Repository navigation
xshader: keep a compute root's layout when the runtime appends its private root SRVs - #296
Open
NickStallman wants to merge 1 commit into
Open
NickStallman wants to merge 1 commit into
NickStallman wants to merge 1 commit into
Conversation
…ivate root SRVs The runtime appends the heap index map and the stride table to a root as root SRVs in space 32766. Two places matched a compute root by its exact parameter count: the root-constant layouts (`table, constants` and `table, table, constants`) and the registers that hold the dispatch IDs. With an SRV appended the constants were no longer declared and their registers stayed zero. That already affects programs translated with the stride table: 127 of the recorded ProjectScarlett requests gain their root constants back, and nothing else in 25,397 requests changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
The runtime appends two private root SRVs to a compute root when a program needs them: the heap index map (t0, space32766) and the buffer stride table (t1, space32766). The translator matched a compute root by its exact parameter count in two places:
sampler_heap::constantsacceptstable, constantsandtable, table, constants. With an SRV appended neither form matched, so the root constants were not declared and the registers they fill stayed 0.4 + nparams, and the two-table check), so an appended parameter could move them.The translation still compiled and ran, with zeros where the title's constants should be.
What it affects today
Of the 25,397 recorded ProjectScarlett requests, 127 are compute programs translated against a root with the stride table appended, and all 127 lose their root constants on
main. 123 areCS_RaytracingResolve; the others areCS_ComputeImposterTransform, the twoCS_EntityFireReduceClassificationvariants and one I could not name. In the resolve kernels the constants are four words: one is multiplied into a buffer index and one selects the kernel's mode.All 127 are among the compute programs that only translate since #216, the set whose replacement with no-ops got a run past the Xid 109 in #232. That is a correlation, not a finding. A ProjectScarlett run with only this change still hit the Xid 109 at the same point, so it doesn't fix the hang on its own (see #232). It is still wrong output for those 127 programs, and it would also hit the roots #294 gives the index map to, since most of those have root constants.
The change
sampler_heap::guest_paramsgives the root without its trailing space-32766 root SRVs. The console program was compiled without them, so they take no launch register. The compute forms ofconstantsand the dispatch-ID calculation use it. The pixel form, which names the index map itself, is unchanged.Tests
the_runtimes_private_root_srvs_leave_a_compute_roots_layout_alonetranslates a program undertable, constantswith the flag, then with the index map, the stride table, and both appended. It fails onmainat the first appended root (the constant buffer and its register load are missing).cargo testfortools/shader-compiler: 411 passed.python -m unittest discover -s tests -q: 426 ran, OK.mainand with this change: 0 recovered, 0 regressed (23,720 translated, 1,569 refused and 108 failed on both sides). Outputs: 23,701 byte-identical, 127 changed. Each changed output only gains thecbuffer TBIndex…declaration and its register loads.Checks
python tuxbox.py checkpassed on this branch, on AMD and NVIDIA:python tuxbox.py check --adapter 1002:13c0 --proton … --prefix … --windows-dxc …passed, 132 gates.🤖 Generated with Claude Code