pytorch
6367a9d2 - [vulkan] Shaders caching (#39384)

Commit
5 years ago
[vulkan] Shaders caching (#39384) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/39384 Introducing `ComputeUnitFactory` which is responsible for providing `ComputeUnit`s (Shaders), it caches it, using shader name (glsl file name)+workGroupSize as a cacheKey, just `std::map<string, std::shared_ptr>` Macro GLSL_SPV changed to have literal name for cache key as a first argument. All constructors of ComputeUnit are changed to use `ComputeUnitFactory` Ownership model: ComputeUnitFactory also owns `vkPipelineCache` that is internal vulkan cache object ( https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkPipelineCache.html ) `VContext` (global object) owns ComputeUnitFactory, that owns ComputeUnits, vkPipelineCache, for destruction of them we need valid VkDevice, so it should be destructed before `vkDestryDevice` in `~VContext` => As members of the class will be destructed only after destructor - forcing destruction of ComputeUnitFactory before `vkDestroyDevice`, doing `unique_ptr<ComputeUnitFactory>.reset()` Test Plan: Imported from OSS Reviewed By: AshkanAliabadi Differential Revision: D21962430 Pulled By: IvanKobzarev fbshipit-source-id: effe60538308805f317c11448b31dbcf670487e8
Author
Parents
Loading