tests: the three frexp_f64 oracle files check the translator, and pin where their oracle models IEEE=1 (TEST-FREXP-ORACLES-TRANSLATE) #810

Merged
qhukz13 merged 3 commits from upstream-pr/810 into main 2026-11-24 16:06:43 +00:00
qhukz13 commented 2026-11-24 14:05:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-24T14:05:27Z.


Claimed in the coordination issue as: TEST-FREXP-ORACLES-TRANSLATE

Depends on: #746 (the f64_translate.py helper and the spirv_interp binary64 fixes), #764 (neighbouring DEBT entries). This branch is on top of both, so their commits show here until they are merged.

What and why

tests/semantic/test_valu_frexp_f64.py, test_valu_frexp_mant_f64.py and test_valu_frexp_exp_i32_f64.py were DEBT private oracles that never ran the translator. Each gets a TranslatorMatchesOracle class that runs the translated v_frexp_mant_f64 / v_frexp_exp_i32_f64 (f64_translate.py, spirv_interp) and checks it against the file's own oracle: normals, subnormals, zeros, infinities and quiet NaNs, both signs, abs/neg and clamp.

Comparing the two over 402 inputs, they disagree in two places, and in both docs/design.md sides with the translator. The v_frexp_mant_f64 row records gfx1036 measurements in the game's MODE (IEEE 0, denorm_mode_16_64 3):

  • a signalling NaN passes through unchanged; the oracles quiet it (0x7FF0000000000001 -> 0x7FF8000000000001), which is the IEEE=1 behaviour;
  • mul:2 / mul:4 / div:2 are ignored; the oracles scale the mantissa, which is the denorm_mode_16_64=0 behaviour.

The new classes pin those two measured behaviours instead of the oracle, and each file's module docstring now says that its oracle's sNaN/omod rules model IEEE=1. The oracles' own tests are not changed; aligning them with the game's MODE is left to their authors. The three DEBT entries are dropped.

Tested

  • The three files: OK as python -I scripts (the new classes run 5, 4 and 2 tests).
  • python -I tests/test_semantic_translator_use.py: OK without the three entries.
  • tools/semantic_mutants.py --op v_frexp_mant_f64 (the shared mant/exp branch): 92 of 134 mutants caught with test_valu_frexp_f64.py, 77 with test_valu_frexp_mant_f64.py, 42 with test_valu_frexp_exp_i32_f64.py (exponent only). Before, none of the three reached the translator.
  • compileall, tests/test_text_write_line_endings.py, scripts/check_no_game_data.py: OK.

tests/semantic/test_alu_frexp_f64.py already checks this translation against gfx1036 words; these classes add the oracle files' input classes to it.

Linux, CPU only; no GPU, no game files.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5473677457 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/810). Originally posted by [qhukz13](https://github.com/qhukz13) on 2026-11-24T14:05:27Z. --- Claimed in the coordination issue as: TEST-FREXP-ORACLES-TRANSLATE Depends on: #746 (the `f64_translate.py` helper and the `spirv_interp` binary64 fixes), #764 (neighbouring DEBT entries). This branch is on top of both, so their commits show here until they are merged. ### What and why `tests/semantic/test_valu_frexp_f64.py`, `test_valu_frexp_mant_f64.py` and `test_valu_frexp_exp_i32_f64.py` were DEBT private oracles that never ran the translator. Each gets a `TranslatorMatchesOracle` class that runs the translated `v_frexp_mant_f64` / `v_frexp_exp_i32_f64` (`f64_translate.py`, `spirv_interp`) and checks it against the file's own oracle: normals, subnormals, zeros, infinities and quiet NaNs, both signs, `abs`/`neg` and `clamp`. Comparing the two over 402 inputs, they disagree in two places, and in both `docs/design.md` sides with the translator. The `v_frexp_mant_f64` row records gfx1036 measurements in the game's MODE (IEEE 0, denorm_mode_16_64 3): - a signalling NaN passes through unchanged; the oracles quiet it (`0x7FF0000000000001` -> `0x7FF8000000000001`), which is the IEEE=1 behaviour; - `mul:2` / `mul:4` / `div:2` are ignored; the oracles scale the mantissa, which is the denorm_mode_16_64=0 behaviour. The new classes pin those two measured behaviours instead of the oracle, and each file's module docstring now says that its oracle's sNaN/omod rules model IEEE=1. The oracles' own tests are not changed; aligning them with the game's MODE is left to their authors. The three DEBT entries are dropped. ### Tested - The three files: OK as `python -I` scripts (the new classes run 5, 4 and 2 tests). - `python -I tests/test_semantic_translator_use.py`: OK without the three entries. - `tools/semantic_mutants.py --op v_frexp_mant_f64` (the shared mant/exp branch): 92 of 134 mutants caught with `test_valu_frexp_f64.py`, 77 with `test_valu_frexp_mant_f64.py`, 42 with `test_valu_frexp_exp_i32_f64.py` (exponent only). Before, none of the three reached the translator. - `compileall`, `tests/test_text_write_line_endings.py`, `scripts/check_no_game_data.py`: OK. `tests/semantic/test_alu_frexp_f64.py` already checks this translation against gfx1036 words; these classes add the oracle files' input classes to it. Linux, CPU only; no GPU, no game files. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!810
No description provided.