Skip to content
Prev Previous commit
Next Next commit
Update on "[ET-VK] Use VkPipelineCache file if path is specified"
## Context
Pipeline creation involves the compilation of shader SPIR-V code into machine-specific code. This makes the application's first model-load via the `Program::load_method()` ET-API very slow, due to the creation of compute pipelines via the `vkCreateComputePipelines()` VK-API. To amortize that cost, Vulkan offers a [Compute Pipeline Cache API](https://docs.vulkan.org/guide/latest/pipeline_cache.html). Following [this Vulkan example](https://github.com/KhronosGroup/Vulkan-Samples/tree/main/samples/performance/pipeline_cache), we can (1) retrieve the compiled machine-specific code saving it to a file and (2) load it to a file next time. For an internal model executing on a resource-constrained device, this improves model-load time from ~1200ms to ~500ms.

## This change
We implement the logic for (2), though this change is a no-op unless you initialize the `pipeline_cache_file_path` manually. The expectation is for the client application to specify the file path of their pipeline cache data if they want to leverage this optimization. Before that's ready, we will

A. Expose this file_path config parameter to the ET-API, and
B. Demonstrate (1) how to retrieve the data to save to a file.

Differential Revision: [D57085276](https://our.internmc.facebook.com/intern/diff/D57085276/)

[ghstack-poisoned]
  • Loading branch information
Jorge Pineda committed May 8, 2024
commit e8729687ab5e3312fa9696f623aa5f691d7abb07

This merge commit was added into this branch cleanly.

There are no new changes to show, but you can still view the diff.