2017-09-06 21:50:42 +02:00
|
|
|
|
|
|
|
// =================================================================================================
|
|
|
|
// 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 database storage structures.
|
|
|
|
//
|
|
|
|
// =================================================================================================
|
|
|
|
|
2017-09-08 21:09:05 +02:00
|
|
|
#ifndef CLBLAST_DATABASE_DATABASE_STRUCTURE_H_
|
|
|
|
#define CLBLAST_DATABASE_DATABASE_STRUCTURE_H_
|
2017-09-06 21:50:42 +02:00
|
|
|
|
|
|
|
#include <string>
|
2017-09-16 18:02:37 +02:00
|
|
|
#include <array>
|
2017-09-06 21:50:42 +02:00
|
|
|
#include <vector>
|
2017-09-24 15:44:14 +02:00
|
|
|
#include <map>
|
2017-09-06 21:50:42 +02:00
|
|
|
|
2017-12-27 12:04:22 +01:00
|
|
|
// Just needed for 'Precision'
|
|
|
|
#ifdef OPENCL_API
|
2020-03-08 10:14:59 +01:00
|
|
|
#define CL_TARGET_OPENCL_VERSION 110
|
2017-12-27 12:04:22 +01:00
|
|
|
#include "clblast.h"
|
|
|
|
#elif CUDA_API
|
|
|
|
#include "clblast_cuda.h"
|
|
|
|
#endif
|
|
|
|
|
2017-09-06 21:50:42 +02:00
|
|
|
namespace clblast {
|
|
|
|
// A special namespace to hold all the global constant variables (including the database entries)
|
|
|
|
namespace database {
|
|
|
|
|
|
|
|
// =================================================================================================
|
|
|
|
|
2017-09-16 18:02:37 +02:00
|
|
|
// Type alias for the database storage (arrays for fast compilation/efficiency)
|
|
|
|
using Name = std::array<char, 51>; // name as stored in database (50 chars + string terminator)
|
2018-04-08 18:12:54 +02:00
|
|
|
using Params = std::array<size_t, 16>; // parameters as stored in database
|
2017-09-16 18:02:37 +02:00
|
|
|
|
2017-09-24 15:44:14 +02:00
|
|
|
// Type alias after extracting from the database (sorted map for improved code readability)
|
|
|
|
using Parameters = std::map<std::string, size_t>; // parameters after reading from DB
|
2017-09-16 18:02:37 +02:00
|
|
|
|
2017-09-06 21:50:42 +02:00
|
|
|
// The OpenCL device types
|
|
|
|
const std::string kDeviceTypeCPU = "CPU";
|
|
|
|
const std::string kDeviceTypeGPU = "GPU";
|
|
|
|
const std::string kDeviceTypeAccelerator = "accelerator";
|
|
|
|
const std::string kDeviceTypeAll = "default";
|
2017-09-16 18:02:37 +02:00
|
|
|
const Name kDeviceNameDefault = {"default "};
|
2017-09-06 21:50:42 +02:00
|
|
|
|
|
|
|
struct DatabaseDevice {
|
2017-09-19 19:44:05 +02:00
|
|
|
Name name;
|
|
|
|
Params parameters; // parameter values
|
|
|
|
|
2017-09-06 21:50:42 +02:00
|
|
|
};
|
2017-09-14 21:27:33 +02:00
|
|
|
struct DatabaseArchitecture {
|
2017-09-19 19:44:05 +02:00
|
|
|
std::string name;
|
|
|
|
std::vector<DatabaseDevice> devices;
|
2017-09-14 21:27:33 +02:00
|
|
|
};
|
2017-09-06 21:50:42 +02:00
|
|
|
struct DatabaseVendor {
|
2017-09-19 19:44:05 +02:00
|
|
|
std::string type;
|
|
|
|
std::string name;
|
|
|
|
std::vector<DatabaseArchitecture> architectures;
|
2017-09-06 21:50:42 +02:00
|
|
|
};
|
|
|
|
struct DatabaseEntry {
|
2017-09-19 19:44:05 +02:00
|
|
|
std::string kernel;
|
|
|
|
Precision precision;
|
|
|
|
std::vector<std::string> parameter_names;
|
|
|
|
std::vector<DatabaseVendor> vendors;
|
2017-09-06 21:50:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// =================================================================================================
|
|
|
|
} // namespace database
|
|
|
|
} // namespace clblast
|
|
|
|
|
2017-09-08 21:09:05 +02:00
|
|
|
// CLBLAST_DATABASE_DATABASE_STRUCTURE_H_
|
2017-09-06 21:50:42 +02:00
|
|
|
#endif
|