Recompiler: a float v_cmpx through #1426's lowering keeps lanes outside EXEC out #1876
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!1876
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1876/head"
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?
@gefydev on GitHub · 2026-11-24 22:31 UTC · original
gefydev:per-lane-cmpx-exec→main· +36 −0 · 2 files · 1 commits · merged 2026-11-24 23:43 UTCA 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 #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
@upipibi on GitHub · 2026-11-24 22:39 UTC · original
On Ampere: RTX 3070 8 GB (32-lane waves), driver 616.56, Windows 11, debug,
fe78c81onmain689f2db.a_bridged_v_cmpx_keeps_the_lanes_outside_exec_out: passes, 2 of 2 runs.gpu::recomp::l*(lower, lower_dxil, lane_masks): 57 passed, 0 failed.AI-assisted (Claude Code). Synthetic tests only.
@thehollowedone on GitHub · 2026-11-24 22:42 UTC · original
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.
cargo test --offline --locked -p xcl --lib <filter> -- --nocapture --test-threads=1passed 1/1 for each filter,a_bridged_v_cmpx_keeps_the_lanes_outside_exec_outandscratch_bridged_cmpx_intersects_split_exec. Zero skips. Synthetic compute shaders only.AI-assisted. Codex (GPT-6 family, exact variant unavailable) extended and ran the test and drafted this report.
@eizispark on GitHub · 2026-11-24 23:03 UTC · original
Hardware test report — commit
fe78c81Verified
fe78c81b7b26ac2d0aa08b9d74503dd0d0c2a8a1(based onmain689f2db477c3c062cf162649781640ef8a977c18, clean merge): pass (0new failures vsmain689f2db).Tested
32.0.32015.16001), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 x64 (stable-x86_64-pc-windows-msvc,rustc 1.100.0 (0ef1bc386 2026-11-09)), debug tests + release smokecargo test --workspace --no-fail-fast -- --test-threads=4 --skip gpu::dxil::msaa_tests::gpu_direct_msaa_image_loads:973 passed, 2 failed, 45 ignored(8 skipped), vsmain689f2db972 passed, 2 failed, 45 ignored(8 skipped) on this adapter:--skip gpu::dxil::msaa_tests::gpu_direct_msaa_image_loads) and the 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1,gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_3) are pre-existing onmain689f2db(#1679) on RDNA4;0new failures8 skipped: 6gpu::recomp::lower_dxil::testsf16/f32 direct-DXIL per-lane cases refused where#1426semantics differ from the console's;shaders::tests::pso_measurement_compiles_an_exact_synthetic_record(Windows Developer Mode required,0x887A002D);heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowsgpu::recomp::lower_dxil::tests::a_bridged_v_cmpx_keeps_the_lanes_outside_exec_outexecuted on the GPU (0skips, both wave32 and native wave64) and passedlower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu,the_split_form_agrees_with_the_wave64_lowering_on_the_gpu,lower_dxil::tests::*,gpu_geometry_direct_records,gpu_direct_f32_round_modes_*,mesh_dispatch::tests::*,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,console_wave64_compute_through_the_pso_hook_dispatch_and_read_back) ran natively and passed on RDNA4Regression run (
scripts/smoke.ps1, 60 s, warm shader/driver cache)main(689f2db477c3c062cf162649781640ef8a977c18):PR (
fe78c81b7b26ac2d0aa08b9d74503dd0d0c2a8a1):Not tested
XCL_SHADER_BACKEND=dxil, Intel GPUs, Wine/vkd3d-proton, gameplay past the menusAI use
@tylerstraub on GitHub · 2026-11-24 23:57 UTC · original
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,
v0= thread index). The words were assembled with XCL's own encoder and checked with LLVM's gfx1030 disassembler. Differences from the test: the saved EXEC goes tos4instead ofs0(the runner passes buffer addresses ins0–s3),v2starts at 0, and aglobal_store_dwordofv2is appended.v1= −1.0, compare false in every lanev_cmpxSo on RDNA2 a float
v_cmpxleaves EXEC as the compare in the lanes that were in EXEC, as the fix assumes.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.
@DavidM1911 on GitHub · 2026-11-25 01:56 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!