[neurun] Move Source and Sink to `exec` dir (#2612)
author이한종/동작제어Lab(SR)/Engineer/삼성전자 <hanjoung.lee@samsung.com>
Thu, 6 Sep 2018 01:32:26 +0000 (10:32 +0900)
committer오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Thu, 6 Sep 2018 01:32:26 +0000 (10:32 +0900)
Move `Source` and `Sink` to exec directory and change namespace from
`internal` to `exec`.

Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
runtimes/neurun/src/exec/Sink.h [moved from runtimes/neurun/src/internal/Sink.h with 94% similarity]
runtimes/neurun/src/exec/Source.h [moved from runtimes/neurun/src/internal/Source.h with 93% similarity]
runtimes/neurun/src/frontend/execution.cc
runtimes/neurun/src/frontend/wrapper/execution.h

similarity index 94%
rename from runtimes/neurun/src/internal/Sink.h
rename to runtimes/neurun/src/exec/Sink.h
index cf0de1c..8a30d24 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __INTERNAL_SINK_H__
-#define __INTERNAL_SINK_H__
+#ifndef __NEURUN_EXEC_SINK_H__
+#define __NEURUN_EXEC_SINK_H__
 
 #include <cassert>
 
 #include "internal/nnapi/feature/View.h"
 #include "internal/nnapi/feature/Reader.h"
 
+namespace neurun
+{
+namespace exec
+{
+
 struct Sink
 {
   virtual ~Sink() = default;
@@ -96,4 +101,7 @@ private:
   const size_t _size;
 };
 
+} // namespace exec
+} // namespace neurun
+
 #endif // __INTERNAL_SINK_H__
similarity index 93%
rename from runtimes/neurun/src/internal/Source.h
rename to runtimes/neurun/src/exec/Source.h
index b3cad38..dc631fd 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __INTERNAL_SOURCE_H__
-#define __INTERNAL_SOURCE_H__
+#ifndef __NEURUN_EXEC_SOURCE_H__
+#define __NEURUN_EXEC_SOURCE_H__
 
 #include <cassert>
 
 
 #include "backend/acl_cl/feature/View.h"
 
+namespace neurun
+{
+namespace exec
+{
+
 struct Source
 {
   virtual ~Source() = default;
@@ -99,4 +104,7 @@ private:
   const size_t _size;
 };
 
-#endif // __INTERNAL_SOURCE_H__
+} // namespace exec
+} // namespace neurun
+
+#endif // __NEURUN_EXEC_SOURCE_H__
index 4114c2d..b12d823 100644 (file)
@@ -6,7 +6,6 @@
 #include "frontend/wrapper/execution.h"
 #include "frontend/wrapper/event.h"
 
-#include "internal/Source.h"
 #include "graph/operand/Index.h"
 
 //
@@ -62,14 +61,15 @@ int ANeuralNetworksExecution_setInput(ANeuralNetworksExecution *execution, int32
 
     const auto len = operands.at(operand_index).shape().dim(1);
 
-    execution->source<VectorSource>(index, len, reinterpret_cast<const uint8_t *>(buffer), length);
+    execution->source<neurun::exec::VectorSource>(
+        index, len, reinterpret_cast<const uint8_t *>(buffer), length);
   }
   else if (operands.at(operand_index).shape().rank() == 4)
   {
     const auto &operand_shape = operands.at(operand_index).shape().asFeature();
 
-    execution->source<FeatureSource>(index, operand_shape,
-                                     reinterpret_cast<const uint8_t *>(buffer), length);
+    execution->source<neurun::exec::FeatureSource>(
+        index, operand_shape, reinterpret_cast<const uint8_t *>(buffer), length);
   }
   else
   {
@@ -108,13 +108,15 @@ int ANeuralNetworksExecution_setOutput(ANeuralNetworksExecution *execution, int3
 
     const auto len = operands.at(operand_index).shape().dim(1);
 
-    execution->sink<VectorSink>(index, len, reinterpret_cast<uint8_t *>(buffer), length);
+    execution->sink<neurun::exec::VectorSink>(index, len, reinterpret_cast<uint8_t *>(buffer),
+                                              length);
   }
   else if (operands.at(operand_index).shape().rank() == 4)
   {
     const auto &operand_shape = operands.at(operand_index).shape().asFeature();
 
-    execution->sink<FeatureSink>(index, operand_shape, reinterpret_cast<uint8_t *>(buffer), length);
+    execution->sink<neurun::exec::FeatureSink>(index, operand_shape,
+                                               reinterpret_cast<uint8_t *>(buffer), length);
   }
   else
   {
index 4c4c5c2..f0a910b 100644 (file)
@@ -2,8 +2,8 @@
 #define __EXECUTION_H__
 
 #include "codegen/Plan.h"
-#include "internal/Source.h"
-#include "internal/Sink.h"
+#include "exec/Source.h"
+#include "exec/Sink.h"
 
 struct ANeuralNetworksExecution
 {
@@ -22,29 +22,32 @@ private:
 
 public:
   // TODO Use InputIndex instead of int
-  void source(int n, std::unique_ptr<Source> &&source) { _sources.at(n) = std::move(source); }
+  void source(int n, std::unique_ptr<neurun::exec::Source> &&source)
+  {
+    _sources.at(n) = std::move(source);
+  }
   template <typename T, typename... Args> void source(int n, Args &&... args)
   {
     source(n, std::unique_ptr<T>{new T{std::forward<Args>(args)...}});
   }
 
 public:
-  const Source &source(int n) const { return *(_sources.at(n)); }
+  const neurun::exec::Source &source(int n) const { return *(_sources.at(n)); }
 
 public:
   // TODO Use OutputIndex instead of int
-  void sink(int n, std::unique_ptr<Sink> &&sink) { _sinks.at(n) = std::move(sink); }
+  void sink(int n, std::unique_ptr<neurun::exec::Sink> &&sink) { _sinks.at(n) = std::move(sink); }
   template <typename T, typename... Args> void sink(int n, Args &&... args)
   {
     sink(n, std::unique_ptr<T>{new T{std::forward<Args>(args)...}});
   }
 
 public:
-  const Sink &sink(int n) const { return *(_sinks.at(n)); }
+  const neurun::exec::Sink &sink(int n) const { return *(_sinks.at(n)); }
 
 private:
-  std::vector<std::unique_ptr<Source>> _sources;
-  std::vector<std::unique_ptr<Sink>> _sinks;
+  std::vector<std::unique_ptr<neurun::exec::Source>> _sources;
+  std::vector<std::unique_ptr<neurun::exec::Sink>> _sinks;
 };
 
 #endif