From 0571f53e2a56704b4423d1845370b62ab9818fe0 Mon Sep 17 00:00:00 2001 From: "Efimov Alexander/AI Tools Lab/./Samsung Electronics" Date: Mon, 10 Dec 2018 21:37:15 +0300 Subject: [PATCH] [nnc] Add arm-c++ target (#2515) Adds new target option to make possible split of arm and x86 artifact generation in cpu c++ backend Signed-off-by: Efimov Alexander --- contrib/nnc/driver/Driver.cpp | 4 +++- contrib/nnc/driver/Options.cpp | 11 +++++++++-- contrib/nnc/include/option/Options.h | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/contrib/nnc/driver/Driver.cpp b/contrib/nnc/driver/Driver.cpp index 2eab95f..f8798e1 100644 --- a/contrib/nnc/driver/Driver.cpp +++ b/contrib/nnc/driver/Driver.cpp @@ -121,7 +121,9 @@ void Driver::registerBackendPass() { std::unique_ptr pass; - if (cli::target == NNC_TARGET_X86_CPP) { + if (cli::target == NNC_TARGET_ARM_CPP) { + pass = std::move(std::unique_ptr(new CPPCodeGenerator())); + } else if (cli::target == NNC_TARGET_X86_CPP) { pass = std::move(std::unique_ptr(new CPPCodeGenerator())); } else if (cli::target == NNC_TARGET_ARM_GPU_CPP) { pass = std::move(std::unique_ptr(new AclCppCodeGenerator())); diff --git a/contrib/nnc/driver/Options.cpp b/contrib/nnc/driver/Options.cpp index 028bd67..0fc613e 100644 --- a/contrib/nnc/driver/Options.cpp +++ b/contrib/nnc/driver/Options.cpp @@ -117,10 +117,17 @@ Option tflFrontend(optname("--tflite"), ); Option 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("=")); diff --git a/contrib/nnc/include/option/Options.h b/contrib/nnc/include/option/Options.h index 0ce2c4b..670afc8 100644 --- a/contrib/nnc/include/option/Options.h +++ b/contrib/nnc/include/option/Options.h @@ -37,6 +37,7 @@ extern Option tflFrontend; // frontend for TensorFlow Lite AI framework extern Option 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" -- 2.7.4