Repository navigation
Recompiler: a float v_cmpx through #1426's lowering keeps lanes outside EXEC out - #1876
Conversation
…s outside EXEC out thehollowedone's program on xcl-dev#1269 (Pipodi's review point 3 on xcl-dev#1745): EXEC = lanes 0-15 (`s_and_saveexec`), then `v_cmpx_le_f32 0, v1`, true in every lane, then `v_mov v2, 7`. The console, the HLSL path and xcl-dev#1426's per-instruction form write lanes 0-15; the per-lane form wrote all 32. The bridge runs xcl-dev#1426's lowering of a float `v_cmpx` with the guard `true`, so the lane's bit it reads back is the compare alone. The new EXEC is now that bit and the lane's EXEC before the instruction, as the per-lane form's own integer `v_cmpx` already did. Test: his program on the GPU (fails without the fix in lane 16).
|
On Ampere: RTX 3070 8 GB (32-lane waves), driver 616.56, Windows 11, debug,
AI-assisted (Claude Code). Synthetic tests only. |
|
Split-wave64 check of fe78c81 on an RTX 3080 Ti (621.35), Windows 11 build 26300, Rust 1.99.1 MSVC debug, DXC 1.8.2502.11. I extended the wave32 regression with a wave64 program that uses different EXEC masks in the two hardware waves, a mix of ordered float comparisons including NaN and signed zero, and unique destination sentinels. HLSL, per-instruction DXIL and per-lane DXIL all matched the CPU expectation in every lane: 13 writes in the lower half, 11 in the upper half, and all other destinations unchanged. Both EXEC dwords restored correctly. Replacing only the lowering with the pinned main version caused 14 out-of-mask writes in per-lane DXIL. Both reference paths still matched.
AI-assisted. Codex (GPT-6 family, exact variant unavailable) extended and ran the test and drafted this report. |
Hardware test report — commit
|
|
RDNA2 hardware check of the behaviour this PR assumes: confirmed at 64 and 32 lanes. Your "Not tested" lists native wave64 GPUs. I ran the test's instruction sequence as machine code on an RDNA2 GPU, without XCL or any shader compiler in the path, so this is the hardware's own answer rather than a translation's. Setup: Ryzen 9 9950X3D integrated Radeon (RDNA2, PCI 1002:13c0), Linux 7.0, amdgpu. A small runner uploads the instruction words and dispatches them through the kernel's amdgpu interface (compute, 64 threads in one group,
So on RDNA2 a float Not tested: the console itself (same instruction set, different chip and driver state), other compares, VOP3 encodings, partial waves. AI use: Claude Code (Claude Fable 5.2) wrote the runner, ran the programs on the machine above, and wrote and posted this comment at my request. |
, xcl-dev#1876, xcl-dev#1866) Brings main to full parity with upstream/main (62265d3): - xcl-dev#1005: skip VirtualQuery on committed coherent UMA windows in cpu_writes and kernelx - xcl-dev#1053: opt-in fast-boot env vars (Bink intro skip, frame interval override, device type, TTS mute) - xcl-dev#1876: float v_cmpx through xcl-dev#1426 lowering keeps lanes outside EXEC out - xcl-dev#1866: track SCC of mixed mask and number operations Conflict in crates/xcl/src/hle/xgameruntime/api.rs resolved by keeping both the in-process Wine XAsync path and upstream's XCL_MUTE_TTS XAccessibility path. Assisted-by: Antigravity (Gemini 4)
Pulls in xcl-dev#1836 (graphics and two-pass PSO disk cache + lazy MS/GS + shader build coalescing), xcl-dev#1930 (DXIL CSE across discard), xcl-dev#1900, xcl-dev#1005, xcl-dev#1053, xcl-dev#1864, xcl-dev#1866, xcl-dev#1869, xcl-dev#1876, and xcl-dev#1898 while keeping our RDNA4 MSAA clamp (xcl-dev#1908), wave64 graphics Direct DXIL guard (xcl-dev#1913), atomic writable-range tracking, static-sampler cache keys, and 4M-group indirect dispatch clamp.
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
A float
v_cmpxlowered through #1426's semantics in the per-lane form (XCL_PER_LANE=1, #1745) left EXEC as the compare alone, so lanes that were outside EXEC came back in. Point 3 of Pipodi's review of #1745; thehollowedone reproduced it on the GPU (#1269). Part of #1269.His program: EXEC = lanes 0–15 (
s_and_saveexec), thenv_cmpx_le_f32 0, v1(true in every lane), thenv_mov v2, 7. The console, the HLSL path and #1426's per-instruction form write lanes 0–15; the per-lane form wrote all 32. The bridge runs #1426's lowering with the guardtrue, so the lane's bit it reads back is the compare alone. The new EXEC is now that bit and the lane's EXEC before the instruction, as the per-lane form's own integerv_cmpxalready did. OnlyXCL_PER_LANE=1reaches this code.What is in it
crates/xcl/src/gpu/recomp/lower.rs(bridge): forv_cmpx, the lane's bit of the result is combined with its EXEC bit before the instruction.crates/xcl/src/gpu/recomp/lower_dxil.rs:a_bridged_v_cmpx_keeps_the_lanes_outside_exec_out, his program on the GPU. It fails without the fix (lane 16 gets 7).Tested
cargo test --workspace -- --test-threads=4onfe78c81(onmain689f2db): 976 passed, 0 failed, 45 ignored; 22 SKIPPED (18 "no wave64" on this GPU, 1 "no heap windows", 3 per-lane halves refused on purpose for gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426's f16 rounding).Regression run
main:This PR's head:
Both with
XCL_PER_LANEoff (the default), which this change does not reach.Not tested
XCL_PER_LANE=1; the regression runs are with it off, the default.AI use