shader: keep a mesh lane limit across a nested CMPX skip that closes at the same restore (Part of #3703) #3710
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3710"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-12-01T08:27:44Z.
Part of #3703 (item 6). Refs #3641, #3671.
Problem
Many slot 86 mesh programs compute their position in a vertex skip with a nested CMPX skip inside it, and both skips exit to the same EXEC restore:
#3671 lets an export read VGPRs written under a vertex skip when the read is under the same lane count. When the skip closes, it tags the VGPRs with the skip's lane limit (
close_skip,retain). That requires the closing skip's guard to be the current lane mask. Here the nested skip closes first at R and leaves its narrowed mask current. So the outer skip was never tagged, and the restore erased v1–v4.Change
src/gfx1013_direct_mesh.inl:mask_parent), the skip records the parent guard (Skip::narrowed_from).retainin place ofguard == lane_active. The tag, the restore andcheck_graphics_readare unchanged from #3671, so every later read must still be under a proven bound of the same count.Census
Capture. A native Mesh86 run on
main1c634037, withX2W_REFUSE_FIXED_MESH=1andX2W_NATIVE_MESH86=1: 1,569 distinct.m86requests. Each went throughcompile_dxil … gfx1013-container-ms-texture-heap. Counts only; request bytes stay local.undefined on an incoming pathfirstmain(+ #3706, which changes none of these counts)main+ #3706 + #3708 + #3709No program that translated before is refused now. Program by program, 32 go from refused to translated, and none go the other way.
Tests
tests/native_direct_mesh_check.py, built like #3671'sbounded-export:v_cmpx_eq_u32 0, v0skip sets v10 = 2.0, both exit to the same restore, and the export runs under the count guard.nested-skip-export: restore withexec = -1.nested-skip-saved-exec: restore withs_mov_b64 exec, s[36:37]saved before the skip, as in the title.storeVertexOutputwith both constants.nested-skip-write-before-execz(av_movbetween the nested CMPX and its EXECZ) andnested-skip-and-exec(narrowing byv_cmp+s_and_b64 exec): both still stop atgraphics register undefined on an incoming path: 266.nested-skip-full-exec(export without the count guard):mesh register read outside its proven lane range: 266.nested-skip-exportwithundefined on an incoming path: 266.ctest -R "native_|mesh|gfx1013" -E "hardware|_warp": 786/788 pass. The same two local-only failures as in #3708: the SDK validator here supports DXIL 1.7, and those tests emit 1.8.Environment: Windows 11 build 26300, RTX 3090, MSVC 14.44, DXC from SDK 10.0.26100.
AI-assisted.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-01T18:51:47Z.
Review: APPROVED
Reviewed
a7d98042by reading the diff; not built or run.Verdict: approve. The carried guard is set only for a per-lane skip opened right after a CMPX that narrowed the parent's guard (
mask_parent). It is used only when both skips close at the samepc, and only through the existingretainconditions. So every read after the restore still needs #3671's lane-range proof. No MUST.carried_lane.clear()in the forward-arrival block (gfx1013_direct_mesh.inl:763) never runs whilecarried_laneis set. Arrivals atpcare merged, andforward.at(pc)erased, before the firstclose_skip().return truethen re-enters the loop with nothing left to arrive, andmerge_edgesadds no forward edges. The EXEC-definition refusal andretain'sforward.empty()are what actually guard this, so the line could go.wave_activeset) as not carried, but no case pins it. Adding one besidenested-skip-and-execwould cover thewave_active.empty()test at:1378.skip_parentsnot empty). Its ownnarrowed_fromis passed on only if its guard is stilllane_activeafter the merge, so the outer skip is otherwise not tagged and the read is refused.last_end == pc. This requires the CMPX to fall through directly into the EXECZ. Instructions that leave the loop throughcontinuedon't updatelast_name, which fails closed.0x7da40080isv_cmpx_eq_u32 0, v0, and0x7da80017isv_cmpx_gt_u32 s23, v0.0x7d840080, 0x87fe6a7eisv_cmp_eq_u32thens_and_b64 exec, exec, vcc.0xf2/0xf4/0xf6are 1.0/2.0/4.0, and the EXECZ offsets land on the restore.Tests: the two positives reach
storeVertexOutputwith both constants, throughexec = -1and through the saved-EXEC restore. The two refusal cases pin the write-before-EXECZ and non-CMPX narrowing exclusions.nested-skip-full-execkeeps the count guard required.native_direct_meshis in theprpreset filter, and CI ran it green at this head.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T07:42:10Z.
Review: APPROVED
Reviewed
756647aeby reading the diff; not built or run.Verdict: approve. This is a rebase onto
f365f125. The PR's own change is identical toa7d98042, which I approved. No MUST.a7d98042with756647aeusinggit range-diff. Only context lines from main changed (saveexec_vcc_testsbranch, theskip-narrow-inner-savetest line); the source and test hunks of the PR itself did not.carried_lane.clear(), and no whole-wave nested-skip control.Tests:
native_direct_mesh(in theprfilter) is green on this head.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T09:35:49Z.
Review: APPROVED
Reviewed
a2d83177bygit range-diffagainst756647ae; not built or run.Verdict: approve. This is a rebase onto
45c809ab(after #3806). The only change is #3806'sinputs→incomingrename in the context of this PR'scarried_lane.clear()line, which is kept. No MUST.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T20:45:00Z.
Review: APPROVED
Reviewed
43791423. The carried mask can only substitute for the matching parent guard when adjacent CMPX and EXECZ open the nested lane skip, and both skips end at the same PC. The existing export lane-range check remains in place. Independent Windows 11 build 26300, MSVC Debugcmake --build --preset dev --target compile_dxilandctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^native_direct_mesh$'passed. That fixture includes both restore forms, the intervening-write and non-CMPX refusals, and the full-EXEC refusal for the out-of-range export.