Skip to content

[SYCL] Fix method definition of sub_group_mask::group_ballot #8212

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions sycl/include/sycl/ext/oneapi/sub_group_mask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ namespace ext::oneapi {
#define BITS_TYPE uint32_t
#endif

// defining `group_ballot` here to make predicate default `true`
// need to forward declare sub_group_mask first
struct sub_group_mask;
template <typename Group>
detail::enable_if_t<std::is_same<std::decay_t<Group>, sub_group>::value,
sub_group_mask>
group_ballot(Group g, bool predicate = true);

struct sub_group_mask {
friend class detail::Builder;
using BitsType = BITS_TYPE;
Expand Down
11 changes: 11 additions & 0 deletions sycl/test/check_device_code/group_ballot.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: %clangxx -fsycl -fsycl-device-only -fsyntax-only -Xclang -verify %s
// expected-no-diagnostics

#include <sycl/sycl.hpp>

int main() {
sycl::queue Q;
Q.parallel_for(sycl::nd_range<1>{32, 32}, [=](sycl::nd_item<1> item) {
auto Mask = sycl::ext::oneapi::group_ballot(item.get_sub_group());
});
}