Repository navigation
compute: lower s_andn2_wrexec_b64 for wave64 direct compute - #3247
Conversation
s_andn2_wrexec_b64 computes EXEC = S0 & ~EXEC over 64 bits, writes the new mask to EXEC and to the destination pair, and sets SCC to (EXEC != 0). The operand order and the destination receiving the new mask match tools/startup/gfx2hlsl.py op_s_andn2_wrexec_b64, which models it per lane. In the wave64 model each host half holds both EXEC words, so the replicated 64-bit computation reuses the SAVEEXEC path. Aligned general SGPR pairs only; the wave32 model keeps refusing the b64 form, and s_andn1_wrexec_b64 stays refused. New test native_wrexec64_hardware: wave64 64- and 128-thread groups with an explicit 64-bit EXEC, the source pair, the destination pair, SCC and per-lane stores against expected words.
tedin7
left a comment
There was a problem hiding this comment.
Review of head d397e49f (the PR's own change is the same as 573c3b7c; the new head only merges current main).
What I checked:
src/gfx1013_direct_compute.inl:s_andn2_wrexec_b64computesS0 & ~EXECover both words, writes that new mask to EXEC (126/127) and to the destination pair, and sets SCC toEXEC != 0. That matches the ISA description of the instruction (the result goes to both EXEC and the destination, unlike SAVEEXEC) andop_s_andn2_wrexec_b64intools/startup/gfx2hlsl.py.- The new path is gated on
compute && wave64; other models keep the old refusal (a SOP1 op that is not SAVEEXEC still hitsunsupported wave64 scalar operation). Only aligned general SGPR pairs are accepted as source and destination, so VCC/EXEC/constants stay refused. The name is also added to the SCC-writer list used byuses_scc_after, next to its SAVEEXEC siblings. - Test
native_wrexec64_hardware: real D3D12 readback of per-lane stores under the new EXEC, both destination words and SCC, for 64 and 128 threads, plus the EXEC-to-zero case and three operand refusals. The expected words are written out by hand, not derived from the translator.
Commands run:
- Linux:
python3 tests/docs_links_check.pyok,python3 tests/bidi_controls_check.pyok,git diff --check origin/main...HEADclean,python3 -m py_compile tests/native_wrexec64_check.pyok. - Windows Server 2025, D3D12 WARP 1.0.22 (the test ran on WARP, it did not skip),
-R '^native_(wrexec64_hardware|compute_clear|direct_container|descriptor_scc_warp)$': dev 4/4 passed, release 4/4 passed. - Mutation 1 (destination gets the old EXEC, as SAVEEXEC does):
native_wrexec64_hardwarefails (word 264, got0x80000012, want0x84). - Mutation 2 (EXEC not updated by WREXEC):
native_wrexec64_hardwarefails (word 9, lane stored under the old EXEC).
Side note, not caused by this PR: native_or_saveexec_hardware (wave32 s_or_saveexec_b32, #3193) fails on WARP 1.0.22 at the 8-thread all case, with the same assertion on current main without this change.
No blocking findings. The receipt follows in a separate comment.
AI-assisted; commands listed were executed locally.
|
Win2025 WARP receipt for head d397e49 after updating with main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
The new test AI-assisted; commands listed were executed locally. |
Part of #2935, claimed in #3224 (item 2 of my third comment there). Target branch
main.Change (
src/gfx1013_direct_compute.inl): with the wave64 model from #3006, direct compute lowerss_andn2_wrexec_b64.EXEC = S0 & ~EXECover 64 bits and writes the new mask to EXEC and to the destination pair. SCC is set toEXEC != 0.S0 & ~EXEC) and the destination receiving the new mask matchop_s_andn2_wrexec_b64intools/startup/gfx2hlsl.py, which models it per lane.s_andn1_wrexec_b64stays refused: the repository has only its name and opcode (ISA table, disassembler), with no semantics to check against.Tests. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, Release, on
main7364e6a9plus this commit.native_wrexec64_hardwarecovers wave64 requests with 64 and 128 threads, two groups each.s_andn2_wrexec_b64with a source pair whose high word is nonzero.main'scompile_dxil, the new test stops at "unsupported wave64 scalar operation".-R "native_wrexec64|native_wave64|native_salu|native_direct_container".Measured with
compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests,main7364e6a9against this commit.7364e6a9that bucket holds 8 of the 882: 4 compile, 2 move on ("invalid s_cselect_b64 source" and "unbound numeric SGPR"), and 2 stay.AI-assisted.