shader: validate two reachable exits in wave64 mesh containers #2236
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2244"
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 RavenCurseBurg on 2026-11-25T07:24:54Z.
Refs #1998 and #721. The static and runtime mesh CLIs both rejected a synthetic 324-byte gfx1013 program with two reachable
s_endpgminstructions. The waves share a barrier. One exits at byte 188, and the other exports the quad and exits at byte 320. This case is independent of #2241.Enable the existing bounded, two-exit control-flow validation for stage 13 with explicit wave64 and LLVM disassembly. Recognize the mesh barrier and allocation request as fall-through instructions and require a mesh allocation. The static and runtime entry points and the profile audit now use the same extraction rules.
Verification
Linux binary control:
python -B tests/mesh_two_exits_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1. Windows draw controls:ctest --preset dev --no-tests=error -R '^mesh_two_exits_(warp|hardware)$' -V.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T07:29:40Z.
Review: COMMENTED
Review of head
7cafb8308cc846e5f16f6b6027111e266087d3a3.Summary: The logic is narrow and fail-closed. It applies to stage 13, cpu gfx1013 and the exact wave64 feature string, with exactly two
s_endpgmwords and LLVM present. Everything else still hits "Unverified multi-exit program". The static CLI, the runtime CLI and the profile audit now shareMESH_WAVE64, so extraction cannot drift between them. No P1 or P2 correctness findings.Commands executed locally (only LLVM 19 is installed here, not 15):
python3 -B tests/mesh_two_exits_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM-19.so->324 bytes: both CLIs and the profile audit match the single-exit mesh; five refusals checkedpython3 -B tests/mesh_dynamic_geometry_check.py binary ...-> pass (Six mesh inputs matched the CPU allocation and export model)python3 -B tests/mesh_entry_check.py binary ...-> rc 0python3 tests/docs_links_check.py-> pass (18 files, 418 links)python3 tests/bidi_controls_check.py-> passgit diff --check origin/main...HEAD-> cleanMutations (both reverted with
git checkout -- .):mesh_allocfrom the fall-through allowlist intools/pixel_aot.py(onlys_barrierkept). Killed:Unverified multi-exit control flow: s_sendmsg.if False:). Killed:AssertionError: Expected rejection: missing mesh allocation.Not reproduced here:
tests/pixel_aot_check.pyfails on LLVM 19 with a disassembly text difference (v_cvt_f16_i16_e32 v1, 0xfff0), in code this PR does not touch. I assume it is an LLVM 15 vs 19 formatting difference and did not run it on main.tests/shader_profile_audit_check.pyneeds different arguments than I passed. I did not rerun it.mesh_two_exits_{warp,hardware}) were not run. The PR only registers them in CMake and the draw check uses no shader lowering. I rely on the Windows CI job (still pending at review time) and the author's Verification block.CI: Linux Python checks pass and the gfx1013 fixtures job passes.
Build and test on Windowswas pending at review time, and the/O2job was skipped. The PR is mergeable.Nits:
tools/pixel_aot.py(the_check_two_exitsallowlist):s_barrierand the alloc message are matched by exact text, so a variant disassembly such ass_barrierwith an operand ors_sendmsg sendmsg(MSG_GS_ALLOC_REQ, ...)fails closed. That is safe. Add a comment saying it is intentional.P1=0 P2=0
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T07:43:39Z.
Review: COMMENTED
Re-review of head
ad4657eb1c1e9381df190411e6e7c08de998f83a(previous review was on7cafb830). Scope:tools/pixel_aot.py,tools/mesh_entry_aot.py,tools/shader_profile_audit.py,tests/mesh_two_exits_check.py, CMake and workflow wiring.State
mergeable: CONFLICTING. A rebase is needed before it can land.Commands run locally (Linux, LLVM 19 only; LLVM 15 is not installed here)
git diff --check origin/main...HEAD: clean.python3 -B tests/docs_links_check.py: self-test passed, 418 links.python3 -B tests/bidi_controls_check.py: no bidi controls in 1522 files.python3 -B tests/mesh_dynamic_geometry_check.py: six inputs matched.python3 -B tests/mesh_dynamic_aot_check.py: passed.python3 -B tests/mesh_two_exits_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM.so.19.1: passed (324 bytes, six refusals).drawmode: capability skip (77), because LLVM 15 is not found. The GPU draw leg was NOT run by me.Mutations of the new logic (each reverted with
git checkout -- .)Expected rejection: missing mesh allocation).features == MESH_WAVE64gate: killed.s_barrier/alloc match to anys_sendmsg: survived.Findings
tools/pixel_aot.py(theelif not ((mesh and instructions[pc] in ("s_barrier", mesh_alloc)) ...line). The exact-string match is the stated safety property (the comment says extra operands or a different message must not inherit fall-through). No test exercises it: relaxing it to anys_sendmsgstill passes. Suggest a refusal case that rewrites the alloc word to another message, such asMSG_GS_DONE, while keeping a valid alloc elsewhere, and expects "Unverified multi-exit control flow".rejectsis called six times plus the dead-path one. Count them again so the message stays accurate.Not verified by me
mesh_two_exits_<adapter>) and anything on Windows. The Windows CI job passes, but I did not runwin2025.Verdict: logic looks correct and mostly well guarded. Please rebase for the conflict, and add the one refusal test for P2.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T07:52:48Z.
Review: COMMENTED
Re-review of head
5bc22d963e9ee10fb98e4c4129c0b31928e784b5(previous review was onad4657eb). New since then: a merge of upstream main plus one commit,5bc22d96, which only touchestests/mesh_two_exits_check.py.State
mergeable: MERGEABLE. The earlier conflict is resolved.Previous P2: resolved
5bc22d96adds a refusal case: it keeps the realMSG_GS_ALLOC_REQand replaces the later reachables_barrierwiths_sendmsg sendmsg(MSG_GS_DONE, GS_OP_NOP). It expectsUnverified multi-exit control flow: s_sendmsg.Commands run locally (Linux, LLVM 19 only; LLVM 15 is not installed here)
git diff --check origin/main...HEAD: clean.python3 -B tests/docs_links_check.py: 18 files, 428 links.python3 -B tests/bidi_controls_check.py: no bidi controls in 1533 files.python3 -B tests/mesh_dynamic_geometry_check.py: six inputs matched.python3 -B tests/mesh_dynamic_aot_check.py: passed.python3 -B tests/mesh_two_exits_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM.so.19.1: passed (324 bytes, refusal checks passed).Mutation of the new logic (reverted with
git checkout -- .)tools/pixel_aot.py:114, relax the exacts_barrier/alloc match so anys_sendmsgis accepted in a mesh: now killed (Expected rejection: Unverified multi-exit control flow: s_sendmsg). On the previous head this mutation survived.Findings
Not verified by me
mesh_two_exits_<adapter>, skips with 77 without LLVM 15) and anything on Windows. The Windows CI job passes, but I did not runwin2025.Verdict: the P2 is fixed and the new test kills the mutation. Nothing left from my side.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T07:32:59Z.
Addressed both notes in the review. The comment at
afc73b87documents why the mesh barrier and allocation message are matched as complete instructions. I also removed the optional tooling line from the PR description.I reran
python -B tests/shader_profile_audit_check.py(3 passed), the LLVM 15 container checks and both Windows draw controls. For both WARP and a physical D3D12 adapter, the static and runtime CLIs produced shaders that matched all 1,024 pixels. Each rejected the triangle reference with 528 mismatches. The three upstream checks on the initial revision also passed.Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T07:46:49Z.
Merged current main in
2cff5399. The conflict was two LLVM fixture registrations on adjacent lines. Both the heap-sampler check from #2220 and the two-exit check are present. I reran the neighboring sampler translation and its 16 refusal cases.The P2 control is in
5bc22d96. It keeps the real allocation reachable and replaces the later barrier with the separates_sendmsg sendmsg(MSG_GS_DONE, GS_OP_NOP)instruction. LLVM 15 decoded it as expected. The real implementation refused this program, and the review mutation that accepts everys_sendmsgfailed the new test at the intended assertion. The output now reports completion of the refusal checks without a hard-coded count.Both WARP and physical D3D12 draw controls ran again on the revised source. Static and runtime draws on each adapter matched all 1,024 reference pixels and rejected the triangle control with 528 mismatches.