From 39e9b1238ff66a680579a181c0f0c2424e65e003 Mon Sep 17 00:00:00 2001 From: Cedric Nugteren Date: Sun, 10 Jul 2016 11:24:36 +0200 Subject: Fixed a bug related to the cache and retrieval of programs based on the OpenCL context --- src/cache.cpp | 6 +++--- src/cache.hpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/cache.cpp b/src/cache.cpp index 2b90eccc..6080f082 100644 --- a/src/cache.cpp +++ b/src/cache.cpp @@ -38,7 +38,7 @@ void StoreProgramToCache(const Program &program, const Context &context, printf("[DEBUG] Storing program in cache\n"); #endif program_cache_mutex_.lock(); - program_cache_.push_back(ProgramCache{program, context.pointer(), precision, routine_name}); + program_cache_.push_back(ProgramCache{program, context(), precision, routine_name}); program_cache_mutex_.unlock(); } @@ -69,7 +69,7 @@ const Program& GetProgramFromCache(const Context &context, const Precision &prec #endif program_cache_mutex_.lock(); for (auto &cached_program: program_cache_) { - if (cached_program.MatchInCache(context.pointer(), precision, routine_name)) { + if (cached_program.MatchInCache(context(), precision, routine_name)) { program_cache_mutex_.unlock(); return cached_program.program; } @@ -97,7 +97,7 @@ bool ProgramIsInCache(const Context &context, const Precision &precision, const std::string &routine_name) { program_cache_mutex_.lock(); for (auto &cached_program: program_cache_) { - if (cached_program.MatchInCache(context.pointer(), precision, routine_name)) { + if (cached_program.MatchInCache(context(), precision, routine_name)) { program_cache_mutex_.unlock(); return true; } diff --git a/src/cache.hpp b/src/cache.hpp index 8f540891..9075da0d 100644 --- a/src/cache.hpp +++ b/src/cache.hpp @@ -48,14 +48,14 @@ static std::mutex binary_cache_mutex_; // The cache of compiled OpenCL programs, along with some meta-data struct ProgramCache { Program program; - ContextPointer context_ptr; + cl_context context; Precision precision; std::string routine_name_; // Finds out whether the properties match - bool MatchInCache(const ContextPointer ref_context, const Precision &ref_precision, + bool MatchInCache(const cl_context ref_context, const Precision &ref_precision, const std::string &ref_routine) { - return (*context_ptr == *ref_context && + return (context == ref_context && precision == ref_precision && routine_name_ == ref_routine); } -- cgit v1.2.3