FAST-PATHS: what is built around a cold making's driver time, and the compute kernels' case

The known gap on the cold making of a 200,000-word compositing module ended "Nothing is built
around it", which was not true. It now names what is:

- the driver records across boots (`shader_cache/driver.rs`), named by the driver's identity, so a
  driver update, another device or a removed content directory makes every making cold again, and
  no machine's records serve another's;
- pipeline records and `Device::warm`, which remake a previous process's creations on a thread of
  their own below every other making, and what they do not cover today (a compute state that
  states no required threadgroup size predicts nothing, so its dispatches' pipelines are made at
  their first dispatch);
- `PipelineWaitPolicy::Bounded` at creation and at commit, and dispatches that hand their making
  to the pool;
- the consumer's creation of guest states on a compile thread off the guest's command path.

It adds the compute case: a convolution kernel's 12 variants at a macOS 12.7.6 login, one SIMD8
program each of 6,222 to 8,925 instructions with 70 to 221 spills, and the host-load
sensitivity that made the same login's makings 2 to 13 times slower than alone.

Measured on the Iris Xe (Mesa 26.2.6), the dumped modules made by a scratch harness with
the logged specialization, one module of its own per making, the driver's disk cache off:
- the 23,108-word variant alone 0.27 to 0.34 s (jobs 18284, 18292); 11 at once 0.31 to 0.53 s
  each, 0.50 to 0.53 s for all (18293); device robustness on or off alike (18292);
- the 138,047-word fragment module alone 2.03 to 2.42 s, two at once 2.42 to 2.53 s each, four
  at once 2.69 to 3.33 s each (18284);
- under 20 and 30 busy threads on the 20-CPU host, that fragment making 6.27 and 7.94 s, and 11
  kernel makings at once under 20 busy threads 0.78 to 1.44 s each (18293);
- the program counts from INTEL_DEBUG=cs (18226).
The login's own numbers (4.87 s; 1.5 to 4.2 s, 10 or 11 at once; the guest's 1 to 197 command
buffers a second during the making) are the consumer's cold-login log at the 12.7.6 capture; the
3.1 ms warm making is the consumer's warm boot.

Docs only.
This commit is contained in:
Anees Iqbal committed 2026-11-11 18:36:17 -08:00
1 parent 61bb2acf30
commit 269d7066c4
1 file changed
+47 -4
+47 -4
View File
@@ -1123,8 +1123,9 @@ driver's. Each is open work.
GPU, once per cold cache; states that share the module then take 13 to 16 ms, and a warm cache
2 ms. The module inlines a few sampling helpers five or six times each; keeping one copy of each
would cut it. It is not built.
- **A cold making of a compositing fragment module of some 200,000 words takes its driver
seconds, once per module.** Its fragment shader library, cold with the driver's disk cache off
- **A cold making of a large module takes its driver up to seconds, once per module and
driver.** A compositing fragment module's fragment shader library, cold with the driver's disk
cache off
(203,016 words, macOS 26.7.2's fixed-function compositing shader, which a uniform buffer's state
drives): ANV on the Iris Xe (Mesa 26.2.6) 3.3 to 3.7 s at a load of about 16, its program 29,101
SIMD8 instructions with 34 spills; RADV on the Radeon 780M 1.3 to 3.0 s; the RTX 3090's driver
@@ -1135,8 +1136,50 @@ driver's. Each is open work.
instructions (29,110, 36 spills), its time within the run's noise, and holding `half` values in
16 bits across moves, phis and selects adds spills (103).
`VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT` leaves ANV's program and time, and the 3090's
time, as they were; RADV takes 0.9 to 1.0 s with it, at a draw cost not measured. Nothing is
built around it.
time, as they were; RADV takes 0.9 to 1.0 s with it, at a draw cost not measured. A convolution
kernel a macOS 12.7.6 guest dispatches at login is the compute case: its dispatches' 12
variants (22,874 to 29,651 words, `float` arithmetic) each compile on ANV into one SIMD8 program
of 6,222 to 8,925 instructions with 70 to 221 spills, the driver unrolling every loop (1,280
fused multiply-adds, 340 threadgroup loads, 116 barriers) with its accumulators live at once.
Made alone with the driver's disk cache off, the 23,108-word variant takes 0.27 to 0.34 s, and
11 variants made at once 0.31 to 0.53 s each, about 0.5 s for all 11; the 138,047-word
compositing fragment module of the same login takes 2.0 to 2.4 s alone, 2.4 to 2.5 s each two
at once and 2.7 to 3.3 s each four at once. The driver's time grows with the host's load: on
the same Iris Xe's host (20 logical CPUs), 20 threads kept busy beside it take that fragment
making to 6.3 s and 30 to 7.9 s, and the 11 kernel makings at once to 0.8 to 1.4 s each; a
cold login on that host while it ran other work (a load of 31 at the login's start) made the
fragment module in 4.87 s and the kernels in 1.5 to 4.2 s each, 10 or 11 at once. What is built
around the driver's time:
- **Each making once per driver.** A making's pipeline cache data is kept as its record
(`shader_cache/driver.rs`), and a later process over the same content directory finds the
pipeline in it: the consumer's warm boot of the 26.7.2 guest made the 203,016-word module's
state in 3.1 ms. A record is named by the driver's identity (vendor, device, driver version
and `pipelineCacheUUID`) besides the making's own content, so a driver update, another device
or a removed content directory makes every making cold again; Vulkan's cache data is the
driver's own and holds the compiled shaders, so no machine's records serve another's.
- **Made again before the program asks.** A consumer that keeps the pipeline records
(`DeviceOptions::pipeline_records`, descriptors and the libraries they name, not driver data)
and hands them to a later process's `Device::warm` has that device make the same translations
and predicted `VkPipeline`s on a thread of its own, below every other making
(`warm/pass.rs`): after a driver update, the cold makings run there, not at the program's
calls. A record is a state's creation, so the pass makes what a creation predicts: a compute
state whose descriptor states no `requiredThreadsPerThreadgroup` predicts no pipeline, and
its dispatches' pipelines (the kernel's 12 variants above) are made at their first dispatch.
- **No call waits the whole making.** Under `PipelineWaitPolicy::Bounded` (the default) a
creation waits `pipeline_creation_wait` (4.5 s) at most for its predicted making and returns
with it in flight, a committed command buffer waits for its commands' makings until its commit
plus `pipeline_commit_wait` (4.5 s) at most, and a dispatch hands its pipeline's making to the
device's pool and goes on (the ledger's `pipeline_waits` row, `pipeline/dispatch_making.rs`).
- **Off the guest's command path.** The consumer creates a guest's states on a compile thread
of its own: in the 12.7.6 login above, the guest's context recorded 1 to 197 command buffers
a second through the fragment module's 4.87 s making, and another state was created and made
meanwhile.
A making with no record still costs its driver's time once per module and driver: no
unoptimized first form shortens it where the driver ignores
`VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT`, and a state's pipeline is linked from its
libraries with no link-time optimization already (the link takes 0.0 ms of the fragment
module's 4.87 s).
- **On NVIDIA, a command buffer submitted while the runtime makes or frees a GPU pool block
completes as that call ends.** A queue's first lease of an index or mesh records pool makes its
block as the command buffer encodes where the device holds no spare of that kind, a block