Repository navigation
Conversation
A compute program whose root signature does not fit the 16 user SGPRs finds its arguments through a spill table: s[0:1] holds a pointer (high dword masked to 40 bits, usually copied to s2/s3 first) to a table of the user data, and the program s_loads descriptors and constants from it. Table dword k is user SGPR 16 + k. The translator only knew addresses that come from the declared root layout, so every such program failed with "an address in an SGPR that is no root parameter". For compute programs whose root layout lies entirely at user SGPR 16 and above, loads from that pointer with a constant offset become s_mov_b32 copies of the user SGPRs the dwords stand for, before the SSA is built, so resource tracking and lowering see what they see for ordinary root arguments. Only straight-line code from the pointer's set-up is rewritten (tags are dropped at branch targets and on any overwrite of the pointer registers); other loads stay loads. On the title's world shaders this took the "SGPR that is no root parameter" failures from 34 programs to 4 in one run. Other failures that were hidden behind it now show (address not from a root parameter, root UAV or typed root view, an address from a phi...). Whether the translated programs render correctly has not been checked beyond that. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The spill-table rewrite turned each load into `s_mov_b32 sK, s(16+k)`, which reads what the register holds at that point. A program that has already written SGPRs 16 and up (the destination of an earlier table load, say) then reads the wrong root argument, with no refusal. The program now first copies the user SGPRs its table loads stand for into a block of SGPRs it never reads or writes, and the loads read that block. Without such a block below VCC, or when a branch can return to the program's entry, nothing is rewritten. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With 16 user SGPRs the hardware puts the thread-group ids in s16 and up, where the spill rule reads root arguments, so a program reading both got the root argument for the group id (reported on Marvisak#489). Such programs are now left to fail as they do without the rule. victory translate now builds with the same rule, so its counts match the runtime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
s_and_b32 on the table pointer's high dword kept its provenance for any literal mask up to 0xFFFF and any inline constant, so a mask such as 0x7f or 1, which can point to another table, still had its loads rewritten to the root arguments. Only a mask keeping the high dword's eight low bits (40-bit addresses) keeps it now. Co-authored-by: NexForever <37888211+NexForever@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a root view)
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 (Marvisak#302, Marvisak#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 <noreply@anthropic.com>
|
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):
These four are missing from 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, AI-assisted (Claude Code): the runs and log analysis were automated. The hardware, title copy and runs are the user's. |
|
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 873548f: Tested with AI assistance (Claude). |
|
Thanks, that matches what we see: The 11 programs that stop at
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. |
Adapt the writable root view from Marvisak#1077 (873548f) and the bounded validation root signature from Marvisak#1175 (bfe5d2d) to the Linux backend. Resolve the backing resource and byte offset at bind time, retain and synchronise the view range, and keep dynamic slots alive through submission. Keep the existing stride table, diagnostics and cache entries usable. Exercise a translated spilled root UAV through a guest heap and overlapping root bindings on the native GPU. Check final guest memory and an out-of-bounds control word.
|
For reference: on top of the shader stack (#1319 to #1511) this merges without a conflict but does not compile, in two places. |
…sak#709 on Marvisak#1077's root UAVs Marvisak#709's test used Marvisak#294's Root::Uav; this host binds a zeroed root UAV (SetComputeRootUnorderedAccessView) and reads it back after the views' UAVs. Also the fork's track() signature, and stride-0 structured accesses keep the fork's runtime stride-table view (Marvisak#193/Marvisak#704) after Marvisak#709's structured(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Automated triage for the maintainers. Closing because this change is already in Root UAVs stacked on #489/#302: main has 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. |
Stacked 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