Repository navigation
Recompiler: solve split-wave64 mask liveness per basic block with precomputed operand plans - #1090
Conversation
…computed operand plans Co-Authored-By: Gemini 4 Neon <noreply@google.com>
|
NVIDIA (32-lane) run, since Not tested lists the full suite and live split-wave64 compilation on a wave32-only GPU. Tested
Not tested
AI use
|
towiice
left a comment
There was a problem hiding this comment.
Tested:
- Hardware: NVIDIA GeForce GTX 1650 SUPER (Turing TU116, 4 GB VRAM, wave32, driver 610.88), Windows 11 x64 (26H2 / build 26300), DXC v1.9.2609 (
01b62ad4), toolchainstable-x86_64-pc-windows-gnullvm(llvm-mingw 23.1.6), debug build. cargo test -p xcl --lib gpu::recomp::x64_masks: 19 passed, 0 failed, 1 ignored (0.09 s), includingblock_liveness_matches_reference_bit_for_bit,use_plan_matches_fallback_across_all_rdna2_instructions, andnested_loop_ranges_matches_quadratic_merge_on_overlapping_intervals.cargo test -p xcl --lib gpu_split_wave64: 5 passed, 0 failed (1.50 s) on wave32 hardware:gpu_split_wave64_lane_local_masksgpu_split_wave64_cross_half_operationsgpu_split_wave64_local_and_exchanged_masks_in_diverging_wavesgpu_split_wave64_waves_divergegpu_split_wave64_masks_read_whole_after_partial_writes
Not tested: release benchmark (bench_whole_live_out), full workspace suite, retail titles (smoke.ps1).
|
Wine/RDNA3 datapoint: merged this head (lane merge
Per-block mask liveness reads fine on native wave64 hardware, but it does not move the nondeterministic exchange cluster documented in my #772 follow-up. One mechanical note: this head and #1111 both rewrite Counts only, no game data. Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting. |
|
Tested on NVIDIA Ampere (32-lane waves, split wave64): passes
Not tested: AMD, any title (no smoke run). AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report. |
|
Independently tested the Wave64 mask-liveness optimization on commit Environment:
The benchmark passed, including the equality assertions between the reference and optimized implementations. ChatGPT assisted with the testing procedure and report preparation. |
What is in it
Accelerate split-wave64 SGPR mask liveness analysis (
crates/xcl/src/gpu/recomp/x64_masks.rs), which runs during shader translation for wave64 compute, mesh, and geometry programs on 32-lane-wave GPUs:LOOP_GUARDexit mask). Because(X & !k) | X == Xfor bitmasks, the constant per-block exit mask collapses out of intra-block composition, reducing the backward fixpoint from instruction granularity (O(iters * N)) to basic-block granularity (O(iters * B)) with a single linear backward pass per block to reconstructlive_out.BTreeMap<u64, usize>PC table, per-instructionVec<usize>successor lists, and per-instructionVec<Option<usize>>loop-exit lists with binary search on sorted PCs, an inlineBlockSuccenum, and a single flatexit_targetsbuffer populated via anO(B * depth + L log B)sweep.UsePlanTable): Lazily precompute static bit-range descriptors and fixed register masks per(InstEnc, Encoding)in a flat open-addressed table, eliminating per-instruction string.contains()scans and linearEncoding::fieldlookups inuses().Release benchmark (
cargo test --release --lib gpu::recomp::x64_masks::tests::bench_whole_live_out -- --ignored --nocapture, synthetic multi-loop shaders with nested loops, diamond branches, compares,v_cndmask, and carry chains; bit-for-bit verified against the original solver):whole_live_out_reference)whole_live_out)Tested
rustc 1.100.0 (0ef1bc386 2026-11-09)(stable-x86_64-pc-windows-msvc), debug and release.cargo test --lib gpu::recomp::x64_masks: 19 passed, 0 failed, 1 ignored (manual release benchmark). Includes exhaustive equivalence check ofuses()vsuses_fallback()across every RDNA2 instruction and encoding, 200-case fuzz check ofnested_loop_ranges()against the quadratic merge, and bit-for-bitwhole_live_out()equivalence across synthetic multi-loop shaders for bothend_reads_all = falseandtrue.cargo test --release --lib gpu::recomp::x64_masks::tests::bench_whole_live_out -- --ignored --nocapture: 1 passed, 0 failed (11.13x–23.37x speedup).cargo build --release -p xcl: succeeded cleanly.Regression run
Baseline (
origin/main):PR (
7bea019319cc08a54cdb3c9e49a0941d88b35283):Not tested
cargo test --workspaceand live split-wave64 shader compilation on an NVIDIA (wave32-only) GPU; covered by the exhaustive unit and bit-for-bit equivalence tests above.AI use
UsePlanTable, equivalence tests, and release benchmark, and ran local builds, unit tests, and the retail smoke run.