Repository navigation
test(semantic): add semantic interpreter tests for v_perm_b32_u16 - #5371
slopgobblercobbler wants to merge 8 commits into
Conversation
|
Reviewed 775c913 (CPU, Linux, Python 3.13): 3 issues
No game files. |
|
Tested 775c913 (merged onto main 3faac55) on Apple M4, macOS, CPU only, Python 3.15.2. This is a second check, and it agrees with tedin7's review:
The real op is already covered by AI-assisted; no game files. |
|
Verified on a merge with main 3faac55: compileall clean; all 16 oracle tests pass both via unittest discover and directly under python -I, and the existing test_valu_perm_b32.py sibling stays green. No .u16 perm coverage existed on main, so this fills a real gap; stdlib-only and self-contained. Checks pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
Kam471
left a comment
There was a problem hiding this comment.
Reviewed head 775c91373fe34042d8ec5a9889d4b6a3583ff1ef (base 0aa98400, 8 commits; main is 3faac557b).
Blockers:
-
Not a translator test.
python tests/semantic/test_valu_perm_b32_u16.py-> 16 tests OK, butpython -I tests/test_semantic_translator_use.py-> FAILED (failures=1):tests/semantic/test_valu_perm_b32_u16.py:1: imports no rdna2spirv and no helper that does. Same after merging3faac557blocally, so CI is red after merge. -
v_perm_b32_u16is not in the RDNA2 ISA: llvm-mc 21 says "invalid instruction". The table hasv_perm_b32(0x344) only;v_perm_b32takes byte selectors on two dwords and has no 16-bit form. The selector constants this file defines (SEL_SRC0_LO,SEL_SIGN_EXT_SRC1_HI, ...) are therefore invented, and the hand-computed expectations cannot be checked against hardware. -
make_selector,pack_halvesandoracle_v_perm_b32_u16form a private model; the assertions only compare that model with constants derived from the same file.
Same 8-commit template as the other five semantic PRs in this batch.
Kam471
left a comment
There was a problem hiding this comment.
Merging main (3faac557b) into this head and running the semantic guard fails:
python -I -m pytest tests/test_semantic_translator_use.py -q -> 1 failed, 2 passed, test_every_semantic_test_reaches_the_translator: tests/semantic/test_valu_perm_b32_u16.py imports no rdna2spirv and no helper that does.
Fix, following #3448/#3457/#3472: keep the operand tables and expected words, replace the private interpreter with support.translate_lines plus the mini interpreter, and pin Unsupported where the translator has no lowering yet (as #4397 does). Python only, no game files, no GPU.
Also raised in #5361 by @JakubRasken, who found the same nine files across the batch.
Kam471
left a comment
There was a problem hiding this comment.
ISA check on the opcode this test models: "invalid instruction" on gfx1013 and gfx1030 (llvm-mc -arch=amdgcn -mcpu=<gpu>, LLVM 21).
v_perm_b32_u16has zero hits intools/rdna2_isa_tables.py,tools/rdna2spirv.pyanddocs/design.md.- gfx1013: and gfx1030
If the instruction is real but LLVM does not know it, the PR needs the ISA source and the correct encoding, and the test should say which GPU it exists on. If it is a spelling variant, please rename to the mnemonic LLVM accepts. As it stands the test exercises an opcode the project's RDNA2 translator cannot receive, in addition to the semantic guard failure noted above.
(Together with the guard failure this looks like a close-or-rework rather than a rebase.)
|
Review of 775c913: changes suggested. |
What
Adds reference oracle and semantic interpreter tests for
v_perm_b32_u16intests/semantic/test_valu_perm_b32_u16.py.Tested
python -I)python -m compileall -q tests(Passed)python -I tests/semantic/test_valu_perm_b32_u16.py(Passed)