Descriptors: every slot of a table a draw binds counts as a table's slot (VICTORY_TABLED_ALL=1, off by default): 84-96 -> 55-59 ms a frame in the prologue's cell #1414

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

@⁠KyleS98 on GitHub · 2026-11-26 23:58 UTC · original
KyleS98:perf/tabled-table-slots → main · +48 −5 · 2 files · 1 commits · open

Summary

One opt-in switch, VICTORY_TABLED_ALL=1 (off by default): every slot of a table a draw binds counts as a table's slot, whatever it holds, not only the slots that hold texture views. Nothing changes without the switch.

In the prologue's cell on main it took the frame from 84–96 ms to 55–59 ms on an RTX 3090 Ti (table below).

Why

The title writes its per-draw tables into its heap as bytes, every frame. A table that holds a constant buffer is made afresh for its draw in slots of our own, so the title's own slots of it are read by nothing unless a shader picks them by index.

The pass over records copied in as bytes (sync_heaps) cannot know that. It already leaves a table's texture slots to the draws that read them (tabled_lately), but takes every other changed record there for one a shader may pick by index:

  • on the submitting thread, each such buffer view is "left for later" (its host slot made null, the buffer sets and the stride table updated);
  • on a recording thread, the once-a-frame pass over buffer views picked by index (State::heap_buffers) then makes each of them and looks at its memory.

I found it with a counter of what HostHeap::mirror does by kind (on another tree, not in this PR): of about 19,500 records the pass took a frame, 11,400 were buffer views left for later, 3,700 were slots made null, 3,100 were no view over a slot that showed nothing, and 1,300 were texture views it made.

What changes

  • HostHeap::table_slot(index): stamps a title slot as a table's (the same stamp texture_slot_tabled writes, without the "read" bit and without touching the texture queue). It does nothing unless the switch is on.
  • State::table_entry (tables read in place) calls it for an entry that is no texture view, and for an entry that is no view at all.
  • The loop that makes a table afresh calls it for each of the title's own slots of the table.

The pass over copied records then skips those slots exactly as it skips a table's texture slots, for TABLED_FRAMES. 48 lines added, 5 removed, two files.

Measurements

main 4c60466 with #798 on top (the Series S profile needs it to show the world) and two commits that do not touch this code (which card to render on in a two-card PC; the skip list looked up in a set). RTX 3090 Ti 24 GB, Ryzen 9 9950X3D, 64 GB, Windows 11 26200. Series S profile, diagnostics build, warm shader cache, the prologue's cell, hands-off, 5.5 minutes each. One build; the switch is the only difference between the two runs.

Switches in both: INDIRECT_WINDOW JOIN_PARTS BACK_OWN_VIEW INDIRECT_GATHER CARD_REHASH_RUNS LEVELS_ON_DEMAND ASYNC_SUBMIT QUEUE2 TEXTURE_NO_WAIT COPY_PLAIN FILLS_PLAIN ABSENT_ONCE at 1, ABSENT_MS=told MERGE_GAP=64 MERGE_RUNS=4096 STAGING_POOL=0 CARD_BUFFERS_MIN_KB=64 CARD_BUFFERS_MB=1280, and the ray-tracing resolve and traced-shadow shaders of #1268's list in VICTORY_SKIP_PIPELINES.

per frame off VICTORY_TABLED_ALL=1
frame (frame line, last readings) 84–96 ms 55–59 ms
records the pass mirrors 18,645 213
slots left to the draws that read them through tables 62,328 145,624
the pass (sync_heaps) 17.0 ms 3.0 ms
"heap buffers" on the frame line 29–33 ms 8–12 ms
card busy (the corner counter) 45–57 % 82–90 %
exceptions, device loss none none

A third run of the same build with the switch off (it had another, unrelated switch on that changed nothing) read 84–88 ms, so the baseline is not one slow run.

On another tree (#994's head with #911 and #868; the frame there was limited by the submitting thread, not by recording) the same change took the frame from 60 to 53 ms, the pass from 13.8 to 2.3 ms and the buffer slots looked at from 29,400 to 6,500 a frame.

Picture: in the cell the same with and without, on both trees (four frames of each run side by side). The cutscene before the cell has main's known faults in both runs here (black first screens, a broken face); its frames fall at different moments in each run, so I did not compare them one to one.

Risk, and why it is off by default

It widens a rule that already has a known weakness. tabled_lately skips a slot for 240 frames after it was last a table's, and does not see a slot that stops being read through a table and is then picked by index: #827 describes that for texture slots (and proposes a shorter, read-based window). With this switch the same holds for the other slots of a table.

For buffer views there is a second net: the pass over buffer views, in its default form, looks at every slot it knows again every 16 passes, so a slot it has seen once is brought up to date within 16 frames. A slot stamped before the pass ever saw it has no such net.

I have run it in one scene only (the opening cutscene and the cell). It should be looked at in the open world and with skinned characters in view before it is anyone's default.

How this relates to open PRs

  • #467 / #523 and #1043 make the two passes cheaper per slot. This takes the slots out of them. They should compose; I have not tried them together.
  • #827's read-based window would bound the risk above for both kinds of slot.

Verification

  • cargo clippy -p victory-gpu --all-targets: no warnings.
  • cargo test -p victory-gpu --lib descriptor: 39 passed.
  • cargo xtask policy reports the two oversized files it reports on main (host.rs, lower.rs); this PR touches neither.
  • In the game: the two runs above on main, and about a dozen 6-minute runs with the switch on on the other tree, none with an exception or a lost device.

Numbers and text only: no game data, captures or screenshots.

AI-assisted (Claude Code, Claude Fable 5.2).

**@⁠KyleS98** on GitHub · 2026-11-26 23:58 UTC · [original](https://github.com/fxceless/victory-fork/pull/1414) `KyleS98:perf/tabled-table-slots` → `main` · +48 −5 · 2 files · 1 commits · open ## Summary One opt-in switch, `VICTORY_TABLED_ALL=1` (off by default): every slot of a table a draw binds counts as a table's slot, whatever it holds, not only the slots that hold texture views. Nothing changes without the switch. In the prologue's cell on `main` it took the frame from 84–96 ms to 55–59 ms on an RTX 3090 Ti (table below). ## Why The title writes its per-draw tables into its heap as bytes, every frame. A table that holds a constant buffer is made afresh for its draw in slots of our own, so the title's own slots of it are read by nothing unless a shader picks them by index. The pass over records copied in as bytes (`sync_heaps`) cannot know that. It already leaves a table's **texture** slots to the draws that read them (`tabled_lately`), but takes every other changed record there for one a shader may pick by index: - on the submitting thread, each such buffer view is "left for later" (its host slot made null, the buffer sets and the stride table updated); - on a recording thread, the once-a-frame pass over buffer views picked by index (`State::heap_buffers`) then makes each of them and looks at its memory. I found it with a counter of what `HostHeap::mirror` does by kind (on another tree, not in this PR): of about 19,500 records the pass took a frame, 11,400 were buffer views left for later, 3,700 were slots made null, 3,100 were no view over a slot that showed nothing, and 1,300 were texture views it made. ## What changes - `HostHeap::table_slot(index)`: stamps a title slot as a table's (the same stamp `texture_slot_tabled` writes, without the "read" bit and without touching the texture queue). It does nothing unless the switch is on. - `State::table_entry` (tables read in place) calls it for an entry that is no texture view, and for an entry that is no view at all. - The loop that makes a table afresh calls it for each of the title's own slots of the table. The pass over copied records then skips those slots exactly as it skips a table's texture slots, for `TABLED_FRAMES`. 48 lines added, 5 removed, two files. ## Measurements `main` `4c60466` with #798 on top (the Series S profile needs it to show the world) and two commits that do not touch this code (which card to render on in a two-card PC; the skip list looked up in a set). RTX 3090 Ti 24 GB, Ryzen 9 9950X3D, 64 GB, Windows 11 26200. Series S profile, diagnostics build, warm shader cache, the prologue's cell, hands-off, 5.5 minutes each. One build; the switch is the only difference between the two runs. Switches in both: `INDIRECT_WINDOW JOIN_PARTS BACK_OWN_VIEW INDIRECT_GATHER CARD_REHASH_RUNS LEVELS_ON_DEMAND ASYNC_SUBMIT QUEUE2 TEXTURE_NO_WAIT COPY_PLAIN FILLS_PLAIN ABSENT_ONCE` at 1, `ABSENT_MS=told MERGE_GAP=64 MERGE_RUNS=4096 STAGING_POOL=0 CARD_BUFFERS_MIN_KB=64 CARD_BUFFERS_MB=1280`, and the ray-tracing resolve and traced-shadow shaders of #1268's list in `VICTORY_SKIP_PIPELINES`. | per frame | off | `VICTORY_TABLED_ALL=1` | |---|---:|---:| | frame (frame line, last readings) | 84–96 ms | **55–59 ms** | | records the pass mirrors | 18,645 | 213 | | slots left to the draws that read them through tables | 62,328 | 145,624 | | the pass (`sync_heaps`) | 17.0 ms | 3.0 ms | | "heap buffers" on the frame line | 29–33 ms | 8–12 ms | | card busy (the corner counter) | 45–57 % | 82–90 % | | exceptions, device loss | none | none | A third run of the same build with the switch off (it had another, unrelated switch on that changed nothing) read 84–88 ms, so the baseline is not one slow run. On another tree (#994's head with #911 and #868; the frame there was limited by the submitting thread, not by recording) the same change took the frame from 60 to 53 ms, the pass from 13.8 to 2.3 ms and the buffer slots looked at from 29,400 to 6,500 a frame. **Picture:** in the cell the same with and without, on both trees (four frames of each run side by side). The cutscene before the cell has `main`'s known faults in both runs here (black first screens, a broken face); its frames fall at different moments in each run, so I did not compare them one to one. ## Risk, and why it is off by default It widens a rule that already has a known weakness. `tabled_lately` skips a slot for 240 frames after it was last a table's, and does not see a slot that stops being read through a table and is then picked by index: #827 describes that for texture slots (and proposes a shorter, read-based window). With this switch the same holds for the other slots of a table. For buffer views there is a second net: the pass over buffer views, in its default form, looks at every slot it knows again every 16 passes, so a slot it has seen once is brought up to date within 16 frames. A slot stamped before the pass ever saw it has no such net. I have run it in one scene only (the opening cutscene and the cell). It should be looked at in the open world and with skinned characters in view before it is anyone's default. ## How this relates to open PRs - #467 / #523 and #1043 make the two passes cheaper per slot. This takes the slots out of them. They should compose; I have not tried them together. - #827's read-based window would bound the risk above for both kinds of slot. ## Verification - `cargo clippy -p victory-gpu --all-targets`: no warnings. - `cargo test -p victory-gpu --lib descriptor`: 39 passed. - `cargo xtask policy` reports the two oversized files it reports on `main` (`host.rs`, `lower.rs`); this PR touches neither. - In the game: the two runs above on `main`, and about a dozen 6-minute runs with the switch on on the other tree, none with an exception or a lost device. Numbers and text only: no game data, captures or screenshots. AI-assisted (Claude Code, Claude Fable 5.2).
The title writes its per-draw tables into its heap as bytes, every frame.
A table that holds a constant buffer is made afresh for its draw in slots
of our own, so the title's slots of it are read by nothing unless a shader
picks them by index. The pass over records copied in as bytes
(sync_heaps) cannot know that. It leaves a table's TEXTURE slots to the
draws that read them (tabled_lately), and takes every other changed record
there for one a shader may pick by index: a buffer view is "left for
later" (its host slot made null) on the submitting thread, and the
once-a-frame pass over buffer views picked by index (State::heap_buffers)
then makes each of them and looks at its memory, on a recording thread.

With the switch, table_entry and the tables made afresh stamp the title's
own slots as a table's whatever they hold (HostHeap::table_slot), and the
pass leaves them alone for as long as it leaves a table's texture slots
(TABLED_FRAMES).

Measured on main 4c60466 with #798 on top (the Series S profile needs it),
RTX 3090 Ti, Ryzen 9 9950X3D, Series S profile, the prologue's cell,
hands-off, one 5.5-minute run each way, the switch the only difference:

                                          off              VICTORY_TABLED_ALL=1
  frame (frame line)                      84 - 96 ms       55 - 59 ms
  records the pass mirrors, a frame       18,645           213
  the pass (sync_heaps), a frame          17.0 ms          3.0 ms
  "heap buffers" on the frame line        29 - 33 ms       8 - 12 ms
  exceptions, device loss                 none             none

The picture is the same in both (four frames of each side by side).

What it risks is what the rule risks for textures already (and what pull
request #827 describes for the 240-frame window): a slot that was a
table's and is then picked by index only is not seen by the pass until the
frames are over. For buffer views the pass over buffer views, in its
default form, looks at every slot it knows again every 16 passes, which
bounds that to 16 frames for a slot it has seen once. One scene only,
hence off by default.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:03:52 +00:00
Author
Owner

@⁠akimfomin on GitHub · 2026-11-27 00:16 UTC · original

At pinned head 9a18dd08, the table-slot stamp stays eligible for 240 guest frames, inclusive, even in the branch where mirror found no view. The stamp is local to that descriptor heap. Stamp test and lifetime. That gives a small boundary case for the risk you called out: seed a table slot, change the same slot to an indexed-only resource, and check the fetched value at the 240/241 boundary in fresh OFF and ON processes. This distinguishes delayed host-view publication from a frame-time win.

I separately checked that #1414 and #1413 merge cleanly; the span-cache author has that exact tree and four-case suggestion. For an independently repeatable correctness result, you can link just the SHA, both expected/actual values and the switch in PortBridge #98 so a fork can reuse it. This is source evidence, without GPU validation. AI-assisted review.

**@⁠akimfomin** on GitHub · 2026-11-27 00:16 UTC · [original](https://github.com/fxceless/victory-fork/pull/1414#issuecomment-7206317317) At pinned head `9a18dd08`, the table-slot stamp stays eligible for **240 guest frames**, inclusive, even in the branch where `mirror` found no view. The stamp is local to that descriptor heap. [Stamp test and lifetime](https://github.com/fxceless/victory-fork/blob/9a18dd08f88564894766b3a055dca08d29cb0b21/crates/victory-gpu/src/descriptor/host.rs#L1882-L1937). That gives a small boundary case for the risk you called out: seed a table slot, change the same slot to an indexed-only resource, and check the fetched value at the 240/241 boundary in fresh OFF and ON processes. This distinguishes delayed host-view publication from a frame-time win. I separately checked that #1414 and #1413 merge cleanly; the [span-cache author has that exact tree and four-case suggestion](https://git.gtahub.st/github/fxceless--victory-fork/pulls/1413). For an independently repeatable correctness result, you can link just the SHA, both expected/actual values and the switch in [PortBridge #98](https://github.com/akimfomin/PortBridge/issues/98) so a fork can reuse it. This is source evidence, without GPU validation. AI-assisted review.
Author
Owner

@⁠Filip722 on GitHub · 2026-11-27 00:35 UTC · original · edited 2026-11-27 00:52 UTC

I tested this commit on a Bazzite laptop with an RTX 5060 Laptop 8 GB, GE-Proton11-14, vkd3d-proton 3.2.0 and the indexed Wine server. Both Series S runs used the same executable, restored prefix and cache seed, 50% render scale and the same prison camera. Only VICTORY_TABLED_ALL changed. This is the 4c604661-based compatibility build.

54 s at the matched prison view Off On
Unique DXGI Presents 315 277
FPS 5.84 5.14
Median / p95 frame interval 166 / 216 ms 195 / 237 ms
Minimum free VRAM 902 MiB 1,462 MiB
Median mirrored records per frame 11,292 191
Median descriptor sync per frame 30.48 ms 5.25 ms
Median heap buffer pass per frame 77.75 ms 22.40 ms

The descriptor work fell sharply. In this single pair, median reported GPU phase was 22.5 / 60.8 ms and copy-back was 64.7 / 81.4 ms. Overall throughput fell in the same interval. Both rendered the same camera and had a median of zero queued host pipelines in the scoring windows. The usual GPU timing buckets are aggregate, so command attribution requires a separate trace.

The scoped descriptor filter passed 26 tests with each switch setting on the physical RTX. With a separate b1d777a integration, both default-wait arms hit the same title watchdog during loading and yielded no in-cell performance measurement.

A separate synthetic D3D12 test on the b1 integration put a newly copied buffer view in a write-watched heap. With the switch off, the next sync registered it. With the switch on, the page was consumed during the 240-frame stamp window and the view was still absent after 241 frame tokens. A padding write elsewhere on the same page let sync discover the original descriptor, whose bytes and key were unchanged. Both child processes selected the RTX. This isolates a lost retry after expiry.

A source-only follow-up reproduces that failure on public base b1d777a plus the PR and fixture at 4f164079. At f189f9a3, both physical test children pass. One deadline per changed page schedules a live reread when its table stamp can expire. The helper also checks that due pages merge in address order with ordinary dirty pages and that a failed read waits until a later frame. Windows-target GPU Clippy passed with warnings denied. The gameplay numbers above predate the expiry correction. Fixture and correction

Assisted by Codex (GPT-6.2-Sol High).

**@⁠Filip722** on GitHub · 2026-11-27 00:35 UTC · [original](https://github.com/fxceless/victory-fork/pull/1414#issuecomment-7206583060) · edited 2026-11-27 00:52 UTC I tested this commit on a Bazzite laptop with an RTX 5060 Laptop 8 GB, GE-Proton11-14, vkd3d-proton 3.2.0 and the indexed Wine server. Both Series S runs used the same executable, restored prefix and cache seed, 50% render scale and the same prison camera. Only `VICTORY_TABLED_ALL` changed. This is the `4c604661`-based compatibility build. | 54 s at the matched prison view | Off | On | | --- | ---: | ---: | | Unique DXGI Presents | 315 | 277 | | FPS | 5.84 | 5.14 | | Median / p95 frame interval | 166 / 216 ms | 195 / 237 ms | | Minimum free VRAM | 902 MiB | 1,462 MiB | | Median mirrored records per frame | 11,292 | 191 | | Median descriptor sync per frame | 30.48 ms | 5.25 ms | | Median heap buffer pass per frame | 77.75 ms | 22.40 ms | The descriptor work fell sharply. In this single pair, median reported GPU phase was 22.5 / 60.8 ms and copy-back was 64.7 / 81.4 ms. Overall throughput fell in the same interval. Both rendered the same camera and had a median of zero queued host pipelines in the scoring windows. The usual GPU timing buckets are aggregate, so command attribution requires a separate trace. The scoped descriptor filter passed 26 tests with each switch setting on the physical RTX. With a separate `b1d777a` integration, both default-wait arms hit the same title watchdog during loading and yielded no in-cell performance measurement. A separate synthetic D3D12 test on the b1 integration put a newly copied buffer view in a write-watched heap. With the switch off, the next sync registered it. With the switch on, the page was consumed during the 240-frame stamp window and the view was still absent after 241 frame tokens. A padding write elsewhere on the same page let sync discover the original descriptor, whose bytes and key were unchanged. Both child processes selected the RTX. This isolates a lost retry after expiry. A source-only follow-up reproduces that failure on public base `b1d777a` plus the PR and fixture at `4f164079`. At `f189f9a3`, both physical test children pass. One deadline per changed page schedules a live reread when its table stamp can expire. The helper also checks that due pages merge in address order with ordinary dirty pages and that a failed read waits until a later frame. Windows-target GPU Clippy passed with warnings denied. The gameplay numbers above predate the expiry correction. [Fixture and correction](https://github.com/Filip722/victory-fork/tree/review/tabled-descriptor-expiry) Assisted by Codex (GPT-6.2-Sol High).
Author
Owner

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

Your source-only fixture closes the 240/241 ambiguity: the view stays missing after expiry until another write hits the page, and the corrected branch passes without that write. I checked the full SHA of the fixture and correction and preserved their distinct baselines in Test Lab #106.

Anyone with a suitable host can give that card to an agent and run both exact revisions without a title. It records the selected adapter and treats an early return as skipped. We can credit any second-device report here. The Bazzite frame-time pair still belongs to the earlier revision, so it won't be used as a performance claim for your expiry correction.

**@⁠akimfomin** on GitHub · 2026-11-27 01:01 UTC · [original](https://github.com/fxceless/victory-fork/pull/1414#issuecomment-7206945207) Your source-only fixture closes the 240/241 ambiguity: the view stays missing after expiry until another write hits the page, and the corrected branch passes without that write. I checked the full SHA of the fixture and correction and preserved their distinct baselines in [Test Lab #106](https://github.com/akimfomin/PortBridge/issues/106). Anyone with a suitable host can give that card to an agent and run both exact revisions without a title. It records the selected adapter and treats an early return as skipped. We can credit any second-device report here. The Bazzite frame-time pair still belongs to the earlier revision, so it won't be used as a performance claim for your expiry correction.
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/1414/head:github-bot/gh-1414'
git switch 'github-bot/gh-1414'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1414'
git switch 'github-bot/gh-1414'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1414'
git switch 'github-bot/gh-1414'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1414'
git switch 'main'
git merge --squash 'github-bot/gh-1414'
git switch 'main'
git merge --ff-only 'github-bot/gh-1414'
git switch 'main'
git merge 'github-bot/gh-1414'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.