Skip to content

rdna2spirv: the seven f16 transcendentals are measured, not assumed - #4714

Open
liang-kai-shui wants to merge 1 commit into
ItsNotRexed:mainfrom
liang-kai-shui:fix/f16-transcendental-comments
Open

liang-kai-shui wants to merge 1 commit into
ItsNotRexed:mainfrom
liang-kai-shui:fix/f16-transcendental-comments

Conversation

@liang-kai-shui

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: #4683 (comment)

Follow-up to @Jadiac5's note on #1893 (merged). tests/test_mode_round.py:123 had already been updated to cite the exhaustive sweep; two comments in the translator still called the same rounding "unmeasured, assumed".

What and why

  • tools/rdna2spirv.py:5966 (sin/cos f16 path): # sin ignores MODE rounding on hardware (RX 6800, SHADER-35); cos is unmeasured, assumed like it
  • tools/rdna2spirv.py:7762-7763 (rcp/rsq/sqrt/sin/exp/log/cos f16): # ... exp, log (and cos below) are unmeasured, assumed like them: nearest even always.

Both contradict the measured f16 transcendentals row in docs/design.md (FUZZ-29 / #1310 sweep, plus the exhaustive 65,536-input RNE-vs-RTZ gfx1036 measurement in SHADER-132): all seven ignore the f16 FP_ROUND field, so nearest-even always is measured, not assumed. The comments now point at that row.

Comment-only: the emitted SPIR-V and the runtime contract are unchanged.

Tested

  • python -m pytest tests/test_mode_round.py -q -> 74 passed (the mode-rounding contract tests, including test_transcendental_f16_ignores_mode for all seven ops).
  • python -m compileall -q tools/rdna2spirv.py clean; git diff --check clean; one file, +3/??.
  • No game data, no hardware run needed.

AI-assisted.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md).
  • A new translator rule is in the contract table of docs/design.md ??not applicable (comments only).

Two comments still called cos/exp/log f16 rounding "unmeasured, assumed"
after the FUZZ-29 sweep (ItsNotRexed#1310) and the exhaustive gfx1036 RNE-vs-RTZ
measurement (SHADER-132) landed in the f16 transcendentals row. Point at
that row instead; comment-only, the emitted SPIR-V is unchanged.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this at 4ff0db82b on Windows 11: pytest tests/test_mode_round.py -q -> 74 passed; git diff --check clean.

The change is comment-only: the f16 sin/cos/exp/log comments no longer call the three unmeasured, since all seven f16 transcendentals are measured (the docs/design.md f16 transcendentals row already states it). No behaviour change; no blocking issue.

@Atomic258

Copy link
Copy Markdown

Tested 4ff0db82 on Windows 11, Python 3.15.2: pass.

  • python -m pytest tests/test_mode_round.py -q: 74 passed — the mode-rounding contract holds with the corrected comments.
  • Verified the change is comment-only (3 lines touched, no emitted-code edits): the two "unmeasured, assumed" notes now point at the measured f16 transcendentals row.
  • git diff --check + python -I scripts/check_no_game_data.py: clean.

No game files. AI-assisted (Devin).

@theswiss24

Copy link
Copy Markdown

Tested 4ff0db82 (contains main 98fa503f) on two GPUs in a Dell Latitude 5501 (Linux Mint 22.3), test programs built from main 98fa503f (this PR changes no C++), llvm-mc 20.1.2, LEONIDA_W64_EMULATE=1: pass. Every test has the same result as main on each device:

GPU driver run_gpu_tests.py
NVIDIA MX150 (Pascal) 580.178.04 191/217 passed, 26 skipped, 0 failed
Intel UHD 630 (Gen9.5) Mesa ANV 25.2.8 184/217 passed, 31 skipped, 2 failed, the same 2 as main (cs_fmt_int_narrow = TEST-1000, and cs_signed_zero_nan, the known Mesa 25.2 NIR issue)

No game files.

Tested and written by Claude (Claude Code), posting from @theswiss24's account.

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.

4 participants