From 6aae411c22e66bacc404a2d4b03b47f58345ac74 Mon Sep 17 00:00:00 2001 From: "Agarwal, Udit" Date: Fri, 15 Nov 2024 13:58:38 -0800 Subject: [PATCH] Remove build options from fast kernel cache key --- sycl/source/detail/kernel_program_cache.hpp | 19 ++++++++++++++----- .../program_manager/program_manager.cpp | 10 ++-------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/sycl/source/detail/kernel_program_cache.hpp b/sycl/source/detail/kernel_program_cache.hpp index 5794d6930016a..f58cda059bcce 100644 --- a/sycl/source/detail/kernel_program_cache.hpp +++ b/sycl/source/detail/kernel_program_cache.hpp @@ -163,10 +163,19 @@ class KernelProgramCache { ::boost::unordered_map; using KernelFastCacheKeyT = - std::tuple; + std::tuple; + using KernelFastCacheValT = - std::tuple; + std::tuple; + // This container is used as a fast path for retrieving cached kernels. // unordered_flat_map is used here to reduce lookup overhead. // The slow path is used only once for each newly created kernel, so the @@ -283,7 +292,7 @@ class KernelProgramCache { std::unique_lock Lock(MKernelFastCacheMutex); auto It = MKernelFastCache.find(CacheKey); if (It != MKernelFastCache.end()) { - traceKernel("Kernel fetched.", std::get<3>(CacheKey), true); + traceKernel("Kernel fetched.", std::get<2>(CacheKey), true); return It->second; } return std::make_tuple(nullptr, nullptr, nullptr, nullptr); @@ -294,7 +303,7 @@ class KernelProgramCache { std::unique_lock Lock(MKernelFastCacheMutex); // if no insertion took place, thus some other thread has already inserted // smth in the cache - traceKernel("Kernel inserted.", std::get<3>(CacheKey), true); + traceKernel("Kernel inserted.", std::get<2>(CacheKey), true); MKernelFastCache.emplace(CacheKey, CacheVal); } diff --git a/sycl/source/detail/program_manager/program_manager.cpp b/sycl/source/detail/program_manager/program_manager.cpp index 0c188b9fef718..25e03bff57a82 100644 --- a/sycl/source/detail/program_manager/program_manager.cpp +++ b/sycl/source/detail/program_manager/program_manager.cpp @@ -964,17 +964,11 @@ ProgramManager::getOrCreateKernel(const ContextImplPtr &ContextImpl, using KernelArgMaskPairT = KernelProgramCache::KernelArgMaskPairT; KernelProgramCache &Cache = ContextImpl->getKernelProgramCache(); - - std::string CompileOpts, LinkOpts; SerializedObj SpecConsts; - applyOptionsFromEnvironment(CompileOpts, LinkOpts); - // Should always come last! - appendCompileEnvironmentVariablesThatAppend(CompileOpts); - appendLinkEnvironmentVariablesThatAppend(LinkOpts); + ur_device_handle_t UrDevice = DeviceImpl->getHandleRef(); - auto key = std::make_tuple(std::move(SpecConsts), UrDevice, - CompileOpts + LinkOpts, KernelName); + auto key = std::make_tuple(std::move(SpecConsts), UrDevice, KernelName); if (SYCLConfig::get()) { auto ret_tuple = Cache.tryToGetKernelFast(key); constexpr size_t Kernel = 0; // see KernelFastCacheValT tuple