You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
shader: verify cross-quad WQM and EXECZ in a native pixel draw #2907
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.py with 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 run ctest --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.
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:
the case: two quads in one wave, where the filter leaves live lanes only in quad A; quad B's surviving pixels then export a value that depends on whether the wave took the EXECZ branch;
the fixture first records that the branch refuses this case today, then measures that the two quads share a desktop wave (a diagnostic draw reporting lane count and wave membership), with a CPU reference per measured wave, an all-empty wave and untouched sentinels;
the translator accepts only that bounded form, with the vote as WaveActiveAnyTrue of the surviving lanes. Cross-lane reads inside the region and an unproven helper or wave participation keep the current refusal;
negative control: a quad-local vote must change quad B's pixels.
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?
@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_execz changes 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 and s_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_wqm before 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_execz tests EXEC after s_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 plain WaveActiveAnyTrue over 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:
vote on the WQM-expanded mask, either with [WaveOpsIncludeHelperLanes] (SM 6.7, so a capability gate and a 77 below it) or with a per-quad QuadAny of 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_check on this branch currently crash on that adapter with 0xC0000005 (#2915), native_graphics_wqm_hardware included, so that has to be resolved first.
@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 with QuadReadAcrossX, QuadReadAcrossY and QuadReadAcrossDiagonal; quad operations read helper lanes, and they are available from SM 6.0. Then use WaveActiveAnyTrue of that quad-complete bit for the branch. No SM 6.7 [WaveOpsIncludeHelperLanes] gate is needed.
A correction to my comment above:s_wqm never 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.
a quad whose EXEC bits at the branch come only from lanes without a surviving pixel, where the plain survivor vote and the quad-complete vote must give different pixels;
your quad-local negative control;
the all-empty wave and the untouched sentinels.
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.
Thanks @MasterDomino, clear. Going ahead on cpp-migration with the quad-complete vote: the modelled EXEC predicate at the s_cbranch_execz, OR-ed across the quad with QuadReadAcrossX/Y/Diagonal, then WaveActiveAnyTrue of 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.
Opened #2946 on cpp-migration. The vote is the quad-complete EXEC bit (QuadReadAcrossX/Y/Diagonal) under WaveActiveAnyTrue, 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.
Closed by #2946 (@roansystemlabs), merged into cpp-migration as ea07313b: 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.
Activity
tedin7 commentedon Nov 26, 2026
Releasing this claim: we are focusing on #2908, so this one is open for anyone who wants it.
roansystemlabs commentedon Nov 26, 2026
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 commentedon Nov 26, 2026
@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 commentedon Nov 26, 2026
@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 shader: recognise whole wave32 reductions in gfx2hlsl pixel stages (Part of #2125) #2835 and startup: lower the first active lane of a pixel stage in gfx2hlsl (Refs #2618) #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 commentedon Nov 26, 2026
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 commentedon Nov 26, 2026
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.
shader: vote a quad-complete EXEC for WQM EXECZ branches in native pi…
MasterDomino commentedon Nov 26, 2026
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.