Fixed compilation with Intel compiler (#6788)

* Fixed compilation with Intel compiler

* Fixed template containers for VPU

* Fixe one-dnn

* Updated submodule
This commit is contained in:
Ilya Lavrenov 2021-07-26 12:42:05 +03:00 committed by GitHub
parent 83a3e083a1
commit 37c619b0b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 164 additions and 164 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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")

View File

@ -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)

View File

@ -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})

View File

@ -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}

View File

@ -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}

View File

@ -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()

View File

@ -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<OvGnaType, std::string> 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<OvGnaMode, std::string> modeToString = {
{OvGnaModeDefault, "OvGnaModeDefault"},
{OvGnaModeDisabled, "OvGnaModeDisabled"},

View File

@ -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;

View File

@ -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&) {}
}
}

View File

@ -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"

View File

@ -127,7 +127,7 @@ void InferRequest::SetCompletionCallbackImpl(std::function<void(InferRequest, St
statusCode = [&] {
try {
std::rethrow_exception(exceptionPtr);
} CATCH_IE_EXCEPTIONS_RETURN catch (const std::exception& ex) {
} CATCH_IE_EXCEPTIONS_RETURN catch (const std::exception&) {
return GENERAL_ERROR;
} catch (...) {
return UNEXPECTED;
@ -148,7 +148,7 @@ void InferRequest::SetCompletionCallbackImpl(IInferRequest::CompletionCallback c
statusCode = [&] {
try {
std::rethrow_exception(exceptionPtr);
} CATCH_IE_EXCEPTIONS_RETURN catch (const std::exception& ex) {
} CATCH_IE_EXCEPTIONS_RETURN catch (const std::exception&) {
return GENERAL_ERROR;
} catch (...) {
return UNEXPECTED;

View File

@ -325,7 +325,7 @@ class Core::Impl : public ICore, public std::enable_shared_from_this<ICore> {
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;

View File

@ -161,8 +161,8 @@ void VariantWrapper<IntervalsAlignmentAttributePtr>::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;

View File

@ -349,7 +349,7 @@ template <typename typelist, typename default_t, typename pred_t, typename type_
namespace {
struct cv_type_id {
template <typename type>
const int operator()(type_to_type<type>) { return cv_type_to_depth<type>::depth; }
int operator()(type_to_type<type>) { return cv_type_to_depth<type>::depth; }
};
} // namespace

View File

@ -851,7 +851,7 @@ bool pass::Serialize::run_on_function(std::shared_ptr<ngraph::Function> 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

View File

@ -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")

View File

@ -11,24 +11,33 @@
namespace vpu {
template<class Key, class Value, template<class...> class Map>
inline std::vector<Key> getKeys(const Map<Key, Value>& map) {
template <template <typename, typename...> class Map,
typename Key,
typename Value,
typename... AddParams>
inline std::vector<Key> getKeys(const Map<Key, Value, AddParams...>& map) {
auto keys = std::vector<Key>{};
keys.reserve(map.size());
std::transform(map.cbegin(), map.cend(), std::back_inserter(keys), [](const std::pair<Key, Value>& entry) { return entry.first; });
return keys;
}
template<class Key, class Value, template<class...> class Map>
inline std::vector<Value> getValues(const Map<Key, Value>& map) {
template <template <typename, typename...> class Map,
typename Key,
typename Value,
typename... AddParams>
inline std::vector<Value> getValues(const Map<Key, Value, AddParams...>& map) {
auto values = std::vector<Value>{};
values.reserve(map.size());
std::transform(map.cbegin(), map.cend(), std::back_inserter(values), [](const std::pair<Key, Value>& entry) { return entry.second; });
return values;
}
template<class Key, class Value, template<class...> class Map>
inline Map<Value, Key> inverse(const Map<Key, Value>& map) {
template <template <typename, typename...> class Map,
typename Key,
typename Value,
typename... AddParams>
inline Map<Value, Key> inverse(const Map<Key, Value, AddParams...>& map) {
auto inverted = Map<Value, Key>{};
for (const auto& entry : map) {
const auto& insertion = inverted.emplace(entry.second, entry.first);

View File

@ -18,7 +18,7 @@ void TilingCMXLimitKBOption::validate(const std::string& value) {
int intValue;
try {
intValue = std::stoi(value);
} catch (const std::exception& e) {
} catch (const std::exception&) {
VPU_THROW_FORMAT(R"(unexpected {} option value "{}", must be a number)", key(), value);
}
@ -54,7 +54,7 @@ TilingCMXLimitKBOption::value_type TilingCMXLimitKBOption::parse(const std::stri
int intValue;
try {
intValue = std::stoi(value);
} catch (const std::exception& e) {
} catch (const std::exception&) {
VPU_THROW_FORMAT(R"(unexpected {} option value "{}", must be a number)", key(), value);
}

View File

@ -20,7 +20,7 @@ function(add_graph_transformer_target TARGET_NAME STATIC_IE)
set(TBB_IMPORTED_TARGETS ${TBB_IMPORTED_TARGETS} PARENT_SCOPE)
set(TBB_VERSION ${TBB_VERSION} PARENT_SCOPE)
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")

View File

@ -23,7 +23,7 @@ target_include_directories(${TARGET_NAME}
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_COMPILER_IS_GNUCXX)
target_compile_options(${TARGET_NAME}
PRIVATE
-Wall)

View File

@ -214,7 +214,7 @@ ie_headers_compilation_with_custom_flags(TEST_SUFFIX Cxx17
if(UNIX)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
ie_headers_compilation_with_custom_flags(TEST_SUFFIX WarningsAreErrors
FLAGS -Werror-all -Werror -Wall)
FLAGS -Wremarks -Wcheck -Werror-all -Werror -Wall)
else()
ie_headers_compilation_with_custom_flags(TEST_SUFFIX Pedantic FLAGS -Wpedantic)
endif()

View File

@ -41,12 +41,14 @@ function(ie_add_mkldnn)
set(OpenMP_cmake_included ON) ## to skip "omp simd" inside a code. Lead to some crashes inside NDK LLVM..
endif()
if(SUGGEST_OVERRIDE_SUPPORTED)
# xbyak compilation fails
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-suggest-override")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
ie_add_compiler_flags(-Wno-undef)
if(SUGGEST_OVERRIDE_SUPPORTED)
# xbyak compilation fails
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-suggest-override")
endif()
elseif(UNIX AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -diag-disable=10121")
endif()
add_subdirectory(mkl-dnn EXCLUDE_FROM_ALL)

View File

@ -118,10 +118,6 @@ struct TuneParamsSelector {
return result;
}
tune_params Default(functional_case fun) {
return Default(fun(params));
}
static bool VerifyTuneParams(const fully_connected_params& params, const tune_params& tparams);
const fully_connected_params& params;

View File

@ -32,14 +32,6 @@ ParamsKey GatherNDKernelRef::GetSupportedKey() const {
return k;
}
static inline std::string GetOrderString(std::vector<std::string>& order) {
std::string order_str = order[0];
for (size_t i = 1; i < order.size(); i++)
order_str += ", " + order[i];
return order_str;
}
static inline std::vector<std::string> GetDefaultOrder(size_t size) {
std::vector<std::string> default_order;
if (size <= 4) {

View File

@ -55,14 +55,6 @@ ParamsKey ScatterElementsUpdateKernelRef::GetSupportedKey() const {
return k;
}
static inline std::string GetOrderString(std::vector<std::string>& order) {
std::string order_str = order[0];
for (size_t i = 1; i < order.size(); i++)
order_str += ", " + order[i];
return order_str;
}
static inline std::vector<std::string> GetDefaultOrder(size_t size) {
std::vector<std::string> default_order;
if (size <= 4) {

View File

@ -32,14 +32,6 @@ ParamsKey ScatterNDUpdateKernelRef::GetSupportedKey() const {
return k;
}
static inline std::string GetOrderString(std::vector<std::string>& order) {
std::string order_str = order[0];
for (size_t i = 1; i < order.size(); i++)
order_str += ", " + order[i];
return order_str;
}
static inline std::vector<std::string> GetDefaultOrder(size_t size) {
std::vector<std::string> default_order;
if (size <= 4) {

View File

@ -55,7 +55,7 @@
namespace {
std::mutex cacheAccessMutex;
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
std::wstring multiByteCharToWString(const char* str) {
#ifdef _WIN32
int strSize = static_cast<int>(std::strlen(str));
@ -69,7 +69,7 @@ std::wstring multiByteCharToWString(const char* str) {
return result;
#endif // _WIN32
}
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
static std::vector<unsigned char> loadBinaryFromFile(std::string path) {
std::lock_guard<std::mutex> lock(cacheAccessMutex);

@ -1 +1 @@
Subproject commit d8304554b2caff2ba4e906ff8fcb6efc3b425f7c
Subproject commit 8840c3faf6c4e1131c5408e8d6795093d4f4a815

View File

@ -81,15 +81,6 @@ enum mx_fw_status {
};
/** MXLK data end */
#if !(defined(_WIN32) || defined(_WIN64))
static inline void timeout_to_timeval(unsigned int timeout_ms,
struct timeval *timeval)
{
timeval->tv_sec = timeout_ms / 1000;
timeval->tv_usec = (timeout_ms - (timeval->tv_sec * 1000)) * 1000;
}
#endif
static inline void sleepForSeconds(const unsigned int seconds) {
#if (!defined(_WIN32) && !defined(_WIN64))
sleep(seconds);

View File

@ -15,10 +15,8 @@ target_include_directories(${TARGET_NAME} SYSTEM PRIVATE
${IE_MAIN_SOURCE_DIR}/src/vpu/common/include
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${TARGET_NAME} PRIVATE
"-Wall"
)
if (CMAKE_COMPILER_IS_GNUCXX)
target_compile_options(${TARGET_NAME} PRIVATE -Wall)
endif()
target_link_libraries(${TARGET_NAME} PRIVATE

View File

@ -10,10 +10,8 @@ file(GLOB SRCS
add_executable(${TARGET_NAME} ${SRCS})
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${TARGET_NAME} PRIVATE
"-Wall"
)
if (CMAKE_COMPILER_IS_GNUCXX)
target_compile_options(${TARGET_NAME} PRIVATE -Wall)
endif()
target_link_libraries(${TARGET_NAME} PRIVATE

View File

@ -8,7 +8,7 @@ function(add_perfcheck_target TARGET_NAME PLUGIN_NAME)
add_executable(${TARGET_NAME} ${SOURCES})
# TODO: enable some day and fix all warnings
# if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# if(CMAKE_COMPILER_IS_GNUCXX)
# target_compile_options(${TARGET_NAME}
# PRIVATE
# "-Wall")

View File

@ -145,7 +145,7 @@ namespace ngraph
}
}
void extend_to_3D(ConvolutionParams& p, Shape& in_shape, Shape& filter_shape)
inline void extend_to_3D(ConvolutionParams& p, Shape& in_shape, Shape& filter_shape)
{
int spatial_rank = in_shape.size() - 2;
if (spatial_rank < 3)

View File

@ -125,14 +125,15 @@ namespace ngraph
}
}
void validate_convolution_backprop_parameters(const Shape& in_shape,
const Shape& f_shape,
const Shape& out_shape,
const Strides& strides,
const Strides& dilations,
const CoordinateDiff& pads_begin,
const CoordinateDiff& pads_end,
const CoordinateDiff& output_padding)
inline void
validate_convolution_backprop_parameters(const Shape& in_shape,
const Shape& f_shape,
const Shape& out_shape,
const Strides& strides,
const Strides& dilations,
const CoordinateDiff& pads_begin,
const CoordinateDiff& pads_end,
const CoordinateDiff& output_padding)
{
// this implementation supports 1D, 2D and 3D convolutions
NGRAPH_CHECK(in_shape.size() >= 3 && in_shape.size() <= 5,

View File

@ -37,7 +37,7 @@ namespace ngraph
// information are set to -1
std::vector<T> tmp_out(shape_size(out_shape));
std::fill(tmp_out.begin(), tmp_out.end(), static_cast<T>(-1.0));
std::fill(tmp_out.begin(), tmp_out.end(), static_cast<T>(-1));
for (unsigned int batch_ind = 0; batch_ind < batch_size; batch_ind++)
{

View File

@ -22,7 +22,7 @@ namespace ngraph
T score;
};
static std::vector<float> generate_anchors(const op::ProposalAttrs& attrs,
inline std::vector<float> generate_anchors(const op::ProposalAttrs& attrs,
const unsigned int anchor_count)
{
std::vector<float> anchors(4 * anchor_count);

View File

@ -327,7 +327,7 @@ namespace ngraph
{
ng_node_vector = ng_node_factory(onnx_node);
}
catch (const ::ngraph::onnx_import::error::OnnxNodeValidationFailure& exc)
catch (const ::ngraph::onnx_import::error::OnnxNodeValidationFailure&)
{
// Do nothing OnnxNodeValidationFailure exception already has ONNX node information.
throw;

View File

@ -172,7 +172,7 @@ public:
TuringModel get_turing_model() const { return m_turing_model; }
const element::Type get_element_type() const { return m_element_type; }
const element::Type_t get_element_type_t() const { return m_element_type_t; }
element::Type_t get_element_type_t() const { return m_element_type_t; }
const string& get_val_string() const { return m_val_string; }
bool get_val_bool() const { return m_val_bool; }
bool get_val_float() const { return m_val_float; }

View File

@ -25,7 +25,7 @@ elseif(SELECTIVE_BUILD STREQUAL "ON")
target_compile_definitions(${TARGET_NAME} INTERFACE SELECTIVE_BUILD)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR OV_COMPILER_IS_CLANG)
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
# After disabling a block of code, some variables might be unused.
target_compile_options(${TARGET_NAME} INTERFACE
-Wno-unused-function

View File

@ -26,10 +26,8 @@ if(TARGET ittnotify)
endif()
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${TARGET_NAME} PRIVATE
"-Wall"
)
if (CMAKE_COMPILER_IS_GNUCXX)
target_compile_options(${TARGET_NAME} PRIVATE -Wall)
endif()
target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)

View File

@ -64,6 +64,7 @@ function(add_gflags)
set(BUILD_SHARED_LIBS OFF)
add_subdirectory(gflags EXCLUDE_FROM_ALL)
set_target_properties(gflags_nothreads_static PROPERTIES FOLDER thirdparty)
openvino_developer_export_targets(COMPONENT openvino_common TARGETS gflags)
endfunction()
@ -76,12 +77,6 @@ add_gflags()
function(add_gtest_libraries)
set(gtest_force_shared_crt ON CACHE BOOL "disable static CRT for google test")
if (UNIX)
ie_add_compiler_flags(-Wno-undef)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
ie_add_compiler_flags(-Wno-deprecated-copy)
endif()
endif()
set(BUILD_SHARED_LIBS OFF)
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
@ -93,25 +88,32 @@ function(add_gtest_libraries)
get_target_property(gmock_include_dirs gtest INTERFACE_INCLUDE_DIRECTORIES)
set_target_properties(gmock PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${gmock_include_dirs};${gmock_SOURCE_DIR}/include")
set(gtest_targets gtest gtest_main gmock gmock_main)
foreach(target IN LISTS gtest_targets)
# If we have specified /Z7 option, remove -Zi option which comes from gtest
if (WIN32)
set(gtest_targets "gtest;gtest_main;gmock;gmock_main")
foreach(target_name ${gtest_targets})
if(TARGET "${target_name}")
get_target_property(_target_cxx_flags ${target_name} COMPILE_OPTIONS)
if(_target_cxx_flags)
if(CMAKE_CXX_FLAGS_DEBUG MATCHES ".+/Z7.+" OR CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES ".+/Z7.+")
string(REPLACE "-Zi" " " _target_cxx_flags ${_target_cxx_flags})
message(STATUS "Removing -Zi flag from target " ${target_name})
set_target_properties(${target_name} PROPERTIES COMPILE_OPTIONS "${_target_cxx_flags}")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
get_target_property(_target_cxx_flags ${target} COMPILE_OPTIONS)
if(_target_cxx_flags)
if(CMAKE_CXX_FLAGS_DEBUG MATCHES ".+/Z7.+" OR CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES ".+/Z7.+")
string(REPLACE "-Zi" " " _target_cxx_flags ${_target_cxx_flags})
message(STATUS "Removing -Zi flag from target " ${target})
set_target_properties(${target} PROPERTIES COMPILE_OPTIONS "${_target_cxx_flags}")
endif()
endif()
endforeach()
endif()
elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG OR
CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
target_compile_options(${target} PRIVATE -Wno-undef)
if(CMAKE_COMPILER_IS_GNUCXX)
target_compile_options(${target} PRIVATE -Wno-deprecated-copy)
endif()
endif()
ov_disable_all_warnings(${target})
endforeach()
set_target_properties(gtest gtest_main gmock gmock_main
PROPERTIES FOLDER thirdparty)
openvino_developer_export_targets(COMPONENT inference_engine_tests
TARGETS gmock gmock_main gtest gtest_main)
endfunction()

View File

@ -3257,7 +3257,7 @@ static inline void v_set(v_uint8x64& val_0, v_uint8x64& val_1,
*reinterpret_cast<int64_t*>(&tmp[4 * (*(mapsx + x + 3 * shift + 7))]));
}
#if defined(__GNUC__)
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
int _mm512_cvtsi512_si32(__m512i a)
{

View File

@ -19,13 +19,7 @@ macro(onnx_set_target_properties)
target_include_directories(onnx SYSTEM PRIVATE "${Protobuf_INCLUDE_DIRS}")
target_include_directories(onnx_proto SYSTEM PRIVATE "${Protobuf_INCLUDE_DIRS}")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(onnx PRIVATE /WX-)
elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
target_compile_options(onnx PRIVATE -Wno-all)
target_compile_options(onnx_proto PRIVATE -Wno-all -Wno-unused-variable)
endif()
ov_disable_all_warnings(onnx onnx_proto)
target_compile_definitions(onnx PUBLIC ONNX_BUILD_SHARED_LIBS)
endmacro()

View File

@ -52,28 +52,25 @@ get_directory_property(protobuf_VERSION DIRECTORY protobuf/cmake DEFINITION prot
set(Protobuf_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/protobuf/src)
# to hide libprotobuf warnings
target_include_directories(libprotobuf-lite SYSTEM PRIVATE "${Protobuf_INCLUDE_DIRS}")
if(NGRAPH_USE_PROTOBUF_LITE)
set(Protobuf_LIBRARIES libprotobuf-lite)
else()
set(Protobuf_LIBRARIES libprotobuf)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
set(_proto_libs ${Protobuf_LIBRARIES})
if(TARGET libprotoc)
list(APPEND _proto_libs libprotoc)
target_compile_options(libprotoc PRIVATE -Wno-all -Wno-unused-variable)
# libprotobuf is always built for protoc
target_compile_options(libprotobuf PUBLIC -Wno-undef)
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG OR
CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(protobuf_BUILD_PROTOC_BINARIES)
set_target_properties(protoc libprotoc PROPERTIES
CXX_VISIBILITY_PRESET default
C_VISIBILITY_PRESET default
VISIBILITY_INLINES_HIDDEN OFF)
list(APPEND _protobuf_libs protoc libprotoc)
endif()
set_target_properties(${_proto_libs} PROPERTIES
CXX_VISIBILITY_PRESET default
C_VISIBILITY_PRESET default
VISIBILITY_INLINES_HIDDEN OFF)
foreach(target IN LISTS Protobuf_LIBRARIES)
target_compile_options(${target}
PRIVATE -Wno-all -Wno-unused-variable)
endforeach()
ov_disable_all_warnings(${_protobuf_libs} libprotobuf libprotobuf-lite)
endif()
if(NGRAPH_USE_PROTOBUF_LITE)

View File

@ -2,16 +2,14 @@
# SPDX-License-Identifier: Apache-2.0
#
PROJECT(zlib)
if(NOT WIN32)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-all")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-all")
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP /wd4996 /W3")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
#266: function "XXX" declared implicitly
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -diag-disable=266")
endif()
elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /W3")
endif()
set(TARGET_NAME "zlib")
@ -49,8 +47,7 @@ set(lib_hdrs
set(lib_ext_hdrs "zlib/zlib.h" "zlib/zconf.h")
add_library(${TARGET_NAME} STATIC ${lib_srcs} ${lib_hdrs} ${lib_ext_hdrs})
target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/zlib"
"${CMAKE_CURRENT_SOURCE_DIR}/zlib/..")
set_target_properties(zlib PROPERTIES FOLDER thirdparty)
set_target_properties(zlib PROPERTIES FOLDER thirdparty)