compute: lower v_bcnt_u32_b32 in compute_store_aot #2083
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2090"
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 archielcqp-a11y on 2026-11-25T00:07:30Z.
Refs #2022 (item D)
Summary
compute_store_aotrefusedv_bcnt_u32_b32, item D of #2022. It now lowersv_bcnt_u32_b32 vD, a, bas(countbits(a) + b).Semantics:
D = CountOneBits(a) + b, with the addend wrapping modulo 2^32.D.u = CountOneBits(S0.u) + S1.u.V_BCNT_U32_B32_e64isctpop(src0) + src1.bit_count.Encoding: gfx10 has only the VOP3 encoding. LLVM 15 (
llvm-mc -mcpu=gfx1013) prints it without a suffix, refuses_e32, and refuses source negation andclamp. The instruction joins the existing two-source VOP3 group (v_mul_lo_u32,v_add_nc_i32,v_sub_nc_i32), on known words only.Refused:
_e32and_e64spellings;-v,|v|,neg()) andclamp;v255, asUnverified ALU operand.v_mbcnt_lo/hi_u32_b32ands_bcnt1_i32_b32are unchanged.Fixture
compute_store_aot_alu_bcnt_{warp,hardware}(tests/compute_alu_bcnt_check.py) follows thev_xor3_b32check. It replaces theuminof the read-compute-write fixture with fourv_bcnt_u32_b32, hand-edited in LLVM 15 spelling:params[0].y) and the running result.0xa5c30fd0).Negative controls:
Nine wrong references must fail at their first differing word:
+16for-16.So must one word off and lane 150 also writing.
Six mutated HLSL sources must fail on the GPU:
firstbitlowfor a count, a count dropped, the key fromparams[0].z, the dispatch index dropped, the literal off by one bit, and+16for the inline constant.The translation controls pin the exact store. They reject every refused form above, and a result used as a store address, read address or lane-guard operand.
With the lowering removed, or with its template operands swapped, the controls fail.
Results
Run on
2fd3f69(main) with this change, Windows 10 build 19045, debug layer enabled, 0 debug errors and 0 debug warnings on both adapters.tests/compute_alu_bcnt_check.py drawOther checks:
tests/compute_alu_bcnt_check.py controls: pass.tests/compute_store_check.py binarywith LLVM 15, which also runs the existing controls: pass.tests/compute_alu_xor3_check.py drawon WARP: pass.form_coverage_check,docs_links_check,bidi_controls_checkandshader_census_check: pass.No capability skips.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:48:20Z.
Review: COMMENTED
Review of head
6924fb784a(compute: lower v_bcnt_u32_b32 in compute_store_aot).Result: no P1, no P2.
Commands executed locally:
git merge-tree --write-tree --name-only origin/main HEAD: clean, no conflicts.gh pr checks 2090: Linux Python checks, gfx1013 fixtures and Windows build/test pass (the /O2 job shows "skipping").git diff --check origin/main...HEAD: clean.python3 tests/bidi_controls_check.py: pass.python3 tests/docs_links_check.py: pass (18 files, 393 links).python3 -B tests/compute_alu_bcnt_check.py controls: pass.python3 x2w_pipe.py win2025 2090 --wait 900: Win2025 WARP pass at this exact head, Debug (--preset dev) and Release /O2 (--preset release), includingcompute_store_aot_alu_bcnt_warp(about 5.3 s). The pipeline reported a result already recorded for this head, so it did not rebuild.Mutation: in
tools/compute_store_aot.pyI changed the template(countbits({0}) + {1})to(countbits({0}) - {1}). Thecontrolstest failed on the exact-output assertion, as it should. I restored the file withgit checkout -- ..Reading notes:
P3 (minor):
AI-assisted; commands listed were executed locally.