Skip to content

test(kyty): verify prepared variants after restart - #334

Merged
simnJS merged 4 commits into
simnJS:AnyKytyfrom
mjnhbg3:test/kyty-prepared-variant-first-use
Nov 27, 2026
Merged

simnJS merged 4 commits into
simnJS:AnyKytyfrom
mjnhbg3:test/kyty-prepared-variant-first-use

Conversation

@mjnhbg3

@mjnhbg3 mjnhbg3 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What

Add a synthetic end-to-end regression for issue #327: one shader with two resource shapes is recorded, the backend is restarted, and each prepared compute variant must serve its first dispatch from a distinct native ready pipeline. A one-variant recording followed by the omitted shape must show a synchronous miss. Cold, warm, and control output bytes are checked, with every output word written.

Flush manifest recording when the GPU shuts down so a short run leaves a reloadable manifest. Wait for manifest work before the first replay frame, reject compute preparation failures, and log ready-pipeline consumption when variant logging is enabled. Keep the new test out of lavapipe because its Vulkan device lacks the replay family's required extension and subgroup size. ASan and TSan CTest configurations omit this GPU fixture because the replay requires a fixed guest arena.

Based on current AnyKyty (90a48455d2). The overlap tool compared the other open PRs; it could not merge the older #313 with this base, so I compared its CMake hunk manually. #313 registers BDA page-table tests near line 267; this PR registers the prepared-variant test near line 746 and adds its Windows PATH entry near line 818.

Tested

  • Windows 11 Pro (build 26200), synthetic capture only. Built agc_frame_replay, kyty_shim_generic_compute_replay_tests, and kyty_shim_buffer_cache_pages_tests with the documented MinGW/LLVM setup.
  • On exact base 90a48455d2, ctest --test-dir build -R '^(kyty_shim_generic_compute_replay(_wide)?|kyty_shim_buffer_cache_pages)$' -V: 3/3 passed in 4.48 s. On this change the same 3/3 passed in 3.83 s. Both direct GPU logs inserted validation layer 1.4.350, showed no missing-layer message, and had no VUID- errors.
  • With ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, and VK_LOADER_DEBUG=layer, the new prepared-variant CTest passed in 11.44 s (4/4 focused tests; the 60 s failure watchdog lets the 30 s manifest wait print its diagnostic, while the passing test stays under 30 s). Its four child logs each inserted the layer and had no missing-layer message or VUID- error. The warm run loaded two manifest modules, created two native compute pipelines, served two distinct prepared hits, issued two dispatches, and logged zero compute-sync, compute-wait, or skipped dispatches. The omitted-variant control logged one compute-sync miss and produced the cold reference output.
  • Failure-path checks: a replay command that exited 0 without a frame or dump returned test failure 1; an unavailable Vulkan ICD skipped only when ANYPS5_REQUIRE_VULKAN was unset and failed when it was set. The passing GPU run reported two prepared hits and the omitted-variant miss.
  • Manifest .kpm and shader .code files were saved and reloaded. Persisted SPIR-V caching was disabled, and --cold-pipelines disabled the Vulkan driver pipeline cache, so native readiness is reported separately from code storage or cache hits.
  • python3 tools/check_conventions.py --base origin/AnyKyty, python3 tools/check_kyty_settings.py, and the genuine warning fixtures test_kyty_pgo.py (7/7), test_relinker_fuzz_fixture_warnings.py (9/9), and test_check_kyty_settings.py (19/19) passed. This fork has no origin/main ref, so the template's base check used its AnyKyty target.
  • Re-ran python3 -I tools/kyty_pgo.py report --annotate on the exact-head Linux Kyty CI log: exit 0. The existing profile advisory reports 424 lost functions and 18.95% weight. AnyKyty, Offline checks, and portability passed at head 5aa3ca65c7. Hosted Linux and Windows skipped the prepared GPU fixture; the local Vulkan run above exercised it. No title runtime was available for testing.

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: Fixes Verify prepared shader variants are reused on first dispatch or draw #327
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 616.64.0.0, Windows 11 Pro (build 26200) (prepared replay); Intel(R) Graphics, driver 32.0.101.8331, Windows 11 Pro (build 26200) (buffer cache test)
  • AI-assisted: yes

@simnJS simnJS left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The two native ready-pipeline hits, output checks and omitted-variant control cover #327. Please reserve exit 77 for a confirmed Vulkan device limitation. Right now a failed seed replay or missing frame or dump also skips when ANYPS5_REQUIRE_VULKAN is unset. Please give the four-child test enough time to surface the manifest wait diagnostic, and update the Tested link when CI for this head completes. The Linux run linked now belongs to the base commit.

@simnJS simnJS left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The skip handling and CI link are addressed. The outer CTest timeout is still 60 seconds, while the two independent warm replays can each spend 30 seconds waiting for the manifest. Both seed runs and child startup also count toward that timeout. Please give the whole test enough budget for the replay to report its own timeout diagnostic.

mjnhbg3 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

I prepared a one-line follow-up for the remaining outer-timeout review request, based exactly on this PR's current head 5aa3ca65c7: commit acfdc20d8a.

It raises only kyty_shim_prepared_variant_first_use's outer CTest timeout from 60 to 120 seconds. The fixture runs four child replays in sequence; two warm replays can each spend 30 seconds in WaitForManifestCompletion, so the new watchdog leaves 60 seconds for seed runs and child startup while allowing the replay's own timeout diagnostic to surface.

I checked the two wait call sites, git diff --check, and python3 tools/check_conventions.py --base upstream/AnyKyty; all passed. I did not rerun the GPU fixture because its executable and runtime code are unchanged. This commit is offered to the author for review or cherry-pick; I have not opened a companion PR. AI-assisted: yes.

@github-actions

Copy link
Copy Markdown

The proposed 120-second CTest timeout addresses the review concern: the two sequential 30-second manifest waits could exhaust the current 60-second budget before the second replay prints its diagnostic. The supplied PR diff still shows 60 seconds, so please apply the timeout change to this PR and confirm that CTest reports 120 seconds for the fixture after reconfiguration.

@simnJS simnJS left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The integration includes the 120-second watchdog follow-up. Both CI suites passed on the tested candidate.

@simnJS
simnJS merged commit 5aa3ca6 into simnJS:AnyKyty Nov 27, 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.

Verify prepared shader variants are reused on first dispatch or draw

2 participants