shader: lower v_fma_f64 #3667
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3667
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3665"
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?
@lambirou on GitHub · 2026-11-30 22:20 UTC · original
lambirou:shader/f64-fma→main· +2084 −6 · 7 files · 4 commits · merged 2026-12-01 12:34 UTCProblem
v_fma_f64(VOP3 0x14c on gfx1013/gfx1030) is stillunobservedin the pixel AOT coverage: no fixture draws it and the translator refuses it. No open PR covers this form.Change
Lowers the unmodified VOP3
v_fma_f64on the raw low/high words, without an HLSL binary64 type. It reuses ther64a_*helpers from #3652:r64a_mul32builds the exact 53x53-bit product, the addend is aligned in a 256-bit window anchored 128 bits below the product LSB, the exact sum or difference is formed with the 128-bit integer primitives, andr64a_roundrounds once to nearest even.r64a_roundgains atailargument that is nonzero only when a fractional part falls below the window; the existingv_add_f64andv_mul_f64calls pass 0 and their behavior is unchanged (their CTest passes below).Handled: signed zeros, subnormal inputs and results under the preserve profile, exact cancellation, significand carry, overflow to signed infinity, infinities, and NaN quieting with the first NaN in src0/src1/src2 order.
0*infand opposing infinities give0x7ff8000000000000.Refused: source modifiers, clamp/omod/op_sel, DPP/SDWA, literals and inline constants, malformed or misaligned pairs, untracked pairs, an SGPR pair read before its load, a sample in flight on the destination, a non-entry mask, and a partly overlapping source/destination. An identical source/destination pair is accepted after the source words are captured, including the third source.
Coverage is pinned to exactly
v_fma_f64; no other f64 form (div, rcp, rsq, sqrt, trig, min/max/ldexp, frexp, conversions, DS) is touched.Tests
python -B tests/pixel_aot_check.py-- pass. The newcheck_f64_fma_controlscovers the lowering structure, the pair rules, all refusals, and reference pins.python -B tests/form_coverage_check.py-- pass (check_f64_fma_forms: the record is exactly{("VOP3","v_fma_f64")}).python -B tests/rdna2_tools_check.py-- pass, 164 tests, 19 skips (unchanged capability skips).python -B tests/docs_links_check.py-- pass.cmake --preset devandcmake --build --preset dev --target offscreen_check-- pass.ctest --preset dev --no-tests=error -R '^pixel_aot_f64_(arith|fma)_' -V-- 4/4 pass:pixel_aot_f64_arith_hardwareandpixel_aot_f64_arith_warp: the #3652 forms still pass after ther64a_roundsignature change.pixel_aot_f64_fma_hardware(AMD Radeon RX 9060 XT, driver 32.0.32029.2010, Windows 11 build 26300.10075, debug layer unavailable) andpixel_aot_f64_fma_warp(Microsoft Basic Render Driver, driver 10.0.26100.10068): all 31 rows match and all six mutants reportpixel_mismatch; no skips.The draw (
draw-f64-fma) builds the shader, exports both result words throughR32G32B32A32_UINT, and compares them with the exact rationala*b + cconverted once throughstruct.pack('<d'). Rows cover signed zeros, subnormals, cancellation, fused-vs-unfused discriminants, ties, carry, overflow, infinities, and NaNs. Mutations: product rounded before the add, truncated final rounding, ignored sign, unbiased exponent, lost carry, non-quiet NaN.Coverage delta
Expected +1 gfx1013 and +1 gfx1030 (one VOP3 form); the
FORM_COVERAGE_RECORDcontains exactlyv_fma_f64.Limits
This shows the translated shader computes the stated operation on desktop adapters. It does not establish the console's NaN payload selection, subnormal behavior, or rounding behavior for binary64, which remain unmeasured.
Stack
Stacked on #3645 (
9601449e) and #3652 (98f1bee0), both merged withorigin/mainata3bfd019. This branch isade732fd.AI-assisted: the implementation, tests, and PR text were prepared with an AI coding agent.
CI: run 46526099845 is green (gfx1013 assembly, Linux Python checks, and Windows build/test;
/O2and the coverage chart are skipped on pull requests).Merge with origin/main (2026-12-01)
Merged
origin/mainata3bfd019into this branch; head isade732fd. The shared CMake, docs and test files keep both the #3609/#3623 additions and the PR additions. Local post-merge:pixel_aot_check.py,form_coverage_check.pyandrdna2_tools_check.pypass (165 tests, 19 skips); CTestpixel_aot_f64_arith_warp,pixel_aot_f64_round_warp,pixel_aot_f64_minmax_ldexp_warpandpixel_aot_f64_fma_warppass (4/4). The FMA WARP draw takes about 98 s, so its timeout is 240 s.@lukaslw-lab on GitHub · 2026-12-01 02:44 UTC · original · approved these changes
Reviewed
ade732fdby reading the diff; not built or run. Stacked on #3645 and #3652, so I read this PR's own change against #3652's head98f1bee0.Verdict: approve.
r64a_fmaforms the exact product plus addend and rounds once. Add and multiply are unchanged (they passtail = 0). No MUST, no SHOULD. Merge after #3652.r64a_round's newtail(tools/pixel_aot.py:1394,:1423) only becomes sticky when the guard bit is set insideexact. That is right forr64a_fma, whose window always holds 128 significant bits. A future caller passing a 53-bitexactwithtail != 0would truncate a fraction ≥ ½. Worth a comment.:1508): the first NaN in src0/src1/src2 order wins. inf·0 and inf − inf give the canonical NaN. A zero product returns c exactly, or the IEEE signed zero when c is zero too. A zero c reusesr64a_mul, which keeps the product's sign on underflow.128 + distance.Tests: the
draw-f64-fmarows compare against the exact rationala·b + cand the six mutations show the rows can fail. CI ranpixel_aot_check.py,form_coverage_check.pyandrdna2_tools_check.pyat this head. The draws are outside theprfilter.