summaryrefslogtreecommitdiff
path: root/runtimes/neurun/src/backend/BackendManager.h
diff options
context:
space:
mode:
authorChunseok Lee <chunseok.lee@samsung.com>2019-01-08 17:36:34 +0900
committerChunseok Lee <chunseok.lee@samsung.com>2019-01-08 17:36:34 +0900
commitbd11b24234d7d43dfe05a81c520aa01ffad06e42 (patch)
tree57d0d4044977e4fa0e50cd9ba40b32006dff19eb /runtimes/neurun/src/backend/BackendManager.h
parent91f4ba45449f700a047a4aeea00b1a7c84e94c75 (diff)
downloadnnfw-bd11b24234d7d43dfe05a81c520aa01ffad06e42.tar.gz
nnfw-bd11b24234d7d43dfe05a81c520aa01ffad06e42.tar.bz2
nnfw-bd11b24234d7d43dfe05a81c520aa01ffad06e42.zip
Imported Upstream version 0.3upstream/0.3
Diffstat (limited to 'runtimes/neurun/src/backend/BackendManager.h')
-rw-r--r--runtimes/neurun/src/backend/BackendManager.h45
1 files changed, 33 insertions, 12 deletions
diff --git a/runtimes/neurun/src/backend/BackendManager.h b/runtimes/neurun/src/backend/BackendManager.h
index 6f862ffe6..428542b1e 100644
--- a/runtimes/neurun/src/backend/BackendManager.h
+++ b/runtimes/neurun/src/backend/BackendManager.h
@@ -20,51 +20,72 @@
#include <memory>
#include <map>
-#include "graph/operand/Set.h"
+#include "model/operand/Set.h"
namespace neurun
{
namespace backend
{
-struct IBackendConfig;
-struct IInitializerGenerator;
+struct IConfig;
struct IStageGenerator;
struct ITensorBuilder;
class Backend
{
public:
- Backend(const std::shared_ptr<neurun::backend::IBackendConfig> &backend_config,
- const std::shared_ptr<neurun::backend::IInitializerGenerator> &initializer_gen,
+ Backend(const std::shared_ptr<neurun::backend::IConfig> &backend_config,
const std::shared_ptr<neurun::backend::IStageGenerator> &stage_gen);
- Backend(void) : _config(nullptr), _initializer_gen(nullptr), _stage_gen(nullptr)
+ Backend(void) : _config(nullptr), _stage_gen(nullptr)
{
// DO NOTHING
}
public:
- const std::shared_ptr<neurun::backend::IBackendConfig> config() const;
- const std::shared_ptr<neurun::backend::IInitializerGenerator> initializer_gen() const;
+ const std::shared_ptr<neurun::backend::IConfig> config() const;
const std::shared_ptr<neurun::backend::IStageGenerator> stage_gen() const;
const std::shared_ptr<neurun::backend::ITensorBuilder> tensor_builder() const;
private:
- std::shared_ptr<neurun::backend::IBackendConfig> _config;
- std::shared_ptr<neurun::backend::IInitializerGenerator> _initializer_gen;
+ std::shared_ptr<neurun::backend::IConfig> _config;
std::shared_ptr<neurun::backend::IStageGenerator> _stage_gen;
};
class BackendManager
{
public:
- BackendManager(const neurun::graph::operand::Set &operands);
+ BackendManager(const neurun::model::operand::Set &operands);
- Backend get(const std::string &key);
+ Backend *get(const std::string &key);
private:
std::map<std::string, Backend> _gen_map;
+ /**
+ * @brief Allocate an object of a class of a plugin by loading a plugin function, that does
+ * allocation, and calling it
+ *
+ * @param object_of_plugin_class target object
+ * @param obj_creator_func_name name of the plugin function, that allocates an object
+ * @param handle handle of the plugin
+ * @param args arguments to pass to constructor of the plugin class
+ *
+ * @return
+ */
+ template <typename T, class... Types>
+ void loadObjectFromPlugin(std::shared_ptr<T> &object_of_plugin_class,
+ const std::string obj_creator_func_name, void *handle,
+ Types &&... args);
+
+ /**
+ * @brief load backend plugin
+ *
+ * @param backend backend to be loaded
+ * @param operands operands to construct StageGenerator
+ *
+ * @return
+ */
+ void loadBackend(const std::string &backend, const neurun::model::operand::Set &operands);
};
} // namespace backend