[neurun] Extend Op.lst macro (#3681)
author이한종/동작제어Lab(SR)/Engineer/삼성전자 <hanjoung.lee@samsung.com>
Fri, 23 Nov 2018 01:21:10 +0000 (10:21 +0900)
committer오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Fri, 23 Nov 2018 01:21:10 +0000 (10:21 +0900)
Make `Op.lst` always keep the full list of operations. Add a boolean
parameter to determine if it is from NN API or internally used node.
Later, this list will be used for auto generation of visitor code.

Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
runtimes/neurun/src/compiler/BackendResolver.h
runtimes/neurun/src/graph/operation/Op.lst

index a0fd0df..2a312a8 100644 (file)
@@ -43,7 +43,8 @@ public:
     if (backend_all_str.compare("none") != 0)
     {
       VERBOSE(BackendResolver) << "Use backend for all ops: " << backend_all_str << std::endl;
-#define OP(InternalName, NnApiName)                             \
+#define OP(InternalName, IsNnApi, NnApiName)                    \
+  if (IsNnApi)                                                  \
   {                                                             \
     auto backend = _backend_manager->get(backend_all_str);      \
     _gen_map[typeid(graph::operation::InternalName)] = backend; \
@@ -53,7 +54,8 @@ public:
     }
     else
     {
-#define OP(InternalName, NnApiName)                                                               \
+#define OP(InternalName, IsNnApi, NnApiName)                                                      \
+  if (IsNnApi)                                                                                    \
   {                                                                                               \
     const auto &backend_str =                                                                     \
         ::nnfw::util::EnvVar{std::string("OP_BACKEND_") + #NnApiName}.asString("acl_cl");         \
index 763815f..23f4b51 100644 (file)
 
 // NOTE The relation between "Internal Name" and "NN API Name" is "1 : N".
 
-// Internal Name           | NN API Name
-OP(Conv2DNode              , CONV_2D)
-OP(AvgPool2DNode           , AVERAGE_POOL_2D)
-OP(MaxPool2DNode           , MAX_POOL_2D)
-OP(ConcatNode              , CONCATENATION)
-OP(FullyConnectedNode      , FULLY_CONNECTED)
-OP(ReshapeNode             , RESHAPE)
-OP(SoftmaxNode             , SOFTMAX)
+// Internal Name           | NN API? | NN API Name
+OP(AddNode                 , true    , ADD)
+OP(Conv2DNode              , true    , CONV_2D)
+OP(AvgPool2DNode           , true    , AVERAGE_POOL_2D)
+OP(MaxPool2DNode           , true    , MAX_POOL_2D)
+OP(ConcatNode              , true    , CONCATENATION)
+OP(FullyConnectedNode      , true    , FULLY_CONNECTED)
+OP(ReshapeNode             , true    , RESHAPE)
+OP(SoftmaxNode             , true    , SOFTMAX)
+OP(PermuteNode             , false   , NOT_AVAILABLE)