Skip to content

fix(kyty): reject invalid image LOD and compute exports - #309

Merged
simnJS merged 1 commit into
simnJS:AnyKytyfrom
mjnhbg3:fix/kyty-spirv-execution-model
Nov 26, 2026
Merged

simnJS merged 1 commit into
simnJS:AnyKytyfrom
mjnhbg3:fix/kyty-spirv-execution-model

Conversation

@mjnhbg3

@mjnhbg3 mjnhbg3 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What

Two routes produced #209's invalid execution-model call graph. IMAGE_GET_LOD emitted OpImageQueryLod in a vertex shader. A live compute EXP parameter export created an Output storage variable, which Vulkan forbids in GLCompute. Refuse unsupported image LOD stages and live non-null compute exports before IR output registration. Keep null and disabled compute exports as no-output operations. Add handwritten refusal and supported-path fixtures plus a Kyty debt fragment.

This targets the fork's current AnyKyty base, e68fe52755a4cec68e3e7d32318925ee657775ef. The one-hour Linux compiler-validation run found no call-graph recurrence. It did find a separate atomic storage-class recurrence from #291's unguarded DS_APPEND path, so this PR leaves #209 open for that distinct follow-up.

Tested

  • Windows 11 Pro, Intel(R) Graphics 32.0.101.8331: on the unmodified base, the handwritten vertex image-LOD fixture emitted SPIR-V and the bundled Vulkan 1.3 validator reported OpEntryPoint ... callgraph contains function ... which cannot be used with the current execution model. The candidate explicitly refuses it; the pixel counterpart compiles and validates.
  • A compute parameter export found by the first Linux sanitizer run reproduced the same call-graph error and full validator reason VUID-StandaloneSpirv-None-04644 with a three-word handwritten fixture on the first candidate. The amended candidate refuses that export. Null and disabled compute export fixtures compile and validate.
  • kyty_shim_recompiler_robustness and kyty_shim_recompiler_valid_spirv: 2/2 passed on the candidate. The latter runs every fixture with KYTY_FUZZ_SPIRV=abort.
  • Same machine and Intel GPU, same kyty_shim_cross_queue_label_order and kyty_shim_recompiler_valid_spirv CTests on base e68fe52755 and candidate 9ceedb5409 with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, and VK_LOADER_DEBUG=layer: 2/2 passed on each side. Both logs show Insert instance layer "VK_LAYER_KHRONOS_validation" with layer 1.4.363, no missing-layer warning, and zero VUID- errors.
  • Genuine PGO advisory fixtures 7/7, relinker warning fixtures 9/9, and Kyty settings fixtures 19/19 passed. All 87 live KYTY_* settings are documented.
  • Replayed the current base Linux Kyty CI log at e68fe52755 and the rebased PR Linux Kyty CI log at 9ceedb5409 through tools/kyty_pgo.py report --annotate. Both emit the same genuine advisory: 423 functions lost counts, 18.95% of profile weight, and 4 of the ten hottest. The warning predates this shader change.
  • tools/check_conventions.py --base origin/AnyKyty, tools/check_kyty_settings.py, tools/debt_fold.py --check, git diff --check, and tools/pr_overlap.py --branch fix/kyty-spirv-execution-model passed; no other open PR shares files or exports.
  • AnyKyty CI, offline checks, Emscripten portability, and Conventions passed on rebased commit 9ceedb5409.
  • Ubuntu 24.04.4 WSL2, GCC 14.2.0 and Clang/LLD 21.1.8: the ASan/UBSan kyty_shader_recompiler_fuzzer built at pre-rebase commit e4979d7. From an empty corpus, KYTY_FUZZ_SPIRV=log, KYTY_FUZZ_SPIRV_DIR=invalid, ASAN_OPTIONS=detect_leaks=0, and -max_total_time=3600 completed 6,843,555 inputs in 3,601 seconds, exit 0. Full-log checks found zero callgraph contains messages and zero ASan/UBSan reports. The log saved five distinct other validator findings: image dimension, output location collision, AtomicIAdd and AtomicISub on prohibited storage classes, and SSA dominance. The atomic pair includes Pixel DS_APPEND, outside this PR's files. No GPU driver, title, or homebrew was run in this Linux check. The separate Linux robustness executable compiled but did not link because its existing CMake target omits the UBSan runtime required by the instrumented Kyty archive; Windows robustness and SPIR-V CTests passed.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: Intel(R) Graphics, driver 32.0.101.8331, Windows 11 Pro build 26200
  • AI-assisted: yes

@mjnhbg3
mjnhbg3 force-pushed the fix/kyty-spirv-execution-model branch from fb1e761 to e4979d7 Compare November 26, 2026 05:00
@mjnhbg3 mjnhbg3 changed the title fix(kyty): refuse image LOD queries outside supported stages fix(kyty): reject invalid image LOD and compute exports Nov 26, 2026
@mjnhbg3
mjnhbg3 force-pushed the fix/kyty-spirv-execution-model branch from e4979d7 to 9ceedb5 Compare November 26, 2026 06:14
@mjnhbg3
mjnhbg3 marked this pull request as ready for review November 26, 2026 06:39
@simnJS

simnJS commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Merged into AnyKyty as 9ceedb5409 (your commit as is, fast-forward), after the green CI on this exact base. Thanks @mjnhbg3, nice fixtures and a thorough validation run. Refusing these two forms during translation, instead of handing the driver invalid SPIR-V, is the right behaviour.

@simnJS
simnJS merged commit 9ceedb5 into simnJS:AnyKyty Nov 26, 2026
15 checks passed
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.

2 participants