shader: lower SCC-selected EXEC in pixel loops (Part of #3814) #3918

Merged
timbot103 merged 1 commit from upstream-pr/3918 into main 2026-12-03 12:15:35 +00:00
timbot103 commented 2026-12-03 10:32:48 +00:00 (Migrated from github.com)

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


Part of #3814. Refs #3641.

Change

Target L2, unsupported wave64 scalar mask operation for
s_cselect_b64 s[lo:hi], exec, 0 in a loop. The census reported 322 pixel
stages at this first refusal, including the 24 pixel partners of the first
Mesh86 scene draws. The public census identifies the select and its operands.
The test consumers are source-built and the effect on census counts remains
unmeasured.

Accept an ordinary even SGPR pair, a wave-uniform reaching SCC proven after
loop phi dependencies resolve, and EXEC at raster entry coverage or entry
WQM. Preserve the invocation's selected mask bit for CNDMASK, copies, and
EXEC intersections. Use the wave-wide nonempty result for SCC and VCC tests
and for a bounded AND_SAVEEXEC arm with an EXECZ or SCC0 skip and matching
restore.

Other select operands, wave32, odd destinations, numeric reads of the mask
words, clobbered halves, varying SCC, and unproven EXEC changes or restores
still refuse.

Verification

Commit 993c8279 on d2e6a4ed. Windows 11 Pro build 10.0.26200.9974,
MSVC 19.44.35230, and DXC 1.9.2602.17 (21d28f727). Microsoft WARP
reported driver 10.0.26100.9818 and the NVIDIA GeForce RTX 5080 reported
32.0.16.2140 (621.40). The D3D12 debug layer was unavailable on both
backends.

The compiler built from base d2e6a4ed refused the first positive fixture at
the select (+0x20) with unsupported wave64 scalar mask operation.
The PR-preset controls accepted all three positive variants and verified
eight refusals. WARP and the RTX 5080 matched all 21 pixels in all three
draws in both Debug and Release. Every wrong reference produced the
expected mismatch.

The same source-built variants also compiled through
compile_dxil $DXC_BIN_DIR cache gfx1013-mesh86-ps fixture.ps86 fixture.cso
with a synthetic rootsig_1_1 sidecar declaring direct CBV/SRV/UAV and
sampler heap indexing.

cmake --build out/build/dev -- -j 6
cmake --build out/build/release --target compile_dxil offscreen_check native_pixel_ir_dump native_recording_check native_compute_ir_dump native_sampled_pixel_gpu startup_stream_consumer -- -j 6
ctest --preset dev --no-tests=error -j 1 -V -R 'native_pixel_|native_graphics_|native_direct_container'
ctest --preset release --no-tests=error -j 1 -V -R 'native_pixel_|native_graphics_|native_direct_container'
ctest --preset pr --no-tests=error -R '^native_pixel_loop_exec_cselect_controls$'
ctest --preset dev --no-tests=error -R '^native_compute_pack_refusals$'
.\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py
.\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py
git diff --check origin/main...HEAD
Check Passed Failed Skipped
Debug pixel and graphics selection 71 0 0
Release pixel and graphics selection 71 0 0
PR preset controls 1 0 0
C++17 frontend refusal test 1 0 0
Bidirectional controls, docs links, and Git whitespace 3 0 0

The full Debug build and the selected Release target build completed.

To reproduce the base refusal, build compile_dxil from d2e6a4ed into
out/l2-base-build and set $DXC_BIN_DIR to the same SDK compiler directory.
The following negative control expects exit code 1 at the first fixture.

Push-Location out
.\pe-env\Scripts\python.exe -B ..\tests\native_pixel_loop_exec_cselect_check.py .\l2-base-build\compile_dxil.exe - "$DXC_BIN_DIR" controls
Pop-Location

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5624700893 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3918). Originally posted by [timbot103](https://github.com/timbot103) on 2026-12-03T10:32:48Z. --- Part of #3814. Refs #3641. ## Change Target L2, `unsupported wave64 scalar mask operation` for `s_cselect_b64 s[lo:hi], exec, 0` in a loop. The census reported 322 pixel stages at this first refusal, including the 24 pixel partners of the first Mesh86 scene draws. The public census identifies the select and its operands. The test consumers are source-built and the effect on census counts remains unmeasured. Accept an ordinary even SGPR pair, a wave-uniform reaching SCC proven after loop phi dependencies resolve, and EXEC at raster entry coverage or entry WQM. Preserve the invocation's selected mask bit for CNDMASK, copies, and EXEC intersections. Use the wave-wide nonempty result for SCC and VCC tests and for a bounded AND_SAVEEXEC arm with an EXECZ or SCC0 skip and matching restore. Other select operands, wave32, odd destinations, numeric reads of the mask words, clobbered halves, varying SCC, and unproven EXEC changes or restores still refuse. ## Verification Commit `993c8279` on `d2e6a4ed`. Windows 11 Pro build `10.0.26200.9974`, MSVC `19.44.35230`, and DXC `1.9.2602.17` (`21d28f727`). Microsoft WARP reported driver `10.0.26100.9818` and the NVIDIA GeForce RTX 5080 reported `32.0.16.2140` (`621.40`). The D3D12 debug layer was unavailable on both backends. The compiler built from base `d2e6a4ed` refused the first positive fixture at the select (`+0x20`) with `unsupported wave64 scalar mask operation`. The PR-preset controls accepted all three positive variants and verified eight refusals. WARP and the RTX 5080 matched all 21 pixels in all three draws in both Debug and Release. Every wrong reference produced the expected mismatch. The same source-built variants also compiled through `compile_dxil $DXC_BIN_DIR cache gfx1013-mesh86-ps fixture.ps86 fixture.cso` with a synthetic `rootsig_1_1` sidecar declaring direct CBV/SRV/UAV and sampler heap indexing. ```powershell cmake --build out/build/dev -- -j 6 cmake --build out/build/release --target compile_dxil offscreen_check native_pixel_ir_dump native_recording_check native_compute_ir_dump native_sampled_pixel_gpu startup_stream_consumer -- -j 6 ctest --preset dev --no-tests=error -j 1 -V -R 'native_pixel_|native_graphics_|native_direct_container' ctest --preset release --no-tests=error -j 1 -V -R 'native_pixel_|native_graphics_|native_direct_container' ctest --preset pr --no-tests=error -R '^native_pixel_loop_exec_cselect_controls$' ctest --preset dev --no-tests=error -R '^native_compute_pack_refusals$' .\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py .\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py git diff --check origin/main...HEAD ``` | Check | Passed | Failed | Skipped | | --- | ---: | ---: | ---: | | Debug pixel and graphics selection | 71 | 0 | 0 | | Release pixel and graphics selection | 71 | 0 | 0 | | PR preset controls | 1 | 0 | 0 | | C++17 frontend refusal test | 1 | 0 | 0 | | Bidirectional controls, docs links, and Git whitespace | 3 | 0 | 0 | The full Debug build and the selected Release target build completed. To reproduce the base refusal, build `compile_dxil` from `d2e6a4ed` into `out/l2-base-build` and set `$DXC_BIN_DIR` to the same SDK compiler directory. The following negative control expects exit code 1 at the first fixture. ```powershell Push-Location out .\pe-env\Scripts\python.exe -B ..\tests\native_pixel_loop_exec_cselect_check.py .\l2-base-build\compile_dxil.exe - "$DXC_BIN_DIR" controls Pop-Location ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
JohnConnorNPC commented 2026-12-03 11:27:26 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-12-03T11:27:26Z.


Reviewed 993c8279b3cf. Verdict: no MUST or SHOULD, one NIT.

  1. NIT (new doc): the "Pixel census row L2" link goes to the claim comment (7374732733); the census table with row L2 is comment 7368270349.

Checked on Linux (clang-cl cross build, run under Wine): controls give 3 translated and 8 refused, exit 0. Four source mutations turned them red; a fifth (the SCC write on the OR restore) stayed green here because only the GPU draw covers it. Not run: WARP or hardware draws, Release-build controls, the Windows C++17 refusal test.

Not a finding on the code: the question on #3814 about planned follow-ups and real loop shapes had no reply at review time.

AI-assisted review.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7376726280 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3918#issuecomment-7376726280). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-12-03T11:27:26Z. --- Reviewed `993c8279b3cf`. **Verdict: no MUST or SHOULD, one NIT.** 1. **NIT** (new doc): the "Pixel census row L2" link goes to the claim comment (7374732733); the census table with row L2 is comment 7368270349. Checked on Linux (clang-cl cross build, run under Wine): controls give 3 translated and 8 refused, exit 0. Four source mutations turned them red; a fifth (the SCC write on the OR restore) stayed green here because only the GPU draw covers it. Not run: WARP or hardware draws, Release-build controls, the Windows C++17 refusal test. Not a finding on the code: the question on #3814 about planned follow-ups and real loop shapes had no reply at review time. AI-assisted review.
R0Y00 commented 2026-12-03 12:15:28 +00:00 (Migrated from github.com)

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

Review: APPROVED


Approved 993c8279. The matcher confines the select to entry coverage or entry WQM, checks reaching SCC after resolving loop phis, and keeps the wave-wide nonempty bit separate from the lane bit. Independent MSVC Debug and SDK DXC on Windows build 26300: all three translation positives and eight refusal controls passed. Exact VCC, WQM/EXECZ and WQM/SCC0 each matched 21 pixels on both inbox WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, with the D3D12 debug layer enabled, no debug errors or capability skips.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6169591993 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3918#pullrequestreview-6169591993). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-03T12:15:28Z. **Review:** APPROVED --- Approved 993c8279. The matcher confines the select to entry coverage or entry WQM, checks reaching SCC after resolving loop phis, and keeps the wave-wide nonempty bit separate from the lane bit. Independent MSVC Debug and SDK DXC on Windows build 26300: all three translation positives and eight refusal controls passed. Exact VCC, WQM/EXECZ and WQM/SCC0 each matched 21 pixels on both inbox WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, with the D3D12 debug layer enabled, no debug errors or capability 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!3918
No description provided.