Skip to content

Commit 518c758

Browse files
committed
Fix test failures
1 parent 2924479 commit 518c758

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

sycl/source/detail/kernel_program_cache.hpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -360,29 +360,29 @@ class KernelProgramCache {
360360
template <typename KeyT, typename ValT>
361361
void saveKernel(KeyT &&CacheKey, ValT &&CacheVal) {
362362

363-
ur_program_handle_t Program = std::get<3>(CacheVal);
364-
// Save kernel in fast cache only if the corresponding program is also
365-
// in the cache.
366-
{
367-
auto LockedCache = acquireCachedPrograms();
368-
auto &ProgCache = LockedCache.get();
369-
if (ProgCache.ProgramSizeMap.find(Program) ==
370-
ProgCache.ProgramSizeMap.end())
371-
return;
363+
if (SYCLConfig<SYCL_IN_MEM_CACHE_EVICTION_THRESHOLD>::
364+
isProgramCacheEvictionEnabled()) {
365+
366+
ur_program_handle_t Program = std::get<3>(CacheVal);
367+
// Save kernel in fast cache only if the corresponding program is also
368+
// in the cache.
369+
{
370+
auto LockedCache = acquireCachedPrograms();
371+
auto &ProgCache = LockedCache.get();
372+
if (ProgCache.ProgramSizeMap.find(Program) ==
373+
ProgCache.ProgramSizeMap.end())
374+
return;
375+
}
376+
377+
// Save reference between the program and the fast cache key.
378+
MProgramToKernelFastCacheKeyMap[Program].emplace_back(CacheKey);
372379
}
373380

374381
std::unique_lock<std::mutex> Lock(MKernelFastCacheMutex);
375382
// if no insertion took place, thus some other thread has already inserted
376383
// smth in the cache
377384
traceKernel("Kernel inserted.", std::get<3>(CacheKey), true);
378385
MKernelFastCache.emplace(CacheKey, CacheVal);
379-
380-
if (SYCLConfig<
381-
SYCL_IN_MEM_CACHE_EVICTION_THRESHOLD>::getProgramCacheSize()) {
382-
383-
// Save reference between the program and the fast cache key.
384-
MProgramToKernelFastCacheKeyMap[Program].emplace_back(CacheKey);
385-
}
386386
}
387387

388388
// Evict programs from cache to free up space.

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include <cstdlib>
4040
#include <cstring>
4141
#include <fstream>
42-
#include <functional>
4342
#include <memory>
4443
#include <mutex>
4544
#include <sstream>

0 commit comments

Comments
 (0)