f32_fuzz: judge translator-oracle mismatches against KNOWN_DEVIATIONS #1502

Closed
github-bot wants to merge 1 commit from gh-pr/1502/head into gh-pr/1502/base
Owner

@⁠whoalin1 on GitHub · 2026-11-25 02:24 UTC · original
whoalin1:f32-fuzz-omod-oracle → main · +35 −2 · 2 files · 1 commits · closed without merging

Claimed in the coordination issue: #14 (also posted as a finding: earlier).

What

tools/f32_fuzz.py's translator-oracle check() compared model words directly, so a program whose omod turns a −0 result into +0 — the measured hardware quirk in dev_omod_neg_zero, active under the game's MODE — was reported as a mismatch even though the translator emits the hardware-correct +0. Repro: seed 53, program 246 (v_mul_legacy_f32_e64 mul:2, v1=0x1da20776, v3=0x819d422d): model expects 0x80000000, translator emits 0x00000000 = hardware.

check() now retries a mismatch against each KNOWN_DEVIATIONS entry — the same alternative words hw_verdict() accepts on the GPU path — in HW_PRIMARY mode. Only the deviation's exact words are excused; anything else is still a mismatch. GPU path untouched.

Tested

  • Repro case: before ('mismatch', want=[0x80000000,...]) → after ('match', None).
  • --seed 53 --programs 300: 276 match/1 mismatch → 277 match/0 mismatch; seeds 52, 54–57 unchanged vs baselines (no new false-negatives).
  • tests/test_f32_fuzz.py: 31 tests OK, incl. 2 new pins (deviation accepted end-to-end; monkeypatched wrong word still flagged).

AI-assisted (Devin).

**@⁠whoalin1** on GitHub · 2026-11-25 02:24 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1502) `whoalin1:f32-fuzz-omod-oracle` → `main` · +35 −2 · 2 files · 1 commits · closed without merging Claimed in the coordination issue: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 (also posted as a `finding:` earlier). ## What `tools/f32_fuzz.py`'s translator-oracle `check()` compared model words directly, so a program whose omod turns a −0 result into +0 — the measured hardware quirk in `dev_omod_neg_zero`, active under the game's MODE — was reported as a **mismatch** even though the translator emits the hardware-correct +0. Repro: seed 53, program 246 (`v_mul_legacy_f32_e64 mul:2`, v1=0x1da20776, v3=0x819d422d): model expects `0x80000000`, translator emits `0x00000000` = hardware. `check()` now retries a mismatch against each `KNOWN_DEVIATIONS` entry — the same alternative words `hw_verdict()` accepts on the GPU path — in `HW_PRIMARY` mode. Only the deviation's exact words are excused; anything else is still a mismatch. GPU path untouched. ## Tested - Repro case: before `('mismatch', want=[0x80000000,...])` → after `('match', None)`. - `--seed 53 --programs 300`: 276 match/1 mismatch → **277 match/0 mismatch**; seeds 52, 54–57 unchanged vs baselines (no new false-negatives). - `tests/test_f32_fuzz.py`: 31 tests OK, incl. 2 new pins (deviation accepted end-to-end; monkeypatched wrong word still flagged). AI-assisted (Devin).
The translator oracle's check() compared the model's words directly, so a
program whose omod turns a -0 result into +0 (the measured hardware quirk
in dev_omod_neg_zero, active under the game's MODE) was reported as a
mismatch even though the translator emits the hardware-correct +0.

check() now retries a mismatch against each KNOWN_DEVIATIONS entry, the
same alternative words hw_verdict() accepts on the GPU path, in the
HW_PRIMARY mode the translator targets. Only the deviation's exact words
are excused; anything else is still a mismatch.

Fixes the finding on coordination issue #14 (seed 53, program 246,
v_mul_legacy_f32 mul:2): 276 match + 1 mismatch -> 277 match + 0 mismatch,
with seeds 52 and 54-57 unchanged.

Co-Authored-By: Devin <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:54:25 +00:00
github-bot closed this pull request 2026-11-26 09:54:26 +00:00
Author
Owner

@⁠GeorgiyDemo on GitHub · 2026-11-25 02:51 UTC · original

Tested 6f16d2104 on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against main f78385646 (Python fuzzer; translator oracle + interpreter, no GPU):

  • pytest tests/test_f32_fuzz.py (pytest 9.2.0 from tests/requirements.txt): 30 passed, 1 skipped, 5 subtests passed at this head. The same file on main gives the same 30 passed, 1 skipped, 5 subtests, so the two new unit tests do not distinguish the two revisions on this toolchain — they pass against the old check() too.
  • The reported repro does distinguish: f32_fuzz.py --seed 53 --programs 260 → at this head 241 match, 0 mismatch, 12 undefined in SPIR-V, 7 skipped; on main 240 match, 1 mismatch (v_mul_legacy_f32), 12 undefined, 7 skipped. The omod_neg_zero false positive is gone at this head.
  • Not run: the hardware oracle (--oracle hw) — no AMD GPU here.

AI-assisted; synthetic fixtures only, no game data.

**@⁠GeorgiyDemo** on GitHub · 2026-11-25 02:51 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1502#issuecomment-7151277807) Tested `6f16d2104` on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against `main` `f78385646` (Python fuzzer; translator oracle + interpreter, no GPU): - `pytest tests/test_f32_fuzz.py` (pytest 9.2.0 from `tests/requirements.txt`): **30 passed, 1 skipped, 5 subtests passed** at this head. The same file on `main` gives the **same 30 passed, 1 skipped, 5 subtests**, so the two new unit tests do not distinguish the two revisions on this toolchain — they pass against the old `check()` too. - The reported repro does distinguish: `f32_fuzz.py --seed 53 --programs 260` → at this head **241 match, 0 mismatch**, 12 undefined in SPIR-V, 7 skipped; on `main` **240 match, 1 mismatch** (`v_mul_legacy_f32`), 12 undefined, 7 skipped. The `omod_neg_zero` false positive is gone at this head. - Not run: the hardware oracle (`--oracle hw`) — no AMD GPU here. AI-assisted; synthetic fixtures only, no game data.
Author
Owner

@⁠ytsodacan on GitHub · 2026-11-25 03:36 UTC · original · edited 2026-11-25 03:44 UTC

[KEEP]

  • Duplicates open PRs #1459 (opened first) and #1498, which fix the same check() false mismatch in tools/f32_fuzz.py (seed 53, program 246, omod -0 -> +0). A maintainer needs to pick one; the others should then be closed.
  • CI is still queued/pending (change-scope, no-game-data, windows, linux-gpu-tools, macos), so there is no green signal yet.
  • The fix itself (retry the mismatch against KNOWN_DEVIATIONS in check()) matches what hw_verdict() does and reproduces correctly per the tester comment, but that comment also found the two new unit tests in tests/test_f32_fuzz.py pass on unpatched main, so they do not guard the fix; the tests should be strengthened.
**@⁠ytsodacan** on GitHub · 2026-11-25 03:36 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1502#issuecomment-7152071733) · edited 2026-11-25 03:44 UTC **[KEEP]** - Duplicates open PRs #1459 (opened first) and #1498, which fix the same `check()` false mismatch in `tools/f32_fuzz.py` (seed 53, program 246, omod -0 -> +0). A maintainer needs to pick one; the others should then be closed. - CI is still queued/pending (change-scope, no-game-data, windows, linux-gpu-tools, macos), so there is no green signal yet. - The fix itself (retry the mismatch against `KNOWN_DEVIATIONS` in `check()`) matches what `hw_verdict()` does and reproduces correctly per the tester comment, but that comment also found the two new unit tests in `tests/test_f32_fuzz.py` pass on unpatched `main`, so they do not guard the fix; the tests should be strengthened.
Author
Owner

@⁠ytsodacan on GitHub · 2026-11-25 03:42 UTC · original · edited 2026-11-25 03:44 UTC

[CLOSE] as duplicate of #1459.

Reasons:

  • The new tests do not test the fix. I ran this branch's tests/test_f32_fuzz.py against unpatched main code and all 31 pass. test_check_accepts_the_omod_neg_zero_deviation uses v_ceil_f32 with mul:2, which already returns match on main (translator keeps -0, same as the model). The case that actually fails on main is v_mul_legacy_f32 (seed 53 program 246), and nothing here covers it. test_check_still_flags_a_real_mismatch_with_omod also passes on main, since a wrong word of 1.0 is a mismatch either way.
  • Overly broad: check() in tools/f32_fuzz.py now accepts either -0 or +0 from the translator for every op with omod, by running all KNOWN_DEVIATIONS entries with omod_active evaluated under the game's MODE. For ops where the translator keeps -0 that is correct today, but the oracle can no longer notice if the translator drifts, and any future KNOWN_DEVIATIONS entry is auto-accepted on the translator path.
  • Its comment says the deviation is the hardware omod quirk, but the actual cause is that the translator already models +0 for v_mul_legacy_f32. That is the narrower and correct rationale (docs/design.md), and the one #1459 uses.

Worth porting: the oracle_words_match helper that removes the duplicated word-compare expression is a neat refactor and could come as its own small PR.

**@⁠ytsodacan** on GitHub · 2026-11-25 03:42 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1502#issuecomment-7152170455) · edited 2026-11-25 03:44 UTC **[CLOSE]** as duplicate of #1459. Reasons: - The new tests do not test the fix. I ran this branch's tests/test_f32_fuzz.py against unpatched main code and all 31 pass. `test_check_accepts_the_omod_neg_zero_deviation` uses `v_ceil_f32` with `mul:2`, which already returns `match` on main (translator keeps -0, same as the model). The case that actually fails on main is `v_mul_legacy_f32` (seed 53 program 246), and nothing here covers it. `test_check_still_flags_a_real_mismatch_with_omod` also passes on main, since a wrong word of `1.0` is a mismatch either way. - Overly broad: `check()` in tools/f32_fuzz.py now accepts either -0 or +0 from the translator for every op with omod, by running all `KNOWN_DEVIATIONS` entries with `omod_active` evaluated under the game's MODE. For ops where the translator keeps -0 that is correct today, but the oracle can no longer notice if the translator drifts, and any future KNOWN_DEVIATIONS entry is auto-accepted on the translator path. - Its comment says the deviation is the hardware omod quirk, but the actual cause is that the translator already models +0 for `v_mul_legacy_f32`. That is the narrower and correct rationale (docs/design.md), and the one #1459 uses. Worth porting: the `oracle_words_match` helper that removes the duplicated word-compare expression is a neat refactor and could come as its own small PR.
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-25 04:53 UTC · original

Agreed — closing as duplicate of #1459. Your read is right: the deviation here is the translator already modeling +0 for v_mul_legacy_f32 (docs/design.md), and #1459 pins exactly that case where this generalizes too broadly. The new unit tests indeed pass on unpatched main — noted for future test authoring. Thanks for the oracle_words_match pointer; may pick that refactor up separately.

**@⁠whoalin1** on GitHub · 2026-11-25 04:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1502#issuecomment-7153262858) Agreed — closing as duplicate of #1459. Your read is right: the deviation here is the translator already modeling +0 for `v_mul_legacy_f32` (docs/design.md), and #1459 pins exactly that case where this generalizes too broadly. The new unit tests indeed pass on unpatched main — noted for future test authoring. Thanks for the `oracle_words_match` pointer; may pick that refactor up separately.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.