shader: lower compute s_bcnt1_i32_b32 of exec_lo as a known word #1865
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1872"
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-24T19:54:26Z.
Change
Refs #1543. This is the
s_bcnt1_i32_b32 sN, exec_loslice claimed in https://github.com/R0Y00/Xbox2Windows/issues/1543#issuecomment-7141801643. It is separate from thequad_permandrow_shrDPP slices, and it builds on thev_mbcntslice (#1782). It touches onlytools/compute_store_aot.py, its test,CMakeLists.txtand the docs.execis the whole wave, sos_bcnt1_i32_b32 sD, exec_lois folded to a known scalar word:wave_size=32statement (--wave-size 32) and a thread count that is a multiple of 32.s_and_saveexec_b32up to theexecrestore);exec_hi,execandvcc_loas the source;s105or one still loading.sD != 0) is not modelled, as for the other scalar ALU forms in this subset. A laters_cbranch_scc0stays refused, and a control checks this.v_readlane,v_writelane,ds_bpermuteands_ff1_i32_b64are not part of this PR.Verification
Commit
b7854f13, rebased ontodd753176. Windows 11 build 26300, VS 2019 Build Tools 16.11 (MSVC 14.29), DXC 1.8.2502.11, Python 3.12, debug layer enabled.offscreen_checkwas built from an earliermain(0aa6522c); this PR does not change it.compared_words=320 mismatches=0,debug_errors=0compared_words=320 mismatches=0,debug_errors=0No capability skips. The draws ran before the rebase onto the base above, which changed none of the four files.
controls()was re-run on the final commit.The LLVM 15 round trip ran in Ubuntu 22.04 (
llvm-1515.0.7 from apt, as in the Linux CI job):bcnt_exec_binary()decodes the assembled fixture back to the sames_bcnt1_i32_b32line and requires the same translation.Negative control. With
tools/compute_store_aot.pyreverted tomain,controls()fails withUnsupported compute instruction: s_bcnt1_i32_b32 s4, exec_lo.Evidence
The fixture is source-built in LLVM 15 spelling. It runs one group of 64 threads (two wave32 waves) with
wave_size=32. Each thread storesflat * 64 + count, so all 64 words are distinct, and a Python reference gives the expected words. All 320 words are compared.Checklist
docs/experiments.md).AI-assisted. Gemini 4 Hydrogen (Antigravity CLI) wrote the translator change, the fixture and the docs. Claude Code (Claude Opus 5.5) reviewed them, added the 16-thread control, re-ran the GPU draws and the negative control, and ran the LLVM 15 round trip. The measurements come from the machine described in Verification.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T20:03:16Z.
Review: COMMENTED
Review of head
b7854f1344e91f5e50db0554da2e49e7c5f592be(PR #1872).Findings: 0 defects.
Semantics checked against the RDNA2 definition of
s_bcnt1_i32_b32 sD, exec_lo(sD = popcount of exec_lo, SCC = sD != 0):wave_size=32and a multiple of 32 threads. Everything else is refused (wave64 with a large group, 48 threads).s_cbranch_scc0is refused, so skipping the SCC write is safe.exec_lo(exec_hi,exec,vcc_lo), destination above s105 or with a pending load.Commands executed locally (Linux, LLVM-19):
git diff --check origin/main...HEAD: rc 0tests/docs_links_check.py: passed (18 files, 370 links)tests/bidi_controls_check.py: passedtests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so: rc 0tests/rdna2_tools_check.py: OK (148 tests, 18 skipped)tests/form_coverage_check.py: passedLocal mutations on
tools/compute_store_aot.py, each madecompute_store_check.py binaryfail (rc 1), then the tree was restored:exec_lodisabled.threads <= 32changed tothreads < 32.Not run here: the Windows draw tests (
compute_store_aot_bcnt_exec_*).AI-assisted; commands listed were executed locally.