Shaders, GPU: root UAVs (stacked on #489) #1077
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1077
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1077/head"
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?
@DuarttBR on GitHub · 2026-11-24 15:30 UTC · original
DuarttBR:root-uav→main· +731 −16 · 13 files · 5 commits · closed without mergingStacked on #489 (which carries #302): its four commits come first here; only the last commit,
873548f, is new.What
A compute program can build a buffer descriptor around a root descriptor's address and write through it. Emit refused that as
a root UAV or typed root view; only root CBVs and read-only root SRVs had a handle.Shader::root_uav_handledeclaresu<slot>in the root-view space (ROOT_CBV_SPACE), as aRWByteAddressBuffer(raw buffer, PSV0 kind 7).lower.rstakes(Descriptor, Uav, class 0x100b)there; any other typed root view is still refused, now asa typed root view.HostShader::root_uavs, stored by the shader cache next to the CBV and SRV lists.D3D12_DESCRIPTOR_RANGE_TYPE_UAVrange). Inbind, its view is a raw UAV of the title buffer's host copy from the root address, at most 1 MiB (ROOT_UAV_BYTES: a root view has no size), in a dynamic slot per heap and address per list. The range is refreshed before the submission and copied back after it (Shadow::refresh+gpu_writes), as for a table's buffer UAV. Without a host copy, or not on 16 bytes, the view is null: writes are dropped instead of landing elsewhere.Why
With the spill table read (#302, #489), the 34 compute programs with spilled root arguments that Grand Theft Auto VI's world dispatches get past resource tracking in 13 cases, and 11 of those then stop at this refusal. Among them is the program that dropped the most dispatches per world frame in our runs.
Measured
Offline, over those 34 programs (
victory translate --validate --pipelines, RTX 3080, driver 617.42,dxil.dll1.9.2609):main+ #489The seventh is a wave64 program this card refuses (
WaveSize(64)on a 32-lane GPU), which the wave64 work (#189, #233) addresses separately. What still stops the other 6 of the 13 is unrelated:a select on an untracked mask(3), LDS writes of bytes or halves,buffer_load_ushortand one typed root view (1 each).In the game (same stack plus #493, #483, #189, #333 and others on our integration branch, Series S mode, RTX 3080): 5.5 minutes in the world with no device removal and no error, and
3b90165a77d95cdf(about 1,040 dispatches per frame before) no longer in the drop summary. One run, so please take the runtime part as a data point.Checks
cargo clippy --workspace --all-targets --locked -- -D warningsand with--all-features: clean.cargo test --workspace --locked: passes (the shader cache round trip now includes a root UAV).AI use: Claude Code (Claude Fable 5.2 and Claude Opus 5.5) wrote the change, ran the checks and the measurements on my machine, and drafted this description; I reviewed and posted it.
🤖 Generated with Claude Code
A descriptor built around a root descriptor's address with unordered access was refused in emit ("a root UAV or typed root view"). With the spill table read (#302, #489), 11 of the 34 compute programs with spilled root arguments that Grand Theft Auto VI's world dispatches stopped there, among them the one dropping the most dispatches per frame in our runs. The translated shader now declares u<slot> in the root-view space (RWByteAddressBuffer, PSV0 kind 7). The host binds it as a one-view table: a raw view with unordered access of the title buffer's host copy from the root address, at most 1 MiB, refreshed before the submission and copied back after it like a table's buffer view. Without a host copy, or off 16 bytes, the view is null. The shader cache stores the new list. Offline over those 34 programs (victory translate --validate --pipelines, RTX 3080, dxil.dll 1.9.2609): 0 emitted before, 7 emitted and validated after, 6 of them with a host pipeline (the seventh is a wave64 program this card refuses). Co-Authored-By: Claude Fable 5.2 <[email protected]>@NuraadGit on GitHub · 2026-11-24 16:26 UTC · original
World sizing for this from an RTX 2080, on a stack with #489 but without root UAVs (JMAN730's fork + #493 + #189 + #206 + #667 + #704 + #878 + #489, 12 minutes, loop limit 32):
a root UAV or typed root view.3b90165a77d95cdf(~90) andc42a31951201f9a0(~65). The stack drops about 665 per frame for a missing host pipeline in total, so that's close to a quarter.3b90165a77d95cdfis the single most dropped program.an address not from a root parameter):5062bc7a48e842f8and5279ae36796c31fc, ~65 per frame each.These four are missing from
victory translate --listof the shader archive here, so offline counts over the archive can't show their gain. A runtime count like yours can.Overlap: #294 + #709 (wbkepler, itsRevela) also give root UAVs, as root descriptors with write-back. In a full offline census of my stack with #489 + #294/#709,
a root UAV or typed root viewis at 0 (I haven't run that build in the world). The designs differ: a one-view table per root UAV here, root descriptors there. It'd help to settle on one before both grow. If you post your 13 programs' hashes, I can say what each of them does offline with #294/#709, where they are in the archive.AI-assisted (Claude Code): the runs and log analysis were automated. The hardware, title copy and runs are the user's.
@Zipettte on GitHub · 2026-11-24 16:29 UTC · original
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
873548f:cargo test -p victory -p victory-gpu -p victory-shaderpasses, 176 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
@DuarttBR on GitHub · 2026-11-24 16:30 UTC · original
Thanks, that matches what we see:
3b90165a77d95cdfwas our single largest drop too, and it is one of the seven this PR gets through.The 11 programs that stop at
a root UAV or typed root viewonmain+ #489:3b90165a77d95cdf4ddd6f9702fab2a7c42a31951201f9a05c09eb42b7a3c362bb55c842c391589ff94e5d8bf4e1cf0514394a322f6dd5c2main(WaveSize(64) on a 32-lane card), made with #189caa78b8ca62bc3d628918b7150a7aad5e63d22c4def9ba6aa select on an untracked mask5552dac6a2b7a1fda typed root view(a formatted root UAV, not raw)On the overlap with #294/#709: agreed it is worth settling on one. Our reason for a one-view table is the same as #493's for root SRVs: a root descriptor has no size, so a write past the title buffer's host copy lands in whatever follows it. A table view ends at the copy (capped at 1 MiB here), and out-of-range writes are dropped. If #294/#709 bound the range another way, I'm happy to rebase onto them, or to close this in their favour. I can run #294/#709 on the same stack in the world and report the drop counts.
AI use: Claude Code (Claude Opus 5.5) gathered the per-program results from our runs and drafted this reply; I reviewed and posted it.
@MamaLeVrai on GitHub · 2026-11-24 20:08 UTC · original
For reference: on top of the shader stack (#1319 to #1511) this merges without a conflict but does not compile, in two places.
draw.rspushes a root UAV's dynamic slot onself.dynamic, which #1056 replaced with the list'skeep_dynamic; the stack's tests that build aHostShaderlack the newroot_uavsfield. Both are fixed, with the rest of Impre-visible's list, in #1632. AI-assisted (Claude Code); no game data.@Marvisak on GitHub · 2026-11-25 00:31 UTC · original
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.Root UAVs stacked on #489/#302: main has
HostShader::root_uavs,u<slot> space1and title-memory root views (27c3dc9d,0f637570).If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed