From b4f1e9c8c762664ddf04be6eb8329b5098102b62 Mon Sep 17 00:00:00 2001 From: "Efimov Alexander/AI Tools Lab/./Samsung Electronics" Date: Wed, 5 Sep 2018 15:58:26 +0300 Subject: [PATCH] Refactor soft backend (#1305) Remove redundant soft backend classes Move all C++ code snippets to code_snippet directory Generate headers from snippets to generated directory Signed-off-by: Efimov Alexander --- contrib/nnc/cmake/soft_backend.cmake | 2 +- contrib/nnc/plugin/soft_backend/CMakeLists.txt | 6 +-- contrib/nnc/plugin/soft_backend/base_generator.cpp | 5 ++- contrib/nnc/plugin/soft_backend/base_generator.h | 5 ++- contrib/nnc/plugin/soft_backend/c_backend.cpp | 48 ---------------------- contrib/nnc/plugin/soft_backend/c_generator.cpp | 5 +++ .../{cpp_ops => code_snippets}/cpp_add_bias.def | 0 .../{cpp_ops => code_snippets}/cpp_capped_relu.def | 0 .../cpp_common_funcs.def | 0 .../{cpp_ops => code_snippets}/cpp_concat.def | 0 .../{cpp_ops => code_snippets}/cpp_conv.def | 0 .../cpp_depthwise_conv.def | 0 .../cpp_fully_connected.def | 0 .../{ => code_snippets}/cpp_header_types.def | 0 .../{ => code_snippets}/cpp_operations.def | 0 .../{cpp_ops => code_snippets}/cpp_pool.def | 0 .../{cpp_ops => code_snippets}/cpp_relu.def | 0 .../{cpp_ops => code_snippets}/cpp_softmax.def | 0 .../{cpp_ops => code_snippets}/eigen.def | 0 contrib/nnc/plugin/soft_backend/cpp_backend.cpp | 48 ---------------------- contrib/nnc/plugin/soft_backend/cpp_generator.cpp | 34 ++++++++------- contrib/nnc/plugin/soft_backend/soft_backend.cpp | 39 ------------------ contrib/nnc/plugin/soft_backend/soft_backend.h | 44 -------------------- contrib/nnc/tests/soft_backend/compile_cpp.cpp | 4 +- contrib/nnc/unittests/soft_backend/CMakeLists.txt | 3 +- .../unittests/soft_backend/cpp_header_types.cpp | 2 +- .../nnc/unittests/soft_backend/cpp_operations.cpp | 26 ++++++------ contrib/nnc/unittests/soft_backend/generator.cpp | 6 +-- contrib/nnc/utils/def2src.cpp | 2 +- 29 files changed, 56 insertions(+), 223 deletions(-) delete mode 100644 contrib/nnc/plugin/soft_backend/c_backend.cpp rename contrib/nnc/plugin/soft_backend/{cpp_ops => code_snippets}/cpp_add_bias.def (100%) rename contrib/nnc/plugin/soft_backend/{cpp_ops => code_snippets}/cpp_capped_relu.def (100%) rename contrib/nnc/plugin/soft_backend/{cpp_ops => code_snippets}/cpp_common_funcs.def (100%) rename contrib/nnc/plugin/soft_backend/{cpp_ops => code_snippets}/cpp_concat.def (100%) rename contrib/nnc/plugin/soft_backend/{cpp_ops => code_snippets}/cpp_conv.def (100%) rename contrib/nnc/plugin/soft_backend/{cpp_ops => code_snippets}/cpp_depthwise_conv.def (100%) rename contrib/nnc/plugin/soft_backend/{cpp_ops => code_snippets}/cpp_fully_connected.def (100%) rename contrib/nnc/plugin/soft_backend/{ => code_snippets}/cpp_header_types.def (100%) rename contrib/nnc/plugin/soft_backend/{ => code_snippets}/cpp_operations.def (100%) rename contrib/nnc/plugin/soft_backend/{cpp_ops => code_snippets}/cpp_pool.def (100%) rename contrib/nnc/plugin/soft_backend/{cpp_ops => code_snippets}/cpp_relu.def (100%) rename contrib/nnc/plugin/soft_backend/{cpp_ops => code_snippets}/cpp_softmax.def (100%) rename contrib/nnc/plugin/soft_backend/{cpp_ops => code_snippets}/eigen.def (100%) delete mode 100644 contrib/nnc/plugin/soft_backend/cpp_backend.cpp delete mode 100644 contrib/nnc/plugin/soft_backend/soft_backend.cpp delete mode 100644 contrib/nnc/plugin/soft_backend/soft_backend.h diff --git a/contrib/nnc/cmake/soft_backend.cmake b/contrib/nnc/cmake/soft_backend.cmake index 24dcda6..ccabc07 100644 --- a/contrib/nnc/cmake/soft_backend.cmake +++ b/contrib/nnc/cmake/soft_backend.cmake @@ -2,7 +2,7 @@ function(make_generated_sources DEF_SOURCES OUT_DIR GEN_SOURCES) set(GEN_OUT "") foreach(file IN LISTS DEF_SOURCES) get_filename_component(file_name ${file} NAME_WE) - set(out_file "${OUT_DIR}/${file_name}.h") + set(out_file "${OUT_DIR}/${file_name}.generated.h") list(APPEND GEN_OUT "${out_file}") add_custom_command( OUTPUT ${out_file} diff --git a/contrib/nnc/plugin/soft_backend/CMakeLists.txt b/contrib/nnc/plugin/soft_backend/CMakeLists.txt index b21f65b..22b5998 100644 --- a/contrib/nnc/plugin/soft_backend/CMakeLists.txt +++ b/contrib/nnc/plugin/soft_backend/CMakeLists.txt @@ -1,6 +1,6 @@ -set(SOFT_BACKEND_COMMON_SOURCES soft_backend.cpp base_generator.cpp model_analyzer.cpp serializer.cpp) -set(SOFT_BACKEND_CPP_SOURCES cpp_backend.cpp cpp_generator.cpp) -set(SOFT_BACKEND_C_SOURCES c_backend.cpp c_generator.cpp) +set(SOFT_BACKEND_COMMON_SOURCES base_generator.cpp model_analyzer.cpp serializer.cpp) +set(SOFT_BACKEND_CPP_SOURCES cpp_generator.cpp) +set(SOFT_BACKEND_C_SOURCES c_generator.cpp) set(DEF_CONV ${NNC_ROOT_SRC_DIR}/utils/def2src.cpp) file(GLOB_RECURSE SOFT_DEF_SOURCES "*.def") diff --git a/contrib/nnc/plugin/soft_backend/base_generator.cpp b/contrib/nnc/plugin/soft_backend/base_generator.cpp index 7fac842..dd08bde 100644 --- a/contrib/nnc/plugin/soft_backend/base_generator.cpp +++ b/contrib/nnc/plugin/soft_backend/base_generator.cpp @@ -89,8 +89,9 @@ void BaseCodeGenerator::materializeModelParams(ostream &out, const Serializer &s } } -void BaseCodeGenerator::generate(Graph *g) +void *BaseCodeGenerator::execute(void *data) { + Graph *g = reinterpret_cast(data); // inference shapes core::IR::model::ShapeInference si; g->accept(&si); @@ -119,6 +120,8 @@ void BaseCodeGenerator::generate(Graph *g) auto modelStream = getStream(_paramsPath); materializeModelParams(*modelStream, serializer); modelStream.reset(); + + return nullptr; } } // namespace soft diff --git a/contrib/nnc/plugin/soft_backend/base_generator.h b/contrib/nnc/plugin/soft_backend/base_generator.h index dc2266e..369f1fb 100644 --- a/contrib/nnc/plugin/soft_backend/base_generator.h +++ b/contrib/nnc/plugin/soft_backend/base_generator.h @@ -2,6 +2,7 @@ #define _NNC_SOFT_BACKEND_BASE_GENERATOR_H_ #include "core/modelIR/graph.h" +#include "support/PluginInstance.h" #include #include @@ -19,10 +20,10 @@ class ModelAnalyzer; class Serializer; -class BaseCodeGenerator +class BaseCodeGenerator: public nncc::contrib::plugin::BackendPlugin { public: - void generate(nncc::contrib::core::IR::model::Graph *g); + void *execute(void *data) override; protected: virtual void formatTensorNames(const ModelAnalyzer &ma) = 0; diff --git a/contrib/nnc/plugin/soft_backend/c_backend.cpp b/contrib/nnc/plugin/soft_backend/c_backend.cpp deleted file mode 100644 index ef31a6e..0000000 --- a/contrib/nnc/plugin/soft_backend/c_backend.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "soft_backend.h" -#include "c_generator.h" - -using namespace nncc::contrib::plugin; -using namespace nncc::contrib::backend::soft; - -namespace nncc -{ -namespace contrib -{ -namespace backend -{ -namespace soft -{ - -class CSoftBackend final: public BaseSoftBackend -{ -public: - CSoftBackend &operator=(const CSoftBackend &) = delete; - - CSoftBackend(const CSoftBackend &) = delete; - - void generate(nncc::contrib::core::IR::model::Graph *g) override - { - CCodeGenerator gen; - gen.generate(g); - } - - static CSoftBackend &getInstance() - { - static CSoftBackend instance; - return instance; - } - -private: - CSoftBackend() = default; -}; - -} // namespace soft -} // namespace backend -} // namespace contrib -} // namespace nncc - - -extern "C" Plugin *get_instance() -{ - return &CSoftBackend::getInstance(); -} diff --git a/contrib/nnc/plugin/soft_backend/c_generator.cpp b/contrib/nnc/plugin/soft_backend/c_generator.cpp index 89e394e..55d5e91 100644 --- a/contrib/nnc/plugin/soft_backend/c_generator.cpp +++ b/contrib/nnc/plugin/soft_backend/c_generator.cpp @@ -34,3 +34,8 @@ void CCodeGenerator::materializeCode(ostream &out, const ModelAnalyzer &ma, cons } // namespace contrib } // namespace nncc +extern "C" nncc::contrib::plugin::Plugin *get_instance() +{ + static nncc::contrib::backend::soft::CCodeGenerator cCodeGenerator; + return &cCodeGenerator; +} diff --git a/contrib/nnc/plugin/soft_backend/cpp_ops/cpp_add_bias.def b/contrib/nnc/plugin/soft_backend/code_snippets/cpp_add_bias.def similarity index 100% rename from contrib/nnc/plugin/soft_backend/cpp_ops/cpp_add_bias.def rename to contrib/nnc/plugin/soft_backend/code_snippets/cpp_add_bias.def diff --git a/contrib/nnc/plugin/soft_backend/cpp_ops/cpp_capped_relu.def b/contrib/nnc/plugin/soft_backend/code_snippets/cpp_capped_relu.def similarity index 100% rename from contrib/nnc/plugin/soft_backend/cpp_ops/cpp_capped_relu.def rename to contrib/nnc/plugin/soft_backend/code_snippets/cpp_capped_relu.def diff --git a/contrib/nnc/plugin/soft_backend/cpp_ops/cpp_common_funcs.def b/contrib/nnc/plugin/soft_backend/code_snippets/cpp_common_funcs.def similarity index 100% rename from contrib/nnc/plugin/soft_backend/cpp_ops/cpp_common_funcs.def rename to contrib/nnc/plugin/soft_backend/code_snippets/cpp_common_funcs.def diff --git a/contrib/nnc/plugin/soft_backend/cpp_ops/cpp_concat.def b/contrib/nnc/plugin/soft_backend/code_snippets/cpp_concat.def similarity index 100% rename from contrib/nnc/plugin/soft_backend/cpp_ops/cpp_concat.def rename to contrib/nnc/plugin/soft_backend/code_snippets/cpp_concat.def diff --git a/contrib/nnc/plugin/soft_backend/cpp_ops/cpp_conv.def b/contrib/nnc/plugin/soft_backend/code_snippets/cpp_conv.def similarity index 100% rename from contrib/nnc/plugin/soft_backend/cpp_ops/cpp_conv.def rename to contrib/nnc/plugin/soft_backend/code_snippets/cpp_conv.def diff --git a/contrib/nnc/plugin/soft_backend/cpp_ops/cpp_depthwise_conv.def b/contrib/nnc/plugin/soft_backend/code_snippets/cpp_depthwise_conv.def similarity index 100% rename from contrib/nnc/plugin/soft_backend/cpp_ops/cpp_depthwise_conv.def rename to contrib/nnc/plugin/soft_backend/code_snippets/cpp_depthwise_conv.def diff --git a/contrib/nnc/plugin/soft_backend/cpp_ops/cpp_fully_connected.def b/contrib/nnc/plugin/soft_backend/code_snippets/cpp_fully_connected.def similarity index 100% rename from contrib/nnc/plugin/soft_backend/cpp_ops/cpp_fully_connected.def rename to contrib/nnc/plugin/soft_backend/code_snippets/cpp_fully_connected.def diff --git a/contrib/nnc/plugin/soft_backend/cpp_header_types.def b/contrib/nnc/plugin/soft_backend/code_snippets/cpp_header_types.def similarity index 100% rename from contrib/nnc/plugin/soft_backend/cpp_header_types.def rename to contrib/nnc/plugin/soft_backend/code_snippets/cpp_header_types.def diff --git a/contrib/nnc/plugin/soft_backend/cpp_operations.def b/contrib/nnc/plugin/soft_backend/code_snippets/cpp_operations.def similarity index 100% rename from contrib/nnc/plugin/soft_backend/cpp_operations.def rename to contrib/nnc/plugin/soft_backend/code_snippets/cpp_operations.def diff --git a/contrib/nnc/plugin/soft_backend/cpp_ops/cpp_pool.def b/contrib/nnc/plugin/soft_backend/code_snippets/cpp_pool.def similarity index 100% rename from contrib/nnc/plugin/soft_backend/cpp_ops/cpp_pool.def rename to contrib/nnc/plugin/soft_backend/code_snippets/cpp_pool.def diff --git a/contrib/nnc/plugin/soft_backend/cpp_ops/cpp_relu.def b/contrib/nnc/plugin/soft_backend/code_snippets/cpp_relu.def similarity index 100% rename from contrib/nnc/plugin/soft_backend/cpp_ops/cpp_relu.def rename to contrib/nnc/plugin/soft_backend/code_snippets/cpp_relu.def diff --git a/contrib/nnc/plugin/soft_backend/cpp_ops/cpp_softmax.def b/contrib/nnc/plugin/soft_backend/code_snippets/cpp_softmax.def similarity index 100% rename from contrib/nnc/plugin/soft_backend/cpp_ops/cpp_softmax.def rename to contrib/nnc/plugin/soft_backend/code_snippets/cpp_softmax.def diff --git a/contrib/nnc/plugin/soft_backend/cpp_ops/eigen.def b/contrib/nnc/plugin/soft_backend/code_snippets/eigen.def similarity index 100% rename from contrib/nnc/plugin/soft_backend/cpp_ops/eigen.def rename to contrib/nnc/plugin/soft_backend/code_snippets/eigen.def diff --git a/contrib/nnc/plugin/soft_backend/cpp_backend.cpp b/contrib/nnc/plugin/soft_backend/cpp_backend.cpp deleted file mode 100644 index 3b5240f..0000000 --- a/contrib/nnc/plugin/soft_backend/cpp_backend.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "soft_backend.h" -#include "cpp_generator.h" - -using namespace nncc::contrib::plugin; -using namespace nncc::contrib::backend::soft; - -namespace nncc -{ -namespace contrib -{ -namespace backend -{ -namespace soft -{ - -class CPPSoftBackend final: public BaseSoftBackend -{ -public: - CPPSoftBackend &operator=(const CPPSoftBackend &) = delete; - - CPPSoftBackend(const CPPSoftBackend &) = delete; - - void generate(nncc::contrib::core::IR::model::Graph *g) override - { - CPPCodeGenerator gen; - gen.generate(g); - } - - static CPPSoftBackend &getInstance() - { - static CPPSoftBackend instance; - return instance; - } - -private: - CPPSoftBackend() = default; -}; - -} // namespace soft -} // namespace backend -} // namespace contrib -} // namespace nncc - - -extern "C" Plugin *get_instance() -{ - return &CPPSoftBackend::getInstance(); -} diff --git a/contrib/nnc/plugin/soft_backend/cpp_generator.cpp b/contrib/nnc/plugin/soft_backend/cpp_generator.cpp index 1dbff0a..2ad887f 100644 --- a/contrib/nnc/plugin/soft_backend/cpp_generator.cpp +++ b/contrib/nnc/plugin/soft_backend/cpp_generator.cpp @@ -8,23 +8,22 @@ using namespace std; using namespace nncc::contrib; using namespace nncc::contrib::core::IR::model; -#include "cpp_header_types.h" -#include "cpp_operations.h" - #include "param_constants.def" -#include "param_constants.h" -#include "eigen.h" -#include "cpp_common_funcs.h" -#include "cpp_add_bias.h" -#include "cpp_capped_relu.h" -#include "cpp_concat.h" -#include "cpp_conv.h" -#include "cpp_depthwise_conv.h" -#include "cpp_fully_connected.h" -#include "cpp_pool.h" -#include "cpp_relu.h" -#include "cpp_softmax.h" +#include "cpp_header_types.generated.h" +#include "cpp_operations.generated.h" +#include "param_constants.generated.h" +#include "eigen.generated.h" +#include "cpp_common_funcs.generated.h" +#include "cpp_add_bias.generated.h" +#include "cpp_capped_relu.generated.h" +#include "cpp_concat.generated.h" +#include "cpp_conv.generated.h" +#include "cpp_depthwise_conv.generated.h" +#include "cpp_fully_connected.generated.h" +#include "cpp_pool.generated.h" +#include "cpp_relu.generated.h" +#include "cpp_softmax.generated.h" namespace nncc { @@ -289,3 +288,8 @@ void CPPCodeGenerator::materializeCode(ostream &out, const ModelAnalyzer &ma, co } // namespace contrib } // namespace nncc +extern "C" nncc::contrib::plugin::Plugin *get_instance() +{ + static nncc::contrib::backend::soft::CPPCodeGenerator cppCodeGenerator; + return &cppCodeGenerator; +} diff --git a/contrib/nnc/plugin/soft_backend/soft_backend.cpp b/contrib/nnc/plugin/soft_backend/soft_backend.cpp deleted file mode 100644 index 61e9288..0000000 --- a/contrib/nnc/plugin/soft_backend/soft_backend.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include -#include - -#include "soft_backend.h" -#include "support/PluginException.h" -#include "core/modelIR/graph.h" - -#include "support/Debug.h" -#define DEBUG_AREA "soft_backend" - -using namespace std; -using namespace nncc::contrib; -using namespace nncc::contrib::plugin; -using namespace nncc::contrib::core::IR::model; -using namespace nncc::contrib::backend::soft; - -namespace nncc -{ -namespace contrib -{ -namespace backend -{ -namespace soft -{ - -void *BaseSoftBackend::execute(void *data) -{ - assert(data); - Graph *graph = static_cast(data); - generate(graph); - return data; -} - -} // namespace soft -} // namespace backend -} // namespace contrib -} // namespace nncc diff --git a/contrib/nnc/plugin/soft_backend/soft_backend.h b/contrib/nnc/plugin/soft_backend/soft_backend.h deleted file mode 100644 index 08a31ea..0000000 --- a/contrib/nnc/plugin/soft_backend/soft_backend.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef _NNC_SOFT_BACKEND_PLUGIN_H_ -#define _NNC_SOFT_BACKEND_PLUGIN_H_ - -#include "support/PluginInstance.h" -#include "core/modelIR/graph.h" -#include "base_generator.h" - -#include -#include - -namespace nncc -{ -namespace contrib -{ -namespace backend -{ -namespace soft -{ - -enum class OPT_ID; - -class BaseSoftBackend : public nncc::contrib::plugin::BackendPlugin -{ -public: - BaseSoftBackend &operator=(const BaseSoftBackend &) = delete; - - BaseSoftBackend(const BaseSoftBackend &) = delete; - - void *execute(void *data) override; - -protected: - BaseSoftBackend() = default; - - ~BaseSoftBackend() override = default; - - virtual void generate(nncc::contrib::core::IR::model::Graph *g) = 0; -}; - -} // namespace soft -} // namespace backend -} // namespace contrib -} // namespace nncc - -#endif //_NNC_SOFT_BACKEND_PLUGIN_H_ diff --git a/contrib/nnc/tests/soft_backend/compile_cpp.cpp b/contrib/nnc/tests/soft_backend/compile_cpp.cpp index ddf4c72..a38f396 100644 --- a/contrib/nnc/tests/soft_backend/compile_cpp.cpp +++ b/contrib/nnc/tests/soft_backend/compile_cpp.cpp @@ -21,7 +21,7 @@ #include "cpp_generator.h" // This header generated and contains array with test_main.def contents -#include "test_main.h" +#include "test_main.generated.h" using namespace std; @@ -78,7 +78,7 @@ int main(int argc, const char *argv[]) Graph g; fillGraph(g); - nncc::contrib::backend::soft::CPPCodeGenerator().generate(&g); + nncc::contrib::backend::soft::CPPCodeGenerator().execute(&g); string basePath = outputDir + "/" + artifactName; diff --git a/contrib/nnc/unittests/soft_backend/CMakeLists.txt b/contrib/nnc/unittests/soft_backend/CMakeLists.txt index a67999c..e5415b7 100644 --- a/contrib/nnc/unittests/soft_backend/CMakeLists.txt +++ b/contrib/nnc/unittests/soft_backend/CMakeLists.txt @@ -1,5 +1,4 @@ -set(SOFT_BACKEND_CPP_SOURCES ${NNC_SOFT_BACKEND_DIR}/cpp_backend.cpp - ${NNC_SOFT_BACKEND_DIR}/cpp_generator.cpp) +set(SOFT_BACKEND_CPP_SOURCES ${NNC_SOFT_BACKEND_DIR}/cpp_generator.cpp) file(GLOB_RECURSE SOFT_DEF_SOURCES "${NNC_SOFT_BACKEND_DIR}/*.def") file(GLOB_RECURSE TESTS "*.cpp") diff --git a/contrib/nnc/unittests/soft_backend/cpp_header_types.cpp b/contrib/nnc/unittests/soft_backend/cpp_header_types.cpp index f06b968..443e720 100644 --- a/contrib/nnc/unittests/soft_backend/cpp_header_types.cpp +++ b/contrib/nnc/unittests/soft_backend/cpp_header_types.cpp @@ -4,7 +4,7 @@ #include #include -#include "cpp_header_types.def" +#include "code_snippets/cpp_header_types.def" #include "gtest/gtest.h" diff --git a/contrib/nnc/unittests/soft_backend/cpp_operations.cpp b/contrib/nnc/unittests/soft_backend/cpp_operations.cpp index 50baf69..78a604d 100644 --- a/contrib/nnc/unittests/soft_backend/cpp_operations.cpp +++ b/contrib/nnc/unittests/soft_backend/cpp_operations.cpp @@ -4,23 +4,23 @@ #include // artifact part -#include "cpp_ops/eigen.def" +#include "code_snippets/eigen.def" -#include "cpp_ops/cpp_common_funcs.def" +#include "code_snippets/cpp_common_funcs.def" -#include "cpp_ops/cpp_add_bias.def" -#include "cpp_ops/cpp_capped_relu.def" -#include "cpp_ops/cpp_concat.def" -#include "cpp_ops/cpp_conv.def" -#include "cpp_ops/cpp_depthwise_conv.def" -#include "cpp_ops/cpp_fully_connected.def" -#include "cpp_ops/cpp_pool.def" -#include "cpp_ops/cpp_relu.def" -#include "cpp_ops/cpp_softmax.def" +#include "code_snippets/cpp_add_bias.def" +#include "code_snippets/cpp_capped_relu.def" +#include "code_snippets/cpp_concat.def" +#include "code_snippets/cpp_conv.def" +#include "code_snippets/cpp_depthwise_conv.def" +#include "code_snippets/cpp_fully_connected.def" +#include "code_snippets/cpp_pool.def" +#include "code_snippets/cpp_relu.def" +#include "code_snippets/cpp_softmax.def" #include "param_constants.def" -#include "cpp_header_types.def" -#include "cpp_operations.def" +#include "code_snippets/cpp_header_types.def" +#include "code_snippets/cpp_operations.def" // soft backend part diff --git a/contrib/nnc/unittests/soft_backend/generator.cpp b/contrib/nnc/unittests/soft_backend/generator.cpp index 005c756..f983e32 100644 --- a/contrib/nnc/unittests/soft_backend/generator.cpp +++ b/contrib/nnc/unittests/soft_backend/generator.cpp @@ -85,7 +85,7 @@ TEST(Generator, check_generator_call) assert(!isFileExists(TEST_DIR) && "remove output dir"); { CPPCodeGenerator gen; - gen.generate(&g); + gen.execute(&g); } checkOutputExists(BASE_NAME); @@ -95,7 +95,7 @@ TEST(Generator, check_generator_call) deleteFile(BASE_NAME ".params"); { CPPCodeGenerator gen; - gen.generate(&g); + gen.execute(&g); } checkOutputExists(BASE_NAME); @@ -107,7 +107,7 @@ TEST(Generator, check_generator_call) assert(sBefore.st_size == 0); { CPPCodeGenerator gen; - gen.generate(&g); + gen.execute(&g); } res = stat(BASE_NAME ".h", &sAfter); assert(res == 0); diff --git a/contrib/nnc/utils/def2src.cpp b/contrib/nnc/utils/def2src.cpp index 57b64a9..a993e0d 100644 --- a/contrib/nnc/utils/def2src.cpp +++ b/contrib/nnc/utils/def2src.cpp @@ -67,7 +67,7 @@ int main(int argc, char *argv[]) { for (int i = 2; i < argc; i++) { std::string sourceFullFileName = argv[i]; std::string filename = extractFileName(sourceFullFileName); - std::string outputFileName = OutPutDir + "/" + filename + ".h"; + std::string outputFileName = OutPutDir + "/" + filename + ".generated.h"; if (fileToArray(sourceFullFileName, outputFileName, filename) != 0) return -1; -- 2.7.4