Compute dispatches: a shader takes no more arguments from user SGPRs than it has (XboxBvhBuilder builds empty BLAS / TLAS) #146
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!146
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/146/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?
@ozimchuk on GitHub · 2026-11-23 15:27 UTC · original
ozimchuk:console-list-user-sgprs→main· +116 −6 · 5 files · 2 commits · merged 2026-11-23 21:08 UTCxbox_bvh_builder_builds_on_the_gpuandxbox_bvh_builder_builds_a_tlas_on_the_gpufail onmain: every ray that should hit misses, and the TLAS header is all zeros. They only do anything withXCL_PROBE_BVH_GPU/XCL_PROBE_BVH_TLASset, so a normalcargo teststays green.Cause
Since
18cb400the root arguments of a compute dispatch go into user SGPRs s4… while they fit, and the rest into the table at s[0:1] (console_list::layout_from_blob). That is what the console's compiler emits now. The shaders inside XboxBvhBuilder.dll were built the earlier way, the one HANDOFF describes first ("determined on 52 shaders of XboxBvhBuilder.dll"): four user SGPRs whatever the root signature, s4 the group id, every argument read from the table.The builder's first dispatch has a root signature of two descriptors and 16 constants. XCL puts the descriptors in s4…s7 and the constants in the table. The shader starts:
At +0x10 of the table it finds a constant that is 0, and leaves. All ten dispatches of a build run, none writes: after the list the destination and the scratch buffer are untouched.
Change
The number of user SGPRs is in each shader (COMPUTE_PGM_RSRC2, which
CsInterfacealready reads to place the group id). It is now kept per translated compute pipeline (real::pso_user_sgprs) and caps the inline part (console_list::inline_for): never more bytes in registers than the shader has registers above s3. Used in both places that lay arguments out, the console list replay andbind_abi(with only the first, the BLAS test passed and the TLAS test did not). Parameters stay whole (the inline part ends where the last parameter that fits ends), and the entry is forgotten with the pipeline, like its root signature. A shader the rule fits gets what it got before; with the count unknown the rule applies as before.Tests
New, no GPU:
xbox_bvh_builder_shaders_get_no_argument_in_a_register_they_do_not_have(needsXCL_SAMPLE_DLLS). It finds every compute shader in XboxBvhBuilder.dll by its DXBC header and compares the user SGPRs of its stage descriptor with the layout from its own RTS0:The same line on Windows 11 (26200) and under Wine. Also a unit test for
inline_for.With
XCL_CONSOLE_LISTS=1 XCL_PROBE_BVH_GPU=1 XCL_PROBE_BVH_TLAS=1, onmainat484dd57:main…builds_on_the_gpu, AMD iGPU (RADV)…builds_a_tlas_on_the_gpu, AMD iGPUcargo test -p xcl --libon the AMD GPU: 369 passed / 6 failed onmain, 370 / the same 6 here (the new unit test). The six are not about this: two are my packaging (tests/data/llvm-amdgpunot next to the binary), three are RADV's ACO (gpu_format_stores_atomics_global_lds,gpu_f64_roots,gpu_f64_math_random: they pass withRADV_DEBUG=llvmand on NVIDIA), one is Wine (get_proc_address_and_load_library_ex_reject_null_name: last error 87, not 127);gpu_pso_e2e(6 / 6 with a retail shader pack),gpu_compute_e2eand the test title are unchanged.What I could not check
The GPU runs are on Linux: Wine with vkd3d-proton, GNU toolchain build, and a vkd3d-proton patched to accept the objects whose vtable XCL replaces (a separate topic). On Windows only the no-GPU test was run. Since the argument layout is XCL's own code I expect the two GPU tests to fail on
mainand pass here on Windows as well; could you run them with the probe variables set?AI-assisted.
🤖 Generated with Claude Code
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175@ivall on GitHub · 2026-11-23 21:09 UTC · original
Merged (main
6da33fa). Checked on an RX 9070 (RDNA4) with the 22 PRs merged together on maineaa36b6:cargo build --workspace && cargo test --workspace -- --test-threads=4- 582 unit tests passed, 0 failed (20 ignored), the integration and e2e tests passed too; and the retail game still reaches its first menu (646 frames in 30 s, no device removal).