tests/semantic: interp_ij_analysis's block split, reaching-write walk and f16 pair rules (TEST-INTERP-IJ-CFG) #1370

Merged
qhukz13 merged 2 commits from upstream-pr/1370 into main 2026-11-28 11:54:27 +00:00
qhukz13 commented 2026-11-24 22:45:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-24T22:45:17Z.


Claimed in the coordination issue as: TEST-INTERP-IJ-CFG (claim)

What and why

interp_ij_analysis in tools/rdna2spirv.py (SHADER-177, computed I/J pairs) decides which v_interp_p1/p2 pairs
read a barycentric pair the program computed, and refuses the ones it cannot model. Its refusals were tested on the
f32 pair in straight-line code only: with tools/semantic_mutants.py (#734), 22 of the function's 115 mutants
survived all 15 interpolation test files run together, and about 15 of them changed real behaviour.

This adds a ComputedIJControlFlow class to tests/semantic/test_interp_computed_ij.py with 12 cases:

  • the block split: a pair split only by a branch target (no branch between the ops), and s_branch having no
    fallthrough edge;
  • the reaching-write walk: a write that reaches the pair only through a taken branch, a write two blocks back, a
    loop that never writes the register (the walk must stop at blocks it has seen), a write after the pair, and an
    interp writing its own I register (a write at the site happens after the read);
  • the partner rules: a p2 before its p1 is a dangling op;
  • the f16 pair: two p2s naming one p1's partial (translated), the partial rewritten between the ops, the partial
    read between the ops as another p2's J (both refused), and the nearest p1 as the p2's partner.

Test only, no translator change. The --bary-fallback (#120) and --f16-interp-fallback refusals are left to
their own claims.

Tested

  • python -m unittest discover -s tests/semantic -p test_interp_computed_ij.py: 34 tests, OK.
  • python -I scripts/run_semantic_tests.py tests/semantic: 471 files, 6189 tests, 0 files failed.
  • tools/semantic_mutants.py --function interp_ij_analysis against the same 15 interpolation test files together
    (an aggregator that imports them): 109 of 115 mutants caught, was 93 of 115. The 6 left are the operand
    shape checks at the top of the site scan (len(a) < 2, the ors next to it, the partial guard) and
    last + 1 < len(insns), which differ only on operands or programs the decoder never produces.

No game files, no GPU (the suite runs on the CPU SPIR-V interpreter).

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption (CONTRIBUTING.md).
  • A new translator rule is in the contract table of docs/design.md. (Test only.)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5481586958 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1370). Originally posted by [qhukz13](https://github.com/qhukz13) on 2026-11-24T22:45:17Z. --- Claimed in the coordination issue as: TEST-INTERP-IJ-CFG ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143774321)) ### What and why `interp_ij_analysis` in `tools/rdna2spirv.py` (SHADER-177, computed I/J pairs) decides which `v_interp_p1/p2` pairs read a barycentric pair the program computed, and refuses the ones it cannot model. Its refusals were tested on the f32 pair in straight-line code only: with `tools/semantic_mutants.py` (#734), 22 of the function's 115 mutants survived all 15 interpolation test files run together, and about 15 of them changed real behaviour. This adds a `ComputedIJControlFlow` class to `tests/semantic/test_interp_computed_ij.py` with 12 cases: - the block split: a pair split only by a branch target (no branch between the ops), and `s_branch` having no fallthrough edge; - the reaching-write walk: a write that reaches the pair only through a taken branch, a write two blocks back, a loop that never writes the register (the walk must stop at blocks it has seen), a write after the pair, and an interp writing its own I register (a write at the site happens after the read); - the partner rules: a p2 before its p1 is a dangling op; - the f16 pair: two p2s naming one p1's partial (translated), the partial rewritten between the ops, the partial read between the ops as another p2's J (both refused), and the nearest p1 as the p2's partner. Test only, no translator change. The `--bary-fallback` (#120) and `--f16-interp-fallback` refusals are left to their own claims. ### Tested - `python -m unittest discover -s tests/semantic -p test_interp_computed_ij.py`: 34 tests, OK. - `python -I scripts/run_semantic_tests.py tests/semantic`: 471 files, 6189 tests, 0 files failed. - `tools/semantic_mutants.py --function interp_ij_analysis` against the same 15 interpolation test files together (an aggregator that imports them): **109 of 115** mutants caught, was 93 of 115. The 6 left are the operand shape checks at the top of the site scan (`len(a) < 2`, the `or`s next to it, the `partial` guard) and `last + 1 < len(insns)`, which differ only on operands or programs the decoder never produces. No game files, no GPU (the suite runs on the CPU SPIR-V interpreter). AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption (CONTRIBUTING.md). - [ ] A new translator rule is in the contract table of `docs/design.md`. (Test only.) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
PierreEbele commented 2026-11-25 15:09:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T15:09:12Z.


Reviewed 93dc391: ran the whole test_interp_computed_ij.py (34 OK) here and, with the PR file
copied in, on main (34 OK — no code changes, so coverage is the deliverable). check_no_game_data
clean. A probe confirms each new refusal fails exactly on its asserted message and the CFG cases are
pristine/computed as claimed. The repo's mutation harness over interp_ij_analysis (115 mutants):
old file 27 survive, this PR's file 8, and all mutants against the whole test_interp_* suite caught
109 — the 6 remaining are the equivalent kind (reachable only through malformed operand lists the
parser refuses). The new tests do close the gap the commit describes. No findings.
AI-assisted review.

Recommendation: Merge

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7166386456 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1370#issuecomment-7166386456). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T15:09:12Z. --- Reviewed 93dc391: ran the whole test_interp_computed_ij.py (34 OK) here and, with the PR file copied in, on main (34 OK — no code changes, so coverage is the deliverable). check_no_game_data clean. A probe confirms each new refusal fails exactly on its asserted message and the CFG cases are pristine/computed as claimed. The repo's mutation harness over interp_ij_analysis (115 mutants): old file 27 survive, this PR's file 8, and all mutants against the whole test_interp_* suite caught 109 — the 6 remaining are the equivalent kind (reachable only through malformed operand lists the parser refuses). The new tests do close the gap the commit describes. No findings. AI-assisted review. **Recommendation:** Merge
sodove commented 2026-11-28 10:44:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T10:44:08Z.


#1370 | head 091d1095fe93bd19dad55c8977a55f09cd5ac2da | python3 -m unittest discover -s tests/semantic -p test_interp_computed_ij.py -v | red: 34 passed | green: 34 passed | Passed on both trees

All 34 tests for interpolation block splits, reaching writes and f16 pairs already passed on pinned main. This PR adds coverage.

Captured 25 distinct complete SPIR-V module(s) emitted while rerunning test_interp_computed_ij.py on the merged tree. All assembled and passed spirv-val for Vulkan 1.2 with --allow-offset-texture-operand.

Base 3bd936ecd98995bca3e1da83d5e28d2343001aef was merged into the recorded PR head for the second run. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Counts include unittest subtest events where applicable. AI-assisted with OpenAI Codex. Batch claim.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238087760 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1370#issuecomment-7238087760). Originally posted by [sodove](https://github.com/sodove) on 2026-11-28T10:44:08Z. --- #1370 | head `091d1095fe93bd19dad55c8977a55f09cd5ac2da` | `python3 -m unittest discover -s tests/semantic -p test_interp_computed_ij.py -v` | red: 34 passed | green: 34 passed | **Passed on both trees** All 34 tests for interpolation block splits, reaching writes and f16 pairs already passed on pinned main. This PR adds coverage. Captured 25 distinct complete SPIR-V module(s) emitted while rerunning test_interp_computed_ij.py on the merged tree. All assembled and passed spirv-val for Vulkan 1.2 with --allow-offset-texture-operand. Base `3bd936ecd98995bca3e1da83d5e28d2343001aef` was merged into the recorded PR head for the second run. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Counts include unittest subtest events where applicable. AI-assisted with OpenAI Codex. [Batch claim](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7237873883).
DadaCap commented 2026-11-28 11:54:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T11:54:29Z.


Merged, thank you @qhukz13! This translator PR (tests/semantic: interp_ij_analysis's block split, reaching-write walk and f16 pair rules (TEST-INTERP-IJ-CFG)) passed its own tests with main merged in during sodove's verification of this batch, so it went in with the batch.

AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238861471 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1370#issuecomment-7238861471). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T11:54:29Z. --- Merged, thank you @qhukz13! This translator PR (tests/semantic: interp_ij_analysis's block split, reaching-write walk and f16 pair rules (TEST-INTERP-IJ-CFG)) passed its own tests with main merged in during sodove's verification of this batch, so it went in with the batch. AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1370
No description provided.