Define compile state (#4055)
author오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Mon, 17 Dec 2018 09:47:56 +0000 (18:47 +0900)
committer이춘석/동작제어Lab(SR)/Staff Engineer/삼성전자 <chunseok.lee@samsung.com>
Mon, 17 Dec 2018 09:47:56 +0000 (18:47 +0900)
* Define compile state

- Define 4 compile state getter/setter in plan
- Set compiled state when compile finished

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
* Rename getter & setter

* Use class enum instead of enum

runtimes/neurun/src/compiler/Compiler.cc
runtimes/neurun/src/compiler/Plan.h

index cf5a048..28606bd 100644 (file)
@@ -115,6 +115,8 @@ void Compiler::compile(void)
   /********************************
    * Code generation phase finished
    ********************************/
+
+  plan.state(State::PLANNED);
 }
 
 } // namespace compiler
index b5fb4d5..d7ba31f 100644 (file)
@@ -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<neurun::graph::Graph> &model) : _model(model)
+  Plan(const std::shared_ptr<neurun::graph::Graph> &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<neurun::graph::Graph> _model;
   operand::Context _operands;
   operation::Sequence _ops;
+  State _state;
 };
 
 } // namespace compiler