shader: per-lane v_cmp_* and v_cndmask_b32 in compute_store_aot #2175
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!2175
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2175/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?
@henriazz10 on GitHub · 2026-11-25 02:53 UTC · original
henriazz10:shader/compute-vcmp-select→main· +522 −32 · 6 files · 1 commits · merged 2026-11-25 06:57 UTCChange
Refs #721. This is the general per-lane
v_cmp_*+v_cndmask_b32slice forcompute_store_aot(gfx1013), claimed in #721. 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
@legacy-code-archaeologist on GitHub · 2026-11-25 05:47 UTC · original
Ran head
e3e132b1on three adapters. All pass. Windows 11 build 26100, debug layer unavailable.compute_store_aot_vcmp_select_warpcompared_words=320 mismatches=0compute_store_aot_vcmp_select_hardware(XBOX2WINDOWS_ADAPTER=Quadro)compute_store_aot_vcmp_select_hardware(XBOX2WINDOWS_ADAPTER=Intel)AI-assisted.
@tedin7 on GitHub · 2026-11-25 03:05 UTC · original · reviewed
Review of head
e3e132b14446805dde968785324446bc0e641625: 0 P1, 0 P2.Logic check against RDNA2 VOPC/VOP2 semantics:
asint) are correct.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.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.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)'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.
@stan495 on GitHub · 2026-11-25 06:34 UTC · original · approved these changes
Verified head
e3e132b1on Windows x64 (devpreset, MSVC19.44.35228.0, SDK/DXC10.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)AMD Radeon RX 7900 XTX(vendor=1002 device=744c, driver32.0.32029.2010)Microsoft Basic Render Driver(vendor=1414 device=008c, driver10.0.26100.9818)Verdict: Approved at
e3e132b1.