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

Fix C++20 macro in parallel_for_each + fix concepts macro definition #1611

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

kboyarinov
Copy link
Contributor

Description

Add a comprehensive description of proposed changes

Fix two issues:

  • parallel_for_each failed to compile on gcc9 since __TBB_CPP20_PRESENT was while STL concepts were used actually. Changed to __TBB_CPP20_CONCEPTS_PRESENT
  • __TBB_CPP20_CONCEPTS_PRESENT macro was always defined to 0 for Intel Compiler and Clang. Changed to the detection based on Standard feature-test macros (the same approach as previously used for three-way-comparison)

Fixes #1552

Type of change

Choose one or multiple, leave empty if none of the other choices apply

Add a respective label(s) to PR if you have permissions

  • bug fix - change that fixes an issue
  • new feature - change that adds functionality
  • tests - change in tests
  • infrastructure - change in infrastructure and CI
  • documentation - documentation update

Tests

  • added - required for new features and some bug fixes
  • not needed

Documentation

  • updated in # - add PR number
  • needs to be updated
  • not needed

Breaks backward compatibility

  • Yes
  • No
  • Unknown

Notify the following users

List users with @ to send notifications

Other information

@mmichel11
Copy link

mmichel11 commented Jan 28, 2025

@kboyarinov @dnmokhov @sarathnandu Could this PR please be prioritized for review? The bug is significantly impacting oneDPL's pass rate here as it shows up in our oneTBB backend, and it needs to be fixed for our upcoming milestone.

Copy link
Contributor

@aleksei-fedotov aleksei-fedotov left a comment

Choose a reason for hiding this comment

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

Looks good to me, but some tests on macOS fail. Is it because of the compiler not supporting concept specifics we use?

@kboyarinov
Copy link
Contributor Author

@aleksei-fedotov @pavelkumbrasev @isaevil @sarathnandu @dnmokhov
I faced some unexpected and strange concept issues with clang on MacOS.
I propose to submit all of the other fixes now and keep the concepts disabled on MacOS. I will open an issue to fix that in the future or define the versions of Apple Clang that are not working with all or part of our concepts.
What do you think?

@sarathnandu
Copy link
Contributor

@aleksei-fedotov @pavelkumbrasev @isaevil @sarathnandu @dnmokhov I faced some unexpected and strange concept issues with clang on MacOS. I propose to submit all of the other fixes now and keep the concepts disabled on MacOS. I will open an issue to fix that in the future or define the versions of Apple Clang that are not working with all or part of our concepts. What do you think?

I agree, since this patch is affecting oneDPL's pass rate and they are waiting for this patch to be merged. We can investigate the MacOS build issue separately.

@phprus
Copy link
Contributor

phprus commented Jan 30, 2025

I think this is a bug in Clang (not only AppleClang):
llvm/llvm-project#61763

The bug is fixed in version LLVM 18.1.0.

AppleClang from Xcode 16.2 based on LLVM 17.

Copy link
Contributor

@sarathnandu sarathnandu left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@sarathnandu sarathnandu left a comment

Choose a reason for hiding this comment

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

The icpx compiler is also failing. I have tested on Intel(R) oneAPI DPC++/C++ Compiler 2023.2.0 (2023.2.0.20230721)

I believe you need to disable it for all clang not just clang && APPLE.

@dnmokhov
Copy link
Contributor

dnmokhov commented Jan 30, 2025

I think this is a bug in Clang (not only AppleClang): llvm/llvm-project#61763

The bug is fixed in version LLVM 18.1.0.

AppleClang from Xcode 16.2 based on LLVM 17.

I agree that we should just disable these concepts with any Clang for now.

My results of compiling test_blocked_range.cpp on Ubuntu:

  • Clang 14.0.0 - compiles
  • Clang 15.0.0 - compiles
  • Clang 17.0.1 - same compilation error as in MacOS CI above
  • Clang 18.1.0 - compiles
  • Clang 19.1.0 - internal compiler error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tbb::parallel_for_each build fail on gcc 9.4.0 using C++20
6 participants