11#ifndef EIGEN_CXX11_TENSOR_TENSOR_REDUCTION_H
12#define EIGEN_CXX11_TENSOR_TENSOR_REDUCTION_H
17#if defined(__clang__) && (defined(__CUDA__) || defined(__HIP__))
18#define KERNEL_FRIEND friend __global__ EIGEN_HIP_LAUNCH_BOUNDS_1024
20#define KERNEL_FRIEND friend
36 template<
typename Op,
typename Dims,
typename XprType,
template <
class>
class MakePointer_ >
41 typedef typename XprTraits::Scalar
Scalar;
43 typedef typename XprTraits::Index
Index;
44 typedef typename XprType::Nested
Nested;
46 static const int Layout = XprTraits::Layout;
52 typedef typename MakePointerT::Type
Type;
56template<
typename Op,
typename Dims,
typename XprType,
template <
class>
class MakePointer_>
62template<
typename Op,
typename Dims,
typename XprType,
template <
class>
class MakePointer_>
77 for (
int i = 0;
i < NumInputDims; ++
i) {
94 for (
int i = 0;
i < NumInputDims; ++
i) {
95 (*reduced_dims)[
i] = input_dims[
i];
101template <
typename ReducedDims,
int NumTensorDims,
int Layout>
105template <
typename ReducedDims,
int NumTensorDims,
int Layout>
110#if EIGEN_HAS_CONSTEXPR && EIGEN_HAS_VARIADIC_TEMPLATES
111template <
typename ReducedDims,
int NumTensorDims>
116 static const bool value = tmp1 & tmp2 & tmp3;
118template <
typename ReducedDims,
int NumTensorDims>
119struct are_inner_most_dims<ReducedDims, NumTensorDims,
RowMajor>{
120 static const bool tmp1 = indices_statically_known_to_increase<ReducedDims>();
123 static const bool value = tmp1 & tmp2 & tmp3;
126template <
typename ReducedDims,
int NumTensorDims>
127struct preserve_inner_most_dims<ReducedDims, NumTensorDims,
ColMajor>{
128 static const bool tmp1 = indices_statically_known_to_increase<ReducedDims>();
129 static const bool tmp2 = index_statically_gt<ReducedDims>(0, 0);
130 static const bool value = tmp1 & tmp2;
133template <
typename ReducedDims,
int NumTensorDims>
134struct preserve_inner_most_dims<ReducedDims, NumTensorDims,
RowMajor>{
135 static const bool tmp1 = indices_statically_known_to_increase<ReducedDims>();
137 static const bool value = tmp1 & tmp2;
142template <
int DimIndex,
typename Self,
typename Op>
152template <
typename Self,
typename Op>
155 for (
int j = 0;
j <
self.m_reducedDims[0]; ++
j) {
157 reducer.reduce(
self.m_impl.coeff(
input), accum);
161template <
typename Self,
typename Op>
164 reducer.reduce(
self.m_impl.coeff(index), accum);
168template <
typename Self,
typename Op,
bool Vectorizable = (Self::InputPacketAccess && Self::ReducerTraits::PacketAccess),
169 bool UseTreeReduction = (!Self::ReducerTraits::IsStateful &&
170 !Self::ReducerTraits::IsExactlyAssociative)>
173 typename Self::CoeffReturnType accum = reducer.initialize();
177 return reducer.finalize(accum);
181template <
typename Self,
typename Op>
187 for (
typename Self::Index
j = 0;
j < VectorizedSize;
j +=
packetSize) {
190 typename Self::CoeffReturnType accum = reducer.initialize();
194 return reducer.finalizeBoth(accum,
paccum);
198#if !defined(EIGEN_HIPCC)
199static const int kLeafSize = 1024;
201template <
typename Self,
typename Op>
206 typename Self::CoeffReturnType accum = reducer.initialize();
218 return reducer.finalize(accum);
222template <
typename Self,
typename Op>
229 typename Self::CoeffReturnType accum = reducer.initialize();
232 const typename Self::Index split =
236 const typename Self::Index
num_left =
243 return reducer.finalize(accum);
247 const typename Self::Index VectorizedSize =
249 typename Self::PacketReturnType
paccum =
251 typename Self::PacketReturnType
paccum2 =
254 reducer.reducePacket(
256 reducer.reducePacket(
269 return reducer.finalizeBoth(accum,
paccum);
275template <
int DimIndex,
typename Self,
typename Op,
bool vectorizable = (Self::InputPacketAccess && Self::ReducerTraits::PacketAccess)>
282template <
int DimIndex,
typename Self,
typename Op>
286 for (
typename Self::Index
j = 0;
j <
self.m_reducedDims[
DimIndex]; ++
j) {
293template <
typename Self,
typename Op>
296 for (
typename Self::Index
j = 0;
j <
self.m_reducedDims[0]; ++
j) {
302template <
typename Self,
typename Op>
310template <
typename Self,
typename Op,
typename Device,
bool Vectorizable = (Self::InputPacketAccess && Self::ReducerTraits::PacketAccess)>
321#ifdef EIGEN_USE_THREADS
323template <
typename Self,
typename Op,
324 bool Vectorizable = (Self::InputPacketAccess && Self::ReducerTraits::PacketAccess)>
325struct FullReducerShard {
327 typename Self::Index numValuesToReduce, Op& reducer,
328 typename Self::CoeffReturnType* output) {
330 self, firstIndex, numValuesToReduce, reducer);
335template <
typename Self,
typename Op,
bool Vectorizable>
336struct FullReducer<Self, Op, ThreadPoolDevice, Vectorizable> {
337 static const bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful;
338 static const Index PacketSize =
342 static void run(
const Self& self, Op& reducer,
const ThreadPoolDevice& device,
343 typename Self::CoeffReturnType* output) {
344 typedef typename Self::Index
Index;
346 if (num_coeffs == 0) {
347 *output = reducer.finalize(reducer.initialize());
350 const TensorOpCost cost =
351 self.m_impl.costPerCoeff(Vectorizable) +
355 num_coeffs, cost, device.numThreads());
356 if (num_threads == 1) {
361 const Index blocksize =
362 std::floor<Index>(
static_cast<float>(num_coeffs) / num_threads);
363 const Index numblocks = blocksize > 0 ? num_coeffs / blocksize : 0;
366 Barrier barrier(internal::convert_index<unsigned int>(numblocks));
367 MaxSizeVector<typename Self::CoeffReturnType> shards(numblocks, reducer.initialize());
368 for (
Index i = 0;
i < numblocks; ++
i) {
369 device.enqueue_with_barrier(&barrier, &FullReducerShard<Self, Op, Vectorizable>::run,
370 self,
i * blocksize, blocksize, reducer,
373 typename Self::CoeffReturnType finalShard;
374 if (numblocks * blocksize < num_coeffs) {
376 self, numblocks * blocksize, num_coeffs - numblocks * blocksize,
379 finalShard = reducer.initialize();
383 for (
Index i = 0;
i < numblocks; ++
i) {
384 reducer.reduce(shards[
i], &finalShard);
386 *output = reducer.finalize(finalShard);
394template <
typename Self,
typename Op,
typename Device>
398 EIGEN_DEVICE_FUNC static bool run(
const Self&, Op&,
const Device&,
typename Self::CoeffReturnType*,
typename Self::Index,
typename Self::Index) {
405template <
typename Self,
typename Op,
typename Device>
409 EIGEN_DEVICE_FUNC static bool run(
const Self&, Op&,
const Device&,
typename Self::CoeffReturnType*,
typename Self::Index,
typename Self::Index) {
417template <
typename Self,
typename Op,
typename Device>
418struct GenericReducer {
419 static const bool HasOptimizedImplementation =
false;
421 EIGEN_DEVICE_FUNC static bool run(
const Self&, Op&,
const Device&,
typename Self::CoeffReturnType*,
typename Self::Index,
typename Self::Index) {
428#if defined(EIGEN_USE_GPU) && (defined(EIGEN_GPUCC))
429template <
int B,
int N,
typename S,
typename R,
typename I_>
433#if defined(EIGEN_HAS_GPU_FP16)
434template <
typename S,
typename R,
typename I_>
436template <
int B,
int N,
typename S,
typename R,
typename I_>
438template <
int NPT,
typename S,
typename R,
typename I_>
443template <
int NPT,
typename S,
typename R,
typename I_>
446template <
int NPT,
typename S,
typename R,
typename I_>
458template <
typename Op,
typename CoeffReturnType>
460#if defined(EIGEN_USE_SYCL)
470template <
typename Op,
typename Dims,
typename XprType,
template <
class>
class MakePointer_>
500template<
typename ArgType,
typename Device>
504template<
typename Op,
typename Dims,
typename ArgType,
template <
class>
class MakePointer_,
typename Device>
515 static const int NumOutputDims = NumInputDims - NumReducedDims;
534 PacketAccess = Self::InputPacketAccess && ReducerTraits::PacketAccess,
536 PreferBlockAccess =
true,
550 static const bool RunningFullReduction = (NumOutputDims==0);
553 : m_impl(op.expression(), device), m_reducer(op.reducer()), m_result(NULL), m_device(device)
556 EIGEN_STATIC_ASSERT((!ReducingInnerMostDims | !PreservingInnerMostDims | (NumReducedDims == NumInputDims)),
557 YOU_MADE_A_PROGRAMMING_MISTAKE);
560 for (
int i = 0;
i < NumInputDims; ++
i) {
561 m_reduced[
i] =
false;
563 for (
int i = 0;
i < NumReducedDims; ++
i) {
566 m_reduced[op.
dims()[
i]] =
true;
573 if (NumOutputDims > 0) {
574 if (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) {
575 m_outputStrides[0] = 1;
576 for (
int i = 1;
i < NumOutputDims; ++
i) {
577 m_outputStrides[
i] = m_outputStrides[
i - 1] * m_dimensions[
i - 1];
581 m_outputStrides[NumOutputDims - 1] = 1;
582 for (
int i = NumOutputDims - 2;
i >= 0; --
i) {
583 m_outputStrides[
i] = m_outputStrides[
i + 1] * m_dimensions[
i + 1];
590 if (NumInputDims > 0) {
592 if (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) {
593 input_strides[0] = 1;
594 for (
int i = 1;
i < NumInputDims; ++
i) {
595 input_strides[
i] = input_strides[
i-1] * input_dims[
i-1];
598 input_strides.
back() = 1;
599 for (
int i = NumInputDims - 2;
i >= 0; --
i) {
600 input_strides[
i] = input_strides[
i + 1] * input_dims[
i + 1];
606 for (
int i = 0;
i < NumInputDims; ++
i) {
608 m_reducedStrides[reduceIndex] = input_strides[
i];
611 m_preservedStrides[outputIndex] = input_strides[
i];
612 m_output_to_input_dim_map[outputIndex] =
i;
619 if (NumOutputDims == 0) {
623 m_numValuesToReduce =
626 : (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor))
627 ? m_preservedStrides[0]
628 : m_preservedStrides[NumOutputDims - 1];
636 if ((RunningFullReduction && RunningOnSycl) ||(RunningFullReduction &&
638 ((RunningOnGPU && (m_device.majorDeviceVersion() >= 3)) ||
640 bool need_assign =
false;
646 Op reducer(m_reducer);
652 else if ((RunningOnGPU && (m_device.majorDeviceVersion() >= 3)) || (RunningOnSycl)) {
653 bool reducing_inner_dims =
true;
654 for (
int i = 0;
i < NumReducedDims; ++
i) {
655 if (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) {
656 reducing_inner_dims &= m_reduced[
i];
658 reducing_inner_dims &= m_reduced[NumInputDims - 1 -
i];
662 (reducing_inner_dims || ReducingInnerMostDims)) {
666 if ((num_coeffs_to_preserve < 1024 && num_values_to_reduce > num_coeffs_to_preserve && num_values_to_reduce > 128) || (RunningOnSycl)) {
674 Op reducer(m_reducer);
678 m_device.deallocate_temp(m_result);
683 return (m_result != NULL);
687 bool preserving_inner_dims =
true;
688 for (
int i = 0;
i < NumReducedDims; ++
i) {
689 if (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) {
690 preserving_inner_dims &= m_reduced[NumInputDims - 1 -
i];
692 preserving_inner_dims &= m_reduced[
i];
696 preserving_inner_dims) {
700 if ((num_coeffs_to_preserve < 1024 && num_values_to_reduce > num_coeffs_to_preserve && num_values_to_reduce > 32) || (RunningOnSycl)) {
708 Op reducer(m_reducer);
712 m_device.deallocate_temp(m_result);
717 return (m_result != NULL);
720 #if defined(EIGEN_USE_SYCL)
730 Op reducer(m_reducer);
732 return (m_result != NULL);
739#ifdef EIGEN_USE_THREADS
740 template <
typename EvalSubExprsCallback>
743 evalSubExprsIfNeededAsync(EvaluatorPointerType
data,
744 EvalSubExprsCallback done) {
745 m_impl.evalSubExprsIfNeededAsync(NULL, [
this,
data, done](
bool) {
746 done(evalSubExprsIfNeededCommon(
data));
753 m_impl.evalSubExprsIfNeeded(NULL);
754 return evalSubExprsIfNeededCommon(
data);
760 m_device.deallocate_temp(m_result);
767 if (( RunningFullReduction || RunningOnGPU) && m_result ) {
768 return *(m_result + index);
770 Op reducer(m_reducer);
771 if (ReducingInnerMostDims || RunningFullReduction) {
772 const Index num_values_to_reduce =
773 (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) ? m_preservedStrides[0] : m_preservedStrides[NumPreservedStrides - 1];
775 num_values_to_reduce, reducer);
779 return reducer.finalize(accum);
784 template<
int LoadMode>
790 if (RunningOnGPU && m_result) {
795 if (ReducingInnerMostDims) {
796 const Index num_values_to_reduce =
797 (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) ? m_preservedStrides[0] : m_preservedStrides[NumPreservedStrides - 1];
798 const Index firstIndex = firstInput(index);
799 for (
Index i = 0;
i < PacketSize; ++
i) {
800 Op reducer(m_reducer);
802 num_values_to_reduce, reducer);
804 }
else if (PreservingInnerMostDims) {
805 const Index firstIndex = firstInput(index);
806 const int innermost_dim = (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) ? 0 : NumOutputDims - 1;
808 if (((firstIndex % m_dimensions[innermost_dim]) + PacketSize - 1) < m_dimensions[innermost_dim]) {
809 Op reducer(m_reducer);
810 typename Self::PacketReturnType accum = reducer.template initializePacket<typename Self::PacketReturnType>();
812 return reducer.finalizePacket(accum);
814 for (
int i = 0;
i < PacketSize; ++
i) {
815 values[
i] = coeff(index +
i);
819 for (
int i = 0;
i < PacketSize; ++
i) {
820 values[
i] = coeff(index +
i);
829 if (RunningFullReduction && m_result) {
834 return m_impl.costPerCoeff(vectorized) * num_values_to_reduce +
835 TensorOpCost(0, 0, compute_cost, vectorized, PacketSize);
855#ifdef EIGEN_USE_THREADS
858#if defined(EIGEN_USE_GPU) && (defined(EIGEN_GPUCC))
860#if defined(EIGEN_HAS_GPU_FP16)
870#if defined(EIGEN_USE_SYCL)
879 struct BlockIteratorState {
888 if (ReducingInnerMostDims) {
889 if (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) {
890 return index * m_preservedStrides[0];
892 return index * m_preservedStrides[NumPreservedStrides - 1];
896 Index startInput = 0;
897 if (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) {
898 for (
int i = NumOutputDims - 1;
i > 0; --
i) {
900 const Index idx = index / m_outputStrides[
i];
901 startInput += idx * m_preservedStrides[
i];
902 index -= idx * m_outputStrides[
i];
904 if (PreservingInnerMostDims) {
908 startInput += index * m_preservedStrides[0];
911 for (
int i = 0;
i < NumOutputDims - 1; ++
i) {
913 const Index idx = index / m_outputStrides[
i];
914 startInput += idx * m_preservedStrides[
i];
915 index -= idx * m_outputStrides[
i];
917 if (PreservingInnerMostDims) {
918 eigen_assert(m_preservedStrides[NumPreservedStrides - 1] == 1);
921 startInput += index * m_preservedStrides[NumPreservedStrides - 1];
928 array<bool, NumInputDims> m_reduced;
930 Dimensions m_dimensions;
932 array<Index, NumOutputDims> m_outputStrides;
933 array<internal::TensorIntDivisor<Index>, NumOutputDims> m_fastOutputStrides;
934 array<Index, NumPreservedStrides> m_preservedStrides;
936 array<Index, NumOutputDims> m_output_to_input_dim_map;
938 Index m_numValuesToReduce;
942 array<Index, NumReducedDims> m_reducedStrides;
945 array<Index, NumReducedDims> m_reducedDims;
948 TensorEvaluator<ArgType, Device> m_impl;
954#if defined(EIGEN_USE_GPU) && (defined(EIGEN_GPUCC))
956 static const bool RunningOnSycl =
false;
957#elif defined(EIGEN_USE_SYCL)
958static const bool RunningOnSycl = internal::is_same<typename internal::remove_all<Device>::type, Eigen::SyclDevice>::value;
959static const bool RunningOnGPU =
false;
961 static const bool RunningOnGPU =
false;
962 static const bool RunningOnSycl =
false;
964 EvaluatorPointerType m_result;
969template<
typename Op,
typename Dims,
typename ArgType,
template <
class>
class MakePointer_,
typename Device>
977template<
typename Op,
typename Dims,
typename ArgType,
template <
class>
class MakePointer_>
986 return *(this->
data() + index);
990 template<
int LoadMode>
int i
Definition BiCGSTAB_step_by_step.cpp:9
#define EIGEN_DEVICE_FUNC
Definition Macros.h:976
#define EIGEN_HIP_LAUNCH_BOUNDS_1024
Definition Macros.h:510
#define eigen_assert(x)
Definition Macros.h:1037
#define EIGEN_STRONG_INLINE
Definition Macros.h:917
int data[]
Definition Map_placement_new.cpp:1
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition StaticAssert.h:127
#define EIGEN_DEVICE_REF
Definition TensorMacros.h:50
#define KERNEL_FRIEND
Definition TensorReduction.h:20
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition CwiseBinaryOp.h:84
The tensor base class.
Definition TensorBase.h:973
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int numThreads(double output_size, const TensorOpCost &cost_per_coeff, int max_threads)
Definition TensorCostModel.h:174
Definition TensorCostModel.h:25
Definition TensorReduction.h:471
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorReductionOp(const XprType &expr, const Dims &dims, const Op &reducer)
Definition TensorReduction.h:484
Eigen::internal::traits< TensorReductionOp >::Scalar Scalar
Definition TensorReduction.h:473
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dims & dims() const
Definition TensorReduction.h:490
Eigen::internal::nested< TensorReductionOp >::type Nested
Definition TensorReduction.h:476
Eigen::internal::traits< TensorReductionOp >::StorageKind StorageKind
Definition TensorReduction.h:477
const Dims m_dims
Definition TensorReduction.h:496
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorReductionOp(const XprType &expr, const Dims &dims)
Definition TensorReduction.h:481
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Op & reducer() const
Definition TensorReduction.h:492
Eigen::internal::traits< TensorReductionOp >::Index Index
Definition TensorReduction.h:478
XprType::Nested m_expr
Definition TensorReduction.h:495
internal::remove_const< typenameXprType::CoeffReturnType >::type CoeffReturnType
Definition TensorReduction.h:475
const Op m_reducer
Definition TensorReduction.h:497
Eigen::NumTraits< Scalar >::Real RealScalar
Definition TensorReduction.h:474
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const XprType & expression() const
Definition TensorReduction.h:488
Definition TensorReductionSycl.h:214
Definition EmulateArray.h:21
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T & back()
Definition EmulateArray.h:39
Definition TensorBlock.h:617
Definition TensorRef.h:81
@ ColMajor
Definition Constants.h:319
@ RowMajor
Definition Constants.h:321
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::ptrdiff_t array_prod(const Sizes< Indices... > &)
Definition TensorDimensions.h:140
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T mini(const T &x, const T &y)
Definition MathFunctions.h:1083
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T divup(const X x, const Y y)
Definition TensorMeta.h:30
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
Definition BandTriangularSolver.h:13
Definition TensorDimensions.h:263
Definition Constants.h:507
Definition TensorForwardDeclarations.h:21
Definition TensorMeta.h:50
Definition TensorDimensions.h:93
Definition TensorForwardDeclarations.h:37
EIGEN_STRONG_INLINE TensorEvaluator(const typename Base::XprType &op, const Eigen::SyclDevice &device)
Definition TensorReduction.h:982
TensorReductionEvaluatorBase< const TensorReductionOp< Op, Dims, ArgType, MakePointer_ >, Eigen::SyclDevice > Base
Definition TensorReduction.h:981
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Base::CoeffReturnType coeff(typename Base::Index index) const
Definition TensorReduction.h:985
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Base::PacketReturnType packet(typename Base::Index index) const
Definition TensorReduction.h:991
TensorReductionEvaluatorBase< const TensorReductionOp< Op, Dims, ArgType, MakePointer_ >, Device > Base
Definition TensorReduction.h:972
EIGEN_STRONG_INLINE TensorEvaluator(const typename Base::XprType &op, const Device &device)
Definition TensorReduction.h:973
A cost model used to limit the number of threads used for evaluating tensor expression.
Definition TensorEvaluator.h:29
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Definition TensorEvaluator.h:181
Derived::Dimensions Dimensions
Definition TensorEvaluator.h:34
Definition TensorReduction.h:506
Dims ReducedDims
Definition TensorReduction.h:508
XprType::Index Index
Definition TensorReduction.h:510
EIGEN_STRONG_INLINE TensorReductionEvaluatorBase(const XprType &op, const Device &device)
Definition TensorReduction.h:552
internal::remove_const< Scalar >::type ScalarNoConst
Definition TensorReduction.h:542
EIGEN_DEVICE_FUNC const TensorEvaluator< ArgType, Device > & impl() const
Definition TensorReduction.h:840
TensorEvaluator< ArgType, Device >::Dimensions InputDimensions
Definition TensorReduction.h:512
EIGEN_STRONG_INLINE void cleanup()
Definition TensorReduction.h:757
internal::TensorBlockNotImplemented TensorBlock
Definition TensorReduction.h:545
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
Definition TensorReduction.h:631
internal::ReductionReturnType< Op, typenameXprType::CoeffReturnType >::type CoeffReturnType
Definition TensorReduction.h:520
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType data)
Definition TensorReduction.h:752
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
Definition TensorReduction.h:785
Storage::Type EvaluatorPointerType
Definition TensorReduction.h:526
TensorReductionEvaluatorBase< const TensorReductionOp< Op, Dims, ArgType, MakePointer_ >, Device > Self
Definition TensorReduction.h:518
XprType::Scalar Scalar
Definition TensorReduction.h:517
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
Definition TensorReduction.h:828
StorageMemory< CoeffReturnType, Device > Storage
Definition TensorReduction.h:525
EIGEN_STRONG_INLINE bool evalSubExprsIfNeededCommon(EvaluatorPointerType data)
Definition TensorReduction.h:634
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition TensorReduction.h:521
internal::reducer_traits< Op, Device > ReducerTraits
Definition TensorReduction.h:507
ArgType ChildType
Definition TensorReduction.h:511
Eigen::internal::traits< XprType >::PointerType TensorPointerType
Definition TensorReduction.h:524
TensorReductionOp< Op, Dims, ArgType, MakePointer_ > XprType
Definition TensorReduction.h:509
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition TensorReduction.h:765
EIGEN_DEVICE_FUNC const Device & device() const
Definition TensorReduction.h:841
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Definition TensorReduction.h:839
internal::conditional< NumOutputDims==0, Sizes<>, DSizes< Index, NumOutputDims > >::type Dimensions
Definition TensorReduction.h:516
Definition TensorReduction.h:501
static EIGEN_DEVICE_FUNC void run(const InputDims &input_dims, const array< bool, Rank > &, Sizes<> *, array< Index, Rank > *reduced_dims)
Definition TensorReduction.h:91
Definition TensorReduction.h:69
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)
Definition TensorReduction.h:71
Definition TensorReduction.h:311
static EIGEN_DEVICE_FUNC void run(const Self &self, Op &reducer, const Device &, typename Self::EvaluatorPointerType output)
Definition TensorReduction.h:314
static const bool HasOptimizedImplementation
Definition TensorReduction.h:312
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const Self &self, typename Self::Index index, Op &reducer, typename Self::CoeffReturnType *accum)
Definition TensorReduction.h:163
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const Self &self, typename Self::Index firstIndex, Op &reducer, typename Self::CoeffReturnType *accum)
Definition TensorReduction.h:154
Definition TensorReduction.h:143
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const Self &self, typename Self::Index firstIndex, Op &reducer, typename Self::CoeffReturnType *accum)
Definition TensorReduction.h:144
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const Self &, typename Self::Index, Op &, typename Self::PacketReturnType *)
Definition TensorReduction.h:304
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const Self &self, typename Self::Index firstIndex, Op &reducer, typename Self::PacketReturnType *accum)
Definition TensorReduction.h:295
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const Self &self, typename Self::Index firstIndex, Op &reducer, typename Self::PacketReturnType *accum)
Definition TensorReduction.h:284
Definition TensorReduction.h:276
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const Self &, typename Self::Index, Op &, typename Self::PacketReturnType *)
Definition TensorReduction.h:277
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Self::CoeffReturnType reduce(const Self &self, typename Self::Index firstIndex, typename Self::Index numValuesToReduce, Op &reducer)
Definition TensorReduction.h:204
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Self::CoeffReturnType reduce(const Self &self, typename Self::Index firstIndex, typename Self::Index numValuesToReduce, Op &reducer)
Definition TensorReduction.h:183
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Self::CoeffReturnType reduce(const Self &self, typename Self::Index firstIndex, typename Self::Index numValuesToReduce, Op &reducer)
Definition TensorReduction.h:225
Definition TensorReduction.h:171
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Self::CoeffReturnType reduce(const Self &self, typename Self::Index firstIndex, typename Self::Index numValuesToReduce, Op &reducer)
Definition TensorReduction.h:172
Definition TensorReduction.h:395
static const bool HasOptimizedImplementation
Definition TensorReduction.h:396
static EIGEN_DEVICE_FUNC bool run(const Self &, Op &, const Device &, typename Self::CoeffReturnType *, typename Self::Index, typename Self::Index)
Definition TensorReduction.h:398
Definition TensorReduction.h:406
static const bool HasOptimizedImplementation
Definition TensorReduction.h:407
static EIGEN_DEVICE_FUNC bool run(const Self &, Op &, const Device &, typename Self::CoeffReturnType *, typename Self::Index, typename Self::Index)
Definition TensorReduction.h:409
Definition TensorReduction.h:459
remove_const< CoeffReturnType >::type type
Definition TensorReduction.h:463
Definition TensorReduction.h:102
static const bool value
Definition TensorReduction.h:103
@ value
Definition Meta.h:446
const TensorReductionOp< Op, Dims, XprType, MakePointer_ > & type
Definition TensorReduction.h:59
Definition XprHelper.h:332
Definition XprHelper.h:176
@ Cost
Definition XprHelper.h:179
@ value
Definition Meta.h:148
TensorReductionOp< Op, Dims, XprType, MakePointer_ > type
Definition TensorReduction.h:65
Definition TensorTraits.h:175
T type
Definition GenericPacketMath.h:108
Definition TensorReduction.h:106
static const bool value
Definition TensorReduction.h:107
Definition CXX11Meta.h:262
MakePointer_< T > MakePointerT
Definition TensorReduction.h:51
MakePointerT::Type Type
Definition TensorReduction.h:52
XprTraits::Index Index
Definition TensorReduction.h:43
XprTraits::PointerType PointerType
Definition TensorReduction.h:47
traits< XprType > XprTraits
Definition TensorReduction.h:40
XprTraits::Scalar Scalar
Definition TensorReduction.h:41
XprTraits::StorageKind StorageKind
Definition TensorReduction.h:42
XprType::Nested Nested
Definition TensorReduction.h:44
Definition ForwardDeclarations.h:17
Definition GenericPacketMath.h:133
@ size
Definition GenericPacketMath.h:138
Definition TensorMeta.h:40
std::ptrdiff_t j
Definition tut_arithmetic_redux_minmax.cpp:2