Skip to content

BUILD-1611: Match pipeline-checker stubs to barycentric fallback inputs - #5197

Open
Hiiva wants to merge 2 commits into
ItsNotRexed:mainfrom
Hiiva:fix/bary-pipeline-stubs
Open

Hiiva wants to merge 2 commits into
ItsNotRexed:mainfrom
Hiiva:fix/bary-pipeline-stubs

Conversation

@Hiiva

@Hiiva Hiiva commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The translator records a barycentric fallback pixel input in bary_fallback_input.location, but the standalone pipeline checker and stub generator ignore it. Translating the existing synthetic ps_bary fixture with --bary-fallback requires a vec3 input at location 1, while the generated vs_0.spv writes only the ordinary vec4 at location 0.

On the unchanged checker, vkCreateGraphicsPipelines returns success and the tool counts one OK pipeline, but Khronos validation reports VUID-RuntimeSpirv-OpEntryPoint-08743 for the missing vertex output. Native translation and an exact vec3 partner are clean controls.

Changes

  • Generate a distinct vertex partner with the required vec3 output, such as vs_0_bary1.spv.
  • Include the barycentric location in naming and deduplication while preserving ordinary stub names and binaries.
  • Parse the optional metadata in vk_pipeline_check and select the matching partner.
  • Reject malformed fallback metadata before stub publication or Vulkan initialization.

These are compilation-test partners. Runtime fallback drawing remains with #4309, and ps_sweep support remains with #4847. Their changed files do not overlap this change. No translator or ISA behavior changes.

Current upstream validation

Rebased onto 561b65a832218fbb9e6d2effd392a8eef093a3f8 at 23945a2b22d3b907992d0cb388331321c15f01d5. The Python conflict retains upstream exact-integer interface validation for all stages, legacy GS field selection, atomic sibling-file publication, file-mode handling, replacement retries, and cleanup. The fallback inputs retain the JSON-array and unsigned-32-bit restrictions.

Python stub tests: 23 run, 22 pass, and one existing POSIX file-mode test skips on Windows. The fresh MSVC checker build and 1/1 CPU-only CLI CTest pass. Independent Python/C++ source/range review is clear. compileall, isolated make_game.py --help, and diff checks pass. No GPU rerun was performed for this rebase; the GPU results below remain tied to the original base.

Initial validation

Base: upstream/main 3faac55. Windows 11, MSVC 19.44.35228, Windows SDK 10.0.26100.0, Vulkan SDK 1.4.363.0.

  • Five new Python methods fail 16 subcases against unchanged main and pass after the fix. They use actual translations for native/fallback shaders with ordinary, empty, and sparse input sets, exact vec3 stage linking, deduplication, and invalid metadata.
  • Existing tests: 9 stub, 45 shader-link, 12 semantic fallback, and 7 checker-index tests pass.
  • vk_pipeline_check_cli CTest passes, including 15 new malformed/valid metadata controls that terminate before GPU initialization.
  • Full compileall, make_game.py --help, three text-line-ending tests, and git diff --check pass.
  • Independent C++ and Python reviews found no actionable issue. Reviewers reran the new tests, existing stub tests, and CLI CTest successfully.

GPU compilation check

NVIDIA GeForce RTX 4080, driver 32.0.16.1062 (610.62), subgroup 32. Six translated pixel shaders cover ordinary location 0, no ordinary inputs, and sparse location 7, each in native and fallback mode. All six shaders and all six generated partners pass spirv-val for Vulkan 1.2. The fixed checker creates six pipelines with zero failures and zero skips. Khronos validation error reporting is explicitly enabled; the captured run contains zero validation errors.

An initial native location-30 control exceeded this device's maxFragmentInputComponents limit of 128 and reported VUID-RuntimeSpirv-Location-06272. The six-case GPU matrix therefore uses sparse location 7. Fallback location 30 remains covered by CPU stage linking and spirv-val. No rendering, game-corpus, or gameplay result is claimed.

All inputs are synthetic. No game files accessed or included.

Coordination: BUILD-1611, #5156 (comment).

AI-assisted: yes.

Review follow-up

At 357a06b4, both PS-input consumers require a JSON array of unsigned 32-bit integer locations. Strings, booleans, nulls, nested values, fractions, decimal/exponent tokens, negative nonzero values, and overflow are rejected before stub publication or Vulkan initialization. Missing inputs remain equivalent to an empty array; duplicates/order normalization and JSON -0 retain consistent behavior.

Nine focused Python methods, nine existing stub tests, seven index-CLI tests, the MSVC checker build, and vk_pipeline_check_cli pass. The six valid native/fallback GPU pipeline controls also pass with zero validation errors. The final lexical -0 adjustment is covered by CPU CTest. Independent Python/C++ source review is clear. No files from #5196 were changed.

@thehollowedone

Copy link
Copy Markdown

Independent Windows GPU check of 70206c5a for BUILD-1611. Applied the published patch to 3faac557 in scratch and verified all four resulting blobs. RTX 3080 Ti (32-lane subgroups), NVIDIA 621.35, Windows SDK 10.0.26100.0, Vulkan SDK 1.4.363.0.

  • tests/test_spirv_stubs_bary_fallback.py: 5 passed. vk_pipeline_check_cli: 1 passed.
  • Six synthetic pixel shaders and six generated vertex partners passed spirv-val --target-env vulkan1.2. vk_pipeline_check --graphics-only --jobs 1 compiled six pipelines with zero failures, skips, or Khronos validation errors.
  • Negative control: swapping the ordinary vertex stub in for the fallback partner reproduced VUID-RuntimeSpirv-OpEntryPoint-08743, even though the checker counted the pipeline as OK.

Synthetic inputs only. AI-assisted.

@gertify

gertify commented Nov 23, 2026

Copy link
Copy Markdown

Tested 70206c5 on Intel UHD 630 (Coffee Lake GT2), Mesa 25.2.8 ANV, Ubuntu 24.04, without the Khronos validation layer (not installed here): tests/test_spirv_stubs_bary_fallback.py passes (5 tests) and tests/test_spirv_stubs.py passes (9). With LEONIDA_BARY_FALLBACK=1 the shader build gives ps_bary a bary_fallback_input of location 1 and tools/spirv_stubs.py writes 13 stubs. vk_pipeline_check --stage graphics with LEONIDA_VK_DEVICE=Intel exits 0 with "ps pipelines: 113 ok, 0 failed, 3 skipped" (the 3 skips need VK_KHR_maintenance8), "vs pipelines: 17 ok, 0 failed" and "gs pipelines: 3 ok, 0 failed"; a nonexistent device name fails with "no Vulkan physical device matches", and ctest vk_pipeline_check_cli passes (0.13 s). The checker prints no per-shader names on a pass, so ps_bary passing is inferred from the aggregate. The VUID-RuntimeSpirv-OpEntryPoint-08743 claim and the six-shader matrix in the PR body were not reproduced.

AI-assisted.

@gertify

gertify commented Nov 23, 2026

Copy link
Copy Markdown

Tested 70206c5 on Intel UHD 770, driver 32.0.101.7088, Windows 11, MSVC 19.44, Khronos validation layer on: vk_pipeline_check builds and ctest vk_pipeline_check_cli passes (Test #68, 1.14 sec). Built with LEONIDA_BARY_FALLBACK=1, the shader corpus gives "241 shaders: 241 translated, 241 pass spirv-val" with 3 index entries carrying bary_fallback_input. vk_pipeline_check on that corpus exits 1 with "ps pipelines: 0 ok, 108 failed, 8 skipped", "vs pipelines: 0 ok, 17 failed" and "gs pipelines: 0 ok, 3 failed", and the validation layer reports "SPIR-V Capability Float64 was declared, but one of the following requirements is required (VkPhysicalDeviceFeatures::shaderFloat64)". Every pipeline fails here, including vs_base_ids, which has no barycentric input, so this GPU gives no pipeline-count evidence for the stub change. VUID-RuntimeSpirv-OpEntryPoint-08743 does not appear in the run. The six-case matrix in the PR body and a run on main were not done.

AI-assisted.

@soldsawn

Copy link
Copy Markdown

Independent Windows 11 / MSVC 2022 (\RelWithDebInfo) check at exact head \70206c5af0bfdf7ac1a37272f998a8ff440d2aa7\ (GPU: NVIDIA GeForce RTX 4060 Laptop GPU, driver \32.0.16.1714; claim: #5156 (comment)):

Synthetic fixtures only, no game data. AI-assisted.

@kacper-serewis kacper-serewis 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.

At 70206c5, inputs set to the string "10" with fallback location 2 makes the stub CLI generate vs_0_1_bary2.spv. By source inspection the C++ reader skips that non-array and requests vs_empty_bary2.spv. Please require an array of integer locations consistently in both consumers. The integration with #5196 also showed [1.9] and [true] silently coerced to location 1 by the Python tools. Valid empty, ordinary and sparse interfaces produced the expected reflected types and locations.

AI-assisted independent review.

@Hiiva

Hiiva commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 357a06b. The Python stub generator and the C++ inputs reader now require arrays of exact uint32 JSON integers. They reject the string, fractional, and Boolean examples consistently; invalid input cannot replace existing stubs or reach Vulkan initialization.

Controls include missing/empty inputs, duplicates, sparse locations, uint32 bounds, and JSON -0 normalization. Nine focused Python methods, nine existing stub tests, seven index tests, and the built checker CLI CTest pass. The six valid native/fallback pipeline cases remain clean with validation. Independent source review is complete. #5196 files remain with their owner. AI-assisted: yes.

@sovljanskii

Copy link
Copy Markdown
Contributor

Tested 357a06b4 (base 3faac557, current main) on an Apple M4, macOS 27.2.1, MoltenVK 1.4.2 (Vulkan 1.4.357), AppleClang 21.0.0. Result: pass. On MoltenVK the missing partner output is a hard pipeline failure, not only a validation message, so main miscounts these pipelines without any layer installed.

  • ctest -R vk_pipeline_check: vk_pipeline_check_cli passed (0.66 s).
  • tests/test_spirv_stubs_bary_fallback.py: 9 OK on Python 3.14, with spirv-val on PATH.
  • GPU compile matrix. I used your test's translate() path (the hand-written ps_bary.s fixture and the empty-input variant) to make six pixel shaders: native and --bary-fallback, each with ordinary input location 0, location 7 and no ordinary input. I wrote them with index.json and ran spirv_stubs.generate_for_index and vk_pipeline_check from each tree.
    • The translation used FLOAT_CONTROLS = False, because this device has no shaderDenormPreserveFloat16; with float controls all six are SKIPPED on both trees.
    • Every shader and every stub passes spirv-val --target-env vulkan1.2.
tree stubs generated ps pipelines
main vs_empty, vs_0, vs_7 3 ok, 3 failed (ps_fb_0, ps_fb_7, ps_fb_none; PIPELINE FAIL ... -3)
this PR vs_empty, vs_empty_bary0, vs_0, vs_0_bary1, vs_7, vs_7_bary0 6 ok, 0 failed
main's checker on this PR's folder (as above) 3 ok, 3 failed, the same three

With MVK_CONFIG_LOG_LEVEL=3, the main failures are Metal's own linking error: Fragment input(s) 'user(locn1)' mismatching vertex shader output type(s) or not written by vertex shader. (once, the location-0 fallback) and the same for user(locn0) (twice, the location-7 and no-input fallbacks). That matches the bary_fallback_input locations 1, 0 and 0. The third row shows that the stubs alone don't fix it: the checker must also pick the _baryN partner, which this PR does.

All inputs are synthetic. No game files were used.

AI-assisted.

@lunarminus

Copy link
Copy Markdown

Tested 357a06b4 on an AMD Radeon 760M (RDNA3 iGPU, gfx1103, subgroup 32..64), RADV Mesa 26.3.1, CachyOS Linux: pass

  • I merged the PR onto d0835dd9, which is an ancestor of the PR head, so the merge was a fast-forward. The tree tested is exactly 357a06b4: PR base 3faac557 plus the two PR commits.
  • The runtime builds (RelWithDebInfo). ctest -R vk_pipeline_check: vk_pipeline_check_cli passed (1/1).
  • Python tests: tests/test_spirv_stubs_bary_fallback.py 9/9, tests/test_spirv_stubs.py 9/9, tests/test_shader_link_check.py 45/45, tests/test_bary_fallback_gs.py 28/28, tests/test_vk_pipeline_check_index.py 7/7 (against the built checker), tests/test_vk_pipeline_check_isolate.py 6/6, semantic test_bary_fallback* 12/12. Every test passed.
  • scripts/run_gpu_tests.py, native and with LEONIDA_W64_EMULATE=1: 202/217 passed, 15 skipped in both modes.
    • Compared test by test with d0835dd9 without the PR (196/210, 14 skipped): all 210 shared tests give the same PASS/SKIP result in both modes.
    • The 7 extra tests are fixtures that main added between d0835dd9 and 3faac557, not this PR. cs_smem_sconst_off, ps_far_branch, ps_sample_c, ps_sample_c_b, ps_texture_b_cl and ps_texture_cl pass. ps_m2_literal is skipped ("run by d3d12_m2_textured_test").
  • Six-case matrix like the one in the PR body, all synthetic:
    • Shaders: the tests/semantic ps_bary.s fixture with attr0, the same with attr7, and a hand-written program with no inputs. Each was translated natively and with --bary-fallback; 3/3 translated and passed spirv-val in each mode.
    • Fallback metadata: locations 1, 0 and 0.
    • The PR's spirv_stubs.py writes vs_0, vs_7, vs_empty and vs_0_bary1, vs_7_bary0, vs_empty_bary0. All pass spirv-val --target-env vulkan1.2.
    • vk_pipeline_check --graphics-only --jobs 1 with VK_LAYER_KHRONOS_validation (the loader log confirms it was inserted): native gives ps pipelines: 3 ok, 0 failed, 0 skipped, fallback gives the same. Neither run reports a validation error.
  • Same fallback shaders with d0835dd9's spirv_stubs.py and vk_pipeline_check: it also prints ps pipelines: 3 ok, 0 failed, 0 skipped, but the validation layer reports VUID-RuntimeSpirv-OpEntryPoint-08743 three times, once per pipeline. The native control on d0835dd9 is clean. This reproduces the problem in the PR body on RADV, and the PR's *_bary* partner stubs remove it.

Synthetic inputs only, no game files. AI-assisted (Claude Code).

@Atomic258

Copy link
Copy Markdown
Contributor

Tested 357a06b on Windows Server 2022, CPython 3.13.12: pass

  • python -I tests/test_spirv_stubs_bary_fallback.py -> Ran 9 tests, OK
  • Negative control (tools/spirv_stubs.py swapped to upstream/main): FAILED (failures=69)

git diff --check clean; python -m compileall -q exit 0. No game files, no GPU. AI-assisted (Devin).

@mrloic

mrloic commented Nov 23, 2026

Copy link
Copy Markdown

Tested 357a06b4 (base 3faac557) on NVIDIA GeForce RTX 4060 (Ada, desktop), driver 617.42, Vulkan 1.4.351, subgroup 32..32, Windows 11 Pro 26300: pass. First NVIDIA/Windows run at this head (the earlier NVIDIA checks were on 70206c5a).

Built with MSVC (VS 2022 Build Tools 17.14, scripts\build_runtime.ps1, LLVM_MC set), llvm-mc 23.1.6 (conda-forge), Vulkan SDK 1.4.363.0.

  • python -I tests/test_spirv_stubs_bary_fallback.py: Ran 9 tests, OK; python -I tests/test_spirv_stubs.py: Ran 9 tests, OK
  • ctest -R vk_pipeline_check: vk_pipeline_check_cli passed

Pipeline check with Khronos validation (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_LAYERS_DISABLE=~implicit~), test shaders from runtime/test/shaders/build.py:

build.py bary partner stubs ps / vs pipelines VUID messages
PR, native 242 translated, 242 spirv-val 0 117 ok / 17 ok 0
PR, LEONIDA_BARY_FALLBACK=1 241 translated, 241 spirv-val 2 (vs_0_bary1.spv, vs_empty_bary0.spv) 116 ok / 17 ok 0
control: main 3faac557 stubs + checker, LEONIDA_BARY_FALLBACK=1 241 translated, 241 spirv-val 0 116 ok / 17 ok 6 × VUID-RuntimeSpirv-OpEntryPoint-08743

So on NVIDIA main also counts these pipelines as OK while validation reports the missing vertex output; with the PR the matching partners are generated and the run is clean.

No regressions:

  • full ctest: 177/177 passed (gameinput not built: no SDL3)
  • run_gpu_tests.py with LEONIDA_W64_EMULATE=1: 201/217 passed, 16 skipped
  • native: 169/217 passed, 47 skipped, 1 failed: cs_w32_lds_u8_d16 (no output words, only the device line). It passed 5/5 when rerun alone and passed in the emulated run, and on main it passed earlier on this machine. The PR touches neither the translator nor vk_compute_test, so I read it as a one-off, not this change.

AI-assisted (Claude Code).

@tunczzz

tunczzz commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 357a06b4 (merge base 3faac557) on Windows 11 10.0.26300 with an NVIDIA GeForce RTX 5070 Ti (Blackwell, subgroup 32..32), driver 616.56. Result: pass.

  • Runtime built from this head: MSVC 19.44 (BuildTools 2022), Ninja, RelWithDebInfo, -DLEONIDA_VULKAN_HEADERS_FETCH=ON (no Vulkan SDK; the loader comes from the NVIDIA driver). glslangValidator and llvm-mc 21 came from WSL Ubuntu. Build exit 0.
  • ctest -j 3: 177/177 passed.
  • scripts/run_gpu_tests.py --build <this build>: 170/217 passed, 47 skipped, 0 failed.
  • Every test gives the same result as on main 3faac557 (ctest 177/177, GPU 170/217).
  • As on main, run_gpu_tests.py records cs_fmt_d16_xyz twice and skips cs_tbuffer_store. That's main's runner bug (fixed by run_gpu_tests: record cs_tbuffer_store's result; fail a run that records a test twice #4784), not this PR.

Not run: other GPUs/vendors, Linux, the Vulkan validation layer (not installed). No game files.

AI-assisted (Claude Code).

@Hiiva
Hiiva force-pushed the fix/bary-pipeline-stubs branch from 357a06b to 23945a2 Compare November 23, 2026 12:00
@Hiiva

Hiiva commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto 561b65a832218fbb9e6d2effd392a8eef093a3f8 at 23945a2b22d3b907992d0cb388331321c15f01d5. The Python conflict retains upstream exact-integer interface validation for all stages, legacy GS field selection, atomic sibling-file publication, file-mode handling, replacement retries, and cleanup. The fallback inputs retain the JSON-array and unsigned-32-bit restrictions.

Python stub tests: 23 run, 22 pass, and one existing POSIX file-mode test skips on Windows. The fresh MSVC checker build and 1/1 CPU-only CLI CTest pass. Independent Python/C++ source/range review is clear. compileall, isolated make_game.py --help, and diff checks pass. No GPU rerun was performed for this rebase; the GPU results below remain tied to the original base.

All inputs are synthetic. No game files accessed. AI-assisted: yes.

@kapitche

Copy link
Copy Markdown
Contributor

Tested 23945a2 merged with main 561b65a on Ubuntu (WSL2) / Python 3.12.16, g++ for a syntax check: pass

tests/test_spirv_stubs_bary_fallback.py: 9 run, 9 passed, 0 failed (about 59 s on this loaded machine); tests/test_spirv_stubs.py still prints its stub count and exits 0. Negative control: with tools/spirv_stubs.py (and the two runtime/test files) from main, the new test file fails (9 run, 27 failures/subtest failures). runtime/test/vk_pipeline_check.cpp passes g++ -std=c++20 -fsyntax-only with the Vulkan headers of the Windows SDK copy. I did not build or run vk_pipeline_check or the check_vk_pipeline_cli.cmake ctest here (no Vulkan loader on this Linux), and no GPU run; other commenters report those.

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.