shader: accept wave-uniform readfirstlane in pixel loops #3906
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!3906
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3904"
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?
@lukaslw-lab on GitHub · 2026-12-03 00:42 UTC · original
lukaslw-lab:shader/pixel-loop-readfirstlane→main· +181 −1 · 4 files · 3 commits · merged 2026-12-03 04:41 UTCChange
The direct gfx1013 pixel compiler accepts
v_readfirstlane_b32inside a loop when the value is the same in every lane. Before, every such read was refused withgraphics readfirstlane requires a wave-uniform reaching value. Inside a loop, a value's input dependencies are complete only after all blocks and back edges are emitted, and the uniform-value tracking skips loops.finish_loop_dependencies(), as loop branch conditions already are. A read is accepted when its value depends on no stage input. Every loop branch has passed the varying check, so all lanes run the same trips.Part of #3816 (row L1, claim). No overlap: the open pixel PRs that touch
uniform_vector_valuesall keep!loop_dependencies.Verification
Commit
03c365c04(on0b83a346b; the headfead4acd5is the same change rebased without conflicts onto2f2901cbd, rerun results will follow in a comment) on Windows 10 22H2 (build 19045), MSVC 19.52.37029, CMake 4.3.1, Python 3.13.7, DXC 1.9.2609.5. Draws need shader model 6.6, so both builds useOFFSCREEN_AGILITY_620_DIR(Agility SDK 1.620.2) andOFFSCREEN_WARP_DIR(WARP 1.0.22.0); D3D12 debug layer on. GPU: NVIDIA GeForce RTX 3080 Ti, driver 32.0.16.1047.Negative control: with
src/gfx1013_direct_graphics.inlfrommain(0b83a346b),native_pixel_loop_readfirstlane_controlsfails at the first case:native compute +0xc: graphics readfirstlane requires a wave-uniform reaching value.No capability skips.
tests/bidi_controls_check.pyandtests/docs_links_check.pypass. On the in-box Windows 10 runtime the draw tests of this family (this one,native_pixel_cmpx_if_else_warp,native_pixel_loop_entry_inputs_*) fail at PSO creation (Shader must be vs_6_2…), with and without this change.Offline census: every distinct slot 86 pixel stage of the capture behind #3816 through
compile_dxil gfx1013-mesh86-ps, main72cc7c7f4vs the same plus this change. Counts only, no shader bytes:graphics readfirstlane requires a wave-uniform reaching valueunsupported wave64 scalar mask operationNo stage gained or lost; this change clears the refusal and exposes the next one. In the stages I disassembled, that is
s_cselect_b64 sN, exec, 0inside the loop (row L2 on the #3816 board).Evidence and follow-up
native_direct_container_check.patched_pixel), MIT. Two loops are drawn on an 8×2 target, each checked against its trip count; a wrong trip count is the mismatch control for each draw. Four refusals plus a positive control: the same loop with the UAV store but no readfirstlane translates.s_cselect_b64 sN, exec, 0select in a loop; L3, in a loop every phi at a CMPX-arm merge counts as varying, also for registers the arm does not write. That also blocks loop counters that cross such an arm.Checklist
AI-assisted: prepared with Claude Code; the commands and results above were run on the author's PC.
🤖 Generated with Claude Code
@lukaslw-lab on GitHub · 2026-12-03 00:57 UTC · original
Rerun on the PR head
fead4acd5(main2f2901cbd, which adds #3841 to the pixel path), same host and builds as in the description:ctest … -R '^(native_pixel_(loop_|cmpx|compare_mask|dxil|waterfall)|native_graphics_wqm_|native_direct_container$)', dev-agility2f2901cbdvs this headunsupported wave64 scalar mask operationThe 24 now include #3841's
native_pixel_waterfall_w6_{controls,warp,hardware}; the waterfall stages are unchanged by this PR.The failing Windows CI test,
native_mesh_entry_registers_ir, is not from this change: this PR touches no mesh file, and it fails the same way locally at this head (AssertionError: ('wave-varying-branch', '')). #3840 added a case that expects av_readfirstlane_b32after a wave-varying SCC branch to be refused; #3896, merged shortly before, accepts that read at a converged full-EXEC join. Main at2f2901cbdhas both.AI-assisted.
github-bot referenced this pull request2026-12-03 01:08:36 +00:00
@R0Y00 on GitHub · 2026-12-03 01:53 UTC · original · reviewed
Independently verified
c5e1d5e4with MSVC Debug on Windows 11 build 26300. ctest --preset dev --no-tests=error -j 1 -R "^native_pixel_loop_(readfirstlane|entry_inputs)_(controls|warp|hardware)$": 6/6 passed, no skips. WARP and RTX 4060 Laptop (616.56) drew both counter cases and the existing entry-input cases. Removing only the deferred dependency check admitted varying-source and failed the control, and the restored compiler passed. Main has now picked up #3847. The trial merge has one hunk at the variable declarations: retain both vcc_skip_joins/vcc_skip_saves/vcc_skip_restores from main and loop_first_lane_reads from this PR. Please rerun this selection after rebasing.@R0Y00 on GitHub · 2026-12-03 01:56 UTC · original
I also trial-merged
c5e1d5e4with main at06251bd5. Keeping both sets of declarations resolved the only conflict. MSVC Debug, ctest --preset dev --no-tests=error -j 1 -R "^(native_pixel_loop_(readfirstlane|entry_inputs)(controls|warp|hardware)|native_pixel_varying_vcc_branch(controls|warp|hardware))$": 9/9 on the combined tree, including WARP and RTX 4060 Laptop, zero skips. The trial was local.@lukaslw-lab on GitHub · 2026-12-03 04:29 UTC · original
Merged
main(430552934) into the branch asf5a822a33, keeping both declaration sets at the conflict as you described; the PR diff againstmainis unchanged (4 files, +181/−1).native_pixel_loop_(readfirstlane|entry_inputs)_*,native_pixel_varying_vcc_branch_*),-j 1native_pixel_(loop_|cmpx|compare_mask|dxil|waterfall|varying),native_graphics_wqm_,native_direct_container)Windows 10 build 19045, WARP 1.0.22.0 and RTX 3080 Ti (32.0.16.1047), Agility SDK 1.620.2, no skips.
AI-assisted.
@R0Y00 on GitHub · 2026-12-03 04:36 UTC · original · approved these changes
Re-reviewed
f5a822a3withmain368a045d. The merge resolution retains both the existing varying-VCC declarations and the loop first-lane records. The current diff still applies the input-dependency, quad-vote and UAV refusal after loop dependencies settle. My earlier dependency-check mutation applies to the same guard, which is unchanged in this revision. MSVC Debugctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^native_pixel_(loop_(readfirstlane|entry_inputs)|varying_vcc_branch|masked_region_alu|exec_writelane_vcc)_(controls|warp|hardware)$'passed 15/15 on the combined tree, including #3842 and #3836. Windows build 26300, WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, D3D12 debug layer enabled, no capability skips.s_bitset1_b32, then stop at a scalar loop #3705