tests: the three frexp_f64 oracle files check the translator, and pin where their oracle models IEEE=1 (TEST-FREXP-ORACLES-TRANSLATE) #810
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!810
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/810/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@qhukz13 on GitHub · 2026-11-24 14:05 UTC · original
qhukz13:cont/frexp-oracles-translate→main· +359 −35 · 10 files · 3 commits · merged 2026-11-24 16:06 UTCClaimed in the coordination issue as: TEST-FREXP-ORACLES-TRANSLATE
Depends on: #746 (the
f64_translate.pyhelper and thespirv_interpbinary64 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.pyandtest_valu_frexp_exp_i32_f64.pywere DEBT private oracles that never ran the translator. Each gets aTranslatorMatchesOracleclass that runs the translatedv_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/negandclamp.Comparing the two over 402 inputs, they disagree in two places, and in both
docs/design.mdsides with the translator. Thev_frexp_mant_f64row records gfx1036 measurements in the game's MODE (IEEE 0, denorm_mode_16_64 3):0x7FF0000000000001->0x7FF8000000000001), which is the IEEE=1 behaviour;mul:2/mul:4/div:2are 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
python -Iscripts (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 withtest_valu_frexp_f64.py, 77 withtest_valu_frexp_mant_f64.py, 42 withtest_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.pyalready 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
test_valu_{rcp,rsq,sqrt}_f64.py and test_valu_cvt_f32_f64.py were private oracles exempted in test_semantic_translator_use.py: nothing in them ran the translator, so swapping the high and low word of the f64 source in rdna2spirv.py's shared f64() helper failed no test. Each now has a TranslatorMatchesOracle class that translates the instruction (tests/semantic/f64_translate.py), runs it in tests/spirv_interp.py and checks the word against the file's own oracle, on inputs whose SPIR-V result is defined (no NaN; no zero divisor for rcp, nothing below zero for the roots, no binary32 subnormal or overflow for cvt): both signs, subnormals, infinities, neg/abs and clamp. The four exemptions are dropped. Doing that found that spirv_interp had no binary64 OpFDiv: the op fell through to the binary32 table, so the translated v_rcp_f64 of 3.0 gave 0x3fd5555560000000 instead of 0x3fd5555555555555, and of 1e300 gave 0. OpFDiv joins the F64 table (x / 0 as the binary32 one), and OpFConvert is added (binary64 -> binary32 rounds to nearest even). semantic_mutants --op v_rcp_f64 (and rsq, sqrt, cvt_f32_f64): the line-8487 hi -> lo mutant of f64() now fails each file (it survived all four before). Co-Authored-By: Claude Opus 5.5 <[email protected]>