Skip to content

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

Merged
R0Y00 merged 2 commits into
R0Y00:mainfrom
mumba17:shader/mesh-gap-review
Dec 1, 2026
Merged

R0Y00 merged 2 commits into
R0Y00:mainfrom
mumba17:shader/mesh-gap-review

Conversation

@mumba17

@mumba17 mumba17 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

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

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 <noreply@anthropic.com>
Keeps the diamond join's diamond_joined line untouched, so this merges cleanly with R0Y00#3645.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mumba17

mumba17 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

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 lukaslw-lab left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

3 participants