Repository navigation
shader: lower quad-local DPP16 and DPP8 binary16 arithmetic and rounding in pixel_aot - #1971
Conversation
…ing in pixel_aot Lower the quad-local DPP16 and DPP8 spellings of the eight already-contracted binary16 arithmetic and rounding opcodes (16 forms total across gfx1013 and rdna2): - VOP2_F16: v_add_f16_dpp, v_sub_f16_dpp, v_subrev_f16_dpp, v_mul_f16_dpp - VOP1_F16_ROUND: v_floor_f16_dpp, v_ceil_f16_dpp, v_trunc_f16_dpp, v_rndne_f16_dpp Add half16_dpp_source() enforcing the same low-16-only and static finite-proof contract (R0Y00#839) as plain e32/e64: VGPR sources must carry a statically proven finite low half (known_ssa_bits or known_half), src0 is quad-swizzled via emit_quad_swizzle_u32 while src1 stays on the current lane, DPP16 allows bit-15 abs/neg modifiers on either source (refused on DPP8), overflowing results are refused via f16_vop2_result, and destinations are tagged ("half16", alu) with proven low-16 bits for chaining. Explicit half_denorm="preserve" and HW_REG_MODE RNE remain required. Extend pixel_aot_dpp_f16_{warp,hardware} with four 4-channel programs (arith_dpp16, arith_dpp8, round_dpp16, round_dpp8) verified in both default and -denorm ftz modes plus op/modifier mutations, add all four to check_binary, update check_dpp_f16_contract_controls and docs/experiments.md, and add check_dpp_f16_arith_round_forms in tests/form_coverage_check.py.
tedin7
left a comment
There was a problem hiding this comment.
Review of head d8b51b5. Not mergeable yet.
P2 (blocking): the new pixel_aot_dpp_f16 test fails on Win2025, warp and hardware.
In check_dpp_f16_draw (tests/pixel_aot_check.py, around line 9841), one of the arith_round_mutations cases is expected to report mismatch but reports pass. The mutated shader gives the same readback as the original, so that mutation is not killed. Either the mutation does not change the result for the chosen constants or lane layout, or the expected words do not separate it. Please pick inputs that make each listed mutation visible, or drop the ones that cannot be seen.
Failing tests on Win2025 (Debug, ctest --preset dev -R ^pixel_aot): pixel_aot_dpp_f16_warp, pixel_aot_dpp_f16_hardware. The other 174 pixel_aot_* tests passed.
pixel_aot_attribute_sampled_{warp,hardware} also failed (whole_quad: unexpected result). That test is not touched by this PR, so I treat it as unrelated to this head.
Read the diff (tools/pixel_aot.py, tests, docs). The lowering looks consistent with the stated contract:
- src0 is quad-swizzled and src1 stays on the current lane.
- Modifiers are refused on DPP8.
- Overflow, non-finite and unproven operands are refused.
- Both branches require
half_denorm="preserve".
No P1 found in the lowering. Clean-room: no concerns in the changed files.
Commands run locally, with results:
git merge-tree --write-tree --name-only origin/main HEAD: clean, no conflicts.gh pr checks 1971: Linux Python checks pass, Windows build pass,/O2build skipped, gfx1013 fixtures pending.python3 tests/docs_links_check.py: PASS (386 links).python3 tests/bidi_controls_check.py: PASS.git diff --check origin/main...HEAD: PASS.python3 tests/form_coverage_check.py: could not run locally (iced_x86missing on this host). CI Linux job passes, so this is not counted against the PR.python3 tests/pixel_aot_check.pyon Linux: exits 0 but runs no draws. Source mutations are only checked on Win2025.x2w_pipe.py win2025 1971 --scope direct --regex '^pixel_aot'(Debug): FAIL as above. The default full-scope run could not start (PowerShell command too long), so I used the focused regex. Release/O2was not run, because Debug already fails.- Local source mutations (drop a src1 line; swizzle src1): no draw runs on Linux, so they were not killed locally. I did not use them as evidence. Reverted with
git checkout -- ..
No approval and no merge. Please fix the unkilled mutation and push a new head.
AI-assisted; commands listed were executed locally.
|
Thanks for catching this on Win2025! Found the unkilled mutation: in Pushed
Verified locally on Linux ( |
tedin7
left a comment
There was a problem hiding this comment.
Review of head f1ade5b348550f71ed7dba292ff6f1ea9384fbdc.
Scope: tools/pixel_aot.py, tests/pixel_aot_check.py, tests/form_coverage_check.py, docs/experiments.md. No CMake change. Lowering reuses the existing finite-proof, quad-swizzle and narrow16 helpers. Clean-room: no external code, no new tables.
Findings: P1 = 0, P2 = 0.
Semantics checked:
src0is quad-swizzled andsrc1stays on the current lane.abs/negare refused on DPP8.- Non-finite and overflowing results are refused.
- Operands without a finite proof are refused.
HALF_RTZis refused, and denorm "preserve" is required.- The destination is tagged
("half16", alu)with its proven bits.
Commands executed locally:
git merge-tree --write-tree --name-only origin/main HEAD: clean, no conflicts.python3 tests/pixel_aot_check.py: PASS.python3 tests/docs_links_check.py: PASS (386 links).python3 tests/bidi_controls_check.py: PASS.git diff --check origin/main...HEAD: clean.python3 tests/form_coverage_check.py: not runnable locally (iced_x86missing). The Linux CI job passed it.python3 x2w_pipe.py win2025 1971 --regex '^pixel_aot_dpp_f16_warp$' --py-checks tests/pixel_aot_check.py: Debug--preset dev1/1 passed; Release/O2--preset release1/1 passed; Windowspixel_aot_check.pyok.
Mutations (each reverted with git checkout -- .):
VOP2_F16["subrev"]changed to{0} - {1}:pixel_aot_check.pyfails (f16_arith_controls_no_ref). Killed.VOP1_F16_ROUND["ceil"]changed tofloor({0}): fails (check_f16_round_controls). Killed.
AI-assisted; commands listed were executed locally.
Summary
Follow-up to #1941 lowering the quad-local
DPP16andDPP8forms of the 8 binary16 arithmetic and rounding opcodes already contracted under #839 (+16 forms ongfx1013andrdna2):v_add_f16_dpp,v_sub_f16_dpp,v_subrev_f16_dpp,v_mul_f16_dpp(DPP16+DPP8)v_floor_f16_dpp,v_ceil_f16_dpp,v_trunc_f16_dpp,v_rndne_f16_dpp(DPP16+DPP8)Implementation Details
half16_dpp_source()intools/pixel_aot.py: enforces the shared low-16-only and static finite-proof contract (known_ssa_bitsorknown_half, rejecting unproven runtime sources and non-finite halves), with bit-15abs/negmodifiers allowed onDPP16and refused onDPP8.src0is quad-swizzled viaemit_quad_swizzle_u32whilesrc1stays on the current lane; overflowing VOP2 results are refused viaf16_vop2_result; destinations are tagged("half16", alu)with proven low-16 bits recorded inknown_halffor chaining.half_denorm="preserve"at shader entry andHW_REG_MODERNE rounding remain enforced;WORD_1/whole-word reads,DPP8source modifiers,bound_ctrl/fi, partial masks, cross-quaddpp8, and unlowered binary16 DPP neighbours (v_min/max_f16_dpp,v_fract_f16_dpp,v_fmac/ldexp_f16_dpp, transcendentals) stay refused.pixel_aot_dpp_f16_{warp,hardware}with four 4-channel programs (arith_dpp16,arith_dpp8,round_dpp16,round_dpp8) testing noisy upper-16 halves, destination sentinels, subnormals (in both default mode and-denorm ftz),-0.0, ties-to-even,half16chaining, and 12 op/modifier mutations; added all 4 tocheck_binary, addedcheck_dpp_f16_arith_round_forms()intests/form_coverage_check.py, and updateddocs/experiments.md.Verification
python3 -B tests/pixel_aot_check.py— passedpython3 -B tests/rdna2_tools_check.py— 152 tests OKform_coverage_check:check_f16_arith_forms,check_f16_round_forms,check_dpp_f16_arith_round_forms,check_shader_records— all passed (+16 forms ongfx1013andrdna2)f16_vop2_result/f16_round_resultllvm-mc-19 -triple=amdgcn--amdpal -mcpu=gfx1013and verified round-trip translation through bothdisasm_rdna2andlibLLVM-19.sodocs_links_check.py,bidi_controls_check.py,git diff --check— passedpixel_aot_dpp_f16_warp) and LLVM 15 fixture assembly are pending CI.