[nnc] Add arm-c++ target (#2515)
authorEfimov Alexander/AI Tools Lab/./Samsung Electronics <a.efimov@samsung.com>
Mon, 10 Dec 2018 18:37:15 +0000 (21:37 +0300)
committerРоман Михайлович Русяев/AI Tools Lab /SRR/Staff Engineer/삼성전자 <r.rusyaev@samsung.com>
Mon, 10 Dec 2018 18:37:15 +0000 (21:37 +0300)
Adds new target option to make possible split of arm and x86 artifact generation in cpu c++ backend

Signed-off-by: Efimov Alexander <a.efimov@samsung.com>
contrib/nnc/driver/Driver.cpp
contrib/nnc/driver/Options.cpp
contrib/nnc/include/option/Options.h

index 2eab95f..f8798e1 100644 (file)
@@ -121,7 +121,9 @@ void Driver::registerBackendPass() {
 
   std::unique_ptr<Pass> pass;
 
-  if (cli::target == NNC_TARGET_X86_CPP) {
+  if (cli::target == NNC_TARGET_ARM_CPP) {
+    pass = std::move(std::unique_ptr<Pass>(new CPPCodeGenerator()));
+  } else if (cli::target == NNC_TARGET_X86_CPP) {
     pass = std::move(std::unique_ptr<Pass>(new CPPCodeGenerator()));
   } else if (cli::target == NNC_TARGET_ARM_GPU_CPP) {
     pass = std::move(std::unique_ptr<Pass>(new AclCppCodeGenerator()));
index 028bd67..0fc613e 100644 (file)
@@ -117,10 +117,17 @@ Option<bool> tflFrontend(optname("--tflite"),
                         );
 Option<std::string> target(optname("--target"),
                            overview("select target language to emit for given architecture."
-                                    "Valid values are '" NNC_TARGET_X86_CPP "', '" NNC_TARGET_ARM_GPU_CPP "', '" NNC_TARGET_INTERPRETER "'"),
+                                    "Valid values are '"
+                                    NNC_TARGET_ARM_CPP "', '"
+                                    NNC_TARGET_X86_CPP "', '"
+                                    NNC_TARGET_ARM_GPU_CPP "', '"
+                                    NNC_TARGET_INTERPRETER "'"),
                            std::string(),
                            optional(false),
-                           optvalues(NNC_TARGET_X86_CPP "," NNC_TARGET_ARM_GPU_CPP "," NNC_TARGET_INTERPRETER),
+                           optvalues(NNC_TARGET_ARM_CPP ","
+                                     NNC_TARGET_X86_CPP ","
+                                     NNC_TARGET_ARM_GPU_CPP ","
+                                     NNC_TARGET_INTERPRETER),
                            nullptr,
                            separators("="));
 
index 0ce2c4b..670afc8 100644 (file)
@@ -37,6 +37,7 @@ extern Option<bool> tflFrontend;    // frontend for TensorFlow Lite AI framework
 extern Option<bool> onnxFrontend;   // frontend for ONNX AI framework
 
 // valid values for target option
+#define NNC_TARGET_ARM_CPP      "arm-c++"
 #define NNC_TARGET_X86_CPP      "x86-c++"
 #define NNC_TARGET_ARM_GPU_CPP  "arm-gpu-c++"
 #define NNC_TARGET_INTERPRETER  "interpreter"