Repository navigation
tests/semantic: restore test_alu_u16_clamp.py, the u16 add/sub clamp check - #4108
slint6614-dev wants to merge 1 commit into
Conversation
…check docs/design.md (Integer clamp) cites tests/semantic/test_alu_u16_clamp.py as the CPU check of the VOP3 clamp on v_add_nc_u16 / v_sub_nc_u16 and the v_add/sub/subrev_u16 e64 names: saturate to [0, 0xFFFF] and keep the high half of the destination. 523c32e added it as a translator test together with that translator change. fb9743a, 1352258 and 91b2c31 then overwrote it with Python min/max helpers that never call the translator and name no instruction, so the rule had no test left: on main, with the clamp select in rdna2spirv.py removed (results wrap) or with sub saturating high, this file and the seven other test files that use these ops all still pass. Bring back 523c32e's file unchanged (3/3 pass on main; both mutations fail it) and drop it from DEBT in tests/test_semantic_translator_use.py. Co-Authored-By: quackottu <224479491+quackottu@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nWg6BssUf8MjNaKuMSkfc
|
The restoration mechanics are right: the file is byte-identical to But the restored file is not translator coverage: Since AI-assisted review, no game files, no GPU. |
|
Thanks for the review, @tupacfan04. I think the second half describes the file this PR replaces (the current
That's why it takes about 0.9 s here rather than 0.00 s, and why removing the clamp select fails it (your own 188-failure control, and the mutation table in the description). The "pure So I'd keep the file as restored. It already is the translator-driven test you suggest converting to: it writes its own listing rather than using |
slopradish
left a comment
There was a problem hiding this comment.
CPU verification: checked out pull/4108/head in an isolated worktree and ran pytest -q tests/semantic/test_alu_u16_clamp.py: 3 passed, 850 subtests passed.
The restoration is sound: the test exercises the real translator through the semantic-translator-use harness rather than a private model, and the u16 add/sub clamp cases are now driven from the interpreter's own operand decode. The companion change to tests/test_semantic_translator_use.py keeps the test in the generated list, so it will run in CI instead of being silently skipped again.
One note: 850 subtests from 3 tests is a wide sweep; if a future translator change breaks one case, the failure name should identify the operand set clearly enough to triage without rerunning under a debugger. The current parameterisation does that.
No game files, keys or GPU involved.
|
Restored u16 clamp test verified on Linux: the PR sits on current main (fast-forward), |
Claimed in the coordination issue as: new TEST item, #3918 (comment) (corrected from "delete" to "restore" in #3918 (comment))
Depends on: #4114 (conflict only: both remove adjacent lines from
DEBTintests/test_semantic_translator_use.py; whichever lands second needs a one-line rebase, which I will do).What and why
docs/design.md(row "Integer clamp") citestests/semantic/test_alu_u16_clamp.pyas the CPU check of the VOP3clamponv_add_nc_u16/v_sub_nc_u16and thev_add/sub/subrev_u16_e64names: saturate to [0, 0xFFFF] and keep the high half of the destination.@quackottu added that file in 523c32e as a 114-line translator test, together with the translator change. Three later commits (fb9743a, 1352258, 91b2c31) overwrote it with Python
max(min(...))helpers that never call the translator and name no instruction. The file then went intoDEBTintests/test_semantic_translator_use.py, and the documented rule had no test left.This brings back 523c32e's file unchanged (
git diff 523c32ed -- tests/semantic/test_alu_u16_clamp.pyis empty) and removes it fromDEBT.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_alu_u16_clamp.py: 3/3 pass on today'smain.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 of the clamp select in
tools/rdna2spirv.py(~line 6842). The "other files" are the seven other test files that use these ops:test_valu_add_sub_nc_i16,test_ps_semantics,test_value_semantics,test_valu_int16,test_pk16_diff,test_wint_diffandtest_isa_coverage, run CI-style and all green first.main: current filemain: 7 other filessubsaturates to 0xFFFF instead of 0Checklist
docs/design.md, with how it was confirmed. (No new rule: the row already cites this file.)AI-assisted (Claude Code).
🤖 Generated with Claude Code
https://claude.ai/code/session_013nWg6BssUf8MjNaKuMSkfc