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

#include <sycl/reduction.hpp>

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

Public Types

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
 

Public Member Functions

 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 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
 

Detailed Description

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

Definition at line 832 of file reduction.hpp.

Member Typedef Documentation

◆ binary_operation

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
using sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::binary_operation = BinaryOperation

Definition at line 871 of file reduction.hpp.

◆ identity_container_type

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
using sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::identity_container_type = ReductionIdentityContainer<T, BinaryOperation, ExplicitIdentity>

Definition at line 862 of file reduction.hpp.

◆ reducer_element_type

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
using sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::reducer_element_type = typename ReducerTraits<reducer_type>::element_type

Definition at line 868 of file reduction.hpp.

◆ reducer_token_type

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
using sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::reducer_token_type = detail::ReducerToken<BinaryOperation, identity_container_type>

Definition at line 864 of file reduction.hpp.

◆ reducer_type

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
using sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::reducer_type = reducer<T, BinaryOperation, Dims, Extent, identity_container_type>

Definition at line 866 of file reduction.hpp.

◆ result_type

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
using sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::result_type = T

Definition at line 870 of file reduction.hpp.

Constructor & Destructor Documentation

◆ reduction_impl_algo() [1/3]

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::reduction_impl_algo ( const T &  Identity,
BinaryOperation  BinaryOp,
bool  Init,
RedOutVar  RedOut 
)
inline

Definition at line 885 of file reduction.hpp.

◆ reduction_impl_algo() [2/3]

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
template<typename RelayT = T, typename RelayBinaryOperation = BinaryOperation>
sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::reduction_impl_algo ( BinaryOperation  BinaryOp,
bool  Init,
RedOutVar  RedOut,
std::enable_if_t< IsKnownIdentityOp< RelayT, RelayBinaryOperation >::value, int >  = 0 
)
inline

Definition at line 892 of file reduction.hpp.

◆ reduction_impl_algo() [3/3]

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
template<typename RelayT = T, typename RelayBinaryOperation = BinaryOperation>
sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::reduction_impl_algo ( BinaryOperation  BinaryOp,
bool  Init,
RedOutVar  RedOut,
std::enable_if_t<!IsKnownIdentityOp< RelayT, RelayBinaryOperation >::value, int >  = 0 
)
inline

Definition at line 902 of file reduction.hpp.

Member Function Documentation

◆ getBinaryOperation()

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
BinaryOperation sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::getBinaryOperation ( ) const
inline

Returns the binary operation associated with the reduction.

Definition at line 1077 of file reduction.hpp.

Referenced by sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::withInitializedMem().

◆ getGroupsCounterAccDiscrete()

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
auto sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::getGroupsCounterAccDiscrete ( handler CGH)
inline

◆ getIdentityContainer()

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
const identity_container_type& sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::getIdentityContainer ( )
inline

Definition at line 1045 of file reduction.hpp.

◆ getReadAccToPreviousPartialReds()

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
auto sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::getReadAccToPreviousPartialReds ( handler CGH) const
inline

Definition at line 909 of file reduction.hpp.

◆ getReadWriteAccessorToInitializedGroupsCounter()

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
accessor<int, 1, access::mode::read_write, access::target::device, access::placeholder::false_t> sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::getReadWriteAccessorToInitializedGroupsCounter ( handler CGH)
inline

Definition at line 1051 of file reduction.hpp.

◆ getTempBuffer()

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
template<class _T = T>
auto& sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::getTempBuffer ( size_t  Size,
handler CGH 
)
inline

Definition at line 928 of file reduction.hpp.

◆ getUserRedVarAccess()

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
auto sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::getUserRedVarAccess ( handler CGH)
inline

◆ getWriteAccForPartialReds()

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
auto sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::getWriteAccForPartialReds ( size_t  Size,
handler CGH 
)
inline

Returns an accessor accessing the memory that will hold the reduction partial sums.

If Size is equal to one, then the reduction result is the final and needs to be written to user's read-write accessor (if there is such). Otherwise, a new buffer is created and accessor to that buffer is returned.

Definition at line 940 of file reduction.hpp.

References sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::has_identity, and sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::is_usm.

◆ getWriteMemForPartialReds()

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
template<bool IsOneWG>
auto sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::getWriteMemForPartialReds ( size_t  Size,
handler CGH 
)
inline

◆ initializeToIdentity()

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
bool sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::initializeToIdentity ( ) const
inline

◆ withInitializedMem() [1/2]

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
template<typename KernelName , typename FuncTy , bool HasIdentity = has_identity>
std::enable_if_t<HasIdentity> sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::withInitializedMem ( handler CGH,
FuncTy  Func 
)
inline

◆ withInitializedMem() [2/2]

template<typename T , class BinaryOperation , int Dims, size_t Extent, bool ExplicitIdentity, typename RedOutVar >
template<typename KernelName , typename FuncTy , bool HasIdentity = has_identity>
std::enable_if_t<!HasIdentity> sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, ExplicitIdentity, RedOutVar >::withInitializedMem ( handler CGH,
FuncTy  Func 
)
inline

Member Data Documentation

◆ dims

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

Definition at line 873 of file reduction.hpp.

◆ has_fast_atomics

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 >::has_fast_atomics
staticconstexpr
Initial value:
=
IsReduOptForFastAtomicFetch<T, BinaryOperation>::value

Definition at line 876 of file reduction.hpp.

◆ has_fast_reduce

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 >::has_fast_reduce
staticconstexpr
Initial value:
=
IsReduOptForFastReduce<T, BinaryOperation>::value

Definition at line 878 of file reduction.hpp.

◆ has_float64_atomics

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 >::has_float64_atomics
staticconstexpr
Initial value:
=
IsReduOptForAtomic64Op<T, BinaryOperation>::value

Definition at line 874 of file reduction.hpp.

◆ has_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 >::has_identity = is_known_identity || ExplicitIdentity
staticconstexpr

◆ 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
Initial value:
=
IsKnownIdentityOp<T, BinaryOperation>::value

Definition at line 858 of file reduction.hpp.

◆ 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 = std::is_same_v<RedOutVar, T *>
staticconstexpr

◆ num_elements

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

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