-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Added ext_oneapi_non_uniform_groups
aspect
#10902
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
Changes from 10 commits
75fbe0f
fe5ab18
32961b5
d885fdd
06206f8
a59229b
ee5e1c2
a8e85aa
9ea80ca
fd2f62f
f75ab44
79df2ab
558c8d2
b34be0e
9c1f3a7
9546f8d
be657c9
03ca377
2be3514
07fda3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
gmlueck marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
|
||
#pragma once | ||
|
||
#include <sycl/aspects.hpp> | ||
#include <sycl/detail/pi.h> // for PI_ERROR_INVALID_DEVICE | ||
#include <sycl/detail/type_traits.hpp> // for is_group, is_user_cons... | ||
#include <sycl/exception.hpp> // for runtime_error | ||
|
@@ -30,7 +31,13 @@ template <typename Group> | |
inline std::enable_if_t<sycl::is_group_v<std::decay_t<Group>> && | ||
std::is_same_v<Group, sycl::sub_group>, | ||
ballot_group<Group>> | ||
#ifdef __SYCL_DEVICE_ONLY__ | ||
get_ballot_group [[__sycl_detail__::__uses_aspects__( | ||
sycl::aspect::ext_oneapi_non_uniform_groups)]] (Group group, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the right location to place an attribute for a function declaration? I thought the attribute went before the return type. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah the docs suggest this, but if I put it before the return type : i.e before
If I put it before the
I have tried putting it in a bunch of places, and the only way I can compile and run without any warnings/errors and get it working correctly is like how I've done it in the PR! I could make it superficially different so it also avoids the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to cppreference, the attribute is allowed in either place: before the (https://en.cppreference.com/w/cpp/language/attributes) FWIW, I presume you could do this if you wanted to place the attribute before the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right this does work, I thought I tried it and it didn't. It is better like that. I'll change it. |
||
bool predicate); | ||
#else | ||
get_ballot_group(Group group, bool predicate); | ||
#endif | ||
|
||
template <typename ParentGroup> class ballot_group { | ||
public: | ||
|
@@ -142,6 +149,7 @@ inline std::enable_if_t<sycl::is_group_v<std::decay_t<Group>> && | |
get_ballot_group(Group group, bool predicate) { | ||
(void)group; | ||
#ifdef __SYCL_DEVICE_ONLY__ | ||
#if defined(__SPIR__) || defined(__NVPTX__) | ||
// ballot_group partitions into two groups using the predicate | ||
// Membership mask for one group is negation of the other | ||
sub_group_mask mask = sycl::ext::oneapi::group_ballot(group, predicate); | ||
|
@@ -150,6 +158,7 @@ get_ballot_group(Group group, bool predicate) { | |
} else { | ||
return ballot_group<sycl::sub_group>(~mask, predicate); | ||
} | ||
#endif | ||
#else | ||
(void)predicate; | ||
throw runtime_error("Non-uniform groups are not supported on host device.", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -546,6 +546,11 @@ bool device_impl::has(aspect Aspect) const { | |
sizeof(pi_bool), &support, nullptr) == PI_SUCCESS; | ||
return call_successful && support; | ||
} | ||
case aspect::ext_oneapi_non_uniform_groups: { | ||
return (this->getBackend() == backend::ext_oneapi_level_zero) || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Pennycook I also wanted to check that this correctly covers all the SPIRV cases: Are
The only two backends supporting the spirv non uniform groups? Thanks There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think these are the only two that we've tested, at least. I'm happy to leave this as it is for now -- if we can prove to ourselves later that things should run elsewhere, we can update the aspect. |
||
(this->getBackend() == backend::opencl) || | ||
(this->getBackend() == backend::ext_oneapi_cuda); | ||
} | ||
} | ||
throw runtime_error("This device aspect has not been implemented yet.", | ||
PI_ERROR_INVALID_DEVICE); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
// RUN: %{run} %t.out | ||
|
||
// REQUIRES: gpu | ||
// UNSUPPORTED: hip | ||
|
||
#include <sycl/sycl.hpp> | ||
#include <vector> | ||
|
Uh oh!
There was an error while loading. Please reload this page.