#include <CodegenManager.h>
Definition at line 34 of file CodegenManager.h.
◆ CodegenManager() [1/2]
onert::odc::CodegenManager::CodegenManager |
( |
| ) |
|
|
default |
◆ CodegenManager() [2/2]
◆ codegen()
bool onert::odc::CodegenManager::codegen |
( |
const std::string & |
model_path, |
|
|
const char * |
target, |
|
|
CodegenPreference |
pref |
|
) |
| |
Execute code generator.
- Parameters
-
model[in] | Model to be compiled |
target[in] | Target backend name This target string will be used to find a backend library. The name of target backend library should follow the following rules: 'lib' + {backend extension} + '-gen' + {lib extension} And the target string should be a name except 'lib' and {lib extension}. For example, if the backend extension is 'aaa', the backend library name should be 'libaaa-gen.so', and the target string should be 'aaa-gen'. |
pref | CodegenPreference Codegen preference |
Definition at line 27 of file CodegenManager.cc.
29{
30 if (target == nullptr)
31 throw std::runtime_error("Target string is not set");
32
33 if (_export_model_path.empty())
34 throw std::runtime_error("Export model path is not set");
35
37 throw std::runtime_error("Model path does not exist");
38
39
40 static std::mutex lock;
41 std::lock_guard<std::mutex> guard(lock);
42
44 codegen_loader.loadLibrary(target);
45 const auto code_generator = codegen_loader.get();
46 const auto result = code_generator->codegen(
model_path.c_str(), _export_model_path.c_str());
47 codegen_loader.unloadLibrary();
48
49 return (result == 0);
50}
static CodegenLoader & instance()
Get singleton instance of CodegenLoader.
References onert::odc::CodegenLoader::instance().
◆ exportModelPath() [1/2]
const std::string & onert::odc::CodegenManager::exportModelPath |
( |
| ) |
const |
|
inline |
Get model path to export compiled model.
- Returns
- Model path to export compiled model
Definition at line 55 of file CodegenManager.h.
55{ return _export_model_path; }
◆ exportModelPath() [2/2]
void onert::odc::CodegenManager::exportModelPath |
( |
const std::string & |
model_path | ) |
|
|
inline |
Set model path to export compiled model.
- Parameters
-
model_path | Model path to export compiled model |
Definition at line 48 of file CodegenManager.h.
◆ operator=()
The documentation for this class was generated from the following files: