11 #ifndef EIGEN_CXX11_TENSOR_TENSOR_REDUCTION_H 12 #define EIGEN_CXX11_TENSOR_TENSOR_REDUCTION_H 24 template<
typename Op,
typename Dims,
typename XprType,
template <
class>
class MakePointer_ >
32 typedef typename XprType::Nested
Nested;
34 static const int Layout = XprTraits::Layout;
43 template<
typename Op,
typename Dims,
typename XprType,
template <
class>
class MakePointer_>
49 template<
typename Op,
typename Dims,
typename XprType,
template <
class>
class MakePointer_>
57 template <
typename InputDims,
typename ReducedDims> EIGEN_DEVICE_FUNC
58 static void run(
const InputDims& input_dims,
60 OutputDims* output_dims, ReducedDims* reduced_dims) {
64 for (
int i = 0;
i < NumInputDims; ++
i) {
66 (*reduced_dims)[reduceIndex] = input_dims[
i];
69 (*output_dims)[outputIndex] = input_dims[
i];
77 template <
typename InputDims,
typename Index,
size_t Rank> EIGEN_DEVICE_FUNC
81 for (
int i = 0;
i < NumInputDims; ++
i) {
82 (*reduced_dims)[
i] = input_dims[
i];
88 template <
typename ReducedDims,
int NumTensorDims,
int Layout>
90 static const bool value =
false;
92 template <
typename ReducedDims,
int NumTensorDims,
int Layout>
94 static const bool value =
false;
97 #if EIGEN_HAS_CONSTEXPR && EIGEN_HAS_VARIADIC_TEMPLATES 98 template <
typename ReducedDims,
int NumTensorDims>
100 static const bool tmp1 = indices_statically_known_to_increase<ReducedDims>();
101 static const bool tmp2 = index_statically_eq<ReducedDims>(0, 0);
103 static const bool value = tmp1 & tmp2 & tmp3;
105 template <
typename ReducedDims,
int NumTensorDims>
107 static const bool tmp1 = indices_statically_known_to_increase<ReducedDims>();
110 static const bool value = tmp1 & tmp2 & tmp3;
113 template <
typename ReducedDims,
int NumTensorDims>
115 static const bool tmp1 = indices_statically_known_to_increase<ReducedDims>();
116 static const bool tmp2 = index_statically_gt<ReducedDims>(0, 0);
117 static const bool value = tmp1 & tmp2;
120 template <
typename ReducedDims,
int NumTensorDims>
122 static const bool tmp1 = indices_statically_known_to_increase<ReducedDims>();
124 static const bool value = tmp1 & tmp2;
129 template <
int DimIndex,
typename Self,
typename Op>
133 for (
int j = 0;
j <
self.m_reducedDims[DimIndex]; ++
j) {
134 const typename Self::Index input = firstIndex +
j *
self.m_reducedStrides[DimIndex];
139 template <
typename Self,
typename Op>
142 for (
int j = 0;
j <
self.m_reducedDims[0]; ++
j) {
143 const typename Self::Index input = firstIndex +
j *
self.m_reducedStrides[0];
144 reducer.reduce(
self.m_impl.coeff(input), accum);
148 template <
typename Self,
typename Op>
151 reducer.reduce(
self.m_impl.coeff(index), accum);
155 template <
typename Self,
typename Op,
bool Vectorizable = (Self::InputPacketAccess & Op::PacketAccess)>
158 typename Self::CoeffReturnType accum = reducer.initialize();
160 reducer.reduce(
self.m_impl.coeff(firstIndex +
j), &accum);
162 return reducer.finalize(accum);
166 template <
typename Self,
typename Op>
170 const typename Self::Index VectorizedSize = (numValuesToReduce / packetSize) * packetSize;
171 typename Self::PacketReturnType
p = reducer.template initializePacket<typename Self::PacketReturnType>();
172 for (
typename Self::Index j = 0;
j < VectorizedSize;
j += packetSize) {
173 reducer.reducePacket(
self.m_impl.template packet<Unaligned>(firstIndex +
j), &p);
175 typename Self::CoeffReturnType accum = reducer.initialize();
176 for (
typename Self::Index j = VectorizedSize;
j < numValuesToReduce; ++
j) {
177 reducer.reduce(
self.m_impl.coeff(firstIndex +
j), &accum);
179 return reducer.finalizeBoth(accum, p);
183 template <
int DimIndex,
typename Self,
typename Op,
bool vectorizable = (Self::InputPacketAccess & Op::PacketAccess)>
190 template <
int DimIndex,
typename Self,
typename Op>
194 for (
typename Self::Index j = 0;
j <
self.m_reducedDims[DimIndex]; ++
j) {
195 const typename Self::Index input = firstIndex +
j *
self.m_reducedStrides[DimIndex];
201 template <
typename Self,
typename Op>
204 for (
typename Self::Index j = 0;
j <
self.m_reducedDims[0]; ++
j) {
205 const typename Self::Index input = firstIndex +
j *
self.m_reducedStrides[0];
206 reducer.reducePacket(
self.m_impl.template packet<Unaligned>(input), accum);
210 template <
typename Self,
typename Op>
218 template <
typename Self,
typename Op,
typename Device,
bool Vectorizable = (Self::InputPacketAccess & Op::PacketAccess)>
220 static const bool HasOptimizedImplementation =
false;
222 static EIGEN_DEVICE_FUNC
void run(
const Self&
self, Op& reducer,
const Device&,
typename Self::CoeffReturnType* output) {
229 #ifdef EIGEN_USE_THREADS 231 template <
typename Self,
typename Op,
232 bool Vectorizable = (Self::InputPacketAccess & Op::PacketAccess)>
233 struct FullReducerShard {
235 typename Self::Index numValuesToReduce, Op& reducer,
236 typename Self::CoeffReturnType* output) {
238 self, firstIndex, numValuesToReduce, reducer);
243 template <
typename Self,
typename Op,
bool Vectorizable>
245 static const bool HasOptimizedImplementation = !Op::IsStateful;
246 static const int PacketSize =
250 static void run(
const Self&
self, Op& reducer,
const ThreadPoolDevice& device,
251 typename Self::CoeffReturnType* output) {
253 const Index num_coeffs =
array_prod(
self.m_impl.dimensions());
254 if (num_coeffs == 0) {
255 *output = reducer.finalize(reducer.initialize());
259 self.m_impl.costPerCoeff(Vectorizable) +
263 num_coeffs, cost, device.numThreads());
264 if (num_threads == 1) {
269 const Index blocksize =
270 std::floor<Index>(
static_cast<float>(num_coeffs) / num_threads);
271 const Index numblocks = blocksize > 0 ? num_coeffs / blocksize : 0;
274 Barrier barrier(internal::convert_index<unsigned int>(numblocks));
276 for (Index
i = 0;
i < numblocks; ++
i) {
278 self,
i * blocksize, blocksize, reducer,
281 typename Self::CoeffReturnType finalShard;
282 if (numblocks * blocksize < num_coeffs) {
284 self, numblocks * blocksize, num_coeffs - numblocks * blocksize,
287 finalShard = reducer.initialize();
291 for (Index
i = 0;
i < numblocks; ++
i) {
292 reducer.reduce(shards[
i], &finalShard);
294 *output = reducer.finalize(finalShard);
302 template <
typename Self,
typename Op,
typename Device>
304 static const bool HasOptimizedImplementation =
false;
306 EIGEN_DEVICE_FUNC
static bool run(
const Self&, Op&,
const Device&,
typename Self::CoeffReturnType*,
typename Self::Index,
typename Self::Index) {
313 template <
typename Self,
typename Op,
typename Device>
315 static const bool HasOptimizedImplementation =
false;
317 EIGEN_DEVICE_FUNC
static bool run(
const Self&, Op&,
const Device&,
typename Self::CoeffReturnType*,
typename Self::Index,
typename Self::Index) {
324 #if defined(EIGEN_USE_GPU) && defined(__CUDACC__) 325 template <
int B,
int N,
typename S,
typename R,
typename I>
326 __global__
void FullReductionKernel(
R,
const S,
I,
typename S::CoeffReturnType*,
unsigned int*);
329 #ifdef EIGEN_HAS_CUDA_FP16 330 template <
typename S,
typename R,
typename I>
331 __global__
void ReductionInitFullReduxKernelHalfFloat(
R,
const S,
I, half2*);
332 template <
int B,
int N,
typename S,
typename R,
typename I>
333 __global__
void FullReductionKernelHalfFloat(
R,
const S,
I,
half*, half2*);
334 template <
int NPT,
typename S,
typename R,
typename I>
335 __global__
void InnerReductionKernelHalfFloat(
R,
const S,
I,
I,
half*);
339 template <
int NPT,
typename S,
typename R,
typename I>
340 __global__
void InnerReductionKernel(
R,
const S,
I,
I,
typename S::CoeffReturnType*);
342 template <
int NPT,
typename S,
typename R,
typename I>
343 __global__
void OuterReductionKernel(
R,
const S,
I,
I,
typename S::CoeffReturnType*);
349 template <
typename Op,
typename Dims,
typename XprType,
template <
class>
class MakePointer_>
363 TensorReductionOp(
const XprType& expr,
const Dims& dims,
const Op& reducer) : m_expr(expr), m_dims(dims), m_reducer(reducer)
369 const Dims&
dims()
const {
return m_dims; }
371 const Op&
reducer()
const {
return m_reducer; }
381 template<
typename Op,
typename Dims,
typename ArgType,
template <
class>
class MakePointer_,
typename Device>
390 static const int NumOutputDims = NumInputDims - NumReducedDims;
401 PacketAccess = Self::InputPacketAccess && Op::PacketAccess,
409 static const bool RunningFullReduction = (NumOutputDims==0);
412 : m_impl(op.expression(), device), m_reducer(op.reducer()), m_result(
NULL), m_device(device), m_xpr_dims(op.dims())
415 EIGEN_STATIC_ASSERT((!ReducingInnerMostDims | !PreservingInnerMostDims | (NumReducedDims == NumInputDims)),
416 YOU_MADE_A_PROGRAMMING_MISTAKE);
419 for (
int i = 0;
i < NumInputDims; ++
i) {
420 m_reduced[
i] =
false;
422 for (
int i = 0;
i < NumReducedDims; ++
i) {
425 m_reduced[op.
dims()[
i]] =
true;
432 if (NumOutputDims > 0) {
433 if (static_cast<int>(Layout) == static_cast<int>(
ColMajor)) {
434 m_outputStrides[0] = 1;
435 for (
int i = 1;
i < NumOutputDims; ++
i) {
436 m_outputStrides[
i] = m_outputStrides[
i - 1] * m_dimensions[
i - 1];
439 m_outputStrides.back() = 1;
440 for (
int i = NumOutputDims - 2;
i >= 0; --
i) {
441 m_outputStrides[
i] = m_outputStrides[
i + 1] * m_dimensions[
i + 1];
447 if (NumInputDims > 0) {
449 if (static_cast<int>(Layout) == static_cast<int>(
ColMajor)) {
450 input_strides[0] = 1;
451 for (
int i = 1;
i < NumInputDims; ++
i) {
452 input_strides[
i] = input_strides[
i-1] * input_dims[
i-1];
455 input_strides.
back() = 1;
456 for (
int i = NumInputDims - 2;
i >= 0; --
i) {
457 input_strides[
i] = input_strides[
i + 1] * input_dims[
i + 1];
463 for (
int i = 0;
i < NumInputDims; ++
i) {
465 m_reducedStrides[reduceIndex] = input_strides[
i];
468 m_preservedStrides[outputIndex] = input_strides[
i];
475 if (NumOutputDims == 0) {
483 m_impl.evalSubExprsIfNeeded(
NULL);
486 if ((RunningFullReduction && RunningOnSycl) ||(RunningFullReduction &&
488 ((RunningOnGPU && (m_device.majorDeviceVersion() >= 3)) ||
490 bool need_assign =
false;
492 m_result =
static_cast<CoeffReturnType*
>(m_device.allocate(
sizeof(CoeffReturnType)));
496 Op reducer(m_reducer);
500 else if(RunningOnSycl){
504 data =
static_cast<CoeffReturnType*
>(m_device.allocate(
sizeof(CoeffReturnType) * num_coeffs_to_preserve));
507 Op reducer(m_reducer);
509 return (m_result !=
NULL);
513 else if (RunningOnGPU && (m_device.majorDeviceVersion() >= 3)) {
514 bool reducing_inner_dims =
true;
515 for (
int i = 0;
i < NumReducedDims; ++
i) {
516 if (static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) {
517 reducing_inner_dims &= m_reduced[
i];
519 reducing_inner_dims &= m_reduced[NumInputDims - 1 -
i];
523 (reducing_inner_dims || ReducingInnerMostDims)) {
527 if (num_coeffs_to_preserve < 1024 && num_values_to_reduce > num_coeffs_to_preserve && num_values_to_reduce > 128) {
528 data =
static_cast<CoeffReturnType*
>(m_device.allocate(
sizeof(CoeffReturnType) * num_coeffs_to_preserve));
535 Op reducer(m_reducer);
538 m_device.deallocate(m_result);
543 return (m_result !=
NULL);
547 bool preserving_inner_dims =
true;
548 for (
int i = 0;
i < NumReducedDims; ++
i) {
549 if (static_cast<int>(Layout) == static_cast<int>(
ColMajor)) {
550 preserving_inner_dims &= m_reduced[NumInputDims - 1 -
i];
552 preserving_inner_dims &= m_reduced[
i];
556 preserving_inner_dims) {
560 if (num_coeffs_to_preserve < 1024 && num_values_to_reduce > num_coeffs_to_preserve && num_values_to_reduce > 32) {
561 data =
static_cast<CoeffReturnType*
>(m_device.allocate(
sizeof(CoeffReturnType) * num_coeffs_to_preserve));
568 Op reducer(m_reducer);
571 m_device.deallocate(m_result);
576 return (m_result !=
NULL);
586 m_device.deallocate(m_result);
593 if ((RunningOnSycl || RunningFullReduction || RunningOnGPU) && m_result) {
594 return *(m_result + index);
596 Op reducer(m_reducer);
597 if (ReducingInnerMostDims || RunningFullReduction) {
598 const Index num_values_to_reduce =
599 (
static_cast<int>(Layout) == static_cast<int>(
ColMajor)) ? m_preservedStrides[0] : m_preservedStrides[NumPreservedStrides - 1];
601 num_values_to_reduce, reducer);
605 return reducer.finalize(accum);
610 template<
int LoadMode>
616 if (RunningOnGPU && m_result) {
617 return internal::pload<PacketReturnType>(m_result + index);
621 if (ReducingInnerMostDims) {
622 const Index num_values_to_reduce =
623 (
static_cast<int>(Layout) == static_cast<int>(
ColMajor)) ? m_preservedStrides[0] : m_preservedStrides[NumPreservedStrides - 1];
624 const Index firstIndex = firstInput(index);
625 for (Index
i = 0;
i < PacketSize; ++
i) {
626 Op reducer(m_reducer);
628 num_values_to_reduce, reducer);
630 }
else if (PreservingInnerMostDims) {
631 const Index firstIndex = firstInput(index);
632 const int innermost_dim = (
static_cast<int>(Layout) == static_cast<int>(
ColMajor)) ? 0 : NumOutputDims - 1;
634 if (((firstIndex % m_dimensions[innermost_dim]) + PacketSize - 1) < m_dimensions[innermost_dim]) {
635 Op reducer(m_reducer);
636 typename Self::PacketReturnType accum = reducer.template initializePacket<typename Self::PacketReturnType>();
638 return reducer.finalizePacket(accum);
640 for (
int i = 0;
i < PacketSize; ++
i) {
641 values[
i] = coeff(index +
i);
645 for (
int i = 0;
i < PacketSize; ++
i) {
646 values[
i] = coeff(index +
i);
649 PacketReturnType rslt = internal::pload<PacketReturnType>(
values);
655 if (RunningFullReduction && m_result) {
656 return TensorOpCost(
sizeof(CoeffReturnType), 0, 0, vectorized, PacketSize);
660 return m_impl.costPerCoeff(vectorized) * num_values_to_reduce +
661 TensorOpCost(0, 0, compute_cost, vectorized, PacketSize);
669 const Device&
device()
const{
return m_device;}
671 const Dims&
xprDims()
const {
return m_xpr_dims;}
679 #ifdef EIGEN_USE_THREADS 680 template <
typename S,
typename O,
bool V>
friend struct internal::FullReducerShard;
682 #if defined(EIGEN_USE_GPU) && defined(__CUDACC__) 683 template <
int B,
int N,
typename S,
typename R,
typename I>
friend void internal::FullReductionKernel(
R,
const S,
I,
typename S::CoeffReturnType*,
unsigned int*);
684 #ifdef EIGEN_HAS_CUDA_FP16 685 template <
typename S,
typename R,
typename I>
friend void internal::ReductionInitFullReduxKernelHalfFloat(
R,
const S,
I, half2*);
686 template <
int B,
int N,
typename S,
typename R,
typename I>
friend void internal::FullReductionKernelHalfFloat(
R,
const S,
I,
half*, half2*);
687 template <
int NPT,
typename S,
typename R,
typename I>
friend void internal::InnerReductionKernelHalfFloat(
R,
const S,
I,
I,
half*);
689 template <
int NPT,
typename S,
typename R,
typename I>
friend void internal::InnerReductionKernel(
R,
const S,
I,
I,
typename S::CoeffReturnType*);
691 template <
int NPT,
typename S,
typename R,
typename I>
friend void internal::OuterReductionKernel(
R,
const S,
I,
I,
typename S::CoeffReturnType*);
699 if (ReducingInnerMostDims) {
700 if (static_cast<int>(Layout) == static_cast<int>(
ColMajor)) {
701 return index * m_preservedStrides[0];
703 return index * m_preservedStrides[NumPreservedStrides - 1];
707 Index startInput = 0;
708 if (static_cast<int>(Layout) == static_cast<int>(
ColMajor)) {
709 for (
int i = NumOutputDims - 1;
i > 0; --
i) {
711 const Index idx = index / m_outputStrides[
i];
712 startInput += idx * m_preservedStrides[
i];
713 index -= idx * m_outputStrides[
i];
715 if (PreservingInnerMostDims) {
719 startInput += index * m_preservedStrides[0];
722 for (
int i = 0;
i < NumOutputDims - 1; ++
i) {
724 const Index idx = index / m_outputStrides[
i];
725 startInput += idx * m_preservedStrides[
i];
726 index -= idx * m_outputStrides[
i];
728 if (PreservingInnerMostDims) {
729 eigen_assert(m_preservedStrides[NumPreservedStrides - 1] == 1);
732 startInput += index * m_preservedStrides[NumPreservedStrides - 1];
763 #if defined(EIGEN_USE_GPU) && defined(__CUDACC__) 765 static const bool RunningOnSycl =
false;
766 #elif defined(EIGEN_USE_SYCL) 768 static const bool RunningOnGPU =
false;
770 static const bool RunningOnGPU =
false;
771 static const bool RunningOnSycl =
false;
781 #endif // EIGEN_CXX11_TENSOR_TENSOR_REDUCTION_H TensorEvaluator< ArgType, Device >::Dimensions InputDimensions
const TensorEvaluator< ArgType, Device > & impl() const
required by sycl in order to extract the accessor
EIGEN_DEVICE_FUNC MakePointer_< Scalar >::Type data() const
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int numThreads(double output_size, const TensorOpCost &cost_per_coeff, int max_threads)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::ptrdiff_t array_prod(const Sizes< Indices... > &)
#define EIGEN_STRONG_INLINE
array< Index, NumReducedDims > m_reducedStrides
TensorReductionOp< Op, Dims, ArgType, MakePointer_ > XprType
traits< XprType > XprTraits
array< Index, NumReducedDims > m_reducedDims
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const XprType & expression() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorEvaluator(const XprType &op, const Device &device)
Eigen::internal::traits< TensorReductionOp >::Scalar Scalar
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
const TensorReductionOp< Op, Dims, XprType, MakePointer_ > & type
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const Self &self, typename Self::Index firstIndex, Op &reducer, typename Self::CoeffReturnType *accum)
internal::remove_const< typename XprType::CoeffReturnType >::type CoeffReturnType
TensorEvaluator< ArgType, Device > m_impl
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorReductionOp(const XprType &expr, const Dims &dims)
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const Self &, typename Self::Index, Op &, typename Self::PacketReturnType *)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index firstInput(Index index) const
Rot2 R(Rot2::fromAngle(0.1))
static EIGEN_DEVICE_FUNC bool run(const Self &, Op &, const Device &, typename Self::CoeffReturnType *, typename Self::Index, typename Self::Index)
const Device & device() const
added for sycl in order to construct the buffer from the sycl device
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorReductionOp(const XprType &expr, const Dims &dims, const Op &reducer)
Namespace containing all symbols from the Eigen library.
A cost model used to limit the number of threads used for evaluating tensor expression.
Eigen::NumTraits< Scalar >::Real RealScalar
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T & back()
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
static EIGEN_DEVICE_FUNC void run(const InputDims &input_dims, const array< bool, internal::array_size< InputDims >::value > &reduced, OutputDims *output_dims, ReducedDims *reduced_dims)
array< bool, NumInputDims > m_reduced
vector< size_t > dimensions(L.begin(), L.end())
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
TensorReductionOp< Op, Dims, XprType, MakePointer_ > type
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Op & reducer() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
MakePointer_< T > MakePointerT
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dims & dims() const
internal::remove_const< typename XprType::CoeffReturnType >::type CoeffReturnType
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
array< Index, NumPreservedStrides > m_preservedStrides
static EIGEN_DEVICE_FUNC bool run(const Self &, Op &, const Device &, typename Self::CoeffReturnType *, typename Self::Index, typename Self::Index)
PacketType< CoeffReturnType, Device >::type PacketReturnType
internal::conditional< NumOutputDims==0, Sizes<>, DSizes< Index, NumOutputDims > >::type Dimensions
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const Self &self, typename Self::Index firstIndex, Op &reducer, typename Self::PacketReturnType *accum)
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const Self &self, typename Self::Index index, Op &reducer, typename Self::CoeffReturnType *accum)
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const Self &, typename Self::Index, Op &, typename Self::PacketReturnType *)
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Self::CoeffReturnType reduce(const Self &self, typename Self::Index firstIndex, typename Self::Index numValuesToReduce, Op &reducer)
TensorEvaluator< const TensorReductionOp< Op, Dims, ArgType, MakePointer_ >, Device > Self
Eigen::internal::traits< TensorReductionOp >::StorageKind StorageKind
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const Self &self, typename Self::Index firstIndex, Op &reducer, typename Self::PacketReturnType *accum)
array< Index, NumOutputDims > m_outputStrides
static EIGEN_DEVICE_FUNC void run(const Self &self, Op &reducer, const Device &, typename Self::CoeffReturnType *output)
static EIGEN_DEVICE_FUNC void run(const InputDims &input_dims, const array< bool, Rank > &, Sizes<> *, array< Index, Rank > *reduced_dims)
Eigen::internal::traits< TensorReductionOp >::Index Index
XprTraits::StorageKind StorageKind
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool evalSubExprsIfNeeded(typename MakePointer_< CoeffReturnType >::Type data)
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const Self &self, typename Self::Index firstIndex, Op &reducer, typename Self::CoeffReturnType *accum)
const Dims & xprDims() const
added for sycl in order to re-construct the reduction eval on the device for the sub-kernel ...
void run(Expr &expr, Dev &dev)
MakePointer_< CoeffReturnType >::Type m_result
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Self::CoeffReturnType reduce(const Self &self, typename Self::Index firstIndex, typename Self::Index numValuesToReduce, Op &reducer)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Eigen::internal::nested< TensorReductionOp >::type Nested