9 #ifdef ALPAKA_ACC_SYCL_ENABLED
11 # include <sycl/sycl.hpp>
16 template<
typename TDim>
17 class BlockSyncGenericSycl :
public interface::Implements<ConceptBlockSync, BlockSyncGenericSycl<TDim>>
20 using BlockSyncBase = BlockSyncGenericSycl<TDim>;
22 BlockSyncGenericSycl(sycl::nd_item<TDim::value> work_item) : my_item{work_item}
26 sycl::nd_item<TDim::value> my_item;
32 template<
typename TDim>
33 struct SyncBlockThreads<BlockSyncGenericSycl<TDim>>
35 static auto syncBlockThreads(BlockSyncGenericSycl<TDim>
const& blockSync) ->
void
37 blockSync.my_item.barrier();
41 template<
typename TDim>
42 struct SyncBlockThreadsPredicate<BlockCount, BlockSyncGenericSycl<TDim>>
46 auto const group = blockSync.my_item.get_group();
47 blockSync.my_item.barrier();
49 auto const counter = (predicate != 0) ? 1 : 0;
50 return sycl::reduce_over_group(group, counter, sycl::plus<>{});
54 template<
typename TDim>
55 struct SyncBlockThreadsPredicate<BlockAnd, BlockSyncGenericSycl<TDim>>
59 auto const group = blockSync.my_item.get_group();
60 blockSync.my_item.barrier();
62 return static_cast<int>(sycl::all_of_group(group,
static_cast<bool>(predicate)));
66 template<
typename TDim>
67 struct SyncBlockThreadsPredicate<BlockOr, BlockSyncGenericSycl<TDim>>
71 auto const group = blockSync.my_item.get_group();
72 blockSync.my_item.barrier();
74 return static_cast<int>(sycl::any_of_group(group,
static_cast<bool>(predicate)));
The alpaka accelerator library.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_ACC auto syncBlockThreads(TBlockSync const &blockSync) -> void
Synchronizes all threads within the current block (independently for all blocks).
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_ACC auto syncBlockThreadsPredicate(TBlockSync const &blockSync, int predicate) -> int
Synchronizes all threads within the current block (independently for all blocks), evaluates the predi...