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

reducer is missing deleted members #6065

Closed
Pennycook opened this issue Apr 26, 2022 · 2 comments · Fixed by #8654
Closed

reducer is missing deleted members #6065

Pennycook opened this issue Apr 26, 2022 · 2 comments · Fixed by #8654
Assignees
Labels
bug Something isn't working confirmed good first issue Good for newcomers

Comments

@Pennycook
Copy link
Contributor

SYCL 2020 explicitly deletes the following:

reducer(const reducer&) = delete;
reducer(reducer&&) = delete;
reducer& operator=(const reducer&) = delete;
reducer& operator=(reducer&&) = delete;

These are deleted to prevent mistakes. For example, the code below currently compiles with DPC++ but produces the wrong answer, because the lambda is passed a private copy of the reducer argument. The code is only correct if the final parameter is declared as auto& reducer.

q.parallel_for(sycl::range<1>{N}, sycl::reduction(sum, sycl::plus<>), [=](sycl::id<1>, auto reducer) {
  reducer++;
});
@Ali-Sed
Copy link
Contributor

Ali-Sed commented Nov 10, 2022

Hello,
I'd like to know if anyone else is working on this issue. If not, I'd be glad to work on it.
Thanks!

@aelovikov-intel
Copy link
Contributor

AFAIK, I'm the only recent contributor to reductions and I'm not currently working on this.

This is something that I got bitten by a few times, so I'd be happy if you can contribute to it.

Thanks,
Andrei

@Pennycook Pennycook linked a pull request Mar 15, 2023 that will close this issue
@steffenlarsen steffenlarsen self-assigned this Mar 16, 2023
steffenlarsen added a commit that referenced this issue Mar 21, 2023
According to the SYCL 2020 specification, the reducer class should be
neither moveable nor copyable. This commit deletes these constructors
and assignment operators.

Fixes #6065

---------

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants