test(semantic): align computed-I/J f16 interp oracle with toward-zero p2 narrow (TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ carry) #2633

Merged
aegish-zagi merged 1 commit from upstream-pr/2633 into main 2026-11-30 09:24:28 +00:00
aegish-zagi commented 2026-11-29 20:22:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aegish-zagi on 2026-11-29T20:22:43Z.


Claimed in the coordination issue as: TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ-CARRY — https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7261990077 (carry of zmasi's TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ, claimed at https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7256168778, offered for carry at https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7258235920 because zmasi is at the open-PR cap)

What and why

Carries zmasi's verified one-commit fix (3e478dcef, author unchanged — Zack/zmasi; aegish-zagi is committer only), cherry-picked onto current main c2a726196. #2239 and #1181 (SHADER-468, toward-zero v_interp_p2_f16 narrowing) merged back-to-back; tools/rdna2spirv.py already narrows toward zero, but two assertions in tests/semantic/test_interp_computed_ij_fallback.py still expected nearest-even, leaving semantic-tests red on main. The commit aligns the test oracle with toward-zero (f16_rtz / f16_rtz_bits). Test-only change; no translator code touched.

Tested

MEASURED on Linux, Python 3.12.3, this machine:

  • main c2a726196: tests/semantic/test_interp_computed_ij_fallback.py = 2 failed, 7 passed (the two toward-zero f16 assertions)
  • This branch: same file = 9 passed
  • Semantic subsets on this branch: test_*interp*.py = 270 passed; test_*f16*.py = 591 passed (45 skipped)
  • python -I scripts/check_no_game_data.py tests/semantic/test_interp_computed_ij_fallback.py = pass

GPUs tested: n/a (Profile Z: no free GPU)

AI-assisted: yes (Muse Wonder, Muse by Meta)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a — no new translator rule; test oracle only)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5554739329 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2633). Originally posted by [aegish-zagi](https://github.com/aegish-zagi) on 2026-11-29T20:22:43Z. --- Claimed in the coordination issue as: TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ-CARRY — https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7261990077 (carry of zmasi's TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ, claimed at https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7256168778, offered for carry at https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7258235920 because zmasi is at the open-PR cap) ### What and why Carries zmasi's verified one-commit fix (`3e478dcef`, author unchanged — Zack/zmasi; aegish-zagi is committer only), cherry-picked onto current `main` `c2a726196`. #2239 and #1181 (SHADER-468, toward-zero `v_interp_p2_f16` narrowing) merged back-to-back; `tools/rdna2spirv.py` already narrows toward zero, but two assertions in `tests/semantic/test_interp_computed_ij_fallback.py` still expected nearest-even, leaving `semantic-tests` red on `main`. The commit aligns the test oracle with toward-zero (`f16_rtz` / `f16_rtz_bits`). Test-only change; no translator code touched. ### Tested MEASURED on Linux, Python 3.12.3, this machine: - `main` `c2a726196`: `tests/semantic/test_interp_computed_ij_fallback.py` = 2 failed, 7 passed (the two toward-zero f16 assertions) - This branch: same file = 9 passed - Semantic subsets on this branch: `test_*interp*.py` = 270 passed; `test_*f16*.py` = 591 passed (45 skipped) - `python -I scripts/check_no_game_data.py tests/semantic/test_interp_computed_ij_fallback.py` = pass GPUs tested: n/a (Profile Z: no free GPU) AI-assisted: yes (Muse Wonder, Muse by Meta) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a — no new translator rule; test oracle only)
imShangLi commented 2026-11-29 20:27:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-11-29T20:27:12Z.


Static review: no blocker found.

  • The change is test-only and directly aligns the f16 oracle with the toward-zero v_interp_p2_f16 behavior from SHADER-468.
  • f16_rtz_bits handles NaN, infinity, overflow-to-finite, and positive finite values consistently with truncation toward zero.
  • The updated assertions use the same oracle for both reference and expected values, avoiding nearest-even rounding.
  • This dedicated one-topic carry is preferable to the overlapping hunk in #2566; if #2633 lands first, the integration PR should drop its duplicate hunk.

I did not execute the suite in this review. AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262091930 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2633#issuecomment-7262091930). Originally posted by [imShangLi](https://github.com/imShangLi) on 2026-11-29T20:27:12Z. --- Static review: no blocker found. - The change is test-only and directly aligns the f16 oracle with the toward-zero `v_interp_p2_f16` behavior from SHADER-468. - `f16_rtz_bits` handles NaN, infinity, overflow-to-finite, and positive finite values consistently with truncation toward zero. - The updated assertions use the same oracle for both reference and expected values, avoiding nearest-even rounding. - This dedicated one-topic carry is preferable to the overlapping hunk in #2566; if #2633 lands first, the integration PR should drop its duplicate hunk. I did not execute the suite in this review. AI-assisted: yes.
merzleckeier commented 2026-11-29 20:28:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T20:28:28Z.


Independent full-suite A/B for 71db4c40 on CachyOS, Python 3.14.10 and SPIRV-Tools 2026.4, CPU only. Base was current main edf0ff5d with #2626 at fcc044cd applied (efa3de8d). The other tree (69926466) adds this PR's exact test file as its only change.

  • MEASURED, full suite. LEONIDA_REQUIRE_SPIRV_TOOLS=1 python -I scripts/run_semantic_tests.py tests/semantic -v -j 6. Both trees discovered 6,526 tests in 529 files. The base had two assertion failures in test_interp_computed_ij_fallback.py. With this PR, zero files failed. Both trees reported the same two skips and one expected failure.
  • MEASURED, focused. 7/9 on base and 9/9 with this PR. For a separate test of the assertions, I locally switched only the lowering of v_interp_p2_f16 to nearest-even. The same two cases turned red with their expected and actual values reversed, including 0x4400 versus 0x43ff. The suite above used the original translator.

Synthetic inputs only. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262108583 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2633#issuecomment-7262108583). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T20:28:28Z. --- Independent full-suite A/B for `71db4c40` on CachyOS, Python 3.14.10 and SPIRV-Tools 2026.4, CPU only. Base was current `main` `edf0ff5d` with #2626 at `fcc044cd` applied (`efa3de8d`). The other tree (`69926466`) adds this PR's exact test file as its only change. - **MEASURED, full suite.** `LEONIDA_REQUIRE_SPIRV_TOOLS=1 python -I scripts/run_semantic_tests.py tests/semantic -v -j 6`. Both trees discovered 6,526 tests in 529 files. The base had two assertion failures in `test_interp_computed_ij_fallback.py`. With this PR, zero files failed. Both trees reported the same two skips and one expected failure. - **MEASURED, focused.** 7/9 on base and 9/9 with this PR. For a separate test of the assertions, I locally switched only the lowering of `v_interp_p2_f16` to nearest-even. The same two cases turned red with their expected and actual values reversed, including `0x4400` versus `0x43ff`. The suite above used the original translator. Synthetic inputs only. AI-assisted with OpenAI Codex.
fiestorra commented 2026-11-29 20:32:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-29T20:32:53Z.


Independent verification, since this is the one job still red on main (semantic-tests (ubuntu-latest)).

Cherry-picked onto origin/main edf0ff5d0 - one file, +32 -6, no conflicts:

python3 -m pytest tests/semantic/test_interp_computed_ij_fallback.py -q
main        -> 2 failed, 7 passed, 13 subtests passed
with this   -> 9 passed, 13 subtests passed

So it does what the title says, on the current tree. It is also the same change I derived independently (and which rides inside my three open pull requests), so there is nothing
of mine to add to it - and my queued entry for TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ is now redundant with this pull request.

One note for the merge order: if this lands first, the interp commit inside #1923, #1937 and #2145 becomes a duplicate and those branches can drop it; if one of them lands first,
this one becomes a no-op. Either order ends with the same tree, which is why I am not pushing one over the other.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262167390 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2633#issuecomment-7262167390). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-29T20:32:53Z. --- Independent verification, since this is the one job still red on `main` (`semantic-tests (ubuntu-latest)`). Cherry-picked onto `origin/main` `edf0ff5d0` - one file, `+32 -6`, no conflicts: ``` python3 -m pytest tests/semantic/test_interp_computed_ij_fallback.py -q main -> 2 failed, 7 passed, 13 subtests passed with this -> 9 passed, 13 subtests passed ``` So it does what the title says, on the current tree. It is also the same change I derived independently (and which rides inside my three open pull requests), so there is nothing of mine to add to it - and my queued entry for `TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ` is now redundant with this pull request. One note for the merge order: if this lands first, the interp commit inside #1923, #1937 and #2145 becomes a duplicate and those branches can drop it; if one of them lands first, this one becomes a no-op. Either order ends with the same tree, which is why I am not pushing one over the other. Written with an AI assistant.
fiestorra commented 2026-11-30 05:56:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T05:56:07Z.


Verified on this machine (Windows 11, Python 3.13.14), and the negative control bites - which matters more than usual here, because this is the commit several of my branches carry to turn semantic-tests green.

1. It applies. merge-tree clean; 71db4c405 cherry-picks onto main 1d22590b9 without a conflict. One file: tests/semantic/test_interp_computed_ij_fallback.py.

2. With the change:

python3 -m pytest tests/semantic/test_interp_computed_ij_fallback.py -q
  -> 9 passed, 13 subtests

3. Without it - the same test file against main:

-> 2 failed, 7 passed, 13 subtests
   FAILED ComputedIJDerivativeFallbackTests::test_p1lv_f…
   FAILED ComputedIJDerivativeFallbackTests::test_perspe…
   E  AssertionError: 17407 != 17408
   E  AssertionError: 0.07745361328125 != 0.0775146484375

So main's oracle is one ulp off on the toward-zero narrowing (17407 instead of 17408, and 0.07745361328125 instead of 0.0775146484375 = the next f16 step), and this commit is what makes the test pass. That is a real red->green, not a test agreeing with itself.

A note for whoever merges: this commit is also carried inside several other open pull requests (mine among them) because semantic-tests is red on main and every branch cut from it inherits that. Whichever lands first makes the others' copies redundant - they are the same edit, a parameter named x versus val, so a rebase drops them cleanly and a conflict on this file resolves by taking either side.

What I did not test: the translator that consumes the oracle. The test computes expected f16 bits in Python and compares them against the recorded expectation; whether v_interp_p2_f16 in the real pipeline matches this rounding needs a shader run, which this machine cannot do without the game's shaders.rpf.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7270144483 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2633#issuecomment-7270144483). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-30T05:56:07Z. --- Verified on this machine (Windows 11, Python 3.13.14), and **the negative control bites** - which matters more than usual here, because this is the commit several of my branches carry to turn `semantic-tests` green. **1. It applies.** `merge-tree` clean; `71db4c405` cherry-picks onto `main` `1d22590b9` without a conflict. One file: `tests/semantic/test_interp_computed_ij_fallback.py`. **2. With the change:** ``` python3 -m pytest tests/semantic/test_interp_computed_ij_fallback.py -q -> 9 passed, 13 subtests ``` **3. Without it - the same test file against `main`:** ``` -> 2 failed, 7 passed, 13 subtests FAILED ComputedIJDerivativeFallbackTests::test_p1lv_f… FAILED ComputedIJDerivativeFallbackTests::test_perspe… E AssertionError: 17407 != 17408 E AssertionError: 0.07745361328125 != 0.0775146484375 ``` So `main`'s oracle is **one ulp off** on the toward-zero narrowing (`17407` instead of `17408`, and `0.07745361328125` instead of `0.0775146484375` = the next f16 step), and this commit is what makes the test pass. That is a real red->green, not a test agreeing with itself. **A note for whoever merges:** this commit is also **carried inside several other open pull requests** (mine among them) because `semantic-tests` is red on `main` and every branch cut from it inherits that. Whichever lands first makes the others' copies redundant - they are the **same edit**, a parameter named `x` versus `val`, so a rebase drops them cleanly and a conflict on this file resolves by taking either side. **What I did not test:** the translator that consumes the oracle. The test computes expected f16 bits in Python and compares them against the recorded expectation; whether `v_interp_p2_f16` in the real pipeline matches this rounding needs a shader run, which this machine cannot do without the game's `shaders.rpf`. Written with an AI assistant.
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!2633
No description provided.