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>
A title can pass a 64-bit buffer address as two root-constant dwords, low half first in consecutive user SGPRs (within one parameter or across two). Resource tracking only knew addresses from tables, heaps, root descriptors and the code, so programs reading through such an address failed with "an address from a root parameter that is no address" (or, for a pair past dword 0, "an address in an SGPR that is no root parameter"). Once the spill-table rewrite exposes their arguments, several compute programs stop there. The tracker now recognises a pair from its high half: a root constant (possibly plus a carry) whose user SGPR below holds a root constant that the low half's sum starts from. Nothing else has a root constant as its high half, so no existing address is reclassified. Addresses get the dword of their base and Resources lists the pairs. Reads through a pair (global_load_*, s_buffer_load_* on a descriptor built around it) become a raw root SRV t<n> in a new ROOT_ADDRESS_SPACE, listed in HostShader::address_srvs with the two constants. Writes, typed views and plain scalar loads through a pair stop with a specific reason. The GPU layer declares one SRV root parameter per view, composes the address from the constants' current values at every draw and dispatch (pair_address) and binds it through root_view. An unset half or an address below 0x10000 drops the draw or dispatch with a warning. The shader cache encodes the new list; the test host binds it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
s_load_dword* through an address the title passes as two root constants reads the root SRV bound at that address, as s_buffer_load_dword* on a descriptor built around one does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LAKSHYA-cmd-tech
left a comment
There was a problem hiding this comment.
Verified on Windows 11 MSVC (Rust 1.98.1).
- All 10 shader pair tests (\scalar_loads_through_a_root_constant_pair_read_its_root_srv, \global_loads_through_a_root_constant_pair_read_its_root_srv, root constant pair tracker tests) pass.
- All \�ictory-gpu\ tests (\�ddresses_in_root_constants_are_composed_from_both_halves,
ull_and_low_addresses_are_unset, \shader_cache\ encode/decode) pass. - Correctly lowers 64-bit addresses passed via root constant pairs into raw root SRVs (\ \ in \ROOT_ADDRESS_SPACE), dropping dispatches cleanly if the address is unset or below \MIN_ADDRESS\ (0x10000).
- Fully compliant with asset policy (\cargo xtask policy\ clean: 151 files).
catminou4
left a comment
There was a problem hiding this comment.
Heads-up: no longer merges cleanly with current main (7374bfb) — conflicts in victory-gpu/src/draw.rs, victory-shader/src/emit/lower.rs and valu_tests.rs. Needs a rebase.
For the record, the shader crate on the head passes on macOS 26 arm64 / rustc 1.98.1: cargo test -p victory-shader --locked → 66 passed / 0 failed (+2 ungated vs its base). The GPU-side behavior (two-root-constant buffer reads) still needs the Windows run.
| .ok_or("a descriptor built around a table in the code")?; | ||
| if rp.root == RootType::Constants { | ||
| return match props.0 { | ||
| 11 => self.address_srv(address), |
There was a problem hiding this comment.
If a shader adds an offset to the address pair before a buffer load (such as pair + 0x100), the translation drops the offset
I would add the offset there too or refuse as non-zero offset
There was a problem hiding this comment.
Also the PR's tests only use an offset of zero so they miss this
| } | ||
| for (n, &view) in t.address_srvs.iter().enumerate() { | ||
| stage.address_srvs.push((view, params.len() as u32)); | ||
| params.push(D3D12_ROOT_PARAMETER1 { |
There was a problem hiding this comment.
Check D3D12's limit of 64.
Count the u32s you're pushing. Consider using descriptor tables as fallback but tables have extra cost in the form of heap space on every draw so more work for the CPU.
Make sure to log the fallback i.e "root signature over 64 DWORDs" in the code for debugging
There was a problem hiding this comment.
If the limit is never reached maybe a hard cap and error instead
|
Windows native D3D12 verification for
No game data used. AI-assisted; tests run on my machine. |
|
Verified and resolved cleanly against the latest dynamic slot reclaim and root signature fallbacks in LAKSHYA-cmd-tech@44aec54 (branch eature/root-constant-addresses). |
|
Rebase check against current main (AI-assisted, no game files) This branch no longer merges cleanly into main at 8e79c80: 8 conflicts in draw.rs, lower.rs and valu_tests.rs. I resolved them and have a version that applies cleanly. The resolutions were: draw.rs: kept main's bind -> bool, added this PR's bound flag and note_drop. Results: cargo test -p victory-shader (Linux, Rust 1.100.0): 80 passed, 0 failed, 1 ignored. Plain main gives 70 passed. |
Test Results –
|
|
A/B tested Both sides are actual title runs with the game (menus → intro → loading → world), not synthetic shader tests. Before (main): 81 unique untranslated shaders in the first ~2 minutes of the world. Top reason exactly the one this targets: After (this branch): 82 unique untranslated shaders, but: So the #1 reason from #293 is gone, and what remains matches your table's “+ this” row (root UAVs, typed root views, phi). The mesh pipeline still builds ( Later in the same run: Not tested: Windows, other GPUs, the #193/#539 stacks, and a full world session — the device was removed after ~3 minutes. Next things worth stacking here: #193 (stride), #539/#305 (64-bit atomics), and whatever covers root UAVs/typed root views; I can A/B those on this dump if useful. |
|
Independent root-constant address tests on GTX 1660 Ti, NVIDIA 581.42, Windows 10 22H2 build 19045.6466, Ryzen 5 3600, Rust 1.98.1 MSVC and Agility SDK 1.620.2. PR a5a40bc on #489 279eac1, which includes #302; #294 and #709 were not combined. Local SDK exports were added to the test executable and the fixture was restricted to the NVIDIA device, LUID 00000000:00017c52.
Codex prepared the worktree, ran the tests and drafted this report. |
…UAV raw view) Targets the 'emit: a typed root view' group: 41 -> 40 failing containers in the offline translate (the typed-root-view program now translates); prerequisite for Marvisak#710. Conflicts with the V_DYNAMIC stride path in lower.rs: kept V_DYNAMIC (no stride check) inside the PR's new structured() helper. The new-tree bounds check from Marvisak#650 only covered the in-element offset, so for a root view the index*stride is now folded into the byte offset before the check, and the PR's GPU test passes the view size in root constant 0 as Marvisak#650 requires. resource::track gained a parameter in Marvisak#294; one test call updated for it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
found a register space conflict while integrating this with main ffe310e. ROOT_ADDRESS_SPACE and STRIDE_SPACE both use register space 2. moved ROOT_ADDRESS_SPACE to space 3 in my integration branch. clippy and workspace tests pass with the combined changes. integration: |
…arvisak#710 part 1) Recognize 64-bit buffer addresses passed in two root-constant dwords, emit root SRVs in ROOT_ADDRESS_SPACE (3, distinct from STRIDE_SPACE 2), and bind them via bounded root_srv_table when enabled (Marvisak#493).
Port of upstream PR Marvisak#710 (b1faa34, ac1bc81, a5a40bc). XboxBvhBuilder's compute programs pass a 64-bit buffer address as two root-constant dwords and read it with global, scalar and buffer loads; translation stopped on them with "an address from a root parameter that is no address". The resource tracer pairs the two halves. The lowering binds the address as a root SRV t<n> in ROOT_ADDRESS_SPACE; the GPU side composes it from the constants' current values at every draw and dispatch, and drops one whose address is unset or below 64 KiB. Writes and typed views through such an address still stop the translation with a reason. Unlike Marvisak#710, reads are bounded as Marvisak#650's root views are: the host passes the bytes it maps from the address in a user-data dword past the console dwords and the heap guard slots (AddressView::size), and reads past it return 0. A root view has no bounds on the host, and a read past the host copy is a page fault NVIDIA can hang the GPU on. Census rv709 -> rv710: 21751 -> 21756 validated (compute 1428 -> 1433), no program regressed; the 10 "no address" refusals are gone.
|
Heads-up for anyone measuring this PR offline. On my own copy of the package (build
So this pack does not appear to contain whatever your commits change, and it contains 195 cases of the reason this row is usually described by, in a stage the row is not usually associated with. Table, method and the comparison against today's main in my comment here: #293 (comment) Written with an AI assistant. |
|
In-game test on AMD (RX 9070 XT), #302 + #489 + #710: the runtime refusals of this class go from 34 programs to 1 Machine: RX 9070 XT (native 64-lane waves), Adrenalin 32.0.32029.2010, Ryzen 7 5800X, Windows 11 build 26300. Title 1.0.2.1, diag build, prologue world, Tree: r4tedx Runtime result (same scene, before and after; per-frame drops summed over the programs that do not translate, peak per program):
As @Brazlucas measured on #489, most of the 34 now stop one step later:
Stability: several world runs with this stack, up to 25 minutes, with no device removal from it. The world is still black on this card, for other reasons (see #71). Note: offline AI-assisted (Claude Code): measured in-game on this machine with a diag build. Counts and hashes only. |
…ithout the per-lane form Marvisak#710 collected them at the end of track(); the fork returns early without `lanes`, which left pairs empty ("an address in root constants without its high half"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Automated triage for the maintainers. Closing because this change is already in Stacked on #489/#302. Addresses passed in two root constants are served in main by the raw-address page table (27c3dc9, Lower::memory), builder programs included. 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. |
Depends on: #302 and #489 (this branch is on top of #489, which carries #302). The measured programs also need #294 and #709 to translate all the way.
What
Reads through a 64-bit address that the title passes as two root constants (low half, high half). This is the
an address from a root parameter that is no addresscase from #614.victory-shader,resource.rsvictory-shader,emitglobal_load_*, ans_load_dword*, or ans_buffer_load_*on a descriptor built around the pair reads a raw root SRV,t<n>in a newROOT_ADDRESS_SPACE. The list isHostShader::address_srvs.victory-gpubindcomposes the address from the two constants' current values and binds it withroot_view.Why
In the opening cutscene, 8 compute programs stop at
an address from a root parameter that is no addressonce #302 rewrites their spill-table loads. Onmainthey stop earlier. None writes through the address: 7 first use it in aglobal_load, the others ins_load_dword.I measured with the title, cutscene, in local builds:
no addressno address; 3 at root UAVs, 2 at typed root views, 2 atan address from a phi, 1 at another non-root addressan address from a phi(2), another non-root address (1) and an LDS operation (1)The GPU bound the views without errors in those runs.
Tested
Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.1088), Rust 1.98.1.
resource.rs;lower.rs;global_loadand ans_load_dwordthrough a pair, invalu_tests.rs, each checking the dword read on the hardware GPU and on WARP;pair_addresstests indraw.rs.cargo test -p victory-shader: 81 passed.-p victory-gpu: 46 passed, 1 ignored; withdiagnostics, 48 passed, 1 ignored.cargo test --workspace: 278 passed (on the first commit).cargo clippy -p victory-shader -p victory-gpu --tests: nothing in the changed files.cargo fmt --check: victory-shader clean; victory-gpu 79, the same asmain.cargo xtask policy: ok.Overlap with #294: this touches the same files (
draw.rs,pipeline/host.rs,shader_cache.rs, theemitstructs). I merged the two locally for the measurements above. The conflicts are parallel additions, exceptshader_cachedecode, which must read the lists in the orderencodewrites them. Whichever lands second rebases.Known limits:
AI-assisted (Claude Code). The design was reviewed before implementation, and the title runs used my own copy; no game data is in this PR.
🤖 Generated with Claude Code