shader: lower s_clause and s_bitcmp{0,1}_b{32,64} in mesh_entry_aot #2430
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2438"
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 triggered02 on 2026-11-25T16:48:02Z.
Lowers the SOPP hard-clause hint
s_clauseand the four SOPC scalar bit-test instructions (s_bitcmp0_b32,s_bitcmp1_b32,s_bitcmp0_b64,s_bitcmp1_b64) intools/mesh_entry_aot.py(inherited bytools/mesh_dynamic_aot.pyviaWave).Refs #2413 (where the T2 profile identified 129
s_bitcmp0_b32and 120s_clausestops in the bounded mesh lowerers).What changed
tools/mesh_entry_aot.py:Wave.exec_rangeacceptss_clausewith integer operands0..63(0x0..0x3f) as a scheduling no-op (both top-level and insidejoin_arms), refusing out-of-range or non-integer operands.Wave.scalar_ophandless_bitcmp0_b32,s_bitcmp1_b32,s_bitcmp0_b64,s_bitcmp1_b64:((a & width) >> (b & mask)) & 1 == (1 or 0)(32-bitwidth = U32, mask = 31;64-bitwidth = WAVE, mask = 63). Clearsself.scc = NoneonUNDEFand raisesValueError('Dynamic scalar predicate')on non-concrete operands (RuntimeWordraisesUnproven runtime geometry word).tests/mesh_bitcmp_clause_check.py,CMakeLists.txt(mesh_bitcmp_clause_cpu), anddocs/experiments.md.Measured checks (
25db1affonorigin/mainb442b57f)tests/mesh_bitcmp_clause_check.py: PASS — synthetic gfx1013 bytes decoded viadisasm_rdna2.decode_instructionand lowered with bothmesh_entry_aot.lowerandmesh_dynamic_aot.enumerate_variants/lower(s_clause0x0/0x3fvs0x40/0xffff; 32-bit/64-bit bits 0, 31, 34, 35, 63 and index wraps33 & 31,65 & 63across SGPR pairs,exec,vcc,-1;UNDEF/RuntimeWord/dynamic refusals).mesh_*checks +docs_links_check.py(469 links) +bidi_controls_check.py(1,726 files) +git diff --check: all PASS.tools/mesh_entry_aot.py(flippings_bitcmp1_/0_,& 31on_b64, droppings_clause): all 3 caught (exit 1).Not established
AI-assisted (Gemini).
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T16:48:17Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
25db1afℹ️ 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-25T18:24:58Z.
Review: COMMENTED
Review of head
25db1aff(Linux-only checks; I did not run any Windows tests, and the PR body shows no Windows run for this head SHA).Findings
s_bitcmp0/1_b32ands_bitcmp0/1_b64intools/mesh_entry_aot.py, in the sameWave.scalar_oparea, and it also touchestools/mesh_dynamic_aot.py. Whichever merges second will conflict. Only one of the two should land. #2438 is older and narrower, and it also addss_clause. #2444 touches.github/workflows/windows.ymlandAGENTS.md, which is out of scope for a small additive PR. The maintainers should pick one before either merges.tools/mesh_entry_aot.py(s_bitcmpbranch): the bit index isb & maskand the value isa & width. That matches the SOPC definition, andUNDEFclearsscc. The test pins both. Nothing to change.What I checked
tools/mesh_entry_aot.py+18, newtests/mesh_bitcmp_clause_check.py, aCMakeLists.txttest entry,docs/experiments.md). It is additive and has no CI, launcher or hook changes.s_clauseaccepts only 0..63 and refuses anything else, in bothlower_staticandjoin_arms. Dynamic or non-integer operands are refused with the existing error.python3 -B tests/mesh_bitcmp_clause_check.pypasses. It is a CPU-side machine-code decode and lowering check, not a D3D12 readback. That fits here because the change adds no HLSL math, but there is no GPU-side proof.b & mask) withb & 31makes the test fail on thes_bitcmp1_b64case.s_clauselimit from0x3Fto0x7Fmakes the test fail ("lower_static accepted invalid case"). Both mutations were reverted withgit checkout -- ..git diff --check origin/main...HEAD,tests/docs_links_check.pyandtests/bidi_controls_check.pyare clean.s_bitcmpands_clause: #2024 (gfx2hlsl, a different file, merged) and #2444 (overlap, above). No other overlap.Commands run:
python3 -B tests/mesh_bitcmp_clause_check.py,python3 tests/docs_links_check.py,python3 tests/bidi_controls_check.py,git diff --check origin/main...HEAD, twosedmutations,git checkout -- .,gh pr list --search,gh pr diff 2444 --name-only.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T20:06:50Z.
Review: COMMENTED
Review of head
777a4277(comment only, no merge from this side).Checked:
tools/mesh_entry_aot.py: thes_bitcmp{0,1}_b{32,64}semantics (32-bit index& 31, 64-bit index& 63, UNDEF clearsscc, non-concrete operands refuse) and thes_clause0..63 operand range look correct.tests/mesh_bitcmp_clause_check.pypasses locally.s_bitcmp1_/s_bitcmp0_; disable thes_clausebranch) both make the test fail (exit 1).python3 tests/docs_links_check.py,python3 tests/bidi_controls_check.py,git diff --check origin/main...HEAD: clean.Finding (overlap, design question): #2444 (
shader/mesh-bitcmp) lowers the same fours_bitcmp{0,1}_b{32,64}opcodes in the same function (Wave.scalar_opintools/mesh_entry_aot.py) and also touchestools/mesh_dynamic_aot.py. Two PRs for the same slice will conflict on whichever lands second. #2438 addss_clause, which #2444 does not; #2444 addsDynconstant-buffer bit tests,s_cbranch_scc1joins and a WARP draw test, which #2438 does not. Leaving the choice (merge one, rebase the other onto it, or splits_clauseout) to @R0Y00.Not covered: CI on this head was still pending at review time; no GPU draw or DXIL compile exists for this slice (the PR says so itself). I did not run Win2025.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T20:29:34Z.
Review: COMMENTED
Review of head
5353163e(code + fixture tests only; no game, no GPU draw claimed).Checked
tools/mesh_entry_aot.py:s_bitcmp{0,1}_b{32,64}semantics are right (bit index masked to 31/63, operand masked to width, SCC set from bit == 1 or 0). UNDEF clears SCC, non-concrete operands refuse.s_clauseaccepts 0..63 only, rejects other operands. Siblings_cmp_/s_inst_prefetch/s_noppaths are untouched.tests/mesh_bitcmp_clause_check.pyis registered asmesh_bitcmp_clause_cpuin CMakeLists.txt and decodes real gfx1013 bytes through bothmesh_entry_aotandmesh_dynamic_aot.s_bitcmp s_clause).Commands run locally
python3 -B tests/mesh_bitcmp_clause_check.py-> PASSpython3 tests/docs_links_check.py-> 483 links OKpython3 tests/bidi_controls_check.py-> OKgit diff --check origin/main...HEAD-> cleans_bitcmp1_->s_bitcmp0_in the lowerer: new test fails (exit 1).s_clauseupper bound 0x3F -> 0x7F: new test fails (exit 1).No blocking findings. Win2025 run follows separately.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T20:32:00Z.
Win2025 WARP receipt for head
e12e1229after updating with main.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
e12e122979d6dba3603a7d0b261e1f8c7173dc8a:--preset dev):cmake --build --preset dev -- -j 2):34.17s(configure1.81s)ctest --preset dev -R 'mesh_bitcmp_clause_cpu' --parallel 6 --no-tests=error --output-on-failure): 1/1 passed (3.15s:mesh_bitcmp_clause_cpu2.73s)/O2(--preset release):cmake --build --preset release -- -j 2):45.14s(configure2.05s)ctest --preset release -R 'mesh_bitcmp_clause_cpu' --parallel 6 --no-tests=error --output-on-failure): 1/1 passed (2.27s:mesh_bitcmp_clause_cpu2.16s)tests/mesh_clip_cull_check.pyok (3.4s),tests/mesh_dynamic_aot_check.pyok (0.8s),tests/mesh_dynamic_geometry_check.pyok (0.2s),tests/mesh_join_descriptor_check.pyok (0.2s),tests/mesh_lane_spill_check.pyok (0.2s),tests/startup_ngg_slice_check.pyok (0.2s)sccache: 392/421 hits; wall96.8sAI-assisted; commands listed were executed locally.