diff options
Diffstat (limited to 'src/database')
-rw-r--r-- | src/database/database.cpp | 42 | ||||
-rw-r--r-- | src/database/database.hpp | 1 | ||||
-rw-r--r-- | src/database/database_structure.hpp | 18 | ||||
-rw-r--r-- | src/database/device_mapping.hpp | 51 |
4 files changed, 21 insertions, 91 deletions
diff --git a/src/database/database.cpp b/src/database/database.cpp index d2add8c9..2d78e65c 100644 --- a/src/database/database.cpp +++ b/src/database/database.cpp @@ -16,6 +16,7 @@ #include "utilities/utilities.hpp" #include "database/database.hpp" + #include "database/kernels/xaxpy/xaxpy.hpp" #include "database/kernels/xdot/xdot.hpp" #include "database/kernels/xgemv/xgemv.hpp" @@ -28,6 +29,7 @@ #include "database/kernels/pad/pad.hpp" #include "database/kernels/transpose/transpose.hpp" #include "database/kernels/padtranspose/padtranspose.hpp" + #include "database/kernels/xtrsv.hpp" #include "database/kernels/invert.hpp" #include "database/apple_cpu_fallback.hpp" @@ -77,37 +79,17 @@ Database::Database(const Device &device, const std::string &kernel_name, const Precision precision, const std::vector<database::DatabaseEntry> &overlay): parameters_(std::make_shared<database::Parameters>()) { - // Finds top-level information (vendor and type) - auto device_type = device.Type(); - auto device_vendor = device.Vendor(); - for (auto &find_and_replace : database::kVendorNames) { // replacing to common names - if (device_vendor == find_and_replace.first) { device_vendor = find_and_replace.second; } - } + // Finds device information + const auto device_type = GetDeviceType(device); + const auto device_vendor = GetDeviceVendor(device); + const auto device_architecture = GetDeviceArchitecture(device); + const auto device_name = GetDeviceName(device); - // Finds mid-level information (architecture) - auto device_architecture = std::string{""}; - if (device.HasExtension(kKhronosAttributesNVIDIA)) { - device_architecture = device.NVIDIAComputeCapability(); - } - else if (device.HasExtension(kKhronosAttributesAMD)) { - device_architecture = device.Name(); // Name is architecture for AMD APP and AMD ROCm - } - // Note: no else - 'device_architecture' might be the empty string - for (auto &find_and_replace : database::kArchitectureNames) { // replacing to common names - if (device_architecture == find_and_replace.first) { device_architecture = find_and_replace.second; } - } - - // Finds low-level information (device name) - auto device_name = std::string{""}; - if (device.HasExtension(kKhronosAttributesAMD)) { - device_name = device.AMDBoardName(); - } - else { - device_name = device.Name(); - } - for (auto &find_and_replace : database::kDeviceNames) { // replacing to common names - if (device_name == find_and_replace.first) { device_name = find_and_replace.second; } - } + // Prints the obtained information in verbose mode + #ifdef VERBOSE + printf("[DEBUG] Device type '%s'; vendor '%s'\n", device_type.c_str(), device_vendor.c_str()); + printf("[DEBUG] Device name '%s'; architecture '%s'\n", device_name.c_str(), device_architecture.c_str()); + #endif // Sets the databases to search through const auto databases = std::list<std::vector<database::DatabaseEntry>>{overlay, database}; diff --git a/src/database/database.hpp b/src/database/database.hpp index e7a79cf9..7efcb7c4 100644 --- a/src/database/database.hpp +++ b/src/database/database.hpp @@ -23,7 +23,6 @@ #include "utilities/utilities.hpp" #include "database/database_structure.hpp" -#include "database/device_mapping.hpp" namespace clblast { // ================================================================================================= diff --git a/src/database/database_structure.hpp b/src/database/database_structure.hpp index 4d7f967d..d9ee95fb 100644 --- a/src/database/database_structure.hpp +++ b/src/database/database_structure.hpp @@ -35,19 +35,19 @@ using Parameters = std::unordered_map<std::string, size_t>; // Structures for content inside the database struct DatabaseDevice { - std::string name; - std::vector<size_t> parameters; // parameter values + const std::string name; + const std::vector<size_t> parameters; // parameter values }; struct DatabaseVendor { - std::string type; - std::string name; - std::vector<DatabaseDevice> devices; + const std::string type; + const std::string name; + const std::vector<DatabaseDevice> devices; }; struct DatabaseEntry { - std::string kernel; - Precision precision; - std::vector<std::string> parameter_names; - std::vector<DatabaseVendor> vendors; + const std::string kernel; + const Precision precision; + const std::vector<std::string> parameter_names; + const std::vector<DatabaseVendor> vendors; }; // ================================================================================================= diff --git a/src/database/device_mapping.hpp b/src/database/device_mapping.hpp deleted file mode 100644 index 9fb5d81d..00000000 --- a/src/database/device_mapping.hpp +++ /dev/null @@ -1,51 +0,0 @@ - -// ================================================================================================= -// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This -// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max- -// width of 100 characters per line. -// -// Author(s): -// Cedric Nugteren <www.cedricnugteren.nl> -// -// This file describes the mappings of extracted names from OpenCL (device, board, vendor, etc.) to -// more commonly used names to match devices from different vendors and platforms properly. -// -// ================================================================================================= - -#ifndef CLBLAST_DATABASE_DEVICE_MAPPING_H_ -#define CLBLAST_DATABASE_DEVICE_MAPPING_H_ - -#include <string> -#include <unordered_map> - -namespace clblast { -// A special namespace to hold all the global constant variables (including the device mapping) -namespace database { - -// ================================================================================================= - -// Alternative names for some vendor names (top-level) -const std::unordered_map<std::string, std::string> kVendorNames { - { "Intel(R) Corporation", "Intel" }, - { "GenuineIntel", "Intel" }, - { "Advanced Micro Devices, Inc.", "AMD" }, - { "NVIDIA Corporation", "NVIDIA" }, -}; - -// Alternative names for some architectures (mid-level) -const std::unordered_map<std::string, std::string> kArchitectureNames { - {"gfx803", "Fiji"}, - {"gfx900", "Vega"}, -}; - -// Alternative names for some devices (low-level) -const std::unordered_map<std::string, std::string> kDeviceNames { - // Empty -}; - -// ================================================================================================= -} // namespace database -} // namespace clblast - -// CLBLAST_DATABASE_DEVICE_MAPPING_H_ -#endif |