mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:40:52 +01:00
[PR #856] [MERGED] spirv_mini_interp: binary64 Sqrt/InverseSqrt stay binary64, and OpFAdd/OpFSub/OpFDiv run on doubles (TEST-MINI-INTERP-F64) #894
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#894
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/856
Author: @qhukz13
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism
Base:
main← Head:cont/mini-interp-f64📝 Commits (1)
adc2569spirv_mini_interp: binary64 Sqrt/InverseSqrt stay binary64, and OpFAdd/OpFSub/OpFDiv run on doubles (TEST-MINI-INTERP-F64)📊 Changes
2 files changed (+144 additions, -3 deletions)
View changed files
📝
tests/semantic/spirv_mini_interp.py(+32 -3)➕
tests/semantic/test_mini_interp_f64.py(+112 -0)📄 Description
Claimed in the coordination issue as: TEST-MINI-INTERP-F64
What and why
tests/semantic/spirv_mini_interp.pymishandled binary64:SqrtandInverseSqrtrounded a double result to binary32: the translatedv_sqrt_f64of 2.0 gave0x3ff6a09e60000000instead of0x3ff6a09e667f3bcd, andv_rsq_f64likewise.OpFAdd,OpFSubandOpFDivon binary64 raisedUnsupportedConstruct(onlyOpFMulran), sov_add_f64andv_rcp_f64could not run in this interpreter at all.tests/spirv_interp.py, the other interpreter, had the matchingOpFDivgap (#746).Changes:
Sqrtismath.sqrt(correctly rounded). A doubleInverseSqrtis the newrsqrt_f64, rounded once from the exact value through an integer square root:1.0 / math.sqrt(x)rounds twice and misses by an ulp on about a quarter of random doubles (5,219 of 20,008, checked against a 90-digit decimal;rsqrt_f64matched all 20,008).OpFAdd/OpFSub/OpFDivfollow the binary32 path's rules: a division by zero is still refused as undefined, and a NaN made from non-NaN operands goes throughieee_nan.OpFMulis unchanged.Tested
tests/semantic/test_mini_interp_f64.py(7 tests): translatesv_sqrt_f64,v_rsq_f64,v_rcp_f64andv_add_f64and checks the pair against Python's binary64 operations and, for the inverse root, a 60-digit decimal reference (not againstrsqrt_f64itself);rcpof zero stays refused. Againstmain's interpreter it gives 2 failures and 14 errors.python -I scripts/run_semantic_tests.py tests/semantic: 466 files, 6,115 tests; the only failures aretest_sopc_validationandtest_unary_f16_validation, which needspirv-as/spirv-valand those are not installed here.spirv_mini_interp:test_fma_mix_probe,test_image_query_translate,test_rdna2_decode,test_spirv_interp_bits,test_spirv_interp_f64_glsl,test_shader_diff_exit,test_wave_diff(stdlib) andtest_rdna2spirv_pixelinput,test_u16_high_half(pytest): OK.test_translate.pyskips without llvm-mc.tests/test_semantic_translator_use.py,tests/test_text_write_line_endings.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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.