f64_diff: v_div_fixup_f64 reference follows the gfx1036 measurement (F64-DIFF-DIV-FIXUP-REF) #1005

Merged
thesubtleties merged 1 commit from upstream-pr/1005 into main 2026-11-25 02:36:15 +00:00
thesubtleties commented 2026-11-24 16:44:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by thesubtleties on 2026-11-24T16:44:01Z.


Claimed in the coordination issue as: F64-DIFF-DIV-FIXUP-REF

What and why

The v_div_fixup_f64 reference in tools/f64_diff.py still had the old rule: infinity when exp(S2) - exp(S1) >= 1024, underflow from -1075, and quieted NaN sources. The gfx1036 measurement recorded in docs/design.md (v_div_fixup row, by timelery) says: no overflow cutoff, underflow at <= -1076, NaN sources pass unquieted. The translator already follows it, so the fuzzer reported false mismatches. Only the fuzzer and its tests change. The same design row still states the old rule earlier in its text; I left that for a docs change.

Tested

  • tools/f64_diff.py --programs 300: seeds 770707 and 3 go from 1 mismatch to 0; seeds 1, 2, 4, 5 stay at 0. --self-test passes.
  • tests/test_f64_diff.py: 32 passed, with five table rows moved to the measured values and a new reference-against-translator check at the cutoffs.
  • I did not measure the hardware myself.

GPUs tested: n/a

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md: n/a, no translator change.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5476418979 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1005). Originally posted by [thesubtleties](https://github.com/thesubtleties) on 2026-11-24T16:44:01Z. --- Claimed in the coordination issue as: F64-DIFF-DIV-FIXUP-REF ### What and why The `v_div_fixup_f64` reference in `tools/f64_diff.py` still had the old rule: infinity when `exp(S2) - exp(S1) >= 1024`, underflow from `-1075`, and quieted NaN sources. The gfx1036 measurement recorded in `docs/design.md` (v_div_fixup row, by timelery) says: no overflow cutoff, underflow at `<= -1076`, NaN sources pass unquieted. The translator already follows it, so the fuzzer reported false mismatches. Only the fuzzer and its tests change. The same design row still states the old rule earlier in its text; I left that for a docs change. ### Tested - `tools/f64_diff.py --programs 300`: seeds 770707 and 3 go from 1 mismatch to 0; seeds 1, 2, 4, 5 stay at 0. `--self-test` passes. - `tests/test_f64_diff.py`: 32 passed, with five table rows moved to the measured values and a new reference-against-translator check at the cutoffs. - I did not measure the hardware myself. GPUs tested: n/a AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`: n/a, no translator change.
thesubtleties commented 2026-11-24 18:54:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by thesubtleties on 2026-11-24T18:54:01Z.


One more data point; no code change. On main 3aa97542, tools/f64_diff.py --programs 2000 --seed 551124 reports 1 mismatch, with the minimal program

v_mov_b32 v13, 0x55407155
v_div_fixup_f64 v[8:9], -0.0, 64, v[12:13]

where the reference expects infinity (00000000 7ff00000) and the translator gives zero. On this branch (3edc26ba) the same command reports 0 mismatches (1848 match, the rest are the interpreter's skips). CPU only; I did not measure the hardware myself. AI-assisted (Claude Code)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7141308783 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1005#issuecomment-7141308783). Originally posted by [thesubtleties](https://github.com/thesubtleties) on 2026-11-24T18:54:01Z. --- One more data point; no code change. On main `3aa97542`, `tools/f64_diff.py --programs 2000 --seed 551124` reports 1 mismatch, with the minimal program ``` v_mov_b32 v13, 0x55407155 v_div_fixup_f64 v[8:9], -0.0, 64, v[12:13] ``` where the reference expects infinity (`00000000 7ff00000`) and the translator gives zero. On this branch (`3edc26ba`) the same command reports 0 mismatches (1848 match, the rest are the interpreter's skips). CPU only; I did not measure the hardware myself. AI-assisted (Claude Code)
fin-github commented 2026-11-24 21:32:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fin-github on 2026-11-24T21:32:46Z.

Review: COMMENTED


  • python -I tests/test_f64_diff.py on the PR: 32 tests OK. tools/f64_diff.py --self-test passes, and
    --programs 300 --seed 770707 gives 302 match, 0 mismatch.
  • The PR's test file against main (4a50cafc7): 9 failures, all in the changed rows and the new cutoff check, so the
    tests catch the old reference.
  • The new reference agrees with the measured part of the v_div_fixup row in docs/design.md (line 466): f64
    underflow at e2 - e1 <= -1076, no overflow cutoff, sNaN passed unchanged under IEEE=0.

As you say, the same row also states the old rule (<= -1075, >= 1024, NaN quieted) earlier on, so it contradicts
itself. If nobody has picked that up, a finding: in #14 would make sure the docs fix gets done. Looks good to me.

Tested on Windows 11 Pro 26200, CPython 3.14.4, applied on main 4a50cafc7. No GPU or game files used. AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6047760461 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1005#pullrequestreview-6047760461). Originally posted by [fin-github](https://github.com/fin-github) on 2026-11-24T21:32:46Z. **Review:** COMMENTED --- - `python -I tests/test_f64_diff.py` on the PR: 32 tests OK. `tools/f64_diff.py --self-test` passes, and `--programs 300 --seed 770707` gives 302 match, 0 mismatch. - The PR's test file against `main` (4a50cafc7): 9 failures, all in the changed rows and the new cutoff check, so the tests catch the old reference. - The new reference agrees with the measured part of the `v_div_fixup` row in `docs/design.md` (line 466): f64 underflow at `e2 - e1 <= -1076`, no overflow cutoff, sNaN passed unchanged under `IEEE=0`. As you say, the same row also states the old rule (`<= -1075`, `>= 1024`, NaN quieted) earlier on, so it contradicts itself. If nobody has picked that up, a `finding:` in #14 would make sure the docs fix gets done. Looks good to me. Tested on Windows 11 Pro 26200, CPython 3.14.4, applied on main 4a50cafc7. No GPU or game files used. AI-assisted (Claude Code).
thesubtleties commented 2026-11-24 23:50:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by thesubtleties on 2026-11-24T23:50:12Z.


Native RDNA2 check of the case in my comment above (gfx1036, tools/hw_oracle, IEEE off, f64 denormals on): v_div_fixup_f64 v[8:9], -0.0, 64, v[12:13] with v12 = 0 and v13 = 0x55407155 gives 00000000 00000000, as this branch's reference says.

My first post said I hadn't measured hardware; this one case now is. The other cutoffs aren't. AI-assisted (Claude Code)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7147849028 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1005#issuecomment-7147849028). Originally posted by [thesubtleties](https://github.com/thesubtleties) on 2026-11-24T23:50:12Z. --- Native RDNA2 check of the case in my comment above (gfx1036, `tools/hw_oracle`, IEEE off, f64 denormals on): `v_div_fixup_f64 v[8:9], -0.0, 64, v[12:13]` with v12 = 0 and v13 = `0x55407155` gives `00000000 00000000`, as this branch's reference says. My first post said I hadn't measured hardware; this one case now is. The other cutoffs aren't. AI-assisted (Claude Code)
QemmHD commented 2026-11-25 02:36:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-25T02:36:12Z.


Merging.

Why merged: The f64_diff reference for v_div_fixup follows the gfx1036 hardware measurement in the one case where it differed.

Why it's good: Own tests: 32 passed.

Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main b4b7756e8. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests, ctest_registration) gives 578 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main 3ff2a2adc (after #984): no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7150937466 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1005#issuecomment-7150937466). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-25T02:36:12Z. --- Merging. **Why merged:** The f64_diff reference for v_div_fixup follows the gfx1036 hardware measurement in the one case where it differed. **Why it's good:** Own tests: 32 passed. Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main b4b7756e8. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests, ctest_registration) gives 578 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main 3ff2a2adc (after #984): no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1005
No description provided.