shader: lower quad-local DPP16 and DPP8 binary16 arithmetic and rounding in pixel_aot #1964
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1971"
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 KomaGuy on 2026-11-24T22:20:57Z.
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.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T22:39:00Z.
Review: COMMENTED
Review of head
d8b51b5fc9. Not mergeable yet.P2 (blocking): the new
pixel_aot_dpp_f16test fails on Win2025, warp and hardware.In
check_dpp_f16_draw(tests/pixel_aot_check.py, around line 9841), one of thearith_round_mutationscases is expected to reportmismatchbut reportspass. 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 174pixel_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: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.git checkout -- ..No approval and no merge. Please fix the unkilled mutation and push a new head.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T23:09:56Z.
Review: COMMENTED
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 andnarrow16helpers. 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.HALF_RTZis refused, and denorm "preserve" is required.("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.
Imported from R0Y00/Xbox2Windows. Originally posted by KomaGuy on 2026-11-24T23:05:40Z.
Thanks for catching this on Win2025!
Found the unkilled mutation: in
arith_dpp8, mutatingv_add_f16_dpp v24, v20, v21tov_sub_f16_dpp v24, v20, v21operated on(-0.0, -0.0)wheresrc0came throughQuadReadLaneAt(non-constant) andsrc1folded to constant-0.0f, so DXC simplifiedfsub %x, -0.0to%xand returned0x8000just like the original. Every other mutation inarith_round_mutationschanges the numerical value by at least1.0.Pushed
f1ade5b3which:arith_dpp8mutation with numerically distinct mutations (v24src1v21 -> v22giving-0.0 -> +1.0,v25sub -> addgiving-1.5 -> +3.5, plusmul -> addonv27for botharith_dpp16andarith_dpp8), so every mutation inDPP_F16_ARITH_ROUND_MUTATIONSchanges an exported channel by at least1.0.(name, old, new)in the assertion message if any mutation escapes, matchingcheck_f16_arith_draw.Verified locally on Linux (
pixel_aot_check.py,docs_links_check.py,bidi_controls_check.py,git diff --check, and a Python check confirming every listed mutation changes an exported channel by|delta| >= 1.0). Ready for another Win2025 check.