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

#include <sycl/reduction.hpp>

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

Public Types

using reducer_type = reducer< T, BinaryOperation, Dims, Extent >
 
using result_type = T
 
using binary_operation = BinaryOperation
 

Public Member Functions

 reduction_impl_algo (const T &Identity, BinaryOperation BinaryOp, bool Init, RedOutVar RedOut)
 
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 >
void withInitializedMem (handler &CGH, FuncTy Func)
 Provide Func with a properly initialized memory to write the reduction result to. More...
 
accessor< int, 1, access::mode::read_write, access::target::device, access::placeholder::false_tgetReadWriteAccessorToInitializedGroupsCounter (handler &CGH)
 
auto getGroupsCounterAccDiscrete (handler &CGH)
 
RedOutVar & getUserRedVar ()
 
- Public Member Functions inherited from sycl::_V1::detail::reduction_impl_common< T, BinaryOperation >
template<typename _T = T, class _BinaryOperation = BinaryOperation>
constexpr enable_if_t< IsKnownIdentityOp< _T, _BinaryOperation >::value, _T > getIdentity ()
 Returns the statically known identity value. More...
 
template<typename _T = T, class _BinaryOperation = BinaryOperation>
enable_if_t<!IsKnownIdentityOp< _T, _BinaryOperation >::value, _T > getIdentity ()
 Returns the identity value given by user. More...
 
BinaryOperation getBinaryOperation () const
 Returns the binary operation associated with the reduction. More...
 
bool initializeToIdentity () const
 

Static Public Attributes

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

- Protected Member Functions inherited from sycl::_V1::detail::reduction_impl_common< T, BinaryOperation >
 reduction_impl_common (const T &Identity, BinaryOperation BinaryOp, bool Init=false)
 
- Protected Attributes inherited from sycl::_V1::detail::reduction_impl_common< T, BinaryOperation >
const T MIdentity
 Identity of the BinaryOperation. More...
 
BinaryOperation MBinaryOp
 
bool InitializeToIdentity
 

Detailed Description

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

Definition at line 554 of file reduction.hpp.

Member Typedef Documentation

◆ binary_operation

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

Definition at line 561 of file reduction.hpp.

◆ reducer_type

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

Definition at line 559 of file reduction.hpp.

◆ result_type

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

Definition at line 560 of file reduction.hpp.

Constructor & Destructor Documentation

◆ reduction_impl_algo()

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

Definition at line 575 of file reduction.hpp.

Member Function Documentation

◆ getGroupsCounterAccDiscrete()

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

◆ getReadAccToPreviousPartialReds()

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

Definition at line 579 of file reduction.hpp.

◆ getReadWriteAccessorToInitializedGroupsCounter()

template<typename T , class BinaryOperation , int Dims, size_t Extent, 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, RedOutVar >::getReadWriteAccessorToInitializedGroupsCounter ( handler CGH)
inline

Definition at line 695 of file reduction.hpp.

◆ getTempBuffer()

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

Definition at line 597 of file reduction.hpp.

◆ getUserRedVar()

template<typename T , class BinaryOperation , int Dims, size_t Extent, typename RedOutVar >
RedOutVar& sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, RedOutVar >::getUserRedVar ( )
inline

Definition at line 720 of file reduction.hpp.

◆ getWriteAccForPartialReds()

template<typename T , class BinaryOperation , int Dims, size_t Extent, typename RedOutVar >
auto sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, 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 609 of file reduction.hpp.

◆ getWriteMemForPartialReds()

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

Definition at line 585 of file reduction.hpp.

◆ withInitializedMem()

template<typename T , class BinaryOperation , int Dims, size_t Extent, typename RedOutVar >
template<typename KernelName , typename FuncTy >
void sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, RedOutVar >::withInitializedMem ( handler CGH,
FuncTy  Func 
)
inline

Provide Func with a properly initialized memory to write the reduction result to.

It can either be original user's reduction variable or a newly allocated memory initialized with reduction's identity. In the later case, after the Func finishes, update original user's variable accordingly (i.e., honoring initialize_to_identity property).

Definition at line 634 of file reduction.hpp.

References sycl::_V1::detail::associateWithHandler(), sycl::_V1::handler::copy(), sycl::_V1::handler::single_task(), and sycl::_V1::detail::reduction::withAuxHandler().

Member Data Documentation

◆ dims

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

Definition at line 563 of file reduction.hpp.

◆ has_fast_atomics

template<typename T , class BinaryOperation , int Dims, size_t Extent, typename RedOutVar >
constexpr bool sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, RedOutVar >::has_fast_atomics
staticconstexpr
Initial value:
=
IsReduOptForFastAtomicFetch<T, BinaryOperation>::value

Definition at line 566 of file reduction.hpp.

◆ has_fast_reduce

template<typename T , class BinaryOperation , int Dims, size_t Extent, typename RedOutVar >
constexpr bool sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, RedOutVar >::has_fast_reduce
staticconstexpr
Initial value:
=
IsReduOptForFastReduce<T, BinaryOperation>::value

Definition at line 568 of file reduction.hpp.

◆ has_float64_atomics

template<typename T , class BinaryOperation , int Dims, size_t Extent, typename RedOutVar >
constexpr bool sycl::_V1::detail::reduction_impl_algo< T, BinaryOperation, Dims, Extent, RedOutVar >::has_float64_atomics
staticconstexpr
Initial value:
=
IsReduOptForAtomic64Op<T, BinaryOperation>::value

Definition at line 564 of file reduction.hpp.

◆ is_usm

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

Definition at line 571 of file reduction.hpp.

◆ num_elements

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

Definition at line 573 of file reduction.hpp.


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