shader: verify cross-quad WQM and EXECZ in a native pixel draw #2907

Closed
opened 2026-11-26 18:46:45 +00:00 by R0Y00 · 7 comments
R0Y00 commented 2026-11-26 18:46:45 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T18:46:45Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6633121601 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2907). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-26T18:46:45Z. --- 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.
tedin7 commented 2026-11-26 19:09:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T19:09:59Z.


Releasing this claim: we are focusing on #2908, so this one is open for anyone who wants it.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7201265523 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2907#issuecomment-7201265523). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T19:09:59Z. --- Releasing this claim: we are focusing on #2908, so this one is open for anyone who wants it.
roansystemlabs commented 2026-11-26 19:22:35 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-26T19:22:35Z.


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?

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7201515551 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2907#issuecomment-7201515551). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-26T19:22:35Z. --- 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? AI-assisted.
MasterDomino commented 2026-11-26 21:21:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-26T21:21:23Z.


@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;
  • or accept only the case where the region's EXEC is provably the pre-WQM live mask (the #2835 and #2854 condition), and keep refusing it under WQM.

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.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7203645644 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2907#issuecomment-7203645644). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-26T21:21:23Z. --- @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; - or accept only the case where the region's EXEC is provably the pre-WQM live mask (the #2835 and #2854 condition), and keep refusing it under WQM. 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. AI-assisted.
MasterDomino commented 2026-11-26 21:26:06 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-26T21:26:06Z.


@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.

  • 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:

    • 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.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7203723133 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2907#issuecomment-7203723133). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-26T21:26:06Z. --- @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. - **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:** - 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. AI-assisted.
roansystemlabs commented 2026-11-26 21:59:03 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-26T21:59:03Z.


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.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7204245957 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2907#issuecomment-7204245957). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-26T21:59:03Z. --- 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. AI-assisted.
roansystemlabs commented 2026-11-26 22:39:39 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-26T22:39:39Z.


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.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7204874809 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2907#issuecomment-7204874809). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-26T22:39:39Z. --- 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. AI-assisted.
MasterDomino commented 2026-11-26 22:54:10 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-26T22:54:10Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7205083124 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2907#issuecomment-7205083124). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-26T22:54:10Z. --- 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.
Sign in to join this conversation.
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#2907
No description provided.