void Compiler::compile(void)
{
// Compilation result will be filled in operand_context and operation_sequence
- auto operand_context = std::make_shared<operand::Context>();
+ auto operand_context = std::make_shared<OperandContext>();
auto operation_sequence = std::make_shared<operation::Sequence>();
const auto &operands = _model->operands();
namespace compiler
{
-ConstantInitializer::ConstantInitializer(const graph::Graph &graph, operand::Context &operands,
+ConstantInitializer::ConstantInitializer(const graph::Graph &graph, OperandContext &operands,
const graph::LowerInfoMap &lower_info_map)
: _graph{graph}, _operands{operands}, _lower_info_map{lower_info_map}
{
#define __NEURUN_COMPILER_CONSTANT_INITIALIZER_H__
#include "graph/Graph.h"
-#include "compiler/operand/Context.h"
+#include "compiler/OperandContext.h"
namespace neurun
{
{
public:
// TODO Change std::shared_ptr<Model> instead of Graph
- ConstantInitializer(const graph::Graph &graph, operand::Context &operands,
+ ConstantInitializer(const graph::Graph &graph, OperandContext &operands,
const graph::LowerInfoMap &lower_info_map);
void operator()();
private:
const graph::Graph &_graph;
- operand::Context &_operands;
+ OperandContext &_operands;
const graph::LowerInfoMap &_lower_info_map;
};
* limitations under the License.
*/
-#include "Context.h"
+#include "OperandContext.h"
#include <cassert>
{
namespace compiler
{
-namespace operand
-{
-Context &Context::set(const model::operand::Index &id,
- const std::shared_ptr<backend::operand::IObject> &object)
+OperandContext &OperandContext::set(const model::operand::Index &id,
+ const std::shared_ptr<backend::operand::IObject> &object)
{
// Only one object for an id
assert(_objects.find(id) == _objects.end());
return (*this);
}
-void Context::iterate(
+void OperandContext::iterate(
const std::function<void(const model::operand::Index &, backend::operand::IObject &)> &fn)
{
for (auto &e : _objects)
}
}
-} // namespace operand
} // namespace compiler
} // namespace neurun
{
namespace compiler
{
-namespace operand
-{
-class Context
+class OperandContext
{
public:
- Context &set(const model::operand::Index &ind,
- const std::shared_ptr<backend::operand::IObject> &object);
+ OperandContext &set(const model::operand::Index &ind,
+ const std::shared_ptr<backend::operand::IObject> &object);
public:
bool exist(const ::neurun::model::operand::Index &ind) const
model::operand::IndexMap<std::shared_ptr<backend::operand::IObject>> _objects;
};
-} // namespace operand
} // namespace compiler
} // namespace neurun
#define __NEURUN_CODEGEN_PLAN_H__
#include "graph/Graph.h"
-#include "compiler/operand/Context.h"
+#include "compiler/OperandContext.h"
#include "compiler/operation/Sequence.h"
namespace neurun
* @param[in] ops Compiled operation sequence
* @param[in] compiled @c true if model is compiled successfully, otherwise @c false
*/
- Plan(std::shared_ptr<operand::Context> &operands, std::shared_ptr<operation::Sequence> &ops,
+ Plan(std::shared_ptr<OperandContext> &operands, std::shared_ptr<operation::Sequence> &ops,
bool compiled = true)
: _operands{operands}, _ops{ops}, _compiled{compiled}
{
}
public:
- const operand::Context &operands(void) const { return *_operands; }
+ const OperandContext &operands(void) const { return *_operands; }
const operation::Sequence &operations(void) const { return *_ops; }
bool isCompiled(void) const { return _compiled; }
private:
- std::shared_ptr<operand::Context> _operands{nullptr};
+ std::shared_ptr<OperandContext> _operands{nullptr};
std::shared_ptr<operation::Sequence> _ops{nullptr};
bool _compiled{false};
};
#ifndef __NEURUN_COMPILER_PLAN_BUILDER_H__
#define __NEURUN_COMPILER_PLAN_BUILDER_H__
-#include "compiler/operand/Context.h"
+#include "compiler/OperandContext.h"
#include "compiler/operation/Sequence.h"
#include "compiler/IExecutionBuilder.h"
#include "backend/interface/IStageGenerator.h"
class PlanBuilder
{
public:
- PlanBuilder(operand::Context &operands, operation::Sequence &operations)
+ PlanBuilder(OperandContext &operands, operation::Sequence &operations)
: _operands{operands}, _operations{operations}
{
// DO NOTHING
void finalize(const backend::TensorBuilderSet &tensor_builders);
private:
- operand::Context &_operands;
+ OperandContext &_operands;
operation::Sequence &_operations;
private:
}
}
-DataflowExecutor::DataflowExecutor(
- const std::shared_ptr<const model::Model> &model,
- std::unique_ptr<graph::LowerInfoMap> lower_info,
- const std::shared_ptr<compiler::operand::Context> &operand_context, CodeMap &&code_map)
+DataflowExecutor::DataflowExecutor(const std::shared_ptr<const model::Model> &model,
+ std::unique_ptr<graph::LowerInfoMap> lower_info,
+ const std::shared_ptr<compiler::OperandContext> &operand_context,
+ CodeMap &&code_map)
: ExecutorBase{model, nullptr, std::move(lower_info)}, _operand_context{operand_context},
_code_map{std::move(code_map)}
{
*/
DataflowExecutor(const std::shared_ptr<const model::Model> &model,
std::unique_ptr<graph::LowerInfoMap> lower_info,
- const std::shared_ptr<compiler::operand::Context> &operand_context,
+ const std::shared_ptr<compiler::OperandContext> &operand_context,
CodeMap &&code_map);
void execute() override;
private:
- std::shared_ptr<compiler::operand::Context> _operand_context;
+ std::shared_ptr<compiler::OperandContext> _operand_context;
CodeMap _code_map;
model::operand::IndexSet _initially_ready_operands;
std::list<std::unique_ptr<Job>> _finished_jobs;