shader: lower scalar and vector 32-bit ALU ops in the mesh-entry translator #1080
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!1080
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1080/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:28 UTC · original
tedin7:x2w-mesh-entry-scalar-vector-u32→main· +76 −2 · 2 files · 2 commits · merged 2026-11-24 01:13 UTCChange
Adds scalar
s_add_u32,s_sub_u32,s_mul_i32and vectorv_sub_nc_u32_e32,v_or_b32_e32,v_xor_b32_e32,v_min_u32_e32,v_max_u32_e32to the concrete mesh-entry evaluator intools/mesh_entry_aot.py, following the pattern of the existing integer ops.s_add_u32sets SCC to the carry out,s_sub_u32sets SCC to the borrow,s_mul_i32leaves SCC unchanged.v_sub_nc_u32_e32issrc0 - vsrc1;v_min_u32_e32/v_max_u32_e32compare unsigned.The fixture in
tests/mesh_entry_check.pyuses operands chosen so that wrong flag handling, wrong operand order or a signed comparison changes an emitted constant. It also adds a draw case with the same program for the GPU runner.Verification
Base
110e1860plus this commit, Linux, LLVM 19 (llvm-mc-19, libLLVM 19.1; llvm-mc-15 is not installed here):python3 -B tests/mesh_entry_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM.so.19.1exits 0.Negative control: the same test with
tools/mesh_entry_aot.pytaken from origin/main exits 1 (the tool rejects the new instructions).Not run: the
--mesh-entrydraw path (needs DXC and a D3D12 adapter on Windows); LLVM 15 locally. The CI job uses llvm-mc-15; these are long-standing gfx10 spellings, but CI is the check for that.Evidence and follow-up
Synthetic fixture only; no external inputs. The draw case expects exact depth 0.6953125, a sum of binary32-exact terms.
This is AI-assisted work.
Checklist
@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 00:28 UTC · original · edited 2026-11-24 00:33 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
2c49c0cℹ️ 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.
@ -261,0 +308,4 @@Path(directory), *sys.argv[2:], program=ALU_PROGRAM, words=[4099])for operand in ALU_OPERANDS:assert f"asfloat(0x{operand:08x}u)" in text, hex(operand)@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 00:33 UTC · original
When both min/max handlers use signed comparisons, these assertions still pass: the sign-bit cases merely swap
0x3f200000and0xbfc00000, leaving both strings present.alu_draw()also adds both results using exact binary32 arithmetic, so its expected depth remains0.6953125. I verified this signed-comparison negative control against the added assertions and depth calculation. Assert each result at its specific use, or consume the results asymmetrically, so the fixture actually detects incorrect signedness.AGENTS.md reference: AGENTS.md:L159-L159
Useful? React with 👍 / 👎.
@R0Y00 on GitHub · 2026-11-24 01:13 UTC · original
On
d162e9d7the asymmetric min/max fixture drew all 1,024 pixels correctly on WARP, including the trace-enabled run. In a separate source-built control I swapped the two sign-bit min/max results, which is what signed comparison would do for these operands. The readback rejected all 1,024 pixels. This verifies the review thread's missing control.@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 00:33 UTC · original · reviewed
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
2c49c0c5afℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".