diff --git a/cmake/developer_package/compile_flags/os_flags.cmake b/cmake/developer_package/compile_flags/os_flags.cmake index 868c3455d5daea..0fdbf79e9ec7f2 100644 --- a/cmake/developer_package/compile_flags/os_flags.cmake +++ b/cmake/developer_package/compile_flags/os_flags.cmake @@ -68,13 +68,13 @@ function(ie_sse42_optimization_flags flags) if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") # No such option for MSVC 2019 elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set(${flags} /arch:SSE4.2 /QxSSE4.2 PARENT_SCOPE) + set(${flags} /QxSSE4.2 PARENT_SCOPE) else() message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}") endif() else() if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set(${flags} -msse4.2 -xSSE4.2 PARENT_SCOPE) + set(${flags} -xSSE4.2 PARENT_SCOPE) else() set(${flags} -msse4.2 PARENT_SCOPE) endif() @@ -95,7 +95,7 @@ function(ie_avx2_optimization_flags flags) endif() else() if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set(${flags} -march=core-avx2 -xCORE-AVX2 -mtune=core-avx2 PARENT_SCOPE) + set(${flags} -xCORE-AVX2 PARENT_SCOPE) else() set(${flags} -mavx2 -mfma PARENT_SCOPE) endif() @@ -152,6 +152,24 @@ function(ie_arm_neon_optimization_flags flags) endif() endfunction() +# +# Disables all warnings for 3rd party targets +# +function(ov_disable_all_warnings) + foreach(target IN LISTS ARGN) + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + target_compile_options(${target} PRIVATE /WX-) + elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) + target_compile_options(${target} PRIVATE -w) + elseif(UNIX AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + # 193: zero used for undefined preprocessing identifier "XXX" + # 1011: missing return statement at end of non-void function "XXX" + # 2415: variable "xxx" of static storage duration was declared but never referenced + target_compile_options(${target} PRIVATE -diag-disable=warn,193,1011,2415) + endif() + endforeach() +endfunction() + # # Enables Link Time Optimization compilation # @@ -286,15 +304,12 @@ else() ie_add_compiler_flags(-Wreturn-type) ie_add_compiler_flags(-Wunused-variable) - # Disable noisy warnings - if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") ie_add_compiler_flags(-Wswitch) elseif(UNIX) ie_add_compiler_flags(-Wuninitialized -Winit-self) if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - ie_add_compiler_flags(-Wno-error=switch - -Winconsistent-missing-override) + ie_add_compiler_flags(-Winconsistent-missing-override) else() ie_add_compiler_flags(-Wmaybe-uninitialized) check_cxx_compiler_flag("-Wsuggest-override" SUGGEST_OVERRIDE_SUPPORTED) @@ -304,10 +319,11 @@ else() endif() endif() + # Disable noisy warnings + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - ie_add_compiler_flags(-diag-disable=remark) - # noisy warnings from Intel Compiler 19.1.1.217 20200306 - ie_add_compiler_flags(-diag-disable=2196) + # 177: function "XXX" was declared but never referenced + ie_add_compiler_flags(-diag-disable=remark,177,2196) endif() # Linker flags diff --git a/docs/template_extension/cpu_kernel.cpp b/docs/template_extension/cpu_kernel.cpp index aa2486589cbff2..b1d426b15825ce 100644 --- a/docs/template_extension/cpu_kernel.cpp +++ b/docs/template_extension/cpu_kernel.cpp @@ -102,6 +102,7 @@ InferenceEngine::StatusCode OpImplementation::init(InferenceEngine::LayerConfig& IE_THROW() << "Operation supports only FP32 precisions!"; } } catch (InferenceEngine::Exception& ex) { + error = ex.what(); if (resp) { strncpy(resp->msg, error.c_str(), sizeof(resp->msg) - 1); resp->msg[sizeof(resp->msg) - 1] = 0; diff --git a/docs/template_extension/fft_kernel.cpp b/docs/template_extension/fft_kernel.cpp index 12554a70c75406..3fcf71a8f641b1 100644 --- a/docs/template_extension/fft_kernel.cpp +++ b/docs/template_extension/fft_kernel.cpp @@ -66,6 +66,7 @@ InferenceEngine::StatusCode FFTImpl::init(InferenceEngine::LayerConfig& config, IE_THROW() << "Operation supports only FP32 precisions!"; } } catch (InferenceEngine::Exception& ex) { + error = ex.what(); if (resp) { strncpy(resp->msg, error.c_str(), sizeof(resp->msg) - 1); resp->msg[sizeof(resp->msg) - 1] = 0; diff --git a/inference-engine/cmake/ie_parallel.cmake b/inference-engine/cmake/ie_parallel.cmake index d33a73a5fa760d..eb844d25b76e02 100644 --- a/inference-engine/cmake/ie_parallel.cmake +++ b/inference-engine/cmake/ie_parallel.cmake @@ -29,6 +29,7 @@ function(set_ie_threading_interface_for TARGET_NAME) set(TBB_IMPORTED_TARGETS ${TBB_IMPORTED_TARGETS} PARENT_SCOPE) set(TBB_VERSION ${TBB_VERSION} PARENT_SCOPE) if (NOT TBB_FOUND) + set(THREADING "SEQ" PARENT_SCOPE) ext_message(WARNING "TBB was not found by the configured TBB_DIR/TBBROOT path.\ SEQ method will be used.") endif () @@ -95,6 +96,7 @@ function(set_ie_threading_interface_for TARGET_NAME) set(IE_THREAD_DEFINE "IE_THREAD_TBB") ie_target_link_libraries(${TARGET_NAME} ${LINK_TYPE} ${TBB_IMPORTED_TARGETS}) else () + set(THREADING "SEQ" PARENT_SCOPE) ext_message(WARNING "TBB was not found by the configured TBB_DIR path.\ SEQ method will be used for ${TARGET_NAME}") endif () @@ -133,6 +135,7 @@ function(set_ie_threading_interface_for TARGET_NAME) if (NOT OMP_LIBRARIES_RELEASE) ext_message(WARNING "Intel OpenMP not found. Intel OpenMP support will be disabled. ${IE_THREAD_DEFINE} is defined") + set(THREADING "SEQ" PARENT_SCOPE) else () set(IE_THREAD_DEFINE "IE_THREAD_OMP") diff --git a/inference-engine/ie_bridges/python/CMakeLists.txt b/inference-engine/ie_bridges/python/CMakeLists.txt index 15d248379d7e84..a88b1017a124f4 100644 --- a/inference-engine/ie_bridges/python/CMakeLists.txt +++ b/inference-engine/ie_bridges/python/CMakeLists.txt @@ -58,6 +58,13 @@ else() endif() endif() +function(ov_python_disable_intel_warnings target) + if(UNIX AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + # 1292: unknown attribute "fallthrough" + target_compile_options(${target} PRIVATE -diag-disable=1292) + endif() +endfunction() + set (PYTHON_BRIDGE_SRC_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) add_subdirectory (src/openvino/inference_engine) add_subdirectory (src/openvino/offline_transformations) diff --git a/inference-engine/ie_bridges/python/src/openvino/inference_engine/CMakeLists.txt b/inference-engine/ie_bridges/python/src/openvino/inference_engine/CMakeLists.txt index 059f335f5df6b9..cfab4f2d907f28 100644 --- a/inference-engine/ie_bridges/python/src/openvino/inference_engine/CMakeLists.txt +++ b/inference-engine/ie_bridges/python/src/openvino/inference_engine/CMakeLists.txt @@ -20,13 +20,15 @@ set_source_files_properties(${PYX_SOURCES} PROPERTIES CYTHON_IS_CXX ON) # create target cython_add_module(${TARGET_NAME} ${SOURCES}) -set(INSTALLED_TARGETS ${TARGET_NAME}) +ov_python_disable_intel_warnings(${TARGET_NAME}) +set(INSTALLED_TARGETS ${TARGET_NAME}) list(REMOVE_ITEM PYX_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ie_api.pyx") foreach(PYX_FILE IN LISTS PYX_SOURCES) get_filename_component(PYX_NAME "${PYX_FILE}" NAME_WE) cython_add_module(${PYX_NAME} ${PYX_FILE}) + ov_python_disable_intel_warnings(${PYX_NAME}) add_dependencies(${TARGET_NAME} ${PYX_NAME}) target_include_directories(${PYX_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") target_link_libraries(${PYX_NAME} PRIVATE ${InferenceEngine_LIBRARIES}) diff --git a/inference-engine/ie_bridges/python/src/openvino/offline_transformations/CMakeLists.txt b/inference-engine/ie_bridges/python/src/openvino/offline_transformations/CMakeLists.txt index ba526c3761d851..512b1662be525c 100644 --- a/inference-engine/ie_bridges/python/src/openvino/offline_transformations/CMakeLists.txt +++ b/inference-engine/ie_bridges/python/src/openvino/offline_transformations/CMakeLists.txt @@ -20,7 +20,9 @@ set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/offline_transformations_ # create target cython_add_module(${TARGET_NAME} ${SOURCES}) + add_dependencies(${TARGET_NAME} ie_api) +ov_python_disable_intel_warnings(${TARGET_NAME}) if(COMMAND ie_add_vs_version_file) ie_add_vs_version_file(NAME ${TARGET_NAME} diff --git a/inference-engine/ie_bridges/python/src/openvino/test_utils/CMakeLists.txt b/inference-engine/ie_bridges/python/src/openvino/test_utils/CMakeLists.txt index 8367f941d9f793..9d3e1e0ffc082d 100644 --- a/inference-engine/ie_bridges/python/src/openvino/test_utils/CMakeLists.txt +++ b/inference-engine/ie_bridges/python/src/openvino/test_utils/CMakeLists.txt @@ -20,7 +20,9 @@ set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/test_utils_api.pyx # create target cython_add_module(${TARGET_NAME} ${SOURCES}) + add_dependencies(${TARGET_NAME} ie_api) +ov_python_disable_intel_warnings(${TARGET_NAME}) if(COMMAND ie_add_vs_version_file) ie_add_vs_version_file(NAME ${TARGET_NAME} diff --git a/inference-engine/samples/CMakeLists.txt b/inference-engine/samples/CMakeLists.txt index aef11e16f47bf8..c06336ec8f4e47 100644 --- a/inference-engine/samples/CMakeLists.txt +++ b/inference-engine/samples/CMakeLists.txt @@ -76,6 +76,10 @@ else() set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") #treating warnings as errors endif() + if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -diag-disable:177") + endif() + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") if (APPLE) @@ -135,10 +139,6 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/cnpy") add_subdirectory(thirdparty/cnpy EXCLUDE_FROM_ALL) endif() -if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") -endif() - if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/utils") add_subdirectory(common/utils) endif() diff --git a/inference-engine/src/gna_plugin/backend/dnn_types.h b/inference-engine/src/gna_plugin/backend/dnn_types.h index d08d9346d35c89..0b00b41ec830d7 100644 --- a/inference-engine/src/gna_plugin/backend/dnn_types.h +++ b/inference-engine/src/gna_plugin/backend/dnn_types.h @@ -227,7 +227,7 @@ OvGnaType OvGnaTypeIntFromBytes(T bytesPerElement) { return r->second; } -static std::string OvGnaTypeToString(OvGnaType type) { +inline std::string OvGnaTypeToString(OvGnaType type) { static const std::map typeToString = { {OvGnaTypeInt8, "OvGnaTypeInt8"}, {OvGnaTypeInt16, "OvGnaTypeInt16"}, @@ -241,7 +241,7 @@ static std::string OvGnaTypeToString(OvGnaType type) { return r->second; } -static std::string OvGnaModeToString(OvGnaMode mode) { +inline std::string OvGnaModeToString(OvGnaMode mode) { static const std::map modeToString = { {OvGnaModeDefault, "OvGnaModeDefault"}, {OvGnaModeDisabled, "OvGnaModeDisabled"}, diff --git a/inference-engine/src/gna_plugin/backend/gna_limitations.hpp b/inference-engine/src/gna_plugin/backend/gna_limitations.hpp index 90af04519291a6..41a8178ea4e017 100644 --- a/inference-engine/src/gna_plugin/backend/gna_limitations.hpp +++ b/inference-engine/src/gna_plugin/backend/gna_limitations.hpp @@ -87,6 +87,8 @@ class Validator { static void ThrowIfNotEmpty(const std::string prefix, const std::string error); public: + Validator() = default; + void ValidateCnn2D(std::string name, const uint32_t inHeight, const uint32_t inWidth, const uint32_t inChannels, const uint32_t kH, const uint32_t kW, const uint32_t kN, const uint32_t strideH, const uint32_t strideW, OvGnaType inPrecision) const; diff --git a/inference-engine/src/hetero_plugin/hetero_infer_request.cpp b/inference-engine/src/hetero_plugin/hetero_infer_request.cpp index 7171363e7830f2..2b8d2f4f261667 100644 --- a/inference-engine/src/hetero_plugin/hetero_infer_request.cpp +++ b/inference-engine/src/hetero_plugin/hetero_infer_request.cpp @@ -77,7 +77,7 @@ void HeteroInferRequest::SetBlob(const std::string& name, const InferenceEngine: if (findInputAndOutputBlobByName(name, foundInput, foundOutput)) { r->SetBlob(name, data, foundInput->getPreProcess()); } - } catch (const InferenceEngine::NotFound& ex) {} + } catch (const InferenceEngine::NotFound&) {} } } diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt index bf3acd4d466475..e31f7c3bf5aba2 100644 --- a/inference-engine/src/inference_engine/CMakeLists.txt +++ b/inference-engine/src/inference_engine/CMakeLists.txt @@ -229,7 +229,14 @@ list(APPEND core_components ngraph) list(APPEND PATH_VARS "IE_INCLUDE_DIR" "IE_NGRAPH_DIR" "IE_PARALLEL_CMAKE") -if((THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO") AND TBBROOT MATCHES ${TEMP}) +# define variables for InferenceEngineConfig.cmake +if(THREADING MATCHES "^(TBB|TBB_AUTO)$") + set(IE_TBB_DIR "${TBB_DIR}") + list(APPEND PATH_VARS "IE_TBB_DIR") +endif() + +# install only downloaded TBB, system one is not installed +if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND TBBROOT MATCHES ${TEMP}) ie_cpack_add_component(tbb REQUIRED) list(APPEND core_components tbb) @@ -249,8 +256,6 @@ if((THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO") AND TBBROOT MATCH COMPONENT tbb) set(IE_TBB_DIR_INSTALL "external/tbb/cmake") - set(IE_TBB_DIR "${TBB_DIR}") - list(APPEND PATH_VARS "IE_TBB_DIR") install(FILES "${TBB}/cmake/TBBConfig.cmake" "${TBB}/cmake/TBBConfigVersion.cmake" diff --git a/inference-engine/src/inference_engine/cpp/ie_infer_request.cpp b/inference-engine/src/inference_engine/cpp/ie_infer_request.cpp index 9e68666b7a36f6..f94a3b6ba1c162 100644 --- a/inference-engine/src/inference_engine/cpp/ie_infer_request.cpp +++ b/inference-engine/src/inference_engine/cpp/ie_infer_request.cpp @@ -127,7 +127,7 @@ void InferRequest::SetCompletionCallbackImpl(std::function { plugin.ImportNetwork(networkStream, config); networkIsImported = true; }); - } catch (const HeaderException& ex) { + } catch (const HeaderException&) { // For these exceptions just remove old cache and set that import didn't work cacheManager->removeCacheEntry(blobId); networkIsImported = false; diff --git a/inference-engine/src/low_precision_transformations/src/rt_info/intervals_alignment_attribute.cpp b/inference-engine/src/low_precision_transformations/src/rt_info/intervals_alignment_attribute.cpp index e20fed518e4bad..cb786a8af36e05 100644 --- a/inference-engine/src/low_precision_transformations/src/rt_info/intervals_alignment_attribute.cpp +++ b/inference-engine/src/low_precision_transformations/src/rt_info/intervals_alignment_attribute.cpp @@ -161,8 +161,8 @@ void VariantWrapper::merge( resultSharedValue->preferablePrecisions.insert(sharedValue->preferablePrecisions.begin(), sharedValue->preferablePrecisions.end()); - const auto resultSize = abs(resultSharedValue->minInterval.high - resultSharedValue->minInterval.low); - const auto size = abs(sharedValue->minInterval.high - sharedValue->minInterval.low); + const auto resultSize = std::abs(resultSharedValue->minInterval.high - resultSharedValue->minInterval.low); + const auto size = std::abs(sharedValue->minInterval.high - sharedValue->minInterval.low); if (resultSize > size) { resultSharedValue->minInterval = sharedValue->minInterval; diff --git a/inference-engine/src/preprocessing/ie_preprocess_gapi_kernels.hpp b/inference-engine/src/preprocessing/ie_preprocess_gapi_kernels.hpp index ffefeed06f0c2b..3af55071aa9c89 100644 --- a/inference-engine/src/preprocessing/ie_preprocess_gapi_kernels.hpp +++ b/inference-engine/src/preprocessing/ie_preprocess_gapi_kernels.hpp @@ -349,7 +349,7 @@ template - const int operator()(type_to_type) { return cv_type_to_depth::depth; } + int operator()(type_to_type) { return cv_type_to_depth::depth; } }; } // namespace diff --git a/inference-engine/src/transformations/src/transformations/serialize.cpp b/inference-engine/src/transformations/src/transformations/serialize.cpp index 93f9c24e4b81bb..68214a5c543a97 100644 --- a/inference-engine/src/transformations/src/transformations/serialize.cpp +++ b/inference-engine/src/transformations/src/transformations/serialize.cpp @@ -851,7 +851,7 @@ bool pass::Serialize::run_on_function(std::shared_ptr f) { try { serializeFunc(xml_file, bin_file); - } catch (const ngraph::CheckFailure& e) { + } catch (const ngraph::CheckFailure&) { // optimization decission was made to create .bin file upfront and // write to it directly instead of buffering its content in memory, // hence we need to delete it here in case of failure diff --git a/inference-engine/src/vpu/common/CMakeLists.txt b/inference-engine/src/vpu/common/CMakeLists.txt index 71c727b631ab0f..d8b55be48257e8 100644 --- a/inference-engine/src/vpu/common/CMakeLists.txt +++ b/inference-engine/src/vpu/common/CMakeLists.txt @@ -15,7 +15,7 @@ function(add_common_target TARGET_NAME STATIC_IE) UNITY ) - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if(CMAKE_COMPILER_IS_GNUCXX) # TODO: enable some day and fix all warnings # target_compile_options(${TARGET_NAME} PRIVATE "-Wall") target_compile_options(${TARGET_NAME} PRIVATE "-Werror=unused-function") diff --git a/inference-engine/src/vpu/common/include/vpu/utils/containers.hpp b/inference-engine/src/vpu/common/include/vpu/utils/containers.hpp index 745613c977ece8..ada40a74d84498 100644 --- a/inference-engine/src/vpu/common/include/vpu/utils/containers.hpp +++ b/inference-engine/src/vpu/common/include/vpu/utils/containers.hpp @@ -11,24 +11,33 @@ namespace vpu { -template class Map> -inline std::vector getKeys(const Map& map) { +template