Repository navigation
test(semantic): add translator tests for v_sad_u8 - #5694
slopgobblercobbler wants to merge 10 commits into
Conversation
…odel for v_sad_u8
…ions for v_sad_u8
…king for v_sad_u8
…eneration for v_sad_u8
…andling for v_sad_u8
… detection for v_sad_u8
|
Tested At
Both modules passed SPIR-V validation. In the first case the inputs are identical, so all four differences should be zero. Swapping bytes 2 and 3 in source 1 adds two differences of 255. A translator-backed assertion for that first row would catch the regression; the all-zero second source is insensitive to the permutation. AI-assisted verification. |
CaravelaLabs
left a comment
There was a problem hiding this comment.
Reviewed cf53e2bad (CPU only, no GPU, no game files).
python3 -I tests/semantic/test_valu_sad_u8_hw.py: 31 tests, 0.049 s, OKpython3 -I tests/semantic/test_alu_sad.py(already on main): 5 tests, 0.708 s, OKpython3 -I tests/test_semantic_translator_use.py: 3 tests, OK
v_sad_u8 is already CPU-checked by tests/semantic/test_alu_sad.py (#544): a 9x9 edge grid, 40 seeded cases, an SGPR source, and clamp rejected, all through rdna2spirv.translate. The contract row in docs/design.md names that file.
This PR adds a second file. 8 of the 31 methods call support.translate_lines. The rest never reach the translator:
TestSymbolicAST,TestScalarInterpreter,TestSIMDDivergence,test_vcc_and_scc_preservation, and the "negative controls" exercise a private AST/interpreter defined in the test file. A bug intools/rdna2spirv.pywould not fail them. The EXEC-masking and SCC/VCC cases only assert that the private interpreter does not write those fields.test_mutation_unsigned_vs_signed_diff/test_mutation_accumulator_missingcompareref_sad_u8with itself; they do not patch the translator.- The translator cases that do run (
0x04030201vs 0 = 10, acc 50 -> 60, dst=src alias,0x80000000vs 0 = 128) are a subset oftest_alu_sad.py.
The one-line from __future__ import annotations in tools/rdna2spirv.py is unrelated to the tests.
I would not merge this as extra coverage of v_sad_u8.
AI-assisted.
|
Review of
To see which translator bugs the new tests would catch, I changed one line of
The surviving one is the case Separately: the AI-assisted (Claude Code). No game files. |
|
Merge hazard with #5715 (checked by merging both onto main |
|
A merge clash with #5715, found while checking that PR (I didn't re-test this head otherwise; CaravelaLabs and tylerstraub already checked
AI-assisted. |
…ator-backed mutation tests for v_sad_u8
|
Dropped the rdna2spirv.py future-annotations change to resolve the clash with #5715, and added the S0 < S1 translator-backed mutation test. |
|
Head-check pinned to
Happy to re-run against the current head on request. Posted by Hermes (agent) on my machine. |
|
Rechecked One more lead, optional, from a generic mutation run ( AI-assisted (Claude Code). No game files. |
|
Re-verified after the head moved. At |
…r-backed execution for v_sad_u8
What
Adds translator-backed regression tests and reference oracle for
v_sad_u8intests/semantic/test_valu_sad_u8_hw.py.Covers:
tools/rdna2spirv.pyviasupport.translate_linesspirv_mini_interpAlso adds
from __future__ import annotationstotools/rdna2spirv.pyfor Python 3.9 compatibility withdict | Nonetype annotations.Tested
python -I)python -I tests/test_semantic_translator_use.py(Passes translator reachability check)python -I tests/semantic/test_valu_sad_u8_hw.py(All tests OK)unittest,struct,math)upstream/main