diff options
Diffstat (limited to 'src/database/database.hpp')
-rw-r--r-- | src/database/database.hpp | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/src/database/database.hpp b/src/database/database.hpp index 346fe089..8a3e7040 100644 --- a/src/database/database.hpp +++ b/src/database/database.hpp @@ -26,6 +26,19 @@ namespace clblast { // ================================================================================================= +// A special namespace to hold all the global constant variables (including the database entries) +namespace database { + + // The OpenCL device types + const std::string kDeviceTypeCPU = "CPU"; + const std::string kDeviceTypeGPU = "GPU"; + const std::string kDeviceTypeAccelerator = "accelerator"; + const std::string kDeviceTypeAll = "default"; + +} // namespace database + +// ================================================================================================= + // See comment at top of file for a description of the class class Database { public: @@ -50,12 +63,6 @@ class Database { std::vector<DatabaseVendor> vendors; }; - // The OpenCL device types - static const std::string kDeviceTypeCPU; - static const std::string kDeviceTypeGPU; - static const std::string kDeviceTypeAccelerator; - static const std::string kDeviceTypeAll; - // The OpenCL device vendors static const std::string kDeviceVendorAll; @@ -63,24 +70,11 @@ class Database { static const std::unordered_map<std::string, std::string> kVendorNames; // The database consists of separate database entries, stored together in a vector - static const DatabaseEntry XaxpyHalf, XaxpySingle, XaxpyDouble, XaxpyComplexSingle, XaxpyComplexDouble; - static const DatabaseEntry XdotHalf, XdotSingle, XdotDouble, XdotComplexSingle, XdotComplexDouble; - static const DatabaseEntry XgemvHalf, XgemvSingle, XgemvDouble, XgemvComplexSingle, XgemvComplexDouble; - static const DatabaseEntry XgemvFastHalf, XgemvFastSingle, XgemvFastDouble, XgemvFastComplexSingle, XgemvFastComplexDouble; - static const DatabaseEntry XgemvFastRotHalf, XgemvFastRotSingle, XgemvFastRotDouble, XgemvFastRotComplexSingle, XgemvFastRotComplexDouble; - static const DatabaseEntry XgerHalf, XgerSingle, XgerDouble, XgerComplexSingle, XgerComplexDouble; - static const DatabaseEntry XgemmHalf, XgemmSingle, XgemmDouble, XgemmComplexSingle, XgemmComplexDouble; - static const DatabaseEntry XgemmDirectHalf, XgemmDirectSingle, XgemmDirectDouble, XgemmDirectComplexSingle, XgemmDirectComplexDouble; - static const DatabaseEntry CopyHalf, CopySingle, CopyDouble, CopyComplexSingle, CopyComplexDouble; - static const DatabaseEntry PadHalf, PadSingle, PadDouble, PadComplexSingle, PadComplexDouble; - static const DatabaseEntry TransposeHalf, TransposeSingle, TransposeDouble, TransposeComplexSingle, TransposeComplexDouble; - static const DatabaseEntry PadtransposeHalf, PadtransposeSingle, PadtransposeDouble, PadtransposeComplexSingle, PadtransposeComplexDouble; - static const DatabaseEntry KernelSelectionHalf, KernelSelectionSingle, KernelSelectionDouble, KernelSelectionComplexSingle, KernelSelectionComplexDouble; - static const std::vector<DatabaseEntry> database; + static const std::vector<const DatabaseEntry*> database; // 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); + const Precision precision, const std::vector<const DatabaseEntry*> &overlay); // Accessor of values by key size_t operator[](const std::string key) const { return parameters_.find(key)->second; } @@ -92,7 +86,8 @@ class Database { // 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; + const Precision this_precision, + const std::vector<const DatabaseEntry*> &db) const; // Found parameters suitable for this device/kernel Parameters parameters_; |