Skip to content

[SYCL][NFC] Fix compilation of reduction.hpp with gcc 8.4 #7484

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

Conversation

AlexeySachkov
Copy link
Contributor

GCC 8.4 emits the following error:

include/sycl/reduction.hpp: In lambda function:
include/sycl/reduction.hpp:2318:31: error: lambda capture of ‘NumArgs’ is not a constant expression
     if constexpr (NumArgs == 2) {

Fixed it by removing the lambda used to initialize OneElemSize variable.

GCC 8.4 emits the following error:
```
include/sycl/reduction.hpp: In lambda function:
include/sycl/reduction.hpp:2318:31: error: lambda capture of ‘NumArgs’ is not a constant expression
     if constexpr (NumArgs == 2) {
```

Fixed it by removing the lambda used to initialize `OneElemSize`
variable.
@steffenlarsen
Copy link
Contributor

Precommit failure is an infrastructure problem.

@steffenlarsen steffenlarsen merged commit 39b6672 into intel:sycl Nov 22, 2022
Copy link
Contributor

@aelovikov-intel aelovikov-intel left a comment

Choose a reason for hiding this comment

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

That's very unfortunate because Immediately Invoked Function Expression is the modern C++ idiom for this exact scenario. I'd bet gcc has a bug here...

@AlexeySachkov
Copy link
Contributor Author

That's very unfortunate because Invoked Function Expression is the modern C++ idiom for this exact scenario. I'd bet gcc has a bug here...

It very much could be the case, it is not the first time we encounter issues with older compiler, see #6892. Perhaps at some point we will claim that we only support newer gcc so we can ignore those bugs?

aelovikov-intel added a commit to aelovikov-intel/llvm that referenced this pull request Nov 22, 2022
This reverts intel#7484 and uses a less intrusive workaround for the gcc bug.
steffenlarsen pushed a commit that referenced this pull request Nov 23, 2022
This reverts #7484 and uses a less intrusive workaround for the gcc bug.
@AlexeySachkov AlexeySachkov deleted the private/asachkov/fix-reduction-header-compilation branch May 22, 2024 09:51
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.

3 participants