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

Only fence in SYCL parallel_reduce for non-device-accessible result_ptr #4089

Merged
merged 2 commits into from
Jun 17, 2021

Conversation

masterleinad
Copy link
Contributor

Based on top of #3940. Only 0523bca is relevant.

Before this, we also fenced for device-accessible result_ptr.

@@ -336,6 +356,7 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
Policy m_policy;
ReducerType m_reducer;
pointer_type m_result_ptr;
const bool m_result_ptr_device_accessible;
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: If we are going to make this const, shouldn't we make the other member vars const as well?

Copy link
Member

Choose a reason for hiding this comment

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

What is he point of making any of them const?
#4088 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could go either way here. It doesn't seem sensible to store a copy of a parallel_reduce/parallel_for/parallel_scan object as a class member or invoke the copy-assignment operator in a different way. Having it const makes sure that we don't forget to initialize it (and express intent: none of the members is supposed to change after calling the constructor).

That being said, we are not consistent across the SYCL implementations of these functions. If you feel strongly about it, I would rather try to make these classes copy-assignable in a separate pull request.

@masterleinad masterleinad requested a review from nliber June 12, 2021 15:42
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.

None yet

3 participants