Do the whole warm on the boot screen at the first start after a driver change.

A start that finds the pipeline cache written by another device or driver has nothing built, and everything was
compiled beside the game: an 8-core integrated GPU drew fewer than 600 frames in its first 11 minutes. Such a start
now waits on the "Preparing shaders" screen, with counts, for every recorded pipeline, for the compute pipelines on
every core at normal priority, and, when a sample says the driver's own cache lacks the prepared stage libraries, for
all of them on every core. The memory gate still holds for the builds, and the library builds write the preparation's
journal while the start waits, so a variant the driver's compiler dies on is skipped from the next start on.

boot-warm-owed.txt beside the caches names the GPU and driver: a start closed during the warm is followed by one that
goes on with it, three at most, and "done" keeps later starts ordinary while the cache file still carries the earlier
driver's header. When the boot stops waiting (prewarm_wait_ms, or a minute without progress) the builders step down
to the background's thread counts and idle priority. prewarm_full = 0 turns the warm off.

With nothing in the driver's cache the probe took 425 s on an RTX 5090 with 16 CPU threads: 87 s for 5,775 recorded
pipelines, 19 s for 4,075 compute pipelines and 317 s for 42,231 prepared variants.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-12 20:03:12 -05:00
parent 016c90fafb
commit cd0b1a387d
14 changed files with 443 additions and 59 deletions

View File

@@ -943,10 +943,15 @@ void vk_pipeline_prewarm(void);
// Ends the boot prebuild's crash marker (vk_pipeline.c, "boot prebuild crash marker"): boot_wait calls it when it lets
// the game start while the prewarm goes on, so a crash in play is not taken for one in the boot's builds.
void vk_pipeline_prewarm_marker_clear(void);
// boot_wait calls it when it lets the game start while the prewarm goes on: the builders of the whole warm after a
// driver change (vk_pipeline.c bf_decide) go on as in play, at idle priority and in the background's numbers.
void vk_pipeline_prewarm_detach(void);
typedef struct {
int phase; // 0 starting (device, key file), 1 shaders, 2 pipelines, 3 done
// 0 starting (device, key file), 1 shaders, 2 pipelines, 5 done. Only in the whole warm after a driver change
// (vk_pipeline.c bf_decide): 3 compute pipelines, 4 the prepared variants built into the driver's cache.
int phase;
int64_t sh_done, sh_total, sh_translated; // gfx_shader_prewarm_progress
int64_t pipe_done, pipe_total; // pipelines built or failed of those queued
int64_t pipe_done, pipe_total; // pipelines built or failed of those queued; phases 3 and 4: their counts
} VkPrewarmProgress;
void vk_pipeline_prewarm_progress(VkPrewarmProgress *p); // any thread, while vk_pipeline_prewarm runs or after
VkPipeline vk_pipeline_compute(const GfxShader *cs, const VkPipeInfo **info);