Repository navigation
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
Conversation
…s slot (VICTORY_TABLED_ALL=1, off by default) 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 fxceless#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 fxceless#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 <noreply@anthropic.com>
|
At pinned head 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. |
|
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
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 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 Assisted by Codex (GPT-6.2-Sol High). |
|
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. |
…an be set, and tests of where it ends After review of fxceless#1414 (akimfomin: a stamped slot stayed with its draws for 240 frames whatever it held, and nothing tested where that ends). - The switch's stamps are now its own (HostHeap::table_any, allocated only with the switch), read by the pass over records copied in as bytes and by nothing else. The first form wrote the texture queue's stamp, so the switch also changed how that queue treats a slot that had held a table's buffer view. - VICTORY_TABLED_ALL_FRAMES (1 to 240) says for how many frames after a draw bound its table a slot is left. The default is 60, not 240. - Tests: where the stamp ends (the last frame and the one after, for 1, 8 and 240 frames), and the pass itself over a page: a changed record of a table's slot is left up to the last frame, taken in the frame after, and taken at once when no draw bound it or with VICTORY_HEAP_SYNC_TABLES=1. Why 60. The title makes its per-draw tables in a ring of its heap's slots, so a slot is written again some frames after a draw last bound its table, and the stamp has to outlast that. main 4c60466 with fxceless#798 on top, RTX 3090 Ti, Series S profile, the prologue's cell, one 5.5-minute run a row: window frame records mirrored the pass "heap buffers" off 80 - 91 ms 16,994 a frame 15.8 ms 25 - 34 ms 2 frames 73 - 77 ms 13,016 10.8 ms 19 - 25 ms 8 frames 64 - 73 ms 9,697 10.2 ms 12 - 21 ms 60 frames 55 - 59 ms 1,658 4.3 ms 9 - 11 ms 240 frames 54 - 59 ms 218 3.0 ms 9 - 11 ms (A second run each of "off" and of 60 frames read 84 - 96 ms with 18,645 records and 56 - 59 ms with 1,765: the figures in the code's comment.) No exception and no lost device in any of them, and the cell's picture the same in all (four frames of each side by side). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 4f16407)
(cherry picked from commit f189f9a) Adapted to this branch when picked: a record's deadline comes from HostHeap::left_until, which answers for the switch's own stamps and their window (VICTORY_TABLED_ALL_FRAMES) as well as for the texture queue's stamps. The original took the texture stamp's age and TABLED_FRAMES, which was the only stamp before the commit under this one. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…set before anything is counted
On Windows the write watch also reports a page's first touch when that
touch is a read. The pass reads the whole 64 KiB page that holds a changed
slot, so the fifteen kernel pages of the test's heap that nothing had
written counted as written after the first sync, and the test's own check
that nothing wrote the heap again failed before it reached what it tests
(with the switch off, on Windows 11 26200: 'no descriptor writes after the
first sync', 15 against 0).
With every page touched and the watch reset first, on an RTX 3090 Ti: at
the commit that adds the test the child with the switch on fails where it
should ('stamp expiry must discover the copied slot without re-dirtying
its page') and the child with it off passes; with the retry both pass.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
As picked, the retry took a left record's deadline from whichever rule had left it: the switch's own stamp, or the texture queue's (a table's texture slot, 240 frames), which main applies without the switch. So with the switch on, a record the texture rule had left was read again when that rule's frames ended, where main takes it when its page is next written. That changes main's texture rule, which is not this switch's to change. A slot the rule left goes on showing the texture its draws made; made anew from a record nothing has read since, it waits in the queue of textures picked by index. In one of two 5.5-minute runs of the wider retry (RTX 3090 Ti, Series S profile, the prologue's cell) the cell's window frame drew flat yellow from the first minute to the last. None of nine runs without a retry did, and neither of two with this commit. One run in two does not prove the retry did it; the narrower rule does not need the proof. Now HostHeap::retry_left gives a page a deadline only for a record the switch's own stamp left (table_slot_until). A record with both stamps is asked for again when the switch's ends, is found still left by the texture rule, and then waits for its page's next write, as on main. The test of the pass over a page covers both cases. With it, two runs: frame 56 - 62 and 57 - 59 ms (55 - 59 with no retry), records mirrored 2,011 and 2,114 a frame (1,658), the pass 5.1 and 4.9 ms (4.3), 192 and 180 pages read a frame (174). No exception, no lost device. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
@akimfomin @Filip722 thank you both. The branch has changed a good deal because of what you wrote (head 1. The lost retry is real, and Filip722's test and fix are in. Writing a boundary test for akimfomin's question I had come to the same hole from the other side (the pass does not note a record it leaves as seen, so it is taken the next time its page is read, and nothing reads the page again unless something writes on it), and was about to write it up as a known limit. Two things I changed around them, each in a commit of its own so it can be judged apart:
2. Stamps of the switch's own, and a window that can be set (
The title makes its per-draw tables in a ring of its heap's slots, so the stamp has to outlast the ring's turn; 60 frames keeps nearly all of it for a quarter of the exposure. 3. Tests ( The slower pair stands. @Filip722, I am not claiming this switch is a gain on your machine, and the description now says so near the top. Your descriptor figures match mine (at the same 240 frames, records mirrored 11,292 → 191 against 16,994 → 218 here, and the pass 30.5 → 5.3 ms against 15.8 → 3.0). What I can add is that my own frame lines point the same way as your copy-back: with the switch on, the submitting thread's "copies" go from 60–65 MB and 9–10 ms a frame to 74–83 MB and 19–24 ms, its "preparing" from 25 to 37–43 ms, and copying back takes 16–18 ms where it took 12 for the same 31–33 MB. I have not found why yet (the buffer pass defers its refreshes to the submission too, so it is not simply work moved between threads). Here the frame is shorter all the same, because without the switch recording was the limit; with it the submitting thread is. Where that side is the limit already, the extra could be the whole difference, which is what your pair looks like. If you run it again, an off-on-off order would tell a warm laptop apart from the switch, and One note on the suite, since both of you ran it: AI-assisted (Claude Code, Claude Fable 5.2). |
|
A follow-up on "what it costs", since I wrote that I had not found where the submitting thread's extra time goes. A profile of that thread with the switch on ( What I tried against it, all in the game:
Also for anyone testing on today's Numbers and text only. AI-assisted (Claude Code, Claude Fable 5.2). |
…1080 display, the heap pass Measured by Codex, the ten switches of Status, one session each unless said; the counts of «placed texture slots picked by index … held for room» are over every census between 150 and 600 s of each session. - Without VICTORY_TEXTURE_DROP_MIPS=1 slots were held for room in 63 of 85 counts, up to 18,151 of 25,000, and the room lost its bed and wall; with it, 4 or 5 of some 86 counts, up to 1,004 and 4,955. - VICTORY_DISPLAY_MODE=1920x1080 alone: a black world (the title picks FidelityFX on Series S, whose AMD-native passes are not translated). With VICTORY_OWN_UPSCALER=1 or VICTORY_UPSCALER=6 the picture came back, with slots held for room in 3 to 9 counts a session (up to 2,388 to 5,747), and 6.33 fps against 6.63 on main: not a gain. - VICTORY_TABLED_ALL=1 (fxceless#1414) on f9f53eaa at 1920x1080: 6.86 fps / 143 ms against 6.37 / 151 ms, one pair; heap pass 15.4 against 44.6 ms a frame, draws 4,484 against 4,491. - A black face at 346 s with no slot held for room and 2,611 in the upload queue, after the title's defragmenter started at about 300 s. - Not gains here: VICTORY_BVH_NO_HIT=1, VICTORY_TEXTURE_NO_WAIT=1; VICTORY_SECTION_MB=2 not conclusive. The README's line on the picture says the same in short. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iagnostics, and switches from VI-BR-PORT and Belobug-AMD Thirty-one commits, built as f9f53ea-diagnostics (by claude2; checked by Codex) and tested there (victory-gpu 374 passed, victory-hle 149, the xmem tests with VICTORY_LAZY_REMAP=1 and with VICTORY_PORT_CONSTANTS=1). crates/ and apps/ are those of f9f53ea exactly. On by default, each with a way back: five translator fixes (VICTORY_CMP_SAMPLER_FIX, VICTORY_BPERMUTE_HALVES, VICTORY_FMAC_MODS, VICTORY_SAVEEXEC_SCAN, VICTORY_LEGACY_MUL_DENORM), compares of neighbouring ranges in one pass (VICTORY_CARD_COMPARE_JOIN); without a switch, fences held by reference, depth-plane views kept for a list's life, and heap anisotropic samplers keeping linear mips (their point-mip form removed the device on an RTX 4060 Ti; VICTORY_HEAP_ANISO_POINT_MIP=1). Off by default: VICTORY_TABLED_ALL (fxceless#1414), VICTORY_LAZY_REMAP (written clean-room), VICTORY_PORT_CONSTANTS, VICTORY_SKIP_DEFRAG, VICTORY_RT_TRACE_SKIP, VICTORY_SKIP_RT_SHADOW, VICTORY_AMBIENT_AIR, VICTORY_UPSCALER, VICTORY_PIPELINE_BOOK, VICTORY_WINDOW_REUSE, VICTORY_COLD_SKIP, VICTORY_KEYS_FILE, VICTORY_NULL_SAMPLES, the submission lock's meter and the defragmenter's counter. Measured by Codex on f9f53ea, the ten switches of Status, the scripted manoeuvre, a quiet machine, one session each: 6.59 fps (median frame 144 ms) as it is, against 6.62 on the code before; 6.87 fps (142 ms, 95th percentile 169) with VICTORY_TABLED_ALL=1, its heap pass 18.4 against 41.0 ms a frame; at 1920x1080 with the title's upscaler 6.37 and 6.86 fps. The README gives the line for an 8 GB card as measured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
One opt-in switch,
VICTORY_TABLED_ALL=1(off by default): the pass over records the title copied into its heap as bytes leaves every slot of a table a draw binds to its draws, whatever the slot holds, and not only the slots that hold texture views.VICTORY_TABLED_ALL_FRAMES(1 to 240, default 60) says for how many frames after a draw last bound the table. Nothing changes without the switch.In the prologue's cell on
mainit took the frame from 80–91 ms to 56–62 ms on an RTX 3090 Ti (54–59 ms in the first version, which had a longer window and no retry). It is not a gain everywhere: on an RTX 5060 Laptop 8 GB under Proton, Filip722 measured one pair that was slower with it (5.84 → 5.14 fps, below).Revised after review (akimfomin, Filip722): the switch has stamps of its own, the window can be set and is 60 frames, a record left to its draws is looked at again when its window ends even if nothing writes its page again (Filip722's test and fix, picked with them as author), and there are tests of where the window ends.
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:State::heap_buffers) then makes each of them and asks for its memory to be brought up to date.I found it with a counter of what
HostHeap::mirrordoes 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 one of a table a draw bound, in stamps of the switch's own (table_any, allocated only with the switch). The texture queue's stamps are not touched. (The first version of this PR wrote the texture queue's stamp; that also changed how the queue treats a slot that had held a table's buffer view.)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.mirror_copied,mirror_copied_page) asksleft_to_draws: a table's texture slot lately, as before, or with the switch any stamped slot withinVICTORY_TABLED_ALL_FRAMES.d4e76edthe test and82d837bthe fix): a changed record the pass leaves is not noted as seen, so before this it was taken only the next time something wrote its 64 KiB page. A slot that left its table and was then picked by index, on a page nothing wrote again, stayed unseen for good. Now each heap keeps one deadline per page that has such a record (TableRetries), and the pass reads the page again in the first frame the record is no longer left. Only with the switch, and only for records the switch's own stamp left (c59bc53): what the texture queue's rule leaves is taken when its page is next written, as onmain. Here it costs the pass about 0.7 ms a frame (4.3 → 4.9–5.1 ms; 174 → 180–192 pages read).Measurements
main4c60466with #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 run per row. Frame: the last four readings of the frame line.Switches in every run:
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_ONCEat 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 inVICTORY_SKIP_PIPELINES.sync_heaps)Why the window matters at all: the title makes its per-draw tables in a ring of its heap's slots, so a slot is written again some frames after a draw last bound its table, and the stamp has to outlast that. 60 frames has nearly all of the gain for a quarter of the time a slot can go unseen. Two more runs with the switch off on this base read 84–96 and 84–90 ms, and a second run at 60 frames 56–59 ms.
Picture: in the cell the same in all of these (four frames of each run side by side). The cutscene before the cell has
main's known faults in every run 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.One run outside the table was different, and it shaped the last commit. The retry as first picked also read a page again when the texture queue's 240 frames ended for a record on it. In one of two runs of that form the cell's window frame drew flat yellow in all nine screenshots of the cell (three minutes). None of the nine runs without a retry did, and neither of the two with the retry narrowed to the switch's own stamps (
c59bc53, the row in bold). One run in two does not prove the wider retry did it, but the narrower rule does not need the proof: the texture rule ismain's, and with the switch on it now behaves exactly as without it.What it costs, and where it was slower
With the switch on, the submitting thread has more to do. On the frame line here:
It is not simply work moved from one thread to another: the buffer pass defers its refreshes to the submission too. A profile of the submitting thread with the switch on (on
main1f5d17awith #1388) puts the refreshes of buffer copies at 15.1 ms a frame, 9.4 of it in the write-watch asking (watch::writes, paid per refresh) and 4.4 in the copying; numbers and what was tried against it are in a comment on #1388. I have no profile of the same build with the switch off, so that is where the time is, not yet why it is more. On this PC the frame is shorter all the same, because without the switch recording was the limit; with it the submitting thread is (at work 46 of a 56 ms frame).On a machine where the submitting side or the card behind it is already the limit, the same extra can make the frame longer. Filip722's pair on an RTX 5060 Laptop 8 GB (Bazzite, GE-Proton, Series S at 50 % scale, the first version of this PR, 240 frames): the descriptor work fell as here (records mirrored 11,292 → 191, the pass 30.5 → 5.3 ms, the buffer pass 77.8 → 22.4 ms, 560 MiB more video memory free) and the frame rate fell too, 5.84 → 5.14 fps, with their GPU phase at 22.5 → 60.8 ms and copy-back at 64.7 → 81.4 ms. One pair, but it points the same way as the table above, so read this switch as "measure on your machine", not as a default.
Risk, and why it is off by default
VICTORY_TABLED_ALL_FRAMESframes after the last draw bound its table (60 by default). With the retry it is seen then, whether or not its page is written again. Before the retry it could stay unseen for good; that hole is what Filip722's test shows.tabled_lately,main's) is unchanged, with the switch or without.How this relates to open PRs
Verification
cargo clippy -p victory-gpu --all-targets: no warnings.cargo test -p victory-gpu --lib descriptor: 43 passed. New here: the stamp's ends at 1, 8 and 240 frames; the pass over a page (a changed record of a table's slot is left up to the last frame, taken in the frame after, its deadline is that frame,VICTORY_HEAP_SYNC_TABLES=1holds nothing back, and a table's texture slot is left with no deadline); Filip722's merge test ofTableRetries; and Filip722's device test throughsync_heapson a write-watched heap, in child processes with the switch off and on.9c3deb8): the write watch there also reports a page's first touch when that is a read, so the test now touches its heap's pages and resets the watch before it counts anything.victory-gpusuite is intermittent on this PC with or without this PR: 5 of 48 runs failed on unmodified4c60466(watch::tests::a_write_is_reported_at_every_checked_viewamong them), 4 of 25 on this branch (each timeinplace::tests::warp_a_title_buffer_in_place_shows_its_bytes_at_its_offset). Neither test is touched here.cargo xtask policyreports the two oversized files it reports onmain(host.rs,lower.rs); this PR touches neither.Numbers and text only: no game data, captures or screenshots.
AI-assisted (Claude Code, Claude Fable 5.2). The retry and its two tests are Filip722's (assisted by Codex, per their comment).