From ffa35c623af4b0916f625f3a41000e75a1df7e1f Mon Sep 17 00:00:00 2001 From: Cedric Nugteren Date: Sun, 24 Jul 2016 17:00:21 +0200 Subject: Minor improvements after merging in groundwork for custom tuning parameters and kernels --- src/database/database.cpp | 12 ++++++++---- src/database/database.hpp | 8 ++------ 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::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 &kernels, const Precision precision, const std::vector &overlay): parameters_{} { @@ -66,7 +67,10 @@ Database::Database(const Queue &queue, const std::vector &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 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 &routines, const Precision precision, const std::vector &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 &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 &routines, const Precision precision, const std::vector &userDatabase = {}); -- cgit v1.2.3