tests/semantic: SALU instructions leave SCC exactly 0 or 1, read back through src_scc (OLD-9634) #661

Manually merged
github merged 1 commit from gh-pr/661/head into gh-pr/661/base 2026-11-26 09:14:44 +00:00
Owner

@⁠qhukz13 on GitHub · 2026-11-24 11:13 UTC · original
qhukz13:cont/salu-scc-value → main · +116 −0 · 1 files · 1 commits · merged 2026-11-24 16:06 UTC

Claimed in the coordination issue as: OLD-9634 (restoration of ItsNotRexed/Leonida#9634, closed unmerged when that repository went private)

SCC checks in the suite mostly go through s_cselect_b32 / s_cbranch_scc*, which only see zero vs non-zero, while s_addc_u32, s_subb_u32 and src_scc read SCC as a number. test_salu_scc_value.py runs 63 hand-written cases over 48 SOP1/SOP2/SOPC instructions (each with an SCC = 1 case), copies SCC with v_mov_b32 v0, src_scc and checks the exported word.

Why it is needed: with the nine inline OpSelect ... 1 0 -> OpStore %scc writes in rdna2spirv.py mutated to store 2, the existing suite passes and this file fails 10 instructions; with all 12 such writes mutated it fails 22 (measured on the original upstream base).

Test only, no translator change. Tested: python -m unittest discover -s tests/semantic -p test_salu_scc_value.py (OK) on main 21625bca8, Linux, CPU interpreter; no GPU needed. No game files.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠qhukz13** on GitHub · 2026-11-24 11:13 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/661) `qhukz13:cont/salu-scc-value` → `main` · +116 −0 · 1 files · 1 commits · merged 2026-11-24 16:06 UTC Claimed in the coordination issue as: OLD-9634 (restoration of ItsNotRexed/Leonida#9634, closed unmerged when that repository went private) SCC checks in the suite mostly go through `s_cselect_b32` / `s_cbranch_scc*`, which only see zero vs non-zero, while `s_addc_u32`, `s_subb_u32` and `src_scc` read SCC as a number. `test_salu_scc_value.py` runs 63 hand-written cases over 48 SOP1/SOP2/SOPC instructions (each with an SCC = 1 case), copies SCC with `v_mov_b32 v0, src_scc` and checks the exported word. Why it is needed: with the nine inline `OpSelect ... 1 0 -> OpStore %scc` writes in `rdna2spirv.py` mutated to store 2, the existing suite passes and this file fails 10 instructions; with all 12 such writes mutated it fails 22 (measured on the original upstream base). Test only, no translator change. Tested: `python -m unittest discover -s tests/semantic -p test_salu_scc_value.py` (OK) on `main` 21625bca8, Linux, CPU interpreter; no GPU needed. No game files. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
SCC checks in the suite mostly go through s_cselect_b32 / s_cbranch_scc*, which only see zero vs non-zero, while
s_addc_u32, s_subb_u32 and src_scc read SCC as a number. test_salu_scc_value.py runs 63 hand-written cases over
48 SOP1/SOP2/SOPC instructions (every one with an SCC = 1 case), copies SCC with `v_mov_b32 v0, src_scc` and
checks the exported word. With the nine inline `OpSelect ... 1 0 -> OpStore %scc` writes in rdna2spirv.py
mutated to store 2, the existing suite passes and this file fails 10 instructions; with all 12 such writes
(set_scc and the lane-mask votes included) it fails 22.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:14:42 +00:00
github manually merged commit 65e13e0250 into gh-pr/661/base 2026-11-26 09:14:44 +00:00
Author
Owner

@⁠trigger337 on GitHub · 2026-11-24 11:42 UTC · original

agent: yes
AI-assisted: yes

Hardware/CPU validation on Linux (x86_64, Python 3.14):

  1. Semantic Tests:
    • python3 -m unittest discover -s tests/semantic -p test_salu_scc_value.py -v:
      • test_each_instruction_has_a_case_with_scc_set: PASS (asserts coverage across all 48 SALU instructions).
      • test_every_case: PASS (63 subtests validating exact numerical values 0 and 1 exported via src_scc).
  2. CI Registration & Clean-room Checks:
    • tests/test_ci_registration.py: 15/15 passed (confirms test file is properly registered for CI execution).
    • scripts/check_no_game_data.py: clean.
**@⁠trigger337** on GitHub · 2026-11-24 11:42 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/661#issuecomment-7130451941) agent: yes AI-assisted: yes Hardware/CPU validation on Linux (x86_64, Python 3.14): 1. **Semantic Tests**: - `python3 -m unittest discover -s tests/semantic -p test_salu_scc_value.py -v`: - `test_each_instruction_has_a_case_with_scc_set`: PASS (asserts coverage across all 48 SALU instructions). - `test_every_case`: PASS (63 subtests validating exact numerical values 0 and 1 exported via `src_scc`). 2. **CI Registration & Clean-room Checks**: - `tests/test_ci_registration.py`: 15/15 passed (confirms test file is properly registered for CI execution). - `scripts/check_no_game_data.py`: clean.
This discussion has been locked. Commenting is limited to contributors.
No description provided.