tests: build.py and check.py pick the f16 interpolation fallback from the device (TEST-CHECK-F16-FALLBACK) #822

Merged
hugo0024 merged 1 commit from upstream-pr/822 into main 2026-11-28 21:51:44 +00:00
hugo0024 commented 2026-11-24 14:12:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by hugo0024 on 2026-11-24T14:12:59Z.


Claimed in the coordination issue as: TEST-CHECK-F16-FALLBACK (claim)

What and why

scripts/run_gpu_tests.py and make_game.py translate with --f16-interp-fallback by themselves where tools/vk_subgroup_info.py reports per_vertex_inputs false (MoltenVK). runtime/test/shaders/build.py and check.py did so only with LEONIDA_F16_INTERP_FALLBACK=1. So the two-step form on a Mac built ps_ij_computed and ps_interp_f16_high for PerVertexKHR inputs, and check.py reported both as "vk_harness failed or returned no pixels". Every Apple record lists those two as check.py-only failures (#552, #564, #785).

Both scripts now ask the device when the variable is unset, the way they already do for the barycentric fallback:

  • build.py: f16_interp_fallback() replaces the two == "1" reads (the translator flag, and leaving ps_ij_computed out).
  • check.py: F16_HALVES comes from the same rule, so the two scripts agree on how the shaders were translated.
  • The variable takes 1/0 (and true/false, yes/no, on/off), as run_gpu_tests.py reads it. Before, only 1 meant anything here.
  • A device that gives no answer leaves the fallback off, as before.
  • docs/testing.md: the two paragraphs that said build.py translates with the flag only when the variable is 1.

run_gpu_tests.py is unchanged. The open claim for computed I/J pairs under this fallback (comment) is a translator change and is not touched here.

Tested

Apple M5, MoltenVK 1.4.2, at main d0da7dade. The two-step form, build.py then check.py:

LEONIDA_F16_INTERP_FALLBACK Before After
unset 281 built; 175 of 220 pass, 39 skipped, 6 failed 280 built; 176 of 220 pass, 40 skipped, 4 failed
0 same as unset 281 built; 175 of 220 pass, 39 skipped, 6 failed
1 280 built; 176 of 220 pass, 40 skipped, 4 failed same as before
  • The two failures that go away are ps_interp_f16_high (now ok) and ps_ij_computed (now SKIP, and not built). The four left are cs_fma_fused, cs_imgload_tfe, cs_imgload_d16_tfe and the intermittent ps_imgatomic (#543), which passed in the 1 run after the change, giving 177 there.
  • After the change, the modules built with the variable unset are byte-identical to those built with 1 (280 of 280).
  • tests/test_shader_build_fallbacks.py: 8 tests OK. The probe is pinned in run_build, so the file no longer depends on the GPU of the machine running it. Without the source change the three new tests fail.
  • run_gpu_tests.py: 184/249 passed, 61 skipped, 4 failed (the same four; 185 when ps_imgatomic passes). ctest: 72/72.
  • Translator suite: 465 files, 6108 tests, 0 files failed. pytest files: 1868 passed, 18 skipped, as on main.
  • Standard-library loop: 484 files, 2 failed, tests/test_tool_startup.py and tests/test_tool_stdout_encoding.py. Both fail the same way on untouched main d0da7dade, over tools/native_pso_hashes.py.
  • tests/test_docs_*.py and tests/test_i18n_index.py pass.

Not tested: a device without VK_KHR_fragment_shader_barycentric (llvmpipe, NVIDIA Pascal), where per_vertex_inputs is false too. There the two-step form now takes the path run_gpu_tests.py already takes: vertex shaders also export the decoded halves, ps_interp_f16_high reads them and ps_ij_computed is left out. The CMake fixtures built through build.py follow the same rule; on this Mac ctest passes with them.

GPUs tested: Apple M5 (8-core GPU), MoltenVK 1.4.2, macOS 27.2.1 (26B131)

AI-assisted: yes

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.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5473806140 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/822). Originally posted by [hugo0024](https://github.com/hugo0024) on 2026-11-24T14:12:59Z. --- Claimed in the coordination issue as: TEST-CHECK-F16-FALLBACK ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7133634583)) ### What and why `scripts/run_gpu_tests.py` and `make_game.py` translate with `--f16-interp-fallback` by themselves where `tools/vk_subgroup_info.py` reports `per_vertex_inputs` false (MoltenVK). `runtime/test/shaders/build.py` and `check.py` did so only with `LEONIDA_F16_INTERP_FALLBACK=1`. So the two-step form on a Mac built `ps_ij_computed` and `ps_interp_f16_high` for PerVertexKHR inputs, and `check.py` reported both as "vk_harness failed or returned no pixels". Every Apple record lists those two as `check.py`-only failures (#552, #564, #785). Both scripts now ask the device when the variable is unset, the way they already do for the barycentric fallback: - `build.py`: `f16_interp_fallback()` replaces the two `== "1"` reads (the translator flag, and leaving `ps_ij_computed` out). - `check.py`: `F16_HALVES` comes from the same rule, so the two scripts agree on how the shaders were translated. - The variable takes `1`/`0` (and `true`/`false`, `yes`/`no`, `on`/`off`), as `run_gpu_tests.py` reads it. Before, only `1` meant anything here. - A device that gives no answer leaves the fallback off, as before. - `docs/testing.md`: the two paragraphs that said `build.py` translates with the flag only when the variable is `1`. `run_gpu_tests.py` is unchanged. The open claim for computed I/J pairs under this fallback ([comment](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7130173128)) is a translator change and is not touched here. ### Tested Apple M5, MoltenVK 1.4.2, at `main` `d0da7dade`. The two-step form, `build.py` then `check.py`: | `LEONIDA_F16_INTERP_FALLBACK` | Before | After | |---|---|---| | unset | 281 built; 175 of 220 pass, 39 skipped, 6 failed | 280 built; 176 of 220 pass, 40 skipped, 4 failed | | `0` | same as unset | 281 built; 175 of 220 pass, 39 skipped, 6 failed | | `1` | 280 built; 176 of 220 pass, 40 skipped, 4 failed | same as before | - The two failures that go away are `ps_interp_f16_high` (now `ok`) and `ps_ij_computed` (now `SKIP`, and not built). The four left are `cs_fma_fused`, `cs_imgload_tfe`, `cs_imgload_d16_tfe` and the intermittent `ps_imgatomic` (#543), which passed in the `1` run after the change, giving 177 there. - After the change, the modules built with the variable unset are byte-identical to those built with `1` (280 of 280). - `tests/test_shader_build_fallbacks.py`: 8 tests OK. The probe is pinned in `run_build`, so the file no longer depends on the GPU of the machine running it. Without the source change the three new tests fail. - `run_gpu_tests.py`: 184/249 passed, 61 skipped, 4 failed (the same four; 185 when `ps_imgatomic` passes). `ctest`: 72/72. - Translator suite: 465 files, 6108 tests, 0 files failed. pytest files: 1868 passed, 18 skipped, as on `main`. - Standard-library loop: 484 files, 2 failed, `tests/test_tool_startup.py` and `tests/test_tool_stdout_encoding.py`. Both fail the same way on untouched `main` `d0da7dade`, over `tools/native_pso_hashes.py`. - `tests/test_docs_*.py` and `tests/test_i18n_index.py` pass. Not tested: a device without `VK_KHR_fragment_shader_barycentric` (llvmpipe, NVIDIA Pascal), where `per_vertex_inputs` is false too. There the two-step form now takes the path `run_gpu_tests.py` already takes: vertex shaders also export the decoded halves, `ps_interp_f16_high` reads them and `ps_ij_computed` is left out. The CMake fixtures built through `build.py` follow the same rule; on this Mac `ctest` passes with them. GPUs tested: Apple M5 (8-core GPU), MoltenVK 1.4.2, macOS 27.2.1 (26B131) AI-assisted: yes ### 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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
abnalstlll-byte commented 2026-11-24 14:22:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:22:12Z.

Review: APPROVED


Clean-Room Peer Review for PR #822 (tests: build.py and check.py pick the f16 interpolation fallback from the device)

Excellent cross-platform graphics test harness parity:

  • Device Probe Alignment: Reconciles
    untime/test/shaders/build.py and check.py with scripts/run_gpu_tests.py by querying ools/vk_subgroup_info.py for per_vertex_inputs support.
  • MoltenVK & Metal Parity: Automatically selects --f16-interp-fallback on devices lacking PerVertexKHR decoration (e.g., MoltenVK on macOS/Metal), gracefully skipping ps_ij_computed and allowing ps_interp_f16_high to pass without requiring manual env vars.
  • Explicit Override Controls: Respects LEONIDA_F16_INTERP_FALLBACK=1 (force on) and
<!-- greyfinch-sync:ubiquitarianism/leonida:review:6040926423 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/822#pullrequestreview-6040926423). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T14:22:12Z. **Review:** APPROVED --- ### Clean-Room Peer Review for PR #822 (tests: build.py and check.py pick the f16 interpolation fallback from the device) Excellent cross-platform graphics test harness parity: - **Device Probe Alignment**: Reconciles untime/test/shaders/build.py and check.py with scripts/run_gpu_tests.py by querying ools/vk_subgroup_info.py for per_vertex_inputs support. - **MoltenVK & Metal Parity**: Automatically selects --f16-interp-fallback on devices lacking PerVertexKHR decoration (e.g., MoltenVK on macOS/Metal), gracefully skipping ps_ij_computed and allowing ps_interp_f16_high to pass without requiring manual env vars. - **Explicit Override Controls**: Respects LEONIDA_F16_INTERP_FALLBACK=1 (force on) and
abnalstlll-byte commented 2026-11-24 14:22:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:22:51Z.

Review: APPROVED


Clean-room verified (zero game data). Device probe fallback for 16-bit interpolation without PerVertexKHR (MoltenVK) cleanly mirrors run_gpu_tests.py. Unit tests pass (tests/test_shader_build_fallbacks.py: 5/5 PASS).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6040938840 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/822#pullrequestreview-6040938840). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T14:22:51Z. **Review:** APPROVED --- Clean-room verified (zero game data). Device probe fallback for 16-bit interpolation without PerVertexKHR (MoltenVK) cleanly mirrors run_gpu_tests.py. Unit tests pass (tests/test_shader_build_fallbacks.py: 5/5 PASS).
Tauwni commented 2026-11-25 10:44:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-25T10:44:07Z.


This conflicts with #1444 in runtime/test/shaders/build.py: both add a block right after barycentric_fallback() (#1444 TEXT_ONLY_MARK and text_only_listing(), this PR f16_interp_fallback_override() and f16_interp_fallback()). Git stops on that one hunk; the rest merges. The resolution is to keep both blocks, #1444's first:

def barycentric_fallback():
    ...
        return False


# A comment line a .asm carries when llvm-mc cannot assemble it (cs_dpp_cmp.asm: a VOPC compare in DPP form).
# scripts/run_gpu_tests.py has the same line; tests/test_shader_build_text_only.py checks that the two agree.
TEXT_ONLY_MARK = "; run_gpu_tests: text only, llvm-mc has no gfx1013 encoding for an instruction here"


def text_only_listing(name, raw):
    ...  # unchanged from #1444


def f16_interp_fallback_override():
    ...  # unchanged from this PR


def f16_interp_fallback():
    ...  # unchanged from this PR

Checked on an Apple M3 (macOS 26.5.1) with both merged that way on main 57ba40bd6, together with #1518, #1724, #1212, #1673, #1657, #1412 and #1375: tests/test_shader_build_text_only.py and tests/test_shader_build_fallbacks.py OK; build.py 296/296 translated and valid; check.py on MoltenVK 1.4.2 186 of 231 pass, 44 skipped, and the one failure is ps_ssharp (Metal takes no sampler LOD bias). With this PR ps_interp_f16_high is ok and ps_ij_computed is skipped with its reason, where main reports "vk_harness failed" for both. Whichever of the two lands second needs only this hunk. AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7160101147 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/822#issuecomment-7160101147). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-25T10:44:07Z. --- This conflicts with #1444 in `runtime/test/shaders/build.py`: both add a block right after `barycentric_fallback()` (#1444 `TEXT_ONLY_MARK` and `text_only_listing()`, this PR `f16_interp_fallback_override()` and `f16_interp_fallback()`). Git stops on that one hunk; the rest merges. The resolution is to keep both blocks, #1444's first: ```python def barycentric_fallback(): ... return False # A comment line a .asm carries when llvm-mc cannot assemble it (cs_dpp_cmp.asm: a VOPC compare in DPP form). # scripts/run_gpu_tests.py has the same line; tests/test_shader_build_text_only.py checks that the two agree. TEXT_ONLY_MARK = "; run_gpu_tests: text only, llvm-mc has no gfx1013 encoding for an instruction here" def text_only_listing(name, raw): ... # unchanged from #1444 def f16_interp_fallback_override(): ... # unchanged from this PR def f16_interp_fallback(): ... # unchanged from this PR ``` Checked on an Apple M3 (macOS 26.5.1) with both merged that way on `main` `57ba40bd6`, together with #1518, #1724, #1212, #1673, #1657, #1412 and #1375: `tests/test_shader_build_text_only.py` and `tests/test_shader_build_fallbacks.py` OK; `build.py` 296/296 translated and valid; `check.py` on MoltenVK 1.4.2 186 of 231 pass, 44 skipped, and the one failure is `ps_ssharp` (Metal takes no sampler LOD bias). With this PR `ps_interp_f16_high` is ok and `ps_ij_computed` is skipped with its reason, where `main` reports "vk_harness failed" for both. Whichever of the two lands second needs only this hunk. AI-assisted (Claude Code).
OreoFR commented 2026-11-28 21:44:08 +00:00 (Migrated from github.com)

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


Verified by OreoFR

Run 1 (win02)

  • Base: main 5cb45921e + PR head 6064cbbb4; green run in a merge package of 2 PRs, no new ctest failure vs main
  • Test: python -I tests/test_shader_build_fallbacks.py ; package ctest
  • Red on main: 2 FAIL + 20 ERROR (AttributeError f16_interp_fallback in build.py and check.py; the translator does not get the f16 flag the device asks for): the missing function itself
  • Green with the PR: 9 OK, package with no new ctest failure
  • Verdict: READY

Run 2 (lot 4)

  • Base: main 09c153948 + PR head 6064cbbb4; integration package 3 of 6 (4 PRs, merged without conflict)
  • Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; the PRs' Python tests
  • Red on main: n/a (integration test; main baseline: xbox_present and d3d12_set_descriptor_heaps)
  • Green with the PR: ctest: only xbox_present and d3d12_set_descriptor_heaps fail, as on main; tests/test_shader_build_fallbacks.py PASS
  • Verdict: CLEAN PACKAGE (no new failure vs main)

Run 3 (lot 4 bis)

  • Base: main 33db04a70 + PR head 6064cbbb4; integration package of 15 PRs
  • Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; the PRs' Python tests; translator suite
  • Red on main: 2 failures, 20 errors (python -I tests/test_shader_build_fallbacks.py)
  • Green with the PR: OK; ctest: only xbox_present fails as on main (xs_proxy_mock failed once, flaky: passes on rerun and 5/5 direct runs); Python: same failures as main, the PRs' tests pass; translator: 507 files, 6405 tests, 0 failures
  • Verdict: READY (no new failure vs main; #822 and #1444 conflict trivially with each other in runtime/test/shaders/build.py (two function blocks added at the same place), whichever merges second needs a rebase)

All runs

  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246233526 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/822#issuecomment-7246233526). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T21:44:08Z. --- **Verified by OreoFR** **Run 1 (win02)** - Base: main `5cb45921e` + PR head `6064cbbb4`; green run in a merge package of 2 PRs, no new ctest failure vs main - Test: `python -I tests/test_shader_build_fallbacks.py ; package ctest` - Red on main: 2 FAIL + 20 ERROR (AttributeError f16_interp_fallback in build.py and check.py; the translator does not get the f16 flag the device asks for): the missing function itself - Green with the PR: 9 OK, package with no new ctest failure - Verdict: READY **Run 2 (lot 4)** - Base: main `09c153948` + PR head `6064cbbb4`; integration package 3 of 6 (4 PRs, merged without conflict) - Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; the PRs' Python tests - Red on main: n/a (integration test; main baseline: xbox_present and d3d12_set_descriptor_heaps) - Green with the PR: ctest: only xbox_present and d3d12_set_descriptor_heaps fail, as on main; tests/test_shader_build_fallbacks.py PASS - Verdict: CLEAN PACKAGE (no new failure vs main) **Run 3 (lot 4 bis)** - Base: main `33db04a70` + PR head `6064cbbb4`; integration package of 15 PRs - Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; the PRs' Python tests; translator suite - Red on main: 2 failures, 20 errors (`python -I tests/test_shader_build_fallbacks.py`) - Green with the PR: OK; ctest: only xbox_present fails as on main (xs_proxy_mock failed once, flaky: passes on rerun and 5/5 direct runs); Python: same failures as main, the PRs' tests pass; translator: 507 files, 6405 tests, 0 failures - Verdict: READY (no new failure vs main; #822 and #1444 conflict trivially with each other in runtime/test/shaders/build.py (two function blocks added at the same place), whichever merges second needs a rebase) **All runs** - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
MoonEyes commented 2026-11-28 21:51:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T21:51:46Z.


Merged after OreoFR's red/green check (check) (RTX 4070 Laptop, driver 621.40, Windows 11) and a local re-check here. Merged after local re-verification: this PR merged onto main a8465211f without conflict, and its test file(s) (tests/test_shader_build_fallbacks.py) pass there. Earlier today the same tests failed on main without the PR (red/green) and a bundle with other open PRs showed no new failures. check_no_game_data.py is clean. Windows 11, Python 3.14; no GPU needed for these tests.

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246327588 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/822#issuecomment-7246327588). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T21:51:46Z. --- Merged after **OreoFR**'s red/green check ([check](https://github.com/ProjectLeonida/mandy/pull/822#issuecomment-7246233526)) (RTX 4070 Laptop, driver 621.40, Windows 11) and a local re-check here. Merged after local re-verification: this PR merged onto `main` a8465211f without conflict, and its test file(s) (`tests/test_shader_build_fallbacks.py`) pass there. Earlier today the same tests failed on `main` without the PR (red/green) and a bundle with other open PRs showed no new failures. `check_no_game_data.py` is clean. Windows 11, Python 3.14; no GPU needed for these tests. _AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes._
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!822
No description provided.