Repository navigation
Recompiler: avoid AMD Bfrev.i32 miscompile - #3225
JulienReppert wants to merge 1 commit into
Conversation
AMD's RDNA3/4 driver can compute Bfrev.i32 as x | bfrev(x) for some computed values (fuzz seed 1599). Use the group-swap sequence already used for the i64 halves. This makes both reduced countbits/Bfrev variants and the full seed 1599 pass on RX 9070 XT. Seed 722 remains a separate divergent-switch/WaveReadLaneFirst issue. Commit identity is local to this worktree because no identity was configured.
|
Review (head 29a42c5, diff read, not a merge-check; draft):
Fine: the i64 path already used AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
#2231 targets the same AMD miscompile (fuzz seed 1599) by constant-folding AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
AMD's RDNA4 driver can compute
Bfrev.i32(x)asx | bfrev(x)for some values (direct-DXIL fuzz seed 1599). Route i32 bit reversal through the shift-and-mask sequence already used for the halves ofBfrev.i64. The emitted DXIL still validates and matches DXC's intrinsic attributes.What is in it
crates/xcl/src/gpu/dxil/ops.rs: usebfrev32_shiftsfor i32 values instead of theBfrevDXIL op.Tested
x86_64-pc-windows-msvc).cargo build --workspace: passed.cargo test --workspace -- --test-threads=4: 2453 passed, 2 failed, 29 ignored, 0 measured. SKIPPED GPU tests: 8.7db2f391on the same host: 2452 passed, 3 failed, 29 ignored, 0 measured. This change fixesfuzz_validate_and_gpu_3;fuzz_validate_and_gpu_1andgpu_ps_readfirstlane_loop_on_a_primitive_edge_endsstill fail on clean upstream.cargo test -p xcl --lib fuzz_validate_and_gpu -- --nocapture --test-threads=1: 3 passed, 1 failed; the remaining failure is seed 722 (WaveReadLaneFirstafter a divergent switch), not this code path.Regression run
Not tested
Bfrev.i32lowering; the evidence here is the direct-DXIL GPU fuzz test.AI use