Skip to content

Commit d4e22a7

Browse files
authored
[SYCL] Remove the unused Spec Consts variable (#16902)
Remove the unused Spec Consts component of the kernel fast cache key.
1 parent fb888b8 commit d4e22a7

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

sycl/doc/design/KernelProgramCache.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ The kernels map's key consists of two components:
115115
The third map, called Fast Kernel Cache, is used as an optimization to reduce the
116116
number of lookups in the kernels map. Its key consists of the following components:
117117

118-
- specialization constants values,
119118
- the UR handle of the device this kernel is built for,
120119
- kernel name<sup>[3](#what-is-kname)</sup>.
121120

sycl/source/detail/kernel_program_cache.hpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,9 @@ class KernelProgramCache {
220220
::boost::unordered_map<ur_program_handle_t, KernelByNameT>;
221221

222222
using KernelFastCacheKeyT =
223-
std::tuple<SerializedObj, /* Serialized spec constants. */
224-
ur_device_handle_t, /* UR device handle pointer */
225-
std::string /* Kernel Name */
226-
>;
223+
std::pair<ur_device_handle_t, /* UR device handle pointer */
224+
std::string /* Kernel Name */
225+
>;
227226

228227
using KernelFastCacheValT =
229228
std::tuple<ur_kernel_handle_t, /* UR kernel handle pointer. */
@@ -420,7 +419,7 @@ class KernelProgramCache {
420419
std::unique_lock<std::mutex> Lock(MKernelFastCacheMutex);
421420
auto It = MKernelFastCache.find(CacheKey);
422421
if (It != MKernelFastCache.end()) {
423-
traceKernel("Kernel fetched.", std::get<2>(CacheKey), true);
422+
traceKernel("Kernel fetched.", CacheKey.second, true);
424423
return It->second;
425424
}
426425
return std::make_tuple(nullptr, nullptr, nullptr, nullptr);
@@ -449,7 +448,7 @@ class KernelProgramCache {
449448
std::unique_lock<std::mutex> Lock(MKernelFastCacheMutex);
450449
// if no insertion took place, thus some other thread has already inserted
451450
// smth in the cache
452-
traceKernel("Kernel inserted.", std::get<2>(CacheKey), true);
451+
traceKernel("Kernel inserted.", CacheKey.second, true);
453452
MKernelFastCache.emplace(CacheKey, CacheVal);
454453
}
455454

@@ -504,7 +503,7 @@ class KernelProgramCache {
504503
FastCacheKeyItr != MProgramToKernelFastCacheKeyMap.end()) {
505504
for (const auto &FastCacheKey : FastCacheKeyItr->second) {
506505
MKernelFastCache.erase(FastCacheKey);
507-
traceKernel("Kernel evicted.", std::get<2>(FastCacheKey), true);
506+
traceKernel("Kernel evicted.", FastCacheKey.second, true);
508507
}
509508
MProgramToKernelFastCacheKeyMap.erase(FastCacheKeyItr);
510509
}

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,11 +1058,9 @@ ProgramManager::getOrCreateKernel(const ContextImplPtr &ContextImpl,
10581058
using KernelArgMaskPairT = KernelProgramCache::KernelArgMaskPairT;
10591059

10601060
KernelProgramCache &Cache = ContextImpl->getKernelProgramCache();
1061-
SerializedObj SpecConsts;
1062-
10631061
ur_device_handle_t UrDevice = DeviceImpl->getHandleRef();
10641062

1065-
auto key = std::make_tuple(std::move(SpecConsts), UrDevice, KernelName);
1063+
auto key = std::make_pair(UrDevice, KernelName);
10661064
if (SYCLConfig<SYCL_CACHE_IN_MEM>::get()) {
10671065
auto ret_tuple = Cache.tryToGetKernelFast(key);
10681066
constexpr size_t Kernel = 0; // see KernelFastCacheValT tuple

0 commit comments

Comments
 (0)