DPC++ Runtime
Runtime libraries for oneAPI DPC++
sycl::_V1::detail::reduction_impl< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar > Class Template Reference

This class encapsulates the reduction variable/accessor, the reduction operator and an optional operator identity. More...

#include <sycl/reduction.hpp>

Inheritance diagram for sycl::_V1::detail::reduction_impl< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >:
Collaboration diagram for sycl::_V1::detail::reduction_impl< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >:

Public Member Functions

template<bool ExplicitIdentityRelay = ExplicitIdentity, typename = std::enable_if_t<!ExplicitIdentityRelay>>
 reduction_impl (RedOutVar Var, BinaryOperation BOp, bool InitializeToIdentity=false)
 Constructs reduction_impl when no identity is specified. More...
 
template<bool ExplicitIdentityRelay = ExplicitIdentity, typename = std::enable_if_t<ExplicitIdentityRelay>>
 reduction_impl (RedOutVar &Var, const T &Identity, BinaryOperation BOp, bool InitializeToIdentity)
 Constructs reduction_impl with an explicit identity value. More...
 
- Public Member Functions inherited from sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >
 reduction_impl_algo (const T &Identity, BinaryOperation BinaryOp, bool Init, RedOutVar RedOut)
 
template<typename RelayT = T, typename RelayBinaryOperation = BinaryOperation>
 reduction_impl_algo (BinaryOperation BinaryOp, bool Init, RedOutVar RedOut, std::enable_if_t< IsKnownIdentityOp< RelayT, RelayBinaryOperation >::value, int >=0)
 
template<typename RelayT = T, typename RelayBinaryOperation = BinaryOperation>
 reduction_impl_algo (BinaryOperation BinaryOp, bool Init, RedOutVar RedOut, std::enable_if_t<!IsKnownIdentityOp< RelayT, RelayBinaryOperation >::value, int >=0)
 
auto getReadAccToPreviousPartialReds (handler &CGH) const
 
template<bool IsOneWG>
auto getWriteMemForPartialReds (size_t Size, handler &CGH)
 
template<class _T = T>
auto & getTempBuffer (size_t Size, handler &CGH)
 
auto getWriteAccForPartialReds (size_t Size, handler &CGH)
 Returns an accessor accessing the memory that will hold the reduction partial sums. More...
 
template<typename KernelName , typename FuncTy , bool HasIdentity = has_identity>
std::enable_if_t< HasIdentity > withInitializedMem (handler &CGH, FuncTy Func)
 Provide Func with a properly initialized memory to write the reduction result to. More...
 
template<typename KernelName , typename FuncTy , bool HasIdentity = has_identity>
std::enable_if_t<!HasIdentity > withInitializedMem (handler &CGH, FuncTy Func)
 
const identity_container_typegetIdentityContainer ()
 
accessor< int, 1, access::mode::read_write, access::target::device, access::placeholder::false_tgetReadWriteAccessorToInitializedGroupsCounter (handler &CGH)
 
auto getGroupsCounterAccDiscrete (handler &CGH)
 
BinaryOperation getBinaryOperation () const
 Returns the binary operation associated with the reduction. More...
 
bool initializeToIdentity () const
 
auto getUserRedVarAccess (handler &CGH)
 

Static Public Attributes

static constexpr bool is_known_identity
 
static constexpr bool is_usm
 
- Static Public Attributes inherited from sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >
static constexpr bool is_known_identity
 
static constexpr bool has_identity = is_known_identity || ExplicitIdentity
 
static constexpr size_t dims = Dims
 
static constexpr bool has_float64_atomics
 
static constexpr bool has_fast_atomics
 
static constexpr bool has_fast_reduce
 
static constexpr bool is_usm = std::is_same_v<RedOutVar, T *>
 
static constexpr size_t num_elements = Extent
 

Additional Inherited Members

- Public Types inherited from sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >
using identity_container_type = ReductionIdentityContainer< T, BinaryOperation, ExplicitIdentity >
 
using reducer_token_type = detail::ReducerToken< BinaryOperation, identity_container_type >
 
using reducer_type = reducer< T, BinaryOperation, Dims, Extent, identity_container_type >
 
using reducer_element_type = typename ReducerTraits< reducer_type >::element_type
 
using result_type = T
 
using binary_operation = BinaryOperation
 

Detailed Description

template<typename T, class BinaryOperation, int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar>
class sycl::_V1::detail::reduction_impl< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >

This class encapsulates the reduction variable/accessor, the reduction operator and an optional operator identity.

Definition at line 1107 of file reduction.hpp.

Constructor & Destructor Documentation

◆ reduction_impl() [1/2]

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
template<bool ExplicitIdentityRelay = ExplicitIdentity, typename = std::enable_if_t<!ExplicitIdentityRelay>>
sycl::_V1::detail::reduction_impl< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::reduction_impl ( RedOutVar  Var,
BinaryOperation  BOp,
bool  InitializeToIdentity = false 
)
inline

◆ reduction_impl() [2/2]

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
template<bool ExplicitIdentityRelay = ExplicitIdentity, typename = std::enable_if_t<ExplicitIdentityRelay>>
sycl::_V1::detail::reduction_impl< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::reduction_impl ( RedOutVar &  Var,
const T &  Identity,
BinaryOperation  BOp,
bool  InitializeToIdentity 
)
inline

Constructs reduction_impl with an explicit identity value.

This is only available when ExplicitIdentity is true.

Definition at line 1146 of file reduction.hpp.

References sycl::_V1::detail::InitializeToIdentity, sycl::_V1::invalid, sycl::_V1::detail::reduction_impl< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::is_usm, and sycl::_V1::make_error_code().

Member Data Documentation

◆ is_known_identity

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
constexpr bool sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::is_known_identity
staticconstexpr

◆ is_usm

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
constexpr bool sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::is_usm
staticconstexpr

The documentation for this class was generated from the following file: