From f832453d9da36ee85951b9d38e3e760e77942c70 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Fri, 7 Aug 2020 12:06:47 +0300 Subject: [PATCH] Added compilation of Plugin API headers with strict flags (#1654) * Minimized ngraph headers inclusion * Added compilation of plugin api headers with strict flags * Fixed -WPedantic issue in ngraph headers * Fixed compilation * Trying to fix Windows * Fixed GNA unit tests compilation * Disabled WX test on Windows --- .../src/cldnn_engine/cldnn_infer_request.cpp | 1 - .../src/gna_plugin/connection_details.hpp | 2 +- .../src/gna_plugin/gna_graph_compiler.hpp | 1 + .../src/gna_plugin/layers/gna_concat_layer.hpp | 2 +- .../src/gna_plugin/layers/gna_crop_layer.hpp | 2 +- .../src/gna_plugin/layers/gna_layer_info.hpp | 2 +- .../src/gna_plugin/layers/gna_memory_layer.hpp | 2 +- .../src/gna_plugin/layers/gna_split_layer.hpp | 1 + .../src/inference_engine/network_serializer.cpp | 1 + .../src/mkldnn_plugin/bf16transformer.h | 2 +- .../src/mkldnn_plugin/mkldnn_infer_request.cpp | 1 - .../interface/ie_iplugin_internal.hpp | 3 - .../src/plugin_api/cpp_interfaces/plugin_itt.hpp | 2 +- .../src/plugin_api/exec_graph_info.hpp | 1 - inference-engine/src/plugin_api/generic_ie.hpp | 6 +- .../functional/inference_engine/CMakeLists.txt | 111 +++++++++++++++------ .../unit/engines/gna/I8_quantisation_test.cpp | 1 + .../unit/engines/gna/gna_matcher.cpp | 1 + ngraph/src/ngraph/node.hpp | 6 +- 19 files changed, 99 insertions(+), 49 deletions(-) diff --git a/inference-engine/src/cldnn_engine/cldnn_infer_request.cpp b/inference-engine/src/cldnn_engine/cldnn_infer_request.cpp index 744adee..bf591b6 100644 --- a/inference-engine/src/cldnn_engine/cldnn_infer_request.cpp +++ b/inference-engine/src/cldnn_engine/cldnn_infer_request.cpp @@ -10,7 +10,6 @@ #include #include "cldnn_infer_request.h" #include "cldnn_remote_context.h" -#include "inference_engine.hpp" #include "cldnn_executable_network.h" #include "cldnn_itt.h" diff --git a/inference-engine/src/gna_plugin/connection_details.hpp b/inference-engine/src/gna_plugin/connection_details.hpp index 1c308d5..71bdf9d 100644 --- a/inference-engine/src/gna_plugin/connection_details.hpp +++ b/inference-engine/src/gna_plugin/connection_details.hpp @@ -4,7 +4,7 @@ #pragma once -#include "inference_engine.hpp" +#include "ie_layers.h" namespace GNAPluginNS { struct ConnectionDetails { diff --git a/inference-engine/src/gna_plugin/gna_graph_compiler.hpp b/inference-engine/src/gna_plugin/gna_graph_compiler.hpp index ccaf60a..47a24cd 100644 --- a/inference-engine/src/gna_plugin/gna_graph_compiler.hpp +++ b/inference-engine/src/gna_plugin/gna_graph_compiler.hpp @@ -11,6 +11,7 @@ #include #include +#include "ie_layers.h" #include "descriptions/gna_input_desc.hpp" #include "descriptions/gna_flags.hpp" #include "cpp_interfaces/base/ie_plugin_base.hpp" diff --git a/inference-engine/src/gna_plugin/layers/gna_concat_layer.hpp b/inference-engine/src/gna_plugin/layers/gna_concat_layer.hpp index 2731314..4c64611 100644 --- a/inference-engine/src/gna_plugin/layers/gna_concat_layer.hpp +++ b/inference-engine/src/gna_plugin/layers/gna_concat_layer.hpp @@ -7,7 +7,7 @@ #include #include -#include "inference_engine.hpp" +#include "ie_layers.h" namespace GNAPluginNS { class GNAConcatLayer { diff --git a/inference-engine/src/gna_plugin/layers/gna_crop_layer.hpp b/inference-engine/src/gna_plugin/layers/gna_crop_layer.hpp index 4af6278..130a189 100644 --- a/inference-engine/src/gna_plugin/layers/gna_crop_layer.hpp +++ b/inference-engine/src/gna_plugin/layers/gna_crop_layer.hpp @@ -4,7 +4,7 @@ #pragma once -#include "inference_engine.hpp" +#include "ie_layers.h" namespace GNAPluginNS { class GNACropLayer { diff --git a/inference-engine/src/gna_plugin/layers/gna_layer_info.hpp b/inference-engine/src/gna_plugin/layers/gna_layer_info.hpp index aacc2fe..9a79ff8 100644 --- a/inference-engine/src/gna_plugin/layers/gna_layer_info.hpp +++ b/inference-engine/src/gna_plugin/layers/gna_layer_info.hpp @@ -7,7 +7,7 @@ #include #include #include -#include "inference_engine.hpp" +#include "ie_layers.h" #include "caseless.hpp" #include "ie_algorithm.hpp" #include "gna-api.h" diff --git a/inference-engine/src/gna_plugin/layers/gna_memory_layer.hpp b/inference-engine/src/gna_plugin/layers/gna_memory_layer.hpp index fd5b9c3..93d656e 100644 --- a/inference-engine/src/gna_plugin/layers/gna_memory_layer.hpp +++ b/inference-engine/src/gna_plugin/layers/gna_memory_layer.hpp @@ -4,7 +4,7 @@ #pragma once -#include "inference_engine.hpp" +#include "ie_layers.h" namespace GNAPluginNS { /** diff --git a/inference-engine/src/gna_plugin/layers/gna_split_layer.hpp b/inference-engine/src/gna_plugin/layers/gna_split_layer.hpp index 176c29c..a971fda 100644 --- a/inference-engine/src/gna_plugin/layers/gna_split_layer.hpp +++ b/inference-engine/src/gna_plugin/layers/gna_split_layer.hpp @@ -6,6 +6,7 @@ #include +#include "ie_layers.h" #include "cpp_interfaces/base/ie_plugin_base.hpp" namespace GNAPluginNS { diff --git a/inference-engine/src/inference_engine/network_serializer.cpp b/inference-engine/src/inference_engine/network_serializer.cpp index 97f57da..f9caf80 100644 --- a/inference-engine/src/inference_engine/network_serializer.cpp +++ b/inference-engine/src/inference_engine/network_serializer.cpp @@ -13,6 +13,7 @@ #include "xml_parse_utils.h" #include "ie_ngraph_utils.hpp" #include +#include namespace InferenceEngine { namespace Serialization { diff --git a/inference-engine/src/mkldnn_plugin/bf16transformer.h b/inference-engine/src/mkldnn_plugin/bf16transformer.h index 71d3354..c725a57 100644 --- a/inference-engine/src/mkldnn_plugin/bf16transformer.h +++ b/inference-engine/src/mkldnn_plugin/bf16transformer.h @@ -4,10 +4,10 @@ #pragma once +#include #include #include #include -#include "inference_engine.hpp" namespace MKLDNNPlugin { diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_infer_request.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_infer_request.cpp index f7d89d5..248bb47 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_infer_request.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_infer_request.cpp @@ -11,7 +11,6 @@ #include #include #include -#include "inference_engine.hpp" #include "mkldnn_exec_network.h" #include "mkldnn_itt.h" diff --git a/inference-engine/src/plugin_api/cpp_interfaces/interface/ie_iplugin_internal.hpp b/inference-engine/src/plugin_api/cpp_interfaces/interface/ie_iplugin_internal.hpp index 0581811..3fcbde3 100644 --- a/inference-engine/src/plugin_api/cpp_interfaces/interface/ie_iplugin_internal.hpp +++ b/inference-engine/src/plugin_api/cpp_interfaces/interface/ie_iplugin_internal.hpp @@ -9,7 +9,6 @@ #pragma once -#include #include #include #include @@ -68,7 +67,6 @@ static void copyInputOutputInfo(const InputsDataMap & networkInputs, const Outpu newPtr.reset(new InputInfo()); copyPreProcess(it.second->getPreProcess(), newPtr->getPreProcess()); DataPtr newData(new Data(*it.second->getInputData())); - getInputTo(newData).clear(); newPtr->setInputData(newData); } _networkInputs[it.first] = newPtr; @@ -77,7 +75,6 @@ static void copyInputOutputInfo(const InputsDataMap & networkInputs, const Outpu DataPtr newData; if (it.second) { newData.reset(new Data(*it.second)); - getInputTo(newData).clear(); } _networkOutputs[it.first] = newData; } diff --git a/inference-engine/src/plugin_api/cpp_interfaces/plugin_itt.hpp b/inference-engine/src/plugin_api/cpp_interfaces/plugin_itt.hpp index f207c64..724cdc1 100644 --- a/inference-engine/src/plugin_api/cpp_interfaces/plugin_itt.hpp +++ b/inference-engine/src/plugin_api/cpp_interfaces/plugin_itt.hpp @@ -26,7 +26,7 @@ namespace InferenceEngine { namespace itt { namespace domains { - OV_ITT_DOMAIN(Plugin); + OV_ITT_DOMAIN(Plugin) } } } diff --git a/inference-engine/src/plugin_api/exec_graph_info.hpp b/inference-engine/src/plugin_api/exec_graph_info.hpp index 0762986..f70c555 100644 --- a/inference-engine/src/plugin_api/exec_graph_info.hpp +++ b/inference-engine/src/plugin_api/exec_graph_info.hpp @@ -15,7 +15,6 @@ #include #include -#include /** * @brief A namespace with const values for Execution Graph parameters names. diff --git a/inference-engine/src/plugin_api/generic_ie.hpp b/inference-engine/src/plugin_api/generic_ie.hpp index fbe4aea..0bb1928 100644 --- a/inference-engine/src/plugin_api/generic_ie.hpp +++ b/inference-engine/src/plugin_api/generic_ie.hpp @@ -12,8 +12,10 @@ #include #include #include -#include "ngraph/op/op.hpp" -#include + +#include +#include +#include namespace ngraph { namespace op { diff --git a/inference-engine/tests/functional/inference_engine/CMakeLists.txt b/inference-engine/tests/functional/inference_engine/CMakeLists.txt index 9da413d..9313435 100644 --- a/inference-engine/tests/functional/inference_engine/CMakeLists.txt +++ b/inference-engine/tests/functional/inference_engine/CMakeLists.txt @@ -38,37 +38,46 @@ include(CMakeParseArguments) # # ie_headers_compilation_with_custom_flags(TEST_SUFFIX -# FLAGS -# DEFINITIONS -# HEADERS_TO_SKIP -# CXX_STANDARD ) +# [FLAGS ] +# [PLUGIN_API] +# [DEFINITIONS ] +# [HEADERS_TO_SKIP ] +# [CXX_STANDARD ]) # # Tests compilation with modern flags # function(ie_headers_compilation_with_custom_flags) - set(options) - set(oneValueArgs TEST_SUFFIX CXX_STANDARD) - set(multiValueArgs FLAGS DEFINITIONS HEADERS_TO_SKIP) + set(options PLUGIN_API) + set(oneValueArgs FLAGS TEST_SUFFIX CXX_STANDARD) + set(multiValueArgs DEFINITIONS HEADERS_TO_SKIP) cmake_parse_arguments(IE_TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - file(GLOB_RECURSE header_files RELATIVE "${IE_MAIN_SOURCE_DIR}/include" - "${IE_MAIN_SOURCE_DIR}/include/*") + if(IE_TEST_PLUGIN_API) + set(IE_TEST_INCLUDE_DIRECTORY "${IE_MAIN_SOURCE_DIR}/src/plugin_api") + else() + set(IE_TEST_INCLUDE_DIRECTORY "${IE_MAIN_SOURCE_DIR}/include") + endif() + + file(GLOB_RECURSE header_files RELATIVE "${IE_TEST_INCLUDE_DIRECTORY}" + "${IE_TEST_INCLUDE_DIRECTORY}/*") if(NOT IE_TEST_CXX_STANDARD) set(IE_TEST_CXX_STANDARD ${CMAKE_CXX_STANDARD}) endif() - if(NOT CLDNN__IOCL_ICD_INCDIRS) - list(APPEND IE_TEST_HEADERS_TO_SKIP "gpu/gpu_ocl_wrapper.hpp" - "gpu/gpu_context_api_ocl.hpp" - "gpu/gpu_context_api_va.hpp" - "gpu/gpu_context_api_dx.hpp") - endif() - if(NOT WIN32) - list(APPEND IE_TEST_HEADERS_TO_SKIP "gpu/gpu_context_api_dx.hpp") - endif() - if(NOT LIBVA_FOUND) - list(APPEND IE_TEST_HEADERS_TO_SKIP "gpu/gpu_context_api_va.hpp") + if(NOT IE_TEST_PLUGIN_API) + if(NOT CLDNN__IOCL_ICD_INCDIRS) + list(APPEND IE_TEST_HEADERS_TO_SKIP "gpu/gpu_ocl_wrapper.hpp" + "gpu/gpu_context_api_ocl.hpp" + "gpu/gpu_context_api_va.hpp" + "gpu/gpu_context_api_dx.hpp") + endif() + if(NOT WIN32) + list(APPEND IE_TEST_HEADERS_TO_SKIP "gpu/gpu_context_api_dx.hpp") + endif() + if(NOT LIBVA_FOUND) + list(APPEND IE_TEST_HEADERS_TO_SKIP "gpu/gpu_context_api_va.hpp") + endif() endif() set(content "\n") @@ -96,17 +105,28 @@ function(ie_headers_compilation_with_custom_flags) set(target_name ieFuncTestsCompilation${IE_TEST_TEST_SUFFIX}) add_library(${target_name} OBJECT ${source_file}) - target_include_directories(${target_name} PRIVATE $) + target_include_directories(${target_name} PRIVATE "${IE_TEST_INCLUDE_DIRECTORY}" + $) target_compile_definitions(${target_name} PRIVATE $) + if(IE_TEST_PLUGIN_API) + # ngraph, pugixml, openvino::itt, inference_engine_preproc headers + target_include_directories(${target_name} SYSTEM PRIVATE + $ + $) + target_include_directories(${target_name} PRIVATE + $ + $) + else() + # OpenCL headers if any + if(CLDNN__IOCL_ICD_INCDIRS) + target_include_directories(${target_name} SYSTEM PRIVATE ${CLDNN__IOCL_ICD_INCDIRS}) + endif() + endif() + # To include TBB headers as system set_ie_threading_interface_for(${target_name}) - # OpenCL headers if any - if(CLDNN__IOCL_ICD_INCDIRS) - target_include_directories(${target_name} SYSTEM PRIVATE ${CLDNN__IOCL_ICD_INCDIRS}) - endif() - set_target_properties(${target_name} PROPERTIES CXX_STANDARD ${IE_TEST_CXX_STANDARD} CXX_STANDARD_REQUIRED OFF) @@ -123,15 +143,19 @@ function(ie_headers_compilation_with_custom_flags) add_dependencies(${TARGET_NAME} ${target_name}) endfunction() -# compilation with c++17 -ie_headers_compilation_with_custom_flags(TEST_SUFFIX Cxx17 CXX_STANDARD 17) +# +# Public headers tests +# + +ie_headers_compilation_with_custom_flags(TEST_SUFFIX Cxx17 + CXX_STANDARD 17) if(UNIX) if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") ie_headers_compilation_with_custom_flags(TEST_SUFFIX WarningsAreErrors FLAGS "-Werror-all -Werror -Wall") else() - ie_headers_compilation_with_custom_flags(TEST_SUFFIX Pedantic FLAGS -Wpedantic) + ie_headers_compilation_with_custom_flags(TEST_SUFFIX Pedantic FLAGS "-Wpedantic") endif() else() ie_headers_compilation_with_custom_flags(TEST_SUFFIX WindowsAreErrors @@ -139,11 +163,36 @@ else() "gpu/gpu_context_api_ocl.hpp" "gpu/gpu_context_api_dx.hpp" FLAGS "/we4996 /W4 /WX") - ie_headers_compilation_with_custom_flags(TEST_SUFFIX Unicode - DEFINITIONS UNICODE _UNICODE) endif() # compilation with -Wweak-vtables # if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # ie_headers_compilation_with_custom_flags(TEST_SUFFIX WeakTables FLAGS -Wweak-vtables) # endif() + +# +# Plugin API headers tests +# + +ie_headers_compilation_with_custom_flags(TEST_SUFFIX PluginApiCxx17 + HEADERS_TO_SKIP "generic_ie.hpp" + CXX_STANDARD 17 PLUGIN_API) + +if(UNIX) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + ie_headers_compilation_with_custom_flags(TEST_SUFFIX PluginApiWarningsAreErrors + HEADERS_TO_SKIP "generic_ie.hpp" + FLAGS "-Werror-all -Werror -Wall" + PLUGIN_API) + else() + ie_headers_compilation_with_custom_flags(TEST_SUFFIX PluginApiPedantic FLAGS "-Wpedantic" + HEADERS_TO_SKIP "generic_ie.hpp" + PLUGIN_API) + endif() +else() + # TODO: enable + # ie_headers_compilation_with_custom_flags(TEST_SUFFIX PluginApiWindowsAreErrors + # HEADERS_TO_SKIP "generic_ie.hpp" + # FLAGS "/we4996 /W4 /WX" + # PLUGIN_API) +endif() diff --git a/inference-engine/tests_deprecated/unit/engines/gna/I8_quantisation_test.cpp b/inference-engine/tests_deprecated/unit/engines/gna/I8_quantisation_test.cpp index 2875237..08ce160 100644 --- a/inference-engine/tests_deprecated/unit/engines/gna/I8_quantisation_test.cpp +++ b/inference-engine/tests_deprecated/unit/engines/gna/I8_quantisation_test.cpp @@ -8,6 +8,7 @@ #include #include "frontend/layer_quantizer.hpp" #include "gna_matcher.hpp" +#include using namespace InferenceEngine; using namespace GNAPluginNS; diff --git a/inference-engine/tests_deprecated/unit/engines/gna/gna_matcher.cpp b/inference-engine/tests_deprecated/unit/engines/gna/gna_matcher.cpp index 536d2e2..2e2f639 100644 --- a/inference-engine/tests_deprecated/unit/engines/gna/gna_matcher.cpp +++ b/inference-engine/tests_deprecated/unit/engines/gna/gna_matcher.cpp @@ -24,6 +24,7 @@ #include "net_pass.h" #include "matchers/input_data_matcher.hpp" #include +#include #include
#include "unit_test_utils/mocks/mock_icnn_network.hpp" diff --git a/ngraph/src/ngraph/node.hpp b/ngraph/src/ngraph/node.hpp index 6c379ea..3a4a4f5 100644 --- a/ngraph/src/ngraph/node.hpp +++ b/ngraph/src/ngraph/node.hpp @@ -194,7 +194,7 @@ namespace ngraph public: virtual ~Node(); - virtual bool visit_attributes(AttributeVisitor& visitor) { return false; } + virtual bool visit_attributes(AttributeVisitor&) { return false; } /// \returns the autobroadcasr spec virtual const op::AutoBroadcastSpec& get_autob() const; /// \brief Evaluates the op on input_values putting results in output_values @@ -531,14 +531,14 @@ namespace ngraph #define NGRAPH_RTTI_DECLARATION \ static const ::ngraph::Node::type_info_t type_info; \ const ::ngraph::Node::type_info_t& get_type_info() const override; \ - static const ::ngraph::Node::type_info_t& get_type_info_static(); + static const ::ngraph::Node::type_info_t& get_type_info_static() #define _NGRAPH_RTTI_DEFINITION_COMMON(CLASS) \ const ::ngraph::Node::type_info_t& CLASS::get_type_info() const \ { \ return get_type_info_static(); \ } \ - const ::ngraph::Node::type_info_t CLASS::type_info = CLASS::get_type_info_static(); + const ::ngraph::Node::type_info_t CLASS::type_info = CLASS::get_type_info_static() #define _NGRAPH_RTTI_DEFINITION_WITH_PARENT(CLASS, TYPE_NAME, _VERSION_INDEX, PARENT_CLASS) \ const ::ngraph::Node::type_info_t& CLASS::get_type_info_static() \ { \ -- 2.7.4