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

Numeric PSTL algos require copy-constructible #1955

Open
jwakely opened this issue Dec 3, 2024 · 2 comments
Open

Numeric PSTL algos require copy-constructible #1955

jwakely opened this issue Dec 3, 2024 · 2 comments
Assignees

Comments

@jwakely
Copy link

jwakely commented Dec 3, 2024

All of reduce, transform_reduce, exclusive_scan, and inclusive_scan, transform_exclusive_scan, and transform_inclusive_scan only have a precondition on the type of init that it meets the Cpp17MoveConstructible requirements, so when passing it to the next internal function it needs to be moved, not copied:

     return transform_inclusive_scan(std::forward<_ExecutionPolicy>(__exec), __first, __last, __result, __binary_op,
-                                    __pstl::__internal::__no_op(), __init);
+                                    __pstl::__internal::__no_op(), std::move(__init));

And they need to move when creating local variables:

-        _Tp __temp = *__first;
+        _Tp __temp = std::move(*__first);

and when returning init as well:

-    return std::make_pair(__result, __init);
+    return std::make_pair(__result, std::move(__init));

https://github.com/oneapi-src/oneDPL/blame/b132b83cddec63df5b3794aba8c154cb186d568e/include/oneapi/dpl/pstl/numeric_impl.h#L176-L182

@jwakely
Copy link
Author

jwakely commented Dec 3, 2024

@danhoeflinger danhoeflinger self-assigned this Mar 25, 2025
@danhoeflinger
Copy link
Contributor

@jwakely Thanks for reporting this, and apologies for the delay in our response, it slipped through the cracks.
We will take a look at this and try to get a fix in to address it.

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

No branches or pull requests

2 participants