shader: lower compute v_add_co_u32 and v_add_co_ci_u32 #2124
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2132"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by henriazz10 on 2026-11-25T01:17:37Z.
Change
Refs #721. Lower
v_add_co_u32(VOP3) andv_add_co_ci_u32(_e32and_e64) intools/compute_store_aot.py, touching onlytools/compute_store_aot.py,tests/compute_store_check.py,CMakeLists.txt, anddocs/experiments.md.v_add_co_u32 vD, sDst, S0, S1computes(S0 + S1) mod 2^32intovDand tracks the per-lane carry-out((S0 + S1) < S0 ? 1u : 0u)insDst(vcc_loors0..s105).v_add_co_ci_u32_e32 vD, vcc_lo, S0, vS1, vcc_loandv_add_co_ci_u32_e64 vD, sDst, S0, S1, sCarryInadd the tracked per-lane carry-in and updatevDandsDst.("carry", expr)value, not a uniform scalar word. Writingvcc_loclears any priorv_cmpguard state, and any non-_cireader (s_*ALU,v_*ALU,v_cndmask,s_and_saveexec_b32) is refused. Groups larger than 32 threads requirewave_size=32.alu_controls()negative-opcode check fromv_add_co_u32tov_sub_co_u32.Verification
Commit
b80ffd9e, rebased onto5581b4b0. The draws,controls()and the LLVM 15 round trip were re-run onb80ffd9e. Windows 11 build 26300, DXC 10.0.26100.0, Python 3.12, debug layer enabled.compared_words=320 mismatches=0,debug_errors=0compared_words=320 mismatches=0,debug_errors=0docs_links_check.py(18 Markdown files, 396 links),bidi_controls_check.py(1428 files), andgit diff --check HEAD~1all exited 0.The LLVM 15 round trip in Docker (
x2w-llvm15) exited 0 (binary_exit=0):Negative control. With
tools/compute_store_aot.pyfromorigin/main,add_co_controls()fails withValueError: Unsupported compute instruction: v_add_co_u32 v10, vcc_lo, -16, v3.Evidence
The
ADD_COfixture is source-built in LLVM 15 spelling for one 64-thread group (wave_size=32,buffer_store_dwordx4, 256 output words plus 64SENTINELwords). It exercisesv_add_co_u32+v_add_co_ci_u32_e32viavcc_lo(crossing2^32fortid.x >= 16) andv_add_co_u32+v_add_co_ci_u32_e64vias4/s5(crossing2^32fortid.x >= 32, withv13wrapping on carry-in), comparing all 320 words against an independent Python model.wave_size=32, and refusals for >32 threads withoutwave_size=32, unknown/pending sources, invalid destinations, unverified carry-in, non-_cireaders of the carry SGPR (s_add_u32,v_add_nc_u32_e32,v_cndmask_b32_e64,s_and_saveexec_b32), modifiers (clamp,-,|...|,mul:2), and_e64onv_add_co_u32.vcc carry dropped: word 65;vcc carry inverted: word 1;sgpr carry-in ignored: word 131;sentinel past group: word 256.vcc carry comparison flipped;sgpr carry-in zeroed.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