shader: lower plain e32 binary16 v_fmac_f16 and v_ldexp_f16 in pixel_aot #1120
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1127"
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 tedin7 on 2026-11-24T01:31:56Z.
Change
Lowers the plain e32 binary16
v_fmac_f16andv_ldexp_f16intools/pixel_aot.py(Refs #839, already claimed there). This is separate code from the 16-bit integer conversions in #1077 (now merged): it adds its own helper and its own branch, and does not touch those.v_fmac_f16: fusedS0 * S1 + D, rounded once to nearest even with the existingfma16_rne. The destination is the accumulator, so it must already hold a statically proven finite half. src1 must be a VGPR (e32).v_ldexp_f16:S0 * 2^S1withS1the signed low 16 bits of a VGPR (high half never read). The exponent must be statically known and within -64..64, so the binary32 product is exact andnarrow16rounds once.f16_pk_fmac_lane_result, newf16_ldexp_result), so overflow is refused and chains stay proven. Source proof, entry profile, result tag and readers are those of the binary16VOP2arithmetic.tools/scan_unsupported_shaders.py) counts the two e32 forms._e64, DPP, SDWA,clamp, omod and modifiers stay refused.docs/experiments.mdhas a new paragraph; the new draw has a CTest entry per adapter.AI-assisted: the code, tests and this description were written with an AI assistant and checked by running the commands below.
Verification
Host: Linux, LLVM 19 locally (CI uses LLVM 15), no DXC and no GPU, so the new draw was not run here.
python3 -B tests/pixel_aot_check.py: exit 0 (includes the newcheck_f16_fmac_ldexp_controls)../out/pe-env/bin/python -B tests/form_coverage_check.py:form coverage checks passed(newcheck_f16_fmac_ldexp_forms).python3 -B tests/rdna2_tools_check.py:OK (skipped=10)(scanner rows added totest_low16_binary16_e32_scanner_support).check_f16_fmac_ldexp_binary(llvm-mc-19 encodings, disassembly, e64 refusals) and the round trip of all 14 draw programs through llvm-mc and the disassembler were run with LLVM 19 and pass. The wholepixel_aot_check.py binarycommand stops earlier on an unrelated existing row (check_f16_cvt_int16_binary, a0xfff0literal that LLVM 19 prints differently from LLVM 15); CI runs it with LLVM 15.fma16_rne,widen16,narrow16and the scaling product agrees with the reference on 200000 random fused triples and on every finite half times 14 exponents, and on all 24 baked fused rows.Negative control (new test fails on
origin/main, passes with the change):origin/maintools/pixel_aot.py: every one of the 14 new fixtures is refused withUnsupported instruction 24: v_fmac_f16_e32 v24, v18, v28(and the ldexp equivalent).pixel_mismatchon its first detecting program): product rounded before the sum, accumulator ignored, multiplicand/accumulator swapped, a source read from bits 31:16 (fused and scaling), exponent negated, subnormal results flushed to signed zero. A Python pre-check in the same test requires each to change at least one expected word and leaves unrelated rows alone.Evidence and follow-up
VOP2Instructions.td(VOP_F16_F16_I16); not measured on the console. Not covered: NaN and infinity operands, runtime operands and exponents, exponents beyond 64 in magnitude, the destination's high half, the console denormal state._e64forms, DPP and SDWA spellings, and a runtime exponent with a range proof.draw-f16-fmac-ldexp, testspixel_aot_f16_fmac_ldexp_hardwareand_warp) needs a Windows adapter and DXC; please run it in CI or on a Windows host.python3 -B tests/pixel_aot_check.py draw-f16-fmac-ldexp <dxc> <offscreen_check> <adapter>.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T01:32:05Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
a02c48bℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-24T01:53:44Z.
Hardware side of the new entry: CI excludes
_hardware$(-E '_hardware$'inwindows.yml), so it is never exercised there. Heada02c48bbmerged ontoa7710b73→3df1ca6e, tree6b4de6ba, clean tree,devpreset, DXC1.9.2602.17, RX 9070 XT (vendor 1002, device 7550), driver32.0.32029.2010, Windows26200.9711,debug_layer=unavailable.pixel_aot_f16_fmac_ldexp_hardwarepassed in 5.81 s, three consecutive runs, with the neighbouring entries green in the same selection (pixel_aot_f16_arith_hardware10.82 s,pixel_aot_f16_round_hardware7.16 s) plus three_warpentries. The log carries the mutation sweep on the card —f16_fmac_ldexp mutation unfused: program ('fmac', 0) statuses ['mismatch']. That sweep callsrun_pixel_batch_statuses(renderer, ...)and raises when no mismatch appears, so the fmac unfused mutant is detected on the hardware renderer, not only on WARP.Limits: one GPU, one driver.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Toons29 on 2026-11-24T02:02:47Z.
Tested
a02c48bbon an AMD Radeon RX 9070 (RDNA 4,1002:7550), driver32.0.32029.2010, Windows 11 build 26300,devpreset, debug layer unavailable: passThe description asked for a Windows run of the draw, so here it is:
Both
pixel_aot_f16_fmac_ldexp_hardwareandpixel_aot_f16_fmac_ldexp_warp(in-box WARP10.0.26100.9818) pass, with no skips. On each adapter all seven mutations come back asmismatch:unfused,no_acc,role_swapandsrc_highon('fmac', 0), andexp_negatedandflush_outon('ldexp', 0), plussrc_highon('ldexp', 1). DXC is the Windows SDK copy,1.9.2602.17.Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-24T02:12:25Z.
Confirmed on the merge commit, since the run above was on a merge I built myself (tree
6b4de6ba) rather than on the tree that shipped:416084579160b96565ae95be1b55dcf0666584e3, treeb5a0f4f1c955375773dfb6b490a7bd8877c7acfc, clean tree. The same six entries pass, twice —pixel_aot_f16_fmac_ldexp_hardware5.57 s,pixel_aot_f16_arith_hardware9.99 s,pixel_aot_f16_round_hardware6.92 s and the three_warpones.AI-assisted.