Disable v10 serealizer (#3184)

* Disable v10 serealizer

* Fixed comments
This commit is contained in:
Ilya Churaev 2020-11-19 11:34:59 +03:00 committed by GitHub
parent 9ec18eeb9b
commit 5abbe2fec5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 60 additions and 10 deletions

View File

@ -98,6 +98,8 @@ ie_option (ENABLE_PYTHON "enables ie python bridge build" OFF)
ie_option (ENABLE_V7_SERIALIZE "enables serialization to IR v7" OFF) ie_option (ENABLE_V7_SERIALIZE "enables serialization to IR v7" OFF)
ie_option (ENABLE_V10_SERIALIZE "enables experimental serialization to IR v10" OFF)
ie_option (ENABLE_JAVA "enables ie java bridge build" OFF) ie_option (ENABLE_JAVA "enables ie java bridge build" OFF)
ie_dependent_option(ENABLE_CPPLINT "Enable cpplint checks during the build" ON "UNIX;NOT ANDROID" OFF) ie_dependent_option(ENABLE_CPPLINT "Enable cpplint checks during the build" ON "UNIX;NOT ANDROID" OFF)

View File

@ -74,6 +74,11 @@ file (GLOB_RECURSE PUBLIC_HEADERS
source_group("src" FILES ${LIBRARY_SRC}) source_group("src" FILES ${LIBRARY_SRC})
source_group("include" FILES ${LIBRARY_HEADERS} ${PUBLIC_HEADERS}) source_group("include" FILES ${LIBRARY_HEADERS} ${PUBLIC_HEADERS})
if(ENABLE_V10_SERIALIZE)
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/cnn_network_ngraph_impl.cpp"
PROPERTIES COMPILE_DEFINITIONS ENABLE_V10_SERIALIZE)
endif()
# Plugin API library # Plugin API library
add_library(${TARGET_NAME}_plugin_api INTERFACE) add_library(${TARGET_NAME}_plugin_api INTERFACE)

View File

@ -407,16 +407,28 @@ StatusCode CNNNetworkNGraphImpl::serialize(const std::string& xmlPath,
const std::string& binPath, const std::string& binPath,
ResponseDesc* resp) const noexcept { ResponseDesc* resp) const noexcept {
try { try {
std::map<std::string, ngraph::OpSet> custom_opsets; bool isExecutionGraph = true;
for (auto extension : _ie_extensions) { #if !defined(ENABLE_V10_SERIALIZE)
auto opset = extension->getOpSets(); for (const auto & op : _ngraph_function->get_ops()) {
custom_opsets.insert(begin(opset), end(opset)); auto & rtInfo = op->get_rt_info();
if (rtInfo.find(ExecGraphInfoSerialization::PERF_COUNTER) == rtInfo.end()) {
isExecutionGraph = false;
break;
}
}
#endif
if (isExecutionGraph) {
std::map<std::string, ngraph::OpSet> custom_opsets;
for (const auto& extension : _ie_extensions) {
auto opset = extension->getOpSets();
custom_opsets.insert(begin(opset), end(opset));
}
ngraph::pass::Manager manager;
manager.register_pass<ngraph::pass::Serialize>(xmlPath, binPath, ngraph::pass::Serialize::Version::IR_V10,
custom_opsets);
manager.run_passes(_ngraph_function);
return OK;
} }
ngraph::pass::Manager manager;
manager.register_pass<ngraph::pass::Serialize>(
xmlPath, binPath, ngraph::pass::Serialize::Version::IR_V10,
custom_opsets);
manager.run_passes(_ngraph_function);
} catch (const InferenceEngineException& e) { } catch (const InferenceEngineException& e) {
return DescriptionBuffer(GENERAL_ERROR, resp) << e.what(); return DescriptionBuffer(GENERAL_ERROR, resp) << e.what();
} catch (const std::exception& e) { } catch (const std::exception& e) {
@ -424,7 +436,7 @@ StatusCode CNNNetworkNGraphImpl::serialize(const std::string& xmlPath,
} catch (...) { } catch (...) {
return DescriptionBuffer(UNEXPECTED, resp); return DescriptionBuffer(UNEXPECTED, resp);
} }
return OK; return DescriptionBuffer(NOT_IMPLEMENTED, resp) << "The serialize for IR v10 is not implemented";
} }
StatusCode CNNNetworkNGraphImpl::setBatchSize(size_t size, ResponseDesc* responseDesc) noexcept { StatusCode CNNNetworkNGraphImpl::setBatchSize(size_t size, ResponseDesc* responseDesc) noexcept {

View File

@ -44,6 +44,11 @@ addIeTargetTest(
IE IE
) )
if(ENABLE_V10_SERIALIZE)
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/skip_tests_config.cpp"
PROPERTIES COMPILE_DEFINITIONS ENABLE_V10_SERIALIZE)
endif()
ie_faster_build(${TARGET_NAME} ie_faster_build(${TARGET_NAME}
PCH PRIVATE "precomp.hpp" PCH PRIVATE "precomp.hpp"
) )

View File

@ -11,6 +11,7 @@
#include "ie_core.hpp" #include "ie_core.hpp"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "transformations/serialize.hpp" #include "transformations/serialize.hpp"
#include <functional_test_utils/skip_tests_config.hpp>
#ifndef IR_SERIALIZATION_MODELS_PATH // should be already defined by cmake #ifndef IR_SERIALIZATION_MODELS_PATH // should be already defined by cmake
#define IR_SERIALIZATION_MODELS_PATH "" #define IR_SERIALIZATION_MODELS_PATH ""
@ -39,6 +40,7 @@ protected:
}; };
TEST_F(CustomOpsSerializationTest, CustomOpUser_MO) { TEST_F(CustomOpsSerializationTest, CustomOpUser_MO) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
const std::string model = IR_SERIALIZATION_MODELS_PATH "custom_op.xml"; const std::string model = IR_SERIALIZATION_MODELS_PATH "custom_op.xml";
InferenceEngine::Core ie; InferenceEngine::Core ie;
@ -59,6 +61,7 @@ TEST_F(CustomOpsSerializationTest, CustomOpUser_MO) {
} }
TEST_F(CustomOpsSerializationTest, CustomOpUser_ONNXImporter) { TEST_F(CustomOpsSerializationTest, CustomOpUser_ONNXImporter) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
const std::string model = IR_SERIALIZATION_MODELS_PATH "custom_op.prototxt"; const std::string model = IR_SERIALIZATION_MODELS_PATH "custom_op.prototxt";
InferenceEngine::Core ie; InferenceEngine::Core ie;
@ -79,6 +82,7 @@ TEST_F(CustomOpsSerializationTest, CustomOpUser_ONNXImporter) {
} }
TEST_F(CustomOpsSerializationTest, CustomOpTransformation) { TEST_F(CustomOpsSerializationTest, CustomOpTransformation) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
const std::string model = IR_SERIALIZATION_MODELS_PATH "custom_op.xml"; const std::string model = IR_SERIALIZATION_MODELS_PATH "custom_op.xml";
InferenceEngine::Core ie; InferenceEngine::Core ie;

View File

@ -5,6 +5,7 @@
#include <fstream> #include <fstream>
#include "common_test_utils/ngraph_test_utils.hpp" #include "common_test_utils/ngraph_test_utils.hpp"
#include <functional_test_utils/skip_tests_config.hpp>
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ie_core.hpp" #include "ie_core.hpp"
@ -47,6 +48,7 @@ protected:
}; };
TEST_F(SerializationDeterministicityTest, BasicModel) { TEST_F(SerializationDeterministicityTest, BasicModel) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
const std::string model = IR_SERIALIZATION_MODELS_PATH "add_abc.prototxt"; const std::string model = IR_SERIALIZATION_MODELS_PATH "add_abc.prototxt";
InferenceEngine::Core ie; InferenceEngine::Core ie;
@ -64,6 +66,7 @@ TEST_F(SerializationDeterministicityTest, BasicModel) {
} }
TEST_F(SerializationDeterministicityTest, ModelWithMultipleOutputs) { TEST_F(SerializationDeterministicityTest, ModelWithMultipleOutputs) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
const std::string model = const std::string model =
IR_SERIALIZATION_MODELS_PATH "split_equal_parts_2d.xml"; IR_SERIALIZATION_MODELS_PATH "split_equal_parts_2d.xml";
const std::string weights = const std::string weights =
@ -84,6 +87,7 @@ TEST_F(SerializationDeterministicityTest, ModelWithMultipleOutputs) {
} }
TEST_F(SerializationDeterministicityTest, ModelWithMultipleLayers) { TEST_F(SerializationDeterministicityTest, ModelWithMultipleLayers) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
const std::string model = const std::string model =
IR_SERIALIZATION_MODELS_PATH "addmul_abc.prototxt"; IR_SERIALIZATION_MODELS_PATH "addmul_abc.prototxt";
@ -102,6 +106,7 @@ TEST_F(SerializationDeterministicityTest, ModelWithMultipleLayers) {
} }
TEST_F(SerializationDeterministicityTest, ModelWithConstants) { TEST_F(SerializationDeterministicityTest, ModelWithConstants) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
const std::string model = const std::string model =
IR_SERIALIZATION_MODELS_PATH "add_abc_initializers.xml"; IR_SERIALIZATION_MODELS_PATH "add_abc_initializers.xml";
const std::string weights = const std::string weights =

View File

@ -5,6 +5,7 @@
#include <fstream> #include <fstream>
#include "common_test_utils/ngraph_test_utils.hpp" #include "common_test_utils/ngraph_test_utils.hpp"
#include <functional_test_utils/skip_tests_config.hpp>
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ie_core.hpp" #include "ie_core.hpp"
@ -26,6 +27,7 @@ protected:
}; };
TEST_F(SerializationTest, BasicModel_MO) { TEST_F(SerializationTest, BasicModel_MO) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
const std::string model = IR_SERIALIZATION_MODELS_PATH "add_abc.xml"; const std::string model = IR_SERIALIZATION_MODELS_PATH "add_abc.xml";
const std::string weights = IR_SERIALIZATION_MODELS_PATH "add_abc.bin"; const std::string weights = IR_SERIALIZATION_MODELS_PATH "add_abc.bin";
@ -43,6 +45,7 @@ TEST_F(SerializationTest, BasicModel_MO) {
} }
TEST_F(SerializationTest, BasicModel_ONNXImporter) { TEST_F(SerializationTest, BasicModel_ONNXImporter) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
const std::string model = IR_SERIALIZATION_MODELS_PATH "add_abc.prototxt"; const std::string model = IR_SERIALIZATION_MODELS_PATH "add_abc.prototxt";
InferenceEngine::Core ie; InferenceEngine::Core ie;
@ -59,6 +62,7 @@ TEST_F(SerializationTest, BasicModel_ONNXImporter) {
} }
TEST_F(SerializationTest, ModelWithMultipleOutputs_MO) { TEST_F(SerializationTest, ModelWithMultipleOutputs_MO) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
const std::string model = const std::string model =
IR_SERIALIZATION_MODELS_PATH "split_equal_parts_2d.xml"; IR_SERIALIZATION_MODELS_PATH "split_equal_parts_2d.xml";
const std::string weights = const std::string weights =
@ -79,6 +83,7 @@ TEST_F(SerializationTest, ModelWithMultipleOutputs_MO) {
} }
TEST_F(SerializationTest, ModelWithMultipleOutputs_ONNXImporter) { TEST_F(SerializationTest, ModelWithMultipleOutputs_ONNXImporter) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
const std::string model = const std::string model =
IR_SERIALIZATION_MODELS_PATH "split_equal_parts_2d.prototxt"; IR_SERIALIZATION_MODELS_PATH "split_equal_parts_2d.prototxt";
@ -97,6 +102,7 @@ TEST_F(SerializationTest, ModelWithMultipleOutputs_ONNXImporter) {
} }
TEST_F(SerializationTest, ModelWithMultipleLayers_MO) { TEST_F(SerializationTest, ModelWithMultipleLayers_MO) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
const std::string model = IR_SERIALIZATION_MODELS_PATH "addmul_abc.xml"; const std::string model = IR_SERIALIZATION_MODELS_PATH "addmul_abc.xml";
const std::string weights = IR_SERIALIZATION_MODELS_PATH "addmul_abc.bin"; const std::string weights = IR_SERIALIZATION_MODELS_PATH "addmul_abc.bin";
@ -114,6 +120,7 @@ TEST_F(SerializationTest, ModelWithMultipleLayers_MO) {
} }
TEST_F(SerializationTest, ModelWithMultipleLayers_ONNXImporter) { TEST_F(SerializationTest, ModelWithMultipleLayers_ONNXImporter) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
const std::string model = const std::string model =
IR_SERIALIZATION_MODELS_PATH "addmul_abc.prototxt"; IR_SERIALIZATION_MODELS_PATH "addmul_abc.prototxt";
@ -131,6 +138,7 @@ TEST_F(SerializationTest, ModelWithMultipleLayers_ONNXImporter) {
} }
TEST_F(SerializationTest, ModelWithConstants_MO) { TEST_F(SerializationTest, ModelWithConstants_MO) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
const std::string model = const std::string model =
IR_SERIALIZATION_MODELS_PATH "add_abc_initializers.xml"; IR_SERIALIZATION_MODELS_PATH "add_abc_initializers.xml";
const std::string weights = const std::string weights =
@ -150,6 +158,7 @@ TEST_F(SerializationTest, ModelWithConstants_MO) {
} }
TEST_F(SerializationTest, ModelWithConstants_ONNXImporter) { TEST_F(SerializationTest, ModelWithConstants_ONNXImporter) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
const std::string model = const std::string model =
IR_SERIALIZATION_MODELS_PATH "add_abc_initializers.prototxt"; IR_SERIALIZATION_MODELS_PATH "add_abc_initializers.prototxt";
@ -167,6 +176,7 @@ TEST_F(SerializationTest, ModelWithConstants_ONNXImporter) {
} }
TEST_F(SerializationTest, ExperimentalDetectronROIFeatureExtractor_MO) { TEST_F(SerializationTest, ExperimentalDetectronROIFeatureExtractor_MO) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
const std::string model = IR_SERIALIZATION_MODELS_PATH const std::string model = IR_SERIALIZATION_MODELS_PATH
"experimental_detectron_roi_feature_extractor.xml"; "experimental_detectron_roi_feature_extractor.xml";
@ -184,6 +194,7 @@ TEST_F(SerializationTest, ExperimentalDetectronROIFeatureExtractor_MO) {
} }
TEST_F(SerializationTest, ExperimentalDetectronDetectionOutput_MO) { TEST_F(SerializationTest, ExperimentalDetectronDetectionOutput_MO) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
const std::string model = IR_SERIALIZATION_MODELS_PATH const std::string model = IR_SERIALIZATION_MODELS_PATH
"experimental_detectron_detection_output.xml"; "experimental_detectron_detection_output.xml";

View File

@ -14,5 +14,11 @@ std::vector<std::string> disabledTestPatterns() {
".*TransformationTests\\.ConstFoldingPriorBoxClustered.*", ".*TransformationTests\\.ConstFoldingPriorBoxClustered.*",
// TODO: task 32568, enable after supporting constants outputs in plugins // TODO: task 32568, enable after supporting constants outputs in plugins
".*TransformationTests\\.ConstFoldingPriorBox.*", ".*TransformationTests\\.ConstFoldingPriorBox.*",
#if !defined(ENABLE_V10_SERIALIZE)
// Disable tests for serialization
".*SerializationTest.*",
".*CustomOpsSerializationTest.*",
".*SerializationDeterministicityTest.*",
#endif
}; };
} }