summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorСергей Баранников/AI Tools Lab /SRR/Engineer/삼성전자 <s.barannikov@samsung.com>2019-09-17 16:52:58 (GMT)
committerAlexander Efimov/AI Tools Lab/./Samsung Electronics <a.efimov@samsung.com>2019-09-17 16:52:58 (GMT)
commit6601e7963fa4a356a7982e55eed79b751598921c (patch)
tree46963993c38ef92f83596e54681d4e599a9dcc02
parent0d47a522ac5014465cb42715ef65e8ed9ff7fe03 (diff)
downloadnnfw-6601e7963fa4a356a7982e55eed79b751598921c.zip
nnfw-6601e7963fa4a356a7982e55eed79b751598921c.tar.gz
nnfw-6601e7963fa4a356a7982e55eed79b751598921c.tar.bz2
[nnc] Remove C generating backend (#7545)
Remove C generating backend skeleton. Signed-off-by: Sergei Barannikov <s.barannikov@samsung.com>
-rw-r--r--compiler/nnc/backends/soft_backend/BaseGenerator.cpp132
-rw-r--r--compiler/nnc/backends/soft_backend/CGenerator.cpp41
-rw-r--r--compiler/nnc/backends/soft_backend/CMakeLists.txt28
-rw-r--r--compiler/nnc/backends/soft_backend/CPPGenerator.cpp98
-rw-r--r--compiler/nnc/include/backends/soft_backend/BaseGenerator.h96
-rw-r--r--compiler/nnc/include/backends/soft_backend/CGenerator.h43
-rw-r--r--compiler/nnc/include/backends/soft_backend/CPPGenerator.h67
-rw-r--r--compiler/nnc/tests/soft_backend/CompileCPP.cpp2
-rw-r--r--compiler/nnc/unittests/soft_backend/CMakeLists.txt4
-rw-r--r--compiler/nnc/unittests/soft_backend/CPPHeaderTypes.cpp1
-rw-r--r--compiler/nnc/unittests/soft_backend/Generator.cpp2
11 files changed, 159 insertions, 355 deletions
diff --git a/compiler/nnc/backends/soft_backend/BaseGenerator.cpp b/compiler/nnc/backends/soft_backend/BaseGenerator.cpp
deleted file mode 100644
index 94afd69..0000000
--- a/compiler/nnc/backends/soft_backend/BaseGenerator.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "backends/soft_backend/BaseGenerator.h"
-#include "ModelAnalyzer.h"
-#include "SBSerializer.h"
-#include "option/Options.h"
-#include "CommonData.def"
-
-#include <sys/stat.h>
-
-#include <cerrno>
-#include <cstring>
-#include <fstream>
-#include <memory>
-#include <stdexcept>
-#include <fcntl.h>
-
-using namespace std;
-
-namespace nnc
-{
-
-namespace
-{
-
-/**
- * @brief Creates pointer to some output stream to encapsulate resource management into deleter
- * for example may be used to return std::cout
- * @param path Path to opened file
- * @return Pointer output stream
- * @throws PluginException if did not succeed
- */
-unique_ptr<ofstream> getStream(const string &path)
-{
- unique_ptr<ofstream> ofs(new ofstream(path));
- if (ofs->fail())
- throw std::runtime_error("Can not open code output file: " + path);
- return ofs;
-}
-
-/**
- * @brief Creates directory
- * @param path Path to desired directory
- * @throws PluginException in did not succeed
- */
-void createDir(const string &path)
-{
- int res =
- mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); // NOLINT(hicpp-signed-bitwise)
- if (res != 0 && errno != EEXIST)
- throw std::runtime_error("Failed to create output directory");
-}
-
-} // unnamed namespace
-
-BaseCodeGenerator::BaseCodeGenerator()
-{
- string base_path = cli::artifactDir + "/" + cli::artifactName;
- _headerPath = base_path + ".h";
- _codePath = base_path + ".cpp";
- _paramsPath = base_path + ".params";
-}
-
-void BaseCodeGenerator::materializeModelParams(ostream &out, const Serializer &s)
-{
- using namespace params;
-
- // First form a dump header
- char header[HEADER_LEN];
- uint32_t version = s.getFormatVersion();
- uint32_t hash = s.getModelHash();
- static_assert(VERSION_LEN == sizeof(version), "version length mismatch");
- static_assert(HASH_LEN == sizeof(hash), "hash length mismatch");
- memcpy(header, MAGIC, MAGIC_LEN);
- memcpy(header + MAGIC_LEN, &version, VERSION_LEN);
- memcpy(header + MAGIC_LEN + VERSION_LEN, &hash, HASH_LEN);
-
- out.write(header, HEADER_LEN);
- if (out.fail())
- throw std::runtime_error("Failed to write model parameters header");
- auto &params = s.getBuffer();
- out.write(params.data(), params.size());
- if (out.fail())
- throw std::runtime_error("Failed to write model Parameters");
-}
-
-void BaseCodeGenerator::run(mir::Graph *graph)
-{
- assert(graph);
-
- // visit and analyze graph
- ModelAnalyzer ma;
- ma.analyze(graph);
- // serialize parameters
- Serializer serializer;
- serializer.serialize(ma.getInferenceSequence());
- // rename tensors for specific backend language
- formatTensorNames(ma);
-
- createDir(cli::artifactDir);
-
- // Print header
- auto header_stream = getStream(_headerPath);
- materializeHeader(*header_stream, ma);
- header_stream.reset();
-
- // Print code
- auto code_stream = getStream(_codePath);
- materializeCode(*code_stream, ma, serializer);
- code_stream.reset();
-
- // Print model parameters
- auto model_stream = getStream(_paramsPath);
- materializeModelParams(*model_stream, serializer);
- model_stream.reset();
-}
-
-} // namespace nnc
diff --git a/compiler/nnc/backends/soft_backend/CGenerator.cpp b/compiler/nnc/backends/soft_backend/CGenerator.cpp
deleted file mode 100644
index 2342349..0000000
--- a/compiler/nnc/backends/soft_backend/CGenerator.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "backends/soft_backend/CGenerator.h"
-#include "ModelAnalyzer.h"
-
-using namespace std;
-
-namespace nnc
-{
-
-void CCodeGenerator::formatTensorNames(const ModelAnalyzer & /*ma*/)
-{
- // TODO format tensor names according to c backend requirements
-}
-
-void CCodeGenerator::materializeHeader(ostream & /*out*/, const ModelAnalyzer & /*ma*/)
-{
- // TODO emit C header to out stream
-}
-
-void CCodeGenerator::materializeCode(ostream & /*out*/, const ModelAnalyzer & /*ma*/,
- const Serializer & /*s*/)
-{
- // TODO emit C code to out stream
-}
-
-} // namespace nnc
diff --git a/compiler/nnc/backends/soft_backend/CMakeLists.txt b/compiler/nnc/backends/soft_backend/CMakeLists.txt
index 185f90f..c1f1fa6 100644
--- a/compiler/nnc/backends/soft_backend/CMakeLists.txt
+++ b/compiler/nnc/backends/soft_backend/CMakeLists.txt
@@ -1,29 +1,13 @@
-set(SOFT_BACKEND_COMMON_SOURCES BaseGenerator.cpp ModelAnalyzer.cpp SBSerializer.cpp SequencedIR.cpp)
-set(SOFT_BACKEND_CPP_SOURCES CPPGenerator.cpp)
-set(SOFT_BACKEND_C_SOURCES CGenerator.cpp)
+set(SOFT_BACKEND_CPP_SOURCES CPPGenerator.cpp ModelAnalyzer.cpp SBSerializer.cpp SequencedIR.cpp)
file(GLOB_RECURSE SOFT_DEF_SOURCES "*.def")
nnc_make_generated_sources("${SOFT_DEF_SOURCES}" ${CMAKE_CURRENT_BINARY_DIR} SOFT_GENERATED_SOURCES)
-add_library(soft_backend_common STATIC ${SOFT_BACKEND_COMMON_SOURCES})
-set_property(TARGET soft_backend_common PROPERTY POSITION_INDEPENDENT_CODE ON)
-target_include_directories(soft_backend_common PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
-target_link_libraries(soft_backend_common PRIVATE nnc_support)
-target_link_libraries(soft_backend_common PRIVATE mir)
+nnc_add_library(soft_backend_cpp SHARED ${SOFT_BACKEND_CPP_SOURCES} ${SOFT_GENERATED_SOURCES})
+target_include_directories(soft_backend_cpp PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
-function(make_soft_backend NAME)
- nnc_add_library(${NAME} SHARED ${ARGN} ${SOFT_GENERATED_SOURCES})
- target_include_directories(${NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
-
- target_link_libraries(${NAME} PUBLIC soft_backend_common)
- target_link_libraries(${NAME} PRIVATE nnc_support)
- target_link_libraries(${NAME} PRIVATE mir)
-
- # install soft backend c++ library
- nnc_install_library(${NAME})
-endfunction(make_soft_backend)
-
-make_soft_backend(soft_backend_cpp ${SOFT_BACKEND_CPP_SOURCES})
-make_soft_backend(soft_backend_c ${SOFT_BACKEND_C_SOURCES})
+target_link_libraries(soft_backend_cpp PRIVATE nnc_support mir)
+# install soft backend c++ library
+nnc_install_library(soft_backend_cpp)
diff --git a/compiler/nnc/backends/soft_backend/CPPGenerator.cpp b/compiler/nnc/backends/soft_backend/CPPGenerator.cpp
index ce7057e..f2188c3 100644
--- a/compiler/nnc/backends/soft_backend/CPPGenerator.cpp
+++ b/compiler/nnc/backends/soft_backend/CPPGenerator.cpp
@@ -21,8 +21,6 @@
#include "SBSerializer.h"
#include "option/Options.h"
-using namespace std;
-
#include "CommonData.def"
#include "cpp_header_types.generated.h"
@@ -52,12 +50,104 @@ using namespace std;
#include "cpp_transpose.generated.h"
#include "cpp_gather.generated.h"
+#include <cerrno>
+#include <cstring>
+#include <fstream>
+#include <stdexcept>
+#include <sys/stat.h>
+
namespace nnc
{
using namespace sir;
+using namespace std;
+
+/**
+ * @brief Creates pointer to some output stream to encapsulate resource management into deleter
+ * for example may be used to return std::cout
+ * @param path Path to opened file
+ * @return Pointer output stream
+ * @throws runtime_error if did not succeed
+ */
+static unique_ptr<ofstream> getStream(const string &path)
+{
+ unique_ptr<ofstream> ofs(new ofstream(path));
+ if (ofs->fail())
+ throw runtime_error("Can not open code output file: " + path);
+ return ofs;
+}
+
+/**
+ * @brief Creates directory
+ * @param path Path to desired directory
+ * @throws runtime_error in did not succeed
+ */
+static void createDir(const string &path)
+{
+ int res =
+ mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); // NOLINT(hicpp-signed-bitwise)
+ if (res != 0 && errno != EEXIST)
+ throw runtime_error("Failed to create output directory");
+}
+
+void CPPCodeGenerator::materializeModelParams(ostream &out, const Serializer &s)
+{
+ using namespace params;
+
+ // First form a dump header
+ char header[HEADER_LEN];
+ uint32_t version = s.getFormatVersion();
+ uint32_t hash = s.getModelHash();
+ static_assert(VERSION_LEN == sizeof(version), "version length mismatch");
+ static_assert(HASH_LEN == sizeof(hash), "hash length mismatch");
+ memcpy(header, MAGIC, MAGIC_LEN);
+ memcpy(header + MAGIC_LEN, &version, VERSION_LEN);
+ memcpy(header + MAGIC_LEN + VERSION_LEN, &hash, HASH_LEN);
+
+ out.write(header, HEADER_LEN);
+ if (out.fail())
+ throw runtime_error("Failed to write model parameters header");
+ auto &params = s.getBuffer();
+ out.write(params.data(), params.size());
+ if (out.fail())
+ throw runtime_error("Failed to write model Parameters");
+}
-using TensorType = TensorDescriptor::Type;
+void CPPCodeGenerator::run(mir::Graph *graph)
+{
+ assert(graph);
+
+ // visit and analyze graph
+ ModelAnalyzer ma;
+ ma.analyze(graph);
+ // serialize parameters
+ Serializer serializer;
+ serializer.serialize(ma.getInferenceSequence());
+ // rename tensors for specific backend language
+ formatTensorNames(ma);
+
+ createDir(cli::artifactDir);
+
+ const string base_path = cli::artifactDir + "/" + cli::artifactName;
+ const string header_path = base_path + ".h";
+ const string code_path = base_path + ".cpp";
+ const string params_path = base_path + ".params";
+
+ // Print header
+ auto header_stream = getStream(header_path);
+ materializeHeader(*header_stream, ma);
+ header_stream.reset();
+
+ // Print code
+ auto code_stream = getStream(code_path);
+ materializeCode(*code_stream, ma, serializer);
+ code_stream.reset();
+
+ // Print model parameters
+ auto model_stream = getStream(params_path);
+ materializeModelParams(*model_stream, serializer);
+ model_stream.reset();
+}
/**
* @brief Renames tensors with respect to C++ naming conventions
@@ -65,6 +155,8 @@ using TensorType = TensorDescriptor::Type;
*/
void CPPCodeGenerator::formatTensorNames(const ModelAnalyzer &ma)
{
+ using TensorType = TensorDescriptor::Type;
+
int tmp_tensors = 0;
for (const TensorDescriptor &td : ma.getTensors())
{
diff --git a/compiler/nnc/include/backends/soft_backend/BaseGenerator.h b/compiler/nnc/include/backends/soft_backend/BaseGenerator.h
deleted file mode 100644
index 9aaa723..0000000
--- a/compiler/nnc/include/backends/soft_backend/BaseGenerator.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _NNC_SOFT_BACKEND_BASE_GENERATOR_H_
-#define _NNC_SOFT_BACKEND_BASE_GENERATOR_H_
-
-#include "mir/Graph.h"
-
-#include <string>
-#include <ostream>
-
-namespace nnc
-{
-
-class ModelAnalyzer;
-
-class Serializer;
-
-/**
- * @brief BaseCodeGenerator class provides interface for artifact
- * generation and contains common functionality for all soft backends
- *
- * Derivatives should override:
- * + constructor to set proper filenames for artifact parts
- * + code file generation function: materuializeCode
- * + header file generation to expose artifact inerface to user
- */
-class BaseCodeGenerator
-{
-public:
- virtual ~BaseCodeGenerator() = default;
-
- /**
- * @brief Method represents base generation sequence: analysis, serialization, header/code
- * generation, etc
- * @param graph MIR graph
- */
- void run(mir::Graph *graph);
-
-protected:
- /**
- * @brief This function processes tensor names
- * to transform them into valid identificators of target language
- * @param ma Intermediate artifact information
- */
- virtual void formatTensorNames(const ModelAnalyzer &ma) = 0;
- /**
- * @brief Derivative classes should override this function to generate header of artifact
- * @param out Stream to write header text
- * @param ma Intermediate artifact information
- */
- virtual void materializeHeader(std::ostream &out, const ModelAnalyzer &ma) = 0;
- /**
- * @brief Derivative classes should override this function to generate implementation of artifact
- * @param out Stream to write header text
- * @param ma Intermediate artifact information
- * @param s Serializer holds parameters of network and various meta-information: serializer
- * version, hashes, etc
- */
- virtual void materializeCode(std::ostream &out, const ModelAnalyzer &ma, const Serializer &s) = 0;
- /**
- * @brief Writes serialized parameters to out stream
- * @param out Stream to write serialized parameters
- * @param s Serializer holds parameters of network
- *
- * Contents of generated file:
- * + header(magic number to identify file type, protocol version, hashes of network and params)
- * + array of serialized network parameters
- */
- void materializeModelParams(std::ostream &out, const Serializer &s);
-
- BaseCodeGenerator();
-
- std::vector<std::string> _formattedTensors;
-
- std::string _headerPath;
- std::string _codePath;
- std::string _paramsPath;
-};
-
-} // namespace nnc
-
-#endif //_NNC_SOFT_BACKEND_BASE_GENERATOR_H_
diff --git a/compiler/nnc/include/backends/soft_backend/CGenerator.h b/compiler/nnc/include/backends/soft_backend/CGenerator.h
deleted file mode 100644
index eeb160b..0000000
--- a/compiler/nnc/include/backends/soft_backend/CGenerator.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _NNC_SOFT_BACKEND_C_GENERATOR_H_
-#define _NNC_SOFT_BACKEND_C_GENERATOR_H_
-
-#include "BaseGenerator.h"
-
-namespace nnc
-{
-
-/**
- * @brief CCodeGenerator implements interfaces that provides BaseCodeGenerator for C language
- * This includes header file generation, code file generation and variable renaming according to C
- * naming requirements
- */
-class CCodeGenerator final : public BaseCodeGenerator
-{
-protected:
- void formatTensorNames(const ModelAnalyzer &ma) override;
- void materializeHeader(std::ostream &out, const ModelAnalyzer &ma) override;
- void materializeCode(std::ostream &out, const ModelAnalyzer &ma, const Serializer &s) override;
-
-private:
- CCodeGenerator() = default;
-};
-
-} // namespace nnc
-
-#endif //_NNC_SOFT_BACKEND_C_GENERATOR_H_
diff --git a/compiler/nnc/include/backends/soft_backend/CPPGenerator.h b/compiler/nnc/include/backends/soft_backend/CPPGenerator.h
index 666a670..8bb707c 100644
--- a/compiler/nnc/include/backends/soft_backend/CPPGenerator.h
+++ b/compiler/nnc/include/backends/soft_backend/CPPGenerator.h
@@ -17,11 +17,18 @@
#ifndef _NNC_SOFT_BACKEND_CPP_GENERATOR_H_
#define _NNC_SOFT_BACKEND_CPP_GENERATOR_H_
-#include "BaseGenerator.h"
+#include "mir/Graph.h"
+
+#include <ostream>
+#include <string>
+#include <vector>
namespace nnc
{
+class ModelAnalyzer;
+class Serializer;
+
namespace sir
{
struct TensorDescriptor;
@@ -37,11 +44,29 @@ struct DestroyTmp;
* This includes header file generation, code file generation and variable renaming according to C++
* naming requirements
*/
-class CPPCodeGenerator final : public BaseCodeGenerator
+class CPPCodeGenerator final
{
-protected:
- void formatTensorNames(const ModelAnalyzer &ma) override;
- void materializeHeader(std::ostream &out, const ModelAnalyzer &ma) override;
+public:
+ /**
+ * @brief Method represents base generation sequence: analysis, serialization, header/code
+ * generation, etc
+ * @param graph MIR graph
+ */
+ void run(mir::Graph *graph);
+
+private:
+ /**
+ * @brief This function processes tensor names
+ * to transform them into valid identificators of target language
+ * @param ma Intermediate artifact information
+ */
+ void formatTensorNames(const ModelAnalyzer &ma);
+ /**
+ * @brief Derivative classes should override this function to generate header of artifact
+ * @param out Stream to write header text
+ * @param ma Intermediate artifact information
+ */
+ void materializeHeader(std::ostream &out, const ModelAnalyzer &ma);
/**
* @brief Form list of function call arguments
@@ -49,7 +74,7 @@ protected:
* @param argIds List of argument variable ids
* @param args Result list of arguments transformed in form of strings
*/
- void gatherOperationArguments(const ModelAnalyzer &ma, const std::vector<size_t> &arg_ids,
+ void gatherOperationArguments(const ModelAnalyzer &ma, const std::vector<std::size_t> &arg_ids,
std::vector<std::string> &args);
/**
* @brief Prints setter of artifact
@@ -75,8 +100,7 @@ protected:
* @param ma Intermediate model representation
* @param call Action to generate code from
*/
- void materializeCall(std::ostream &out, const ModelAnalyzer &ma,
- const nnc::sir::CallFunction *call);
+ void materializeCall(std::ostream &out, const ModelAnalyzer &ma, const sir::CallFunction *call);
/**
* @brief Generate code for transpose action
* @param out Output stream to print
@@ -84,7 +108,7 @@ protected:
* @param action Action to generate code from
*/
void materializeTranspose(std::ostream &out, const ModelAnalyzer &ma,
- const nnc::sir::TransposeTensor *transpose);
+ const sir::TransposeTensor *transpose);
/**
* @brief Generate code for constructor action
* @param out Output stream to print
@@ -92,7 +116,7 @@ protected:
* @param action Action to generate code from
*/
void materializeConstructor(std::ostream &out, const ModelAnalyzer &ma,
- const nnc::sir::CreateTmp *constructor);
+ const sir::CreateTmp *constructor);
/**
* @brief Generate code for destructor action
* @param out Output stream to print
@@ -100,14 +124,33 @@ protected:
* @param action Action to generate code from
*/
void materializeDestructor(std::ostream &out, const ModelAnalyzer &ma,
- const nnc::sir::DestroyTmp *destructor);
+ const sir::DestroyTmp *destructor);
/**
* @brief Prints inference sequence placed in doInference method of artifact
* @param out Output stream
* @param ma Intermediate model representation
*/
void materializeInferenceSequence(std::ostream &out, const ModelAnalyzer &ma);
- void materializeCode(std::ostream &out, const ModelAnalyzer &ma, const Serializer &s) override;
+ /**
+ * @brief Derivative classes should override this function to generate implementation of artifact
+ * @param out Stream to write header text
+ * @param ma Intermediate artifact information
+ * @param s Serializer holds parameters of network and various meta-information: serializer
+ * version, hashes, etc
+ */
+ void materializeCode(std::ostream &out, const ModelAnalyzer &ma, const Serializer &s);
+ /**
+ * @brief Writes serialized parameters to out stream
+ * @param out Stream to write serialized parameters
+ * @param s Serializer holds parameters of network
+ *
+ * Contents of generated file:
+ * + header(magic number to identify file type, protocol version, hashes of network and params)
+ * + array of serialized network parameters
+ */
+ void materializeModelParams(std::ostream &out, const Serializer &s);
+
+ std::vector<std::string> _formattedTensors;
};
} // namespace nnc
diff --git a/compiler/nnc/tests/soft_backend/CompileCPP.cpp b/compiler/nnc/tests/soft_backend/CompileCPP.cpp
index 08c00c8..ec3c148 100644
--- a/compiler/nnc/tests/soft_backend/CompileCPP.cpp
+++ b/compiler/nnc/tests/soft_backend/CompileCPP.cpp
@@ -34,7 +34,7 @@
#include <fstream>
#include <string>
-#include <stdlib.h>
+#include <cstdlib>
// This header generated and contains array with test_main.def contents
#include "test_main.generated.h"
diff --git a/compiler/nnc/unittests/soft_backend/CMakeLists.txt b/compiler/nnc/unittests/soft_backend/CMakeLists.txt
index 33f97ff..e51d503 100644
--- a/compiler/nnc/unittests/soft_backend/CMakeLists.txt
+++ b/compiler/nnc/unittests/soft_backend/CMakeLists.txt
@@ -7,10 +7,10 @@ set(CPU_CPP_BACKEND_MA_SOURCES ModelAnalyzer.cpp)
set(CPU_CPP_BACKEND_HT_SOURCES CPPHeaderTypes.cpp)
nnc_add_unit_test(nnc_cpu_cpp_backend_ops_test ${CPU_CPP_BACKEND_OP_SOURCES} ${CPU_BACKEND_CPP_OP_SOURCES} ${OPTIONS_SRC} ${SOFT_DEF_SOURCES})
-optional_target_link_libraries(nnc_cpu_cpp_backend_ops_test nnc_support nnc_interpreter mir soft_backend_common)
+optional_target_link_libraries(nnc_cpu_cpp_backend_ops_test nnc_support nnc_interpreter mir soft_backend_cpp)
target_include_directories(nnc_cpu_cpp_backend_ops_test PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${NNC_SOFT_BACKEND_DIR})
nnc_add_unit_test(nnc_cpu_cpp_backend_general_test ${CPU_CPP_BACKEND_GN_SOURCES} ${CPU_CPP_BACKEND_HT_SOURCES}
${CPU_CPP_BACKEND_MA_SOURCES} ${OPTIONS_SRC} ${SOFT_DEF_SOURCES})
-optional_target_link_libraries(nnc_cpu_cpp_backend_general_test nnc_support mir soft_backend_common)
+optional_target_link_libraries(nnc_cpu_cpp_backend_general_test nnc_support mir soft_backend_cpp)
target_include_directories(nnc_cpu_cpp_backend_general_test PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${NNC_SOFT_BACKEND_DIR})
diff --git a/compiler/nnc/unittests/soft_backend/CPPHeaderTypes.cpp b/compiler/nnc/unittests/soft_backend/CPPHeaderTypes.cpp
index 5175966..3b07151 100644
--- a/compiler/nnc/unittests/soft_backend/CPPHeaderTypes.cpp
+++ b/compiler/nnc/unittests/soft_backend/CPPHeaderTypes.cpp
@@ -15,7 +15,6 @@
*/
#include <cstddef>
-#include <cassert>
#include <initializer_list>
#include <functional>
#include <numeric>
diff --git a/compiler/nnc/unittests/soft_backend/Generator.cpp b/compiler/nnc/unittests/soft_backend/Generator.cpp
index 4522bda..b96df88 100644
--- a/compiler/nnc/unittests/soft_backend/Generator.cpp
+++ b/compiler/nnc/unittests/soft_backend/Generator.cpp
@@ -20,9 +20,7 @@
#include <gtest/gtest.h>
#include <fstream>
-#include <sys/types.h>
#include <sys/stat.h>
-#include <fcntl.h>
#include <unistd.h>
#include <cstdio>
#include <ftw.h>