Recompiler: size a compute program's LDS block from its LDS_SIZE #2146
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!2146
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2146"
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?
@grahamster2 on GitHub · 2026-11-25 06:15 UTC · original
grahamster2:lds-size-from-rsrc2→main· +186 −33 · 5 files · 1 commits · openEvery translated program that touches LDS declares
groupshared uint xcl_lds[8192](32 KB, the D3D12 limit), whatever the console program allocated. A compute program's allocation is inCOMPUTE_PGM_RSRC2.LDS_SIZE(bits 15..23, 512-byte units), which we already read from the FSSM descriptor. This sizes the HLSL block of a compute program to the next power of two that holds it plus the runtime words kept at the top: the split-wave64 exchange, the safe barrier's two words and the 2-D thread hand-out (XCL_WT). Accesses are masked withXCL_LDS_MASKinstead of8191u. LDS_SIZE 0 and the other stages keep 32 KB.With 32 KB per group, an NVIDIA Ampere SM holds 3 groups at once, which is 6 warps for a 64-thread group. In the split form nothing hides the meets' latency. Analysis and numbers: #675.
Part of #675.
What is in it
CsInterface::lds_bytesfrom RSRC2 (gpu/recomp/mod.rs);lds_words/lds_decland the layouts that used 8192 / 8191 / 8189 / 8190 / 8188 (gpu/recomp/emit.rs). Struct literals in tests getlds_bytes: 0.gpu/recomp/tests.rs):compute_lds_block_takes_the_programs_lds_size: block size and layout per LDS_SIZE, native / wave64 / split.gpu_compute_lds_ring_in_a_block_of_the_programs_size: an LDS ring plus an exchange, with the largest LDS_SIZE that still gets the smallest block and the program's words at its very end. Runs 64 / 256 threads and an 8 x 8 group, split and native wave32. With one word fewer reserved at the top, it fails.Tested
52577f9.cargo test --workspace -- --test-threads=4: 1156 passed, 0 failed, 46 ignored.lower/lower_dxilwave64 parity tests,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,heap_window_out_of_memory_falls_back_to_the_switch_form.bench_split_wave64loop with an LDS store and load per iteration: 2^18 threads x 8192 iterations, 64-thread groups, GPU timestamps, median of 7.xcl shaders --export-hlslon the retail title's pack: HBO (LDS_SIZE 512 B) now declaresxcl_lds[256]. The 84 LDS-using split programs allocate 512 B to 16.9 KB.Regression run
main (
cbc296a):this PR (
52577f9):Not tested
XCL_DIRECT_DXIL,gpu/dxil/lanes.rs) still declares 8192 words. It is unchanged and would be a follow-up.ds_*offset past its size, but dynamic addresses were not checked.AI use
@DarkPanda69 on GitHub · 2026-11-25 06:28 UTC · original
Tested:
gpu_compute_lds_ring_in_a_block_of_the_programs_sizepasses on AMD with native 64-lane waves, and on an RTX 3060.gpu::filter: 586 passed, 2 failed, 22 ignored. The 2 failures are the AMD fuzz seeds 722 and 1599 tracked in #2115, which fail the same way onmain.Head
52577f9applied onmain6ea813a,cargo test -p xcl --lib -- gpu:: --test-threads=4withXCL_ADAPTERset to each card.Not tested: the occupancy or speed change on AMD (correctness only), a title.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@JoaoPauluu on GitHub · 2026-11-25 06:29 UTC · original
A run with vkd3d-proton as the host D3D12. The DXIL goes through dxil-spirv and then the NVIDIA Vulkan driver, not the native-Windows path: this PR's 2 new tests pass, none skipped.
Tested
x86_64-pc-windows-gnu.52577f9as it is (merge base withmaincbc296a), no uncommitted changes. The lib test binary runs under Wine, one test per process.compute_lds_block_takes_the_programs_lds_size: okgpu_compute_lds_ring_in_a_block_of_the_programs_size: okNot tested
AI use
@DavidM1911 on GitHub · 2026-11-25 06:49 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.