#include <CodegenManager.h>
Definition at line 36 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 29 of file CodegenManager.cc.
31{
32 if (target == nullptr)
33 throw std::runtime_error("Target string is not set");
34
35 if (_export_model_path.empty())
36 throw std::runtime_error("Export model path is not set");
37
39 throw std::runtime_error("Model path does not exist");
40
41
42 static std::mutex lock;
43 std::lock_guard<std::mutex> guard(lock);
44
46 codegen_loader.loadLibrary(target);
47 const auto code_generator = codegen_loader.get();
48 const auto result = code_generator->codegen(
model_path.c_str(), _export_model_path.c_str());
49 codegen_loader.unloadLibrary();
50
51 return (result == 0);
52}
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 57 of file CodegenManager.h.
57{ 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 50 of file CodegenManager.h.
◆ operator=()
The documentation for this class was generated from the following files: