Repository navigation
Recompiler: mark SRC_VCCZ/SRC_EXECZ whole-live in x64_masks S_MOVREL and VOP3 mask ops - #2597
Conversation
…and VOP3 mask ops Fix two soundness bugs in split-wave64 mask liveness (`x64_masks::uses` and `uses_fallback`): 1. `S_MOVREL*` with `SSRC0 == 251` (`SRC_VCCZ`) or `252` (`SRC_EXECZ`) clamped `raw` to `124` and dropped the whole-`VCC` read; union `scalar_code(raw, 1)` alongside `range(src, 124 - src)` so `SRC_VCCZ` marks `VCC` whole-live without setting spurious bit 125 for `SSRC0 == 124`. 2. `ENC_VOP3` / `VOP3_SDST_ENC` per-lane mask consumers (`V_CNDMASK_B32`, `V_ADD_CO_CI_U32`, `V_SUB_CO_CI_U32`, `V_SUBREV_CO_CI_U32`) skipped `SRC2` unconditionally, dropping whole-`VCC` / `EXEC` reads when `SRC2` is `251` (`SRC_VCCZ`) or `252` (`SRC_EXECZ`). Record `is_per_lane_mask` on `DynOp` (mirrored in `uses_fallback`) so `251`/`252` stay whole-live while lane-local SGPR/`VCC` (`106`) mask pairs remain omitted from `whole`. Also add a guard test verifying `ENC_VOP2` carry-out SDWA (`VOP2_VOP_SDWA`, including `OMOD = 2` with bit 47 set) always overwrites `VCC` and extend `use_plan_matches_fallback_across_all_rdna2_instructions` to `Variant::Sdwa`. Part of xcl-dev#675 Part of xcl-dev#1833 Part of xcl-dev#1269 Assisted-by: Google Antigravity (Gemini 4 Neon)
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! — Devin |
|
Native wave64 run (listed as untested; 21 wave64 GPU tests skipped on the RTX 4060) on an AMD RX 9070 XT, plus an RTX 3060: the 3 new tests pass, and nothing else changes in the GPU suite. Head
On both cards, the only result changes against Not tested: the D3D12 debug-layer tests (no |
… mask ops (port upstream xcl-dev#2597) Soundness fix in the shared use/liveness analysis: SSRC0 251 (VCCZ) / 252 (EXECZ) read the whole VCC/EXEC, and a per-lane SRC2 that is a mask constant (251/252) keeps the mask whole-live instead of being dropped. Whole-file diff lands verbatim (fallback + table paths + new tests).
|
merge-check |
|
merge-check |
What is in it
Fixes two soundness bugs in split-wave64 mask liveness (
crates/xcl/src/gpu/recomp/x64_masks.rs), applied symmetrically to bothuses_with_tableanduses_fallback:S_MOVREL*withSSRC0 == 251(SRC_VCCZ) or252(SRC_EXECZ): computeslet raw = ...; let src = raw.min(124);and unionsscalar_code(raw, 1)alongsiderange(src, 124 - src)soS_MOVRELD_B32/S_MOVRELD_B64readingSRC_VCCZmarkVCCwhole-live instead of clamping251torange(124, 0) == 0(and without setting spurious bit 125 whenSSRC0 == 124).ENC_VOP3/VOP3_SDST_ENCper-lane mask consumers withSRC2 == 251(SRC_VCCZ) or252(SRC_EXECZ): addsis_per_lane_masktoDynOp(with the matching check inuses_fallback) soV_CNDMASK_B32,V_ADD_CO_CI_U32,V_SUB_CO_CI_U32, andV_SUBREV_CO_CI_U32keepVCC/EXECwhole-live whenSRC2is251/252, while keeping lane-local SGPR andVCC(106) mask pairs omitted fromwhole.s_movreld_with_src_vccz_marks_vcc_whole_liveandvop3_per_lane_mask_ops_with_src_vccz_mark_vcc_whole_live(withusesvsuses_fallbackparity checks), adds a guard testsdwa_vop2_carry_always_overwrites_vcc_even_with_omod_bit47verifyingENC_VOP2carry-out SDWA (VOP2_VOP_SDWA, even withOMOD = 2setting bit 47) still overwrites onlyVCC, and extendsuse_plan_matches_fallback_across_all_rdna2_instructionstoVariant::SdwaacrossENC_VOP1,ENC_VOP2, andENC_VOPC.Part of #675
Part of #1833
Part of #1269
Tested
origin/main(b49be183) with the new tests (cargo test -p xcl --lib gpu::recomp::x64_masks:: -- --test-threads=1 --nocapture): 20 passed, 2 failed (s_movreld_with_src_vccz_marks_vcc_whole_live,vop3_per_lane_mask_ops_with_src_vccz_mark_vcc_whole_live), 1 ignored (bench_whole_live_out); thesdwa_vop2_carry_always_overwrites_vcc_even_with_omod_bit47guard passed.cargo test --release -p xcl --lib gpu::recomp::x64_masks:: -- --test-threads=1 --nocapture): 22 passed, 0 failed, 1 ignored (bench_whole_live_out), 0 skipped.XCL_ADAPTER=warp,XCL_WARP=1,cargo test --release -p xcl --lib gpu::recomp::x64_masks:: -- --test-threads=1 --nocapture): 22 passed, 0 failed, 1 ignored (bench_whole_live_out), 0 skipped.cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture): 37 test binaries (36 compiled + 1 doc-test), 1438 passed, 0 failed, 47 ignored, 29SKIPPEDlines:no wave64on wave32-only RTX 4060 (dispatch_chain_native_wave64_builds_whole, 4 ingpu::recomp::lower, 14 ingpu::recomp::lower_dxil, 2 ingpu::recomp::tests)per-lane form: refusedingpu::recomp::lower_dxil(f16 arithmetic, f16 packed, f32 conversions on wave32)no d3d12SDKLayers.dllx2,uploads_start_from_each_subresources_state)cannot disable the driver cache(shaders::tests::pso_measurement_compiles_an_exact_synthetic_record)no heap windows(heap_window_out_of_memory_falls_back_to_the_switch_form)Regression run
Paired 60-second smoke runs on NVIDIA GeForce RTX 4060 against
origin/main(b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7):PR head:
Base (
origin/main):Both runs exit
0x0with steady60 60 60presents per 2 s, 0 device removals, and 0 crashes (1557 vs 1533 frames; peak commit 13969 MB vs 14018 MB).Not tested
d3d12SDKLayers.dllis not installed on this host; 3 tests skipped).bench_whole_live_out(manual--ignoredrelease benchmark) and the other 46#[ignore]tests.emit.rscode generation forS_MOVREL*SSRC0=251(intentionally out of scope for this liveness-only fix).AI use
Written and verified with Google Antigravity (Gemini 4 Neon). Every change in
x64_masks.rs, the failing-first reproducer, the release RTX 4060 / WARP / full workspace test runs, and the paired 60 s smoke runs were verified locally.