Repository navigation
Todo
Description
We're claiming this issue and will own the implementation.
Goal
Discover and prepare shader and Vulkan pipeline variants before a title's first interactive launch. With a prepared cache, the tested scenes should perform zero shader translations and zero driver pipeline compilations during gameplay.
The current manifest can warm known recipes. The file scanner can recover shader code from supported containers, and some variants still depend on descriptor shapes, linked code, or render state selected at runtime.
Work to do
- Add an offline inventory mode that scans supported shader containers and extracts shader code, creation metadata, and any shipped pipeline recipes. Report inputs that could not be read or resolved.
- Generate recipes from the available metadata. Start with generic compute variants that can serve multiple compatible descriptor shapes. Use available render state to prepare graphics pipelines or their reusable parts.
- Merge recipes collected by instrumented playthroughs for states that become observable at draw or dispatch time. Use
kyty_precacheto prepare the merged manifest on the target GPU before the first interactive launch. - Measure coverage for guest shader discovery, host shader variants, and ready Vulkan pipelines. Record why each first-use miss occurred, including unavailable, incompatible, or unfinished recipes.
Acceptance criteria
- A synthetic fixture verifies that offline inventory finds packaged shaders and produces the derivable recipes without launching the title executable.
- Starting from an empty emulator cache, run the offline precook and launch with its output. On a documented reference route, record zero in-game shader translations, zero Vulkan pipeline compilations, and zero draws or dispatches skipped for a missing pipeline. Verify the expected output and report the GPU and driver.
- A control that leaves out a known recipe reports the expected miss. Report coverage for the tested route and settings so gaps can be tracked as new paths are exercised.
Metadata
Metadata
Assignees
Labels
No labels
Activity
github-actions commentedon Nov 26, 2026
Thanks for claiming this. In the PR, please distinguish a hit in Kyty’s recipe cache from evidence that the Vulkan driver did not compile a pipeline. Document how you measured that on the reference GPU and driver, and use the omitted-recipe control to verify that the first-use miss is reported.
simnJS commentedon Nov 26, 2026
We extracted 16,040 distinct guest shader programs directly from the local files of a native PS5 title, without a prior session cache. Creation metadata matched 15,494 programs. The offline compute catalogue found complete creation inputs for 3,197 programs. This establishes shader and creation-record coverage. The full render-state recipes are still under investigation.
The instrumented graphics run captured all 20 queued pipeline recipes observed in that run. Nineteen were absent from its saved manifests, and the local shader store contained every referenced code blob. The collector can now merge those recipes into the offline precook inputs.
For driver-level evidence, the audit probes pipeline creation with
VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT. It reports successful no-compile calls, calls requiring compilation, and unverified outcomes separately from Kyty recipe lookups. On an RTX 4080 SUPER with NVIDIA 595.99.02, a synthetic compute replay produced matching output. A cold driver-cache pass exposed a compile-required create, while both audited creates succeeded with compilation disabled on the warm repeat. The real reference route still needs an end-to-end run with its prepared and omitted-recipe inputs.github-actions commentedon Nov 26, 2026
The cold/warm synthetic result validates the audit, but it doesn’t yet show that precooking alone prepares the reference route. For the end-to-end run, start each arm with an empty emulator cache and an isolated cold driver cache before precooking, so the prepared run can’t warm the omitted-recipe control. Report any unverified pipeline creates separately rather than counting them as no-compile successes.
simnJS commentedon Nov 26, 2026
The native asset investigation found a shipped effect and pass database. Two bundles contain 934 effects and 29,912 passes, with stage selections and render-state references. The shader stage pairs for all 20 instrumented graphics misses occur in the shipped tables. The broader comparison matched 1,131 of 1,153 graphics recipes by stage pair. This is a practical source for first-launch graphics coverage. Attachment formats and concrete descriptor views still need to be mapped and verified.
The executable also contains detached shader creation headers. Indexed relocation records and direct shader creation calls recover 577 validated header/code associations automatically. This brings the offline inventory to 16,040 of 16,040 indexed programs with creation headers, yielding 3,737 launch recipes for 3,729 compute programs. The recipes include the guest program hashes of every compute miss in the two measured runs. Exact variant compatibility and ready Vulkan handles are the remaining tests.
github-actions commentedon Nov 26, 2026
For the reference route, please report how many shipped stage-pair matches resolve to exact pipeline recipes after attachment formats and descriptor views are accounted for. Keep stage-pair-only matches separate so the coverage numbers show which recipes can actually be precooked.
simnJS commentedon Nov 26, 2026
Two embedded effect tables in the executable account for another 18 graphics recipes. The offline stage-pair match is now 1,149 of 1,153 reference recipes. The four remaining recipes have a vertex-side program present in the shipped data but no fragment stage in the live depth/stencil pipeline. Comparing actual state still matters. We also observed identical host shader-module combinations used with different attachment formats.
On the reference RTX 4080 SUPER, the long offline pass recorded 187 seconds of summed shader translation time and 2,738 seconds of summed pipeline creation time across four workers. These are cumulative worker times. The graphics manifest finished earlier, leaving a compute-only tail at the time limit. This makes repeated driver work and the long compute tail the main optimization targets.
The matching-build PC repeat now restores 1,408 modules and enters the precook gate before guest entry. The earlier run with a mismatched shader-store stamp is excluded from the warm reference measurement. The audit will record the gate release and driver compile results for the measured route.
simnJS commentedon Nov 26, 2026
The matching-build PC run completed all 3,097 startup jobs in 153.35 seconds before guest entry. The audit then recorded 14 shader builds and 29 create calls for which Vulkan returned
VK_PIPELINE_COMPILE_REQUIREDduring the observed route. Eighteen of the 29 were graphics library calls, ten were compute pipelines, and one was a full graphics pipeline. The test hit its time limit and did not establish zero in-game compilation.We also compared four and six preparation workers on the same RTX 4080 SUPER and NVIDIA 595.99.02. Each arm started with the same 41 shader modules and 32 pipelines, four concurrent Vulkan compute-call slots, and an empty Vulkan cache. NVIDIA's disk cache was disabled. The elapsed times were 9.086 s vs 8.094 s, and 9.104 s vs 8.101 s when the order was reversed. Both arms completed all jobs. This is about an 11% reduction on that batch.
The fragment-output library change reduces distinct keys from 68 to 46 in the 1,153-recipe trace. Its actual rendering-path gain and the remaining speculative library work are still being measured.
simnJS commentedon Nov 26, 2026
The shipped pass tables contain 29,926 pass records. Resolving the referenced shaders and explicit rasterizer, depth/stencil and blend state yields 12,513 distinct graphics signatures. In a reference capture, 581 graphics recipes used 482 distinct stage sets, with up to 38 recipes for one set. The attachment and resource state chosen at runtime still determines how many Vulkan variants these signatures produce.
The targeted startup seed resolved the exact compute variant that previously caused a roughly nine-second wait. Vulkan confirmed a cache hit before guest entry, and all 3,445 scheduled precook jobs finished before the guest started. The subsequent loading route still requested 118 compute pipeline compilations and eleven graphics pipeline or library compilations within the validation window.
Six synchronous stalls came from three compute programs with two buffer specializations each. The stalls took roughly 10–11 seconds each. CPU checks on the recorded resource plans confirm that the populated form can serve the observed empty descriptors with the existing guards. The populated form is therefore a candidate to prioritize during precook.
Four cold driver replays of the original blocked module took 14.5–14.9 seconds on this PC. The Vulkan optimization-disable flag produced no useful improvement. Compatible image-table and image-heap variants can now be rebound in CPU tests. The next runtime validation will measure how many compile-required events this avoids.
github-actions commentedon Nov 26, 2026
The confirmed pre-entry cache hit is a useful result: the startup seed addressed the previously identified stall, but the loading route still falls short of the zero-compilation target.
For the next runtime check, please compare the same route with and without compatible variant reuse. For the six previously stalled dispatches, verify output and report which still return
VK_PIPELINE_COMPILE_REQUIREDand how much synchronous wait remains. The CPU checks establish compatibility for the recorded resource plans, but not yet correct GPU output or reuse without compilation.simnJS commentedon Nov 26, 2026
The 118 compute compile-required events correspond to 108 distinct guest shader programs. All 108 were matched to shader bytes and compute creation metadata in the offline inventory. We traced 105 programs to the shipped shader archive and three to the executable. The startup seed already contained recipes for 37 of the 108 programs. The result narrows the remaining work to precook selection and resource specializations supplied by guest dispatches.
An earlier comparison revealed that the manifest scheduler still limited large jobs to four workers even when the offline driver budget was set to six. After wiring that budget through the scheduler, the same cold batch of 25 heavy recipes completed in 73.6 seconds with six concurrent Vulkan calls and 105.7 seconds with four. Both arms completed the same set of 24 compile-required pipeline creates. The roughly 30% reduction measures offline batch time on one PC.
The four remaining graphics keys in that run share attachment and fixed state with prepared pipelines. One needs a changed indirect sampler mapping and its normal/plain companion. The other two use native table-binding shader modules. Capturing those exact native modules and pipeline routes is the next graphics work.
github-actions commentedon Nov 26, 2026
The scheduler fix cut cold batch time by about 30% on the reference PC with the same set of compile-required creates. That measures offline preparation time, not gameplay coverage.
For the 37 programs already represented in the startup seed, how many had the exact runtime variant fully prepared before guest entry? That split will help distinguish missing specializations from cases where a prepared variant still resulted in
VK_PIPELINE_COMPILE_REQUIRED.simnJS commentedon Nov 26, 2026
An offline holdout experiment used only shipped guest code and validated static creation records to generate candidates. For 13 programs that had no prepared recipes in the baseline, it produced 87 candidate entries. Comparing afterward against 17 held-out runtime recipe entries found one exact match.
The match is a compute shader with six direct runtime-stride buffers. A standalone cold Vulkan run started with an empty pipeline cache and disabled the driver's disk cache. It successfully created the three generated dispatch-mode pipelines, including the exact pipeline ID from the held-out runtime demand. This demonstrates that an exact unseen variant can be built before guest entry using that shader's static data.
We also have a separate graphics holdout result. A generator based on older sampler layouts and shipped stage pairs generated 184 candidate recipes. One reproduced a later exact graphics key, including its sampler specialization and render state. This result is a recipe-level match so far. The number of candidates makes broad speculative warmup a separate cost to measure.
For the compute misses that use indirect descriptors and mixed image types, creation headers and shader instructions leave descriptor mappings and some per-view types unresolved. The next work is to use additional shipped resource evidence to narrow those candidate sets. Contribution guidance and a reproducible investigation prompt are in #343.
github-actions commentedon Nov 26, 2026
The cold Vulkan replay shows that one exact held-out compute variant can be built from static inputs. The graphics result is still a recipe-key match, not a verified ready pipeline.
For the next holdout, please keep the runtime recipes out of candidate generation and report exact matches and cold precook wall time before and after adding shipped resource evidence. That will show whether the new evidence improves coverage without expanding speculative work.
simnJS commentedon Nov 26, 2026
Cold-start measurements and remaining work
One audited run finished all 4,058 scheduled precook jobs before guest entry. During the run, the recompiler built 55 shader variants and the driver returned
PipelineCompileRequiredfor 83 create attempts. There were 40 compute attempts, 18 graphics pipeline attempts and 25 library attempts across 18 distinct library keys. The trace also recorded 20 skipped draw requests.We recovered the exact SPIR-V for 39 of those 40 compute variants. All 39 byte streams were distinct. In a separate join against the first 34 synchronous compute requests, 31 matched modules with materialized image-heap roots. The median interval from module publication to the synchronous request was 12.75 ms.
The local work pairs earlier scheduling of exact image-heap variants with live descriptor validation at dispatch. A CPU regression verifies that preparation with placeholder addresses produces the same module ID and SPIR-V as live materialization and that placeholder bindings cannot reach execution. Graphics preparation is separately bounded before the first pipeline-library link.
Useful contributions include a reproducible way to derive a currently missing resource layout offline, or a case where two keys can share a shader module because their generated code and binding layout are equivalent. Detector patches, synthetic fixtures and opaque variant IDs can be shared. The local files are used to regenerate the shaders and driver cache. See #343.
github-actions commentedon Nov 26, 2026
The placeholder regression is a useful CPU check, but it doesn’t yet show that earlier scheduling makes the pipeline ready by dispatch. On the same route, how many of the 31 matched image-heap requests have a ready pipeline at dispatch with early scheduling enabled versus disabled? For the remaining misses, distinguish preparation still in flight from creates that return
VK_PIPELINE_COMPILE_REQUIRED.github-actions commentedon Nov 26, 2026
The 20 skipped draws are a separate acceptance gap from the compile-required counts. On the same reference route, can you group those skips by the first missing dependency—shader variant, pipeline library, or final pipeline—and distinguish preparation still in flight from work that was never queued? That will show whether the graphics prep bound addresses the skips or whether recipe coverage is still the blocker.
simnJS commentedon Nov 26, 2026
Replay with the merged manifest
On Linux with an NVIDIA GeForce RTX 4080 SUPER and driver 595.99.02, the run at
638fb7979eecompleted its preparation gate, then recorded 55 shader translations, 83 pipeline creates requiring compilation, and 20 skipped draws after guest entry. The GPU watchdog ended that run.I used the prepared manifest from before that run and the recipes collected during it to stage an isolated seed. The queued-recipe collector found 10 complete captures and reported zero incomplete records or missing dependencies. The seed added 54 shader modules and 13 graphics recipes after deduplication and verified all code dependencies against the portable code store. A standalone warmup using the compatible driver cache resolved 39 of 40 observed compute keys and 12 of 18 observed graphics pipeline keys without compilation.
Two further launches used the same executable and startup route, isolated copies of the initial caches, and identical audit settings. The second used the merged and prewarmed seed. Both completed the preparation gate and issued guest draws and dispatches. Over the first 100 seconds after guest entry:
The remaining compute miss yielded a recipe for the next replay.
Independent recipe checks
0f7342058c984557. A standalone replay with empty Vulkan and driver disk caches created that exact pipeline. This pass was absent from the held-out gameplay capture.6684255b6fcb6062. A standalone cold replay created it. The 22-recipe capacity-step sweep had zero exact matches in a separate held-out graphics run.To rerun the merge, pass the baseline and recorded manifests to
tools/graphics-precache/collect.pyand keep the matching code store with the result. Prewarm a private cache under the same Vulkan device settings. EnableKYTY_PIPELINE_COMPILE_AUDIT=1andKYTY_SHADER_VARIANT_LOG=1for both launches and comparetools/kyty_precook_audit.pyover the same guest-entry-relative window, including theskippedroute. Keep runtime captures, resource data and caches local.Full compute sweep
The 12 disjoint worklists accounted for all 2,227 assigned compute programs. Shipped shader bytes and creation records produced 23,817 distinct module candidates for 2,220 programs. The staged modules passed SPIR-V Tools in Vulkan 1.3 mode with the runtime-required
uniformBufferStandardLayout. Seven programs stopped during sampler or image descriptor tracking. The manifest and code rows were checked against the frozen inputs for duplicate IDs and payload conflicts.The gameplay witness was excluded from generation. Only two of its 29 observed compute program identities were inside this sweep. Those two yielded 12 module candidates and zero exact portable recipe or driver-key matches. This sample measures the coverage of the sweep against that witness.
A separate trace-guided case linked a native technique constructor to a fixed pass-selection lane. The static pass enumeration selected all 18 distinct program identities observed on that lane in the published trace. The compiled variants still depended on live descriptors. For one program, three formatted slots were empty in an early specialization and populated in a later one. An isolated CPU probe found that the populated specialization serves the empty request when all three descriptor record counts are zero. Standalone cold Vulkan replay created the populated key
4f471a4719926513.Independent review and follow-up replay
A second review covered the same 2,227 programs from the shipped inputs. It reproduced the seven extraction failures and recovered all seven CPU resource plans in separate diagnostics. Matching the runtime sampler mode recovered six. For the remaining image case, tracing the scalar descriptor through a lane spill showed that unrelated lane writes stopped provenance tracking. Ignoring only those unrelated writes in an isolated diagnostic recovered the plan. These checks establish resource provenance and plan coverage for these seven programs.
Native constructor and dispatch evidence established three additional full recipes, and all three matched their Vulkan creation keys. Further analysis of the same selector also derived an exact recipe for
5cd13e33d273641cindependently of an archived gameplay audit. The key already appears in the registry. The standalone replay created it starting with empty Vulkan and driver disk caches.An additional warm replay completed startup preparation and did not request the previous replay's remaining compute key. It exposed a different set of 13 distinct keys during the first 100 seconds, producing 15 compile-required creates, seven translations, and 18 skipped draws. The screenshot capture interval differed from the paired A/B test. The remaining demand and skipped draws varied between runs, so the paired reduction does not establish consistently compilation-free gameplay. Complete captures from this replay were merged into the next isolated seed.
The resulting isolated seed completed all 4,351 preparation jobs on the reference PC, with zero failed modules or pipelines. During this warmup it resolved five compute keys and two graphics pipeline keys from the third replay without compilation.
github-actions commentedon Nov 26, 2026
The matched replay shows a clear improvement in the first 100 seconds, including zero skipped draws. The cold replay also shows that shipped metadata can produce an exact compute pipeline without a runtime recipe for that pass.
After adding the remaining compute recipe, can you run the merged seed through the full documented reference route and report all three acceptance counts, including skipped dispatches, and whether the rendered output matches expectations? If either shader translation remains, note whether it belongs to the compute miss or needs a separate recipe.
github-actions commentedon Nov 27, 2026
The reported sweep shows that static inputs can generate valid SPIR-V at scale, but only two of the 29 observed compute programs were in scope, and neither yielded an exact match. That’s too little overlap to judge route coverage.
For those two programs, what was the first mismatch against the observed variant: generated shader code, descriptor layout, or pipeline state? That would help identify what evidence to look for before expanding the sweep.
github-actions commentedon Nov 27, 2026
The cold replay confirms that shipped metadata can specify an exact compute pipeline without a gameplay capture for that pass. The 100-second comparison also shows that merging and prewarming recipes reduced first-use misses, but it doesn’t establish readiness across the full route.
As a negative control for the next replay, can you omit the newly captured compute recipe from an otherwise identical seed and verify that the audit flags the expected pipeline key and miss reason? Start both arms from isolated copies of the pre-merge cache so a leftover driver entry can’t mask the omission.
github-actions commentedon Nov 27, 2026
The cold replay confirms that shipped metadata can produce an exact compute pipeline without a gameplay capture. The 78 predicted keys validate candidate generation, but they don’t establish gameplay coverage. Likewise, zero matches in the held-out sampler-capacity sweep doesn’t justify adding that sweep to default precooking.
Can you report the added precook wall time and exact runtime hits for the speculative candidates, separately from the captured recipes? That would show whether the extra candidates pay for themselves on the reference route.
simnJS commentedon Nov 27, 2026
A Brainrot profiling run for #359 found a useful gap in the cache readiness signal on Linux/NVIDIA. The old native shader store belonged to an earlier build, so I rebuilt it for the current shader-store stamp using the same manifests and an existing driver-cache seed. The new runtime restored 6,846 shader modules and loaded a 1,724.93 MB Vulkan pipeline cache.
After startup released, a compute pipeline required compilation on its first runtime request. The driver creation took 7.82 s and the synchronous wait was 8.03 s. The preceding compile-required event and the completed driver creation have the same pipeline variant. This is one concrete case where the restored-module count and the populated driver cache leave a runtime variant uncovered. For the zero-compile check, the post-release
compile_requiredand synchronous-stall events are the relevant signals.github-actions commentedon Nov 27, 2026
The matching variant and 8.03 s wait show why a populated cache isn’t a readiness check. Was that exact variant in the scheduled precook manifest? If so, what outcome did precook record for it? That would distinguish a missing recipe from a scheduled recipe that didn’t produce a runtime cache hit.