shader: cover four DPP lowering semantics that no draw observed #673

Merged
Leyukaka merged 2 commits from upstream-pr/679 into main 2026-11-23 01:20:14 +00:00
Leyukaka commented 2026-11-22 19:42:37 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-22T19:42:37Z.


Change

This closes four coverage gaps in the DPP lowering of tools/pixel_aot.py. Each was a one-line mutation that passed every WARP test on main. Only tests/pixel_aot_check.py and the DPP mutation list in docs/experiments.md change; the translator does not.

DPP_BODY gains four lines, folded into existing output channels, and dpp_reference is extended independently of the translator:

New line Mutation it covers
v_sub_f32_dpp v49, v20, v20 quad_perm:[1,2,3,2] (lane 3 reads lane 2) generic quad_perm lane 3 read from lane 0
v_max_f32_dpp v50, |v49|, v49 with v49 negative on some lanes abs dropped on v_max_f32_dpp
v_cvt_f32_f16_dpp v51, v29 of a negative half half sign bit cleared before widening
v_exp_f32_dpp v52, v30 of a fractional input exponent argument truncated

Four must-mismatch controls each change one new line (quad_perm:[1,2,3,0], max without abs, \|v29\|, v38 as the exp input) and must make the draw fail.

Verification

On de73617 (branch on 0a9cc04), Windows 11 build 26300.9974, MSVC 14.44.35207, Python 3.14, WARP:

ctest --preset dev --no-tests=error -j 4

All 297 tests pass.

Each mutation was applied to tools/pixel_aot.py one at a time, and all WARP tests were run. On main, all of them passed for each mutation. A control that replaced QuadReadAcrossX with QuadReadAcrossY was caught, so the run does detect a broken translator. On this branch, rebased on 0a9cc04, each of the four mutations fails pixel_aot_warp.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed. (Mutation list only; no capability changed.)
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6546873923 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/679). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-22T19:42:37Z. --- ## Change This closes four coverage gaps in the DPP lowering of `tools/pixel_aot.py`. Each was a one-line mutation that passed every WARP test on `main`. Only `tests/pixel_aot_check.py` and the DPP mutation list in `docs/experiments.md` change; the translator does not. `DPP_BODY` gains four lines, folded into existing output channels, and `dpp_reference` is extended independently of the translator: | New line | Mutation it covers | |---|---| | `v_sub_f32_dpp v49, v20, v20 quad_perm:[1,2,3,2]` (lane 3 reads lane 2) | generic `quad_perm` lane 3 read from lane 0 | | `v_max_f32_dpp v50, \|v49\|, v49` with `v49` negative on some lanes | `abs` dropped on `v_max_f32_dpp` | | `v_cvt_f32_f16_dpp v51, v29` of a negative half | half sign bit cleared before widening | | `v_exp_f32_dpp v52, v30` of a fractional input | exponent argument truncated | Four must-mismatch controls each change one new line (`quad_perm:[1,2,3,0]`, `max` without `abs`, `\|v29\|`, `v38` as the `exp` input) and must make the draw fail. ## Verification On `de73617` (branch on `0a9cc04`), Windows 11 build 26300.9974, MSVC 14.44.35207, Python 3.14, WARP: ```text ctest --preset dev --no-tests=error -j 4 ``` All 297 tests pass. Each mutation was applied to `tools/pixel_aot.py` one at a time, and all WARP tests were run. On `main`, all of them passed for each mutation. A control that replaced `QuadReadAcrossX` with `QuadReadAcrossY` was caught, so the run does detect a broken translator. On this branch, rebased on `0a9cc04`, each of the four mutations fails `pixel_aot_warp`. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. (Mutation list only; no capability changed.) - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted.
upstream-sync closed this pull request 2026-11-24 06:44:17 +00:00
Leyukaka commented 2026-11-24 06:48:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-22T21:04:55Z.


Thanks for the run on RDNA4.

You are right about two of the four lines: v_cvt_f32_f16_dpp v51, v29 and v_exp_f32_dpp v52, v30 read v29/v30, which are copies of s46/s47, so their quad_perm is not exercised. Those two lines only cover what their mutations change: the sign of a negative half (|v29|) and a fractional exp input (v38 = trunc(1.75)).

The quad_perm:[1,2,3,2] line reads v20, the lane index built from v8/v9, so it does depend on the lane: v49 is {1, 1, 1, -1} and v50 = max(|v49|, v49) is 1 in every lane. With lane 3 reading lane 0 (quad_perm:[1,2,3,0]), lane 3 gets 3 and the draw reports a mismatch.

A per-lane reference, and exp fed from a lane-dependent source, would be stronger. I can do that in a follow-up so this PR stays as reviewed.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7085770668 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/679#issuecomment-7085770668). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-22T21:04:55Z. --- Thanks for the run on RDNA4. You are right about two of the four lines: `v_cvt_f32_f16_dpp v51, v29` and `v_exp_f32_dpp v52, v30` read `v29`/`v30`, which are copies of `s46`/`s47`, so their `quad_perm` is not exercised. Those two lines only cover what their mutations change: the sign of a negative half (`|v29|`) and a fractional `exp` input (`v38` = `trunc(1.75)`). The `quad_perm:[1,2,3,2]` line reads `v20`, the lane index built from `v8`/`v9`, so it does depend on the lane: `v49` is `{1, 1, 1, -1}` and `v50 = max(|v49|, v49)` is 1 in every lane. With lane 3 reading lane 0 (`quad_perm:[1,2,3,0]`), lane 3 gets 3 and the draw reports a mismatch. A per-lane reference, and `exp` fed from a lane-dependent source, would be stronger. I can do that in a follow-up so this PR stays as reviewed. AI-assisted.
thepatrickworld commented 2026-11-24 06:48:46 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-22T20:52:57Z.


Verification: #679 shader: cover four DPP lowering semantics that no draw observed

Head de736171, merged with main. tests/pixel_aot_check.py (+19/−3) and docs/experiments.md
(+1/−1). No translator change: this is a coverage PR.

What it adds

Four DPP forms enter the dpp fixture, each with a mutation pair:

  • v_sub_f32_dpp followed by v_max_f32_dpp with |v49| on src0, over quad_perm:[1,2,3,2];
  • v_cvt_f32_f16_dpp on the same half without the abs modifier;
  • v_exp_f32_dpp fed a fractional input instead of an integer one;
  • a generic quad_perm where lane 3 reads lane 2.

The reference computes the quad term as max(abs(perm[lane] - lane), perm[lane] - lane) and asserts
a single distinct value across the four lanes. That is a neat way to say "this permutation must
yield 1 in every lane" without hardcoding it, and it fails loudly if the permutation changes.

Environment

Same machine as the other runs: Windows 11 25H2 build 26200.9711, MSVC 19.44.35230, DXC 1.9.2602.17,
RX 9070 XT (RDNA4), driver 32.0.32029.2010.

Commands and output

ctest --preset dev --no-tests=error -R "^pixel_aot_"
100% tests passed out of 22

Negative control: I replaced QuadReadAcrossX({bits}) with QuadReadAcrossY({bits}) in the DPP
swizzle helper and re-ran ^pixel_aot_hardware$:

0% tests passed, 1 tests failed out of 1

The new cases do catch a broken swizzle direction.

GitHub reports mergeable_state: unstable for this head, so CI is not green on its own.

The reserve

The four mutations added by the PR are reference mutations: they alter the expected shader and
require a mismatch, which proves the new draws discriminate against wrong values. They do not prove
that the four added forms are the ones the coverage dashboard counts as missing, and the docs change
from "six mutations" to "eleven" is not verified by anything executable.

v38 is defined, so the v_exp_f32_dpp mutation is sound: v_trunc_f32_dpp v38, v35 sits in
DPP_BODY before the insertion, giving trunc(1.75) = 1.0, and exp2(1) = 2 against
exp2(1.5) = 2.83 moves ch3 from 25 to 22.

The real gap is elsewhere: both new permuted instructions read uniform constants (s46, s47),
so any permutation returns the same answer and their quad_perm is decorative. Only the abs
modifier and the fractional input are actually exercised. The same limit runs through the whole
fixture: it writes a single expected value for all 4096 pixels
(struct.pack("<4f", *expected) * 64), so any quad-symmetric error is invisible.

What I would add

Make the permutation ride on a source that varies by lane, and make the reference per pixel.
v_mov_b32_dpp v53, v20 quad_perm:[1,2,3,2] expecting lane 1,2,3,2 is the only shape that tells a
correct permutation from an identity on a uniform source. At the minimum, run exp on v20 instead
of v30 and let ch3 depend on the lane.

What this does not prove

  • Cross-quad DPP, row_*/wave_* controls and partial masks stay untested, as the docs say.
  • Nothing about wave32 execution, which this card runs alongside wave64.

Merge note: this head, #683 and #687 branch from the same blob (11f47701) on the same file. Their hunks are disjoint (2400-2500 / 3600-3760 / 4543), so no conflict today, but each will need a rebase after the first one lands.

AI-assisted; runs executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7085617433 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/679#issuecomment-7085617433). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-22T20:52:57Z. --- **Verification: #679 `shader: cover four DPP lowering semantics that no draw observed`** Head `de736171`, merged with `main`. `tests/pixel_aot_check.py` (+19/−3) and `docs/experiments.md` (+1/−1). No translator change: this is a coverage PR. ### What it adds Four DPP forms enter the `dpp` fixture, each with a mutation pair: - `v_sub_f32_dpp` followed by `v_max_f32_dpp` with `|v49|` on src0, over `quad_perm:[1,2,3,2]`; - `v_cvt_f32_f16_dpp` on the same half without the `abs` modifier; - `v_exp_f32_dpp` fed a fractional input instead of an integer one; - a generic `quad_perm` where lane 3 reads lane 2. The reference computes the quad term as `max(abs(perm[lane] - lane), perm[lane] - lane)` and asserts a single distinct value across the four lanes. That is a neat way to say "this permutation must yield 1 in every lane" without hardcoding it, and it fails loudly if the permutation changes. ### Environment Same machine as the other runs: Windows 11 25H2 build 26200.9711, MSVC 19.44.35230, DXC 1.9.2602.17, RX 9070 XT (RDNA4), driver 32.0.32029.2010. ### Commands and output ``` ctest --preset dev --no-tests=error -R "^pixel_aot_" 100% tests passed out of 22 ``` Negative control: I replaced `QuadReadAcrossX({bits})` with `QuadReadAcrossY({bits})` in the DPP swizzle helper and re-ran `^pixel_aot_hardware$`: ``` 0% tests passed, 1 tests failed out of 1 ``` The new cases do catch a broken swizzle direction. GitHub reports `mergeable_state: unstable` for this head, so CI is not green on its own. ### The reserve The four mutations added by the PR are *reference* mutations: they alter the expected shader and require a mismatch, which proves the new draws discriminate against wrong values. They do not prove that the four added forms are the ones the coverage dashboard counts as missing, and the docs change from "six mutations" to "eleven" is not verified by anything executable. `v38` is defined, so the `v_exp_f32_dpp` mutation is sound: `v_trunc_f32_dpp v38, v35` sits in `DPP_BODY` before the insertion, giving `trunc(1.75) = 1.0`, and `exp2(1) = 2` against `exp2(1.5) = 2.83` moves `ch3` from 25 to 22. The real gap is elsewhere: **both new permuted instructions read uniform constants** (`s46`, `s47`), so any permutation returns the same answer and their `quad_perm` is decorative. Only the `abs` modifier and the fractional input are actually exercised. The same limit runs through the whole fixture: it writes a single expected value for all 4096 pixels (`struct.pack("<4f", *expected) * 64`), so any quad-symmetric error is invisible. ### What I would add Make the permutation ride on a source that varies by lane, and make the reference per pixel. `v_mov_b32_dpp v53, v20 quad_perm:[1,2,3,2]` expecting lane `1,2,3,2` is the only shape that tells a correct permutation from an identity on a uniform source. At the minimum, run `exp` on `v20` instead of `v30` and let `ch3` depend on the lane. ### What this does not prove - Cross-quad DPP, `row_*`/`wave_*` controls and partial masks stay untested, as the docs say. - Nothing about wave32 execution, which this card runs alongside wave64. Merge note: this head, #683 and #687 branch from the same blob (`11f47701`) on the same file. Their hunks are disjoint (2400-2500 / 3600-3760 / 4543), so no conflict today, but each will need a rebase after the first one lands. _AI-assisted; runs executed locally._
thepatrickworld commented 2026-11-24 06:48:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-22T22:03:27Z.


Agreed on all three points, and the follow-up is the right shape: a permutation riding on a lane-varying source, with a per-pixel reference.

Worth saying explicitly, because it outlives this PR: the single expected value for all 4096 pixels is the underlying weakness. It makes any quad-symmetric error invisible — a permutation that is wrong the same way in all four lanes still lands on the one expected value.

That is why your [1,2,3,2] row does catch a wrong permutation: it reads the lane id, so the four lanes disagree ({1, 1, 1, -1} before max(|v49|, v49)), and lane 3 alone breaks it. The two uniform-source rows have no such disagreement to expose.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7086517326 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/679#issuecomment-7086517326). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-22T22:03:27Z. --- Agreed on all three points, and the follow-up is the right shape: a permutation riding on a lane-varying source, with a per-pixel reference. Worth saying explicitly, because it outlives this PR: the single expected value for all 4096 pixels is the underlying weakness. It makes any quad-symmetric error invisible — a permutation that is wrong the same way in all four lanes still lands on the one expected value. That is why your `[1,2,3,2]` row does catch a wrong permutation: it reads the lane id, so the four lanes disagree (`{1, 1, 1, -1}` before `max(|v49|, v49)`), and lane 3 alone breaks it. The two uniform-source rows have no such disagreement to expose. _AI-assisted._
thepatrickworld commented 2026-11-24 06:49:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T13:52:23Z.


Merged commit 37ed46d on RDNA4 (native wave64), plus what the new quad_perm line can and cannot separate. Measurements only.

Environment

  • Windows 11 25H2, build 26200.9711
  • MSVC 19.44.35230 (toolset 14.44.35207), Windows SDK 10.0.26100.0, DXC 1.9.2602.17
  • AMD Radeon RX 9070 XT, vendor 1002, device 7550, driver 32.0.32029.2010, native wave width 64
  • debug_layer=unavailable (Tools.Graphics.DirectX is NotPresent here)

Commands

git checkout 37ed46d
cmake --preset dev
cmake --build --preset dev --parallel 12 --target offscreen_check
set XBOX2WINDOWS_ADAPTER=AMD Radeon RX 9070 XT
ctest --preset dev --no-tests=error -R "^pixel_aot_(hardware|warp)$" -V

Observed

1/2 Test #264: pixel_aot_hardware ...   Passed   13.79 sec
2/2 Test #297: pixel_aot_warp .......   Passed    7.65 sec
100% tests passed out of 2
Total Test time (real) =  21.46 sec

check_render calls check_dpp_draw unconditionally (tests/pixel_aot_check.py:7391), and that function raises when a mutation escapes (:4244). A green pixel_aot_hardware therefore means each of the eleven controls — including the four added here — produced a pixel_mismatch on RDNA4 silicon, not only under WARP. Expected words recomputed at 37ed46d: (9.25, 26.0, 9.75, 25.0) for set 0 and (6.75, 70.5, -7.75, 32.0) for set 1.

The generic quad_perm line separates less than its label suggests

dpp_reference computes max(abs(perm[lane] - lane), perm[lane] - lane) (:4189), which is identically abs(...): the max models nothing, and the |.| on v49 has already discarded the sign. Sweeping all 256 quad_perm tuples and keeping the ones whose channel-0 term is uniform leaves exactly four with the value this line expects:

(1,0,1,2)  (1,0,3,2)  (1,2,1,2)  (1,2,3,2)

(1,0,3,2) is QuadReadAcrossX. The new line cannot separate "lane 3 reads lane 2" from "every lane reads lane 1", and the control at :4232 fires because the mutated permutation changes the magnitude in lane 3, not because the direction is observed. The two swizzles on v51/v52 are inert for the same family of reasons: v29 and v30 are v_mov_b32_e32 copies of s46/s47, uniform across lanes.

So docs/experiments.md:2469 reads "lane 3 of a generic quad_perm" where what the fixture establishes is the magnitude in lane 3 under a uniform expectation. A permutation like (1,2,1,2), or the reversed direction (lane perm[l] receiving from lane l), stays invisible — and the whole fixture shares that limit, because the case writes one expected word for all 64 pixels (:4217).

None of this is a defect of the lowering; it is what a green run proves. The three other additions — abs on v_max_f32_dpp with a negative input, the half sign in v_cvt_f32_f16_dpp, the fractional input to v_exp_f32_dpp — close holes that mutation testing shows were real, and they hold on this adapter.

AI-assisted; runs executed locally. The permutation sweep and the audit were produced by a separate review pass and re-verified here against dpp_reference at 37ed46d.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7103152777 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/679#issuecomment-7103152777). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-23T13:52:23Z. --- **Merged commit `37ed46d` on RDNA4 (native wave64), plus what the new `quad_perm` line can and cannot separate.** Measurements only. ### Environment - Windows 11 25H2, build **26200.9711** - MSVC **19.44.35230** (toolset 14.44.35207), Windows SDK 10.0.26100.0, DXC **1.9.2602.17** - **AMD Radeon RX 9070 XT**, vendor 1002, device 7550, driver **32.0.32029.2010**, native wave width 64 - `debug_layer=unavailable` (`Tools.Graphics.DirectX` is `NotPresent` here) ### Commands ``` git checkout 37ed46d cmake --preset dev cmake --build --preset dev --parallel 12 --target offscreen_check set XBOX2WINDOWS_ADAPTER=AMD Radeon RX 9070 XT ctest --preset dev --no-tests=error -R "^pixel_aot_(hardware|warp)$" -V ``` ### Observed ``` 1/2 Test #264: pixel_aot_hardware ... Passed 13.79 sec 2/2 Test #297: pixel_aot_warp ....... Passed 7.65 sec 100% tests passed out of 2 Total Test time (real) = 21.46 sec ``` `check_render` calls `check_dpp_draw` unconditionally (`tests/pixel_aot_check.py:7391`), and that function raises when a mutation escapes (`:4244`). A green `pixel_aot_hardware` therefore means each of the eleven controls — including the four added here — produced a `pixel_mismatch` on RDNA4 silicon, not only under WARP. Expected words recomputed at `37ed46d`: `(9.25, 26.0, 9.75, 25.0)` for set 0 and `(6.75, 70.5, -7.75, 32.0)` for set 1. ### The generic `quad_perm` line separates less than its label suggests `dpp_reference` computes `max(abs(perm[lane] - lane), perm[lane] - lane)` (`:4189`), which is identically `abs(...)`: the `max` models nothing, and the `|.|` on `v49` has already discarded the sign. Sweeping all 256 `quad_perm` tuples and keeping the ones whose channel-0 term is uniform leaves exactly four with the value this line expects: ``` (1,0,1,2) (1,0,3,2) (1,2,1,2) (1,2,3,2) ``` `(1,0,3,2)` is `QuadReadAcrossX`. The new line cannot separate "lane 3 reads lane 2" from "every lane reads lane 1", and the control at `:4232` fires because the mutated permutation changes the magnitude in lane 3, not because the direction is observed. The two swizzles on `v51`/`v52` are inert for the same family of reasons: `v29` and `v30` are `v_mov_b32_e32` copies of `s46`/`s47`, uniform across lanes. So `docs/experiments.md:2469` reads "lane 3 of a generic `quad_perm`" where what the fixture establishes is the magnitude in lane 3 under a uniform expectation. A permutation like `(1,2,1,2)`, or the reversed direction (lane `perm[l]` receiving from lane `l`), stays invisible — and the whole fixture shares that limit, because the case writes one expected word for all 64 pixels (`:4217`). None of this is a defect of the lowering; it is what a green run proves. The three other additions — `abs` on `v_max_f32_dpp` with a negative input, the half sign in `v_cvt_f32_f16_dpp`, the fractional input to `v_exp_f32_dpp` — close holes that mutation testing shows were real, and they hold on this adapter. _AI-assisted; runs executed locally. The permutation sweep and the audit were produced by a separate review pass and re-verified here against `dpp_reference` at `37ed46d`._
Sign in to join this conversation.
No reviewers
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!673
No description provided.