gfx2hlsl: accept fi:1 on the pixel-stage DPP16 quad forms under the whole-quad proof #2475
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2483"
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 NiiRoZz on 2026-11-25T18:05:21Z.
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
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T18:41:30Z.
Review: COMMENTED
Review of head
b5198c61a5(comment only, no merge or approval).What I checked:
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.quad_permforms outside the tables. They still fall into the "dpp with " refusal.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/experiments.mdand the code comments are updated to match.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.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-> cleanfi:1filter indpp()with a plain copy. All three DPP checks exit 1.wqm_execrequirement in the swap path. The swap check exits 1, so the whole-quad control is real.git checkout -- ..Windows and GPU:
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.No blocking findings.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T18:12:22Z.
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 (
dpp_pairPASS,dpp_quad_broadcast… ,dpp_quad_swapPASS), and the wholestartup_gfx2hlsl_*family is green.fi:1dropmods = [m for m in mods if m != 'fi:1']→mods = list(mods)(keep it, so it refuses)m.startswith('fi'))fi:0instead offi:1The second and third rows are the ones worth having: a blanket
fi*filter and an off-by-one on the literal both look like the same line, and all three fixtures separate them.What the change is actually conditioned on, measured
I probed the shapes around it rather than reading only the diff:
So
fi:1is accepted only where the quad-active proof already holds and no other modifier rides along —fi:0, abank_mask, or a vertex stage each still refuse, with the reason naming the offending token rather thanfi:1. That is the right shape for "this bit decides nothing here": the acceptance is licensed by an existing proof, not by relaxing the modifier check.One wording nit, worth one line
The
fi:1comment says it "only decides what a disabled source lane returns", which is the reason it can be dropped. What is not written is why dropping it is safer than modelling it: afi:1that reached a lowering without the active-quad proof would be a wrong result, not a refusal. The code does handle that (the proof gate is upstream), but a reader tracingmodswill not see the connection from this comment alone; naming the gate (dpp()reaches here only with the whole-quad proof) would close it.Also:
docs/experiments.mdnow says "fi:1 without that proof … stay refused", which is accurate and matches the probe above — worth keeping in sync if the gate moves.AI-assisted; the three mutations and the five probes were run locally on Windows 11 build 26300.9974.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T19:02:28Z.
Win2025 WARP receipt for head
1fe1dd34after updating with main.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
1fe1dd341df0787a2a3b87fa3fd9a59fee40f6ae:--preset dev):cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim -- -j 2):4.33s(configure4.35s)/O2(--preset release):cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim -- -j 2):5.70s(configure5.59s)tests/mesh_heap_sampler_check.pyok (1.0s),tests/startup_buffer_address_check.pyok (0.6s),tests/startup_compute_request_offline_check.pyok (0.9s),tests/startup_compute_translate_check.pyok (0.5s),tests/startup_flat_param_check.pyok (0.2s),tests/startup_gfx2hlsl_add_sub_co_check.pyok (0.2s),tests/startup_gfx2hlsl_add_sub_co_ci_check.pyok (0.3s),tests/startup_gfx2hlsl_bit_alu_check.pyok (1.1s),tests/startup_gfx2hlsl_capture_check.pyok (1.3s),tests/startup_gfx2hlsl_cmp16_check.pyok (0.3s),tests/startup_gfx2hlsl_compare_dst_check.pyok (0.1s),tests/startup_gfx2hlsl_compute_check.pyok (0.6s),tests/startup_gfx2hlsl_cselect_mask_check.pyok (0.2s),tests/startup_gfx2hlsl_cvt_alu_check.pyok (0.2s),tests/startup_gfx2hlsl_f32_lg_check.pyok (2.3s),tests/startup_gfx2hlsl_f32_nan_check.pyok (7.5s),tests/startup_gfx2hlsl_getpc_refusal_check.pyok (0.2s),tests/startup_gfx2hlsl_handler_arity_check.pyok (0.3s),tests/startup_gfx2hlsl_image_arity_check.pyok (0.4s),tests/startup_gfx2hlsl_image_get_lod_check.pyok (0.3s),tests/startup_gfx2hlsl_int_med3_check.pyok (0.4s),tests/startup_gfx2hlsl_join_symbols_check.pyok (0.6s),tests/startup_gfx2hlsl_loop_constants_check.pyok (0.6s),tests/startup_gfx2hlsl_mask_overwrite_check.pyok (0.5s),tests/startup_gfx2hlsl_operand_count_check.pyok (0.8s),tests/startup_gfx2hlsl_readfirstlane_recompute_check.pyok (0.3s),tests/startup_gfx2hlsl_readfirstlane_uniform_check.pyok (0.3s),tests/startup_gfx2hlsl_refusals_check.pyok (1.2s),tests/startup_gfx2hlsl_root_check.pyok (1.9s),tests/startup_gfx2hlsl_saveexec_same_reg_check.pyok (0.3s),tests/startup_gfx2hlsl_scalar_arity_check.pyok (0.3s),tests/startup_gfx2hlsl_scalar_brev_fold_check.pyok (0.2s),tests/startup_gfx2hlsl_scalar_m0_check.pyok (0.2s),tests/startup_gfx2hlsl_sdwa_cvt_check.pyok (0.5s),tests/startup_gfx2hlsl_sgpr_spill_check.pyok (0.1s),tests/startup_gfx2hlsl_shift64_check.pyok (0.2s),tests/startup_gfx2hlsl_smem_offset_check.pyok (0.1s),tests/startup_gfx2hlsl_sop2_complement_check.pyok (6.9s),tests/startup_gfx2hlsl_sopk_accum_check.pyok (1.1s),tests/startup_gfx2hlsl_sopk_signext_check.pyok (0.2s),tests/startup_gfx2hlsl_swap_check.pyok (0.8s),tests/startup_gfx2hlsl_vopc_sdwa_check.pyok (8.0s),tests/startup_gfx2hlsl_waitcnt_depctr_check.pyok (0.1s),tests/startup_gfx2hlsl_watch_check.pyok (2.9s),tests/startup_image_2d_array_check.pyok (0.3s),tests/startup_image_3d_check.pyok (0.2s),tests/startup_image_gather_lz_check.pyok (1.1s),tests/startup_image_load_d16_check.pyok (2.3s),tests/startup_image_sample_a16_check.pyok (0.5s),tests/startup_image_sample_b_check.pyok (0.3s),tests/startup_image_sample_c_check.pyok (0.4s),tests/startup_image_sample_l_check.pyok (0.4s),tests/startup_image_sample_lod_check.pyok (1.3s),tests/startup_inline_sampler_check.pyok (0.3s),tests/startup_run_ps1_check.pyok (16.0s),tests/startup_run_sh_check.pyFAIL (0.1s),tests/startup_sampler_heap_check.pyok (0.1s),tests/startup_smem_address_check.pyok (0.1s),tests/startup_stream_fetch_check.pyok (0.3s),tests/startup_stream_interface_check.pyok (0.3s),tests/startup_translator_check.pyok (0.6s)sccache: 0/100 hits; wall103.3sAI-assisted; commands listed were executed locally.