RADV Radeon Vulkan Driver Begins Landing Graphics Pipeline Library Support
VK_EXT_graphics_pipeline_library is the extension that debuted in Vulkan 1.3.210. That extension made public back in March allows for shaders to be compiled earlier than at the pipeline state object creation time.
VK_EXT_graphics_pipeline_library allows for separating the shader compilation into four distinct parts of the graphics pipeline to allow for portions of the shader compilation to happen earlier and to allow for more re-use of pipelines sharing the same shaders or states across multiple pipelines. This modularity improvement to the Vulkan graphics pipeline was worked on by Valve, AMD, NVIDIA, Google, Ubisoft, and other vendors.
Longtime open-source graphics driver developer Samuel Pitoiset with Valve's Linux graphics driver team has been wiring up VK_EXT_graphics_pipeline_library support for RADV. He wrote in thos now-merged MR:
This experimental and very suboptimal implementation of graphics pipeline library shouldn't be used by anyone, except for development purposes. It's still under active development from my side. This extension is only exposed via RADV_PERFTEST=gpl anyways.
It's very suboptimal because RADV doesn't yet support PS epilogs and VS prologs need to be improved/reworked because GPL changed the logic (eg. can't know the next stage when compiling a prolog). So, currently the driver ALWAYS retains NIR shaders during libs creation and it links and compiles in the final pipeline.
I have WIP branches for approximately everything but it looks simpler to start merging an initial implementation in order to improve steps by steps from main. This commit might look simple and short but I already merged TON of preliminary work. RADV was definitely not ready for GPL and it's still not completely fine. Expect refactoring again.
This implementation currently pass dEQP-VK.pipeline.pipeline_library.* on NAVI21, except few feedback creation tests due to CTS bugs.
This is still very much a work-in-progress but at least the initial 400 lines of code for the graphics pipeline library was merged and hopefully more of the implementation will be readied by the Mesa 22.3 release next quarter.