shader: carry exact mesh lanes through nested CMPX skips to an EXEC restore (Part of #3703) #3762
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3762
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3760"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@mumba17 on GitHub · 2026-12-01 16:54 UTC · original
mumba17:shader/mesh-nested-skip-restore→main· +99 −4 · 2 files · 2 commits · merged 2026-12-02 20:49 UTCStacked on #3712. The branch contains #3712's commit until it merges; the change here is the last commit (
e55a511f).Part of #3705. This is the wall right after #3731:
graphics register undefined on an incoming path.What goes wrong
Skinned mesh programs nest a chain of per-lane CMPX skips inside the vertex skip. Each one opens straight after a CMPX that narrows the skip around it, and all of them exit to one
s_mov_b64 exec, s[N:N+1]that restores the vertex mask. The vertex skip then goes on and reads the accumulated registers.A per-lane skip merges every register per lane when it closes, so after the chain closes each thread below V holds an exact value. #3712 carried that fact up one level only, and only when the parent closed at the same instruction. Here the chain is deeper and closes at a restore while the vertex skip continues. The restore then treated every register written since the mask was saved as stale, cleared it, and the next read refused.
Change
close_skippasses the carried lane set through any number of skips that close at one pc (a skip exact for its guard makes itsnarrowed_fromparent exact too).These still break the chain and refuse as before:
v_cmpthens_and_b64 exec).Tests
Source-built in
tests/native_direct_mesh_check.py:nested-skip-chain-restore-1and-3: one and three nested skips exit to a restore of the saved vertex mask, thenv10is read and written again under that mask before the export.nested-skip-chain-end: two nested skips that close where the vertex skip closes.nested-skip-chain-write-before-execzandnested-skip-chain-and-exec: the two controls above, stillundefined on an incoming path: 266.I removed each half of the fix in turn: dropping the multi-level carry fails
-3, and ignoring the carried set at the restore fails-1.Validation (Windows 11, MSVC, Windows SDK 10.0.26100)
ctest --test-dir out/build/dev -R "native_direct_mesh|mesh": 210/210 pass (the twomesh_two_exitshardware tests skip as usual).maine1161e43+ #3710 + #3711 + #3712 + #3731 + this: 749 of 1,569 distinct Mesh86 programs translate, up from 512. 237 gained, none lost. Counts only; request bytes stay local.AI-assisted.
🤖 Generated with Claude Code
s_bitset1_b32, then stop at a scalar loop #3705@R0Y00 on GitHub · 2026-12-01 17:08 UTC · original
CI on the current head is green. This branch still carries #3712, whose current head GitHub reports as non-mergeable. Please refresh the stack against current main or confirm that #3762 supersedes #3712 and should be landed as one combined change.
e55a511f3ctoc4ee8a14e9@mumba17 on GitHub · 2026-12-01 17:22 UTC · original
Thanks @R0Y00. I refreshed the stack against current
main(158ef794). Both rebased without conflicts:a7d98042.a7d98042+c4ee8a14.ctest -R "native_direct_mesh|mesh"passes 210/210 on the top of the stack, andnative_direct_meshpasses on #3712 alone.#3762 does not replace #3712. It extends it: #3712 carries the lane set from one nested skip to its parent, and #3762 carries it through any depth and into an EXEC restore. Either order works:
Tell me which you prefer and I'll tidy up the other.
AI-assisted.
@lukaslw-lab on GitHub · 2026-12-01 18:56 UTC · original · approved these changes
Reviewed
c4ee8a14(own commit on top of #3712'sa7d98042) by reading the diff; not built or run.Verdict: approve. The carry now passes through skips that are exact for their guard by either route: the guard is still current, or a deeper skip carried it. At the restore it is used only when the restored mask is exactly the carried guard of the open skip, both lane and wave guard. No MUST.
carried_atto that earlierpc.lane_activethen stays narrowed at the parent's close, soguard_lanesis false and the parent passes nothing on. The restore then falls back to the existing clearing.carried_at == pc. Together withclosed_nested_skip, this keeps the carry to the restore instruction at the closingpc(gfx1013_direct_mesh.inl:1984).0x061414f2isv_add_f32 v10, 1.0, v10.0xbea6047e/0xbefe0426save and restores[38:39]. The exit offsets land on the restore, and the vertex skip is still open there.text.count('fadd') >= depth + 1counts adds anywhere in the output. Acceptance already shows thatv10survived the restore. Following the lastfaddto the export would also show that the per-lane merge feeds it.Tests:
-1and-3reach the restore path with one and three levels, andchain-endreaches the multi-level carry into #3712'sretain. The two controls keep the write-before-EXECZ and non-CMPX narrowing refused.native_direct_meshis in theprpreset filter, and CI ran it green at this head.s_bitset1_b32, then stop at a scalar loop #3705github-bot referenced this pull request2026-12-01 23:59:36 +00:00
github-bot referenced this pull request2026-12-02 04:54:17 +00:00
s_bitset1_b32, then stop at a scalar loop #3705@Leyukaka on GitHub · 2026-12-02 07:13 UTC · original
Friendly note: this is approved, but it conflicts with
mainagain since #3799 and #3772 merged today; one more rebase should be all it needs.c4ee8a14e9tocf68344ab9@mumba17 on GitHub · 2026-12-02 07:26 UTC · original
Thanks @Leyukaka. I rebased the stack on current
main(f365f125):756647ae.756647ae+cf68344a.#3762 had one conflict, where
main's narrowed-restore branch (from #3767) and #3762's carried-lane check meet. Both are kept: the narrowed restore runs first, and otherwise the restore is skipped only when the lanes were carried.On top of the stack,
ctest -R "native_direct_mesh|mesh"passes 228/230, with the twomesh_two_exitstests skipped as usual. Twostartup_indirect_mesh_*_hardwaretests failed under-j 8from GPU contention and pass when run serially.native_direct_meshalso passes on #3712 alone.AI-assisted.
@lukaslw-lab on GitHub · 2026-12-02 07:42 UTC · original · approved these changes
Reviewed
cf68344aby reading the diff; not built or run.Verdict: approve. The conflict with #3767's narrowed restore is resolved fail-closed. No MUST.
c4ee8a14is the restore inlower_mesh(gfx1013_direct_mesh.inl:2315).narrowed_restorenow runs first, and the carried-lane skip only guards theelse if(:2327).c4ee8a14.Tests:
native_direct_mesh(in theprfilter) is green on this head.@mumba17 on GitHub · 2026-12-02 07:43 UTC · original
Census on the rebased stack (same capture and method as on #3705), so the merge can be prioritised:
mainf365f125: 532 of 1,569 translate. The largest wall isgraphics register undefined on an incoming path, at 547 programs.main+ #3712 + #3762: 993 of 1,569. 461 gained, none lost. No program stops atgraphics register undefined on an incoming pathany more.Counts only; request bytes stay local. Not run in the game.
AI-assisted.
cf68344ab9tob15feae054@lukaslw-lab on GitHub · 2026-12-02 09:35 UTC · original · approved these changes
Reviewed
b15feae0bygit range-diffagainstcf68344a; not built or run.Verdict: approve. This is a rebase onto
45c809ab. The commit is identical to the one I approved, and its base #3712 only gained #3808's rename in context. No MUST.s_bitset1_b32, then stop at a scalar loop #3705b15feae054to42ce2c2754@R0Y00 on GitHub · 2026-12-02 20:48 UTC · original · approved these changes
Reviewed
42ce2c27independently and reran the same MSVC Debugnative_direct_meshfixture against the trial merge into81f677d4after #3712 and #3792 landed. Both runs passed. The remaining diff carries the lane proof only across closes at the same PC, and the restore still requires the matching saved lane and wave guards. The one-level and three-level cases, the missing adjacency and non-CMPX refusals all passed.s_bitset1_b32, then stop at a scalar loop #3705github-bot referenced this pull request2026-12-02 21:54:40 +00:00
s_bitset1_b32, then stop at a scalar loop #3705s_bitset1_b32, then stop at a scalar loop #3705