#pragma once #include #include #include #include "kernel_runtime.hpp" namespace deep_gemm { class KernelRuntimeCache { std::unordered_map> cache; public: // TODO: consider cache capacity KernelRuntimeCache() = default; std::shared_ptr get(const std::filesystem::path& dir_path) { // Hit the runtime cache if (const auto iterator = cache.find(dir_path); iterator != cache.end()) return iterator->second; if (KernelRuntime::check_validity(dir_path)) return cache[dir_path] = std::make_shared(dir_path); return nullptr; } }; static auto kernel_runtime_cache = std::make_shared(); } // namespace deep_gemm