Skip to content

shader: read concrete src_scc words in bounded mesh lowerers - #2434

Merged
tedin7 merged 2 commits into
R0Y00:mainfrom
RavenCurseBurg:shader/mesh-scc-compare-operand
Nov 25, 2026
Merged

tedin7 merged 2 commits into
R0Y00:mainfrom
RavenCurseBurg:shader/mesh-scc-compare-operand

Conversation

@RavenCurseBurg

Copy link
Copy Markdown
Contributor

Part of #2413. The T2 report identified int("src_scc", 0) as the first refusal in 15 inputs in its what-if run. I reproduced that exception in both bounded mesh lowerers with a source-built triangle/quad program.

The shared wave model now returns a 32-bit scalar word of 0 or 1 for a known SCC. A read before SCC is defined, or while SCC depends on a constant-buffer expression, produces a specific refusal. The source fixture checks s_cmp_eq_u32 src_scc, 1 and s_cmp_lg_u32 0, src_scc between a geometry comparison and its branch. It covers the flag in either source position and also reads the carry from s_add_u32 through s_mov_b32.

Verification

  • LLVM 15 assembled both full gfx1013 wave64 variants. Each adds one instruction at byte 48. Their encodings are fd8106bf and 80fd07bf. Both lowerers returned the original fixture's HLSL on the patched source. Both failed on the parent with the invalid integer literal.
  • On an RTX 4060 and Windows WARP, the two comparisons × two lowerers × triangle/quad produced 16 matching 1,024-pixel readbacks. Changing the equality comparison from 1 to 2 in the runtime shader made 496 pixels differ on each adapter. The UHD 770 reported no mesh shader tier and returned 77.
  • The host regression detects forcing the operand to zero or one, inverting it, and returning a Python boolean where a scalar word is required. The existing runtime geometry, scalar spill and join-descriptor checks passed. The documentation and bidi checks passed.

I tested the source fixture on b442b57f. The reported 15 private inputs weren't used.

AI-assisted with Codex + GPT-6.2 Astra (xhigh).

AI-assisted with Codex + GPT-6.2 Astra (xhigh).

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of head c696bd2 (diff against origin/main, 3 files, +50 lines).

What I checked

  • Change is small and additive: Wave.scalar in tools/mesh_entry_aot.py now returns the SCC bit as a 0/1 word, with specific refusals for an undefined SCC and for a constant-buffer-dependent (Dyn) SCC. No sibling table or callsite is left out.
  • Not a duplicate: the open #1821 covers src_scc in tools/startup/gfx2hlsl.py, a different lowerer. #2305 (merged) only refused stale SCC reads after descriptor arithmetic.
  • The new check_scc_operand covers both comparison forms in either source position, the undefined and dynamic refusals, and the carry from s_add_u32 through s_mov_b32.
  • The PR body cites WARP/RTX readbacks. I did not run them. I did not check which head SHA they cover.

Commands run locally (worktree at the PR head)

  • python3 tests/mesh_dynamic_aot_check.py: pass
  • python3 tests/docs_links_check.py: pass
  • python3 tests/bidi_controls_check.py: pass
  • git diff --check origin/main...HEAD: clean
  • Mutation 1: return int(self.scc) changed to return 0: the new check fails (AssertionError).
  • Mutation 2: changed to return 1 - int(self.scc): the check fails (ValueError on the unproven geometry word).
  • Both mutations reverted.

No blocking findings. No Windows run on my side. This comment is not an approval.

AI-assisted; commands listed were executed locally.

@RavenCurseBurg

Copy link
Copy Markdown
Contributor Author

Windows results at the exact PR head c696bd2d48898bafd2c2c13ee8ef63c71a3704b2 are now available. Windows Server 2025 WARP passed both mesh_dynamic_aot_cpu and mesh_dynamic_aot_draw_warp in CMake Debug and Release. Each preset recorded 13 matching 1,024-pixel images. Build and CTest logs.

I also repeated the SCC-specific source-built programs at that checkout on Windows 11 build 26100.9711. The two operand forms, static/runtime translations, and triangle/quad geometry gave 16 matching 1,024-pixel images across the RTX 4060 (32.0.15.9579) and local WARP (10.0.26100.9711). Changing the comparison immediate produced 496 incorrect pixels in the rendering control on each. Intel UHD 770 reported no mesh support (exit 77). The local D3D12 debug layer was unavailable.

@tedin7

tedin7 commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Win2025 WARP receipt for head 0f5ae41 after updating with main. Note: the automatic Python check list included tests/mesh_entry_check.py, which needs a mode argument and exits 1 without one; it was left out via --py-checks (the PR does not touch it).

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 0f5ae41ad8a019fb3fa92c906594c5d344ae4080:

  • Debug (--preset dev):
  • Build (cmake --build --preset dev -- -j 2): 0.00s (configure 0.00s)
  • Test (ctest --preset dev -R 'mesh_dynamic_aot_(cpu|cli_check|draw_warp)' --parallel 2 --no-tests=error --output-on-failure): 3/3 passed (6.80s: mesh_dynamic_aot_cli_check 4.02s, mesh_dynamic_aot_draw_warp 5.19s, mesh_dynamic_aot_cpu 2.29s)
  • Release /O2 (--preset release):
  • Build (cmake --build --preset release -- -j 2): 0.00s (configure 0.00s)
  • Test (ctest --preset release -R 'mesh_dynamic_aot_(cpu|cli_check|draw_warp)' --parallel 2 --no-tests=error --output-on-failure): 3/3 passed (6.37s: mesh_dynamic_aot_cli_check 3.80s, mesh_dynamic_aot_draw_warp 4.99s, mesh_dynamic_aot_cpu 2.31s)
  • Windows Python checks: tests/mesh_dynamic_aot_check.py ok (1.3s), tests/mesh_dynamic_geometry_check.py ok (0.3s), tests/mesh_join_descriptor_check.py ok (0.6s), tests/mesh_lane_spill_check.py ok (0.6s)
  • sccache: 0/12 hits; wall 23.3s

AI-assisted; commands listed were executed locally.

@tedin7
tedin7 merged commit bbe711f into R0Y00:main Nov 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants