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

Merged
mumba17 merged 2 commits from upstream-pr/3646 into main 2026-12-01 00:19:27 +00:00
mumba17 commented 2026-11-30 20:43:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-11-30T20:43:54Z.


Follow-up to #3633. lukaslw-lab's review had one SHOULD and two NITs. #3633 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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5573423861 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3646). Originally posted by [mumba17](https://github.com/mumba17) on 2026-11-30T20:43:54Z. --- Follow-up to #3633. lukaslw-lab's review had one SHOULD and two NITs. #3633 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)
mumba17 commented 2026-11-30 20:53:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-11-30T20:53:08Z.


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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7291605855 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3646#issuecomment-7291605855). Originally posted by [mumba17](https://github.com/mumba17) on 2026-11-30T20:53:08Z. --- In `6a5eeedc` I moved the restore-at-join note into the gap comment block, so the diamond join line is untouched. This PR and #3645 now merge cleanly in either order; I checked both with `git merge-tree`.
lukaslw-lab commented 2026-11-30 20:54:26 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-30T20:54:26Z.

Review: APPROVED


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

Verdict: approve. This settles the three points from my #3633 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 #3644's pattern), so it has only your run on d5970858.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6120380665 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3646#pullrequestreview-6120380665). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-30T20:54:26Z. **Review:** APPROVED --- Reviewed `6a5eeedc` by reading the diff; not built or run. **Verdict: approve.** This settles the three points from my #3633 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 #3644's pattern), so it has only your run on `d5970858`.
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!3646
No description provided.