shader: lower delayed EXEC restores in mesh CMPX arms (Part of #3703) #3917

Merged
timbot103 merged 1 commit from upstream-pr/3917 into main 2026-12-03 12:06:20 +00:00
timbot103 commented 2026-12-03 10:21:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-03T10:21:14Z.


Part of #3703

Mesh census row E2

mesh SAVEEXEC then arm depends on EXEC accounted for 277 first refusals in the
368a045df census, including 127 moved there by #3843. This change targets
the local-restore case of the distant CMPX restores described in the work split.

Inside a SAVEEXEC then arm, the compiler now accepts a copy of EXEC followed by
one supported CMPX and a forward EXECZ skip to a common tail of EXEC-independent
scalar ALU and wait instructions. The tail must end at a restore of that exact
copy inside the then arm. The existing nested diamond joins the VGPRs at the
skip target and executes the scalar work on both paths before continuing under
the restored mask.

The matcher still refuses branches into or across the nested region, vector and
memory operations in the tail, EXEC- or VCC-dependent tail instructions,
wrong or clobbered saved masks, and reads of scalar values defined only in the
skipped body. Backward branches and shared exits that would reach an enclosing
inverse with narrowed EXEC remain refused. The exact instruction schedule and
first-refusal delta for the 277 capture programs remain unverified.

Verification

Tested b1cd99f3 based on d2e6a4ed on Windows 11 26200.9974, MSVC
19.44.35230.0, Windows SDK 10.0.26100.0, and DXC 1.9.2602.17. The D3D12
debug layer was unavailable. The GPUs were Microsoft Basic Render Driver
(WARP, 1414:008c, driver 10.0.26100.9818) and NVIDIA GeForce RTX 5080
(10de:2c02, driver 32.0.16.2140).

cmake --preset dev
cmake --preset release
cmake --build out/build/dev -- -j 6
cmake --build out/build/release --target compile_dxil offscreen_check startup_indirect_draw_indexed d3d12_xs_shim -- -j 6
ctest --preset dev --no-tests=error -j 1 -V -R 'native_direct_mesh|native_direct_container|native_mesh_'
ctest --preset release --no-tests=error -j 1 -V -R 'native_direct_mesh|native_direct_container|native_mesh_'
$env:X2W_SYNC_MESH_REQUESTS='1'
ctest --preset release --no-tests=error -j 1 -V -R '^native_mesh_(guarded_allocation|empty_allocation|missing_position)_warp$'
Remove-Item Env:X2W_SYNC_MESH_REQUESTS
ctest --preset pr --no-tests=error -R '^native_mesh_saveexec_cmpx_tail_ir$' -V
ctest --preset dev --no-tests=error -j 1 -V -R '^native_compute_pack_refusals$'
python tests/bidi_controls_check.py
python tests/docs_links_check.py
git diff --check origin/main...HEAD
Run Passed Failed Skipped
Debug mesh regression suite 25 0 0
Release mesh regression suite, first run 22 3 0
Release synchronous WARP retry 3 0 0
PR preset, new IR test 1 0 0
Debug C++17 pack refusal fixture 1 0 0

The full Debug build, Release target build, bidi check, Markdown link check
and diff check passed. The first Release run reproduced the known asynchronous
WARP failures in guarded allocation, empty allocation, and missing position.
The first diagnostic was accepted=1 refused=0 for guarded allocation, where
the fixture expected accepted=1 refused=1. The synchronous retry passed all
three.

The new IR fixture passed four DXIL cases and 11 refusal controls. For each
adapter and configuration, wave32 and wave64 mesh readback matched all 4,096
pixels across four draws. Each wrong reference, which omits the scalar tail
on the empty path, produced the expected 512 mismatches.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5624523779 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3917). Originally posted by [timbot103](https://github.com/timbot103) on 2026-12-03T10:21:14Z. --- Part of #3703 ## Mesh census row E2 `mesh SAVEEXEC then arm depends on EXEC` accounted for 277 first refusals in the `368a045df` census, including 127 moved there by #3843. This change targets the local-restore case of the distant CMPX restores described in the work split. Inside a SAVEEXEC then arm, the compiler now accepts a copy of EXEC followed by one supported CMPX and a forward EXECZ skip to a common tail of EXEC-independent scalar ALU and wait instructions. The tail must end at a restore of that exact copy inside the then arm. The existing nested diamond joins the VGPRs at the skip target and executes the scalar work on both paths before continuing under the restored mask. The matcher still refuses branches into or across the nested region, vector and memory operations in the tail, EXEC- or VCC-dependent tail instructions, wrong or clobbered saved masks, and reads of scalar values defined only in the skipped body. Backward branches and shared exits that would reach an enclosing inverse with narrowed EXEC remain refused. The exact instruction schedule and first-refusal delta for the 277 capture programs remain unverified. ## Verification Tested `b1cd99f3` based on `d2e6a4ed` on Windows 11 `26200.9974`, MSVC `19.44.35230.0`, Windows SDK `10.0.26100.0`, and DXC `1.9.2602.17`. The D3D12 debug layer was unavailable. The GPUs were Microsoft Basic Render Driver (WARP, `1414:008c`, driver `10.0.26100.9818`) and NVIDIA GeForce RTX 5080 (`10de:2c02`, driver `32.0.16.2140`). ```powershell cmake --preset dev cmake --preset release cmake --build out/build/dev -- -j 6 cmake --build out/build/release --target compile_dxil offscreen_check startup_indirect_draw_indexed d3d12_xs_shim -- -j 6 ctest --preset dev --no-tests=error -j 1 -V -R 'native_direct_mesh|native_direct_container|native_mesh_' ctest --preset release --no-tests=error -j 1 -V -R 'native_direct_mesh|native_direct_container|native_mesh_' $env:X2W_SYNC_MESH_REQUESTS='1' ctest --preset release --no-tests=error -j 1 -V -R '^native_mesh_(guarded_allocation|empty_allocation|missing_position)_warp$' Remove-Item Env:X2W_SYNC_MESH_REQUESTS ctest --preset pr --no-tests=error -R '^native_mesh_saveexec_cmpx_tail_ir$' -V ctest --preset dev --no-tests=error -j 1 -V -R '^native_compute_pack_refusals$' python tests/bidi_controls_check.py python tests/docs_links_check.py git diff --check origin/main...HEAD ``` | Run | Passed | Failed | Skipped | | --- | ---: | ---: | ---: | | Debug mesh regression suite | 25 | 0 | 0 | | Release mesh regression suite, first run | 22 | 3 | 0 | | Release synchronous WARP retry | 3 | 0 | 0 | | PR preset, new IR test | 1 | 0 | 0 | | Debug C++17 pack refusal fixture | 1 | 0 | 0 | The full Debug build, Release target build, bidi check, Markdown link check and diff check passed. The first Release run reproduced the known asynchronous WARP failures in guarded allocation, empty allocation, and missing position. The first diagnostic was `accepted=1 refused=0` for guarded allocation, where the fixture expected `accepted=1 refused=1`. The synchronous retry passed all three. The new IR fixture passed four DXIL cases and 11 refusal controls. For each adapter and configuration, wave32 and wave64 mesh readback matched all 4,096 pixels across four draws. Each wrong reference, which omits the scalar tail on the empty path, produced the expected 512 mismatches. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
R0Y00 commented 2026-12-03 12:06:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T12:06:14Z.

Review: APPROVED


Approved b1cd99f3. The nested CMPX arms rejoin before the EXEC-independent scalar tail, and the restore still consumes its exact saved pair. Independent MSVC Debug and SDK DXC on Windows build 26300: native_mesh_saveexec_cmpx_tail_ir passed four IR cases and eleven refusals. The source-built renderer matched 1,024 pixels in each of the four wave32/wave64 and inverse/no-inverse draws on each adapter. The wrong tail reference differed in 512 pixels with both guest wave sizes on both adapters. Inbox WARP 10.0.26100.9818, RTX 4060 Laptop 32.0.16.1656, debug layer enabled, zero debug errors and no skips.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6169437746 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3917#pullrequestreview-6169437746). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-03T12:06:14Z. **Review:** APPROVED --- Approved b1cd99f3. The nested CMPX arms rejoin before the EXEC-independent scalar tail, and the restore still consumes its exact saved pair. Independent MSVC Debug and SDK DXC on Windows build 26300: native_mesh_saveexec_cmpx_tail_ir passed four IR cases and eleven refusals. The source-built renderer matched 1,024 pixels in each of the four wave32/wave64 and inverse/no-inverse draws on each adapter. The wrong tail reference differed in 512 pixels with both guest wave sizes on both adapters. Inbox WARP 10.0.26100.9818, RTX 4060 Laptop 32.0.16.1656, debug layer enabled, zero debug errors and no skips.
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!3917
No description provided.