graph->finishBuilding();
// Compile
- auto compiler = new onert::compiler::Compiler{graph};
- compiler->compile();
- compiler->release(executor);
+ auto subgs = std::make_shared<onert::ir::Subgraphs>();
+ subgs->push(onert::ir::SubgraphIndex{0}, graph);
+ auto compiler = new onert::compiler::Compiler{subgs};
+ executors = compiler->compile();
delete compiler;
}
public:
std::shared_ptr<Graph> graph;
- std::shared_ptr<onert::exec::IExecutor> executor;
+ std::shared_ptr<onert::exec::ExecutorMap> executors;
};
TEST(ExecInstance, simple)
{
auto mockup = CompiledMockUpModel();
auto graph = mockup.graph;
- auto executor = mockup.executor;
+ auto executors = mockup.executors;
auto input1 = IOIndex{0};
auto input2 = IOIndex{1};
float output_buffer[4] = {};
const float output_expected[4] = {5, -2, 0, -1};
- auto execution = new onert::exec::Execution(executor);
+ auto execution = new onert::exec::Execution(executors);
execution->setInput(input1, reinterpret_cast<const void *>(input1_buffer), 16);
execution->setInput(input2, reinterpret_cast<const void *>(input2_buffer), 16);
{
auto mockup = CompiledMockUpModel();
auto graph = mockup.graph;
- auto executor1 = mockup.executor;
- auto execution1 = new onert::exec::Execution(executor1);
+ auto executors1 = mockup.executors;
+ auto execution1 = new onert::exec::Execution(executors1);
auto input1 = IOIndex{0};
auto input2 = IOIndex{1};
execution1->setOutput(output, reinterpret_cast<void *>(exe1_output_buffer), 16);
// Make new executor: compile again
- auto compiler = new onert::compiler::Compiler{graph};
- compiler->compile();
- std::shared_ptr<onert::exec::IExecutor> executor2;
- compiler->release(executor2);
- auto execution2 = new onert::exec::Execution(executor2);
+ auto subgs = std::make_shared<onert::ir::Subgraphs>();
+ subgs->push(onert::ir::SubgraphIndex{0}, graph);
+ auto compiler = new onert::compiler::Compiler{subgs};
+ std::shared_ptr<onert::exec::ExecutorMap> executors2 = compiler->compile();
+ auto execution2 = new onert::exec::Execution(executors2);
const float exe2_input1_buffer[4] = {2, 1, -2, 0};
const float exe2_input2_buffer[4] = {-3, 3, 1, 2};
TEST(ExecInstance, twoExecution)
{
auto mockup = CompiledMockUpModel();
- auto executor = mockup.executor;
+ auto executors = mockup.executors;
auto input1 = IOIndex{0};
auto input2 = IOIndex{1};
auto output1 = IOIndex{0};
const float exe1_output_expected[4] = {5, -2, 0, -1};
const float exe2_output_expected[4] = {2, 5, -2, 7};
- auto execution1 = new onert::exec::Execution(executor);
+ auto execution1 = new onert::exec::Execution(executors);
execution1->setInput(input1, reinterpret_cast<const void *>(exe1_input1_buffer), 16);
execution1->setInput(input2, reinterpret_cast<const void *>(exe1_input2_buffer), 16);
execution1->setOutput(output1, reinterpret_cast<void *>(exe1_output_buffer), 16);
float exe2_output_buffer[4] = {};
// Make new execution
- auto execution2 = new onert::exec::Execution(executor);
+ auto execution2 = new onert::exec::Execution(executors);
execution2->setInput(input1, reinterpret_cast<const void *>(exe2_input1_buffer), 16);
execution2->setInput(input2, reinterpret_cast<const void *>(exe2_input2_buffer), 16);
execution2->setOutput(output1, reinterpret_cast<void *>(exe2_output_buffer), 16);
{
public:
Inference(const float (&input1)[4], const float (&input2)[4], float (&output)[4],
- std::shared_ptr<onert::exec::IExecutor> &executor)
- : _input1{input1}, _input2{input2}, _output{output}, _executor{executor}
+ std::shared_ptr<onert::exec::ExecutorMap> &executors)
+ : _input1{input1}, _input2{input2}, _output{output}, _executors{executors}
{
// DO NOTHING
}
auto input2 = IOIndex{1};
auto output1 = IOIndex{0};
- auto execution = new onert::exec::Execution(_executor);
+ auto execution = new onert::exec::Execution(_executors);
execution->setInput(input1, reinterpret_cast<const void *>(_input1), 16);
execution->setInput(input2, reinterpret_cast<const void *>(_input2), 16);
execution->setOutput(output1, reinterpret_cast<void *>(_output), 16);
const float (&_input1)[4];
const float (&_input2)[4];
float (&_output)[4];
- std::shared_ptr<onert::exec::IExecutor> &_executor;
+ std::shared_ptr<onert::exec::ExecutorMap> &_executors;
};
// Support multi-thread execution
TEST(ExecInstance, twoThreads)
{
auto mockup = CompiledMockUpModel();
- auto executor = mockup.executor;
+ auto executors = mockup.executors;
const float exe1_input1_buffer[4] = {1, 0, -1, -2};
const float exe1_input2_buffer[4] = {1, -3, 2, -4};
float exe1_output_buffer[4] = {};
const float exe1_output_expected[4] = {5, -2, 0, -1};
- Inference execution1{exe1_input1_buffer, exe1_input2_buffer, exe1_output_buffer, executor};
+ Inference execution1{exe1_input1_buffer, exe1_input2_buffer, exe1_output_buffer, executors};
const float exe2_input1_buffer[4] = {2, 1, -2, 0};
const float exe2_input2_buffer[4] = {-3, 3, 1, 2};
float exe2_output_buffer[4] = {};
const float exe2_output_expected[4] = {2, 5, -2, 7};
- Inference execution2{exe2_input1_buffer, exe2_input2_buffer, exe2_output_buffer, executor};
+ Inference execution2{exe2_input1_buffer, exe2_input2_buffer, exe2_output_buffer, executors};
std::thread t1{&Inference::inference, &execution1};
std::thread t2{&Inference::inference, &execution2};
{
auto mockup = CompiledMockUpModel();
auto graph = mockup.graph;
- auto executor = mockup.executor;
+ auto executors = mockup.executors;
auto input1 = IOIndex{0};
auto input2 = IOIndex{1};
float output_buffer[4] = {};
const float output_expected[4] = {5, -2, 0, -1};
- auto execution = new onert::exec::Execution(executor);
+ auto execution = new onert::exec::Execution(executors);
execution->setInput(input1, reinterpret_cast<const void *>(input1_buffer), 16);
execution->setInput(input2, reinterpret_cast<const void *>(input2_buffer), 16);