vk_pipeline_get_deferred keeps its contract: it gives a pipeline or a stand-in, and the recording thread waits for a stand-in at its bind. Inside it, a new Pipe on the GPL path goes this way:

  1. vk_pipe_split gives the four keys. Each key finds its entry, or adds one.
  2. A part that is new goes to the workers. A PR or FS part goes to the head of the draws' queue. A VI or FO part is made on the GPU thread at once, because it costs microseconds. A part that the startup pass queued (prewarm) moves to the draws' queue, as pipe_promote does now.
  3. When the PR and FS parts are ready, a worker links the four with VkPipelineLibraryCreateInfoKHR, with no LINK_TIME_OPTIMIZATION flag. This is the fast link. It sets Pipe.fast and the ready flag.
  4. Once the link was drawn in PIPE_OPT_PRESENTS (3) presents, the optimized pipeline goes on a third queue, below the draws' queue and the file's queue: rec_CmdBindPipeline counts the presents the link's stand-in is bound in (vk_pipeline_bound), and the worker that makes the link queues it when its draws asked before it was ready. A link a scene draws once (a loading screen's, one of the file's that no draw asks for again) takes no worker for it. A draw that binds the link's own handle, as vk_pipeline_get gives it without the recording thread, asks for it at once. It is the same link with VK_PIPELINE_CREATE_LINK_TIME_OPTIMIZATION_BIT_EXT, into g_pipeline.pcache. All parts are made with VK_PIPELINE_CREATE_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT (VUID-VkGraphicsPipelineCreateInfo-flags-06609). When it is done, it sets Pipe.opt.

If all parts are ready at step 1, the GPU thread makes the fast link itself, in about 1 ms, and gives the real pipeline with no stand-in. The measurement must show if that cost is small enough on the GPU thread. If it is not, the link goes to a worker as in step 3.

The stand-in resolves to the best pipeline at its bind. vk_pipeline_resolve, vk_pipeline_ready and vk_pipeline_now read opt first, then fast, each with acquire order. They wait (only resolve) while neither is there, which is the time of a part compile and a link. The wait never includes the optimized pipeline.

The swap:

The lock fixes of 92df965c9 need nothing more. The workers take no vk_lock. The recording thread waits at the bind as before, with no renderer lock held, and the wait is now short.

When the device has no fast link (graphicsPipelineLibraryFastLinking false), a link is a compile. The GPL path then stays off (see Without the extension).


Made from docs/layers/gpu/pipeline-libraries.md at 69237645142c. GPL-3.0-or-later.