Minor improvements after merging in groundwork for custom tuning parameters and kernels

pull/86/head
Cedric Nugteren 2016-07-24 17:00:21 +02:00
parent d4ffa6395e
commit ffa35c623a
3 changed files with 12 additions and 11 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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 = {});