Skip to content

Commit

Permalink
[SYCL] Fix method definition of sub_group_mask::group_ballot (intel#8212
Browse files Browse the repository at this point in the history
)

Closes intel#8201
provided default value for `predicate` argument in
`sub_group_mask::group_ballot` definition

---------

Co-authored-by: Alexey Sachkov <alexey.sachkov@intel.com>
  • Loading branch information
haroon26 and AlexeySachkov authored Mar 28, 2023
1 parent 4bf87d2 commit e4024d7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
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());
});
}

0 comments on commit e4024d7

Please sign in to comment.