summaryrefslogtreecommitdiff
path: root/src/routine.hpp
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2018-01-06 16:08:27 +0100
committerGitHub <noreply@github.com>2018-01-06 16:08:27 +0100
commita7ccce196915db7a3b7ea7fe8ea9048f5b1204c6 (patch)
tree27dd8771ee6f913b5a2dabfae115bbe7fbc9d979 /src/routine.hpp
parent8040a4e355bdf6531eb9c4c5ae1fe4f792899d24 (diff)
parentad197da08da7ef414db90dbb97e92c575363c280 (diff)
Merge pull request #238 from CNugteren/gemm_api_with_temp_buffer
GEMM API with optional temp buffer
Diffstat (limited to 'src/routine.hpp')
-rw-r--r--src/routine.hpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/routine.hpp b/src/routine.hpp
index a8f1cb6a..00f7b5cc 100644
--- a/src/routine.hpp
+++ b/src/routine.hpp
@@ -33,6 +33,26 @@ namespace clblast {
class Routine {
public:
+ static void InitDatabase(const Device &device, const std::vector<std::string> &kernel_names,
+ const Precision precision, const std::vector<database::DatabaseEntry> &userDatabase,
+ Databases &db) {
+ const auto platform_id = device.PlatformID();
+ for (const auto &kernel_name : kernel_names) {
+
+ // Queries the cache to see whether or not the kernel parameter database is already there
+ bool has_db;
+ db(kernel_name) = DatabaseCache::Instance().Get(DatabaseKeyRef{platform_id, device(), precision, kernel_name},
+ &has_db);
+ if (has_db) { continue; }
+
+ // Builds the parameter database for this device and routine set and stores it in the cache
+ log_debug("Searching database for kernel '" + kernel_name + "'");
+ db(kernel_name) = Database(device, kernel_name, precision, userDatabase);
+ DatabaseCache::Instance().Store(DatabaseKey{platform_id, device(), precision, kernel_name},
+ Database{db(kernel_name)});
+ }
+ }
+
// Base class constructor. The user database is an optional extra database to override the
// built-in database.
// All heavy preparation work is done inside this constructor.