Skip to content

[SYCL] Add missing reduction parallel_for shortcuts to queue #6070

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

steffenlarsen
Copy link
Contributor

These changes add the missing parallel_for shortcuts with the variadic parameters containing reduction operations and a kernel functor or lambda.

These changes add the missing parallel_for shortcuts with the variadic
parameters containing reduction operations and a kernel functor or
lambda.

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
@steffenlarsen
Copy link
Contributor Author

/verify with intel/llvm-test-suite#1010

@v-klochkov
Copy link
Contributor

This PR is similar to existing one: #4352

Copy link
Contributor

@v-klochkov v-klochkov left a comment

Choose a reason for hiding this comment

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

I have couple comments, see below.
Also, this PR duplicates the work done in #4352, which I hoped to merge soon after getting review from @tovinkere

/// \param Rest is a parameter pack argument of size N where N > 1 and the
/// first N-1 arguments are reduction operations and the last argument is a
/// kernel functor or lambda.
template <typename KernelName = detail::auto_name, int Dims,
Copy link
Contributor

Choose a reason for hiding this comment

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

Here the more general implementation is add, i.e. the one that accepts 'range' instead of having 3 different: 1 for range<1>, one for range<2>, and 3rd for range<3>.
Such split was done on purpose to allow conversions from int scalar: 4009b8b

(sizeof...(RestT) > 1 &&
ext::oneapi::detail::AreAllButLastReductions<RestT...>::value),
event>
parallel_for(range<Dims> NumWorkItems, RestT... Rest) {
Copy link
Contributor

Choose a reason for hiding this comment

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

SYCL 2020 SPEC says it should be 'RestT&&... Rest'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're absolutely right, though we do not have that in the handler parallel_for implementation so it made sense to me to keep the signatures the same and migrate at the same time. Either is probably fine.

@steffenlarsen
Copy link
Contributor Author

Also, this PR duplicates the work done in #4352,

I agree, they do look like they try to achieve the same. I am closing this in favor of #4352.

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.

2 participants