Skip to content

build.py: leave ps_ij_computed out under the PerVertexKHR fallbacks instead of failing the batch - #1853

Merged
ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
sovljanskii:test-shaders-build-skip-ij-under-fallback
Nov 22, 2026
Merged

ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
sovljanskii:test-shaders-build-skip-ij-under-fallback

Conversation

@sovljanskii

@sovljanskii sovljanskii commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Item: TEST-276, claim in #1745. The build.py half of TEST-237, which #1680 (merged) didn't cover.

What was wrong

Under LEONIDA_BARY_FALLBACK=1 or LEONIDA_F16_INTERP_FALLBACK=1 the translator refuses ps_ij_computed, because a computed I/J pair needs PerVertexKHR inputs and both fallbacks take them away. runtime/test/shaders/build.py counted that as a missing module and exited

Translation did not produce validated SPIR-V for: ps_ij_computed

before publishing anything (build.py:163-165). <out>/spirv stayed empty, and check.py then reported 0 of 147.

On a Mac the two-step path needs LEONIDA_F16_INTERP_FALLBACK=1, because check.py doesn't detect MoltenVK the way run_gpu_tests.py does. So the documented build.py + check.py way never ran there, and the SKIP check.py gained in #1680 was never reached. GPUs without VK_KHR_fragment_shader_barycentric that use LEONIDA_BARY_FALLBACK=1 (RDNA1 on RADV, Intel Gen9, llvmpipe) hit the same wall. I reported this on #1680 before it was merged (comment).

The fix

Under either fallback, build.py leaves ps_ij_computed out and prints a "not built" line, as it already does for ms_/gs_ shaders. Without a fallback ps_ij_computed is built as before, and any other missing module still fails the batch.

Tests

New tests/test_shader_build_fallbacks.py (standard library). It loads build.py and replaces only the translator with a stand-in that writes the index and modules and, like the real one, refuses ps_ij_computed under a fallback:

  • each fallback: cs_store ps_ij_computed builds, the translator is never asked for ps_ij_computed, and cs_store.spv is published;
  • the whole list under LEONIDA_F16_INTERP_FALLBACK=1 publishes every module the translator was asked for, ps_interp_f16_high included;
  • without a fallback ps_ij_computed is still built, and a module missing for another reason still fails the batch.

The first two fail on main with the message above, and all 4 pass with the fix. tests/test_shader_checks.py, test_run_gpu_tests.py and test_mc_command.py pass, and compileall is clean.

End to end on an Apple M4 (MoltenVK 1.4.2, macOS 27.2.1, LLVM 23.1.6), with LEONIDA_F16_INTERP_FALLBACK=1 and the runtime built from this branch:

  • main: build.py exits 1 and publishes nothing; check.py gives 0 of 147 pass.
  • this branch: build.py exits 0 (not built (computed I/J pairs need PerVertexKHR inputs, off under the fallback): ps_ij_computed); check.py gives 71 of 154 pass, 81 skipped, with ps_ij_computed SKIP and ps_interp_f16_high ok.

The two remaining failures are already on main and have nothing to do with this change: ps_ssharp is SHADER-268 (#1845). cs_cvt_f32_sat is a check.py issue I'll post separately: it counts the "can't run this shader at 32 lanes" skip as 16 wrong inputs, and run_gpu_tests.py passes it 16/16.

No game data. AI-assisted.

…nstead of failing the batch

Under LEONIDA_BARY_FALLBACK=1 or LEONIDA_F16_INTERP_FALLBACK=1 the
translator refuses ps_ij_computed (a computed I/J pair needs PerVertexKHR
inputs, which both fallbacks take away). build.py counted that as a
missing module and exited before publishing anything, so check.py then
reported 0 of 147. A Mac needs LEONIDA_F16_INTERP_FALLBACK=1 for the
two-step path, so that path never ran there, and the SKIP check.py gained
in ItsNotRexed#1680 was never reached.

Leave ps_ij_computed out under either fallback with a "not built" line,
as build.py already does for ms_/gs_ shaders. Without a fallback it is
built as before, and any other missing module still fails the batch.

AI-assisted.
@tylerstraub

Copy link
Copy Markdown
Contributor

Tested 5314dffcef7e93566f477cede7ac7749dc1415af on NVIDIA GeForce RTX 5090, 595.99.02 (Linux).

Independent Linux Vulkan check on a GeForce RTX 5090, NVIDIA driver 595.99.02, Linux 7.0.0-43-generic, LLVM 21.1.8, and SPIRV-Tools 2026.1.

I built vs_ids, cs_store, and ps_ij_computed through the real build.py in three fresh output directories. In native mode, all three validated and were published, and the check.py pixel check passed. Under each forced PerVertexKHR fallback, the build exited 0 and published both controls. It omitted ps_ij_computed from the output and index, and the pixel checker returned SKIP. The cs_store GPU readback passed in all three modes.

All four build-fallback tests and 59 shader-check tests passed. The build-fallback suite emitted a Python 3.14 temporary-directory cleanup warning.

AI-assisted verification.

The fallback subtests called setUp() again, so the folder the first
setUp() made was dropped without cleanup and Python warned
(ResourceWarning: Implicitly cleaning up <TemporaryDirectory ...>).
Each folder now registers its own cleanup. Seen by @tylerstraub on
Python 3.14.

AI-assisted.
@sovljanskii

Copy link
Copy Markdown
Contributor Author

@tylerstraub thanks for the RTX 5090 run and for checking all three modes through the real build.py. You were right about the warning: the fallback subtests called setUp() again, so the first temporary folder was never cleaned up. Fixed in 949d08c, where each folder registers its own cleanup. python -X dev -W error::ResourceWarning tests/test_shader_build_fallbacks.py is now 4/4 with no warning (Python 3.15, macOS). It's test-only, and build.py is unchanged.

AI-assisted.

@lucastayaralvarenga-ui lucastayaralvarenga-ui left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All four synthetic test_shader_build_fallbacks.py tests pass on Windows with Python 3.12 at 949d08c6. The latest cleanup also removes the temporary-directory warning. I checked the selection against check.py. Both =1 fallback flags skip the same computed-I/J case, and the normal-build and missing-module cases still exercise the existing behavior. I did not run a GPU build. AI-assisted review.

@tylerstraub

Copy link
Copy Markdown
Contributor

Tested 949d08c687816208d5f3059054ebe85ea3820727 on NVIDIA GeForce RTX 5090, 595.99.02 (Linux).

Retested the cleanup fix on Linux 7.0.0-43-generic with an RTX 5090, driver 595.99.02, LLVM 21.1.8, and SPIRV-Tools 2026.1.

The four build-fallback tests passed under Python 3.14 with -X dev -W error::ResourceWarning and emitted no cleanup warning. The other 59 shader-check tests passed. In fresh output directories the real builder and GPU checker repeated the prior result. Native mode built and passed ps_ij_computed. Each forced fallback omitted that shader and reported SKIP, while cs_store still passed in all three modes.

AI-assisted verification.

@Jess-Doit

Copy link
Copy Markdown
Contributor

Tested 5314dff on an NVIDIA GeForce GTX 1060 6GB (Pascal, no VK_KHR_fragment_shader_barycentric), driver 560.94, Vulkan 1.3.280, Windows 10 22H2, Vulkan SDK 1.4.363.0, llvm-mc 23.1.6, MSVC 19.44, runtime built from this branch: pass. AI-assisted testing.

build.py + check.py:

  • main 003e781, LEONIDA_BARY_FALLBACK=1: build.py exits 1 ("Translation did not produce validated SPIR-V for: ps_ij_computed"), check.py 0 of 154 pass. Reproduces the bug.
  • this branch, LEONIDA_BARY_FALLBACK=1: build.py exits 0 with the "not built … ps_ij_computed" line, check.py 115 of 154 pass, 39 skipped, 0 failed.
  • this branch, no fallback: ps_ij_computed still built (182/182 translate and validate), check.py 112 of 154, 42 skipped, 0 failed (ps_ij_computed skips: no barycentric extension).
  • this branch, LEONIDA_F16_INTERP_FALLBACK=1: 113 of 154, 41 skipped, 0 failed.
  • this branch, with LEONIDA_BARY_FALLBACK=1 LEONIDA_MESH_COMPUTE=1 LEONIDA_TEXOFF_FALLBACK=1 LEONIDA_W64_EMULATE=1: 148 of 154, 6 skipped, 0 failed. The skips are the 3 mesh fixtures build.py doesn't build, ps_ij_computed, ps_interp_f16_high (needs the extension) and ps_w64x_readlane (no 64-wide fragment subgroup).

tests/test_shader_build_fallbacks.py 4/4 OK; tests/test_shader_checks.py OK.

@x2Tweek

x2Tweek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Static review — PR #1853 (BUILD-501)

Branch: (head of PR #1853)
Commit: (head of PR #1853)
Author: (author of PR #1853)
State: OPEN, mergeable

What it does

runtime/test/shaders/build.py: under LEONIDA_BARY_FALLBACK=1 or LEONIDA_F16_INTERP_FALLBACK=1, the translator refuses ps_ij_computed (computed I/J pair needs PerVertexKHR inputs which both fallbacks take away). Previously build.py treated the missing module as a failed batch (exited before publishing anything), causing check.py to report every test missing. Now build.py leaves ps_ij_computed out and builds the rest; check.py and run_gpu_tests.py report it as SKIP.

Changes

  • runtime/test/shaders/build.py — Added NEEDS_PER_VERTEX_INPUTS = ("ps_ij_computed",) and, under either fallback env var, filters those names out of the build list with a clear message.
  • tests/test_shader_build_fallbacks.py (new) — 4 tests using a stand-in translator (no llvm-mc, SPIR-V tools, GPU or game data): each fallback builds the rest without ps_ij_computed; whole list builds under fallback; without fallback ps_ij_computed is still built; missing module without fallback still fails the batch.

CPU test results

  • tests/test_shader_build_fallbacks.py: 4 passed, 2 subtests
  • python -m compileall: clean
  • No game data, no runtime changes.

Reviewer recommendation

Approve. Small, correct fix with proper tests. Uses a stand-in translator so no external tools are needed.


AI-assisted. Reviewed with Claude Code.

@sovljanskii

Copy link
Copy Markdown
Contributor Author

@x2Tweek thanks for the review. One correction so the tables don't mix them up: this PR isn't BUILD-501. That item is the rdna2spirv --merge fix (#1804 and the three PRs with it). #1853 is a new TEST item (the build.py half of TEST-237, claim), and it doesn't have an ID in #1745 yet.

AI-assisted.

@ItsNotRexed
ItsNotRexed merged commit acadbdc into ItsNotRexed:main Nov 22, 2026
4 checks passed
@umnitus

umnitus commented Nov 22, 2026

Copy link
Copy Markdown

Tested 949d08c on RTX 3060 12 GB, NVIDIA 621.14, Vulkan 1.4.357, Windows 11 26H2: pass. Both GPU checks passed in native mode. With each fallback enabled separately, cs_store passed and ps_ij_computed was correctly omitted and reported as SKIP. All four synthetic CPU checks passed. AI-assisted verification.

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.

7 participants