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

Manually merged
github merged 1 commit from gh-pr/1005/head into gh-pr/1005/base 2026-11-26 09:33:06 +00:00
Owner

@⁠thesubtleties on GitHub · 2026-11-24 16:44 UTC · original
thesubtleties:f64-diff-fixup-ref → main · +25 −12 · 2 files · 1 commits · merged 2026-11-25 02:36 UTC

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.
**@⁠thesubtleties** on GitHub · 2026-11-24 16:44 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1005) `thesubtleties:f64-diff-fixup-ref` → `main` · +25 −12 · 2 files · 1 commits · merged 2026-11-25 02:36 UTC 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:33:03 +00:00
github manually merged commit 3edc26bad8 into gh-pr/1005/base 2026-11-26 09:33:06 +00:00
Author
Owner

@⁠thesubtleties on GitHub · 2026-11-24 18:54 UTC · original

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)

**@⁠thesubtleties** on GitHub · 2026-11-24 18:54 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1005#issuecomment-7141308783) 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)
Author
Owner

@⁠fin-github on GitHub · 2026-11-24 21:32 UTC · original · reviewed

  • 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).

**@⁠fin-github** on GitHub · 2026-11-24 21:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1005#pullrequestreview-6047760461) · **reviewed** - `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).
Author
Owner

@⁠thesubtleties on GitHub · 2026-11-24 23:50 UTC · original

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)

**@⁠thesubtleties** on GitHub · 2026-11-24 23:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1005#issuecomment-7147849028) 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)
Author
Owner

@⁠QemmHD on GitHub · 2026-11-25 02:36 UTC · original

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).

**@⁠QemmHD** on GitHub · 2026-11-25 02:36 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1005#issuecomment-7150937466) 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).
This discussion has been locked. Commenting is limited to contributors.
No description provided.