tools: f32_fuzz translator-oracle applies the omod KNOWN_DEVIATIONS the GPU path applies (FUZZ-F32-ORACLE-DEV) #1498

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

@⁠thiefyzheng on GitHub · 2026-11-25 02:15 UTC · original
thiefyzheng:fix/f32-oracle-deviations → main · +14 −1 · 1 files · 1 commits · closed without merging

What

tools/f32_fuzz.py's translator-oracle check() path (line ~726) now consults the same KNOWN_DEVIATIONS rules the GPU-compare path already applies (line ~941): after the exact-match check fails, it asks each rule for an alternate expectation, classifies a hit as deviation:<name>, and counts/prints them per rule and op (known deviation omod_neg_zero x1: v_mul_legacy_f32). Match/mismatch verdicts and the undefined/skip accounting are untouched.

Why

The finding is @⁠whoalin1's (coordination issue #14, 02:02Z, posted twice): the oracle path counted as a mismatch exactly the translator output that is measured hardware behavior — an active mul:2 turning a -0 result into +0, documented in docs/design.md's v_mul_legacy_f32 and output-modifier rows (native gfx1031/gfx1036 measurements: with IEEE off and f32 denormals flushed the omod is applied every time, and the 66 -0-result programs become +0). A differential fuzzer whose oracle path false-positives on documented-and-measured behavior trains people to ignore its output.

What I ran (CPU-only, current main lineage 3ff2a2adc, no GPU, no game files)

  • Seed 53 before: 1000 programs (seed 53): 936 match, 1 mismatch, 34 undefined in SPIR-V, 29 skipped + mismatch x1: v_mul_legacy_f32 (program 246, the finding's exact operands). After: 936 match, 0 mismatch, 34 undefined, 29 skipped + known deviation omod_neg_zero x1: v_mul_legacy_f32.
  • Regression sweep, seeds 1–30, before vs after: every summary line byte-identical (952 match, 0 mismatch… etc. per seed), zero new deviations, zero regressions — the classification only changes for the one program that hit the rule.
  • --self-test OK; tests/test_f32_fuzz.py — 29 tests OK (1 skipped, GPU).
  • scripts/check_no_game_data.py exit 0.

Not run

The GPU-compare path and any hardware oracle (no GPU needed or used; the path is untouched).

AI-assisted: a pi coding agent operated by the repo contributor ran the verification sweep and built the single-file diff; the finding is @⁠whoalin1's.

**@⁠thiefyzheng** on GitHub · 2026-11-25 02:15 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1498) `thiefyzheng:fix/f32-oracle-deviations` → `main` · +14 −1 · 1 files · 1 commits · closed without merging ## What `tools/f32_fuzz.py`'s translator-oracle `check()` path (line ~726) now consults the same `KNOWN_DEVIATIONS` rules the GPU-compare path already applies (line ~941): after the exact-match check fails, it asks each rule for an alternate expectation, classifies a hit as `deviation:<name>`, and counts/prints them per rule and op (`known deviation omod_neg_zero x1: v_mul_legacy_f32`). Match/mismatch verdicts and the undefined/skip accounting are untouched. ## Why The finding is @⁠whoalin1's (coordination issue #14, 02:02Z, posted twice): the oracle path counted as a **mismatch** exactly the translator output that is measured hardware behavior — an active `mul:2` turning a `-0` result into `+0`, documented in docs/design.md's `v_mul_legacy_f32` and output-modifier rows (native gfx1031/gfx1036 measurements: with IEEE off and f32 denormals flushed the omod is applied every time, and the 66 `-0`-result programs become `+0`). A differential fuzzer whose oracle path false-positives on documented-and-measured behavior trains people to ignore its output. ## What I ran (CPU-only, current main lineage 3ff2a2adc, no GPU, no game files) - **Seed 53 before:** `1000 programs (seed 53): 936 match, 1 mismatch, 34 undefined in SPIR-V, 29 skipped` + `mismatch x1: v_mul_legacy_f32` (program 246, the finding's exact operands). **After:** `936 match, 0 mismatch, 34 undefined, 29 skipped` + `known deviation omod_neg_zero x1: v_mul_legacy_f32`. - **Regression sweep, seeds 1–30, before vs after:** every summary line byte-identical (`952 match, 0 mismatch…` etc. per seed), zero new deviations, zero regressions — the classification only changes for the one program that hit the rule. - `--self-test` OK; `tests/test_f32_fuzz.py` — 29 tests OK (1 skipped, GPU). - `scripts/check_no_game_data.py` exit 0. ## Not run The GPU-compare path and any hardware oracle (no GPU needed or used; the path is untouched). **AI-assisted**: a pi coding agent operated by the repo contributor ran the verification sweep and built the single-file diff; the finding is @⁠whoalin1's.
The differential fuzzer's GPU-compare path classifies an active omod
turning a -0 result into +0 as a known deviation (dev_omod_neg_zero);
the translator-oracle check() path did not consult KNOWN_DEVIATIONS,
so the same translator output that is measured hardware behavior
counted as a mismatch (seed 53 program 246, v_mul_legacy_f32_e64
mul:2). The oracle path now asks the same rules after the exact-match
check fails, counts deviations per rule and op, and prints them in the
GPU path's style. Only the classification changes; the match/mismatch
verdicts and the undefined/skip accounting are untouched, proven by a
seed 1..30 sweep with byte-identical summaries before and after.

The finding is whoalin1's (coordination issue #14, 02:02Z).

AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:54:17 +00:00
github-bot closed this pull request 2026-11-26 09:54:17 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 02:17 UTC · original

For the maintainers: this fixes the same false mismatch as #1459. Same function (check() in tools/f32_fuzz.py), same reproducer (--seed 53, program 246, v_mul_legacy_f32_e64 ... mul:2, model -0 vs translated +0). #1459 was claimed in #14 as F32-FUZZ-LEGACY-OMOD-ZERO at 00:36Z (#14) and opened at 00:39Z. I opened #1459 from this account.

The two diffs merge without a textual conflict, but only one is needed. How they differ:

  • #1459 changes the expected word to +0 for v_mul_legacy_f32 when an omod is active. The program then counts as a match. It adds test_legacy_mul_omod_turns_an_underflowed_minus_zero_into_plus_zero to tests/test_f32_fuzz.py, which fails on main for mul:2, mul:4 and div:2.
  • This PR reuses the KNOWN_DEVIATIONS rules from the GPU-compare path. The program is reported as deviation:omod_neg_zero instead of a match. It changes only tools/f32_fuzz.py and adds no test.

The maintainers can choose either approach. If they choose this one, #1459 can be closed.

AI-assisted.

**@⁠PierreEbele** on GitHub · 2026-11-25 02:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1498#issuecomment-7150535772) For the maintainers: this fixes the same false mismatch as #1459. Same function (`check()` in `tools/f32_fuzz.py`), same reproducer (`--seed 53`, program 246, `v_mul_legacy_f32_e64 ... mul:2`, model -0 vs translated +0). #1459 was claimed in #14 as F32-FUZZ-LEGACY-OMOD-ZERO at 00:36Z (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) and opened at 00:39Z. I opened #1459 from this account. The two diffs merge without a textual conflict, but only one is needed. How they differ: - #1459 changes the expected word to +0 for `v_mul_legacy_f32` when an omod is active. The program then counts as a match. It adds `test_legacy_mul_omod_turns_an_underflowed_minus_zero_into_plus_zero` to `tests/test_f32_fuzz.py`, which fails on main for `mul:2`, `mul:4` and `div:2`. - This PR reuses the `KNOWN_DEVIATIONS` rules from the GPU-compare path. The program is reported as `deviation:omod_neg_zero` instead of a match. It changes only `tools/f32_fuzz.py` and adds no test. The maintainers can choose either approach. If they choose this one, #1459 can be closed. AI-assisted.
Author
Owner

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

[KEEP]

  • Small and scoped (tools/f32_fuzz.py, +14/-1): check() now consults KNOWN_DEVIATIONS so the v_mul_legacy_f32 omod -0/+0 case is reported as deviation:omod_neg_zero instead of a mismatch.
  • Duplicates the fix in open #1459 (same function and reproducer, --seed 53 program 246), as the existing author comment notes. #1502 (f32_fuzz: judge translator-oracle mismatches against KNOWN_DEVIATIONS) is also open and appears to overlap. Only one approach should land; that is a maintainer decision.
  • Unlike #1459, this PR adds no test in tests/test_f32_fuzz.py.
  • No CI checks have run on head 262b1771.
**@⁠ytsodacan** on GitHub · 2026-11-25 03:36 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1498#issuecomment-7152074658) · edited 2026-11-25 03:44 UTC **[KEEP]** - Small and scoped (`tools/f32_fuzz.py`, +14/-1): `check()` now consults `KNOWN_DEVIATIONS` so the `v_mul_legacy_f32` omod -0/+0 case is reported as `deviation:omod_neg_zero` instead of a mismatch. - Duplicates the fix in open #1459 (same function and reproducer, `--seed 53` program 246), as the existing author comment notes. #1502 (`f32_fuzz: judge translator-oracle mismatches against KNOWN_DEVIATIONS`) is also open and appears to overlap. Only one approach should land; that is a maintainer decision. - Unlike #1459, this PR adds no test in `tests/test_f32_fuzz.py`. - No CI checks have run on head `262b1771`.
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:

  • No tests. The PR changes only tools/f32_fuzz.py (+14/-1), so nothing guards the new behavior; the existing suite passes the same with or without it (29 tests OK on both main and this branch).
  • It is broader than the bug. check() now runs every KNOWN_DEVIATIONS entry for every op, but the only mismatch seen (seed 53 program 246) is v_mul_legacy_f32 with omod, where the translator already models +0 on purpose. For that case check now returns deviation:omod_neg_zero, which hides the fact that the model/translator disagree rather than fixing the oracle for that op.
  • It adds a new status string, deviation:<name>, that leaves check()'s documented match/mismatch/skip/undefined contract. Other callers would see an unexpected status, and translate_cases stops counting these cases as match or mismatch.
  • Because alt is judged with the same relaxed NaN rule, any KNOWN_DEVIATIONS added later is silently accepted on the translator path with no per-op scoping.

Worth porting (separately, with a test): the "known deviation ... xN: op n" summary lines in translate_cases. Reporting excused cases is useful, as long as they are asserted in a test.

**@⁠ytsodacan** on GitHub · 2026-11-25 03:42 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1498#issuecomment-7152169952) · edited 2026-11-25 03:44 UTC **[CLOSE]** as duplicate of #1459. Reasons: - No tests. The PR changes only tools/f32_fuzz.py (+14/-1), so nothing guards the new behavior; the existing suite passes the same with or without it (29 tests OK on both main and this branch). - It is broader than the bug. `check()` now runs every `KNOWN_DEVIATIONS` entry for every op, but the only mismatch seen (seed 53 program 246) is `v_mul_legacy_f32` with omod, where the translator already models +0 on purpose. For that case `check` now returns `deviation:omod_neg_zero`, which hides the fact that the model/translator disagree rather than fixing the oracle for that op. - It adds a new status string, `deviation:<name>`, that leaves `check()`'s documented match/mismatch/skip/undefined contract. Other callers would see an unexpected status, and `translate_cases` stops counting these cases as match or mismatch. - Because `alt` is judged with the same relaxed NaN rule, any KNOWN_DEVIATIONS added later is silently accepted on the translator path with no per-op scoping. Worth porting (separately, with a test): the "known deviation ... xN: op n" summary lines in `translate_cases`. Reporting excused cases is useful, as long as they are asserted in a test.
Author
Owner

@⁠thiefyzheng on GitHub · 2026-11-25 19:56 UTC · original

Closing as a duplicate of #1459 (same function, same --seed 53 program 246 reproducer), as the reviewer noted: #1459 carries a regression test and this one does not. No objection to #1459 landing instead.

AI-assisted (Claude Code).

**@⁠thiefyzheng** on GitHub · 2026-11-25 19:56 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1498#issuecomment-7172971787) Closing as a duplicate of #1459 (same function, same `--seed 53` program 246 reproducer), as the reviewer noted: #1459 carries a regression test and this one does not. No objection to #1459 landing instead. AI-assisted (Claude Code).

Pull request closed

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