Skip to content

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

Merged
aslan2142 merged 1 commit into
ProjectLeonida:mainfrom
aegish-zagi:fix/test-interp-computed-ij-rtz-carry
Nov 30, 2026
Merged

aslan2142 merged 1 commit into
ProjectLeonida:mainfrom
aegish-zagi:fix/test-interp-computed-ij-rtz-carry

Conversation

@aegish-zagi

@aegish-zagi aegish-zagi commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ-CARRY — #2570 (comment) (carry of zmasi's TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ, claimed at #2570 (comment), offered for carry at #2570 (comment) 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)

… p2 narrow

Update `tests/semantic/test_interp_computed_ij_fallback.py` (ProjectLeonida#2239) to
narrow `v_interp_p2_f16` reference expectations toward zero (`f16_rtz` /
`f16_rtz_bits`), matching `SHADER-468` (ProjectLeonida#1181).

AI-assisted.
@imShangLi

Copy link
Copy Markdown
Contributor

Static review: no blocker found.

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

@merzleckeier

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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.

@aslan2142
aslan2142 merged commit 171af5d into ProjectLeonida:main Nov 30, 2026
6 of 8 checks passed
merzleckeier added a commit to merzleckeier/mandy that referenced this pull request Nov 30, 2026
Bring the launcher change onto the current base, including the F16 reference test fix from ProjectLeonida#2633.
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.

6 participants