-
Notifications
You must be signed in to change notification settings - Fork 407
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
Deduce workgroup size for SYCL parallel_reduce RangePolicy #5227
Deduce workgroup size for SYCL parallel_reduce RangePolicy #5227
Conversation
The diff is best viewed without whitespace changes. |
929cebe
to
3297b04
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks fine but the code could use more comments.
sycl::access::target::local> | ||
num_teams_done(1, cgh); | ||
|
||
auto dummy_reduction_lambda = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is called dummy
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it gets base dummy memory pointers.
sycl::accessor<unsigned int, 1, sycl::access::mode::read_write, | ||
sycl::access::target::local> | ||
num_teams_done, | ||
sycl::device_ptr<value_type> results_ptr) mutable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not getting -Wshadow warnings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently not. 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this need to be mutable?
static sycl::kernel kernel = [&] { | ||
sycl::kernel_id functor_kernel_id = | ||
sycl::get_kernel_id<decltype(dummy_reduction_lambda)>(); | ||
auto kernel_bundle = | ||
sycl::get_kernel_bundle<sycl::bundle_state::executable>( | ||
q.get_context(), std::vector{functor_kernel_id}); | ||
return kernel_bundle.get_kernel(functor_kernel_id); | ||
}(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code you have 2x in Kokkos_SYCL_Parallel_Team.hpp
.
Did you consider defining some kind of helper function for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it's worth it. In my opinion, this is pretty concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will not approve unless you refactor
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that thing mutable?
sycl::accessor<unsigned int, 1, sycl::access::mode::read_write, | ||
sycl::access::target::local> | ||
num_teams_done, | ||
sycl::device_ptr<value_type> results_ptr) mutable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this need to be mutable?
@crtrott I dropped the |
The crucial new lines of code are
We have a similar approach already for
TeamPolicy
to find a suitable vector length/subgroup size.