Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed compilation with C++20 #21646

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/linux_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ jobs:
-DENABLE_NCC_STYLE=OFF \
-DENABLE_TESTS=ON \
-DENABLE_STRICT_DEPENDENCIES=OFF \
-DENABLE_SYSTEM_TBB=OFF \
-DENABLE_SYSTEM_OPENCL=ON \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCPACK_GENERATOR=TGZ \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/linux_conditional_compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ jobs:
cmake \
-G "${{ env.CMAKE_GENERATOR }}" \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_CXX_STANDARD=20 \
-DENABLE_TESTS=ON \
-DENABLE_CPPLINT=OFF \
-DENABLE_NCC_STYLE=OFF \
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/windows_conditional_compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on:
schedule:
# run daily at 00:00
- cron: '0 0 * * *'
# pull_request:
# paths-ignore:
# - '**/docs/**'
# - 'docs/**'
# - '**/**.md'
# - '**.md'
# - '**/layer_tests_summary/**'
# - '**/conformance/**'
pull_request:
paths-ignore:
- '**/docs/**'
- 'docs/**'
- '**/**.md'
- '**.md'
- '**/layer_tests_summary/**'
- '**/conformance/**'
push:
paths-ignore:
- '**/docs/**'
Expand Down Expand Up @@ -118,6 +118,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 `
Expand Down
7 changes: 6 additions & 1 deletion cmake/features.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,12 @@ endif()
if(DEFINED ENV{TBBROOT} OR DEFINED ENV{TBB_DIR} OR DEFINED TBB_DIR OR DEFINED TBBROOT)
set(ENABLE_SYSTEM_TBB_DEFAULT OFF)
else()
set(ENABLE_SYSTEM_TBB_DEFAULT ${ENABLE_SYSTEM_LIBS_DEFAULT})
if(LINUX AND ARM64)
# CVS-126984: system TBB is not very stable on Linux ARM64 (at least on Ubuntu 20.04)
set(ENABLE_SYSTEM_TBB_DEFAULT OFF)
else()
set(ENABLE_SYSTEM_TBB_DEFAULT ${ENABLE_SYSTEM_LIBS_DEFAULT})
endif()
endif()

ov_dependent_option (ENABLE_SYSTEM_TBB "Enables use of system TBB" ${ENABLE_SYSTEM_TBB_DEFAULT}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is it related to build with C++20?
Why it was not required to be public before?

public:
OPENVINO_RTTI("nms_selected_indices", "0");
NmsSelectedIndices() = default;
Expand Down
27 changes: 21 additions & 6 deletions src/plugins/intel_cpu/src/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,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 >= 202002L
#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<NodePtr>& executableGraphNodes) : m_executableGraphNodes(executableGraphNodes) {}
Expand All @@ -1048,22 +1059,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;
}
Expand All @@ -1082,6 +1093,10 @@ class UpdateNodesBase : public IUpdateNodes {
std::vector<NodePtr>& m_executableGraphNodes;
};

#undef ov_memory_order_release
#undef ov_memory_order_relaxed
#undef ov_memory_order_acquire

#if (OV_THREAD == OV_THREAD_TBB || OV_THREAD == OV_THREAD_TBB_AUTO)
#if (TBB_VERSION_MAJOR > 2020)
template <typename Body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ void reorder_inputs::run(program& p, layout_optimizer& lo, reorder_factory& rf)
p.get_processing_order().begin(),
p.get_processing_order().end(),
reorder_cnt{ 0, 0 },
[&](reorder_cnt& total, program_node* node) {
[&](const 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);
Expand Down
Loading