ShaderLayoutCache Class — pytorch Architecture
Architecture documentation for the ShaderLayoutCache class in Shader.h from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/vulkan/api/Shader.h lines 111–150
class ShaderLayoutCache final {
public:
explicit ShaderLayoutCache(VkDevice device);
ShaderLayoutCache(const ShaderLayoutCache&) = delete;
ShaderLayoutCache& operator=(const ShaderLayoutCache&) = delete;
ShaderLayoutCache(ShaderLayoutCache&&) noexcept;
ShaderLayoutCache& operator=(ShaderLayoutCache&&) = delete;
~ShaderLayoutCache();
using Key = ShaderLayout::Signature;
using Value = ShaderLayout;
struct Hasher {
inline size_t operator()(const ShaderLayout::Signature& signature) const {
size_t hashed = 0u;
for (const VkDescriptorType type : signature) {
hashed =
utils::hash_combine(hashed, std::hash<VkDescriptorType>()(type));
}
return hashed;
}
};
private:
// Multiple threads could potentially be adding entries into the cache, so use
// a mutex to manage access
std::mutex cache_mutex_;
VkDevice device_;
std::unordered_map<Key, Value, Hasher> cache_;
public:
VkDescriptorSetLayout retrieve(const Key&);
void purge();
};
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free