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

@@ -380,6 +380,7 @@ static void boot_wait(PlatThread *warm, uint64_t cap_ms) {
if ((cap_ms && now - t0 >= cap_ms) || now - moved >= BOOT_STALL_MS) {
plat_thread_detach(warm);
vk_pipeline_prewarm_marker_clear();
vk_pipeline_prewarm_detach();
rt_log("boot: the prewarm goes on in the background after %llu ms (%s)", (unsigned long long)(now - t0),
cap_ms && now - t0 >= cap_ms ? "NX2NAVI_PREWARM_WAIT_MS" : "no progress for 60 s");
break;
@@ -423,9 +424,11 @@ void rt_boot(void) {
uint64_t held = plat_now_ms();
// The guest waits for all of the prewarm (boot_wait): a warm start is ready in about half a second; a cold one (a new
// translator, GPU or driver) translated 2,987 shaders in about 11 s and then builds the recorded pipelines, with the
// boot screen showing its progress. Started early instead, the game would meet those shaders in play and wait for
// each one there. NX2NAVI_PREWARM_WAIT_MS caps the wait (0, the default: none); past it the prewarm goes on in the
// background. A --shot image waits for all of it without the screen, so that it does not depend on build timing.
// boot screen showing its progress; after a driver change also the compute pipelines and the driver's cache of
// stage libraries (vk_pipeline.c bf_decide). Started early instead, the game would meet those shaders in play and
// wait for each one there. NX2NAVI_PREWARM_WAIT_MS caps the wait (0, the default: none); past it the prewarm goes
// on in the background. A --shot image waits for all of it without the screen, so that it does not depend on build
// timing.
const char *pw = cfg_get("NX2NAVI_PREWARM_WAIT_MS");
uint64_t wait_ms = pw && *pw ? strtoull(pw, NULL, 10) : 0;
if (warm && rt_config()->shot) plat_thread_join(warm);