Recompiler: direct DXIL LDS accesses stop below the safe barrier's words #3468
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3468"
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?
Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T22:39:55Z.
Follow-up to #3264 (merged). With LDS and a safe multi-wave barrier, the barrier keeps its counts in
xcl_lds[8189..8190]andlds_topis 8188, but only the split form clamped the program's own LDS indices tolds_top. A native wave64 or wave32 program with several hardware waves a group could write the top of LDS over the barrier's counts. The HLSL path clamps every LDS access toXCL_LDS_TOP(8188) in this case (emit.rs,safe_barrier_prelude). Direct DXIL now does the same wheneverlds_topis below 8191. Found while comparing amd-dev's declared-LDS commit with #2937, whose clamp has the same condition.What is in it
crates/xcl/src/gpu/dxil/lower_mem.rs:lds_indexclamps whensplit || lds_top < 8191(DS loads, stores and atomics)crates/xcl/src/gpu/dxil/lower_geom.rs: the mesh epilogue's LDS reads, the same conditioncrates/xcl/src/gpu/dxil/robustness_tests.rs:lds_accesses_stop_below_the_safe_barrier_words(native wave64 and wave32, 16 x 16 threads). It fails without the fix and passes with it.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4on4a777f16: 2777 passed, 0 failed, 49 ignored. SKIPPED GPU tests: 45 distinct notices, almost allno wave64.Regression run
main:
this PR:
Not tested
AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by vasanex on 2026-11-30T03:35:23Z.
Unattended test report – posted automatically by an AI agent on the account owner's instruction. The account owner has not read or checked it. It is not a code review and not a merge-check.
Outcome of the tests: with this PR merged onto current
main, the whole suite has no failures on an RTX 3080, and the PR's new test fails on the samemainwithout the PR's two code changes.Tree tested
4a777f160e25fa5723e5dccdf6d6e44a70e576e4maincfb9753a8cbf5517ee36914b7041cb62b4a975829d7d26d1845dc5c618dbf9562da795189927196dMachine: NVIDIA GeForce RTX 3080 10 GB (no wave64), driver 621.40, AMD Ryzen 9 7950X, Windows 11 Pro build 26200, rustc 1.100.0, debug build, no
XCL_*variables set.Commands and results
cargo build --workspace: okcargo test --workspace --no-fail-fast -- --test-threads=4, once, on the merge: 2835 passed, 0 failed, 51 ignored. 25 SKIPPED lines, not counted as coverage: 22 no wave64, 2 no heap windows, 1 driver cache cannot be disabled without Developer Mode.cargo test -p xcl --lib lds_accesses_stop_below_the_safe_barrier_words -- --nocapturemaincfb9753awith only this PR'srobustness_tests.rsadded: 0 passed, 1 failed,wave64 true: no LDS index clamped to 8188. The test stops there, so this does not show whether its wave32 half fails without the change.Since the merge had no failures, the whole suite was not run on
mainalone.Not tested
lower_geom.rs(mesh epilogue): the new test translates a compute program. Whether another test reaches this change was not checked.Tool and model: Claude Code, Claude Opus 5.5 (read the diff before building it, merged, built, ran the tests and wrote this report).
Imported from ivall/xcl. Originally posted by Foniass on 2026-11-30T21:45:44Z.
Closing: superseded by
ada50ec5(Kalmarv, #3497). On main,lds_indexnow clamps wheneverlds_top < 8191, with a test of its own, which is this PR's fix for program LDS accesses. The only part left here is the same condition for the mesh epilogue's LDS reads inlower_geom.rs. That is a read-only path, and on mainlds_topis below 8191 there only in the split form, which already clamps. #3478 is rebased directly onto main without this PR.(Written with Claude Code, Claude Opus 5.5.)
Pull request closed