diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/database/database.cpp | 12 | ||||
-rw-r--r-- | src/database/database.hpp | 8 | ||||
-rw-r--r-- | src/routine.hpp | 3 |
3 files changed, 12 insertions, 11 deletions
diff --git a/src/database/database.cpp b/src/database/database.cpp index ea1557b9..47f1da16 100644 --- a/src/database/database.cpp +++ b/src/database/database.cpp @@ -42,7 +42,8 @@ const std::vector<Database::DatabaseEntry> Database::database = { // ================================================================================================= -// Constructor, computing device properties and populating the parameter-vector from the database +// Constructor, computing device properties and populating the parameter-vector from the database. +// This takes an optional overlay database in case of custom tuning or custom kernels. Database::Database(const Queue &queue, const std::vector<std::string> &kernels, const Precision precision, const std::vector<DatabaseEntry> &overlay): parameters_{} { @@ -66,7 +67,10 @@ Database::Database(const Queue &queue, const std::vector<std::string> &kernels, for (auto db: { &overlay, &database }) { search_result = Search(kernel, device_type, device_vendor, device_name, precision, *db); - if (search_result) { parameters_.insert(search_result->begin(), search_result->end()); break; } + if (search_result) { + parameters_.insert(search_result->begin(), search_result->end()); + break; + } } if (!search_result) { throw std::runtime_error("Database error, could not find a suitable entry"); } @@ -86,7 +90,7 @@ std::string Database::GetDefines() const { // ================================================================================================= -// Searches the database for the right kernel and precision +// Searches a particular database for the right kernel and precision Database::ParametersPtr Database::Search(const std::string &this_kernel, const std::string &this_type, const std::string &this_vendor, @@ -119,7 +123,7 @@ Database::ParametersPtr Database::Search(const std::string &this_kernel, } } - // If we reached this point, something is wrong + // If we reached this point, the entry was not found in this database return nullptr; } diff --git a/src/database/database.hpp b/src/database/database.hpp index 5a61fad9..e84357dc 100644 --- a/src/database/database.hpp +++ b/src/database/database.hpp @@ -79,7 +79,7 @@ class Database { static const DatabaseEntry PadtransposeHalf, PadtransposeSingle, PadtransposeDouble, PadtransposeComplexSingle, PadtransposeComplexDouble; static const std::vector<DatabaseEntry> database; - // The constructor with a user-provided database overlay + // The constructor with a user-provided database overlay (potentially an empty vector) explicit Database(const Queue &queue, const std::vector<std::string> &routines, const Precision precision, const std::vector<DatabaseEntry> &overlay); @@ -90,11 +90,7 @@ class Database { std::string GetDefines() const; private: - Parameters Search(const std::string &this_kernel, const std::string &this_type, - const std::string &this_vendor, const std::string &this_device, - const Precision this_precision) const; - - // Alternate search method in a specified database, returning pointer (possibly NULL) + // Search method for a specified database, returning pointer (possibly a nullptr) ParametersPtr Search(const std::string &this_kernel, const std::string &this_type, const std::string &this_vendor, const std::string &this_device, const Precision this_precision, const std::vector<DatabaseEntry> &db) const; diff --git a/src/routine.hpp b/src/routine.hpp index 21506e7b..f5c607af 100644 --- a/src/routine.hpp +++ b/src/routine.hpp @@ -32,7 +32,8 @@ namespace clblast { class Routine { public: - // Base class constructor + // Base class constructor. The user database is an optional extra database to override the + // built-in database. explicit Routine(Queue &queue, EventPointer event, const std::string &name, const std::vector<std::string> &routines, const Precision precision, const std::vector<Database::DatabaseEntry> &userDatabase = {}); |