Memory line: tell dead render-target copies from held ones (#791) #803

Manually merged
github merged 1 commit from github-bot/gh-803 into main 2026-11-28 19:42:37 +00:00 AGit
Owner

@⁠kibagami-nc on GitHub · 2026-11-28 06:21 UTC · original
kibagami-nc:diag/target-copies-census → main · +77 −5 · 2 files · 1 commits · merged 2026-11-28 19:39 UTC

Adds the counters CuteBooty suggested in #791. They tell dead render-target host copies apart from the ones the title still holds, before any policy is picked.

Why

The host copies of textures the host renders to or writes are released only when the title releases its texture. The sweep never takes them, by design. On an RTX 3070 8 GB, they grew from about 197 MB to about 1.6 GB over a session, and late in the session interiors came up black (#791).

The census line can say how many there are and how big they are. It cannot say whether they are dead weight or targets the title holds, and that decides what a fix can do.

The change

Diagnostics only. Nothing changes outside the counts.

  • targets_census also counts, of the copies the host renders to or writes:

    • those whose title memory has a newer target now. The title made another target at the same address after them. TARGETS_AT already holds the newest target at each address, and superseded compares against it.
    • those whose title memory is not mapped now, placed or not. Before, only PLACED_TEXTURES ones were asked.
  • TARGET_TEXTURES counts two things since the start: title textures the host renders to or writes that the title made, and those it released.

  • The memory line prints the four numbers after the existing census. A line now ends like this:

    ... Of the first, 412 whose title memory has a newer target now 690 MB and 0 whose title memory is not mapped now, placed or not, 0 MB; title textures the host renders to or writes since the start: 1930 made, 915 released
    

    (The figures here are an illustration, not a measurement.)

  • TARGETS_AT is copied before the textures' lock is taken, so the census never holds both locks together.

How to read it, per #791:

  • First two numbers rise with the copies alive: those are dead copies, and a pass under pressure could release them.
  • Made stops after world entry and released stays near zero: the title holds its targets, and the question becomes what to do with live targets on small cards.

Tests

  • New test resource::tests::a_target_with_a_newer_one_at_its_memory_is_superseded. It makes a target, then a second target at the first one's memory (create_at_address). The older one counts as superseded, the newer one does not, and another address does not. Both count as made, then as released.
    • It fails when superseded always answers no.
    • It runs in the default build too, so CI runs it.
  • cargo test -p victory-gpu --lib --locked: 454 passed. With --features diagnostics, the resource tests pass (22).
  • Clippy (default and --all-features) shows nothing in the changed files. Main's own lints are in #665.

Not run with the game here.

Checked by others

CuteBooty ran these counters on an RTX 3070 8 GB (Series S, DLSS performance), in one unattended run that stood still for 11 minutes after world entry. Read with the guide above:

  • Held, not dead. Targets made minus released was 1,184 on every line from minute 1 to the end: each new target was matched by a release. The host held copies of 696 of the 1,203 made.
  • The dead share is small. Copies with a newer target at their memory peaked at 28 (49 MB of 1,055 MB). Copies whose memory is not mapped were 0 on all 137 lines.
  • The growth after entry looks like first use. Copies went from 631 to 696 (963 to 1,055 MB) while only 13 new targets were made.
  • No cost seen. Four 12-minute runs on the same save, without, with, with and without this change: every number of the two runs with it (frame time 59.3 and 56.9 ms, preparing 32.0 and 32.4 ms, peak private bytes 20,474 and 20,074 MB) lies within or below the range of the two without (58.3 and 67.2 ms, 31.2 and 34.1 ms, 20,363 and 20,684 MB). That is four runs standing still, not a measure of a small cost.

A play session through new interiors is next on that card.

**@⁠kibagami-nc** on GitHub · 2026-11-28 06:21 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/803) `kibagami-nc:diag/target-copies-census` → `main` · +77 −5 · 2 files · 1 commits · merged 2026-11-28 19:39 UTC Adds the counters CuteBooty suggested in #791. They tell dead render-target host copies apart from the ones the title still holds, before any policy is picked. ## Why The host copies of textures the host renders to or writes are released only when the title releases its texture. The sweep never takes them, by design. On an RTX 3070 8 GB, they grew from about 197 MB to about 1.6 GB over a session, and late in the session interiors came up black (#791). The census line can say how many there are and how big they are. It cannot say whether they are dead weight or targets the title holds, and that decides what a fix can do. ## The change Diagnostics only. Nothing changes outside the counts. - `targets_census` also counts, of the copies the host renders to or writes: - **those whose title memory has a newer target now.** The title made another target at the same address after them. `TARGETS_AT` already holds the newest target at each address, and `superseded` compares against it. - **those whose title memory is not mapped now, placed or not.** Before, only `PLACED_TEXTURES` ones were asked. - `TARGET_TEXTURES` counts two things since the start: title textures the host renders to or writes that the title made, and those it released. - The memory line prints the four numbers after the existing census. A line now ends like this: ``` ... Of the first, 412 whose title memory has a newer target now 690 MB and 0 whose title memory is not mapped now, placed or not, 0 MB; title textures the host renders to or writes since the start: 1930 made, 915 released ``` (The figures here are an illustration, not a measurement.) - `TARGETS_AT` is copied before the textures' lock is taken, so the census never holds both locks together. How to read it, per #791: - **First two numbers rise with the copies alive:** those are dead copies, and a pass under pressure could release them. - **Made stops after world entry and released stays near zero:** the title holds its targets, and the question becomes what to do with live targets on small cards. ## Tests - **New test `resource::tests::a_target_with_a_newer_one_at_its_memory_is_superseded`.** It makes a target, then a second target at the first one's memory (`create_at_address`). The older one counts as superseded, the newer one does not, and another address does not. Both count as made, then as released. - It fails when `superseded` always answers no. - It runs in the default build too, so CI runs it. - **`cargo test -p victory-gpu --lib --locked`**: 454 passed. With `--features diagnostics`, the `resource` tests pass (22). - **Clippy** (default and `--all-features`) shows nothing in the changed files. Main's own lints are in #665. Not run with the game here. ## Checked by others **CuteBooty** ran these counters on an RTX 3070 8 GB (Series S, DLSS performance), in one unattended run that stood still for 11 minutes after world entry. Read with the guide above: - **Held, not dead.** Targets made minus released was 1,184 on every line from minute 1 to the end: each new target was matched by a release. The host held copies of 696 of the 1,203 made. - **The dead share is small.** Copies with a newer target at their memory peaked at 28 (49 MB of 1,055 MB). Copies whose memory is not mapped were 0 on all 137 lines. - **The growth after entry looks like first use.** Copies went from 631 to 696 (963 to 1,055 MB) while only 13 new targets were made. - **No cost seen.** Four 12-minute runs on the same save, without, with, with and without this change: every number of the two runs with it (frame time 59.3 and 56.9 ms, preparing 32.0 and 32.4 ms, peak private bytes 20,474 and 20,074 MB) lies within or below the range of the two without (58.3 and 67.2 ms, 31.2 and 34.1 ms, 20,363 and 20,684 MB). That is four runs standing still, not a measure of a small cost. A play session through new interiors is next on that card.
The host copies of textures the host renders to or writes are let go
only when the title releases its texture: on an 8 GB card they grew by
1.4 GB over a session, and the census could not say whether the title
still holds them or they are dead weight (#791, CuteBooty's
suggestion).

targets_census now also counts, of those copies:
- the ones whose title memory has a newer target now: the title made
  another target at the same address after them (TARGETS_AT holds the
  newest at each address; superseded);
- the ones whose title memory is not mapped now, placed or not (before,
  only placed ones were asked).

And two counts since the start, TARGET_TEXTURES: title textures the
host renders to or writes made, and released by the title. The memory
line (diagnostics) prints the four numbers after the census.

A copy of TARGETS_AT is taken before the textures' lock, so the two are
never held together. Nothing changes outside the counts.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 06:23:51 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-28 07:10 UTC · original · approved these changes

Tested locally merged onto main (63b902f).

  • Merge & Policy: Clean merge; cargo xtask policy passed (294 files ok).
  • Tests (RTX 5090):
    • cargo test -p victory-gpu --lib resource:: passed (21 passed; 0 failed).
    • cargo test -p victory-gpu --features diagnostics --lib resource:: passed (22 passed; 0 failed, including the new an_alias_source_is_held_after_the_title_releases_it test).

Clear diagnostic separation between superseded/dead copies and live held alias sources. LGTM.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-28 07:10 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/803#pullrequestreview-6096420947) · **approved these changes** Tested locally merged onto `main` (`63b902f`). - **Merge & Policy**: Clean merge; `cargo xtask policy` passed (`294 files ok`). - **Tests (RTX 5090)**: - `cargo test -p victory-gpu --lib resource::` passed (`21 passed; 0 failed`). - `cargo test -p victory-gpu --features diagnostics --lib resource::` passed (`22 passed; 0 failed`, including the new `an_alias_source_is_held_after_the_title_releases_it` test). Clear diagnostic separation between superseded/dead copies and live held alias sources. LGTM. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠CuteBooty on GitHub · 2026-11-28 09:25 UTC · original

I ran this in the game on an RTX 3070 8 GB (driver 621.24), a Ryzen 7 5800X3D, 32 GB and Windows 11 build 26200. The build was main 63b902fe plus my local patches, with this PR applied as is (diagnostics feature). Settings: Series S, DLSS performance, no frame generation.

Setup: four unattended 12-minute runs on the same save. Each loaded the save and then stood still. The run order was without, with, with, without this PR.

Result:

  • All four runs were stopped after 12 minutes, with no crash signs in the logs.
  • Warnings: of 18 warning and error kinds, 17 appeared in every run and 16 had identical counts in all four.
    • "a texture picked by index changed after its upload" varied: 92 and 115 without the PR, 150 and 200 with it. Both runs with the PR had higher counts, but four runs don't show that the PR is the cause.
    • "shaders touched pages that had no copy" appeared only in the first run (125, without the PR), and in none of the other three.
Run PR Frame ms Preparing ms GPU ms Peak private MB
1 without 58.3 31.2 11.2 20363
2 with 59.3 32.0 11.9 20474
3 with 56.9 32.4 8.7 20074
4 without 67.2 34.1 15.7 20684

Every number of the two runs with the PR lies within, or below, the range of the two runs without it. These runs show no consistent increase that could be put down to the census. That is four runs standing still, not a measurement of a small cost.

What the new counters said is in #791 (#791). In short, standing still, the title holds its targets. Made minus released was flat at 1184, and only 4.6% of the copies' MB had a newer target at their memory. Not mapped was 0.

(Unattended standing-still runs without frame generation. Measurements and text prepared with my AI assistants, Claude Code and Codex. No game files.)

**@⁠CuteBooty** on GitHub · 2026-11-28 09:25 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/803#issuecomment-7237232551) I ran this in the game on an RTX 3070 8 GB (driver 621.24), a Ryzen 7 5800X3D, 32 GB and Windows 11 build 26200. The build was main 63b902fe plus my local patches, with this PR applied as is (diagnostics feature). Settings: Series S, DLSS performance, no frame generation. **Setup:** four unattended 12-minute runs on the same save. Each loaded the save and then stood still. The run order was without, with, with, without this PR. **Result:** - All four runs were stopped after 12 minutes, with no crash signs in the logs. - **Warnings:** of 18 warning and error kinds, 17 appeared in every run and 16 had identical counts in all four. - "a texture picked by index changed after its upload" varied: 92 and 115 without the PR, 150 and 200 with it. Both runs with the PR had higher counts, but four runs don't show that the PR is the cause. - "shaders touched pages that had no copy" appeared only in the first run (125, without the PR), and in none of the other three. | Run | PR | Frame ms | Preparing ms | GPU ms | Peak private MB | |---|---|---:|---:|---:|---:| | 1 | without | 58.3 | 31.2 | 11.2 | 20363 | | 2 | with | 59.3 | 32.0 | 11.9 | 20474 | | 3 | with | 56.9 | 32.4 | 8.7 | 20074 | | 4 | without | 67.2 | 34.1 | 15.7 | 20684 | Every number of the two runs with the PR lies within, or below, the range of the two runs without it. These runs show no consistent increase that could be put down to the census. That is four runs standing still, not a measurement of a small cost. What the new counters said is in #791 (https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/issues/791). In short, standing still, the title holds its targets. Made minus released was flat at 1184, and only 4.6% of the copies' MB had a newer target at their memory. Not mapped was 0. (Unattended standing-still runs without frame generation. Measurements and text prepared with my AI assistants, Claude Code and Codex. No game files.)
github-bot referenced this pull request from a commit 2026-11-28 19:41:56 +00:00
github manually merged commit 0e1e52cbb8 into main 2026-11-28 19:42:37 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!803
No description provided.