Skip to content

tests/semantic: convert test_int_to_float DEBT entry to a translator-backed test - #6315

Open
ErRusso wants to merge 1 commit into
ItsNotRexed:mainfrom
ErRusso:fix/cvt-int-to-float-test
Open

ErRusso wants to merge 1 commit into
ItsNotRexed:mainfrom
ErRusso:fix/cvt-int-to-float-test

Conversation

@ErRusso

@ErRusso ErRusso commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

The test_int_to_float.py DEBT entry in tests/test_semantic_translator_use.py modelled
the int→f32 instructions as a plain-Python oracle and never called the translator.
Now every case translates a hand-written pixel shader through tools/rdna2spirv.py
and runs it in spirv_mini_interp.

This change:

  • Replaces the private IntToFloatOracle class with support.translate_lines calls
  • Adds hand-written boundary tables for both v_cvt_f32_i32 and v_cvt_f32_u32
  • Adds a plain-Python reference that the hand table and seeded random cases check against
  • Tests VOP3 modifier forms (omod mul:2/div:2/mul:4, clamp, SGPR source, inline constant)

Standard library only, no GPU, no game files, no external tools. All 13 tests pass.

Claim: #6214 (comment)

AI-assisted.

…slator-backed test

Replace the self-built Python oracle for v_cvt_f32_i32/v_cvt_f32_u32
with a real translator test: every case translates a hand-written pixel
shader through tools/rdna2spirv.py and runs it in spirv_mini_interp.

Covers:
- Hand-written boundary table (i32 and u32 directions)
- Seeded random inputs matched against a plain-Python reference
- VOP3 omod (mul:2, div:2, mul:4), clamp and source modifiers
- e64 SGPR and inline-constant sources

AI-assisted.
@neoisg8

neoisg8 commented Nov 23, 2026

Copy link
Copy Markdown

Independent verification on Windows 11 (CPython 3.14.0, CPU only, standard library only, zero game data):

  • python -I tests/semantic/test_int_to_float.py: all 13 tests passed in ~8.7s.
  • python -I tests/test_semantic_translator_use.py: all 3 tests passed.
  • Verified that _reaches('tests/semantic/test_int_to_float.py') now returns True.
  • git diff --check origin/main...HEAD and python -m compileall -q tests/semantic/test_int_to_float.py are clean.

Optional follow-up / polish:
Since test_int_to_float.py is now translator-backed, you can remove the entry from the DEBT dict in tests/test_semantic_translator_use.py:47:

    "test_int_to_float.py": "private oracle merged before this guard (2026-11-22); should translate a listing",

Tested removing that line locally: tests/test_semantic_translator_use.py continues to pass 3/3, officially retiring this debt entry.

LGTM!

AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants