Repository navigation
shader: validate two reachable exits in wave64 mesh containers - #2244
Conversation
Exercise the bounded stage-13 container through static and runtime geometry lowering. Verify both terminal branches with LLVM 15 and compare their GPU pixels. Agent environment: Codex (GPT-6.2 Astra xhigh).
tedin7
left a comment
There was a problem hiding this comment.
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_endpgm words and LLVM present. Everything else still hits "Unverified multi-exit program". The static CLI, the runtime CLI and the profile audit now share MESH_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-> clean
Mutations (both reverted with git checkout -- .):
- Dropped
mesh_allocfrom the fall-through allowlist intools/pixel_aot.py(onlys_barrierkept). Killed:Unverified multi-exit control flow: s_sendmsg. - Disabled the "missing mesh allocation" check (
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.- The Windows WARP and hardware draw controls (
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 Windows was pending at review time, and the /O2 job was skipped. The PR is mergeable.
Nits:
- P3
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. - P3 Clean-room hygiene: the PR body's last line names the tooling that prepared it. Please edit it out, since the repo rules keep tool and model names off GitHub.
P1=0 P2=0
AI-assisted; commands listed were executed locally.
|
Addressed both notes in the review. The comment at I reran |
tedin7
left a comment
There was a problem hiding this comment.
Re-review of head ad4657eb1c1e9381df190411e6e7c08de998f83a (previous review was on 7cafb830). 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
- CI on this head: Linux Python checks, gfx1013 fixtures and Windows build/test pass. The /O2 job and the chart job are skipped.
- GitHub reports
mergeable: CONFLICTING. A rebase is needed before it can land. - Title is neutral. No clean-room concerns found in the diff.
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 -- .)
- Remove the "missing mesh allocation" requirement: killed (
Expected rejection: missing mesh allocation). - Drop the
features == MESH_WAVE64gate: killed. - Enable the mesh allowance for compute (stage 5): killed.
- Relax the exact
s_barrier/alloc match to anys_sendmsg: survived.
Findings
- P1: none.
- P2:
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". - Nit: the check only requires the alloc string to exist somewhere in the program, not to be reachable from the entry before the exits. Reachability is covered by the branch walk, so this is only a comment/wording point.
- Nit: the summary line in the test says "six refusals checked" while
rejectsis called six times plus the dead-path one. Count them again so the message stays accurate.
Not verified by me
- The D3D12 draw leg (
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.
|
Merged current main in The P2 control is in 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. |
tedin7
left a comment
There was a problem hiding this comment.
Re-review of head 5bc22d963e9ee10fb98e4c4129c0b31928e784b5 (previous review was on ad4657eb). New since then: a merge of upstream main plus one commit, 5bc22d96, which only touches tests/mesh_two_exits_check.py.
State
- CI on this head: Linux Python checks, gfx1013 fixtures and Windows build/test pass. The /O2 job and the chart job are skipped.
mergeable: MERGEABLE. The earlier conflict is resolved.- Title is neutral. No clean-room concerns found in the PR's own diff (7 files, 177 insertions).
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.- The summary line no longer hard-codes a count ("refusal checks passed"). That closes the second nit.
- The reachability nit from last time is only a wording point and is covered by the branch walk. Not blocking.
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 -- .)
- In
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
- P1: none.
- P2: none.
Not verified by me
- The D3D12 draw leg (
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.
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.