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

Open
opened 2026-11-26 20:21:08 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1370
Author: @qhukz13
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: cont/interp-ij-cfg


📝 Commits (2)

  • 93dc391 tests/semantic: interp_ij_analysis's block split, reaching-write walk and f16 pair rules
  • 091d109 Merge main into cont/interp-ij-cfg

📊 Changes

1 file changed (+121 additions, -0 deletions)

View changed files

📝 tests/semantic/test_interp_computed_ij.py (+121 -0)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1370 **Author:** [@qhukz13](https://github.com/qhukz13) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `cont/interp-ij-cfg` --- ### 📝 Commits (2) - [`93dc391`](https://github.com/ubiquitarianism/leonida/commit/93dc391dcaf2c3960fa61c83fa8036a878fe342d) tests/semantic: interp_ij_analysis's block split, reaching-write walk and f16 pair rules - [`091d109`](https://github.com/ubiquitarianism/leonida/commit/091d1095fe93bd19dad55c8977a55f09cd5ac2da) Merge main into cont/interp-ij-cfg ### 📊 Changes **1 file changed** (+121 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tests/semantic/test_interp_computed_ij.py` (+121 -0) </details> ### 📄 Description 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1400
No description provided.