Skip to content

docs/design: v_fma_mix* rounding is measured; say which path is still off (PROC-96) - #1828

Closed
dcastell1 wants to merge 1 commit into
ItsNotRexed:mainfrom
dcastell1:docs/proc-96-fma-mix
Closed

dcastell1 wants to merge 1 commit into
ItsNotRexed:mainfrom
dcastell1:docs/proc-96-fma-mix

Conversation

@dcastell1

Copy link
Copy Markdown
Contributor

PROC-96 (claimed in #1745).

What and why

docs/design.md, Known approximations row. It listed mix ops with the packs that round to nearest "because the mode says so", which reads as if nearest-even mix were correct by construction. SHADER-135 (#1722) measured v_fma_mixlo/mixhi_f16 on RDNA2 (gfx1036): they round the exact x*y+z once, in every mode, 7 of 7 discriminating tie inputs.

The translator already rounds once toward zero (Gen.fma_mix_odd), so in that mode it is exact. In nearest-even it still computes an f32 Fma and narrows, which is 1 f16 ulp off on ties — that is the approximation, and #1774 (SHADER-296) is the change that removes it. The row now says exactly that instead of grouping mix ops with the packs.

The other half of the item (the "Not measured" note about v_fma_mix* constants) needed no change: #1722 already replaced it with the measured per-operand rule in the f16 inline constants row.

Testing

  • uvx pytest -q tests/test_docs_links.py → 5 passed.
  • Row renders as one table cell; no other row touched.

No game files; docs only.

… one still off

PROC-96: the Known approximations row still listed mix ops with the packs that
round to nearest because the mode says so. SHADER-135 (ItsNotRexed#1722) measured
v_fma_mixlo/mixhi_f16 on gfx1036: they round the exact x*y+z once in every mode,
7 of 7 discriminating tie inputs. The toward-zero path already does that; the
nearest-even path narrows an f32 Fma, which is 1 f16 ulp off on ties until
ItsNotRexed#1774 (SHADER-296) lands, so the row now says which of the two is the
approximation instead of implying both are correct by construction.

The f16 inline constants row needed no change: ItsNotRexed#1722 already replaced its
"Not measured" note with the measured per-operand rule.
@dcastell1

Copy link
Copy Markdown
Contributor Author

Closing: #1774 landed and now documents exactly this. The Known approximations row on current main says v_fma_mix{lo,hi}_f16 rounds the exact fma once "straight to f16, in both nearest-even and toward-zero modes (measured on AMD RDNA2 gfx1036 and verified by tools/fma_mix_probe.py; finding 7079901079)", and the nearest-even "rounds twice" note is gone, so PROC-96 is complete without this branch and there is nothing left to change. My rebase conflicted on that row, which is what surfaced it.

@dcastell1 dcastell1 closed this Nov 22, 2026
@GrahamboJangles

Copy link
Copy Markdown

Reviewed on main — CPU only: no GPU, no game files.

This PR's only change (+1/-1, one line) rewrites the "Known approximations" row of the translator contract. #1838 rewrites that same row from the same SHADER-135 measurements, and additionally fixes the "f16 inline constants" row, which is the row PROC-96 points at (docs/design.md line 251, "The translator gives the same words" — stale against difference 4 of docs/shader_validation.md, section "f16 output modifiers, clamp and v_fma_mix* operands on RDNA2 (SHADER-135)", line 997: the translator keeps f32 denormal operands while the hardware gives a zero of its sign under denorm_mode_32 = 0).

Nothing in this wording is wrong — it agrees with those measurements, and #1774 (SHADER-296) is still open, so "until the fix lands" is accurate. But #1838 covers everything this row change says plus the row this item also asks for, so the two overlap on the same line. Per the coordination rule in #1745 (when two PRs take one item, one merges and the other is asked to rebase or close), this looks like the one to close or to rebase onto #1838; I found no text here that #1838 does not already carry.

Unaddressed by either PR, and not yours to fix: the duplicated rows at docs/design.md lines 245-250 (PS system inputs, Inputs and outputs and 16-bit results each appear twice, an artifact of #1722's merge). That is PROC-97, claimed by @Vonsek.

ItsNotRexed added a commit that referenced this pull request Nov 22, 2026
# Conflicts:
#	docs/design.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants