const auto &operands = graph.operands();
// Compilation result will be filled in operand_context and operation_sequence
- auto operation_sequence = std::make_shared<operation::Sequence>();
+ auto function_sequence = std::make_shared<exec::FunctionSequence>();
// linearize
auto linear = graph.linearize();
* Code generation phase
***********************/
- PlanBuilder plan_builder{*operand_context, *operation_sequence};
+ PlanBuilder plan_builder{*operand_context, *function_sequence};
// Fix shapes
linear->iterate([&](const linear::Element &element) {
mem_mgrs->insert(std::move(tensor_builder->releaseMemoryManager()));
}
- auto plan = std::make_shared<Plan>(operation_sequence);
+ auto plan = std::make_shared<Plan>(function_sequence);
return new exec::LinearExecutor{graph.shareModel(),
linear->releaseSubgraphContext(),
operand_context,
#define __NEURUN_CODEGEN_PLAN_H__
#include "graph/Graph.h"
+#include "exec/FunctionSequence.h"
#include "compiler/OperandContext.h"
-#include "compiler/operation/Sequence.h"
namespace neurun
{
* @param[in] operands Compiled operand context
* @param[in] ops Compiled operation sequence
*/
- Plan(std::shared_ptr<operation::Sequence> &ops) : _ops{ops}
+ Plan(std::shared_ptr<exec::FunctionSequence> &ops) : _ops{ops}
{
// DO NOTHING
}
public:
- const operation::Sequence &operations(void) const { return *_ops; }
+ exec::FunctionSequence &functions(void) const { return *_ops; }
private:
- std::shared_ptr<operation::Sequence> _ops{nullptr};
+ std::shared_ptr<exec::FunctionSequence> _ops{nullptr};
};
} // namespace compiler
}
// Generate kernels
- auto execution_builder = nnfw::cpp14::make_unique<ExecutionBuilder>(_operations);
+ auto execution_builder = nnfw::cpp14::make_unique<ExecutionBuilder>(_functions);
linear->iterate([&](const linear::Element &element) {
auto backend = element.lower_info->backend();
auto kernel_gen = backend->kernel_gen();
#ifndef __NEURUN_COMPILER_PLAN_BUILDER_H__
#define __NEURUN_COMPILER_PLAN_BUILDER_H__
+#include "exec/FunctionSequence.h"
#include "compiler/OperandContext.h"
-#include "compiler/operation/Sequence.h"
#include "compiler/IExecutionBuilder.h"
#include "backend/IShapeFixer.h"
#include "backend/ITensorBuilder.h"
class ExecutionBuilder final : public IExecutionBuilder
{
public:
- ExecutionBuilder(operation::Sequence &operations) : _operations{operations}
+ ExecutionBuilder(exec::FunctionSequence &functions) : _functions{functions}
{
// DO NOTHING
}
public:
void append(std::unique_ptr<::neurun::exec::IFunction> &&f) override
{
- _operations.append(std::move(f));
+ _functions.append(std::move(f));
}
private:
- operation::Sequence &_operations;
+ exec::FunctionSequence &_functions;
};
class PlanBuilder
{
public:
- PlanBuilder(OperandContext &operands, operation::Sequence &operations)
- : _operands{operands}, _operations{operations}
+ PlanBuilder(OperandContext &operands, exec::FunctionSequence &functions)
+ : _operands{operands}, _functions{functions}
{
// DO NOTHING
}
private:
OperandContext &_operands;
- operation::Sequence &_operations;
+ exec::FunctionSequence &_functions;
};
} // namepsace compiler
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Sequence.h"
-
-namespace neurun
-{
-namespace compiler
-{
-namespace operation
-{
-
-// NO IMPLEMENTATION YET
-
-} // namespace operation
-} // namespace compiler
-} // namespace neurun
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __NEURUN_COMPILER_OPERATION_SEQUENCE_H__
-#define __NEURUN_COMPILER_OPERATION_SEQUENCE_H__
-#include <stdint.h>
-#include "exec/IFunction.h"
-#include <memory>
-#include <vector>
-
-namespace neurun
-{
-namespace compiler
-{
-namespace operation
-{
-
-class Sequence
-{
-public:
- uint32_t size(void) const { return _functions.size(); }
-
-public:
- Sequence &append(std::unique_ptr<::neurun::exec::IFunction> &&func)
- {
- _functions.emplace_back(std::move(func));
- return (*this);
- }
-
-public:
- ::neurun::exec::IFunction &at(uint32_t n) const { return *(_functions.at(n)); }
-
-private:
- std::vector<std::unique_ptr<::neurun::exec::IFunction>> _functions;
-};
-
-} // namespace operation
-} // namespace compiler
-} // namespace neurun
-
-#endif // __NEURUN_COMPILER_OPERATION_SEQUENCE_H__
namespace exec
{
-void LinearExecutor::executeImpl()
-{
- const auto &operations = _plan->operations();
- for (uint32_t n = 0; n < operations.size(); ++n)
- {
- operations.at(n).run();
- }
-}
+void LinearExecutor::executeImpl() { _plan->functions().run(); }
} // namespace exec
} // namespace neurun