Eigen::TensorSycl::internal::SecondStepPartialReduction< OutScalar, Index, InputAccessor, OutputAccessor, OpType > Struct Template Reference

#include <TensorReductionSycl.h>

Public Types

typedef OpDefiner< OpType, OutScalar, Index, false > OpDef
 
typedef OpDef::type Op
 
typedef cl::sycl::accessor< OutScalar, 1, cl::sycl::access::mode::read_write, cl::sycl::access::target::local > ScratchAccessor
 

Public Member Functions

EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE SecondStepPartialReduction (ScratchAccessor, InputAccessor input_accessor_, OutputAccessor output_accessor_, OpType op_, const Index num_coeffs_to_preserve_, const Index num_coeffs_to_reduce_)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void operator() (cl::sycl::nd_item< 1 > itemID) const
 

Public Attributes

InputAccessor input_accessor
 
OutputAccessor output_accessor
 
Op op
 
const Index num_coeffs_to_preserve
 
const Index num_coeffs_to_reduce
 

Member Typedef Documentation

◆ Op

template<typename OutScalar , typename Index , typename InputAccessor , typename OutputAccessor , typename OpType >
typedef OpDef::type Eigen::TensorSycl::internal::SecondStepPartialReduction< OutScalar, Index, InputAccessor, OutputAccessor, OpType >::Op

◆ OpDef

template<typename OutScalar , typename Index , typename InputAccessor , typename OutputAccessor , typename OpType >
typedef OpDefiner<OpType, OutScalar, Index, false> Eigen::TensorSycl::internal::SecondStepPartialReduction< OutScalar, Index, InputAccessor, OutputAccessor, OpType >::OpDef

◆ ScratchAccessor

template<typename OutScalar , typename Index , typename InputAccessor , typename OutputAccessor , typename OpType >
typedef cl::sycl::accessor<OutScalar, 1, cl::sycl::access::mode::read_write, cl::sycl::access::target::local> Eigen::TensorSycl::internal::SecondStepPartialReduction< OutScalar, Index, InputAccessor, OutputAccessor, OpType >::ScratchAccessor

Constructor & Destructor Documentation

◆ SecondStepPartialReduction()

template<typename OutScalar , typename Index , typename InputAccessor , typename OutputAccessor , typename OpType >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Eigen::TensorSycl::internal::SecondStepPartialReduction< OutScalar, Index, InputAccessor, OutputAccessor, OpType >::SecondStepPartialReduction ( ScratchAccessor  ,
InputAccessor  input_accessor_,
OutputAccessor  output_accessor_,
OpType  op_,
const Index  num_coeffs_to_preserve_,
const Index  num_coeffs_to_reduce_ 
)
inline
380  : input_accessor(input_accessor_),
381  output_accessor(output_accessor_),
382  op(OpDef::get_op(op_)),
383  num_coeffs_to_preserve(num_coeffs_to_preserve_),
384  num_coeffs_to_reduce(num_coeffs_to_reduce_) {}
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE type get_op(Op &op)
Definition: TensorReductionSycl.h:41
OutputAccessor output_accessor
Definition: TensorReductionSycl.h:371
const Index num_coeffs_to_preserve
Definition: TensorReductionSycl.h:373
const Index num_coeffs_to_reduce
Definition: TensorReductionSycl.h:374
Op op
Definition: TensorReductionSycl.h:372
InputAccessor input_accessor
Definition: TensorReductionSycl.h:370

Member Function Documentation

◆ operator()()

template<typename OutScalar , typename Index , typename InputAccessor , typename OutputAccessor , typename OpType >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void Eigen::TensorSycl::internal::SecondStepPartialReduction< OutScalar, Index, InputAccessor, OutputAccessor, OpType >::operator() ( cl::sycl::nd_item< 1 >  itemID) const
inline
386  {
387  const Index globalId = itemID.get_global_id(0);
388 
389  if (globalId >= num_coeffs_to_preserve) return;
390 
391  auto in_ptr = input_accessor + globalId;
392 
393  OutScalar accumulator = op.initialize();
394  // num_coeffs_to_reduce is not bigger that 256
395  for (Index i = 0; i < num_coeffs_to_reduce; i++) {
396  op.reduce(*in_ptr, &accumulator);
397  in_ptr += num_coeffs_to_preserve;
398  }
399  output_accessor[globalId] = op.finalize(accumulator);
400  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83

References i, Eigen::TensorSycl::internal::SecondStepPartialReduction< OutScalar, Index, InputAccessor, OutputAccessor, OpType >::input_accessor, Eigen::TensorSycl::internal::SecondStepPartialReduction< OutScalar, Index, InputAccessor, OutputAccessor, OpType >::num_coeffs_to_preserve, Eigen::TensorSycl::internal::SecondStepPartialReduction< OutScalar, Index, InputAccessor, OutputAccessor, OpType >::num_coeffs_to_reduce, Eigen::TensorSycl::internal::SecondStepPartialReduction< OutScalar, Index, InputAccessor, OutputAccessor, OpType >::op, and Eigen::TensorSycl::internal::SecondStepPartialReduction< OutScalar, Index, InputAccessor, OutputAccessor, OpType >::output_accessor.

Member Data Documentation

◆ input_accessor

template<typename OutScalar , typename Index , typename InputAccessor , typename OutputAccessor , typename OpType >
InputAccessor Eigen::TensorSycl::internal::SecondStepPartialReduction< OutScalar, Index, InputAccessor, OutputAccessor, OpType >::input_accessor

◆ num_coeffs_to_preserve

template<typename OutScalar , typename Index , typename InputAccessor , typename OutputAccessor , typename OpType >
const Index Eigen::TensorSycl::internal::SecondStepPartialReduction< OutScalar, Index, InputAccessor, OutputAccessor, OpType >::num_coeffs_to_preserve

◆ num_coeffs_to_reduce

template<typename OutScalar , typename Index , typename InputAccessor , typename OutputAccessor , typename OpType >
const Index Eigen::TensorSycl::internal::SecondStepPartialReduction< OutScalar, Index, InputAccessor, OutputAccessor, OpType >::num_coeffs_to_reduce

◆ op

template<typename OutScalar , typename Index , typename InputAccessor , typename OutputAccessor , typename OpType >
Op Eigen::TensorSycl::internal::SecondStepPartialReduction< OutScalar, Index, InputAccessor, OutputAccessor, OpType >::op

◆ output_accessor

template<typename OutScalar , typename Index , typename InputAccessor , typename OutputAccessor , typename OpType >
OutputAccessor Eigen::TensorSycl::internal::SecondStepPartialReduction< OutScalar, Index, InputAccessor, OutputAccessor, OpType >::output_accessor

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