Skip to content

fix(kyty): refuse 3D image gathers - #320

Merged
simnJS merged 1 commit into
simnJS:AnyKytyfrom
mjnhbg3:fix/kyty-image-gather-dimensions
Nov 26, 2026
Merged

simnJS merged 1 commit into
simnJS:AnyKytyfrom
mjnhbg3:fix/kyty-image-gather-dimensions

Conversation

@mjnhbg3

@mjnhbg3 mjnhbg3 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

What

A compute IMAGE_GATHER with a 3D image reached SPIR-V as OpImageGather. The SPIR-V validator rejects that image dimension; the SPIR-V specification permits 2D, Cube or Rect for OpImageGather. Refuse a gather before emission when its direct image or any candidate in an indirect image table is 3D. A mixed table must be refused because its emitted module contains every candidate branch. Existing 2D gathers and the separate depth-comparison refusal remain unchanged.

The matched regression fixtures use synthetic shader words. The 2D fixture requires nonempty, validator-accepted SPIR-V; changing its image dimension to 3D must give the explicit refusal. A debt fragment records that console 3D gather semantics are unmeasured. This is based on current AnyKyty dcdde0a.

Tested

  • On exact base dcdde0a with only the new test fixture, Windows emitted invalid 3D gather SPIR-V: spirv-val reported an invalid image dimension, and the refusal test failed. The matched 2D fixture passed. On this PR, both fixtures passed and the 2D case emitted nonempty validated SPIR-V.
  • Windows 11 Pro build 26200, Intel(R) Graphics driver 32.0.101.8331: kyty_shim_cross_queue_label_order and kyty_shim_recompiler_valid_spirv passed 2/2 on the base and change on the same GPU with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and VK_LOADER_DEBUG=layer. Both logs show the loader inserting VK_LAYER_KHRONOS_validation from SDK 1.4.350, no missing-layer warning, and zero VUID- errors. The change also passed kyty_shim_recompiler_robustness, 3/3 focused tests total.
  • Ubuntu 24.04 WSL2, GCC 14.2 and LLVM 21: the focused release targets built and the same three focused CTests passed. No title or physical GPU was tested in this Linux run.
  • Replayed the current-base Linux Kyty CI log and the candidate local Linux build log through tools/kyty_pgo.py report --annotate. Both report the same genuine PGO advisory: 423 functions lost counts, 18.95% of profile weight, four of the ten hottest; the warning annotation lines match exactly.
  • 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.
  • 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-image-gather-dimensions passed; the overlap check found zero shared files or exports among four open AnyKyty PRs.
  • Console behavior for 3D gathers is unmeasured. The PR refuses that form rather than substituting an unverified result.

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

@simnJS
simnJS merged commit 007a98c into simnJS:AnyKyty Nov 26, 2026
13 checks passed
@simnJS

simnJS commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Thanks, this is the right call for now: an invalid OpImageGather on a 3D image was reaching the driver, and a refusal is better than that. All checks are green, and the 2D fixture proving the module stays valid is a good guard.

Merged into AnyKyty (fast-forward, your commit as is). One possible follow-up if you want it: for a mixed indirect table, refuse only the 3D candidate branch (for example return zero for it) instead of the whole module, so the 2D candidates keep working. Worth doing only if a title actually hits a mixed table.

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