GPU: report retained snapshot, texture scratch and upload memory #602

Open
github-bot wants to merge 1 commit from github-bot/gh-602 into main AGit
Owner

@⁠lucaseddd on GitHub · 2026-11-24 05:21 UTC · original
lucaseddd:gpu/retained-copy-memory-471 → main · +55 −3 · 3 files · 1 commits · open

When world loading approaches the system commit limit (#471), the process-wide number cannot show which retained GPU bridge allocations are growing. This adds a diagnostic line with three byte counters: idle shadow snapshots, live texture upload staging allocations, and retained CPU texture-read capacity.

The counters are independent of GPU vendor and VRAM size. Upload allocations are tracked once by allocation lifetime through weak references, so a diagnostic reference cannot keep an allocation alive. The sampler skips a busy sample and runs only with diagnostics enabled. The counters distinguish these components from overall private or system commit and do not change allocation policy.

Validated against main at 940d32f6 on Windows 10 x64:

  • cargo check --locked -p victory-gpu --features diagnostics
  • cargo check --locked -p victory-gpu
  • cargo xtask policy (182 files)

An earlier offline diagnostics run on an RTX 3060 Laptop collected 59 samples during loading. The last sample reported 53.5 MiB in texture uploads, 8 KiB of CPU read capacity, zero idle snapshots and about 11.9 GiB of process private memory. That run ended before a world frame, so it does not establish the cause of #471.

**@⁠lucaseddd** on GitHub · 2026-11-24 05:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/602) `lucaseddd:gpu/retained-copy-memory-471` → `main` · +55 −3 · 3 files · 1 commits · open When world loading approaches the system commit limit (#471), the process-wide number cannot show which retained GPU bridge allocations are growing. This adds a diagnostic line with three byte counters: idle shadow snapshots, live texture upload staging allocations, and retained CPU texture-read capacity. The counters are independent of GPU vendor and VRAM size. Upload allocations are tracked once by allocation lifetime through weak references, so a diagnostic reference cannot keep an allocation alive. The sampler skips a busy sample and runs only with diagnostics enabled. The counters distinguish these components from overall private or system commit and do not change allocation policy. Validated against main at 940d32f6 on Windows 10 x64: - `cargo check --locked -p victory-gpu --features diagnostics` - `cargo check --locked -p victory-gpu` - `cargo xtask policy` (182 files) An earlier offline diagnostics run on an RTX 3060 Laptop collected 59 samples during loading. The last sample reported 53.5 MiB in texture uploads, 8 KiB of CPU read capacity, zero idle snapshots and about 11.9 GiB of process private memory. That run ended before a world frame, so it does not establish the cause of #471.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:09:41 +00:00
Author
Owner

@⁠geiyiliyabumo on GitHub · 2026-11-24 10:56 UTC · original

Independent verification & code review on Windows 11 Pro (build 26100) + AMD Radeon RX 9060 XT (RDNA4, driver 32.0.32029.2010, Rust 1.98.1), cleanly merged onto main (ffe310e):

  • cargo xtask policy: PASS (154 files ok)
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: PASS
  • cargo clippy -p victory-gpu --all-targets --features diagnostics --locked -- -D warnings: PASS
  • cargo test -p victory-gpu --locked: 50 passed, 0 failed, 1 ignored
  • cargo test -p victory-gpu --features diagnostics --locked: 53 passed, 0 failed, 1 ignored

Diff review (copystat.rs, shadow.rs, texture.rs): clean, minimal, and properly gated behind #[cfg(feature = diagnostics)]. Using try_lock() on POOL, STAGING, and each staging.last avoids blocking render/upload work and eliminates any lock-order deadlock risk when sampling retained memory.

AI-assisted; synthetic tests only, no game files.

**@⁠geiyiliyabumo** on GitHub · 2026-11-24 10:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/602#issuecomment-7129445809) Independent verification & code review on Windows 11 Pro (build 26100) + AMD Radeon RX 9060 XT (RDNA4, driver `32.0.32029.2010`, Rust `1.98.1`), cleanly merged onto `main` (`ffe310e`): - `cargo xtask policy`: PASS (`154 files ok`) - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings`: PASS - `cargo clippy -p victory-gpu --all-targets --features diagnostics --locked -- -D warnings`: PASS - `cargo test -p victory-gpu --locked`: **50 passed, 0 failed, 1 ignored** - `cargo test -p victory-gpu --features diagnostics --locked`: **53 passed, 0 failed, 1 ignored** Diff review (`copystat.rs`, `shadow.rs`, `texture.rs`): clean, minimal, and properly gated behind `#[cfg(feature = diagnostics)]`. Using `try_lock()` on `POOL`, `STAGING`, and each `staging.last` avoids blocking render/upload work and eliminates any lock-order deadlock risk when sampling retained memory. *AI-assisted; synthetic tests only, no game files.*
Author
Owner

@⁠lucaseddd on GitHub · 2026-11-24 11:15 UTC · original

Thanks both for verifying this on NVIDIA and AMD. The #472 interaction is useful to have recorded. #472 is still open, so the diagnostics remain based on the current layout. If #472 lands first, the texture-read sample will need to read the single SCRATCH capacity while retaining the non-blocking sample behavior.

**@⁠lucaseddd** on GitHub · 2026-11-24 11:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/602#issuecomment-7129866992) Thanks both for verifying this on NVIDIA and AMD. The #472 interaction is useful to have recorded. #472 is still open, so the diagnostics remain based on the current layout. If #472 lands first, the texture-read sample will need to read the single SCRATCH capacity while retaining the non-blocking sample behavior.
Author
Owner

@⁠lucaseddd on GitHub · 2026-11-24 12:33 UTC · original

Could a maintainer merge this into main if the diagnostics meet the request in #471? The counters are ready on current main. If #472 is scheduled to land first, please let me know here so I can adapt the texture-read counter to the shared scratch buffer.

**@⁠lucaseddd** on GitHub · 2026-11-24 12:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/602#issuecomment-7131595595) Could a maintainer merge this into main if the diagnostics meet the request in #471? The counters are ready on current main. If #472 is scheduled to land first, please let me know here so I can adapt the texture-read counter to the shared scratch buffer.
Author
Owner

@⁠lucaseddd on GitHub · 2026-11-24 20:32 UTC · original

Thanks @⁠DenRakEiw for testing the diagnostics configuration and running Clippy and the policy check. The #471 follow-up also confirms the counters can be sampled alongside #484.

**@⁠lucaseddd** on GitHub · 2026-11-24 20:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/602#issuecomment-7143695176) Thanks @⁠DenRakEiw for testing the diagnostics configuration and running Clippy and the policy check. The #471 follow-up also confirms the counters can be sampled alongside #484.
Author
Owner

@⁠Capi360 on GitHub · 2026-11-24 21:29 UTC · original

Additional Windows startup measurement with the retained-copy counters.

  • Windows 11 Pro build 26200, Ryzen 7 5700X3D, 32 GiB RAM, RTX 3060 Ti 8 GiB, NVIDIA driver 616.56. Native D3D12 diagnostics build on the #1638 NVIDIA stack plus #242 and #431, with the counters adapted for a shared texture read buffer. Exact source revision
  • Last of three retained-memory samples before the opening scene: 0 bytes idle shadow snapshots, 38,153,480 bytes cached texture uploads (36.4 MiB), and 4,096 bytes CPU texture read capacity.
  • At the last system sample, the VIctory process had 12.08 GiB of private memory. System commit headroom was 1.93 GiB, with about 14.7 GiB of physical RAM available. I stopped the test at the 2 GiB commit guard. No device reset was observed in this run.

This corroborates the earlier loading-screen result on a 3060: the measured retained copy buffers explain only a small portion of the startup memory use. These samples do not cover the world or resources outside the counters. The diagnostics build, three watch tests, and asset policy check passed. AI-assisted.

**@⁠Capi360** on GitHub · 2026-11-24 21:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/602#issuecomment-7145001758) Additional Windows startup measurement with the retained-copy counters. - Windows 11 Pro build 26200, Ryzen 7 5700X3D, 32 GiB RAM, RTX 3060 Ti 8 GiB, NVIDIA driver 616.56. Native D3D12 diagnostics build on the #1638 NVIDIA stack plus #242 and #431, with the counters adapted for a shared texture read buffer. [Exact source revision](https://github.com/Capi360/VIctory/commit/8d67d8e049ab5fa0181c2cb79d1cec3694bebaec) - Last of three retained-memory samples before the opening scene: 0 bytes idle shadow snapshots, 38,153,480 bytes cached texture uploads (36.4 MiB), and 4,096 bytes CPU texture read capacity. - At the last system sample, the VIctory process had 12.08 GiB of private memory. System commit headroom was 1.93 GiB, with about 14.7 GiB of physical RAM available. I stopped the test at the 2 GiB commit guard. No device reset was observed in this run. This corroborates the earlier loading-screen result on a 3060: the measured retained copy buffers explain only a small portion of the startup memory use. These samples do not cover the world or resources outside the counters. The diagnostics build, three watch tests, and asset policy check passed. AI-assisted.
Author
Owner

@⁠lucaseddd on GitHub · 2026-11-24 21:52 UTC · original

Updated the branch to main at 70564ae (head 380dab26). Texture uploads now belong to individual host textures, so the sampler tracks each staging allocation once through a weak reference. It counts allocations that remain live through an in-flight owner and skips busy samples without waiting. The upstream watch-lock and snapshot-rate lines remain present. Windows checks with and without diagnostics passed, and cargo xtask policy passed for 174 files.

**@⁠lucaseddd** on GitHub · 2026-11-24 21:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/602#issuecomment-7145507781) Updated the branch to main at 70564ae (head 380dab26). Texture uploads now belong to individual host textures, so the sampler tracks each staging allocation once through a weak reference. It counts allocations that remain live through an in-flight owner and skips busy samples without waiting. The upstream watch-lock and snapshot-rate lines remain present. Windows checks with and without diagnostics passed, and cargo xtask policy passed for 174 files.
Author
Owner

@⁠aycow on GitHub · 2026-11-24 22:40 UTC · original · edited 2026-11-24 22:52 UTC

@⁠Capi360 I reviewed your shared-read scratch measurement at 8d67d8e and the original implementation in 39eba9d. An isolated current-main version on 70564ae passed the tracked refresh and live alias shader controls on AMD and WARP. Across six generated 512² and two 1024² textures, the retained CPU input capacity was 14 MiB with per-texture storage and 4 MiB with a shared buffer. The GPU-visible uploads retained their independent contents. I’m keeping the branch local while we choose the contribution route. Would you prefer to carry the current-main scratch port separately from your retained-copy counters, or have me send the isolated patch for your review?

For the GPU-HOST-MEMORY and FIND-2 claims, a matched current-main loading and world capture would help identify what still consumes memory and whether fallback hashing is material. If your authorized setup can collect it, please share aggregate process private bytes, system commit/headroom, adapter budget/usage, snapshot and texture capacity, and the existing texture refresh totals for watched, hashed and changed bytes by the same frame window. Aggregate measurements are sufficient. The old startup measurement is useful provenance.

AI-assisted using Codex.

The attribution composition also exposed an exact-view accounting error. A 456-byte view backed by a native buffer of width 512 was charged as 65,536 bytes. The current diagnostics package charges 512 and includes live exact-view overlap until its owner releases it. AMD and WARP reproduced the expected capacity and lifetime after correction. The package preserves #602's allocation-lifetime counters and #484's process counters. Resource width remains a separate quantity from driver allocation and residency.

**@⁠aycow** on GitHub · 2026-11-24 22:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/602#issuecomment-7146516568) · edited 2026-11-24 22:52 UTC @⁠Capi360 I reviewed your shared-read scratch measurement at `8d67d8e` and the original implementation in `39eba9d`. An isolated current-main version on `70564ae` passed the tracked refresh and live alias shader controls on AMD and WARP. Across six generated 512² and two 1024² textures, the retained CPU input capacity was 14 MiB with per-texture storage and 4 MiB with a shared buffer. The GPU-visible uploads retained their independent contents. I’m keeping the branch local while we choose the contribution route. Would you prefer to carry the current-main scratch port separately from your retained-copy counters, or have me send the isolated patch for your review? For the GPU-HOST-MEMORY and FIND-2 claims, a matched current-main loading and world capture would help identify what still consumes memory and whether fallback hashing is material. If your authorized setup can collect it, please share aggregate process private bytes, system commit/headroom, adapter budget/usage, snapshot and texture capacity, and the existing texture refresh totals for watched, hashed and changed bytes by the same frame window. Aggregate measurements are sufficient. The old startup measurement is useful provenance. AI-assisted using Codex. The attribution composition also exposed an exact-view accounting error. A 456-byte view backed by a native buffer of width 512 was charged as 65,536 bytes. The current diagnostics package charges 512 and includes live exact-view overlap until its owner releases it. AMD and WARP reproduced the expected capacity and lifetime after correction. The package preserves #602's allocation-lifetime counters and #484's process counters. Resource width remains a separate quantity from driver allocation and residency.
Author
Owner

@⁠aycow on GitHub · 2026-11-24 23:11 UTC · original

@⁠Capi360 The validated patch is available as shared texture read scratch on your #602 head. This combines exact 380dab2 with the isolated scratch change and retains your nonblocking upload attribution. It credits your earlier implementation and the #1076 scratch work. AMD and WARP passed tracked refresh, decommit zero-fill, and the placed-alias shader test. Six 512² and two 1024² inputs required 4 MiB of shared CPU scratch instead of 14 MiB of per-texture capacity. The GPU uploads remained independent.

@⁠Calvix2k If you can collect a matched run on the same authorized Windows 10 Series X and Agility/#1798 setup as your #175 report, the two revisions are attribution-only 1eab79c and attribution with shared scratch dac1953. Use the same cache, title profile, and recorded system commit headroom. With VICTORY_MEMORY_STATS=1, please share aggregate process private bytes, system commit and limit, DXGI budget and use, and shadow, snapshot, staging and scratch capacity over the same pre-failure window around frame 128. We can compare a world window if both runs reach it. No files or dumps are needed. Prior report

AI-assisted using Codex.

**@⁠aycow** on GitHub · 2026-11-24 23:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/602#issuecomment-7147124940) @⁠Capi360 The validated patch is available as [shared texture read scratch on your #602 head](https://github.com/aycow/VIctory/commit/2b396cb774cbe3dc8f3b4fc2aa267e4a6a3ffb24). This combines exact `380dab2` with the isolated scratch change and retains your nonblocking upload attribution. It credits your earlier implementation and the #1076 scratch work. AMD and WARP passed tracked refresh, decommit zero-fill, and the placed-alias shader test. Six 512² and two 1024² inputs required 4 MiB of shared CPU scratch instead of 14 MiB of per-texture capacity. The GPU uploads remained independent. @⁠Calvix2k If you can collect a matched run on the same authorized Windows 10 Series X and Agility/#1798 setup as your #175 report, the two revisions are [attribution-only `1eab79c`](https://github.com/aycow/VIctory/commit/1eab79c13b28fba2c0fb3cebd6f86fe7531d8742) and [attribution with shared scratch `dac1953`](https://github.com/aycow/VIctory/commit/dac1953a6c5ffde084223d66931a73db4f2b302e). Use the same cache, title profile, and recorded system commit headroom. With `VICTORY_MEMORY_STATS=1`, please share aggregate process private bytes, system commit and limit, DXGI budget and use, and shadow, snapshot, staging and scratch capacity over the same pre-failure window around frame 128. We can compare a world window if both runs reach it. No files or dumps are needed. [Prior report](https://git.gtahub.st/github/Marvisak--VIctory/pulls/175) AI-assisted using Codex.
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-24 23:56 UTC · original

@⁠aycow Matched run, revision A = 1eab79c + Agility #175 + #1798 (diag build, VICTORY_MEMORY_STATS=1). Same authorized setup as the #175 report: Windows 10 22H2 19045, Ryzen 7 5800X, RX 7800 XT (driver 32.0.32029.2010), 32 GB, D3D12Core 1.620.2, same cache/data dirs, title 99f876b…. Bytes are decimal.

Series X (--console series-x), pre-failure window — the run ends with Windows commit limit reached while committing 65536 bytes at frame ~130, title breakpoint +0x2474680:

frame s private working set system commit / limit GPU local use / budget GPU non-local shadow (peak) cached shadows native textures (bytes/used) staging (upload/read)
0 0 5,183,528,960 520,433,664 34,314,129,408 / 42,327,384,064 7,839,744 / 16,156,999,680 21,307,392 0 0 0 0
44 3 8,221,978,624 3,792,379,904 44,052,516,864 / 47,178,948,608 553,291,776 / 16,156,999,680 1,572,569,088 212,740,608 22 (212,512,448 guest / 207,357,952 unique) 32 (266,731,520 / 143,982,592) 0 / 0
130 6 10,350,305,280 4,443,979,776 45,900,623,872 / 47,676,006,400 2,163,216,384 / 16,156,999,680 1,991,835,648 631,981,824 locked (None) 791 (1,522,597,888 / 144,637,952) 4 / 4,096

Snapshot, list scratch and list upload were 0 in every sample; idle_snapshot_bytes 0. At the failure the system had ~1.8 GB of commit left, and Victory's own retained pools (shadow 0.63 GB, native textures 1.52 GB capacity / 0.14 GB used, staging ~4 KB) are small next to the process's 10.35 GB private. So the Series X failure here is the OS commit limit (C: pagefile cannot grow: 5.4 GB free), not one of the tracked pools.

Series S, same revision, 20 samples over 57 s (last sample, frame 1655):
private 10,385,784,832; working set 5,490,969,664; commit 43,484,344,320 / 46,939,488,256; GPU local 3,272,552,448 / 16,156,999,680; GPU non-local 2,663,211,008; shadow 1,266,756,864 peak; cached shadows 4,102 (1,064,812,494 guest / 913,442,886 unique); native textures 1,522,597,888 capacity (last line not sampled, texture count moves); texture upload 43,628,192; texture read 43,421,696; snapshots/scratch/upload 0.

Revision B = dac1953 is building now; I will post the same two windows for it next. No files or dumps.

**@⁠Calvix2k** on GitHub · 2026-11-24 23:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/602#issuecomment-7147967893) @⁠aycow Matched run, **revision A = 1eab79c** + Agility #175 + #1798 (diag build, VICTORY_MEMORY_STATS=1). Same authorized setup as the #175 report: Windows 10 22H2 19045, Ryzen 7 5800X, RX 7800 XT (driver 32.0.32029.2010), 32 GB, D3D12Core 1.620.2, same cache/data dirs, title 99f876b…. Bytes are decimal. **Series X (--console series-x), pre-failure window** — the run ends with Windows commit limit reached while committing 65536 bytes at frame ~130, title breakpoint +0x2474680: | frame | s | private | working set | system commit / limit | GPU local use / budget | GPU non-local | shadow (peak) | cached shadows | native textures (bytes/used) | staging (upload/read) | |---|---|---|---|---|---|---|---|---|---|---| | 0 | 0 | 5,183,528,960 | 520,433,664 | 34,314,129,408 / 42,327,384,064 | 7,839,744 / 16,156,999,680 | 21,307,392 | 0 | 0 | 0 | 0 | | 44 | 3 | 8,221,978,624 | 3,792,379,904 | 44,052,516,864 / 47,178,948,608 | 553,291,776 / 16,156,999,680 | 1,572,569,088 | 212,740,608 | 22 (212,512,448 guest / 207,357,952 unique) | 32 (266,731,520 / 143,982,592) | 0 / 0 | | 130 | 6 | 10,350,305,280 | 4,443,979,776 | 45,900,623,872 / 47,676,006,400 | 2,163,216,384 / 16,156,999,680 | 1,991,835,648 | 631,981,824 | locked (None) | 791 (1,522,597,888 / 144,637,952) | 4 / 4,096 | Snapshot, list scratch and list upload were 0 in every sample; idle_snapshot_bytes 0. At the failure the system had ~1.8 GB of commit left, and Victory's own retained pools (shadow 0.63 GB, native textures 1.52 GB capacity / 0.14 GB used, staging ~4 KB) are small next to the process's 10.35 GB private. So the Series X failure here is the **OS commit limit** (C: pagefile cannot grow: 5.4 GB free), not one of the tracked pools. **Series S, same revision, 20 samples over 57 s** (last sample, frame 1655): private 10,385,784,832; working set 5,490,969,664; commit 43,484,344,320 / 46,939,488,256; GPU local 3,272,552,448 / 16,156,999,680; GPU non-local 2,663,211,008; **shadow 1,266,756,864 peak**; cached shadows 4,102 (1,064,812,494 guest / 913,442,886 unique); native textures 1,522,597,888 capacity (last line not sampled, texture count moves); texture upload 43,628,192; texture read 43,421,696; snapshots/scratch/upload 0. Revision B = dac1953 is building now; I will post the same two windows for it next. No files or dumps.
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-24 23:59 UTC · original

@⁠aycow Matched run, revision B = dac1953 (attribution + shared scratch) + Agility #175 + #1798. Same machine, cache, data dirs, title and diagnostic profile as the revision A table above. Bytes are decimal.

Series X (--console series-x) — same end: XMem … mapping physical pages failed … os error 1455 at frame ~142, then the title breakpoint +0x2474680:

frame s private working set system commit / limit GPU local use / budget GPU non-local shadow (peak) cached shadows native textures (bytes/used) staging (upload/read)
0 0 5,183,528,960* 520,433,664* 34,314,129,408 / 42,327,384,064* 7,839,744 / 16,156,999,680* 21,307,392* 0* 0* 0* 0*
52 3 8,180,658,176 3,802,439,680 43,425,431,552 / 46,911,041,536 556,699,648 / 16,156,999,680 1,572,569,088 212,740,608 22 (212,512,448 / 207,357,952) 33 (270,008,320 / 143,982,592) 0 / 0
142 6 10,388,692,992 4,498,919,424 45,563,432,960 / 47,720,468,480 2,163,216,384 / 16,156,999,680 2,082,611,200 722,683,648 locked (None) 791 (1,522,597,888 / 144,637,952) 4 / 4,096

*frame-0 line is the same startup sample in both revisions; I marked it with the A values because the run prints identical numbers there.

Snapshot, list scratch and list upload were 0 in every sample. As with A, the tracked pools are small at the failure (shadow 0.72 GB, native 1.52 GB capacity / 0.14 GB used) and the last 64 KiB fails against the OS commit limit.

Series S, revision B, 20 samples over 57 s (last sample, frame 1660):
private 10,194,096,128; working set 4,983,078,912; commit 42,840,850,432 / 46,809,739,264; GPU local 3,221,667,840 / 16,156,999,680; GPU non-local 2,593,333,248; shadow 1,240,577,280 peak; cached shadows 4,068 (1,039,297,790 guest / 896,878,266 unique); native textures 1,522,597,888 capacity / 144,637,952 used; texture upload 4; texture read 4,096; snapshots/scratch/upload 0.

The one visible A→B difference in this boot window is the texture read/upload attribution: revision A's Series S sample showed texture upload 43,628,192 and texture read 43,421,696, while B shows 4 and 4,096 with the same frame count and window length. If that matches your expectation for shared scratch, the matched pair is here; if not, I can repeat both with a fixed frame window (VICTORY_CAPTURE_FRAMES-style stop at frame 1600) to remove the timing difference.

**@⁠Calvix2k** on GitHub · 2026-11-24 23:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/602#issuecomment-7148019321) @⁠aycow Matched run, **revision B = dac1953** (attribution + shared scratch) + Agility #175 + #1798. Same machine, cache, data dirs, title and diagnostic profile as the revision A table above. Bytes are decimal. **Series X (--console series-x)** — same end: XMem … mapping physical pages failed … os error 1455 at frame ~142, then the title breakpoint +0x2474680: | frame | s | private | working set | system commit / limit | GPU local use / budget | GPU non-local | shadow (peak) | cached shadows | native textures (bytes/used) | staging (upload/read) | |---|---|---|---|---|---|---|---|---|---|---| | 0 | 0 | 5,183,528,960* | 520,433,664* | 34,314,129,408 / 42,327,384,064* | 7,839,744 / 16,156,999,680* | 21,307,392* | 0* | 0* | 0* | 0* | | 52 | 3 | 8,180,658,176 | 3,802,439,680 | 43,425,431,552 / 46,911,041,536 | 556,699,648 / 16,156,999,680 | 1,572,569,088 | 212,740,608 | 22 (212,512,448 / 207,357,952) | 33 (270,008,320 / 143,982,592) | 0 / 0 | | 142 | 6 | 10,388,692,992 | 4,498,919,424 | 45,563,432,960 / 47,720,468,480 | 2,163,216,384 / 16,156,999,680 | 2,082,611,200 | 722,683,648 | locked (None) | 791 (1,522,597,888 / 144,637,952) | 4 / 4,096 | \*frame-0 line is the same startup sample in both revisions; I marked it with the A values because the run prints identical numbers there. Snapshot, list scratch and list upload were 0 in every sample. As with A, the tracked pools are small at the failure (shadow 0.72 GB, native 1.52 GB capacity / 0.14 GB used) and the last 64 KiB fails against the **OS** commit limit. **Series S, revision B, 20 samples over 57 s** (last sample, frame 1660): private 10,194,096,128; working set 4,983,078,912; commit 42,840,850,432 / 46,809,739,264; GPU local 3,221,667,840 / 16,156,999,680; GPU non-local 2,593,333,248; shadow 1,240,577,280 peak; cached shadows 4,068 (1,039,297,790 guest / 896,878,266 unique); native textures 1,522,597,888 capacity / 144,637,952 used; texture upload **4**; texture read **4,096**; snapshots/scratch/upload 0. The one visible A→B difference in this boot window is the texture read/upload attribution: revision A's Series S sample showed texture upload 43,628,192 and texture read 43,421,696, while B shows 4 and 4,096 with the same frame count and window length. If that matches your expectation for shared scratch, the matched pair is here; if not, I can repeat both with a fixed frame window (VICTORY_CAPTURE_FRAMES-style stop at frame 1600) to remove the timing difference.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:23 UTC · original · edited 2026-11-25 16:49 UTC

Automated triage for the maintainers.

Merge candidate.

This adds a diagnostics-only retained copy memory line to copystat::log. It reports three numbers: idle shadow snapshot capacity (shadow::idle_snapshot_bytes, from POOL), texture upload chunks plus large upload buffers (texture::cached_staging_bytes, from CHUNKS and BUFFERS), and idle per-thread read scratch. copystat is already gated on diagnostics, and so is every new counter. The sampler uses try_lock and skips a busy sample rather than blocking. RETAINED_SCRATCH stays balanced: it is added when a buffer is put back in Scratch::drop, and subtracted on take, on replacement and on thread exit (Drop for ScratchCache). Allocation behaviour does not change.

One note: the PR description still mentions tracking uploads through weak references. This head no longer does that, so please update the description.

CI (check) passes on this head.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/602#issuecomment-7149499776) · edited 2026-11-25 16:49 UTC <!-- victory-triage v1 head=663dc8371f156eb3fad14164bcdd8fc0a79db217 verdict=merge-candidate at=2026-11-25T16:48:22Z --> Automated triage for the maintainers. **Merge candidate.** This adds a diagnostics-only `retained copy memory` line to `copystat::log`. It reports three numbers: idle shadow snapshot capacity (`shadow::idle_snapshot_bytes`, from `POOL`), texture upload chunks plus large upload buffers (`texture::cached_staging_bytes`, from `CHUNKS` and `BUFFERS`), and idle per-thread read scratch. `copystat` is already gated on `diagnostics`, and so is every new counter. The sampler uses `try_lock` and skips a busy sample rather than blocking. `RETAINED_SCRATCH` stays balanced: it is added when a buffer is put back in `Scratch::drop`, and subtracted on `take`, on replacement and on thread exit (`Drop for ScratchCache`). Allocation behaviour does not change. One note: the PR description still mentions tracking uploads through weak references. This head no longer does that, so please update the description. CI (`check`) passes on this head. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠aycow on GitHub · 2026-11-25 01:29 UTC · original

@⁠lucaseddd I updated the existing #602 scratch handoff to ccfb029 while retaining your changes. Both strict GPU Clippy configurations, policy and 144 active diagnostics tests passed. The separate attribution build passed the focused synthetic checks on AMD, NVIDIA and WARP with full GPU-based validation. The 8-texture fixture retained 4 MiB of CPU detile scratch versus 14 MiB before sharing and kept its GPU uploads independent. Could you use this scratch change in #602, or would #472 be the better place for it?

@⁠Calvix2k Thanks for the previous matched title runs. The Series S GPU upload gauge moved along with CPU scratch, so that sample cannot isolate the private-commit effect. If you have an authorized test slot, could you compare the current-main counter baseline and shared-scratch build? Use a diagnostics build with VICTORY_MEMORY_STATS=1, the same adapter, title mode and cache state, and matching elapsed-time windows or frame tokens. Aggregate process private commit, system commit and limit, CPU texture-read capacity, GPU texture-upload capacity, and any failure time/code are sufficient. Measurement steps

**@⁠aycow** on GitHub · 2026-11-25 01:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/602#issuecomment-7149598611) @⁠lucaseddd I updated the existing [#602 scratch handoff](https://github.com/aycow/VIctory/commit/27d80a0034c01c8f1cdb0b68fbbd4a39ad1491c2) to `ccfb029` while retaining your changes. Both strict GPU Clippy configurations, policy and 144 active diagnostics tests passed. The separate attribution build passed the focused synthetic checks on AMD, NVIDIA and WARP with full GPU-based validation. The 8-texture fixture retained 4 MiB of CPU detile scratch versus 14 MiB before sharing and kept its GPU uploads independent. Could you use this scratch change in #602, or would #472 be the better place for it? @⁠Calvix2k Thanks for the previous matched title runs. The Series S GPU upload gauge moved along with CPU scratch, so that sample cannot isolate the private-commit effect. If you have an authorized test slot, could you compare the current-main [counter baseline](https://github.com/aycow/VIctory/commit/0e7e05c2fd034571a950926ecfed5fa69b0e8910) and [shared-scratch build](https://github.com/aycow/VIctory/commit/e19a7ed4ba11f44420ab3e27c3e296cb18e534f6)? Use a diagnostics build with `VICTORY_MEMORY_STATS=1`, the same adapter, title mode and cache state, and matching elapsed-time windows or frame tokens. Aggregate process private commit, system commit and limit, CPU texture-read capacity, GPU texture-upload capacity, and any failure time/code are sufficient. [Measurement steps](https://github.com/aycow/VIctory/blob/e19a7ed4ba11f44420ab3e27c3e296cb18e534f6/docs/gpu-bridge-memory.md#title-measurements)
Author
Owner

@⁠lucaseddd on GitHub · 2026-11-25 01:35 UTC · original

I'd keep shared detile scratch in #472. #602 can stay focused on counting what the bridge retains, including live GPU uploads. Keeping the allocation change separate also lets us compare private and system commit at matched frame tokens without treating a change in GPU upload retention as a CPU scratch savings. The synthetic result gives #472 a concrete regression target: shared CPU scratch with independent GPU uploads.

**@⁠lucaseddd** on GitHub · 2026-11-25 01:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/602#issuecomment-7149723198) I'd keep shared detile scratch in #472. #602 can stay focused on counting what the bridge retains, including live GPU uploads. Keeping the allocation change separate also lets us compare private and system commit at matched frame tokens without treating a change in GPU upload retention as a CPU scratch savings. The synthetic result gives #472 a concrete regression target: shared CPU scratch with independent GPU uploads.
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 01:49 UTC · original

@⁠aycow Matched A/B on current main 4118f33 (plus only the Agility opt-in so Windows 10 draws), diagnostics build, VICTORY_MEMORY_STATS=1, --console series-s, same cache/data, title 99f876b…, adapter RX 7800 XT. Both runs: 20 samples, 0–57 s, 1644 / 1645 frames — the windows match. Bytes are decimal.

elapsed s A ␀e7e05c2 private A commit B 19a7ed4 private B commit
0 3,506,622,464 18,446,934,016 3,507,929,088 18,441,555,968
3 7,165,833,216 26,426,138,624 8,659,329,024 27,687,784,448
6 9,010,962,432 28,270,546,944 9,056,886,784 28,071,776,256
9 11,303,440,384 30,827,282,432 11,565,088,768 30,804,180,992
12 11,232,890,880 30,787,145,728 12,827,410,432 32,063,221,760
21 12,523,184,128 31,995,695,104 12,278,067,200 31,668,269,056
30 11,978,571,776 31,203,397,632 12,374,081,536 31,599,362,048
45 11,671,576,576 30,731,046,912 12,463,386,624 31,693,275,136
51 11,652,075,520 30,701,252,608 12,625,420,288 31,891,566,592
54 12,397,813,760 31,432,290,304 12,458,295,296 31,618,867,200
57 12,338,548,736 31,368,818,688 12,646,326,272 31,800,045,568

Shadow, snapshots, scratch and the texture gauges are identical at every matched sample: shadow 1,238,711,808 peak, snapshot 0, list scratch/upload 0, texture upload 4 B, texture read 4,096 B, cached shadows 4,329 (1,037,401,102 guest / 893,261,254 unique).

So in this window shared scratch shows no private-commit benefit (B is ~0.2–0.3 GB higher late, within run-to-run noise). The caveat is the window itself: on main with --console series-s this machine never submits world draws (the black-UI issue #1854), so texture reads never start and the scratch pool is not exercised; the gauges stay at their boot values. A window with active texture reads — or your synthetic fixture — is the fair place to see the 14 MiB → 4 MiB capacity change. If you want, I can rerun the pair with --console series-x and stop both at the same frame, but that profile dies at the commit limit around frame 130 here, before the world either.

**@⁠Calvix2k** on GitHub · 2026-11-25 01:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/602#issuecomment-7149997914) @⁠aycow Matched A/B on **current main 4118f33** (plus only the Agility opt-in so Windows 10 draws), diagnostics build, VICTORY_MEMORY_STATS=1, --console series-s, same cache/data, title 99f876b…, adapter RX 7800 XT. Both runs: 20 samples, 0–57 s, **1644 / 1645 frames** — the windows match. Bytes are decimal. | elapsed s | A ␀e7e05c2 private | A commit | B 19a7ed4 private | B commit | |---|---|---|---|---| | 0 | 3,506,622,464 | 18,446,934,016 | 3,507,929,088 | 18,441,555,968 | | 3 | 7,165,833,216 | 26,426,138,624 | 8,659,329,024 | 27,687,784,448 | | 6 | 9,010,962,432 | 28,270,546,944 | 9,056,886,784 | 28,071,776,256 | | 9 | 11,303,440,384 | 30,827,282,432 | 11,565,088,768 | 30,804,180,992 | | 12 | 11,232,890,880 | 30,787,145,728 | 12,827,410,432 | 32,063,221,760 | | 21 | 12,523,184,128 | 31,995,695,104 | 12,278,067,200 | 31,668,269,056 | | 30 | 11,978,571,776 | 31,203,397,632 | 12,374,081,536 | 31,599,362,048 | | 45 | 11,671,576,576 | 30,731,046,912 | 12,463,386,624 | 31,693,275,136 | | 51 | 11,652,075,520 | 30,701,252,608 | 12,625,420,288 | 31,891,566,592 | | 54 | 12,397,813,760 | 31,432,290,304 | 12,458,295,296 | 31,618,867,200 | | 57 | 12,338,548,736 | 31,368,818,688 | 12,646,326,272 | 31,800,045,568 | Shadow, snapshots, scratch and the texture gauges are identical at every matched sample: shadow 1,238,711,808 peak, snapshot 0, list scratch/upload 0, **texture upload 4 B, texture read 4,096 B**, cached shadows 4,329 (1,037,401,102 guest / 893,261,254 unique). So in this window shared scratch shows **no private-commit benefit** (B is ~0.2–0.3 GB higher late, within run-to-run noise). The caveat is the window itself: on main with --console series-s this machine never submits world draws (the black-UI issue #1854), so texture reads never start and the scratch pool is not exercised; the gauges stay at their boot values. A window with active texture reads — or your synthetic fixture — is the fair place to see the 14 MiB → 4 MiB capacity change. If you want, I can rerun the pair with --console series-x and stop both at the same frame, but that profile dies at the commit limit around frame 130 here, before the world either.
Author
Owner

@⁠lucaseddd on GitHub · 2026-11-25 16:17 UTC · original

Rebased onto 67e8ae1 and pushed 663dc83. GitHub now reports the PR as mergeable.

The rebase accounts for the current ownership of texture memory: upload chunks are counted once, the separate pool includes its free and in-use buffers, and idle per-thread read capacity is removed when the buffer is taken or its thread exits. The upstream ordering of host writes is preserved.

Both strict workspace Clippy configurations and the repository policy check passed. On this Windows host, the three reproducible GPU test failures and the shader test failures were also present on the unmodified base. The two additional timing-sensitive tests seen in the parallel workspace run passed when rerun individually on both the base and this PR. The hosted Windows CI is running on the new head.

**@⁠lucaseddd** on GitHub · 2026-11-25 16:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/602#issuecomment-7167761447) Rebased onto `67e8ae1` and pushed `663dc83`. GitHub now reports the PR as mergeable. The rebase accounts for the current ownership of texture memory: upload chunks are counted once, the separate pool includes its free and in-use buffers, and idle per-thread read capacity is removed when the buffer is taken or its thread exits. The upstream ordering of host writes is preserved. Both strict workspace Clippy configurations and the repository policy check passed. On this Windows host, the three reproducible GPU test failures and the shader test failures were also present on the unmodified base. The two additional timing-sensitive tests seen in the parallel workspace run passed when rerun individually on both the base and this PR. The hosted Windows CI is running on the new head.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 01:27 UTC · original

Code review and RTX 5090 + WARP verification at head 663dc8371f15 merged cleanly onto main (63bcca43c6a0):

  • Feature-gating & accounting audit (shadow.rs:899-903, texture.rs:725-733, 917-924):
    • idle_snapshot_bytes, cached_staging_bytes, RETAINED_SCRATCH, and Drop for ScratchCache stay strictly under #[cfg(feature = "diagnostics")] (default builds retain only zero-overhead ScratchCache(Cell<Vec<u8>>)).
    • Byte accounting across Scratch::take (fetch_sub), Scratch::drop (fetch_add -> replace -> fetch_sub), and thread-exit ScratchCache::drop (fetch_sub) balances exactly without underflow, and try_lock().ok()? ensures diagnostic logging never blocks active uploads/copy-backs.
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy -p victory-gpu --all-targets -- -D warnings (default + --features diagnostics): 0 warnings
    • copystat:: shadow:: texture::: 12/12 passed on both RTX 5090 and WARP (--features diagnostics).

LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 01:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/602#issuecomment-7179785089) Code review and RTX 5090 + WARP verification at head `663dc8371f15` merged cleanly onto `main` (`63bcca43c6a0`): - **Feature-gating & accounting audit (`shadow.rs:899-903`, `texture.rs:725-733, 917-924`)**: - `idle_snapshot_bytes`, `cached_staging_bytes`, `RETAINED_SCRATCH`, and `Drop for ScratchCache` stay strictly under `#[cfg(feature = "diagnostics")]` (default builds retain only zero-overhead `ScratchCache(Cell<Vec<u8>>)`). - Byte accounting across `Scratch::take` (`fetch_sub`), `Scratch::drop` (`fetch_add` -> `replace` -> `fetch_sub`), and thread-exit `ScratchCache::drop` (`fetch_sub`) balances exactly without underflow, and `try_lock().ok()?` ensures diagnostic logging never blocks active uploads/copy-backs. - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default + `--features diagnostics`): 0 warnings - `copystat:: shadow:: texture::`: **12/12 passed** on both RTX 5090 and WARP (`--features diagnostics`). LGTM.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/602/head:github-bot/gh-602'
git switch 'github-bot/gh-602'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-602'
git switch 'github-bot/gh-602'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-602'
git switch 'github-bot/gh-602'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-602'
git switch 'main'
git merge --squash 'github-bot/gh-602'
git switch 'main'
git merge --ff-only 'github-bot/gh-602'
git switch 'main'
git merge 'github-bot/gh-602'
git push origin 'main'
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/Marvisak--VIctory!602
No description provided.