summaryrefslogtreecommitdiff
path: root/src/clblast.cpp
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2017-02-16 21:12:50 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2017-02-16 21:12:50 +0100
commit08bfb75a9d72b6b373d8f18e8be83fe4ea31015b (patch)
tree93c7861c51c12b07e47a0fc266a004cfd782017a /src/clblast.cpp
parentbdc57221bd0279bcdb4f024df54f08a2fe1bb8d4 (diff)
Added input-sanity checks for the OverrideParameters function
Diffstat (limited to 'src/clblast.cpp')
-rw-r--r--src/clblast.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/clblast.cpp b/src/clblast.cpp
index 885b849e..871a4804 100644
--- a/src/clblast.cpp
+++ b/src/clblast.cpp
@@ -2264,6 +2264,16 @@ StatusCode OverrideParameters(const cl_device_id device, const std::string &kern
const auto device_cpp = Device(device);
const auto device_name = device_cpp.Name();
+ // Retrieves the current database values to verify whether the new ones are complete
+ auto in_cache = false;
+ const auto current_database = DatabaseCache::Instance().Get(DatabaseKeyRef{ precision, device_name, kernel_name }, &in_cache);
+ if (!in_cache) { return StatusCode::kInvalidOverrideKernel; }
+ for (const auto &current_param : current_database.GetParameterNames()) {
+ if (parameters.find(current_param) == parameters.end()) {
+ return StatusCode::kMissingOverrideParameter;
+ }
+ }
+
// 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) {