shader: verify cross-quad WQM and EXECZ in a native pixel draw #2907
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#2907
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@R0Y00 on GitHub · 2026-11-26 18:46 UTC · original
Part of #870 and related to #2125. Target branch
cpp-migration.Claim. Open to a contributor with a GPU that can run the relevant wave operations. Comment here before starting. @roansystemlabs owns the related Python whole-wave reduction work in #2125. This issue covers a native C++ pixel draw with a WQM/EXECZ dependency and a fenced color comparison.
Deliverable. Extend the source-built pixel fixture in
tests/native_graphics_wqm_check.pywith one bounded cross-quad case. Arrange different mask states for two quads in the same guest wave, then check the EXECZ branch result, the output of surviving pixels and the untouched sentinel pixels after exact coverage is restored. Establish in the fixture that the participating quads share the expected wave topology and use a CPU mask and coverage reference.Negative control. Replace the cross-quad decision with a quad-local decision and require a pixel mismatch. Preserve the diagnostic for a continuation whose required helper lanes or wave participation cannot be proven.
Reproduction. Build with
cmake --build --preset dev --target compile_dxil offscreen_check. Extend and runctest --preset dev --no-tests=error -R '^native_graphics_wqm_hardware$' -V. Include the commit, Windows build, GPU, driver, wave width and debug-layer status. If the adapter lacks the required capability, record the skip separately and include a passing quad-local baseline on a supported adapter.Use only source-built shader containers and synthetic raster inputs.
@tedin7 on GitHub · 2026-11-26 19:09 UTC · original · edited 2026-11-26 19:15 UTC
Releasing this claim: we are focusing on #2908, so this one is open for anyone who wants it.
@roansystemlabs on GitHub · 2026-11-26 19:22 UTC · original
I'd like to take this, on an RTX 3070 (32-lane waves, debug layer on) plus WARP for the quad-local baseline. WARP runs one quad per wave, so the cross-quad case will skip there with 77.
Plan, on
cpp-migration:WaveActiveAnyTrueof the surviving lanes. Cross-lane reads inside the region and an unproven helper or wave participation keep the current refusal;One design question before I write the translator part: is a vote over the desktop wave acceptable here, under the same packing contract as #2835 and #2854 (a correct program cannot depend on which quads the console groups into one wave)? Or do you want the decision kept to cases where that contract isn't needed?
AI-assisted.
@MasterDomino on GitHub · 2026-11-26 21:21 UTC · original
@roansystemlabs, some input on the design question. The decision is @R0Y00's. This is only how the case lines up with what #2835 and #2854 already rely on.
1. The EXECZ vote fits the contract's reasoning, with one caveat about what it means for a program to depend on it.
s_cbranch_execzchanges no per-lane result. A skipped block run with EXEC = 0 writes no VGPR, LDS or export, because all of those are masked by EXEC. Only effects outside EXEC can differ: SALU/SGPR writes, scalar memory ands_sendmsg. So quad B's pixels can only depend on the outcome when the program carries quad A's coverage into quad B through such a scalar effect. That outcome depends on which quads share a console wave, which is exactly what #2835's contract says a correct program cannot rely on. Reading the vote over the desktop wave is therefore consistent with that contract. Your fixture builds that dependency on purpose, so its CPU reference has to come from the measured desktop wave membership, as you plan. It shows that the lowering votes over the desktop wave. It does not show console equivalence for that quad-B output, and the docs note should say so.2. The part #2835 and #2854 did not cover: helper lanes.
Both accepted the lowering only while EXEC was still the entry mask, with no
s_wqmbefore it. On the console the helper lanes were then out of EXEC, and on the desktop they are left out of wave operations, which #2835 measured. Your branch is under WQM, so that agreement no longer holds automatically. On the console,s_cbranch_execztests EXEC afters_wqm, so a quad whose surviving lanes are only helpers keeps the wave from skipping. By default, D3D wave intrinsics do not count helper lanes; Shader Model 6.7 adds the[WaveOpsIncludeHelperLanes]entry attribute to change that. A plainWaveActiveAnyTrueover the surviving lanes can therefore skip where the console would not. If the block has an effect outside EXEC, that difference is visible.Two ways to keep the vote over the same lane set the console tests:
[WaveOpsIncludeHelperLanes](SM 6.7, so a capability gate and a 77 below it) or with a per-quadQuadAnyof the live lanes, then the wave vote;Either way, a case in the fixture where the only lanes left in a quad are helpers would pin it. That case should differ between the plain vote and the WQM-mask vote.
3. Adapter note for your plan. WARP runs 4-lane waves, so the cross-quad case skips there, as you expect. @thepatrickworld measured 64-lane pixel waves on an RX 9070 XT on #2835. A wave64 adapter would give the topology check a second layout besides your RTX 3070's 32 lanes. I can run it on an RX 9070 XT once there is a branch. One caveat: native pixel draws through
offscreen_checkon this branch currently crash on that adapter with0xC0000005(#2915),native_graphics_wqm_hardwareincluded, so that has to be resolved first.AI-assisted.
@MasterDomino on GitHub · 2026-11-26 21:26 UTC · original
@roansystemlabs, following up on my comment above: this one is our call as maintainers, so here is the decision.
Yes, vote over the desktop wave, but over the lanes the console's EXEC holds at the branch, not only the surviving pixels.
The vote: take the translator's modelled EXEC predicate at the
s_cbranch_execz. OR it across the quad withQuadReadAcrossX,QuadReadAcrossYandQuadReadAcrossDiagonal; quad operations read helper lanes, and they are available from SM 6.0. Then useWaveActiveAnyTrueof that quad-complete bit for the branch. No SM 6.7[WaveOpsIncludeHelperLanes]gate is needed.A correction to my comment above:
s_wqmnever makes a zero mask non-zero. So when EXEC at the branch is just the WQM expansion of the surviving lanes, a plain vote over the survivors gives the same answer. The two differ only when EXEC holds bits in a quad that has no survivor, for example a WQM mask taken before the filter. The quad-complete vote is right in both cases, so use it and do not rely on which case a program happens to be.The contract: this rests on the same contract as #2835 and #2854: a correct program cannot depend on which quads share a console wave. The fixture's reference therefore has to use the measured desktop wave membership, as you planned. The note should state that it shows the vote over the desktop wave, not console equivalence for an output that depends on another quad.
Fixture cases, on top of your plan:
Keep refusing anything inside the region that reads other lanes, and anything where helper or wave participation cannot be proven, as you proposed.
Go ahead on
cpp-migration. I can run it on an RX 9070 XT, which has 64-lane pixel waves, once #2915 is out of the way.AI-assisted.
@roansystemlabs on GitHub · 2026-11-26 21:59 UTC · original
Thanks @MasterDomino, clear. Going ahead on
cpp-migrationwith the quad-complete vote: the modelled EXEC predicate at thes_cbranch_execz, OR-ed across the quad withQuadReadAcrossX/Y/Diagonal, thenWaveActiveAnyTrueof that bit. The fixture will add the case where a quad's EXEC bits come only from lanes without a surviving pixel (plain survivor vote and quad-complete vote must give different pixels), next to the quad-local negative control, the all-empty wave and the sentinels. Reads of other lanes inside the region and unproven helper or wave participation stay refused, and the docs note will say it shows the vote over the desktop wave, not console equivalence for a cross-quad output. I'll post the RTX 3070 + WARP results here; a wave64 run on your RX 9070 XT after #2915 would be very welcome.AI-assisted.
@roansystemlabs on GitHub · 2026-11-26 22:39 UTC · original
Opened #2946 on
cpp-migration. The vote is the quad-complete EXEC bit (QuadReadAcrossX/Y/Diagonal) underWaveActiveAnyTrue, as decided above. It is checked against the measured desktop quads on an RTX 3070 and WARP, with the helper-only, non-survivor, quad-local, empty-wave and sentinel cases. WARP runs one quad per wave, so it names the quad-local control as skipped and passes the rest. @MasterDomino, thanks for the RX 9070 XT offer; the branch is ready for it whenever #2915 allows.AI-assisted.
@MasterDomino on GitHub · 2026-11-26 22:54 UTC · original
Closed by #2946 (@roansystemlabs), merged into
cpp-migrationasea07313b: the quad-complete EXEC vote decided above.native_graphics_wqm_{hardware,warp,ir}pass on WARP (4 lanes), an RTX 3070 (32 lanes) and an RX 9070 XT (64 lanes, debug layer on, 0 errors). On the RX 9070 XT, dropping the diagonal quad read fails the hardware test. AI-assisted.