From a7bb092dae440f728ac8e61420aab8dd556b2e5d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9D=B4=ED=95=9C=EC=A2=85/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Engineer/=EC=82=BC=EC=84=B1=EC=A0=84?= =?utf8?q?=EC=9E=90?= Date: Fri, 23 Nov 2018 10:21:10 +0900 Subject: [PATCH] [neurun] Extend Op.lst macro (#3681) 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 --- runtimes/neurun/src/compiler/BackendResolver.h | 6 ++++-- runtimes/neurun/src/graph/operation/Op.lst | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/runtimes/neurun/src/compiler/BackendResolver.h b/runtimes/neurun/src/compiler/BackendResolver.h index a0fd0df..2a312a8 100644 --- a/runtimes/neurun/src/compiler/BackendResolver.h +++ b/runtimes/neurun/src/compiler/BackendResolver.h @@ -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"); \ diff --git a/runtimes/neurun/src/graph/operation/Op.lst b/runtimes/neurun/src/graph/operation/Op.lst index 763815f..23f4b51 100644 --- a/runtimes/neurun/src/graph/operation/Op.lst +++ b/runtimes/neurun/src/graph/operation/Op.lst @@ -20,11 +20,13 @@ // 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) -- 2.7.4