Repository navigation
shader: per-lane v_cmp_* and v_cndmask_b32 in compute_store_aot - #2175
Merged
Merged
Conversation
Refs R0Y00#721 Written with Gemini 4 Hydrogen (Antigravity CLI), reviewed by Claude.
tedin7
reviewed
Nov 25, 2026
tedin7
left a comment
Collaborator
There was a problem hiding this comment.
Review of head e3e132b14446805dde968785324446bc0e641625: 0 P1, 0 P2.
Logic check against RDNA2 VOPC/VOP2 semantics:
- Integer predicates (f/lt/eq/le/gt/ne/ge/t, u32 and i32 via
asint) are correct. - f32 predicates follow the IEEE rule. The ordered forms are false on NaN. The
n*forms are true on NaN, andnge,nlg,ngt,nle,nltandneqare the exact complements of their ordered partners.lgis ordered!=. v_cndmask_b32takes a per-lanecondfrom VCC or an SGPR pair. The constant-mask path keeps the existing single-wave limit.vcc_condis cleared by the carry/borrow writers and merged at the guard end, so a stale condition is not reused.- No sibling PR covers the same slice. #2020 is the unrelated f16 class op.
Commands run locally (Linux):
python3 -B tests/compute_store_check.py controlsand the lane_mask and cmp_ne controls: the self-controls ran with no failure.python3 tests/docs_links_check.py: PASS (401 links).python3 tests/bidi_controls_check.py: PASS.git diff --check origin/main...HEAD: clean.- Mutation: in
FLOAT_COMPARE_PREDICATES,ngewas changed to the ordered form. The controls failed with an AssertionError. I reverted it afterwards.
Windows Server 2025 (WARP and hardware):
python3 x2w_pipe.py win2025 2175 --scope direct --targets offscreen_check --regex 'compute_store_aot_vcmp_select|compute_lane_mask|compute_alu_cmp_ne|compute_store_aot_(bfe|draw)'- Debug: 5/5 passed.
- Release /O2: 5/5 passed.
- This includes
compute_store_aot_vcmp_select_warpandcompute_store_aot_vcmp_select_hardware, which compare GPU readback against the independent Python model.
GitHub CI Build and test on Windows: SUCCESS.
AI-assisted; commands listed were executed locally.
Contributor
|
Ran head
AI-assisted. |
stan495
approved these changes
Nov 25, 2026
stan495
left a comment
Contributor
There was a problem hiding this comment.
Verified head e3e132b1 on Windows x64 (dev preset, MSVC 19.44.35228.0, SDK/DXC 10.0.26100.0):
cmake --build --preset dev --target offscreen_check-> succeededctest --preset dev --no-tests=error -R '^compute_store_aot_vcmp_select_' -V-> 2/2 passed (compute_store_aot_vcmp_select_hardware,compute_store_aot_vcmp_select_warp)- Hardware:
AMD Radeon RX 7900 XTX(vendor=1002 device=744c, driver32.0.32029.2010) - WARP:
Microsoft Basic Render Driver(vendor=1414 device=008c, driver10.0.26100.9818)
- Hardware:
Verdict: Approved at e3e132b1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Refs #721. This is the general per-lane
v_cmp_*+v_cndmask_b32slice forcompute_store_aot(gfx1013), claimed in #721 (comment). It touches onlytools/compute_store_aot.py,tests/compute_store_check.py,CMakeLists.txt, anddocs/experiments.md(plus updated expected rejection diagnostics intests/compute_alu_cmp_ne_check.pyandtests/compute_lane_mask_check.pywhere previously unsupportedv_cmp_*/v_cndmask_b32forms are now parsed and refused downstream).Accepted forms (66 total: 64 compare forms + 2 select forms)
16forms):v_cmp_{f,lt,eq,le,gt,ne,ge,t}_u32_e32(intovcc_lo) andv_cmp_{f,lt,eq,le,gt,ne,ge,t}_u32_e64(intovcc_loors0..s105), comparinguintwords.16forms):v_cmp_{f,lt,eq,le,gt,ne,ge,t}_i32_e32(intovcc_lo) andv_cmp_{f,lt,eq,le,gt,ne,ge,t}_i32_e64(intovcc_loors0..s105), comparingasint(...).32forms):v_cmp_{f,lt,eq,le,gt,lg,ge,o,u,nge,nlg,ngt,nle,neq,nlt,tru}_f32_e32(intovcc_lo) andv_cmp_{f,lt,eq,le,gt,lg,ge,o,u,nge,nlg,ngt,nle,neq,nlt,tru}_f32_e64(intovcc_loors0..s105), comparingasfloat(...)with explicitisnan(...)checks for all ordered and unordered IEEE NaN predicates.2forms):v_cndmask_b32_e32 vD, S0, vS1, vcc_loandv_cndmask_b32_e64 vD, S0, S1, (vcc_lo|sN), lowering to(cond ? S1 : S0)when the mask holds a("cond", ...)(wave-size independent because only the same lane reads its bit).Existing lane guards (
s_and_saveexec_b32on uniformv_cmp_*), constant-maskv_cndmask_b32_e64, andvcc_carry/vcc_borrowkeep their current behavior. Any write tovcc_loinvalidates the other VCC-derived states.Refused (one control each)
f32source modifiers (-v1,|v1|);clamp, SDWA (_sdwa), and DPP (_dpp) spellings;condSGPR read by a scalar ALU instruction (s_add_u32) or used as a branch condition (s_cbranch_scc0);s_and_saveexec_b32on acondbuilt from loaded (v1) or ALU (v4) data;_cicarry-in from acond(vcc_loors4);condafter anothervcc_lowrite (v_add_co_u32).Verification
Commit
e3e132b1, onshader/compute-vcmp-selectfrome3e39c43. Windows 11 build 26300, VS 2019 Build Tools 16.11 (MSVC 14.29), DXC (Windows SDK 10.0.26100.0), Python 3.12, debug layer enabled.compared_words=320 mismatches=0,debug_errors=0 debug_warnings=0compared_words=320 mismatches=0,debug_errors=0 debug_warnings=0The LLVM 15 round trip in Docker (
x2w-llvm15) exited 0 (binary_exit=0):vcmp_select_binary()disassembles all 12 assembled programs and checks identicalv_cmp_*/v_cndmask_b32_*lines and identicalaot.lower()output.Negative control. With
tools/compute_store_aot.pyfromorigin/main,vcmp_select_controls()fails withValueError: Unverified lane guard compare.Evidence
gfx1013dispatches (buffer_store_dwordx4, 256 output words + 64SENTINELwords each = 3,840 words total) covering all 32 predicates (8u32+8i32+16f32) across equal values,0x7fffffffvs0x80000000,0vs0xffffffff, denormal raw words (0x00000001vs0x80000001),±0,NaNon either or both sides,±inf, and memory-loaded/tidinputs.ltandgtswapped: word 1;lt) used for unordered (nge): word 5;<for<=onu32;asintdropped oni32;isnanreplaced byisinfon unorderedf32.Checklist
docs/experiments.md).AI-assisted. Gemini 4 Hydrogen (Antigravity CLI) wrote the change and ran the checks; Claude Code reviewed it.
🤖 Generated with Claude Code