From a61f4283a0cf72577141477a09c04e0f700c6494 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=98=A4=ED=98=95=EC=84=9D/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Mon, 17 Dec 2018 18:47:56 +0900 Subject: [PATCH] Define compile state (#4055) * Define compile state - Define 4 compile state getter/setter in plan - Set compiled state when compile finished Signed-off-by: Hyeongseok Oh * Rename getter & setter * Use class enum instead of enum --- runtimes/neurun/src/compiler/Compiler.cc | 2 ++ runtimes/neurun/src/compiler/Plan.h | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/runtimes/neurun/src/compiler/Compiler.cc b/runtimes/neurun/src/compiler/Compiler.cc index cf5a048..28606bd 100644 --- a/runtimes/neurun/src/compiler/Compiler.cc +++ b/runtimes/neurun/src/compiler/Compiler.cc @@ -115,6 +115,8 @@ void Compiler::compile(void) /******************************** * Code generation phase finished ********************************/ + + plan.state(State::PLANNED); } } // namespace compiler diff --git a/runtimes/neurun/src/compiler/Plan.h b/runtimes/neurun/src/compiler/Plan.h index b5fb4d5..d7ba31f 100644 --- a/runtimes/neurun/src/compiler/Plan.h +++ b/runtimes/neurun/src/compiler/Plan.h @@ -26,10 +26,18 @@ namespace neurun namespace compiler { +enum class State +{ + NONE, // Initial state + FAILED, // Failed + PLANNED, // Success planned + NO_PLAN // Not planned by environment or graph status +}; + class Plan { public: - Plan(const std::shared_ptr &model) : _model(model) + Plan(const std::shared_ptr &model) : _model(model), _state(State::NONE) { // DO NOTHING } @@ -38,6 +46,9 @@ public: neurun::graph::Graph &model(void) { return *_model; } const neurun::graph::Graph &model(void) const { return *_model; } + void state(State state) { _state = state; } + State state(void) const { return _state; } + public: operand::Context &operands(void) { return _operands; } const operand::Context &operands(void) const { return _operands; } @@ -50,6 +61,7 @@ private: std::shared_ptr _model; operand::Context _operands; operation::Sequence _ops; + State _state; }; } // namespace compiler -- 2.7.4