Repository navigation
test(semantic): add translator-backed tests for v_pk_max_i16 - #5652
slopgobblercobbler wants to merge 9 commits into
Conversation
|
Tested
No GPU, no game data. AI-assisted. |
|
Tested 22a24f2 merged with main 561b65a on Linux (WSL2) / Python 3.12.16 (-I, unittest discover -s tests/semantic -p test_valu_pk_max_i16_hw.py): pass 24 run, 24 passed, 0 failed. Test-only PR, so the tests also pass on main's translator (they pin existing v_pk_max_i16 behaviour). Mutation control: forcing signed = False in the packed 16-bit integer lowering of tools/rdna2spirv.py (line 6656, so max_i16 extracts unsigned) gives 2 failures; restored and it passes. Only 6 lines of the file reference the translator, so most of the 24 tests check Python reference code in the file; the 2 mutation failures show the translator-facing ones do bite. |
… signed boundary cases Address maintainer feedback from mrbean56 on PR ItsNotRexed#5652: - Add translator-backed execution coverage (run_translated_pk_max_i16) across reference oracle cases, AST instruction validation, scalar interpreter, SIMD divergence, register aliasing, and condition codes. - Add test_oracle_signed_vs_unsigned_discriminators with multiple execution assertions exercising signed extreme values (0x8000 vs 0x0000, 0xFFFF vs 0x0000, 0x8000 vs 0xFFFF, mixed half patterns). - Add translated tests for op_sel / op_sel_hi modifiers and SGPR/literal operands. - Under min/max flip mutation, 21 of 27 tests fail (up from 2); under signed=False mutation, 17 of 27 tests fail (up from 2). - Verify with python -I (27/27 passed) and test_semantic_translator_use.py.
|
Updated in cee6761 to address maintainer feedback regarding signed comparison rows and packed min/max selection sensitivity:
|
larpinguser
left a comment
There was a problem hiding this comment.
Summary
Adds a 690-line semantic test suite for RDNA2 v_pk_max_i16: an exact signed-packed-max oracle, AST construction, scalar/SIMD lane models, register aliasing, condition codes, and bit-pattern edge cases including -32768, mixed signs, and signed-vs-unsigned discriminators. Translator-backed checks drive rdna2spirv.py through support.translate_lines/mrt0_words, including op_sel and op_sel_hi variants, comparing results to the oracle.
Why merge
Locks down packed 16-bit signed maximum semantics end-to-end, catching translator regressions on a subtle instruction.
Verdict: Approve
SummaryAdds a 690-line semantic test suite for RDNA2 Why mergeLocks down packed 16-bit signed maximum semantics end-to-end, catching translator regressions on a subtle instruction. Verdict: Approve |
What
Adds hardware-semantic translator-backed tests and reference mathematical oracle for RDNA2 VALU packed signed 16-bit integer maximum
v_pk_max_i16intests/semantic/test_valu_pk_max_i16_hw.py.The 8-commit progression covers:
ref_pk_max_i16): element-wise signed two's complement 16-bit integer maximum across low and high halves.V_PK_MAX_I16) and 32-bit packed operand validation.support.translate_linesemittingSMaxand verified viasupport.mrt0_words).Tested
py -3.10 -m compileall -q tests(Clean, 0 errors)py -3.10 -I tests/semantic/test_valu_pk_max_i16_hw.py(All test suites passed, OK)py -3.10 -I tests/test_semantic_translator_use.py(Passes translator use guard, OK)unittest,struct,dataclasses,enum)