Descriptors: a view heap's strides table stays in upload memory unless VICTORY_STRIDES_WB=1 (on an RTX 5090 shaders read it slowly from write-back memory: 23 ms of the card a frame instead of 15) #4501
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!4501
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4500"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@HQasper on GitHub · 2026-11-30 21:25 UTC · original
HQasper:pr/strides-upload-memory→main· +9 −12 · 1 files · 13 commits · closed without mergingFollows #2174 (merged as
26d1d102), whose default for the strides table this changes.What it changes
#2174 (
26d1d102) made each view heap's table of strides and guest addresses withupload_buffer_maybe_wb(bytes, scratch_wb(host)): in CPU write-back (L0) memory wherever the lists' scratch is, which is by itself on a discrete NVIDIA card (VICTORY_SCRATCH_WB). That made the CPU's updates of the table cheap (the heaps' records pass).The card reads the same table. Every shader that picks buffers from the view heap by an index it computes binds it as a root view (
t255,t252ort250of space 1) and reads a dword of it for each such buffer. On an RTX 5090 those reads are slow from write-back memory: the programs that read the table take several times as long on the card, with the same dispatches and the same translation.With this change the table is made in upload memory again, as before #2174, unless
VICTORY_STRIDES_WB=1. The lists' scratch chunks are not touched, and the rest of #2174 (the lock-free address lookup, the direct record read) stays.What is in it:
crates/victory-gpu/src/descriptor/host.rs(strides_wb,strides_wb_of, used where the heap makes the table), and one test in the same file.How it was found
Our branch on
c71899d9(v2026.11.30.01, our local commits rebased onto it) had more slow frames than the same commits on41adb551: the card meter gave the title's lists 22-23 ms a frame against 15 ms, in the same scene, at the same frame rate.VICTORY_GPU_TIMING, diagnostics builds, steady part of the opening): dispatches 5.6-5.7 ms a frame on41adb551and 11.3 ms onc71899d9, in the same 3,414 commands a frame; indirect commands 6.2-6.3 against 8.0 ms. About 30 compute programs went from 0.01-0.07 ms to 0.13-0.57 ms a frame each: skinning (512416d975ace48b,3a79195f06d3ed85,12eae112b559091c), the compute graph (2666062bd7f4c95d,7a38ed7f5205f384,a06ef09446bd6e70), hair (4a05640ec16718ad,269b802f878c24e1), meshlet culling (764ca63daec9c616,87bf9e3f2bf2f052,3b471c122be79b3e).844200e9) and in the type of a few selects; no loop, cap or atomic differs.t255ort252) and all 26 grew. Of the four that do not read it, three cost the same on both builds; one (7b2c3c1db2298f44, one dispatch) is 1.1 ms slower onc71899d9for another reason, not settled, with or without this change.c71899d9against 68-69 % on41adb551.VICTORY_SCRATCH_WB=0on thec71899d9build (the table and the scratch chunks in upload memory) brings the card's time by command from 21.7 ms a frame to 14.5 ms, and the 26 programs from 6.9 ms to 0.9 ms.VICTORY_WINDOWS_BAR_MB=0(#2313's windows in card memory the CPU maps): 22.2 ms.How it was tested
New test
descriptor::host::strides_wb_tests::the_strides_table_is_in_upload_memory_unless_asked_for: unset,0and an empty value give upload memory whatever the scratch's kind;1gives write-back memory only where the scratch is write-back.cargo test --locked -p victory-gpu --lib strides_wbon this branch (9d50534bon84bd61e2): 1 passed, 1199 filtered out.In game (the opening from one save, RTX 5090, driver 621.24, 2560x1440 with DLSS Quality, ray tracing off, 170 s runs, 2026-11-30; our branch on
c71899d9without and with this commit, interleaved b r r b after one uncounted run; steady = seconds 60 to 120 of the world):What it costs the CPU (the same four runs): the heaps' records pass takes 5.3-5.5 ms a frame with this against 3.9-4.4 ms without (6.7 ms on
41adb551, before #2174), and the submitting thread's submissions 22.6-22.8 ms against 19.8-20.3 ms. The frame is still shorter with it (median 24.6 against 25.9 ms), because the card no longer falls behind.With ray tracing on (the same scene and settings, our branch on
84bd61e2with this commit, one exe; the switch set against unset):VICTORY_STRIDES_WB=1(the table as before this change)The two runs with the switch were interleaved with two unset runs (e f f e, between two runs of an older build): one of those gave 28.7 ms and 32.0 fps, the other fell into a ray-tracing slowdown we also see on older builds (in about one run in four to ten, on this build and the one before it alike; the card's time per frame doubles or more at about 100 s and stays, whatever the table's memory) and is left out. The other eight unset runs are from two later series of the same evening on the same exe, so they are not interleaved with the runs that set the switch.
Not measured: other cards (the cost of the card's reads from write-back memory may differ on AMD or on an NVIDIA card of another generation, which is why the switch stays).
A possible follow-up
#2174's saving and this one need not exclude each other: the CPU could keep its own copy of the table in ordinary memory for the compare that skips unchanged entries, and write only the changed ones into the upload-memory table the card reads. Not in this PR.
Checked for overlap
strides table,SCRATCH_WB,write-back strides,26d1d102andSTRIDES_WB(2026-11-30): #2174 is the change this follows; open #3501 (by its title, GVN and LICM of theSLOT_STRIDESreads in the translator, which would lower the number of reads) is related, not a duplicate; #3833 and #3807 are about raw twins. Searched again at 22:30 the same day: open #4333 (the lists' scratch in card memory the CPU maps, off by default) and #4320 (the lists' memory made ahead) are about the scratch chunks, not this table; open #4484 changesdescriptor/host.rselsewhere. No report of the card's time or of this default.Written with Claude Code (Claude Fable 5.2); measured on my PC; reviewed by me.
🤖 Generated with Claude Code
@IRennie74 on GitHub · 2026-11-30 22:39 UTC · original
One thing to weigh for PCs where the submitting thread, not the card, is the limit: here the records pass costs 1.1-1.4 ms more a frame (5.3-5.5 against 3.9-4.4 ms) and submissions 2.5-3 ms more. On a Ryzen 5 5600X with an RTX 3060 (Series S, DLSS Performance) our submitting thread is busy 44-54 ms of a 55-58 ms frame and the card idles 14-21 ms of it waiting for that thread, so CPU time added there tends to show directly in the frame, while card time saved shows only in the busiest frames. We have not measured
VICTORY_STRIDES_WBon the 3060 yet and will A/B it. Until then, the follow-up in the description (a CPU-side copy for the compare, only changed entries written into the upload table) looks like the version that suits both kinds of PC.Small thing:
strides_wb(descriptor/host.rs:32-34) reads the variable by hand;crate::asked_for!("VICTORY_STRIDES_WB")is the repo's helper for an on-only-when-1switch (switch.rs).@HQasper on GitHub · 2026-12-01 05:40 UTC · original
Thanks, both points taken.
asked_for!: done ind7ed1464.strides_wbnow readsVICTORY_STRIDES_WBthroughcrate::asked_for!, and the test covers the combination with the scratch's kind. The same push merges upstream main in (it was force-updated, so the branch had conflicted); the PR is back to the one file.VICTORY_STRIDES_WBunset the table stays in upload memory, which is the card-bound win on the RTX 5090, and the records pass pays the 1.1-1.4 ms you quote. We have not measured it on a CPU-bound PC like your 5600X + 3060, so an A/B from you would be welcome. The CPU-side copy for the compare, writing only changed entries into the upload table, is the follow-up we want to try; it would be a separate change from this one.@trustno1-coder on GitHub · 2026-12-01 18:39 UTC · original
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed