Repository navigation
compute: accept vcc_hi as the wave32 mask of SDWA compares - #3157
Conversation
In the direct wave32 compute path a VOPC mask is one SGPR, so an SDWA compare or v_cmp_class may write it to vcc_hi (s107). The decoder capped the destination at vcc_lo. A wave64 container stage, graphics, v_cmpx with an SGPR destination and anything above s107 stay refused. native_sdwa_vcc_hi_hardware writes both masks to vcc_hi in two groups, reads vcc_hi back as the scalar source of a second compare, and checks both per lane against a CPU reference; native_direct_container checks the wave64 container, s108 and v_cmpx refusals. AI-assisted.
tedin7
left a comment
There was a problem hiding this comment.
Review of d3bc25a (updated with main). Comment only.
The SDWA compare destination limit becomes 107 (vcc_hi) only for direct wave32 compute (direct && !graphics && !wave64), and stays 106 for graphics and wave64, in both the compare-mask check and the class-modifier check. decode gets the wave size from its one direct caller, and the default wave64=false keeps the other callers as they were. The new refusal cases in native_direct_container_check.py cover vcc_hi under wave64, sdst 108 and v_cmpx with vcc_hi. They run without a GPU and pass here. The positive readback (native_sdwa_vcc_hi_hardware, wave32) skips on WARP and rests on the RTX 5080 run in the description, which also shows that the old limit fails it.
src/gfx1013_compute_native.cpp and tests/native_direct_container_check.py are also touched by cpp-migration. The change merges cleanly there; the native sweep on that merge is in the comment below.
Commands: git diff origin/main...pull/3157/head (read), git merge-tree --write-tree origin/cpp-migration pull/3157/head, plus the Windows commands in the comment below.
AI-assisted; commands listed were executed locally.
|
Windows Server 2025 verification of
AI-assisted; commands listed were executed locally. |
|
Review of src/gfx1013_direct_compute.inl and src/gfx1013_compute_native.cpp changes: Image instruction mask change (i.b & 0x3e000000u → 0x3c000000u) ✓ This tightens the rejection mask by removing bit 25 from the forbidden set. The gather_lod path already has its own stricter check at line 747 ( SDWA mask limit variable (wave64-aware) ✓ The change from hardcoded
This correctly reflects that register 107 is only a valid scalar mask destination when running in wave32 compute mode. The decoder now properly rejects invalid SDWA destinations based on the actual execution context. Emit::image() mask change ✓ Same Summary: Looks correct. Both changes are narrow and well-scoped — one fixes an overly restrictive mask for unnormalized coordinate image ops, the other makes SDWA destination validation wave-mode-aware. No issues found. |
Part of #2935. Target branch
main.Change (
src/gfx1013_compute_native.cpp, one line indocs/experiments/native-sdwa-f16.md): in the direct wave32 compute path, an SDWA VOPC compare orv_cmp_class_f32may write its lane mask tovcc_hi(s107). Readingvcc_hias a scalar source was already accepted; the new test covers it.vcc_lo.vcc_hidestination in a wave64 container stage, where the mask is an SGPR pair. Slot 67 requests are all compiled as wave32 onmain, so for them this refusal applies once shader: read the wave size of slot 67 compute requests from .sa #3006 (shader: read the wave size of slot 67 compute requests (bit 20 of .sa dword 4) instead of assuming wave32 #2999) lands;v_cmpxwith an SGPR destination;Tests. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, on
main80668b97plus this commit.native_sdwa_vcc_hi_hardware(new) runs two 32-thread groups of a wave32 request (.sabit 20 set).v_cmp_class_f32_sdwawithsrc1_sel:BYTE_3writesvcc_hi.v_cmp_ne_i32_sdwa vcc_hi, vcc_hi, v6withsrc1_sel:BYTE_0reads it back as its scalar source.native_direct_containernow also checks that these are refused:vcc_hidestination in a wave64 container stage, for both forms;v_cmpxwithvcc_hi.native_sdwa_f16_irandnative_sdwa_f16_hardwarepass.vcc_hion wave64 failsnative_direct_container;native_sdwa_vcc_hi_hardware.Measured on a local capture (counts and instruction shape only) with
compile_dxil --jobs 8 gfx1013-direct-cs@36 --requestsonmain80668b97.vcc_hias the destination: 29v_cmp_class_f32_sdwaand 13v_cmp_ne_i32_sdwa.AI-assisted.