// Lower: decide backend
graph.lower();
+ plan.state(State::LOWERED);
dot_dumper.dumpIfNeeded("after_lower");
auto linear = graph.linearize();
+ plan.state(State::LINEARIZED);
// Dump ops
linear->accept(neurun::graph::dumper::Dumper{});
* Code generation phase finished
********************************/
- plan.state(State::PLANNED);
+ plan.state(State::COMPILED);
}
} // namespace compiler
enum class State
{
- NONE, // Initial state
- FAILED, // Failed
- PLANNED, // Success planned
- NO_PLAN // Not planned by environment or graph status
+ NONE, // Initial state
+ LOWERED, // Backend is decided
+ LINEARIZED, // Everything is moved to Linear object so this Graph object is no longer effective
+ COMPILED, // Success compilation
+ NOT_COMPILED // Not compiled by environment or graph status
};
class Plan
});
}
- _phase = Phase::LOWERED;
-
// Run PermutationInsertionPass
{
pass::PermutationInsertionPass pi_pass(*this);
std::unique_ptr<linear::Linear> Graph::linearize(void)
{
- assert(isLowered());
+ assert(_phase == Phase::MODEL);
auto linear = nnfw::cpp14::make_unique<linear::Linear>(*this);
// TODO Move the operations and operands to linear object
-
- _phase = Phase::LINEARIZED;
-
return std::move(linear);
}
enum class Phase
{
BUILDING,
- MODEL,
- LOWERED,
- LINEARIZED // Everything is moved to Linear object so this Graph object is no longer effective
+ MODEL
};
public:
void removeOperand(const model::operand::Index &ind) { _model->operands.remove(ind); }
std::unique_ptr<linear::Linear> linearize(void);
bool isBuildingPhase(void) const { return _phase == Phase::BUILDING; }
- bool isLowered(void) const { return _phase == Phase::LOWERED; }
private:
void initializeUseDef();
PermutationInsertionPass::insertPermute(const model::operand::Index &operand_index,
const backend::Backend *backend)
{
- assert(_graph.isLowered());
+ assert(!_graph.isBuildingPhase());
auto &operand = _graph.operands().at(operand_index);