28 #ifndef SPLA_REGISTRY_HPP
29 #define SPLA_REGISTRY_HPP
34 #include <robin_hood.hpp>
40 #define CPU_SUFFIX "__cpu"
41 #define GPU_CL_SUFFIX "__cl"
42 #define OP_KEY(op) "_" + (op)->get_key()
43 #define TYPE_KEY(type) "_" + (type)->get_code()
44 #define MAKE_KEY_0(name, type) std::string(name) + TYPE_KEY(type)
45 #define MAKE_KEY_1(name, op) std::string(name) + OP_KEY(op)
46 #define MAKE_KEY_2(name, op1, op2) std::string(name) + OP_KEY(op1) + OP_KEY(op2)
47 #define MAKE_KEY_3(name, op1, op2, op3) std::string(name) + OP_KEY(op1) + OP_KEY(op2) + OP_KEY(op3)
48 #define MAKE_KEY_CPU_0(name, type) MAKE_KEY_0(name, type) + CPU_SUFFIX
49 #define MAKE_KEY_CPU_1(name, op) MAKE_KEY_1(name, op) + CPU_SUFFIX
50 #define MAKE_KEY_CPU_2(name, op1, op2) MAKE_KEY_2(name, op1, op2) + CPU_SUFFIX
51 #define MAKE_KEY_CPU_3(name, op1, op2, op3) MAKE_KEY_3(name, op1, op2, op3) + CPU_SUFFIX
52 #define MAKE_KEY_CL_0(name, type) MAKE_KEY_0(name, type) + GPU_CL_SUFFIX
53 #define MAKE_KEY_CL_1(name, op) MAKE_KEY_1(name, op) + GPU_CL_SUFFIX
54 #define MAKE_KEY_CL_2(name, op1, op2) MAKE_KEY_2(name, op1, op2) + GPU_CL_SUFFIX
55 #define MAKE_KEY_CL_3(name, op1, op2, op3) MAKE_KEY_3(name, op1, op2, op3) + GPU_CL_SUFFIX
81 virtual void add(
const std::string& key, std::shared_ptr<RegistryAlgo> algo);
82 virtual bool has(
const std::string& key);
83 virtual std::shared_ptr<RegistryAlgo>
find(
const std::string& key);
86 robin_hood::unordered_flat_map<std::string, std::shared_ptr<RegistryAlgo>> m_registry;
Status of library operation execution.
Algorithm suitable to process schedule task based on task string key.
Definition: registry.hpp:66
virtual std::string get_name()=0
virtual Status execute(const struct DispatchContext &ctx)=0
virtual ~RegistryAlgo()=default
virtual std::string get_description()=0
Registry with key-algo mapping of stored algo implementations.
Definition: registry.hpp:78
virtual bool has(const std::string &key)
Definition: registry.cpp:36
virtual void add(const std::string &key, std::shared_ptr< RegistryAlgo > algo)
Definition: registry.cpp:32
virtual ~Registry()=default
virtual std::shared_ptr< RegistryAlgo > find(const std::string &key)
Definition: registry.cpp:40
Definition: algorithm.hpp:37
Execution context of a single task.
Definition: dispatcher.hpp:46