DPC++ Runtime
Runtime libraries for oneAPI Data Parallel C++
cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder > Class Template Reference

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

#include <CL/sycl/handler.hpp>

Collaboration diagram for cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >:

Public Types

using reducer_type = reducer< T, BinaryOperation >
 
using result_type = T
 
using binary_operation = BinaryOperation
 
using rw_accessor_type = accessor< T, Dims, access::mode::read_write, access::target::device, IsPlaceholder, ext::oneapi::accessor_property_list<> >
 
using dw_accessor_type = accessor< T, Dims, access::mode::discard_write, access::target::device, IsPlaceholder, ext::oneapi::accessor_property_list<> >
 

Public Member Functions

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...
 
template<typename _T , typename AllocatorT , std::enable_if_t< IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
 reduction_impl (buffer< _T, 1, AllocatorT > Buffer, handler &CGH, bool InitializeToIdentity)
 SYCL-2020. More...
 
template<typename _T = T, enable_if_t< IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
 reduction_impl (rw_accessor_type &Acc)
 Constructs reduction_impl when the identity value is statically known. More...
 
template<typename _T = T, enable_if_t< IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
 reduction_impl (dw_accessor_type &Acc)
 Constructs reduction_impl when the identity value is statically known. More...
 
template<typename _T , typename AllocatorT , enable_if_t< IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
 reduction_impl (buffer< _T, 1, AllocatorT > Buffer, handler &CGH, const T &, BinaryOperation, bool InitializeToIdentity)
 SYCL-2020. More...
 
template<typename _T = T, enable_if_t< IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
 reduction_impl (rw_accessor_type &Acc, const T &, BinaryOperation)
 Constructs reduction_impl when the identity value is statically known, and user still passed the identity value. More...
 
template<typename _T = T, enable_if_t< IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
 reduction_impl (dw_accessor_type &Acc, const T &, BinaryOperation)
 Constructs reduction_impl when the identity value is statically known, and user still passed the identity value. More...
 
template<typename _T , typename AllocatorT , enable_if_t<!IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
 reduction_impl (buffer< _T, 1, AllocatorT > Buffer, handler &CGH, const T &Identity, BinaryOperation BOp, bool InitializeToIdentity)
 SYCL-2020. More...
 
template<typename _T = T, enable_if_t<!IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
 reduction_impl (rw_accessor_type &Acc, const T &Identity, BinaryOperation BOp)
 Constructs reduction_impl when the identity value is unknown. More...
 
template<typename _T = T, enable_if_t<!IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
 reduction_impl (dw_accessor_type &Acc, const T &Identity, BinaryOperation BOp)
 Constructs reduction_impl when the identity value is unknown. More...
 
template<typename _T = T, enable_if_t< IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
 reduction_impl (T *VarPtr, bool InitializeToIdentity=false)
 Constructs reduction_impl when the identity value is statically known. More...
 
template<typename _T = T, enable_if_t< IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
 reduction_impl (T *VarPtr, const T &Identity, BinaryOperation, bool InitializeToIdentity=false)
 Constructs reduction_impl when the identity value is statically known, and user still passed the identity value. More...
 
template<typename _T = T, enable_if_t<!IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
 reduction_impl (T *VarPtr, const T &Identity, BinaryOperation BOp, bool InitializeToIdentity=false)
 Constructs reduction_impl when the identity value is unknown. More...
 
void associateWithHandler (handler &CGH)
 Associates the reduction accessor to user's memory with CGH handler to keep the accessor alive until the command group finishes the work. More...
 
accessor< T, buffer_dim, access::mode::readgetReadAccToPreviousPartialReds (handler &CGH) const
 
template<bool IsOneWG, bool _IsUSM = is_usm>
std::enable_if_t< IsOneWG &&_IsUSM, result_type * > getWriteMemForPartialReds (size_t, handler &)
 Returns user's USM pointer passed to reduction for editing. More...
 
template<bool IsOneWG, bool _IsUSM = is_usm>
std::enable_if_t< IsOneWG &&!_IsUSM, rw_accessor_typegetWriteMemForPartialReds (size_t, handler &CGH)
 Returns user's accessor passed to reduction for editing if that is the read-write accessor. More...
 
template<bool IsOneWG>
std::enable_if_t<!IsOneWG, rw_accessor_typegetWriteMemForPartialReds (size_t Size, handler &CGH)
 Constructs a new temporary buffer to hold partial sums and returns the accessor for that buffer. More...
 
rw_accessor_type getWriteAccForPartialReds (size_t Size, handler &CGH)
 Returns an accessor accessing the memory that will hold the reduction partial sums. More...
 
template<bool HasFastAtomics = (has_fast_atomics || has_atomic_add_float64)>
std::enable_if_t< HasFastAtomics, rw_accessor_typegetReadWriteAccessorToInitializedMem (handler &CGH)
 If reduction is initialized with read-write accessor, which does not require initialization with identity value, then return user's read-write accessor. More...
 
accessor< int, 1, access::mode::read_write, access::target::device, access::placeholder::false_tgetReadWriteAccessorToInitializedGroupsCounter (handler &CGH)
 
bool hasUserDiscardWriteAccessor ()
 
template<bool _IsUSM = IsUSM>
std::enable_if_t<!_IsUSM, rw_accessor_type & > getUserReadWriteAccessor ()
 
template<bool _IsUSM = IsUSM>
std::enable_if_t<!_IsUSM, dw_accessor_type & > getUserDiscardWriteAccessor ()
 
result_typegetUSMPointer ()
 
BinaryOperation getBinaryOperation () const
 Returns the binary operation associated with the reduction. More...
 
bool initializeToIdentity () const
 

Static Public Member Functions

template<typename _T = result_type>
static accessor< _T, buffer_dim, access::mode::read_write, access::target::localgetReadWriteLocalAcc (size_t Size, handler &CGH)
 Creates and returns a local accessor with the Size elements. More...
 
static result_typegetOutPointer (const rw_accessor_type &OutAcc)
 
static result_typegetOutPointer (result_type *OutPtr)
 

Static Public Attributes

static constexpr int accessor_dim = Dims
 
static constexpr int buffer_dim = (Dims == 0) ? 1 : Dims
 
static constexpr bool has_atomic_add_float64
 
static constexpr bool has_fast_atomics
 
static constexpr bool has_fast_reduce
 
static constexpr bool is_usm = IsUSM
 
static constexpr bool is_placeholder
 

Detailed Description

template<typename T, class BinaryOperation, int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
class cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >

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

Definition at line 245 of file handler.hpp.

Member Typedef Documentation

◆ binary_operation

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
using cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::binary_operation = BinaryOperation

Definition at line 377 of file reduction.hpp.

◆ dw_accessor_type

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
using cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::dw_accessor_type = accessor<T, Dims, access::mode::discard_write, access::target::device, IsPlaceholder, ext::oneapi::accessor_property_list<> >

Definition at line 383 of file reduction.hpp.

◆ reducer_type

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
using cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::reducer_type = reducer<T, BinaryOperation>

Definition at line 375 of file reduction.hpp.

◆ result_type

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
using cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::result_type = T

Definition at line 376 of file reduction.hpp.

◆ rw_accessor_type

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
using cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::rw_accessor_type = accessor<T, Dims, access::mode::read_write, access::target::device, IsPlaceholder, ext::oneapi::accessor_property_list<> >

Definition at line 380 of file reduction.hpp.

Constructor & Destructor Documentation

◆ reduction_impl() [1/12]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<typename _T , typename AllocatorT , std::enable_if_t< IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::reduction_impl ( buffer< _T, 1, AllocatorT >  Buffer,
handler CGH,
bool  InitializeToIdentity 
)
inline

SYCL-2020.

Constructs reduction_impl when the identity value is statically known.

Definition at line 423 of file reduction.hpp.

References cl::sycl::detail::associateWithHandler(), PI_INVALID_VALUE, and cl::sycl::buffer< T, dimensions, AllocatorT, __Enabled >::size().

◆ reduction_impl() [2/12]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<typename _T = T, enable_if_t< IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::reduction_impl ( rw_accessor_type Acc)
inline

Constructs reduction_impl when the identity value is statically known.

Definition at line 437 of file reduction.hpp.

References PI_INVALID_VALUE, and cl::sycl::accessor< DataT, Dimensions, AccessMode, AccessTarget, IsPlaceholder, PropertyListT >::size().

◆ reduction_impl() [3/12]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<typename _T = T, enable_if_t< IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::reduction_impl ( dw_accessor_type Acc)
inline

Constructs reduction_impl when the identity value is statically known.

Definition at line 449 of file reduction.hpp.

References PI_INVALID_VALUE, and cl::sycl::accessor< DataT, Dimensions, AccessMode, AccessTarget, IsPlaceholder, PropertyListT >::size().

◆ reduction_impl() [4/12]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<typename _T , typename AllocatorT , enable_if_t< IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::reduction_impl ( buffer< _T, 1, AllocatorT >  Buffer,
handler CGH,
const T ,
BinaryOperation  ,
bool  InitializeToIdentity 
)
inline

SYCL-2020.

Constructs reduction_impl when the identity value is statically known, and user still passed the identity value.

Definition at line 463 of file reduction.hpp.

References cl::sycl::detail::associateWithHandler(), PI_INVALID_VALUE, and cl::sycl::buffer< T, dimensions, AllocatorT, __Enabled >::size().

◆ reduction_impl() [5/12]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<typename _T = T, enable_if_t< IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::reduction_impl ( rw_accessor_type Acc,
const T ,
BinaryOperation   
)
inline

Constructs reduction_impl when the identity value is statically known, and user still passed the identity value.

Definition at line 490 of file reduction.hpp.

References PI_INVALID_VALUE, and cl::sycl::accessor< DataT, Dimensions, AccessMode, AccessTarget, IsPlaceholder, PropertyListT >::size().

◆ reduction_impl() [6/12]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<typename _T = T, enable_if_t< IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::reduction_impl ( dw_accessor_type Acc,
const T ,
BinaryOperation   
)
inline

Constructs reduction_impl when the identity value is statically known, and user still passed the identity value.

Definition at line 514 of file reduction.hpp.

References PI_INVALID_VALUE, and cl::sycl::accessor< DataT, Dimensions, AccessMode, AccessTarget, IsPlaceholder, PropertyListT >::size().

◆ reduction_impl() [7/12]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<typename _T , typename AllocatorT , enable_if_t<!IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::reduction_impl ( buffer< _T, 1, AllocatorT >  Buffer,
handler CGH,
const T Identity,
BinaryOperation  BOp,
bool  InitializeToIdentity 
)
inline

SYCL-2020.

Constructs reduction_impl when the identity value is NOT known statically.

Definition at line 538 of file reduction.hpp.

References cl::sycl::detail::associateWithHandler(), PI_INVALID_VALUE, and cl::sycl::buffer< T, dimensions, AllocatorT, __Enabled >::size().

◆ reduction_impl() [8/12]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<typename _T = T, enable_if_t<!IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::reduction_impl ( rw_accessor_type Acc,
const T Identity,
BinaryOperation  BOp 
)
inline

◆ reduction_impl() [9/12]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<typename _T = T, enable_if_t<!IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::reduction_impl ( dw_accessor_type Acc,
const T Identity,
BinaryOperation  BOp 
)
inline

◆ reduction_impl() [10/12]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<typename _T = T, enable_if_t< IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::reduction_impl ( T VarPtr,
bool  InitializeToIdentity = false 
)
inline

Constructs reduction_impl when the identity value is statically known.

The

Parameters
VarPtris a USM pointer to memory, to where the computed reduction value is added using BinaryOperation, i.e. it is expected that the memory is pre-initialized with some meaningful value.

Definition at line 580 of file reduction.hpp.

◆ reduction_impl() [11/12]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<typename _T = T, enable_if_t< IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::reduction_impl ( T VarPtr,
const T Identity,
BinaryOperation  ,
bool  InitializeToIdentity = false 
)
inline

Constructs reduction_impl when the identity value is statically known, and user still passed the identity value.

The

Parameters
VarPtris a USM pointer to memory, to where the computed reduction value is added using BinaryOperation, i.e. it is expected that the memory is pre-initialized with some meaningful value.

Definition at line 592 of file reduction.hpp.

◆ reduction_impl() [12/12]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<typename _T = T, enable_if_t<!IsKnownIdentityOp< _T, BinaryOperation >::value > * = nullptr>
cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::reduction_impl ( T VarPtr,
const T Identity,
BinaryOperation  BOp,
bool  InitializeToIdentity = false 
)
inline

Constructs reduction_impl when the identity value is unknown.

The

Parameters
VarPtris a USM pointer to memory, to where the computed reduction value is added using BinaryOperation, i.e. it is expected that the memory is pre-initialized with some meaningful value.

Definition at line 616 of file reduction.hpp.

Member Function Documentation

◆ associateWithHandler()

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
void cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::associateWithHandler ( handler CGH)
inline

Associates the reduction accessor to user's memory with CGH handler to keep the accessor alive until the command group finishes the work.

This function does not do anything for USM reductions.

Definition at line 624 of file reduction.hpp.

◆ getBinaryOperation()

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
BinaryOperation cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::getBinaryOperation ( ) const
inline

Returns the binary operation associated with the reduction.

Definition at line 752 of file reduction.hpp.

◆ getIdentity() [1/2]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<typename _T = T, class _BinaryOperation = BinaryOperation>
constexpr enable_if_t<IsKnownIdentityOp<_T, _BinaryOperation>::value, _T> cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::getIdentity ( )
inlineconstexpr

Returns the statically known identity value.

Definition at line 407 of file reduction.hpp.

◆ getIdentity() [2/2]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<typename _T = T, class _BinaryOperation = BinaryOperation>
enable_if_t<!IsKnownIdentityOp<_T, _BinaryOperation>::value, _T> cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::getIdentity ( )
inline

Returns the identity value given by user.

Definition at line 414 of file reduction.hpp.

◆ getOutPointer() [1/2]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
static result_type* cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::getOutPointer ( const rw_accessor_type OutAcc)
inlinestatic

◆ getOutPointer() [2/2]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
static result_type* cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::getOutPointer ( result_type OutPtr)
inlinestatic

Definition at line 747 of file reduction.hpp.

◆ getReadAccToPreviousPartialReds()

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
accessor<T, buffer_dim, access::mode::read> cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::getReadAccToPreviousPartialReds ( handler CGH) const
inline

Definition at line 647 of file reduction.hpp.

◆ getReadWriteAccessorToInitializedGroupsCounter()

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
accessor<int, 1, access::mode::read_write, access::target::device, access::placeholder::false_t> cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::getReadWriteAccessorToInitializedGroupsCounter ( handler CGH)
inline

Definition at line 718 of file reduction.hpp.

◆ getReadWriteAccessorToInitializedMem()

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<bool HasFastAtomics = (has_fast_atomics || has_atomic_add_float64)>
std::enable_if_t<HasFastAtomics, rw_accessor_type> cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::getReadWriteAccessorToInitializedMem ( handler CGH)
inline

If reduction is initialized with read-write accessor, which does not require initialization with identity value, then return user's read-write accessor.

Otherwise, create 1-element global buffer initialized with identity value and return an accessor to that buffer.

Definition at line 705 of file reduction.hpp.

◆ getReadWriteLocalAcc()

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<typename _T = result_type>
static accessor<_T, buffer_dim, access::mode::read_write, access::target::local> cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::getReadWriteLocalAcc ( size_t  Size,
handler CGH 
)
inlinestatic

Creates and returns a local accessor with the Size elements.

By default the local accessor elements are of the same type as the elements processed by the reduction, but may it be altered by specifying _T explicitly if need an accessor with elements of different type.

Definition at line 642 of file reduction.hpp.

◆ getUserDiscardWriteAccessor()

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<bool _IsUSM = IsUSM>
std::enable_if_t<!_IsUSM, dw_accessor_type &> cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::getUserDiscardWriteAccessor ( )
inline

Definition at line 734 of file reduction.hpp.

◆ getUserReadWriteAccessor()

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<bool _IsUSM = IsUSM>
std::enable_if_t<!_IsUSM, rw_accessor_type &> cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::getUserReadWriteAccessor ( )
inline

Definition at line 729 of file reduction.hpp.

◆ getUSMPointer()

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
result_type* cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::getUSMPointer ( )
inline

Definition at line 738 of file reduction.hpp.

◆ getWriteAccForPartialReds()

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
rw_accessor_type cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::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 686 of file reduction.hpp.

References cl::sycl::detail::associateWithHandler().

◆ getWriteMemForPartialReds() [1/3]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<bool IsOneWG>
std::enable_if_t<!IsOneWG, rw_accessor_type> cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::getWriteMemForPartialReds ( size_t  Size,
handler CGH 
)
inline

Constructs a new temporary buffer to hold partial sums and returns the accessor for that buffer.

Definition at line 674 of file reduction.hpp.

◆ getWriteMemForPartialReds() [2/3]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<bool IsOneWG, bool _IsUSM = is_usm>
std::enable_if_t<IsOneWG && _IsUSM, result_type *> cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::getWriteMemForPartialReds ( size_t  ,
handler  
)
inline

Returns user's USM pointer passed to reduction for editing.

Definition at line 655 of file reduction.hpp.

◆ getWriteMemForPartialReds() [3/3]

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
template<bool IsOneWG, bool _IsUSM = is_usm>
std::enable_if_t<IsOneWG && !_IsUSM, rw_accessor_type> cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::getWriteMemForPartialReds ( size_t  ,
handler CGH 
)
inline

Returns user's accessor passed to reduction for editing if that is the read-write accessor.

Otherwise, create a new buffer and return read-write accessor to it.

Definition at line 664 of file reduction.hpp.

◆ hasUserDiscardWriteAccessor()

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
bool cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::hasUserDiscardWriteAccessor ( )
inline

Definition at line 726 of file reduction.hpp.

◆ initializeToIdentity()

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
bool cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::initializeToIdentity ( ) const
inline

Definition at line 753 of file reduction.hpp.

References cl::sycl::detail::InitializeToIdentity.

Member Data Documentation

◆ accessor_dim

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
constexpr int cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::accessor_dim = Dims
staticconstexpr

Definition at line 384 of file reduction.hpp.

◆ buffer_dim

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
constexpr int cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::buffer_dim = (Dims == 0) ? 1 : Dims
staticconstexpr

Definition at line 385 of file reduction.hpp.

◆ has_atomic_add_float64

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
constexpr bool cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::has_atomic_add_float64
staticconstexpr
Initial value:
=
IsReduOptForAtomic64Add<T, BinaryOperation>::value

Definition at line 387 of file reduction.hpp.

◆ has_fast_atomics

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
constexpr bool cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::has_fast_atomics
staticconstexpr
Initial value:
=
IsReduOptForFastAtomicFetch<T, BinaryOperation>::value

Definition at line 389 of file reduction.hpp.

◆ has_fast_reduce

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
constexpr bool cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::has_fast_reduce
staticconstexpr
Initial value:
=
IsReduOptForFastReduce<T, BinaryOperation>::value

Definition at line 391 of file reduction.hpp.

◆ is_placeholder

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
constexpr bool cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::is_placeholder
staticconstexpr
Initial value:
=
(IsPlaceholder == access::placeholder::true_t)

Definition at line 394 of file reduction.hpp.

◆ is_usm

template<typename T , class BinaryOperation , int Dims, bool IsUSM, access::placeholder IsPlaceholder = access::placeholder::false_t>
constexpr bool cl::sycl::ext::oneapi::detail::reduction_impl< T, BinaryOperation, Dims, IsUSM, IsPlaceholder >::is_usm = IsUSM
staticconstexpr

Definition at line 393 of file reduction.hpp.


The documentation for this class was generated from the following files:
cl::sycl::access::placeholder::true_t
@ true_t