Skip to content

test(semantic): add SALU 64-bit logic bundle suite - #5849

Open
slopgobblercobbler wants to merge 33 commits into
ItsNotRexed:mainfrom
slopgobblercobbler:test/semantic-salu-logic-b64-bundle
Open

slopgobblercobbler wants to merge 33 commits into
ItsNotRexed:mainfrom
slopgobblercobbler:test/semantic-salu-logic-b64-bundle

Conversation

@slopgobblercobbler

Copy link
Copy Markdown
Contributor

Summary

Implement Bundle 4 (SALU 64-bit Logic Suite, 32 commits) in tests/semantic/test_salu_logic_b64_bundle.py.

Coverage

Comprehensive test suite covering all 8 RDNA2 64-bit scalar ALU bitwise logic operations:

  • s_and_b64: D = S0 & S1, SCC = (D != 0)
  • s_or_b64: D = S0 | S1, SCC = (D != 0)
  • s_xor_b64: D = S0 ^ S1, SCC = (D != 0)
  • s_andn2_b64: D = S0 & ~S1, SCC = (D != 0)
  • s_orn2_b64: D = S0 | ~S1, SCC = (D != 0)
  • s_nand_b64: D = ~(S0 & S1), SCC = (D != 0)
  • s_nor_b64: D = ~(S0 | S1), SCC = (D != 0)
  • s_xnor_b64: D = ~(S0 ^ S1), SCC = (D != 0)

Staging Structure (4 granular commits per opcode, 32 commits total)

For each opcode:

  1. Reference mathematical oracle and bitwise truth table modeling.
  2. Symbolic AST instruction representation, operand typing, and scalar register state machine step evaluation.
  3. 64-bit mask divergence patterns, all-zeros / all-ones boundary conditions, alternating bit patterns, and lo/hi dword independence.
  4. SPIR-V translator integration via rdna2spirv, shader execution verification through spirv_mini_interp, SCC status flag verification (zero and nonzero), and syntax rejection controls.

Verification

  • py -3.10 -I tests/semantic/test_salu_logic_b64_bundle.py
  • py -3.10 -I tests/test_semantic_translator_use.py
  • py -3.10 -m compileall -q tests

@kapitche

Copy link
Copy Markdown
Contributor

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

tests/semantic/test_salu_logic_b64_bundle.py: 96 run, 96 passed, 0 failed (test-only PR, one file). Negative control: the new tests pass on unmodified main code as expected (nothing to revert); with a mutation in tools/rdna2spirv.py making s_nand/s_nor/s_xnor_b64 skip the final OpNot (inv = False), 6 of 96 fail. I did not check the "hardware-verified" claim in the docstring (no hardware run).

@BeegSchmooze

Copy link
Copy Markdown

Mutation check of the current head with a generic run (tools/semantic_mutants.py --op s_and_b64, #6548; the branch handles all eight ops). The file passes as submitted. 13 of 17 mutants caught. Windows 11, Python 3.13.

Survivors:

  • SCC from the 64-bit result (SCC = (lo | hi) != 0, ~line 10043): | → &, | → ^, and "low half only" all survive. SCC is checked through s_cselect_b32, but every case's result has both halves zero or both non-zero, and those are exactly the results where the variants agree. Two cases would pin it: a result with only the low half set (e.g. s_and_b64 of 0x00000000_FFFFFFFF and 0x00000000_0000000F: SCC 1, the & variant gives 0) and one with only the high half set (e.g. 0xF0000000_00000000: the low-half-only variant gives 0).
  • The lane-mask path (EXEC/VCC destination or a mask source, ~line 10016) ignoring S1 survives, as in test(semantic): add hardware translator tests for s_and_b64 #5810: no case reaches that path.

AI-assisted (Claude Code). No game files.

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