shader: lower scalar add, sub, and, or, xor and shift on known words in the compute store profile #1090
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!1090
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1090/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?
@tedin7 on GitHub · 2026-11-24 00:48 UTC · original
tedin7:x2w-compute-store-scalar-alu→main· +194 −1 · 3 files · 4 commits · merged 2026-11-24 02:04 UTCChange
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
@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 00:48 UTC · original · edited 2026-11-24 00:52 UTC
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.
@tedin7 on GitHub · 2026-11-24 01:33 UTC · original
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.