Draws: fresh tables with no constant views are shared by a frame's lists, refcounted (VICTORY_SHARED_TABLES=1) #1715

Merged
101Leafy merged 4 commits from upstream-pr/1715 into main 2026-11-29 08:16:54 +00:00
101Leafy commented 2026-11-28 23:42:46 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by 101Leafy on 2026-11-28T23:42:46Z.


When several of a frame's lists bind the same table, and it has to be made afresh, each list makes its own copy in the dynamic slots and writes every view into it again.

VICTORY_SHARED_TABLES=1 lets a list use the copy another list made this frame. Tables holding constant views are left out, since those bytes belong to the list that copied them. The shared copy is brought up to date the same way a list's own known table is. Its slots are refcounted and go back when the last list using them is done. A test covers the refcounts.

Off by default.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5545723622 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1715). Originally posted by [101Leafy](https://github.com/101Leafy) on 2026-11-28T23:42:46Z. --- When several of a frame's lists bind the same table, and it has to be made afresh, each list makes its own copy in the dynamic slots and writes every view into it again. VICTORY_SHARED_TABLES=1 lets a list use the copy another list made this frame. Tables holding constant views are left out, since those bytes belong to the list that copied them. The shared copy is brought up to date the same way a list's own known table is. Its slots are refcounted and go back when the last list using them is done. A test covers the refcounts. Off by default.
lorddie commented 2026-11-29 14:36:18 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by lorddie on 2026-11-29T14:36:18Z.


Measurements on AMD (RX 9070 XT, Ryzen 5 5600X, Windows 11), busy city spot. Our fork is VIctory-7900XTX-based, not this tree; VICTORY_SHARED_TABLES and the State::tables stages were ported by hand.

  • With VICTORY_CALL_STATS=1: bind.tables is ~17,500 calls/frame at 15–17 µs, ~250–300 ms of the recording threads per frame. Of it, tables.new ~15,600/frame at ~12 µs (~185 ms), tables.hit ~10,600/frame at ~2.2 µs (~24 ms), tables.direct ~70 ms. Same picture as tikD1337's NVIDIA numbers.
  • Every fresh table in this title holds a constant view: 15,600 of 15,600 per frame. Made before in the same frame at the same table with the same records: ~37/frame, all with a constant view. Same records at any table: ~2,100/frame (13%), also all with a constant view.
  • So VICTORY_SHARED_TABLES never finds a table to share here. A/B in one run (20 s phases, ~8,800 draws/frame): 63.9 ms on vs 63.0 ms off, fresh tables unchanged.

If this holds on your side too, whole-table reuse can't help this title. Reusing a table's non-constant entries and writing only the constant views per draw might. We're measuring where a fresh table's 12 µs go (constant views vs made views vs readable) and will post it.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7257432990 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1715#issuecomment-7257432990). Originally posted by [lorddie](https://github.com/lorddie) on 2026-11-29T14:36:18Z. --- **Measurements on AMD (RX 9070 XT, Ryzen 5 5600X, Windows 11), busy city spot.** Our fork is VIctory-7900XTX-based, not this tree; `VICTORY_SHARED_TABLES` and the `State::tables` stages were ported by hand. - With `VICTORY_CALL_STATS=1`: `bind.tables` is ~17,500 calls/frame at 15–17 µs, ~250–300 ms of the recording threads per frame. Of it, `tables.new` ~15,600/frame at ~12 µs (~185 ms), `tables.hit` ~10,600/frame at ~2.2 µs (~24 ms), `tables.direct` ~70 ms. Same picture as tikD1337's NVIDIA numbers. - **Every fresh table in this title holds a constant view: 15,600 of 15,600 per frame.** Made before in the same frame at the same table with the same records: ~37/frame, all with a constant view. Same records at any table: ~2,100/frame (13%), also all with a constant view. - So `VICTORY_SHARED_TABLES` never finds a table to share here. A/B in one run (20 s phases, ~8,800 draws/frame): 63.9 ms on vs 63.0 ms off, fresh tables unchanged. If this holds on your side too, whole-table reuse can't help this title. Reusing a table's non-constant entries and writing only the constant views per draw might. We're measuring where a fresh table's 12 µs go (constant views vs made views vs readable) and will post it.
lorddie commented 2026-11-29 15:04:59 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by lorddie on 2026-11-29T15:04:59Z.


Follow-up, same setup (RX 9070 XT, 5600X), where a fresh table's time goes: of ~310 ms/frame in bind.tables, ~135 ms is entries the list already made (the make_listed path), ~89,000 a frame at 1.5 µs, 5–6 per table. Constant views are only ~19 ms (22,000 at 0.9 µs), views made anew are negligible, readable on buffers ~41 ms, tables.direct ~61 ms. So the cost is copying known views one by one into each of ~16,000 runs, not the constants. A per-list template (same non-constant records → one block copy, then only the constant slots written) looks like the lever. CPU balance per frame here: title threads ~250 ms, list translation ~470 ms, rest of the layer ~110–140 ms; card idle 38–44 ms of a ~62 ms frame.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7257805669 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1715#issuecomment-7257805669). Originally posted by [lorddie](https://github.com/lorddie) on 2026-11-29T15:04:59Z. --- Follow-up, same setup (RX 9070 XT, 5600X), where a fresh table's time goes: of ~310 ms/frame in `bind.tables`, ~135 ms is entries the list already made (the `make_listed` path), ~89,000 a frame at 1.5 µs, 5–6 per table. Constant views are only ~19 ms (22,000 at 0.9 µs), views made anew are negligible, `readable` on buffers ~41 ms, `tables.direct` ~61 ms. So the cost is copying known views one by one into each of ~16,000 runs, not the constants. A per-list template (same non-constant records → one block copy, then only the constant slots written) looks like the lever. CPU balance per frame here: title threads ~250 ms, list translation ~470 ms, rest of the layer ~110–140 ms; card idle 38–44 ms of a ~62 ms frame.
lorddie commented 2026-11-29 22:11:01 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by lorddie on 2026-11-29T22:11:01Z.


Black ground / black signs up close: what we ruled out and what we know (RX 9070 XT, Windows)

We added a pixel-history diagnostic of our own (diagnostics builds only): with VICTORY_PIXEL=x,y;... and a capture, the colour targets' pixels at those points are copied before every draw of the captured frames, giving frame-<n>-pixels.txt (draw line, list, target, value).

Findings:

  • The sign is always written by the same G-buffer draw. In good frames it writes the albedo; in bad frames the same draw, with the same bindings, writes albedo 0 while normals and the other channels are fine. So it samples an empty texture, picked by index from the descriptor heap.
  • The ground up close is never written to any G-buffer target by any draw, though its depth is there.
  • Tested with no effect: skipping the deferred-decal pixel shaders that write the G-buffer through UAVs; EQUAL depth tests loosened to GREATER_EQUAL (512+ pipelines); VICTORY_KEEP_SHOWN=2; VICTORY_HELD_LEVELS=0; running the 929 indirect computes/frame left out by the CS_RaytracingResolve name match (VICTORY_RT_RESOLVE=1); VICTORY_MAPPED_BY_VIEWS=0.
  • The runtime's views and Windows always agree on which texture memory is mapped (0 disagreements in a whole session). Yet textures shown "after waiting for memory" wait 12–29 s on average, with 99% over 32 s.

Our current suspicion is the streaming path that fills that memory (DirectStorage destinations). If anyone has seen sharper texture levels whose memory never gets mapped, we'd be glad to compare notes.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7263470244 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1715#issuecomment-7263470244). Originally posted by [lorddie](https://github.com/lorddie) on 2026-11-29T22:11:01Z. --- **Black ground / black signs up close: what we ruled out and what we know (RX 9070 XT, Windows)** We added a pixel-history diagnostic of our own (diagnostics builds only): with `VICTORY_PIXEL=x,y;...` and a capture, the colour targets' pixels at those points are copied before every draw of the captured frames, giving `frame-<n>-pixels.txt` (draw line, list, target, value). Findings: - The sign is always written by the same G-buffer draw. In good frames it writes the albedo; in bad frames the same draw, with the same bindings, writes albedo 0 while normals and the other channels are fine. So it samples an empty texture, picked by index from the descriptor heap. - The ground up close is never written to any G-buffer target by any draw, though its depth is there. - Tested with no effect: skipping the deferred-decal pixel shaders that write the G-buffer through UAVs; EQUAL depth tests loosened to GREATER_EQUAL (512+ pipelines); `VICTORY_KEEP_SHOWN=2`; `VICTORY_HELD_LEVELS=0`; running the 929 indirect computes/frame left out by the `CS_RaytracingResolve` name match (`VICTORY_RT_RESOLVE=1`); `VICTORY_MAPPED_BY_VIEWS=0`. - The runtime's views and Windows always agree on which texture memory is mapped (0 disagreements in a whole session). Yet textures shown "after waiting for memory" wait 12–29 s on average, with 99% over 32 s. Our current suspicion is the streaming path that fills that memory (DirectStorage destinations). If anyone has seen sharper texture levels whose memory never gets mapped, we'd be glad to compare notes.
Sign in to join this conversation.
No reviewers
No labels
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.

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