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

Open
github-bot wants to merge 1 commit from github-bot/gh-822 into main AGit
Owner

@⁠hugo0024 on GitHub · 2026-11-24 14:12 UTC · original
hugo0024:check-f16-fallback → main · +151 −15 · 4 files · 1 commits · open

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

**@⁠hugo0024** on GitHub · 2026-11-24 14:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/822) `hugo0024:check-f16-fallback` → `main` · +151 −15 · 4 files · 1 commits · open Claimed in the coordination issue as: TEST-CHECK-F16-FALLBACK ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)) ### 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://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)) 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)
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). build.py and check.py only did so 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 failed.

Both scripts now ask the device when the variable is unset, the way they
already do for the barycentric fallback, and take 1/0 (true/false, yes/no,
on/off) as run_gpu_tests.py does. On an Apple M5 (MoltenVK 1.4.2) check.py
goes from 175 of 220 pass, 39 skipped, 6 failed to 176 pass, 40 skipped,
4 failed: ps_interp_f16_high passes and ps_ij_computed is a SKIP.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:23:07 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 14:22 UTC · original · approved these changes

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** on GitHub · 2026-11-24 14:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/822#pullrequestreview-6040926423) · **approved these changes** ### 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
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 14:22 UTC · original · approved these changes

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).

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 14:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/822#pullrequestreview-6040938840) · **approved these changes** 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).
Author
Owner

@⁠Tauwni on GitHub · 2026-11-25 10:44 UTC · original

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).

**@⁠Tauwni** on GitHub · 2026-11-25 10:44 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/822#issuecomment-7160101147) 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).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/822/head:github-bot/gh-822'
git switch 'github-bot/gh-822'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-822'
git switch 'github-bot/gh-822'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-822'
git switch 'github-bot/gh-822'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-822'
git switch 'main'
git merge --squash 'github-bot/gh-822'
git switch 'main'
git merge --ff-only 'github-bot/gh-822'
git switch 'main'
git merge 'github-bot/gh-822'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.