Skip to content

docs: design.md v_fma_mix* rows match the SHADER-135 measurements (PROC-96) - #1838

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
ezwinxdlmao:proc-96-fma-mix-docs
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
ezwinxdlmao:proc-96-fma-mix-docs

Conversation

@ezwinxdlmao

Copy link
Copy Markdown
Contributor

PROC-96 (found by @PedroNunes11 in #1745). Docs only: two rows of the contract table in docs/design.md contradicted docs/shader_validation.md after #1722.

Line 251, "f16 inline constants". The row said the translator gives the same words as the hardware for v_fma_mix* constants, with integer constants included. docs/shader_validation.md ("f16 output modifiers, clamp and v_fma_mix* operands on RDNA2") limits that agreement to the float constants and to the integer constants as f16 halves. Its difference 4 says the opposite for 1 and 64 as f32 operands: they are f32 denormals, which gfx1036 flushes to a zero of their sign with denorm_mode_32 = 0, while the translator keeps them. The row now gives that scope and cites difference 4.

Line 368, "Known approximations". The row said nearest-mode v_fma_mix* rounding was "unmeasured". #1722 measured it: on gfx1036, tools/fma_mix_probe.py --oracle hw gave the single-rounded word for all 7 ties. The sentence now says the hardware rounds once, the translator still rounds twice, and the translator is one f16 ulp off on exactly those ties. It points to the section in docs/shader_validation.md and to SHADER-296 for the fix.

Depends on: #1774. The two PRs overlap only on that one sentence of line 368, and either merge order works. #1774 (SHADER-296, @shadshuvo) makes the translator round once and deletes the sentence. If it lands first, the line-368 hunk here goes away and the line-251 fix stays. If this lands first, #1774's rebase drops the rewritten sentence.

No translator, test or tool changes. No game files and no GPU needed.

Tested (Windows 11, Python 3.12):

  • python -m compileall -q make_game.py tools tests: OK
  • python -I tests/test_docs_links.py: 5 tests OK
  • python -I tests/test_fma_mix_probe.py: 18 tests OK
  • Checked every new statement against docs/shader_validation.md on main at 003e7812.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

…OC-96)

- "f16 inline constants": the translator matches the hardware on the
  float constants and on the integer constants as f16 halves, not on
  `1`/`64` as f32 operands (f32 denormals gfx1036 flushes and the
  translator keeps; difference 4 in docs/shader_validation.md).
- "Known approximations": nearest-mode v_fma_mix{lo,hi}_f16 rounding is
  no longer unmeasured: gfx1036 rounds once on all seven probe ties,
  the translator still rounds twice (one f16 ulp off on those ties).

Docs only; no game files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@GrahamboJangles

Copy link
Copy Markdown

Reviewed on main against the merged measurements — CPU only: no GPU, no game files, nothing beyond this repo.

The new caveat in the "f16 inline constants" row is right. docs/shader_validation.md, section "f16 output modifiers, clamp and v_fma_mix* operands on RDNA2 (SHADER-135)" (line 997) says the translator "gives the same word for the float constants in every op_sel/op_sel_hi combination, for the integer constants as f16 halves", then lists five differences. Difference 4 is exactly what this row now claims: f32 denormal operands are not flushed by the translator, where the hardware gives a zero of its sign under denorm_mode_32 = 0 (the MODE the translator assumes for the game). So PROC-96's "the translator gives the same words" is stale, and this row fixes it.

One wording suggestion: difference 4 names three such operands — 0x00000001, 0x807fffff, and the integer constants 1 and 64 used as f32. The row names only 1 and 64, so a reader after the raw f32 denormals has to find them in the table by hand. Naming all three, or just citing "difference 4", keeps the row and the validation note in step.

The "Known approximations" rewrite also checks out. The same section's "v_fma_mixlo/mixhi_f16 round once" bullet gives the single-rounded word on all 7 tie inputs on gfx1036, and #1774 (SHADER-296) is still open in this tree, so "one f16 ulp off on those ties until the fix lands" matches the source today.

Docs only (+2/-2, one file), no translator rule touched, so no fixture or contract-table entry is due here. This PR does not touch the duplicated rows at docs/design.md lines 245-250 (PS system inputs, Inputs and outputs and 16-bit results each appear twice, both sides of #1722 kept); that is PROC-97, claimed by @Vonsek, so no conflict.

@ItsNotRexed
ItsNotRexed merged commit e41faaf into ItsNotRexed:main Nov 22, 2026
2 checks passed
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.

3 participants