[PR #1459] f32_fuzz: judge v_mul_legacy_f32 omod -0 against the +0 the translator models #1489

Open
opened 2026-11-26 20:21:25 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1459
Author: @PierreEbele
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: f32-fuzz-legacy-omod-zero


📝 Commits (1)

  • 93d0c20 f32_fuzz: judge v_mul_legacy_f32 omod -0 against the +0 the translator models

📊 Changes

2 files changed (+20 additions, -0 deletions)

View changed files

📝 tests/test_f32_fuzz.py (+12 -0)
📝 tools/f32_fuzz.py (+8 -0)

📄 Description

tools/f32_fuzz.py reports a false translator mismatch for v_mul_legacy_f32 with an output modifier when the product underflows to -0.

Reproducer on main (CPU only): python3 -I tools/f32_fuzz.py --programs 1500 --seed 53 exits 1:

--- program 246: v_mul_legacy_f32_e64 v8, v1, v3 mul:2
    inputs: v1=0x1da20776(4.288875738331329e-21) v3=0x819d422d(-5.776764917635499e-38)
    model v8/vcc:      0x80000000(-0.0) 0x00000000(0.0)
    translated v8/vcc: 0x00000000(0.0) 0x00000000(0.0)

The translator's +0 is intended. Its v_mul_legacy_f32 branch in tools/rdna2spirv.py applies the measured IEEE-off omod rule (a -0 result becomes +0 under mul:2/mul:4/div:2; docs/design.md rows "v_mul_legacy_f32 default-mode f32 denormal flushing" and "Output modifiers on hardware"). The fuzzer's hardware side already treats this as the known deviation dev_omod_neg_zero. The translator-side check(), however, still compared against the ISA-text model's -0.

Change: check() now expects +0 in that case (only for the ops listed in TRANSLATOR_OMOD_POS_ZERO, currently v_mul_legacy_f32). model() and the hardware path are unchanged, and v_mul_f32, whose translation keeps -0, is still judged as before.

Tests (Linux arm64, no GPU):

  • New test_legacy_mul_omod_turns_an_underflowed_minus_zero_into_plus_zero in tests/test_f32_fuzz.py: fails on main (3 subtests: mul:2, mul:4, div:2) and passes on this branch. The whole file gives 30 tests, OK (1 skipped: needs the hw oracle).
  • python3 -I tools/f32_fuzz.py --programs 1500 --seed 53: exit 1 on main, exit 0 here.
  • scripts/check_no_game_data.py on both files: clean.

The case was found by a translator-oracle fuzzing campaign (seeds 41–56). No game data is involved and no GPU is needed.

AI-assisted.

Claimed in the coordination issue as: F32-FUZZ-LEGACY-OMOD-ZERO

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1459 **Author:** [@PierreEbele](https://github.com/PierreEbele) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `f32-fuzz-legacy-omod-zero` --- ### 📝 Commits (1) - [`93d0c20`](https://github.com/ubiquitarianism/leonida/commit/93d0c205ba2e649fe4e111d989e9de2fd06b1838) f32_fuzz: judge v_mul_legacy_f32 omod -0 against the +0 the translator models ### 📊 Changes **2 files changed** (+20 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_f32_fuzz.py` (+12 -0) 📝 `tools/f32_fuzz.py` (+8 -0) </details> ### 📄 Description `tools/f32_fuzz.py` reports a false translator mismatch for `v_mul_legacy_f32` with an output modifier when the product underflows to -0. **Reproducer on main** (CPU only): `python3 -I tools/f32_fuzz.py --programs 1500 --seed 53` exits 1: ``` --- program 246: v_mul_legacy_f32_e64 v8, v1, v3 mul:2 inputs: v1=0x1da20776(4.288875738331329e-21) v3=0x819d422d(-5.776764917635499e-38) model v8/vcc: 0x80000000(-0.0) 0x00000000(0.0) translated v8/vcc: 0x00000000(0.0) 0x00000000(0.0) ``` The translator's +0 is intended. Its `v_mul_legacy_f32` branch in `tools/rdna2spirv.py` applies the measured IEEE-off omod rule (a -0 result becomes +0 under `mul:2`/`mul:4`/`div:2`; docs/design.md rows "`v_mul_legacy_f32` default-mode f32 denormal flushing" and "Output modifiers on hardware"). The fuzzer's hardware side already treats this as the known deviation `dev_omod_neg_zero`. The translator-side `check()`, however, still compared against the ISA-text model's -0. **Change**: `check()` now expects +0 in that case (only for the ops listed in `TRANSLATOR_OMOD_POS_ZERO`, currently `v_mul_legacy_f32`). `model()` and the hardware path are unchanged, and `v_mul_f32`, whose translation keeps -0, is still judged as before. **Tests** (Linux arm64, no GPU): - New `test_legacy_mul_omod_turns_an_underflowed_minus_zero_into_plus_zero` in `tests/test_f32_fuzz.py`: fails on main (3 subtests: `mul:2`, `mul:4`, `div:2`) and passes on this branch. The whole file gives 30 tests, OK (1 skipped: needs the hw oracle). - `python3 -I tools/f32_fuzz.py --programs 1500 --seed 53`: exit 1 on main, exit 0 here. - `scripts/check_no_game_data.py` on both files: clean. The case was found by a translator-oracle fuzzing campaign (seeds 41–56). No game data is involved and no GPU is needed. AI-assisted. Claimed in the coordination issue as: F32-FUZZ-LEGACY-OMOD-ZERO 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1489
No description provided.