shader: read concrete src_scc words in bounded mesh lowerers #2426

Merged
RavenCurseBurg merged 2 commits from upstream-pr/2434 into main 2026-11-25 20:19:24 +00:00
RavenCurseBurg commented 2026-11-25 16:37:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T16:37:43Z.


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).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6609096373 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2434). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T16:37:43Z. --- Part of #2413. The [T2 report](https://github.com/R0Y00/Xbox2Windows/issues/2413#issuecomment-7167689491) 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).
tedin7 commented 2026-11-25 19:03:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T18:23:51Z.

Review: COMMENTED


Review of head c696bd2d (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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6062827949 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2434#pullrequestreview-6062827949). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T18:23:51Z. **Review:** COMMENTED --- Review of head c696bd2d (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 commented 2026-11-25 19:04:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T18:48:06Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7171418619 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2434#issuecomment-7171418619). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T18:48:06Z. --- 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](https://github.com/RavenCurseBurg/Xbox2Windows/actions/runs/45677390608). 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.
upstream-sync closed this pull request 2026-11-25 21:00:55 +00:00
tedin7 commented 2026-11-25 21:01:30 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T20:17:02Z.


Win2025 WARP receipt for head 0f5ae41a 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7173440309 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2434#issuecomment-7173440309). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T20:17:02Z. --- Win2025 WARP receipt for head 0f5ae41a 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.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!2426
No description provided.