Repository navigation
gfx2hlsl: accept fi:1 on the pixel-stage DPP16 quad forms under the whole-quad proof - #2483
Conversation
…ole-quad proof The quad swap, quad broadcast and pair broadcast lowerings of tools/startup/gfx2hlsl.py refused every DPP16 word with FI set. FI (bit 18 of the DPP dword; LLVM AMDGPU `fi`, Mesa ACO `fetch_inactive`) only chooses what a disabled source lane returns: its register instead of the bound_ctrl result. All three lowerings are taken only in a straight-line pixel stage whose EXEC is the entry mask after `s_wqm exec, exec`, so every lane of the quad is active, no source lane is disabled, and FI decides nothing, as for bound_ctrl. dpp() now drops `fi:1` before dispatching; the translation is the one without it. Without the proof (no s_wqm, EXEC changed, branches, vertex stage) the forms stay refused, as do `fi:0` as a spelling, row and wave controls, mirrors, DPP8 and partial masks. Tests: the three DPP checks build the fixtures with FI set, compare the translated text with the plain fixture, and keep fi:1 refused without the proof. Without the dpp() line each of the three checks fails with `..._dpp with fi:1`. Refs R0Y00#2125, R0Y00#2023 (item H), R0Y00#1996 (item B). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…adcast The DPP source is SRC0 and v_subrev computes SRC1 - SRC0, so `v_subrev_f32_dpp vD, vS, vS quad_perm:[0,0,0,0]` is the lane's own word minus lane 0 (R0Y00#1996 item B). The broadcast check now asserts the two emitted lines; with the operands exchanged in the table it fails. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Three mutations, all caught by all three fixtures — and the acceptance is narrower than "fi:1 is allowed"Baseline on this branch: the three DPP fixtures pass (
The second and third rows are the ones worth having: a blanket What the change is actually conditioned on, measuredI probed the shapes around it rather than reading only the diff: So One wording nit, worth one lineThe Also: AI-assisted; the three mutations and the five probes were run locally on Windows 11 build 26300.9974. |
tedin7
left a comment
There was a problem hiding this comment.
Review of head b5198c6 (comment only, no merge or approval).
What I checked:
- Code:
Stage.dpp()intools/startup/gfx2hlsl.pynow dropsfi:1before it dispatches to the quad swap, quad broadcast and pair lowerings. Each of those three paths still requires a straight-line pixel stage, entry EXEC andwqm_exec, and each is refused otherwise. Sofi:1only changes an outcome in the case where no source lane is disabled. That is the same argument the code already makes forbound_ctrl. No new HLSL is emitted. - Other controls stay refused: row shifts, mirrors, DPP8, partial masks,
quad_permforms outside the tables. They still fall into the "dpp with " refusal. - Tests: the three DPP checks are extended with
fi:1fixtures that must translate to the same text as the plain fixture. They must also be refused withouts_wqm, after an EXEC change, with branches, and in a vertex stage. The three old "fi:1 is refused" controls were replaced, which matches the intended change. - Docs:
docs/experiments.mdand the code comments are updated to match. - Duplicates: I searched
DPP16 fi:1. Earlier DPP PRs (#2140, #2141, #1971) are merged and refusedfi, which this follows up on. #1884 is open but covers compute row_shr, a different slice. - Scope: five files, no .github, launcher or hook changes. The body does not claim to advance startup and says it unblocks one program of its sample, so no game result is needed or claimed.
Commands run locally (Linux, in a worktree of this head):
python3 -B tests/startup_gfx2hlsl_dpp_quad_swap_check.py-> exit 0python3 -B tests/startup_gfx2hlsl_dpp_quad_broadcast_check.py-> exit 0python3 -B tests/startup_gfx2hlsl_dpp_pair_check.py-> exit 0python3 -B tests/startup_translator_check.py-> exit 0python3 tests/docs_links_check.py-> ok (19 files, 466 links)python3 tests/bidi_controls_check.py-> okgit diff --check origin/main...HEAD-> clean- Mutation 1: replaced the
fi:1filter indpp()with a plain copy. All three DPP checks exit 1. - Mutation 2: disabled the
wqm_execrequirement in the swap path. The swap check exits 1, so the whole-quad control is real. - Both mutations restored with
git checkout -- ..
Windows and GPU:
- I ran no Windows or WARP run. The author's Windows 11 results are for Python only, and the body states the
binaryanddrawmodes were not run. Because the emitted HLSL is unchanged, I think that is reasonable, but it is the author's claim and I did not check it. - The PR's own CI run on this head shows the Linux Python checks, the fixture assembly job and the Windows build job all passing.
No blocking findings.
AI-assisted; commands listed were executed locally.
|
Win2025 WARP receipt for head 1fe1dd3 after updating with main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
AI-assisted; commands listed were executed locally. |
Main now carries R0Y00#2459, R0Y00#2461, R0Y00#2466, R0Y00#2483, R0Y00#2428 and others in their final form; the conflicts take main's versions. Kept from this branch: R0Y00#2460's generalized unjoined(), R0Y00#2432's scalar(mods), the s_setreg MODE check, the cube image kind, the v_cvt_f64_f32 inline check. Upstream chose R0Y00#2428 for v_{add,sub,subrev}_co_ci_u32, so the local co_ci handlers are renamed unbound_* and their two checks unregistered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #2125, #2023 (item H), #1996 (item B).
Change
The three pixel-stage DPP16 lowerings in
tools/startup/gfx2hlsl.py(quad swaps, quad broadcasts, pair broadcasts) refused every word with FI set.dpp()now dropsfi:1before it dispatches to them.fi, Mesa ACOfetch_inactive) only chooses what a disabled source lane returns: its register instead of thebound_ctrlresult.s_wqm exec, exec. Every lane of the quad is then active, so no source lane is disabled and FI decides nothing. This is the argument the code already uses forbound_ctrl.fi:1. No new HLSL is emitted.fi:1without the proof (nos_wqm, EXEC changed, a stage with branches, a vertex stage),fi:0as a spelling, row and wave controls, mirrors, DPP8, partial masks.docs/experiments.md: the two sentences that listedfiamong the refused forms are updated.Verification
Pure Python, Windows 11, Python 3.13:
Every other no-argument
tests/startup_gfx2hlsl_*_check.py(62 files in all),tests/docs_links_check.pyandtests/bidi_controls_check.pyexit 0.git diff --checkis clean.New checks:
or,mov,min) are rebuilt with FI set in each DPP dword. They must decode tofi:1, translate to exactly the text of the plain fixture, and be refused withouts_wqm exec, exec.fi:1line emits the same lines as the line without it, and is refused without the whole-quad proof, after an EXEC change, with branches and in a vertex stage.v_subrev_f32_dpp vD, vS, vS quad_perm:[0,0,0,0]emits the lane's own word minus quad lane 0 (the DPP source is SRC0 andv_subrevis SRC1 - SRC0). With the two operands exchanged in the operation table the check fails.fi:1is refused. They are replaced by "refused without the proof"; this is the intended behaviour change.dpp()line removed, each of the three checks fails (..._dpp with fi:1).Not run: the
binary(LLVM 15) anddraw(DXC, WARP or hardware) modes of the three checks. The emitted HLSL is unchanged, so the existing draws cover the pixels; no GPU result is claimed for this change.What this does not unblock
Aggregate counts from a private set of 153 pixel programs (decode only; no shader bytes can be shared). One of the 153 translates with this change. In the other 152 the DPP words sit in programs with branches, usually after EXEC writes, where the whole-quad proof does not hold:
Rows overlap: a program can contain several forms.
v_min_u32/v_max_u32/v_or_b32withquad_perm:[1,0,3,2],[2,3,0,1],row_half_mirror,row_mirror, thenv_permlanex16_b32andv_readlane_b32 ..., 31s_or_saveexec_b32 ..., -1with an identity fill (#2125 item D), not a per-quad onev_subrev_f32 vD, vS, vSwith[0,0,0,0](64 programs),[0,0,2,2](35),[0,1,0,1](19), followed by a broadcastv_mov_b32/v_mul_f32/v_add_f32QuadReadLaneAtpath is exact for them in straight-line codev_add_f32/v_mov_b32/v_add_nc_u32with the three swapsv_cndmask_b32with a quad broadcastv_cmpx_gt_f32DPP<unsupported DPP16>for VOPC DPPA quad read in a program with branches needs a proof that all four lanes reach the instruction together, and an emission that keeps them in step; neither exists in the per-lane
pcloop. That is the follow-up, not part of this change.AI-assisted (Claude Code); the commands listed were executed locally.
🤖 Generated with Claude Code