shader: lower nested mesh SAVEEXEC regions (Part of #3703) #3722

Merged
timbot103 merged 1 commit from upstream-pr/3722 into main 2026-12-01 11:21:02 +00:00
timbot103 commented 2026-12-01 10:53:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-01T10:53:08Z.


Refs #3703.

Summary

Lowers nested SAVEEXEC regions inside the then arm of an enclosing SAVEEXEC within a mesh lane skip (src/gfx1013_direct_mesh.inl, with a brief note in docs/experiments.md):

  • Nested if-only and if/else SAVEEXEC: Matches inner s_and_saveexec_b64 blocks inside an enclosing SAVEEXEC then arm, accepting s_andn2_b64 or s_xor_b64 inverses and s_mov_b64 or s_or_b64 restores (including vector-only inner else arms that omit their EXECZ when paired with a local restore).
  • Exact nested EXEC tracking: Intersects each inner arm's predicate with the reaching parent EXEC mask, propagates wave nonemptiness and mask words when proven (allowing uniform inner wave-SCC reads while leaving lane-varying SCC undefined), restores the parent mask at the inner join, and preserves incoming VGPR values for skipped lanes across both inner and outer joins.
  • Fail-closed controls: Keeps wrong restores, overwritten or overlapping saved EXEC pairs, escaping then/else branches, instruction-interior targets, unproven masks, extra restores, enclosing else reads of then-written scalars, and standalone nested CMPX strictly refused.

Verification

Windows 11 (26200), MSVC 19.44, Ninja, Windows SDK 10.0.26100. Source-built tests only; added nested if-only, nested paired, no-else-EXECZ, outer-if-only, mask-copy, uniform wave-SCC positive cases and 10 refusal controls in tests/native_direct_mesh_check.py.

  • Debug (dev preset):
    • ctest --preset dev --no-tests=error -R '^native_direct_|^startup_mesh57_real_shape$' -V -> 3/3 passed (native_direct_container, native_direct_mesh, startup_mesh57_real_shape)
  • Release (release preset):
    • ctest --preset release --no-tests=error -R '^native_direct_|^startup_mesh57_real_shape$' -V -> 3/3 passed
  • git diff --check HEAD^ HEAD clean.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5584196825 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3722). Originally posted by [timbot103](https://github.com/timbot103) on 2026-12-01T10:53:08Z. --- Refs #3703. ## Summary Lowers nested `SAVEEXEC` regions inside the `then` arm of an enclosing `SAVEEXEC` within a mesh lane skip (`src/gfx1013_direct_mesh.inl`, with a brief note in `docs/experiments.md`): - **Nested if-only and if/else `SAVEEXEC`:** Matches inner `s_and_saveexec_b64` blocks inside an enclosing `SAVEEXEC` `then` arm, accepting `s_andn2_b64` or `s_xor_b64` inverses and `s_mov_b64` or `s_or_b64` restores (including vector-only inner `else` arms that omit their `EXECZ` when paired with a local restore). - **Exact nested EXEC tracking:** Intersects each inner arm's predicate with the reaching parent EXEC mask, propagates wave nonemptiness and mask words when proven (allowing uniform inner wave-SCC reads while leaving lane-varying SCC undefined), restores the parent mask at the inner join, and preserves incoming VGPR values for skipped lanes across both inner and outer joins. - **Fail-closed controls:** Keeps wrong restores, overwritten or overlapping saved EXEC pairs, escaping `then`/`else` branches, instruction-interior targets, unproven masks, extra restores, enclosing `else` reads of `then`-written scalars, and standalone nested `CMPX` strictly refused. ## Verification Windows 11 (26200), MSVC 19.44, Ninja, Windows SDK 10.0.26100. Source-built tests only; added nested if-only, nested paired, no-else-EXECZ, outer-if-only, mask-copy, uniform wave-SCC positive cases and 10 refusal controls in `tests/native_direct_mesh_check.py`. - **Debug (`dev` preset):** - `ctest --preset dev --no-tests=error -R '^native_direct_|^startup_mesh57_real_shape$' -V` -> **3/3 passed** (`native_direct_container`, `native_direct_mesh`, `startup_mesh57_real_shape`) - **Release (`release` preset):** - `ctest --preset release --no-tests=error -R '^native_direct_|^startup_mesh57_real_shape$' -V` -> **3/3 passed** - `git diff --check HEAD^ HEAD` clean. AI-assisted.
R0Y00 commented 2026-12-01 11:20:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-01T11:20:58Z.

Review: APPROVED


Reviewed mask restore, branch boundaries and scalar clobber tracking. Integrated native_direct_mesh passed locally with nested SAVEEXEC and refusal controls.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6130203794 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3722#pullrequestreview-6130203794). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-01T11:20:58Z. **Review:** APPROVED --- Reviewed mask restore, branch boundaries and scalar clobber tracking. Integrated native_direct_mesh passed locally with nested SAVEEXEC and refusal controls.
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!3722
No description provided.