shader: lower binary64 add and multiply #3652
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!3652
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3650"
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 21:15 UTC · original
lambirou:shader/f64-add-mul→main· +1461 −6 · 7 files · 3 commits · openStacked on #3645 (
shader/f64-rounding, head9601449eafter theorigin/mainmerge). Do not merge this change before #3645.Problem
v_add_f64andv_mul_f64are VOP3 gfx1013/gfx1030 forms that were stillunobservedin both coverage references. No open pull request lowers either form; #3645 lists them among the forms it explicitly leaves uncovered.Change
Add the two unmodified VOP3 forms to the pixel AOT translator. The destination is a VGPR pair. Each source is an unmodified VGPR pair or an aligned SGPR pair. The implementation operates on the low and high 32-bit words and uses no HLSL binary64 type:
(+inf) + (-inf)and zero times infinity produce0x7ff8000000000000.The existing f64 rounding helpers do not provide the 128-bit alignment, exact product, carries, or subnormal-result rounding, so this change adds the
r64a_*integer helpers. It leavesv_fma_f64, divide/reciprocal/square root/trigonometric f64, min/max/ldexp, frexp, conversions, and DS f64 forms unchanged. Modifiers, clamp, omod, op_sel, DPP, SDWA, literals, inline constants, malformed or untracked pairs, pending SGPR loads, sample results, partial source/destination overlap, and non-entry masks are refused; an identical source and destination pair is accepted after both source words are captured.Tests
python -B tests/pixel_aot_check.py: passed.python -B tests/form_coverage_check.py: passed.python -B tests/rdna2_tools_check.py: 163 tests passed, 19 skipped.cmake --preset dev -DINTAKE_PYTHON=<repo>/out/pe-env/Scripts/python.exe;cmake --build --preset dev -- -j 4: passed. The final build was rerun at-j4after a default-parallelrc.exefailure in unrelated targets.ctest --preset dev --no-tests=error -R '^pixel_aot_f64_arith_' --output-junit out/f64_arith_junit.xml: 2 passed, 0 failed, 0 skipped.pixel_aot_f64_arith_hardwarepassed on an AMD Radeon RX 9060 XT (driver 32.0.32029.2010, Windows build 26300.10075, debug layer unavailable) andpixel_aot_f64_arith_warppassed on the Microsoft Basic Render Driver.FORM_COVERAGE_RECORDcontains exactlyv_add_f64andv_mul_f64.tools/form_coverage.py out/build/dev/out/f64_arith_junit.xml --records out/build/dev/form_coverage: 2 of 1968 gfx1013 forms and 2 of 1863 gfx1030 forms from this fixture. The measured delta is +2 gfx1013 and +2 gfx1030.pixel_mismatch. An additional local 256-pair randomized draw pass matched the Python reference.Limits
This is desktop DXIL translation evidence only. It does not establish the console's NaN payload selection, subnormal behavior, or rounding behavior. Only the two named VOP3 forms are covered; dependent f64 arithmetic remains out of scope.
AI-assisted change.
Merge with origin/main (2026-12-01)
Merged
origin/mainata3bfd019into this branch; head is98f1bee0. 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 (164 tests, 19 skips); CTestpixel_aot_f64_arith_warp,pixel_aot_f64_round_warpandpixel_aot_f64_minmax_ldexp_warppass (3/3).@lukaslw-lab on GitHub · 2026-12-01 02:43 UTC · original · approved these changes
Reviewed
98f1bee0by reading the diff; not built or run. Stacked on #3645, so I read this PR's own change against #3645's head9601449e.Verdict: approve. The integer binary64 add and multiply round once, correctly, in every range I traced. No MUST, no SHOULD. Merge after #3645, as the body says.
r64a_mul32, theadd128/sub128carry chains and the shifts are exact.r64a_bitlen(0)is 0.r64a_roundnormal path (tools/pixel_aot.py:1372): the exponent base is in units of the integer significand,befor add andae + be − 1075for multiply. Guard and sticky give ties-to-even, a carry to 2^53 renormalizes, and overflow before or after rounding gives signed infinity.r64a_roundsubnormal path: a value with exponent ≤ 0 is below 2^52 after the shift, sohi >= 0x00100000can only be the rounding carry, and returning the minimum normal is exact.:1427): operands are swapped so that |a| ≥ |b|. Thedistance >= 64early return (:1459) is safe, because b < 2^−11 ulp(a), which is below the half-ulp just under a power of two. An exact cancellation gives +0, and −0 + −0 gives −0.:1467): four partial products cover all 106 bits. inf·0 gives the canonical NaN.0x7ff8000000000000.:7832), and an identical pair is safe because the helper call reads both sources first. The CMake delta only adds the two draws.Tests: the 39 draw rows with five mutations prove the rounding paths against the Python reference. CI ran
pixel_aot_check.py,form_coverage_check.pyandrdna2_tools_check.pyat this head. The draws are outside theprfilter.@lambirou on GitHub · 2026-12-02 18:08 UTC · original
Superseded: main already carries this change as
8b7e0213(shader: lower binary64 add and multiply). The branch has no non-merge commits outside main, so closing it avoids a duplicate review.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.