From 628e1e8cce084657df854fa97ba18ad740270b23 Mon Sep 17 00:00:00 2001 From: Kirill Mavreshko Date: Fri, 26 May 2017 15:04:19 +0500 Subject: Fixes inability to run GEMM on multiple identical GPUs (issue #155) --- src/cache.hpp | 4 ++-- src/clblast.cpp | 2 +- src/routine.cpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cache.hpp b/src/cache.hpp index 694de839..207cb2dd 100644 --- a/src/cache.hpp +++ b/src/cache.hpp @@ -80,8 +80,8 @@ extern template std::string BinaryCache::Get(const BinaryKeyRef &, bool *) const // The key struct for the cache of compiled OpenCL programs (context-dependent) // Order of fields: context, precision, routine_name (smaller fields first) -typedef std::tuple ProgramKey; -typedef std::tuple ProgramKeyRef; +typedef std::tuple ProgramKey; +typedef std::tuple ProgramKeyRef; typedef Cache ProgramCache; diff --git a/src/clblast.cpp b/src/clblast.cpp index 1eb1ddd7..a73b67f3 100644 --- a/src/clblast.cpp +++ b/src/clblast.cpp @@ -2470,7 +2470,7 @@ StatusCode OverrideParameters(const cl_device_id device, const std::string &kern // Clears the existing program & binary cache for routines with the target kernel const auto routine_names = Routine::routines_by_kernel.at(kernel_name); for (const auto &routine_name : routine_names) { - ProgramCache::Instance().RemoveBySubset<1, 2>(ProgramKey{nullptr, precision, routine_name}); + ProgramCache::Instance().RemoveBySubset<1, 2>(ProgramKey{nullptr, device, precision, routine_name}); BinaryCache::Instance().Remove(BinaryKey{precision, routine_name, device_name}); } diff --git a/src/routine.cpp b/src/routine.cpp index cb39c7ee..81baa590 100644 --- a/src/routine.cpp +++ b/src/routine.cpp @@ -87,7 +87,7 @@ void Routine::InitProgram(std::initializer_list source) { // Queries the cache to see whether or not the program (context-specific) is already there bool has_program; - program_ = ProgramCache::Instance().Get(ProgramKeyRef{ context_(), precision_, routine_name_ }, + program_ = ProgramCache::Instance().Get(ProgramKeyRef{ context_(), device_(), precision_, routine_name_ }, &has_program); if (has_program) { return; } @@ -106,7 +106,7 @@ void Routine::InitProgram(std::initializer_list source) { if (has_binary) { program_ = Program(device_, context_, binary); program_.Build(device_, options); - ProgramCache::Instance().Store(ProgramKey{ context_(), precision_, routine_name_ }, + ProgramCache::Instance().Store(ProgramKey{ context_(), device_(), precision_, routine_name_ }, Program{ program_ }); return; } @@ -185,7 +185,7 @@ void Routine::InitProgram(std::initializer_list source) { BinaryCache::Instance().Store(BinaryKey{ precision_, routine_name_, device_name_ }, program_.GetIR()); - ProgramCache::Instance().Store(ProgramKey{ context_(), precision_, routine_name_ }, + ProgramCache::Instance().Store(ProgramKey{ context_(), device_(), precision_, routine_name_ }, Program{ program_ }); // Prints the elapsed compilation time in case of debugging in verbose mode -- cgit v1.2.3 From 64ba590279f98899e738e223354547f4bf361b58 Mon Sep 17 00:00:00 2001 From: Kirill Mavreshko Date: Sat, 27 May 2017 10:30:09 +0500 Subject: Fixed comment decribing the order of program cache fields --- src/cache.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cache.hpp b/src/cache.hpp index 207cb2dd..ed693ea3 100644 --- a/src/cache.hpp +++ b/src/cache.hpp @@ -79,7 +79,7 @@ extern template std::string BinaryCache::Get(const BinaryKeyRef &, bool *) const // ================================================================================================= // The key struct for the cache of compiled OpenCL programs (context-dependent) -// Order of fields: context, precision, routine_name (smaller fields first) +// Order of fields: context, device_id, precision, routine_name (smaller fields first) typedef std::tuple ProgramKey; typedef std::tuple ProgramKeyRef; -- cgit v1.2.3