Skip to content

tests/semantic: restore test_int_to_float.py, the int-to-float translator test - #4114

Open
slint6614-dev wants to merge 1 commit into
ItsNotRexed:mainfrom
slint6614-dev:test/restore-int-to-float
Open

slint6614-dev wants to merge 1 commit into
ItsNotRexed:mainfrom
slint6614-dev:test/restore-int-to-float

Conversation

@slint6614-dev

@slint6614-dev slint6614-dev commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: new TEST item, #3918 (comment). This replaces my #4083: I had proposed deleting the file there, before I found it was an overwritten translator test.

Depends on: #4108 (conflict only: both remove adjacent lines from DEBT in tests/test_semantic_translator_use.py; whichever lands second needs a one-line rebase, which I will do).

What and why

@Ritolino added tests/semantic/test_int_to_float.py in 9a2db92 as a translator test. It translates v_cvt_f32_i32, v_cvt_f32_u32 and v_cvt_f32_ubyte0..3, runs them in spirv_mini_interp, and compares the result with a float32 reference, with negative controls on the emitted SPIR-V. Three later commits (791c9e5, 3fff9fd, 514cbff) overwrote it with checks of Python's own float()/struct conversions that import nothing from the repository, and the file went into DEBT in tests/test_semantic_translator_use.py.

This brings back 9a2db92's file unchanged (git diff 9a2db924 -- tests/semantic/test_int_to_float.py is empty) and removes it from DEBT. Same pattern as #4108 (test_alu_u16_clamp.py).

Tested

Linux (WSL2), CPython 3.14.4, CPU only, no GPU, no game files, at aa2988cc:

  • python -m unittest discover -s tests/semantic -p test_int_to_float.py: 5/5 pass on today's main.
  • python -I tests/test_semantic_translator_use.py: pass. python -I tests/test_text_write_line_endings.py: pass. git diff --check: clean.

Mutation check in tools/rdna2spirv.py:

Mutation current file on main restored file other files on main
v_cvt_f32_i32 converted as unsigned not caught caught test_alu_vop3_mods_hw, test_f32_fuzz, test_values, test_translate
v_cvt_f32_u32 converted as signed not caught caught test_f32_fuzz, test_values, test_translate
v_cvt_f32_ubyteN reads byte N-1 not caught caught test_f32_fuzz only

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (No new rule: test-only.)

AI-assisted (Claude Code).

🤖 Generated with Claude Code

https://claude.ai/code/session_013nWg6BssUf8MjNaKuMSkfc

…ator test

9a2db92 added tests/semantic/test_int_to_float.py as a translator test:
v_cvt_f32_i32, v_cvt_f32_u32 and v_cvt_f32_ubyte0..3 translated, run in
spirv_mini_interp and compared with a float32 reference, with negative
controls on the emitted SPIR-V. 791c9e5, 3fff9fd and 514cbff then
overwrote it with checks of Python's own float()/struct conversions that
import nothing from the repository, and the file went into DEBT in
tests/test_semantic_translator_use.py.

Bring back 9a2db92's file unchanged (5/5 pass on main) and drop it from
DEBT. With v_cvt_f32_i32 converted as unsigned, v_cvt_f32_u32 as signed,
or v_cvt_f32_ubyteN reading the wrong byte, the restored file fails; the
current one passes all three.

Co-Authored-By: Ritolino <230431388+Ritolino@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013nWg6BssUf8MjNaKuMSkfc

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this at bb4320ed on Windows 11:

  • python tests/semantic/test_int_to_float.py -> 5 tests, OK; the file imports rdna2spirv and spirv_mini_interp, translates each v_cvt_f32_i32/u32/ubyte0..3 listing, runs it, and has in-memory SPIR-V sabotage controls.
  • python -I tests/test_semantic_translator_use.py -> 3 tests, OK, with the file no longer in DEBT.
  • compileall and git diff --check clean.

This is the correct resolution of #4083: rather than deleting the overwritten file, it restores the translator-driven test that was there before the model-only commits. No blocking issue.

@tupacfan04

Copy link
Copy Markdown
Contributor

Tested at the head on Windows 11 / Python 3.13.0: 5/5 new tests, the guard 3 OK, line endings 3 OK, test_f32_valu.py and test_alu_cvt_flr_rpi.py pass, compileall and git diff --check clean, merge clean.

Importantly, this is not a pure oracle: it imports rdna2spirv (test_int_to_float.py:25), calls translate (:82) and runs the SPIR-V (:87), and it is byte-identical to 9a2db924. The guard fails on main's stdlib-only version at tests/test_semantic_translator_use.py:215 and passes here. Mutation (emitting UToF for i32) fails 6 assertions in the restored test, while the same mutation passes 4 on main's oracle - exactly the difference this is meant to make.

#4108 still open and touches the same DEBT hunk, so a one-line rebase is expected.

Approve. AI-assisted review, no game files, no GPU.

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.

3 participants