tests: the f64 rcp/rsq/sqrt/cvt oracle files check the translator, and spirv_interp divides doubles as doubles (TEST-F64-ORACLES-TRANSLATE) #746
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!746
Loading…
Reference in a new issue
No description provided.
Delete branch "cont/f64-oracles-translate"
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?
Pull request successfully merged and closed
Claimed in the coordination issue as: TEST-F64-ORACLES-TRANSLATE
What and why
tests/semantic/test_valu_{rcp,rsq,sqrt}_f64.pyandtest_valu_cvt_f32_f64.pywere private oracles, exempted intests/test_semantic_translator_use.py("should translate a listing"): nothing in them ran the translator.tools/semantic_mutants.py --op v_rcp_f64(and rsq, sqrt, cvt_f32_f64) showed it: swapping the high and low word of the f64 source in the sharedf64()helper (rdna2spirv.pyline 8487) failed none of the four files.TranslatorMatchesOracleclass: the instruction is translated (tests/semantic/f64_translate.py), run intests/spirv_interp.py, and its word checked against the file's own oracle. Inputs are the ones whose SPIR-V result is defined (docs/design.md rows for these ops): 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 are covered.tests/test_semantic_translator_use.py.Doing this found a bug in
tests/spirv_interp.py: itsF64table had noOpFDiv, so a binary64 division fell through to the binary32 table. The translatedv_rcp_f64of 3.0 gave0x3fd5555560000000instead of0x3fd5555555555555, and of 1e300 gave 0.OpFDivis added toF64(x / 0 as the binary32 one does), andOpFConvertis added (binary64 to binary32 rounds to nearest even, binary32 to binary64 is exact).The oracles are correctly rounded, which matches the translator's contract (GLSL
Sqrt/InverseSqrt,OpFDiv). RDNA2's ownv_sqrt_f64is not correctly rounded (docs/design.md), and none of the four ops occurs in the game listings, so this checks the translation against its documented contract, not against hardware.Tested
python -m unittest discover -s tests/semantic -p ...and aspython -Iscripts. Againstmain'sspirv_interp.pythe new classes fail (rcp: 19 failures; cvt: 34 errors, noOpFConvert).python -I tests/test_semantic_translator_use.py: OK without the four exemptions.semantic_mutants --op v_rcp_f64 / v_rsq_f64 / v_sqrt_f64 / v_cvt_f32_f64with the matching file: the line-8487 hi -> lo mutant is now caught by each (survived all four before). The four survivors left arev_add_f64code in the same shared branch (lines 8508, 8516), whichtest_valu_add_f64.pycovers.spirv_interpusers: thetests/semanticfiles pass, and the five pytest files (test_f16_hw_words,test_f16_op_sel_values,test_mode_round,test_u16_high_half,test_values) pass, 330 tests.tests/test_text_write_line_endings.py,tests/test_ci_registration.py,scripts/check_no_game_data.py,compileall: OK.Linux, CPU only; no GPU, no game files.
AI-assisted (Claude Code).
🤖 Generated with Claude Code
LGTM. Outstanding work on f64 VALU translation verification: adds 64_translate.py bridge, fixes spirv_interp.py binary64 OpFDiv / OpFConvert handling, and hooks
cp_f64,
sq_f64, sqrt_f64, and cvt_f32_f64 into active translator testing.
Audited and verified. Clean-room compliant.
Follow-up to my review: I reran the full semantic suite in the project's Fedora 45 tool container with SPIRV-Tools available.
python3 -I scripts/run_semantic_tests.py tests/semantic -j 16completed 465 files, 6,116 tests, 0 files failed in 90 seconds. Environment: Python 3.15.2 and SPIRV-Tools v2026.2. This supersedes the earlier local run where two files could not findspirv-as/spirv-val; those were environment failures, not project failures. The four affected f64 oracle modules still passed 237/237, and the translator-use guard passed 3/3.