Make every pipeline built ahead of its first use pass a memory gate that counts the builds already running.

Only the large compute shaders' background builder looked at the system's commit before it started a build, and it
saw nothing of what the builds beside it were about to take. The boot's recorded pipelines (up to 64 builders), the
pool's background builds during play, the boot's compute pipelines and stage libraries and the library warm asked
nobody.

Each of them now asks the gate before a build. A build that starts reserves an estimate of the driver compiler's
working memory until it ends (build_reserve_mb, 64 MB; 4096 MB for a large compute shader), and the gate admits a
build only while the commit headroom holds the part kept free (build_free_mb, 4096 MB), the reservations and its own.
A refused boot builder ends and leaves its pipelines to the pool; the pool leaves a background build queued and asks
again every two seconds; the stage library prebuild and the library warm wait up to 30 seconds and then end, and the
warm goes on at the next start. A pipeline a draw or a dispatch waits for is never refused. The preparation of the
pipeline list runs without the gate: no game runs beside it.

tests/build_gate_check.py checks the gate's arithmetic and, through --probe-buildgate, its answers with the machine's
own commit. What the builders do when refused is not exercised by a test.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-11 04:42:07 -05:00
parent 534591be04
commit 39fa0be78c
9 changed files with 404 additions and 10 deletions

View File

@@ -161,6 +161,15 @@
# (0: no limit). Each large shader costs the driver 1-4 GB; on a 31 GB machine four of them took the process from 15 to
# 29 GB and the game stuttered, so raise this only on a machine with room to spare.
# big_build_max_mb = 4096
# Memory kept free of pipelines built ahead of their first use (at the start and in the background during play), in MB
# of commit headroom: RAM plus page file not yet promised to a program. Such a build starts only while this much stays
# free beyond what the builds already running are counted for; otherwise it waits or is left to the moment the game
# first needs the pipeline, which can hold a frame once but does not push a full machine into paging. A pipeline a
# draw is waiting for is always built. 0: no check. Default: 4096.
# build_free_mb = 4096
# What each such build is counted for while it runs, in MB: the working memory of the video driver's shader compiler.
# A very large compute shader is counted for 4096. Default: 64.
# build_reserve_mb = 64
# 1: the log says how many pipelines came from pipeline-cache.bin; 2 also logs every compute pipeline built. 0: off.
# pipe_feedback = 1
# pipeline-cache.bin larger than this (MB) starts empty and is rewritten (0: no limit).