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

Manually merged
github merged 4 commits from github-bot/gh-1715 into main 2026-11-29 08:21:40 +00:00 AGit
Owner

@⁠101Leafy on GitHub · 2026-11-28 23:42 UTC · original
101Leafy:nv/shared-tables → main · +171 −21 · 11 files · 4 commits · merged 2026-11-29 08:16 UTC

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.

**@⁠101Leafy** on GitHub · 2026-11-28 23:42 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1715) `101Leafy:nv/shared-tables` → `main` · +171 −21 · 11 files · 4 commits · merged 2026-11-29 08:16 UTC 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 23:46:59 +00:00
github-bot force-pushed github-bot/gh-1715 from 986afd05cc to 50e82e3617 2026-11-29 01:47:22 +00:00 Compare
github manually merged commit 20ef343a22 into main 2026-11-29 08:21:40 +00:00
Author
Owner

@⁠lorddie on GitHub · 2026-11-29 14:36 UTC · original

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** on GitHub · 2026-11-29 14:36 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1715#issuecomment-7257432990) **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.
Author
Owner

@⁠lorddie on GitHub · 2026-11-29 15:04 UTC · original

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** on GitHub · 2026-11-29 15:04 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1715#issuecomment-7257805669) 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.
Author
Owner

@⁠lorddie on GitHub · 2026-11-29 22:11 UTC · original

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.

**@⁠lorddie** on GitHub · 2026-11-29 22:11 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1715#issuecomment-7263470244) **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.
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!1715
No description provided.