D994 - Compiled pipelines are kept one checked entry a pipeline

Status: decided Date: 2026-10-26 known_by: measured

Amends D744. A title's compiled pipelines are still kept across runs in the titles library, but no longer as one Vulkan pipeline cache. Each pipeline is built through a pipeline cache of its own, and that cache's data is kept as one entry under host-pipelines/ (pipeline_cache).

Where an entry lives. A directory is named by the device and driver that made the data: <vendor>-<device>-<driver version>-<pipeline-cache UUID>. In it, an entry file is named by the pipeline's key:

What is checked before the driver sees a byte. An entry's envelope holds a magic, a format, the four identity fields, the key, the data's length and a hash of the data. An entry is handed to vkCreatePipelineCache only when every field matches this device, driver and pipeline, the file is exactly as long as the envelope says, and the data hashes as it says. The data must also begin with a version-one pipeline-cache header naming this vendor, device and UUID.

Fallbacks. Each failure compiles the pipeline afresh:

A driver that stops while loading. Loading one title's whole driver cache, hundreds of megabytes, has been reported to stop a driver on this title. An entry holds one pipeline's data. While the driver loads it, a marker file stands beside it. The next run drops any entry whose marker is left from the last, so one bad entry costs one run and one compile, not every boot after.

Opening the store also drops:

Entries are written through a temporary file and a rename.

The size bound. The store is kept within 4 GiB, at its opening and again after every 1 GiB a run writes. Entries are dropped in the order of their stamps, oldest first. Each entry a run finds or writes is stamped just before that run opened the store, a millisecond earlier for each one after. So every earlier run's entries go before this run's, and among this run's the last used go first. A boot's pipelines, the first a run uses, are kept longest.

Measured on Grand Theft Auto V, booting to its first in-world ray-traversal dispatch (0x74005b7e8600) under --limit 540, the two runs back to back on one build:

boot to in-world pipelines built by then, and their time whole run
cold, the store empty 194 s 750 in 60.1 s 1,163 in 89.0 s; 2.5 GB of entries written
warm, second boot 126 s 550 in 5.8 s, 314 found kept 1,313 in 35.0 s, 599 found; 1.3 GB read, 1.6 GB written

At the same 750 pipelines, the warm boot had spent 23.8 s against the cold one's 60.1 s.

The compile watch counts every pipeline it builds (compile_watch::tally). It writes a line every fifty pipelines and once at the run's end. Each line gives how many were built, their time together, the longest, and how many were found kept.

Tests.

Rejected: