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>
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.
|
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at bfe5d2d: Tested with AI assistance (Claude). |
|
I tested exact bfe5d2d using an original translated compute shader and the production spilled root UAV binding path. The short view and existing 1 MiB edge behaved as expected. An unaligned root address did bind a native null UAV, but its deferred GPU-write bookkeeping still blocked a later CPU refresh on exact #1175 (17 observed, 77 expected). The focused fix and fixture schedule shadow work only when a native view covers complete dwords. AMD, NVIDIA and WARP pass with full GBV. Feel free to take the production hunk into this PR. This leaves the existing extent policy intact; the title producer binding and actual write extent remain unverified. |
|
Automated triage for the maintainers. Closing because this change is already in Draft integration of #1077 plus one test and a design doc (docs/compute-bvh-root-uav.md, against the short-docs rule); the capability is in main (27c3dc9). 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. |
Draft integration of #1077 with a focused regression for one synthetic compute shader that reconstructs a raw root UAV from a spilled argument. The new commit aligns the D3D12 validation host with the runtime's bounded, single-view UAV descriptor table.
The test writes one dword at byte offset 4 and checks the readback and an untouched control buffer. It passed on the hardware adapter and WARP. Workspace tests, shader Clippy and the asset policy check also passed.
This exercises the binding path relevant to #614. In-game BVH dispatch counts and rendering impact remain unmeasured. Details are in docs/compute-bvh-root-uav.md.
OpenAI Codex assisted with the implementation, tests and documentation.