shader: review follow-up for the mesh diamond restore gap (#3633) #3648

Manually merged
github merged 2 commits from github-bot/gh-3646 into gh-pr/3646/base 2026-12-01 00:25:15 +00:00 AGit
Owner

@⁠mumba17 on GitHub · 2026-11-30 20:43 UTC · original
mumba17:shader/mesh-gap-review → main · +21 −6 · 2 files · 2 commits · merged 2026-12-01 00:19 UTC

Follow-up to #3635. lukaslw-lab's review had one SHOULD and two NITs. #3635 was merged before I pushed the fix (dbf725ef), so the fix is here on top of main.

  • SHOULD: scalar_gap now has s_buffer_load_dword s30, s[24:27], 0 and its wait. The positive case now goes through the SMEM op 8–12 branch, which both real sites use.
  • NIT, allowlist: the SALU test in the gap is now an allowlist: 32-bit SOP1/SOP2/SOPK forms the frontend lowers, plus s_cmp* / s_bitcmp* for SOPC. s_call_b64, s_setreg_b32, s_subvector_loop_*, s_rfe_b64 and all 64-bit forms now end the gap. A new control, gap-salu-b64 (s_mov_b64 s[30:31], 0 in the gap), checks that the restore stays refused.
  • NIT, restore at the join: a comment at diamond_joined=true now says that a restore at the join of a diamond whose own restore names another mask is accepted only when that mask is the open skip's guard.

Mutation checks, each caught by native_direct_mesh:

  • allowing s_mov_b64;
  • limiting SMEM to ops 0–4;
  • clearing diamond_joined unconditionally.

Verification on main d5970858: ctest --preset release -R "mesh|compile_dxil" -j 4 gives 204 passed (the two mesh_two_exits cases skip, as on main). The census of the 454 cached requests is unchanged: 8 mesh EXEC write inside a lane-skip block left.

🤖 Generated with Claude Code

**@⁠mumba17** on GitHub · 2026-11-30 20:43 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3646) `mumba17:shader/mesh-gap-review` → `main` · +21 −6 · 2 files · 2 commits · merged 2026-12-01 00:19 UTC Follow-up to #3635. lukaslw-lab's review had one SHOULD and two NITs. #3635 was merged before I pushed the fix (`dbf725ef`), so the fix is here on top of main. - **SHOULD:** `scalar_gap` now has `s_buffer_load_dword s30, s[24:27], 0` and its wait. The positive case now goes through the SMEM op 8–12 branch, which both real sites use. - **NIT, allowlist:** the SALU test in the gap is now an allowlist: 32-bit SOP1/SOP2/SOPK forms the frontend lowers, plus `s_cmp*` / `s_bitcmp*` for SOPC. `s_call_b64`, `s_setreg_b32`, `s_subvector_loop_*`, `s_rfe_b64` and all 64-bit forms now end the gap. A new control, `gap-salu-b64` (`s_mov_b64 s[30:31], 0` in the gap), checks that the restore stays refused. - **NIT, restore at the join:** a comment at `diamond_joined=true` now says that a restore at the join of a diamond whose own restore names another mask is accepted only when that mask is the open skip's guard. Mutation checks, each caught by `native_direct_mesh`: - allowing `s_mov_b64`; - limiting SMEM to ops 0–4; - clearing `diamond_joined` unconditionally. Verification on main `d5970858`: `ctest --preset release -R "mesh|compile_dxil" -j 4` gives 204 passed (the two `mesh_two_exits` cases skip, as on main). The census of the 454 cached requests is unchanged: 8 `mesh EXEC write inside a lane-skip block` left. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Cover s_buffer_load_dword in the gap fixture (the SMEM op 8-12 path the
real sites use). Replace the SALU name denylist with an allowlist of
32-bit forms plus s_cmp/s_bitcmp, with an s_mov_b64 control. Document
that a restore at the join itself is accepted on the same guard terms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 20:46:13 +00:00
Keeps the diamond join's diamond_joined line untouched, so this merges cleanly with #3645.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠mumba17 on GitHub · 2026-11-30 20:53 UTC · original

In 6a5eeedc I moved the restore-at-join note into the gap comment block, so the diamond join line is untouched. This PR and #3647 now merge cleanly in either order; I checked both with git merge-tree.

**@⁠mumba17** on GitHub · 2026-11-30 20:53 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3646#issuecomment-7291605855) In `6a5eeedc` I moved the restore-at-join note into the gap comment block, so the diamond join line is untouched. This PR and #3647 now merge cleanly in either order; I checked both with `git merge-tree`.
Author
Owner

@⁠lukaslw-lab on GitHub · 2026-11-30 20:54 UTC · original · approved these changes

Reviewed 6a5eeedc by reading the diff; not built or run.

Verdict: approve. This settles the three points from my #3635 review. No MUST, no SHOULD.

  • Checked, no finding:
    • Fixture: 0xf420078c 0xfa000000 is SMEM op 8 (s_buffer_load_dword) with sdata = s30, sbase = s[24:27] and soffset = null. The positive scalar_gap case now goes through the op 8–12 branch that both real sites use, with its wait.
    • gap-salu-b64 (0xbe9e0480 = SOP1 op 4, s_mov_b64 s[30:31], 0) isolates the allowlist: the old name-denylist would have accepted it, because dst < 106 and the name has no exec.
    • Allowlist (src/gfx1013_direct_mesh.inl:594-606): only 32-bit SOP1/SOP2/SOPK forms with dst < 106. s_addk_i32/s_mulk_i32 also read their destination, but dst < 106 already keeps that a plain SGPR. SOPK skips the meaningless src[1], and its unset src[0] (s0) passes lane_free trivially. Calls, setreg, subvector_loop, rfe, movrel and every 64-bit form now end the gap. Leaving out s_bcnt*/s_ff1/s_sext* and similar is conservative.
    • SOPC: only s_cmp*/s_bitcmp* with lane-free sources, so a 64-bit compare of EXEC or VCC stays out.
    • The gap comment (:577-579) now states the restore-at-join condition I asked for.

Tests: the three mutations you list (allowing s_mov_b64, SMEM ops 0–4 only, clearing diamond_joined unconditionally) are each caught by native_direct_mesh. That test is still outside the Windows pr preset filter (also not selected by #3646's pattern), so it has only your run on d5970858.

**@⁠lukaslw-lab** on GitHub · 2026-11-30 20:54 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3646#pullrequestreview-6120380665) · **approved these changes** Reviewed `6a5eeedc` by reading the diff; not built or run. **Verdict: approve.** This settles the three points from my #3635 review. No MUST, no SHOULD. - Checked, no finding: - Fixture: `0xf420078c 0xfa000000` is SMEM op 8 (`s_buffer_load_dword`) with `sdata = s30`, `sbase = s[24:27]` and `soffset = null`. The positive `scalar_gap` case now goes through the `op 8–12` branch that both real sites use, with its wait. - `gap-salu-b64` (`0xbe9e0480` = SOP1 op 4, `s_mov_b64 s[30:31], 0`) isolates the allowlist: the old name-denylist would have accepted it, because `dst < 106` and the name has no `exec`. - Allowlist (`src/gfx1013_direct_mesh.inl:594-606`): only 32-bit SOP1/SOP2/SOPK forms with `dst < 106`. `s_addk_i32`/`s_mulk_i32` also read their destination, but `dst < 106` already keeps that a plain SGPR. SOPK skips the meaningless `src[1]`, and its unset `src[0]` (s0) passes `lane_free` trivially. Calls, `setreg`, `subvector_loop`, `rfe`, `movrel` and every 64-bit form now end the gap. Leaving out `s_bcnt*`/`s_ff1`/`s_sext*` and similar is conservative. - SOPC: only `s_cmp*`/`s_bitcmp*` with lane-free sources, so a 64-bit compare of EXEC or VCC stays out. - The gap comment (`:577-579`) now states the restore-at-join condition I asked for. Tests: the three mutations you list (allowing `s_mov_b64`, SMEM ops 0–4 only, clearing `diamond_joined` unconditionally) are each caught by `native_direct_mesh`. That test is still outside the Windows `pr` preset filter (also not selected by #3646's pattern), so it has only your run on `d5970858`.
github-bot changed target branch from main to gh-pr/3646/base 2026-12-01 00:25:12 +00:00
github manually merged commit 6a5eeedc25 into gh-pr/3646/base 2026-12-01 00:25:15 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.