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
This commit is contained in:
Ilya Lavrenov 2020-08-07 12:06:47 +03:00 committed by GitHub
parent 054a7cdf8d
commit f832453d9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 99 additions and 49 deletions

View File

@ -10,7 +10,6 @@
#include <description_buffer.hpp> #include <description_buffer.hpp>
#include "cldnn_infer_request.h" #include "cldnn_infer_request.h"
#include "cldnn_remote_context.h" #include "cldnn_remote_context.h"
#include "inference_engine.hpp"
#include "cldnn_executable_network.h" #include "cldnn_executable_network.h"
#include "cldnn_itt.h" #include "cldnn_itt.h"

View File

@ -4,7 +4,7 @@
#pragma once #pragma once
#include "inference_engine.hpp" #include "ie_layers.h"
namespace GNAPluginNS { namespace GNAPluginNS {
struct ConnectionDetails { struct ConnectionDetails {

View File

@ -11,6 +11,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "ie_layers.h"
#include "descriptions/gna_input_desc.hpp" #include "descriptions/gna_input_desc.hpp"
#include "descriptions/gna_flags.hpp" #include "descriptions/gna_flags.hpp"
#include "cpp_interfaces/base/ie_plugin_base.hpp" #include "cpp_interfaces/base/ie_plugin_base.hpp"

View File

@ -7,7 +7,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "inference_engine.hpp" #include "ie_layers.h"
namespace GNAPluginNS { namespace GNAPluginNS {
class GNAConcatLayer { class GNAConcatLayer {

View File

@ -4,7 +4,7 @@
#pragma once #pragma once
#include "inference_engine.hpp" #include "ie_layers.h"
namespace GNAPluginNS { namespace GNAPluginNS {
class GNACropLayer { class GNACropLayer {

View File

@ -7,7 +7,7 @@
#include <string> #include <string>
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "inference_engine.hpp" #include "ie_layers.h"
#include "caseless.hpp" #include "caseless.hpp"
#include "ie_algorithm.hpp" #include "ie_algorithm.hpp"
#include "gna-api.h" #include "gna-api.h"

View File

@ -4,7 +4,7 @@
#pragma once #pragma once
#include "inference_engine.hpp" #include "ie_layers.h"
namespace GNAPluginNS { namespace GNAPluginNS {
/** /**

View File

@ -6,6 +6,7 @@
#include <vector> #include <vector>
#include "ie_layers.h"
#include "cpp_interfaces/base/ie_plugin_base.hpp" #include "cpp_interfaces/base/ie_plugin_base.hpp"
namespace GNAPluginNS { namespace GNAPluginNS {

View File

@ -13,6 +13,7 @@
#include "xml_parse_utils.h" #include "xml_parse_utils.h"
#include "ie_ngraph_utils.hpp" #include "ie_ngraph_utils.hpp"
#include <ngraph/variant.hpp> #include <ngraph/variant.hpp>
#include <ngraph/function.hpp>
namespace InferenceEngine { namespace InferenceEngine {
namespace Serialization { namespace Serialization {

View File

@ -4,10 +4,10 @@
#pragma once #pragma once
#include <cpp/ie_cnn_network.h>
#include <caseless.hpp> #include <caseless.hpp>
#include <string> #include <string>
#include <set> #include <set>
#include "inference_engine.hpp"
namespace MKLDNNPlugin { namespace MKLDNNPlugin {

View File

@ -11,7 +11,6 @@
#include <nodes/mkldnn_concat_node.h> #include <nodes/mkldnn_concat_node.h>
#include <nodes/mkldnn_split_node.h> #include <nodes/mkldnn_split_node.h>
#include <ie_compound_blob.h> #include <ie_compound_blob.h>
#include "inference_engine.hpp"
#include "mkldnn_exec_network.h" #include "mkldnn_exec_network.h"
#include "mkldnn_itt.h" #include "mkldnn_itt.h"

View File

@ -9,7 +9,6 @@
#pragma once #pragma once
#include <ie_layers.h>
#include <ie_iextension.h> #include <ie_iextension.h>
#include <ie_input_info.hpp> #include <ie_input_info.hpp>
#include <ie_icnn_network.hpp> #include <ie_icnn_network.hpp>
@ -68,7 +67,6 @@ static void copyInputOutputInfo(const InputsDataMap & networkInputs, const Outpu
newPtr.reset(new InputInfo()); newPtr.reset(new InputInfo());
copyPreProcess(it.second->getPreProcess(), newPtr->getPreProcess()); copyPreProcess(it.second->getPreProcess(), newPtr->getPreProcess());
DataPtr newData(new Data(*it.second->getInputData())); DataPtr newData(new Data(*it.second->getInputData()));
getInputTo(newData).clear();
newPtr->setInputData(newData); newPtr->setInputData(newData);
} }
_networkInputs[it.first] = newPtr; _networkInputs[it.first] = newPtr;
@ -77,7 +75,6 @@ static void copyInputOutputInfo(const InputsDataMap & networkInputs, const Outpu
DataPtr newData; DataPtr newData;
if (it.second) { if (it.second) {
newData.reset(new Data(*it.second)); newData.reset(new Data(*it.second));
getInputTo(newData).clear();
} }
_networkOutputs[it.first] = newData; _networkOutputs[it.first] = newData;
} }

View File

@ -26,7 +26,7 @@
namespace InferenceEngine { namespace InferenceEngine {
namespace itt { namespace itt {
namespace domains { namespace domains {
OV_ITT_DOMAIN(Plugin); OV_ITT_DOMAIN(Plugin)
} }
} }
} }

View File

@ -15,7 +15,6 @@
#include <string> #include <string>
#include <ngraph/node.hpp> #include <ngraph/node.hpp>
#include <ngraph/function.hpp>
/** /**
* @brief A namespace with const values for Execution Graph parameters names. * @brief A namespace with const values for Execution Graph parameters names.

View File

@ -12,8 +12,10 @@
#include <ie_ishape_infer_extension.hpp> #include <ie_ishape_infer_extension.hpp>
#include <ie_parameter.hpp> #include <ie_parameter.hpp>
#include <ie_precision.hpp> #include <ie_precision.hpp>
#include "ngraph/op/op.hpp"
#include <ngraph/ngraph.hpp> #include <ngraph/op/op.hpp>
#include <ngraph/op/tensor_iterator.hpp>
#include <ngraph/graph_util.hpp>
namespace ngraph { namespace ngraph {
namespace op { namespace op {

View File

@ -38,37 +38,46 @@ include(CMakeParseArguments)
# #
# ie_headers_compilation_with_custom_flags(TEST_SUFFIX <prefix> # ie_headers_compilation_with_custom_flags(TEST_SUFFIX <prefix>
# FLAGS <flags> # [FLAGS <flags>]
# DEFINITIONS <definitions> # [PLUGIN_API]
# HEADERS_TO_SKIP <skip headers> # [DEFINITIONS <definitions>]
# CXX_STANDARD <number>) # [HEADERS_TO_SKIP <skip headers>]
# [CXX_STANDARD <number>])
# #
# Tests compilation with modern flags # Tests compilation with modern flags
# #
function(ie_headers_compilation_with_custom_flags) function(ie_headers_compilation_with_custom_flags)
set(options) set(options PLUGIN_API)
set(oneValueArgs TEST_SUFFIX CXX_STANDARD) set(oneValueArgs FLAGS TEST_SUFFIX CXX_STANDARD)
set(multiValueArgs FLAGS DEFINITIONS HEADERS_TO_SKIP) set(multiValueArgs DEFINITIONS HEADERS_TO_SKIP)
cmake_parse_arguments(IE_TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) cmake_parse_arguments(IE_TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
file(GLOB_RECURSE header_files RELATIVE "${IE_MAIN_SOURCE_DIR}/include" if(IE_TEST_PLUGIN_API)
"${IE_MAIN_SOURCE_DIR}/include/*") 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) if(NOT IE_TEST_CXX_STANDARD)
set(IE_TEST_CXX_STANDARD ${CMAKE_CXX_STANDARD}) set(IE_TEST_CXX_STANDARD ${CMAKE_CXX_STANDARD})
endif() endif()
if(NOT CLDNN__IOCL_ICD_INCDIRS) if(NOT IE_TEST_PLUGIN_API)
list(APPEND IE_TEST_HEADERS_TO_SKIP "gpu/gpu_ocl_wrapper.hpp" if(NOT CLDNN__IOCL_ICD_INCDIRS)
"gpu/gpu_context_api_ocl.hpp" list(APPEND IE_TEST_HEADERS_TO_SKIP "gpu/gpu_ocl_wrapper.hpp"
"gpu/gpu_context_api_va.hpp" "gpu/gpu_context_api_ocl.hpp"
"gpu/gpu_context_api_dx.hpp") "gpu/gpu_context_api_va.hpp"
endif() "gpu/gpu_context_api_dx.hpp")
if(NOT WIN32) endif()
list(APPEND IE_TEST_HEADERS_TO_SKIP "gpu/gpu_context_api_dx.hpp") if(NOT WIN32)
endif() list(APPEND IE_TEST_HEADERS_TO_SKIP "gpu/gpu_context_api_dx.hpp")
if(NOT LIBVA_FOUND) endif()
list(APPEND IE_TEST_HEADERS_TO_SKIP "gpu/gpu_context_api_va.hpp") if(NOT LIBVA_FOUND)
list(APPEND IE_TEST_HEADERS_TO_SKIP "gpu/gpu_context_api_va.hpp")
endif()
endif() endif()
set(content "\n") set(content "\n")
@ -96,17 +105,28 @@ function(ie_headers_compilation_with_custom_flags)
set(target_name ieFuncTestsCompilation${IE_TEST_TEST_SUFFIX}) set(target_name ieFuncTestsCompilation${IE_TEST_TEST_SUFFIX})
add_library(${target_name} OBJECT ${source_file}) add_library(${target_name} OBJECT ${source_file})
target_include_directories(${target_name} PRIVATE $<TARGET_PROPERTY:inference_engine,INTERFACE_INCLUDE_DIRECTORIES>) target_include_directories(${target_name} PRIVATE "${IE_TEST_INCLUDE_DIRECTORY}"
$<TARGET_PROPERTY:inference_engine,INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_definitions(${target_name} PRIVATE $<TARGET_PROPERTY:inference_engine,INTERFACE_COMPILE_DEFINITIONS>) target_compile_definitions(${target_name} PRIVATE $<TARGET_PROPERTY:inference_engine,INTERFACE_COMPILE_DEFINITIONS>)
if(IE_TEST_PLUGIN_API)
# ngraph, pugixml, openvino::itt, inference_engine_preproc headers
target_include_directories(${target_name} SYSTEM PRIVATE
$<TARGET_PROPERTY:pugixml,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:openvino::itt,INTERFACE_INCLUDE_DIRECTORIES>)
target_include_directories(${target_name} PRIVATE
$<TARGET_PROPERTY:${NGRAPH_LIBRARIES},INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:inference_engine_preproc,INTERFACE_INCLUDE_DIRECTORIES>)
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 # To include TBB headers as system
set_ie_threading_interface_for(${target_name}) 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 set_target_properties(${target_name} PROPERTIES
CXX_STANDARD ${IE_TEST_CXX_STANDARD} CXX_STANDARD ${IE_TEST_CXX_STANDARD}
CXX_STANDARD_REQUIRED OFF) CXX_STANDARD_REQUIRED OFF)
@ -123,15 +143,19 @@ function(ie_headers_compilation_with_custom_flags)
add_dependencies(${TARGET_NAME} ${target_name}) add_dependencies(${TARGET_NAME} ${target_name})
endfunction() 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(UNIX)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
ie_headers_compilation_with_custom_flags(TEST_SUFFIX WarningsAreErrors ie_headers_compilation_with_custom_flags(TEST_SUFFIX WarningsAreErrors
FLAGS "-Werror-all -Werror -Wall") FLAGS "-Werror-all -Werror -Wall")
else() else()
ie_headers_compilation_with_custom_flags(TEST_SUFFIX Pedantic FLAGS -Wpedantic) ie_headers_compilation_with_custom_flags(TEST_SUFFIX Pedantic FLAGS "-Wpedantic")
endif() endif()
else() else()
ie_headers_compilation_with_custom_flags(TEST_SUFFIX WindowsAreErrors ie_headers_compilation_with_custom_flags(TEST_SUFFIX WindowsAreErrors
@ -139,11 +163,36 @@ else()
"gpu/gpu_context_api_ocl.hpp" "gpu/gpu_context_api_ocl.hpp"
"gpu/gpu_context_api_dx.hpp" "gpu/gpu_context_api_dx.hpp"
FLAGS "/we4996 /W4 /WX") FLAGS "/we4996 /W4 /WX")
ie_headers_compilation_with_custom_flags(TEST_SUFFIX Unicode
DEFINITIONS UNICODE _UNICODE)
endif() endif()
# compilation with -Wweak-vtables # compilation with -Wweak-vtables
# if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# ie_headers_compilation_with_custom_flags(TEST_SUFFIX WeakTables FLAGS -Wweak-vtables) # ie_headers_compilation_with_custom_flags(TEST_SUFFIX WeakTables FLAGS -Wweak-vtables)
# endif() # 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()

View File

@ -8,6 +8,7 @@
#include <frontend/model_quantizer.hpp> #include <frontend/model_quantizer.hpp>
#include "frontend/layer_quantizer.hpp" #include "frontend/layer_quantizer.hpp"
#include "gna_matcher.hpp" #include "gna_matcher.hpp"
#include <ie_core.hpp>
using namespace InferenceEngine; using namespace InferenceEngine;
using namespace GNAPluginNS; using namespace GNAPluginNS;

View File

@ -24,6 +24,7 @@
#include "net_pass.h" #include "net_pass.h"
#include "matchers/input_data_matcher.hpp" #include "matchers/input_data_matcher.hpp"
#include <blob_factory.hpp> #include <blob_factory.hpp>
#include <ie_core.hpp>
#include <details/ie_cnn_network_tools.h> #include <details/ie_cnn_network_tools.h>
#include "unit_test_utils/mocks/mock_icnn_network.hpp" #include "unit_test_utils/mocks/mock_icnn_network.hpp"

View File

@ -194,7 +194,7 @@ namespace ngraph
public: public:
virtual ~Node(); virtual ~Node();
virtual bool visit_attributes(AttributeVisitor& visitor) { return false; } virtual bool visit_attributes(AttributeVisitor&) { return false; }
/// \returns the autobroadcasr spec /// \returns the autobroadcasr spec
virtual const op::AutoBroadcastSpec& get_autob() const; virtual const op::AutoBroadcastSpec& get_autob() const;
/// \brief Evaluates the op on input_values putting results in output_values /// \brief Evaluates the op on input_values putting results in output_values
@ -531,14 +531,14 @@ namespace ngraph
#define NGRAPH_RTTI_DECLARATION \ #define NGRAPH_RTTI_DECLARATION \
static const ::ngraph::Node::type_info_t type_info; \ static const ::ngraph::Node::type_info_t type_info; \
const ::ngraph::Node::type_info_t& get_type_info() const override; \ 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) \ #define _NGRAPH_RTTI_DEFINITION_COMMON(CLASS) \
const ::ngraph::Node::type_info_t& CLASS::get_type_info() const \ const ::ngraph::Node::type_info_t& CLASS::get_type_info() const \
{ \ { \
return get_type_info_static(); \ 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) \ #define _NGRAPH_RTTI_DEFINITION_WITH_PARENT(CLASS, TYPE_NAME, _VERSION_INDEX, PARENT_CLASS) \
const ::ngraph::Node::type_info_t& CLASS::get_type_info_static() \ const ::ngraph::Node::type_info_t& CLASS::get_type_info_static() \
{ \ { \