Skip to content

test(semantic): add translator tests for s_nand_b64 - #5646

Open
slopgobblercobbler wants to merge 8 commits into
ItsNotRexed:mainfrom
slopgobblercobbler:test/semantic-salu-nand-b64-suite
Open

slopgobblercobbler wants to merge 8 commits into
ItsNotRexed:mainfrom
slopgobblercobbler:test/semantic-salu-nand-b64-suite

Conversation

@slopgobblercobbler

Copy link
Copy Markdown
Contributor

What

Adds translator-backed regression tests and reference oracle for s_nand_b64 in tests/semantic/test_salu_nand_b64_hw.py.

Covers:

  • Reference mathematical model matching RDNA2 hardware specification: sdst = ~(ssrc0 & ssrc1) and SCC = (sdst != 0)
  • Structural AST operand typing and SGPR pair alignment validation
  • Deterministic scalar and multi-lane SIMD divergence under Wave32 / Wave64 EXEC masking
  • Register aliasing and in-place operand preservation
  • Condition code generation (SCC flag propagation)
  • IEEE 754 extreme boundary checks: signed zeros, subnormals, infinities, quiet NaNs
  • End-to-end SPIR-V assembly translation through tools/rdna2spirv.py via support.translate_lines
  • Fragment execution and MRT0 export verification with spirv_mini_interp

Tested

  • Tested with Python 3.9+ (python -I)
  • python -I tests/test_semantic_translator_use.py (Passes translator reachability check)
  • python -I tests/semantic/test_salu_nand_b64_hw.py (All test suites OK)
  • Standard library Python only (unittest, struct, math)
  • Clean merge against upstream/main
  • Strictly zero game data, binaries, or proprietary keys

@mrbean56

Copy link
Copy Markdown

Tested 441002a22c on Linux (Debian 13), Python 3.13.5: pass, mutation caught.

  • pytest tests/semantic/test_salu_nand_b64_hw.py -q: 18 passed.
  • Mutation: "nand": "OpBitwiseAnd" → OpBitwiseOr makes 2 tests fail, so the inverted result one half at a time is pinned.
  • This is the _hw sibling of test(semantic): add translator tests for s_nand_b64 #5628 (which tests the same op through the interpreter with 376 subtests); the two overlap but neither is redundant — this one keeps the SCC rule in a separate executable row.

No GPU, no game data. AI-assisted.

@kapitche

Copy link
Copy Markdown
Contributor

Tested 441002a merged with main 561b65a on Ubuntu (WSL2) / Python 3.12.16: pass

tests/semantic/test_salu_nand_b64_hw.py: 18 run, 18 passed, 0 failed (test-only PR, one file). Negative control: the tests pass on unmodified main code as expected (no source change); with a mutation in tools/rdna2spirv.py removing s_nand_b64 from the set that gets the final OpNot, 2 of 18 fail. Overlap note: open PR #5628 adds tests/semantic/test_salu_nand_b64.py for the same instruction, and #5849 adds a SALU 64-bit logic bundle that also covers s_nand_b64, so the three overlap in coverage.

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