dxil: batch consecutive v_readfirstlane/v_readlane exchanges in split-wave64 #2343
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!2343
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2343"
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?
@zondy1i on GitHub · 2026-11-25 16:07 UTC · original
zondy1i:dxil/split-readlane-batch→main· +358 −8 · 5 files · 1 commits · openPart of #1269. Re-opens #2071 (rebased onto current
mainb49be183; #2071 was auto-closed after its fork branch was briefly deleted while nudging a stalled GitHub PR sync).Prior independent hardware verification on #2071 (same implementation, pre-rebase): RTX 3090 multi-wave
Partner::Spin(@WebIdentity1), Intel Arc A770 (@JJAutoCompare), vkd3d-proton / dxil-spirv (@JoaoPauluu), AMD RX 9070 XT + RTX 3060 (@DarkPanda69), and RTX 3060 Ti (@DavidM1911). On the previous head77a9a6eof this PR: Linux / Wine / vkd3d-proton on an RX 7900 XT (@SlopTart), native Windows RX 9070 XT + RTX 3060 includinggpu::dxil::fuzz_tests(@DarkPanda69), and a review by @bmjask (no source-level defect found).Brings the split-wave64
v_readfirstlane_b32/v_readlane_b32exchange batching idea (similar to #944 for HLSL) to the direct DXIL backend (crates/xcl/src/gpu/dxil/).In split-wave64 mode (wave64 console shaders running on 32-lane hardware such as NVIDIA/Intel GPUs), every
v_readfirstlane_b32/v_readlane_b32previously emitted its own single-wordexchange_n(&[m])— 2 group barriers per instruction inPartner::Present(64-thread groups) and a full 4-block spin-wait loop with 2TGSM_FENCEbarriers and 2 groupsharedatomicrmwops per instruction inPartner::Spin(>64-thread groups). Consecutive independent runs now share a singleexchange_ncall. Native wave64 and wave32 lowering is untouched.What changed
crates/xcl/src/gpu/dxil/lanes.rs:Lw::read_lane_uniform_batch(&[(Value, Value)])to perform one cross-halfexchange_nacross a run of independent lane reads (reusingl & 31andlh == self.halfwhen consecutive items share the same lane index).crates/xcl/src/gpu/dxil/lower_valu.rs:Lw::lower_block_inststo greedily batch consecutiveVariant::Plainv_readfirstlane_b32/v_readlane_b32instructions within a basic block up toself.xslot, stopping at any SGPR read-after-write hazard (includingEXEC,VCCZ,EXECZ,M0, orEXECwrites).max_readlane_batch(stopping at CFG blockleaders) to size split-wave64 exchange slots inLw::new.crates/xcl/src/gpu/dxil/kernel.rs&crates/xcl/src/gpu/dxil/compact.rs:Lw::lower_block_instsin both the standard and compact forms.slotinLw::newwhensplitandmax_readlane_batch >= 2(up to 16 words without LDS; bounded to at most 256 total dwords = 1 KiB when sharing LDS).crates/xcl/src/gpu/dxil/core_tests.rs:split_readlane_batch_merges_present_and_spin_exchanges: verifies 6 consecutivev_readfirstlane_b32/v_readlane_b32collapse from 13 to 3 barriers (Partner::Present) and from 13 to 3atomicrmw addspin ops (Partner::Spin).split_readlane_batch_respects_sgpr_hazards: verifies lane-selector RAW dependencies andEXECwrites break the batch.gpu_split_readlane_batch_executes_correctly: GPU execution check on lower-half, upper-half, masked-lower-half, and dependent-chain cases.Tested
rustc 1.100.0, DXC /dxil.dll1.9.2602.17, NVIDIA GeForce RTX 3060 Ti 8 GB (driver621.01).cargo test --workspace -- --test-threads=4on3ec09d7: 1438 passed, 0 failed, 47 ignored across 37 test binaries (29 runtimeSKIPPEDnotices from adapter-gated tests); includessplit_readlane_batch_merges_present_and_spin_exchanges,split_readlane_batch_respects_sgpr_hazardsandgpu_split_readlane_batch_executes_correctly.xcl shaders <corpus> --direct --sample 500 --seed 1 --max-bytes 262144 --split 1 --validate --threads 8: 500/500 translated and validated (0 unsupported, 0 validator failures, 0 panics), run on the previous head77a9a6e; the rebase onto currentmainresolved one conflict incore_tests.rs(both sides appended tests) and changed no code.Not tested
gpu::dxil::fuzz_tests, AMD / Intel GPUs, Linux / Wine / vkd3d-proton (the reports above ran them on77a9a6e).Regression run
main:PR:
AI use
Antigravity (Gemini 4 Neon) assisted with implementation, IR/hazard/GPU tests, and validation; all changes were reviewed and verified locally.
@SlopTart on GitHub · 2026-11-25 16:22 UTC · original
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).No Linux/Wine report in the thread yet; adding one.
gpu_suite (--release --locked,--test-threads=2): 145 passed / 3 failed / 1 ignored, same three baseline failures as plainorigin/mainon this rig (rig's known baseline: fuzz seed 1003 of #2115,gpu_nonfused_mad_and_mac_prevent_fma_contraction,gpu_depth_buffer_created_for_unordered_access_is_placed). The +1 pass vs the pre-PR count is this PR's newgpu_split_readlane_batch_executes_correctly, green.gpu::dxil::core_tests::split_readlane_batch_merges_present_and_spin_exchangesand...split_readlane_batch_respects_sgpr_hazards: both pass, targeted run.Not tested: retail titles (no title data on this lane, counts only).
AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
@DavidM1911 on GitHub · 2026-11-25 18:25 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!
@zondy1i on GitHub · 2026-11-26 03:04 UTC · original
Rebased onto current
main(b49be183); the only conflict was incore_tests.rs(both sides appended tests at the end, kept both) and no code changed. Re-ran the full workspace suite (1438 passed, 0 failed) and a 60 s smoke on the new head3ec09d7; description updated with the new smoke block.Re @bmjask's non-blocking note: a graphics-stage (pixel / geometry) execution case for the shared lowering is not in this PR; the new GPU test is compute-only. I listed it under "Not tested".
@DarkPanda69 on GitHub · 2026-11-25 16:31 UTC · original · edited 2026-11-26 03:26 UTC
Update for head
3ec09d7: paired rerun onmainb49be18withXCL_DIRECT_DXIL=1, same cards. On both, the only result changes againstmainaregpu_split_readlane_batch_executes_correctly,split_readlane_batch_merges_present_and_spin_exchangesandsplit_readlane_batch_respects_sgpr_hazards, all ok, with no new skips. RX 9070 XT: 708 → 711 passed, 2 failed (the #2115 fuzz seeds 722 / 1599, the same onmain), 6 SKIPPED. RTX 3060: 710 → 713 passed, 0 failed, 24 SKIPPED.Native Windows AMD run, including
gpu::dxil::fuzz_tests(both listed as untested; the AMD run above is Linux / RADV), plus an RTX 3060, paired againstmainwith the direct translator on.Head
77a9a6eapplied onmain3f4495a, debug, Windows 11 Pro 26200:cargo test -p xcl --lib -- gpu:: --test-threads=4:gpu_split_readlane_batch_executes_correctlyok on both cards. RX 9070 XT (RDNA4, 32.0.32029.2010): 646 passed, 2 failed, 22 ignored. RTX 3060 (32.0.16.1088): 648 passed, 0 failed.gpu::dxil::fuzz_tests: on the RX 9070 XT the same two fail with and without this PR,fuzz_validate_and_gpu_1(seed 722) andfuzz_validate_and_gpu_3(seed 1599), the AMD driver issue tracked in #2115; every other fuzz group passes. On the RTX 3060 all pass. So the PR adds no fuzz failure.XCL_DIRECT_DXIL=1for the wholegpu::filter: on both cards the only differences frommainare the 3 new tests (all ok); no existing test changes result or skip state.Not tested: a title, Intel.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
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.