From b218169589785906fa871a2da51c392b5a784933 Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Mon, 12 Feb 2024 11:23:25 +0100 Subject: [PATCH 01/18] Disable deprecated features in cpp20 as errors --- .../compile_flags/os_flags.cmake | 28 +++++++++++++++++++ docs/snippets/CMakeLists.txt | 3 ++ .../CMakeLists.txt | 3 ++ src/common/snippets/CMakeLists.txt | 3 ++ src/common/transformations/CMakeLists.txt | 3 ++ src/frontends/paddle/src/CMakeLists.txt | 4 +++ src/frontends/pytorch/src/CMakeLists.txt | 4 +++ src/plugins/intel_cpu/CMakeLists.txt | 6 +++- src/plugins/intel_gpu/CMakeLists.txt | 4 +++ 9 files changed, 57 insertions(+), 1 deletion(-) diff --git a/cmake/developer_package/compile_flags/os_flags.cmake b/cmake/developer_package/compile_flags/os_flags.cmake index 5a1625349ac206..1de569ae134d79 100644 --- a/cmake/developer_package/compile_flags/os_flags.cmake +++ b/cmake/developer_package/compile_flags/os_flags.cmake @@ -62,6 +62,34 @@ macro(ov_deprecated_no_errors) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ov_c_cxx_deprecated_no_errors}") endmacro() +# +# ov_deprecated_featurs_no_errors() +# +# Don't threat deprecated features of C++ as errors in current scope (directory, function) +# Defines ov_c_cxx_deprecated_features_no_errors varaible which contains C / C++ compiler flags +# +macro(ov_deprecated_featurs_no_errors) + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + # show 4996 only for /w4 + set(ov_c_cxx_deprecated_features_no_errors "") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + if(WIN32) + set(ov_c_cxx_deprecated_features_no_errors "") + else() + set(ov_c_cxx_deprecated_features_no_errors "") + endif() + elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX) + set(ov_c_cxx_deprecated_features_no_errors "-Wno-error=deprecated") + else() + message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}") + endif() + + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${ov_c_cxx_deprecated_features_no_errors}") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${ov_c_cxx_deprecated_features_no_errors}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ov_c_cxx_deprecated_features_no_errors}") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ov_c_cxx_deprecated_features_no_errors}") +endmacro() + # # ov_dev_package_no_errors() # diff --git a/docs/snippets/CMakeLists.txt b/docs/snippets/CMakeLists.txt index 89c39d706d33d2..1f39d2f41c2a2a 100644 --- a/docs/snippets/CMakeLists.txt +++ b/docs/snippets/CMakeLists.txt @@ -14,6 +14,9 @@ endif() if(UNUSED_BUT_SET_VARIABLE_SUPPORTED) ov_add_compiler_flags(-Wno-unused-but-set-variable) endif() +if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) + ov_deprecated_featurs_no_errors() +endif() file(GLOB SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp" diff --git a/src/common/low_precision_transformations/CMakeLists.txt b/src/common/low_precision_transformations/CMakeLists.txt index 215cb74de0f1c0..1ecbb9a32898a4 100644 --- a/src/common/low_precision_transformations/CMakeLists.txt +++ b/src/common/low_precision_transformations/CMakeLists.txt @@ -16,6 +16,9 @@ source_group("src" FILES ${LIBRARY_SRC}) source_group("include" FILES ${PUBLIC_HEADERS}) # Create library +if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) + ov_deprecated_featurs_no_errors() +endif() add_library(${TARGET_NAME}_obj OBJECT ${LIBRARY_SRC} diff --git a/src/common/snippets/CMakeLists.txt b/src/common/snippets/CMakeLists.txt index b3d2db77b77241..df76168752a70a 100644 --- a/src/common/snippets/CMakeLists.txt +++ b/src/common/snippets/CMakeLists.txt @@ -16,6 +16,9 @@ source_group("src" FILES ${LIBRARY_SRC}) source_group("include" FILES ${PUBLIC_HEADERS}) # Create static library +if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) + ov_deprecated_featurs_no_errors() +endif() add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} diff --git a/src/common/transformations/CMakeLists.txt b/src/common/transformations/CMakeLists.txt index c4c4ccaa9bb94c..42c83c8735d87d 100644 --- a/src/common/transformations/CMakeLists.txt +++ b/src/common/transformations/CMakeLists.txt @@ -16,6 +16,9 @@ source_group("src" FILES ${LIBRARY_SRC}) source_group("include" FILES ${PUBLIC_HEADERS}) # Create library +if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) + ov_deprecated_featurs_no_errors() +endif() add_library(${TARGET_NAME}_obj OBJECT ${LIBRARY_SRC} ${PUBLIC_HEADERS}) target_compile_definitions(${TARGET_NAME}_obj PRIVATE IMPLEMENT_OPENVINO_API) diff --git a/src/frontends/paddle/src/CMakeLists.txt b/src/frontends/paddle/src/CMakeLists.txt index af0cf0373af7d1..a774727b6aeb31 100644 --- a/src/frontends/paddle/src/CMakeLists.txt +++ b/src/frontends/paddle/src/CMakeLists.txt @@ -2,6 +2,10 @@ # SPDX-License-Identifier: Apache-2.0 # +if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) + ov_deprecated_featurs_no_errors() +endif() + ov_add_frontend(NAME paddle LINKABLE_FRONTEND PROTOBUF_REQUIRED diff --git a/src/frontends/pytorch/src/CMakeLists.txt b/src/frontends/pytorch/src/CMakeLists.txt index 814d820b5c17aa..7f60198c68a33a 100644 --- a/src/frontends/pytorch/src/CMakeLists.txt +++ b/src/frontends/pytorch/src/CMakeLists.txt @@ -2,6 +2,10 @@ # SPDX-License-Identifier: Apache-2.0 # +if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) + ov_deprecated_featurs_no_errors() +endif() + ov_add_frontend(NAME pytorch LINKABLE_FRONTEND SHUTDOWN_PROTOBUF diff --git a/src/plugins/intel_cpu/CMakeLists.txt b/src/plugins/intel_cpu/CMakeLists.txt index 3a15194061b360..5bd693a38bb467 100644 --- a/src/plugins/intel_cpu/CMakeLists.txt +++ b/src/plugins/intel_cpu/CMakeLists.txt @@ -8,6 +8,10 @@ endif() set(TARGET_NAME "openvino_intel_cpu_plugin") +if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) + ov_deprecated_featurs_no_errors() +endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") # C4267, 4244 issues from oneDNN headers conversion from 'XXX' to 'YYY', possible loss of data ov_add_compiler_flags(/wd4018) @@ -205,7 +209,7 @@ if(BUILD_SHARED_LIBS) $) target_include_directories(${TARGET_NAME}_obj SYSTEM PUBLIC $) - + if(ENABLE_MLAS_FOR_CPU) target_include_directories(${TARGET_NAME}_obj SYSTEM PUBLIC $) endif() diff --git a/src/plugins/intel_gpu/CMakeLists.txt b/src/plugins/intel_gpu/CMakeLists.txt index e48c985ad753bf..04ac4711aa9b96 100644 --- a/src/plugins/intel_gpu/CMakeLists.txt +++ b/src/plugins/intel_gpu/CMakeLists.txt @@ -8,6 +8,10 @@ endif() set (TARGET_NAME "openvino_intel_gpu_plugin") +if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) + ov_deprecated_featurs_no_errors() +endif() + if(CMAKE_COMPILER_IS_GNUCXX) ov_add_compiler_flags(-Wno-strict-aliasing) endif() From 9a8563c5df43cb5cfdcbd49cd5d7a7cadf894b23 Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Mon, 12 Feb 2024 11:24:43 +0100 Subject: [PATCH 02/18] Build compatibility for cpp 11 and 20 --- src/core/tests/matcher_pass.cpp | 2 +- .../tests/functional/caching_test.cpp | 6 ++--- .../auto_batch/src/sync_infer_request.cpp | 2 +- src/plugins/intel_cpu/src/graph.cpp | 23 ++++++++++++++----- .../graph/graph_optimizer/reorder_inputs.cpp | 20 ++++++++-------- .../common_test_utils/src/file_utils.cpp | 4 ++-- 6 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/core/tests/matcher_pass.cpp b/src/core/tests/matcher_pass.cpp index ae0b6d911c7514..0ac381a531a34c 100644 --- a/src/core/tests/matcher_pass.cpp +++ b/src/core/tests/matcher_pass.cpp @@ -25,7 +25,7 @@ class TestMatcherPass : public ov::pass::MatcherPass { auto m_relu1 = ov::pass::pattern::wrap_type(pattern::consumers_count(1)); auto m_relu2 = ov::pass::pattern::wrap_type({m_relu1}); - ov::graph_rewrite_callback callback = [=](pattern::Matcher& m) { + ov::graph_rewrite_callback callback = [m_relu1, this](pattern::Matcher& m) { // Map that helps to connect labels with matched outputs auto& node_to_output = m.get_pattern_value_map(); diff --git a/src/inference/tests/functional/caching_test.cpp b/src/inference/tests/functional/caching_test.cpp index 1b45c2bd4a7e9d..c1a7d685f4a04a 100644 --- a/src/inference/tests/functional/caching_test.cpp +++ b/src/inference/tests/functional/caching_test.cpp @@ -2359,9 +2359,7 @@ TEST_P(CachingTest, LoadBATCHWithConfig) { EXPECT_CALL(*mockPlugin, get_property(ov::internal::caching_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, get_property(ov::hint::performance_mode.name(), _)) .Times(AnyNumber()) - .WillRepeatedly(Return([] { - return ov::hint::PerformanceMode::THROUGHPUT; - })); + .WillRepeatedly(Return(ov::hint::PerformanceMode::THROUGHPUT)); if (m_remoteContext) { return; // skip the remote Context test for Auto plugin } @@ -2490,4 +2488,4 @@ INSTANTIATE_TEST_SUITE_P(CacheTestWithProxyEnabled, CacheTestWithProxyEnabled, ::testing::Combine(::testing::ValuesIn(loadVariants), ::testing::ValuesIn(cacheFolders)), getTestCaseName); -#endif \ No newline at end of file +#endif diff --git a/src/plugins/auto_batch/src/sync_infer_request.cpp b/src/plugins/auto_batch/src/sync_infer_request.cpp index c766c521cea27c..707adedc3b9bad 100644 --- a/src/plugins/auto_batch/src/sync_infer_request.cpp +++ b/src/plugins/auto_batch/src/sync_infer_request.cpp @@ -160,4 +160,4 @@ std::vector SyncInferRequest::get_profiling_info() const { return m_batched_request_wrapper->_infer_request_batched->get_profiling_info(); } } // namespace autobatch_plugin -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/graph.cpp b/src/plugins/intel_cpu/src/graph.cpp index 39a72bd80aaad7..2b2fdc9b71830f 100644 --- a/src/plugins/intel_cpu/src/graph.cpp +++ b/src/plugins/intel_cpu/src/graph.cpp @@ -1093,6 +1093,17 @@ class UpdateNodesSeq : public IUpdateNodes { #endif #if (OV_THREAD == OV_THREAD_TBB || OV_THREAD == OV_THREAD_TBB_AUTO || OV_THREAD == OV_THREAD_OMP) + +# if __cplusplus > 201703L +# define ov_memory_order_release std::memory_order_release +# define ov_memory_order_relaxed std::memory_order_relaxed +# define ov_memory_order_acquire std::memory_order_acquire +# else +# define ov_memory_order_release std::memory_order::memory_order_release +# define ov_memory_order_relaxed std::memory_order::memory_order_relaxed +# define ov_memory_order_acquire std::memory_order::memory_order_acquire +# endif + class UpdateNodesBase : public IUpdateNodes { public: explicit UpdateNodesBase(std::vector& executableGraphNodes) : m_executableGraphNodes(executableGraphNodes) {} @@ -1103,22 +1114,22 @@ class UpdateNodesBase : public IUpdateNodes { if (node->isDynamicNode()) { node->updateShapes(); } - m_prepareCounter.store(i, std::memory_order::memory_order_release); + m_prepareCounter.store(i, ov_memory_order_release); } } catch(...) { - m_completion.store(true, std::memory_order::memory_order_relaxed); + m_completion.store(true, ov_memory_order_relaxed); throw; } - m_prepareCounter.store(stop_indx, std::memory_order::memory_order_relaxed); - m_completion.store(true, std::memory_order::memory_order_release); + m_prepareCounter.store(stop_indx, ov_memory_order_relaxed); + m_completion.store(true, ov_memory_order_release); } void updateDynParams(size_t node_indx, size_t /*unused*/) { size_t local_counter = node_indx; while (true) { - const bool completion = m_completion.load(std::memory_order::memory_order_acquire); - const size_t prepareCounter = m_prepareCounter.load(std::memory_order::memory_order_relaxed); + const bool completion = m_completion.load(ov_memory_order_acquire); + const size_t prepareCounter = m_prepareCounter.load(ov_memory_order_relaxed); if (completion && local_counter == prepareCounter) { break; } diff --git a/src/plugins/intel_gpu/src/graph/graph_optimizer/reorder_inputs.cpp b/src/plugins/intel_gpu/src/graph/graph_optimizer/reorder_inputs.cpp index 0148026b6c0c48..20b229ad9c6bc9 100644 --- a/src/plugins/intel_gpu/src/graph/graph_optimizer/reorder_inputs.cpp +++ b/src/plugins/intel_gpu/src/graph/graph_optimizer/reorder_inputs.cpp @@ -689,16 +689,16 @@ void reorder_inputs::run(program& p, layout_optimizer& lo, reorder_factory& rf) } GPU_DEBUG_IF(debug_config->verbose >= 2) { - reorder_cnt total_reorder_count = std::accumulate( - p.get_processing_order().begin(), - p.get_processing_order().end(), - reorder_cnt{ 0, 0 }, - [&](reorder_cnt& total, program_node* node) { - if (fmt_map.count(node) == 0 || fmt_map.at(node) == format::any) - return total; - auto count = count_reorders(fmt_map, lo, node); - return reorder_cnt{ total.number + count.number, total.total_sizes + count.total_sizes }; - }); + reorder_cnt total_reorder_count = + std::accumulate(p.get_processing_order().begin(), + p.get_processing_order().end(), + reorder_cnt{0, 0}, + [&](reorder_cnt total, program_node* node) { + if (fmt_map.count(node) == 0 || fmt_map.at(node) == format::any) + return total; + auto count = count_reorders(fmt_map, lo, node); + return reorder_cnt{total.number + count.number, total.total_sizes + count.total_sizes}; + }); // Divide results by two as above function will each reorder from both sides GPU_DEBUG_LOG_PASS << "Total number of reorders: " << total_reorder_count.number / 2 << std::endl; GPU_DEBUG_LOG_PASS << "Total elements count of all reorders: " << total_reorder_count.total_sizes / 2 << std::endl; diff --git a/src/tests/test_utils/common_test_utils/src/file_utils.cpp b/src/tests/test_utils/common_test_utils/src/file_utils.cpp index b1b8b42797aa5d..eadaab6b7126dd 100644 --- a/src/tests/test_utils/common_test_utils/src/file_utils.cpp +++ b/src/tests/test_utils/common_test_utils/src/file_utils.cpp @@ -192,7 +192,7 @@ std::string getRelativePath(const std::string& from, const std::string& to) { output += std::accumulate(mismatch_it.first, from_vec.end(), std::string{}, - [&separator](std::string& a, const std::string&) -> std::string { + [&separator](std::string a, const std::string&) -> std::string { return a += ".." + separator; }); } @@ -203,7 +203,7 @@ std::string getRelativePath(const std::string& from, const std::string& to) { output += std::accumulate(mismatch_it.second, to_vec.end(), std::string{}, - [&separator](std::string& a, const std::string& b) -> std::string { + [&separator](std::string a, const std::string& b) -> std::string { return a.empty() ? a += b : a += separator + b; }); return output; From 33e8a0d23323a5d90e3ae0753e01bac20b1dde72 Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Mon, 12 Feb 2024 12:18:39 +0100 Subject: [PATCH 03/18] Use cpp20 in CC builds --- .github/workflows/linux_conditional_compilation.yml | 1 + .github/workflows/windows_conditional_compilation.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/linux_conditional_compilation.yml b/.github/workflows/linux_conditional_compilation.yml index 4f2d7d8ec91bed..f74802072c0910 100644 --- a/.github/workflows/linux_conditional_compilation.yml +++ b/.github/workflows/linux_conditional_compilation.yml @@ -152,6 +152,7 @@ jobs: run: | cmake \ -G "${{ env.CMAKE_GENERATOR }}" \ + -DCMAKE_CXX_STANDARD=20 \ -DBUILD_SHARED_LIBS=OFF \ -DENABLE_TESTS=ON \ -DENABLE_CPPLINT=OFF \ diff --git a/.github/workflows/windows_conditional_compilation.yml b/.github/workflows/windows_conditional_compilation.yml index 6a47f620e73b30..ead6c37c876475 100644 --- a/.github/workflows/windows_conditional_compilation.yml +++ b/.github/workflows/windows_conditional_compilation.yml @@ -147,6 +147,7 @@ jobs: run: | cmake -G "${{ env.CMAKE_GENERATOR }}" ` -DBUILD_SHARED_LIBS=OFF ` + -DCMAKE_CXX_STANDARD=20 ` -DENABLE_TESTS=ON ` -DENABLE_CPPLINT=OFF ` -DENABLE_NCC_STYLE=OFF ` From a693bce033a9ecc453e4d49a7caabfa20a3e99a8 Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Tue, 13 Feb 2024 11:35:49 +0100 Subject: [PATCH 04/18] Fix c++20 build issues on GPU --- .../src/kernel_selector/kernel_selector_common.cpp | 2 -- .../tests/unit/module_tests/primitive_comparison_test.cpp | 7 +++++++ src/plugins/intel_gpu/thirdparty/rapidjson/document.h | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernel_selector_common.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernel_selector_common.cpp index 6caa5e75a474b7..3a14e9d802da04 100644 --- a/src/plugins/intel_gpu/src/kernel_selector/kernel_selector_common.cpp +++ b/src/plugins/intel_gpu/src/kernel_selector/kernel_selector_common.cpp @@ -612,10 +612,8 @@ std::string toString_v2(const DataTensor& tensor) { std::stringstream s; s << toString(tensor.GetDType()) << "_"; s << toString(tensor.GetLayout()); - int i = 0; for (auto dim : tensor.GetDims()) { s << "_v" << dim.v << "_p" << dim.pad.before << "_" << dim.pad.after; - i++; } return s.str(); } diff --git a/src/plugins/intel_gpu/tests/unit/module_tests/primitive_comparison_test.cpp b/src/plugins/intel_gpu/tests/unit/module_tests/primitive_comparison_test.cpp index 0390593b591dfb..3e0f608a9e9640 100644 --- a/src/plugins/intel_gpu/tests/unit/module_tests/primitive_comparison_test.cpp +++ b/src/plugins/intel_gpu/tests/unit/module_tests/primitive_comparison_test.cpp @@ -11,6 +11,13 @@ #include #include +namespace cldnn { +// For gtest NE compare, class defines only `==` operator. Required when building using C++20 +inline bool operator!=(const range& lhs, const fully_connected& rhs) { + return !(lhs.operator==(rhs)); +} +} // namespace cldnn + using namespace cldnn; using namespace ::tests; diff --git a/src/plugins/intel_gpu/thirdparty/rapidjson/document.h b/src/plugins/intel_gpu/thirdparty/rapidjson/document.h index dfa499e7bd06f6..93854ee912782e 100644 --- a/src/plugins/intel_gpu/thirdparty/rapidjson/document.h +++ b/src/plugins/intel_gpu/thirdparty/rapidjson/document.h @@ -169,6 +169,8 @@ class GenericMemberIterator { //! @name relations //@{ + bool operator!=(NonConstIterator that) const { return ptr_ != that.ptr_; } + bool operator==(NonConstIterator that) const { return ptr_ == that.ptr_; } bool operator==(ConstIterator that) const { return ptr_ == that.ptr_; } bool operator!=(ConstIterator that) const { return ptr_ != that.ptr_; } bool operator<=(ConstIterator that) const { return ptr_ <= that.ptr_; } From 0a3d0f67cd77834afeedac3df0c74a55a70bff64 Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Tue, 13 Feb 2024 12:08:51 +0100 Subject: [PATCH 05/18] Fix cpp20 build issues on windows (use private) --- .../include/transformations/rt_info/nms_selected_indices.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/transformations/include/transformations/rt_info/nms_selected_indices.hpp b/src/common/transformations/include/transformations/rt_info/nms_selected_indices.hpp index 0719a5347cb981..28fa98d324f8d3 100644 --- a/src/common/transformations/include/transformations/rt_info/nms_selected_indices.hpp +++ b/src/common/transformations/include/transformations/rt_info/nms_selected_indices.hpp @@ -21,7 +21,7 @@ TRANSFORMATIONS_API bool has_nms_selected_indices(const Node* node); TRANSFORMATIONS_API void set_nms_selected_indices(Node* node); -class TRANSFORMATIONS_API NmsSelectedIndices : ov::RuntimeAttribute { +class TRANSFORMATIONS_API NmsSelectedIndices : public ov::RuntimeAttribute { public: OPENVINO_RTTI("nms_selected_indices", "0"); NmsSelectedIndices() = default; From 05158279b311db27ae4cda9f66d697c9a0f0b946 Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Tue, 13 Feb 2024 14:08:22 +0100 Subject: [PATCH 06/18] Move rapidjson iterator operators and build it only for c++20 --- .../src/kernel_selector/auto_tuner.cpp | 21 +++++++++++++++++++ .../intel_gpu/thirdparty/rapidjson/document.h | 2 -- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/plugins/intel_gpu/src/kernel_selector/auto_tuner.cpp b/src/plugins/intel_gpu/src/kernel_selector/auto_tuner.cpp index a5d0711f61cb10..d71a6834e80a25 100644 --- a/src/plugins/intel_gpu/src/kernel_selector/auto_tuner.cpp +++ b/src/plugins/intel_gpu/src/kernel_selector/auto_tuner.cpp @@ -36,6 +36,27 @@ #include #endif +#if __cplusplus > 201703L + +// Add operators `==` and `!=` for rapidjson::GenericMemberIterator for non const iterator when build with C++20, +// is more strict regarding type checks. +namespace rapidjson { + +template +inline bool operator==(GenericMemberIterator lhs, + GenericMemberIterator rhs) { + return static_cast>(lhs) == + static_cast>(rhs); +} + +template +inline bool operator!=(GenericMemberIterator lhs, + GenericMemberIterator rhs) { + return !(lhs == rhs); +} +} // namespace rapidjson +#endif + namespace kernel_selector { class TuningCache::Impl { diff --git a/src/plugins/intel_gpu/thirdparty/rapidjson/document.h b/src/plugins/intel_gpu/thirdparty/rapidjson/document.h index 93854ee912782e..dfa499e7bd06f6 100644 --- a/src/plugins/intel_gpu/thirdparty/rapidjson/document.h +++ b/src/plugins/intel_gpu/thirdparty/rapidjson/document.h @@ -169,8 +169,6 @@ class GenericMemberIterator { //! @name relations //@{ - bool operator!=(NonConstIterator that) const { return ptr_ != that.ptr_; } - bool operator==(NonConstIterator that) const { return ptr_ == that.ptr_; } bool operator==(ConstIterator that) const { return ptr_ == that.ptr_; } bool operator!=(ConstIterator that) const { return ptr_ != that.ptr_; } bool operator<=(ConstIterator that) const { return ptr_ <= that.ptr_; } From 4480f8bbc671f214b57adb277810b7da688bd19c Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Tue, 13 Feb 2024 14:39:04 +0100 Subject: [PATCH 07/18] Use invoke_result for cpp20 instead result_of --- src/plugins/intel_cpu/src/cache/multi_cache.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/intel_cpu/src/cache/multi_cache.h b/src/plugins/intel_cpu/src/cache/multi_cache.h index 746499bd9b29d7..e4c0f5aa43b033 100644 --- a/src/plugins/intel_cpu/src/cache/multi_cache.h +++ b/src/plugins/intel_cpu/src/cache/multi_cache.h @@ -41,10 +41,15 @@ class MultiCache { * Also the builder type is used for the ValueType deduction * @return result of the operation which is a pair of the requested object of ValType and the status of whether the cache hit or miss occurred */ - - template::type> - typename CacheEntry::ResultType - getOrCreate(const KeyType& key, BuilderType builder) { + template 201703L + typename ValueType = std::invoke_result_t +#else + typename ValueType = typename std::result_of::type +#endif + > + typename CacheEntry::ResultType getOrCreate(const KeyType& key, BuilderType builder) { auto entry = getEntry(); return entry->getOrCreate(key, std::move(builder)); } From 019867d70e1ab4c950fbd2dc1ad8e8850b748eca Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Wed, 14 Feb 2024 08:48:08 +0100 Subject: [PATCH 08/18] Fix cpp20 detection because of MSVC bug --- src/plugins/intel_cpu/src/cache/multi_cache.h | 7 +++---- src/plugins/intel_cpu/src/graph.cpp | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugins/intel_cpu/src/cache/multi_cache.h b/src/plugins/intel_cpu/src/cache/multi_cache.h index e4c0f5aa43b033..8225f5ed0fc447 100644 --- a/src/plugins/intel_cpu/src/cache/multi_cache.h +++ b/src/plugins/intel_cpu/src/cache/multi_cache.h @@ -43,12 +43,11 @@ class MultiCache { */ template 201703L - typename ValueType = std::invoke_result_t +#if (defined(_MSVC_LANG) && (_MSVC_LANG > 201703L)) || (defined(__cplusplus) && (__cplusplus > 201703L)) + typename ValueType = std::invoke_result_t> #else - typename ValueType = typename std::result_of::type + typename ValueType = typename std::result_of::type> #endif - > typename CacheEntry::ResultType getOrCreate(const KeyType& key, BuilderType builder) { auto entry = getEntry(); return entry->getOrCreate(key, std::move(builder)); diff --git a/src/plugins/intel_cpu/src/graph.cpp b/src/plugins/intel_cpu/src/graph.cpp index 2b2fdc9b71830f..e1362e3302242e 100644 --- a/src/plugins/intel_cpu/src/graph.cpp +++ b/src/plugins/intel_cpu/src/graph.cpp @@ -1094,7 +1094,7 @@ class UpdateNodesSeq : public IUpdateNodes { #if (OV_THREAD == OV_THREAD_TBB || OV_THREAD == OV_THREAD_TBB_AUTO || OV_THREAD == OV_THREAD_OMP) -# if __cplusplus > 201703L +# if (defined(_MSVC_LANG) && (_MSVC_LANG > 201703L)) || (defined(__cplusplus) && (__cplusplus > 201703L)) # define ov_memory_order_release std::memory_order_release # define ov_memory_order_relaxed std::memory_order_relaxed # define ov_memory_order_acquire std::memory_order_acquire From 3dfb834a0a7c3b56625ee31fdd142f2ce9817cca Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Wed, 14 Feb 2024 08:53:29 +0100 Subject: [PATCH 09/18] Cpp20 MSVC fix add lambda return type to avoid deduction issues --- .../src/nodes/executors/fullyconnected_implementations.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/intel_cpu/src/nodes/executors/fullyconnected_implementations.cpp b/src/plugins/intel_cpu/src/nodes/executors/fullyconnected_implementations.cpp index 0f656c70495766..cae4a605f65964 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/fullyconnected_implementations.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/fullyconnected_implementations.cpp @@ -244,7 +244,10 @@ const std::vector>& getImplementations() { return true; }, // create - [](const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, ExecutorContext::CPtr context) { + [](const FCAttrs& attrs, + const PostOps& postOps, + const MemoryArgs& memory, + ExecutorContext::CPtr context) -> std::shared_ptr { struct ConvolutionInstantiator { std::shared_ptr operator()( const MemoryArgs& memory, From ee77aba1f7c70a9ba317e270280f6031114da285 Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Wed, 14 Feb 2024 08:55:51 +0100 Subject: [PATCH 10/18] Cpp20 MSVC fix declare specialization to avoid instantiation in header and again in cpp file --- src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.hpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.hpp index e837dc7fdfa045..ecc3688c683d6e 100644 --- a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.hpp +++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.hpp @@ -700,6 +700,9 @@ struct jit_kernel : public dnnl::impl::cpu::x64::jit_generator { std::unordered_map> _emitters; }; +template <> +const Xbyak::Reg64& jit_kernel::reserve(); + template void jit_kernel::copy(const Xbyak::Reg64& dst, const Xbyak::Reg64& src, From 5250e18cc2163e52f4fdc02b3e1e8b94724bec0b Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Wed, 14 Feb 2024 11:40:34 +0100 Subject: [PATCH 11/18] Update gtest to fix build issues with cpp20 --- thirdparty/gtest/gtest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty/gtest/gtest b/thirdparty/gtest/gtest index d269d902e4c3cd..d0d8211a70cfbd 160000 --- a/thirdparty/gtest/gtest +++ b/thirdparty/gtest/gtest @@ -1 +1 @@ -Subproject commit d269d902e4c3cd02f3e731e1e2ff8307352817a4 +Subproject commit d0d8211a70cfbd04e1e9f52f6f8fb3f60996c703 From 1fdc7d1f60a86d48897ece5408c2cdde69759fb3 Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Wed, 14 Feb 2024 14:51:40 +0100 Subject: [PATCH 12/18] Don't use wstring for logger and exception message MSVC cpp20 issue, attempting to reference a deleted function for std::operator << --- samples/cpp/hello_classification/main.cpp | 3 ++- src/frontends/tensorflow/src/variables_index.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/samples/cpp/hello_classification/main.cpp b/samples/cpp/hello_classification/main.cpp index b0624b9a544888..940ab918ddedfb 100644 --- a/samples/cpp/hello_classification/main.cpp +++ b/samples/cpp/hello_classification/main.cpp @@ -28,7 +28,8 @@ int tmain(int argc, tchar* argv[]) { // -------- Parsing and validation of input arguments -------- if (argc != 4) { - slog::info << "Usage : " << argv[0] << " " << slog::endl; + slog::info << "Usage : " << TSTRING2STRING(argv[0]) << " " + << slog::endl; return EXIT_FAILURE; } diff --git a/src/frontends/tensorflow/src/variables_index.cpp b/src/frontends/tensorflow/src/variables_index.cpp index 2dcf3faf9e0b0c..3d97022bc683c0 100644 --- a/src/frontends/tensorflow/src/variables_index.cpp +++ b/src/frontends/tensorflow/src/variables_index.cpp @@ -228,11 +228,11 @@ bool VariablesIndex::read_variables(std::ifstream& vi_stream, const std::wstring } if (m_mmap_enabled) { m_data_files[shard].mmap = load_mmap_object(fullPath); - FRONT_END_GENERAL_CHECK(m_data_files[shard].mmap->data(), L"Variable index data cannot be mapped"); + FRONT_END_GENERAL_CHECK(m_data_files[shard].mmap->data(), "Variable index data cannot be mapped"); } else { m_data_files[shard].stream = std::shared_ptr( new std::ifstream(fullPath.c_str(), std::ifstream::in | std::ifstream::binary)); - FRONT_END_GENERAL_CHECK(m_data_files[shard].stream->is_open(), L"Variable index data file does not exist"); + FRONT_END_GENERAL_CHECK(m_data_files[shard].stream->is_open(), "Variable index data file does not exist"); } } From ec91b9c5fbbf3b5146c393a51f68fd99541e5cfb Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Wed, 14 Feb 2024 20:23:53 +0100 Subject: [PATCH 13/18] Remove not required c-style cast --- thirdparty/itt_collector/sea_itt_lib/sea_itt_lib.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/thirdparty/itt_collector/sea_itt_lib/sea_itt_lib.cpp b/thirdparty/itt_collector/sea_itt_lib/sea_itt_lib.cpp index 18196eda17e3ab..a764b27e68b67f 100644 --- a/thirdparty/itt_collector/sea_itt_lib/sea_itt_lib.cpp +++ b/thirdparty/itt_collector/sea_itt_lib/sea_itt_lib.cpp @@ -327,14 +327,14 @@ SEA_EXPORT int NotifyEvent(iJIT_JVM_EVENT event_type, void* EventSpecificData) { switch (event_type) { case iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED: { - sea::WriteJit(&(uint32_t)methodData->method_id, sizeof(uint32_t)); + sea::WriteJit(&methodData->method_id, sizeof(uint32_t)); sea::WriteJit(&methodData->method_load_address, sizeof(void*)); - sea::WriteJit(&(uint32_t)methodData->method_size, sizeof(uint32_t)); - sea::WriteJit(&(uint32_t)methodData->line_number_size, sizeof(uint32_t)); + sea::WriteJit(&methodData->method_size, sizeof(uint32_t)); + sea::WriteJit(&methodData->line_number_size, sizeof(uint32_t)); for (unsigned int i = 0; i < methodData->line_number_size; ++i) { const LineNumberInfo& lni = methodData->line_number_table[i]; - sea::WriteJit(&(uint32_t)lni.Offset, sizeof(uint32_t)); - sea::WriteJit(&(uint32_t)lni.LineNumber, sizeof(uint32_t)); + sea::WriteJit(&lni.Offset, sizeof(uint32_t)); + sea::WriteJit(&lni.LineNumber, sizeof(uint32_t)); } const char* strings[] = {methodData->method_name, methodData->class_file_name, methodData->source_file_name}; From ac33f64a96ae6f600f45eafa5f1994c3f6f5ac02 Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Thu, 15 Feb 2024 11:41:14 +0100 Subject: [PATCH 14/18] Remove ov_deprecated_featurs_no_errors macro --- .../compile_flags/os_flags.cmake | 28 ------------------- docs/snippets/CMakeLists.txt | 4 +-- .../CMakeLists.txt | 4 +-- src/common/snippets/CMakeLists.txt | 4 +-- src/common/transformations/CMakeLists.txt | 4 +-- src/frontends/paddle/src/CMakeLists.txt | 4 +-- src/frontends/pytorch/src/CMakeLists.txt | 4 +-- src/plugins/intel_cpu/CMakeLists.txt | 4 +-- src/plugins/intel_gpu/CMakeLists.txt | 4 +-- 9 files changed, 16 insertions(+), 44 deletions(-) diff --git a/cmake/developer_package/compile_flags/os_flags.cmake b/cmake/developer_package/compile_flags/os_flags.cmake index 1de569ae134d79..5a1625349ac206 100644 --- a/cmake/developer_package/compile_flags/os_flags.cmake +++ b/cmake/developer_package/compile_flags/os_flags.cmake @@ -62,34 +62,6 @@ macro(ov_deprecated_no_errors) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ov_c_cxx_deprecated_no_errors}") endmacro() -# -# ov_deprecated_featurs_no_errors() -# -# Don't threat deprecated features of C++ as errors in current scope (directory, function) -# Defines ov_c_cxx_deprecated_features_no_errors varaible which contains C / C++ compiler flags -# -macro(ov_deprecated_featurs_no_errors) - if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - # show 4996 only for /w4 - set(ov_c_cxx_deprecated_features_no_errors "") - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - if(WIN32) - set(ov_c_cxx_deprecated_features_no_errors "") - else() - set(ov_c_cxx_deprecated_features_no_errors "") - endif() - elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX) - set(ov_c_cxx_deprecated_features_no_errors "-Wno-error=deprecated") - else() - message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}") - endif() - - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${ov_c_cxx_deprecated_features_no_errors}") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${ov_c_cxx_deprecated_features_no_errors}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ov_c_cxx_deprecated_features_no_errors}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ov_c_cxx_deprecated_features_no_errors}") -endmacro() - # # ov_dev_package_no_errors() # diff --git a/docs/snippets/CMakeLists.txt b/docs/snippets/CMakeLists.txt index 1f39d2f41c2a2a..e46db7fb2e9e28 100644 --- a/docs/snippets/CMakeLists.txt +++ b/docs/snippets/CMakeLists.txt @@ -14,8 +14,8 @@ endif() if(UNUSED_BUT_SET_VARIABLE_SUPPORTED) ov_add_compiler_flags(-Wno-unused-but-set-variable) endif() -if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) - ov_deprecated_featurs_no_errors() +if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) + set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() file(GLOB SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" diff --git a/src/common/low_precision_transformations/CMakeLists.txt b/src/common/low_precision_transformations/CMakeLists.txt index 1ecbb9a32898a4..9f3cb4d4948687 100644 --- a/src/common/low_precision_transformations/CMakeLists.txt +++ b/src/common/low_precision_transformations/CMakeLists.txt @@ -16,8 +16,8 @@ source_group("src" FILES ${LIBRARY_SRC}) source_group("include" FILES ${PUBLIC_HEADERS}) # Create library -if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) - ov_deprecated_featurs_no_errors() +if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) + set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() add_library(${TARGET_NAME}_obj OBJECT diff --git a/src/common/snippets/CMakeLists.txt b/src/common/snippets/CMakeLists.txt index df76168752a70a..4a9789f6fa6bd5 100644 --- a/src/common/snippets/CMakeLists.txt +++ b/src/common/snippets/CMakeLists.txt @@ -16,8 +16,8 @@ source_group("src" FILES ${LIBRARY_SRC}) source_group("include" FILES ${PUBLIC_HEADERS}) # Create static library -if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) - ov_deprecated_featurs_no_errors() +if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) + set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() add_library(${TARGET_NAME} STATIC diff --git a/src/common/transformations/CMakeLists.txt b/src/common/transformations/CMakeLists.txt index 42c83c8735d87d..df2bc0f4de55d3 100644 --- a/src/common/transformations/CMakeLists.txt +++ b/src/common/transformations/CMakeLists.txt @@ -16,8 +16,8 @@ source_group("src" FILES ${LIBRARY_SRC}) source_group("include" FILES ${PUBLIC_HEADERS}) # Create library -if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) - ov_deprecated_featurs_no_errors() +if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) + set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() add_library(${TARGET_NAME}_obj OBJECT ${LIBRARY_SRC} ${PUBLIC_HEADERS}) diff --git a/src/frontends/paddle/src/CMakeLists.txt b/src/frontends/paddle/src/CMakeLists.txt index a774727b6aeb31..40d9f7570718a4 100644 --- a/src/frontends/paddle/src/CMakeLists.txt +++ b/src/frontends/paddle/src/CMakeLists.txt @@ -2,8 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 # -if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) - ov_deprecated_featurs_no_errors() +if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) + set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() ov_add_frontend(NAME paddle diff --git a/src/frontends/pytorch/src/CMakeLists.txt b/src/frontends/pytorch/src/CMakeLists.txt index 7f60198c68a33a..b39a5b48e1f3c4 100644 --- a/src/frontends/pytorch/src/CMakeLists.txt +++ b/src/frontends/pytorch/src/CMakeLists.txt @@ -2,8 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 # -if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) - ov_deprecated_featurs_no_errors() +if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) + set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() ov_add_frontend(NAME pytorch diff --git a/src/plugins/intel_cpu/CMakeLists.txt b/src/plugins/intel_cpu/CMakeLists.txt index 5bd693a38bb467..1463c2b5e12100 100644 --- a/src/plugins/intel_cpu/CMakeLists.txt +++ b/src/plugins/intel_cpu/CMakeLists.txt @@ -8,8 +8,8 @@ endif() set(TARGET_NAME "openvino_intel_cpu_plugin") -if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) - ov_deprecated_featurs_no_errors() +if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) + set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") diff --git a/src/plugins/intel_gpu/CMakeLists.txt b/src/plugins/intel_gpu/CMakeLists.txt index 04ac4711aa9b96..66cf774db5b6eb 100644 --- a/src/plugins/intel_gpu/CMakeLists.txt +++ b/src/plugins/intel_gpu/CMakeLists.txt @@ -8,8 +8,8 @@ endif() set (TARGET_NAME "openvino_intel_gpu_plugin") -if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) - ov_deprecated_featurs_no_errors() +if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) + set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() if(CMAKE_COMPILER_IS_GNUCXX) From bd85f4644fb7b4aa106971480787b665e4feb5d6 Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Thu, 15 Feb 2024 12:24:19 +0100 Subject: [PATCH 15/18] Fix condition for Wno-error=deprecated --- docs/snippets/CMakeLists.txt | 3 ++- src/common/low_precision_transformations/CMakeLists.txt | 2 +- src/common/snippets/CMakeLists.txt | 2 +- src/common/transformations/CMakeLists.txt | 2 +- src/frontends/paddle/src/CMakeLists.txt | 2 +- src/frontends/pytorch/src/CMakeLists.txt | 2 +- src/plugins/intel_cpu/CMakeLists.txt | 2 +- src/plugins/intel_gpu/CMakeLists.txt | 2 +- 8 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/snippets/CMakeLists.txt b/docs/snippets/CMakeLists.txt index e46db7fb2e9e28..eead0445c4be37 100644 --- a/docs/snippets/CMakeLists.txt +++ b/docs/snippets/CMakeLists.txt @@ -14,7 +14,8 @@ endif() if(UNUSED_BUT_SET_VARIABLE_SUPPORTED) ov_add_compiler_flags(-Wno-unused-but-set-variable) endif() -if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) + +if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() diff --git a/src/common/low_precision_transformations/CMakeLists.txt b/src/common/low_precision_transformations/CMakeLists.txt index 9f3cb4d4948687..b6cfe3ab454bfa 100644 --- a/src/common/low_precision_transformations/CMakeLists.txt +++ b/src/common/low_precision_transformations/CMakeLists.txt @@ -16,7 +16,7 @@ source_group("src" FILES ${LIBRARY_SRC}) source_group("include" FILES ${PUBLIC_HEADERS}) # Create library -if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) +if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() diff --git a/src/common/snippets/CMakeLists.txt b/src/common/snippets/CMakeLists.txt index 4a9789f6fa6bd5..d03fd425f9fd0b 100644 --- a/src/common/snippets/CMakeLists.txt +++ b/src/common/snippets/CMakeLists.txt @@ -16,7 +16,7 @@ source_group("src" FILES ${LIBRARY_SRC}) source_group("include" FILES ${PUBLIC_HEADERS}) # Create static library -if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) +if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() diff --git a/src/common/transformations/CMakeLists.txt b/src/common/transformations/CMakeLists.txt index df2bc0f4de55d3..ba04873301407c 100644 --- a/src/common/transformations/CMakeLists.txt +++ b/src/common/transformations/CMakeLists.txt @@ -16,7 +16,7 @@ source_group("src" FILES ${LIBRARY_SRC}) source_group("include" FILES ${PUBLIC_HEADERS}) # Create library -if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) +if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() diff --git a/src/frontends/paddle/src/CMakeLists.txt b/src/frontends/paddle/src/CMakeLists.txt index 40d9f7570718a4..ee5c73c4038738 100644 --- a/src/frontends/paddle/src/CMakeLists.txt +++ b/src/frontends/paddle/src/CMakeLists.txt @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # -if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) +if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() diff --git a/src/frontends/pytorch/src/CMakeLists.txt b/src/frontends/pytorch/src/CMakeLists.txt index b39a5b48e1f3c4..b11184b7428a87 100644 --- a/src/frontends/pytorch/src/CMakeLists.txt +++ b/src/frontends/pytorch/src/CMakeLists.txt @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # -if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) +if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() diff --git a/src/plugins/intel_cpu/CMakeLists.txt b/src/plugins/intel_cpu/CMakeLists.txt index 1463c2b5e12100..ace1355d990e88 100644 --- a/src/plugins/intel_cpu/CMakeLists.txt +++ b/src/plugins/intel_cpu/CMakeLists.txt @@ -8,7 +8,7 @@ endif() set(TARGET_NAME "openvino_intel_cpu_plugin") -if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) +if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() diff --git a/src/plugins/intel_gpu/CMakeLists.txt b/src/plugins/intel_gpu/CMakeLists.txt index 66cf774db5b6eb..34bdf9a84ee490 100644 --- a/src/plugins/intel_gpu/CMakeLists.txt +++ b/src/plugins/intel_gpu/CMakeLists.txt @@ -8,7 +8,7 @@ endif() set (TARGET_NAME "openvino_intel_gpu_plugin") -if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) +if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() From 4d2a920e59cc45ddca39fba86ab02b9db6d229be Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Thu, 15 Feb 2024 12:51:15 +0100 Subject: [PATCH 16/18] Add -Wno-error=deprecated to Clang --- docs/snippets/CMakeLists.txt | 2 +- src/common/low_precision_transformations/CMakeLists.txt | 2 +- src/common/snippets/CMakeLists.txt | 2 +- src/common/transformations/CMakeLists.txt | 2 +- src/frontends/paddle/src/CMakeLists.txt | 2 +- src/frontends/pytorch/src/CMakeLists.txt | 2 +- src/plugins/intel_cpu/CMakeLists.txt | 2 +- src/plugins/intel_gpu/CMakeLists.txt | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/snippets/CMakeLists.txt b/docs/snippets/CMakeLists.txt index eead0445c4be37..415f1dea887b13 100644 --- a/docs/snippets/CMakeLists.txt +++ b/docs/snippets/CMakeLists.txt @@ -15,7 +15,7 @@ if(UNUSED_BUT_SET_VARIABLE_SUPPORTED) ov_add_compiler_flags(-Wno-unused-but-set-variable) endif() -if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) +if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() diff --git a/src/common/low_precision_transformations/CMakeLists.txt b/src/common/low_precision_transformations/CMakeLists.txt index b6cfe3ab454bfa..a325407d829a40 100644 --- a/src/common/low_precision_transformations/CMakeLists.txt +++ b/src/common/low_precision_transformations/CMakeLists.txt @@ -16,7 +16,7 @@ source_group("src" FILES ${LIBRARY_SRC}) source_group("include" FILES ${PUBLIC_HEADERS}) # Create library -if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) +if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() diff --git a/src/common/snippets/CMakeLists.txt b/src/common/snippets/CMakeLists.txt index d03fd425f9fd0b..dcde389cde71ad 100644 --- a/src/common/snippets/CMakeLists.txt +++ b/src/common/snippets/CMakeLists.txt @@ -16,7 +16,7 @@ source_group("src" FILES ${LIBRARY_SRC}) source_group("include" FILES ${PUBLIC_HEADERS}) # Create static library -if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) +if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() diff --git a/src/common/transformations/CMakeLists.txt b/src/common/transformations/CMakeLists.txt index ba04873301407c..1d398b00546159 100644 --- a/src/common/transformations/CMakeLists.txt +++ b/src/common/transformations/CMakeLists.txt @@ -16,7 +16,7 @@ source_group("src" FILES ${LIBRARY_SRC}) source_group("include" FILES ${PUBLIC_HEADERS}) # Create library -if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) +if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() diff --git a/src/frontends/paddle/src/CMakeLists.txt b/src/frontends/paddle/src/CMakeLists.txt index ee5c73c4038738..57241ae95aeba7 100644 --- a/src/frontends/paddle/src/CMakeLists.txt +++ b/src/frontends/paddle/src/CMakeLists.txt @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # -if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) +if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() diff --git a/src/frontends/pytorch/src/CMakeLists.txt b/src/frontends/pytorch/src/CMakeLists.txt index b11184b7428a87..7fb8c4ae508bcd 100644 --- a/src/frontends/pytorch/src/CMakeLists.txt +++ b/src/frontends/pytorch/src/CMakeLists.txt @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # -if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) +if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() diff --git a/src/plugins/intel_cpu/CMakeLists.txt b/src/plugins/intel_cpu/CMakeLists.txt index ace1355d990e88..962ba21c0e99b0 100644 --- a/src/plugins/intel_cpu/CMakeLists.txt +++ b/src/plugins/intel_cpu/CMakeLists.txt @@ -8,7 +8,7 @@ endif() set(TARGET_NAME "openvino_intel_cpu_plugin") -if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) +if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() diff --git a/src/plugins/intel_gpu/CMakeLists.txt b/src/plugins/intel_gpu/CMakeLists.txt index 34bdf9a84ee490..18a941ca790c79 100644 --- a/src/plugins/intel_gpu/CMakeLists.txt +++ b/src/plugins/intel_gpu/CMakeLists.txt @@ -8,7 +8,7 @@ endif() set (TARGET_NAME "openvino_intel_gpu_plugin") -if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) +if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND CMAKE_CXX_STANDARD GREATER_EQUAL 20) set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}") endif() From 8b59864e441e838cd0ab59642954ecd9658f8759 Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Fri, 16 Feb 2024 12:21:19 +0100 Subject: [PATCH 17/18] Remove warnings for `abs` use in inverse --- src/plugins/intel_cpu/src/nodes/inverse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/intel_cpu/src/nodes/inverse.cpp b/src/plugins/intel_cpu/src/nodes/inverse.cpp index 93f0df29488b7c..04c283fc2ffb15 100644 --- a/src/plugins/intel_cpu/src/nodes/inverse.cpp +++ b/src/plugins/intel_cpu/src/nodes/inverse.cpp @@ -153,7 +153,7 @@ void Inverse::lu_decomposition(const T* data, // Find maximum value pivot - non-parallel for (size_t i = (k + 1) * m_side, j = k + 1; i < m_side_squared; i += m_side, ++j) { - if (abs(U[i + k]) > abs(U[pivot_idx + k])) { + if (std::abs(U[i + k]) > std::abs(U[pivot_idx + k])) { pivot_row = j; pivot_idx = pivot_row * m_side; } From 9ad6b3a957de15cc1784e4f85111d8b4b097a2e0 Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Fri, 16 Feb 2024 13:20:51 +0100 Subject: [PATCH 18/18] Update gtest submodule --- thirdparty/gtest/gtest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty/gtest/gtest b/thirdparty/gtest/gtest index d0d8211a70cfbd..70a225df5dd55b 160000 --- a/thirdparty/gtest/gtest +++ b/thirdparty/gtest/gtest @@ -1 +1 @@ -Subproject commit d0d8211a70cfbd04e1e9f52f6f8fb3f60996c703 +Subproject commit 70a225df5dd55bd5931664fadaa67765eb9f6016