shader: cover four DPP lowering semantics that no draw observed #673
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/679"
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?
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 onmain. Onlytests/pixel_aot_check.pyand the DPP mutation list indocs/experiments.mdchange; the translator does not.DPP_BODYgains four lines, folded into existing output channels, anddpp_referenceis extended independently of the translator:v_sub_f32_dpp v49, v20, v20 quad_perm:[1,2,3,2](lane 3 reads lane 2)quad_permlane 3 read from lane 0v_max_f32_dpp v50, |v49|, v49withv49negative on some lanesabsdropped onv_max_f32_dppv_cvt_f32_f16_dpp v51, v29of a negative halfv_exp_f32_dpp v52, v30of a fractional inputFour must-mismatch controls each change one new line (
quad_perm:[1,2,3,0],maxwithoutabs,\|v29\|,v38as theexpinput) and must make the draw fail.Verification
On
de73617(branch on0a9cc04), Windows 11 build 26300.9974, MSVC 14.44.35207, Python 3.14, WARP:All 297 tests pass.
Each mutation was applied to
tools/pixel_aot.pyone at a time, and all WARP tests were run. Onmain, all of them passed for each mutation. A control that replacedQuadReadAcrossXwithQuadReadAcrossYwas caught, so the run does detect a broken translator. On this branch, rebased on0a9cc04, each of the four mutations failspixel_aot_warp.Checklist
AI-assisted.
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, v29andv_exp_f32_dpp v52, v30readv29/v30, which are copies ofs46/s47, so theirquad_permis not exercised. Those two lines only cover what their mutations change: the sign of a negative half (|v29|) and a fractionalexpinput (v38=trunc(1.75)).The
quad_perm:[1,2,3,2]line readsv20, the lane index built fromv8/v9, so it does depend on the lane:v49is{1, 1, 1, -1}andv50 = 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
expfed from a lane-dependent source, would be stronger. I can do that in a follow-up so this PR stays as reviewed.AI-assisted.
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 observedHead
de736171, merged withmain.tests/pixel_aot_check.py(+19/−3) anddocs/experiments.md(+1/−1). No translator change: this is a coverage PR.
What it adds
Four DPP forms enter the
dppfixture, each with a mutation pair:v_sub_f32_dppfollowed byv_max_f32_dppwith|v49|on src0, overquad_perm:[1,2,3,2];v_cvt_f32_f16_dppon the same half without theabsmodifier;v_exp_f32_dppfed a fractional input instead of an integer one;quad_permwhere lane 3 reads lane 2.The reference computes the quad term as
max(abs(perm[lane] - lane), perm[lane] - lane)and assertsa 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
Negative control: I replaced
QuadReadAcrossX({bits})withQuadReadAcrossY({bits})in the DPPswizzle helper and re-ran
^pixel_aot_hardware$:The new cases do catch a broken swizzle direction.
GitHub reports
mergeable_state: unstablefor 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.
v38is defined, so thev_exp_f32_dppmutation is sound:v_trunc_f32_dpp v38, v35sits inDPP_BODYbefore the insertion, givingtrunc(1.75) = 1.0, andexp2(1) = 2againstexp2(1.5) = 2.83movesch3from 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_permis decorative. Only theabsmodifier 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 lane1,2,3,2is the only shape that tells acorrect permutation from an identity on a uniform source. At the minimum, run
exponv20insteadof
v30and letch3depend on the lane.What this does not prove
row_*/wave_*controls and partial masks stay untested, as the docs say.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.
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}beforemax(|v49|, v49)), and lane 3 alone breaks it. The two uniform-source rows have no such disagreement to expose.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T13:52:23Z.
Merged commit
37ed46don RDNA4 (native wave64), plus what the newquad_permline can and cannot separate. Measurements only.Environment
debug_layer=unavailable(Tools.Graphics.DirectXisNotPresenthere)Commands
Observed
check_rendercallscheck_dpp_drawunconditionally (tests/pixel_aot_check.py:7391), and that function raises when a mutation escapes (:4244). A greenpixel_aot_hardwaretherefore means each of the eleven controls — including the four added here — produced apixel_mismatchon RDNA4 silicon, not only under WARP. Expected words recomputed at37ed46d:(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_permline separates less than its label suggestsdpp_referencecomputesmax(abs(perm[lane] - lane), perm[lane] - lane)(:4189), which is identicallyabs(...): themaxmodels nothing, and the|.|onv49has already discarded the sign. Sweeping all 256quad_permtuples and keeping the ones whose channel-0 term is uniform leaves exactly four with the value this line expects:(1,0,3,2)isQuadReadAcrossX. The new line cannot separate "lane 3 reads lane 2" from "every lane reads lane 1", and the control at:4232fires because the mutated permutation changes the magnitude in lane 3, not because the direction is observed. The two swizzles onv51/v52are inert for the same family of reasons:v29andv30arev_mov_b32_e32copies ofs46/s47, uniform across lanes.So
docs/experiments.md:2469reads "lane 3 of a genericquad_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 (laneperm[l]receiving from lanel), 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 —
absonv_max_f32_dppwith a negative input, the half sign inv_cvt_f32_f16_dpp, the fractional input tov_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_referenceat37ed46d.