Repository navigation
startup: lower DPP quad reads in pixel programs with uniform branches and loops (Part of #1723) - #2705
Conversation
…d loops
Symptom: a DPP16 quad read (quad swap, quad broadcast, pair broadcast) in a
pixel program with any branch or loop was refused ("requires a straight-line
pixel shader with entry EXEC" / "outside straight-line pixel code"), so every
program that also has a loop failed even when the loop is a plain scalar
counter.
Root cause: the one-lane model runs each guest lane as its own HLSL thread
through the pc dispatch, and the quad intrinsics only see a neighbour when
the four threads of a quad reach them together. The old check required
straight-line code instead of proving that.
Change: Stage.quad_flow_refusals proves it over the whole program after
translation: the s_wqm exec, exec runs before every branch and target, no
other EXEC write can reach the read (CFG reachability, back edges included),
and every conditional branch that can reach the read is wave-uniform (SCC
proven uniform by the existing pass; execz/execnz under the whole-quad mask).
vccz/vccnz loops, SCC from a lane mask, an EXEC write inside the loop and a
late s_wqm are refused with the offset that breaks the proof. No wave size is
assumed (SM 6.0 quad operations need only the 2x2 quad).
Test: tests/startup_gfx2hlsl_dpp_quad_flow_check.py (controls fail before:
LOOP refused, the four refusal reasons absent). Win2025 WARP (DXC ps_6_0)
dev and release: LOOP draws 256/256 pixels equal to the CPU reference, the
three wrong-lane mutations each fail; dpp_pair draws still pass.
(cherry picked from commit 82d1b1d7786e8012494782d13eeefafd88b6a4c8)
…f DPP quad reads, keep unit probes on the entry prefix
|
@MasterDomino Independent Stage-2 gate review of head e9283e3: PASS, marked Ready.
Commands executed: AI-assisted; commands listed were executed locally. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e9283e3e93
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Re-checked the fix for the empty branch set on head fc3afb5 (resolving the thread).
Commands executed: AI-assisted; commands listed were executed locally. |
R0Y00
left a comment
There was a problem hiding this comment.
Reviewed the whole-quad flow proof and ran the new controls plus the existing DPP broadcast, swap and pair checks with main e6902a1 combined. The uniform loop matched all 256 pixels on WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656 (Windows 11 build 26200). The three wrong-lane mutations changed 256, 256 and 128 pixels respectively on each adapter. Missing WQM, a reaching EXEC write and unproved SCC flow stayed refused.
Part of #1723
What this unblocks: pixel programs that read a DPP quad neighbour (quad swap, quad broadcast, pair broadcast) and also have a uniform branch or loop now translate; today any branch or loop after the first read, or around it, is refused.
Extends #2657 and #2483: #2657 accepts a broadcast in the entry prefix when a loop follows; this PR proves the same property for reads inside branches and loops.
What changed
The one-lane model runs each guest lane as its own HLSL thread through the pc dispatch, and
QuadReadLaneAtonly sees a neighbour when the four threads of a quad reach the statement together. The old check required straight-line code (or, since #2657, the entry prefix) instead of proving that.Stage.quad_flow_refusalsproves it over the whole program after translation:s_wqm_b64 exec, execruns before every branch and branch target;execz/execnzunder the whole-quad mask).No wave size is assumed (SM 6.0 quad operations need only the 2x2 quad). The second commit keeps the entry-prefix test for stage objects that never run
translate()(unit probes), so #2657's fixtures behave as before.What stays refused
vccz/vccnzloops, SCC derived from a lane mask, an EXEC write inside the loop, and a lates_wqm, each with the offset that breaks the proof. The vertex stage and any DPP form other than the lowered quad reads.Tests
New
tests/startup_gfx2hlsl_dpp_quad_flow_check.py(registered inCMakeLists.txt, noted indocs/startup-runtime.md): controls for the accepted loop and the four refusal reasons, mutation controls for wrong-lane reads, and adrawmode with a CPU reference for a 16 x 16 readback. Onorigin/mainthe controls fail (LOOP translates, and the four refusal reasons are absent); with the change they pass.Verification
python3 -B tests/startup_gfx2hlsl_dpp_quad_flow_check.py: PASS (fails onorigin/main)python3 -B tests/startup_gfx2hlsl_dpp_quad_broadcast_check.py,..._dpp_quad_swap_check.py,..._dpp_pair_check.py: PASStests/startup_gfx2hlsl_*_check.pyrun with no arguments on this branch and onorigin/main: same result per script (export_null_drawandmul24_align_drawneed a compiler and renderer and exit 1 on both); the only new script isdpp_quad_flow_check.startup_gfx2hlsl_dpp_quad_flow,_warpand_hardware(the 16 x 16 draw against the CPU reference, with the wrong-lane control failing as required).Commands (run per preset
devandrelease):AI-assisted; commands listed were executed locally.