shader: lower scalar add, sub, and, or, xor and shift on known words in the compute store profile #1083
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1090"
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 tedin7 on 2026-11-24T00:48:28Z.
Change
The compute store profile now accepts
s_add_u32,s_sub_u32,s_and_b32,s_or_b32,s_xor_b32ands_lshr_b32on known words (constant-buffer words, inline constants, literals and earlier results). The result is an inline HLSL expression, can feed vector instructions, and is data only: not an address and not a lane-guard compare operand. SCC is not modelled because no accepted instruction reads it. Docs: new "Scalar ALU on known words" section indocs/experiments.md.Refs #721 (step 4, arithmetic). The vector ALU additions in #1083 touch the same files; this change adds a separate table, regex branch and test function, and does not edit the lines #1083 changes.
This change was AI-assisted.
Verification
python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so: exit 0 with this change.tools/compute_store_aot.pyfrom origin/main fails withUnsupported compute instruction: s_add_u32 s16, s0, 7.draw_scalar, caseread_scalar, mode draw-guard-read) with an independent Python reference (scalar_chain/scalar_word). Inputs make the add and the sub both wrap, and the minimum take each operand (35 lanes the product, 115 the chain, last run). Wrong references (max for min, each of add/sub/and/or/xor dropped, shift by 2, wrong xor operand) must fail at the exact first differing word, and the same six edits to the translated HLSL must fail the readback.scalar_chainfor bounds 0, 17 and 150.Evidence and follow-up
Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T00:48:41Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
16df191ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T01:33:31Z.
AI-assisted. Merged origin/main into the branch to resolve a conflict in tests/compute_store_check.py (both sides added independent cases; both are kept). tests/compute_store_check.py passes locally with LLVM 19.