Redux.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
5 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
6 //
7 // This Source Code Form is subject to the terms of the Mozilla
8 // Public License v. 2.0. If a copy of the MPL was not distributed
9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 
11 #ifndef EIGEN_REDUX_H
12 #define EIGEN_REDUX_H
13 
14 // IWYU pragma: private
15 #include "./InternalHeaderCheck.h"
16 
17 namespace Eigen {
18 
19 namespace internal {
20 
21 // TODO
22 // * implement other kind of vectorization
23 // * factorize code
24 
25 /***************************************************************************
26  * Part 1 : the logic deciding a strategy for vectorization and unrolling
27  ***************************************************************************/
28 
29 template <typename Func, typename Evaluator>
30 struct redux_traits {
31  public:
33  enum {
35  InnerMaxSize = int(Evaluator::IsRowMajor) ? Evaluator::MaxColsAtCompileTime : Evaluator::MaxRowsAtCompileTime,
36  OuterMaxSize = int(Evaluator::IsRowMajor) ? Evaluator::MaxRowsAtCompileTime : Evaluator::MaxColsAtCompileTime,
39  : (int(InnerMaxSize) / int(PacketSize)) * int(OuterMaxSize)
40  };
41 
42  enum {
43  MayLinearize = (int(Evaluator::Flags) & LinearAccessBit),
47  };
48 
49  public:
50  enum {
55  };
56 
57  public:
58  enum {
59  Cost = Evaluator::SizeAtCompileTime == Dynamic
60  ? HugeCost
61  : int(Evaluator::SizeAtCompileTime) * int(Evaluator::CoeffReadCost) +
62  (Evaluator::SizeAtCompileTime - 1) * functor_traits<Func>::Cost,
64  };
65 
66  public:
67  enum { Unrolling = Cost <= UnrollingLimit ? CompleteUnrolling : NoUnrolling };
68 
69 #ifdef EIGEN_DEBUG_ASSIGN
70  static void debug() {
71  std::cerr << "Xpr: " << typeid(typename Evaluator::XprType).name() << std::endl;
72  std::cerr.setf(std::ios::hex, std::ios::basefield);
73  EIGEN_DEBUG_VAR(Evaluator::Flags)
74  std::cerr.unsetf(std::ios::hex);
82  std::cerr << "Traversal"
83  << " = " << Traversal << " (" << demangle_traversal(Traversal) << ")" << std::endl;
85  std::cerr << "Unrolling"
86  << " = " << Unrolling << " (" << demangle_unrolling(Unrolling) << ")" << std::endl;
87  std::cerr << std::endl;
88  }
89 #endif
90 };
91 
92 /***************************************************************************
93  * Part 2 : unrollers
94  ***************************************************************************/
95 
96 /*** no vectorization ***/
97 
98 template <typename Func, typename Evaluator, Index Start, Index Length>
100  static constexpr Index HalfLength = Length / 2;
101 
102  typedef typename Evaluator::Scalar Scalar;
103 
104  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func& func) {
107  }
108 };
109 
110 template <typename Func, typename Evaluator, Index Start>
111 struct redux_novec_unroller<Func, Evaluator, Start, 1> {
112  static constexpr Index outer = Start / Evaluator::InnerSizeAtCompileTime;
113  static constexpr Index inner = Start % Evaluator::InnerSizeAtCompileTime;
114 
115  typedef typename Evaluator::Scalar Scalar;
116 
117  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func&) {
118  return eval.coeffByOuterInner(outer, inner);
119  }
120 };
121 
122 // This is actually dead code and will never be called. It is required
123 // to prevent false warnings regarding failed inlining though
124 // for 0 length run() will never be called at all.
125 template <typename Func, typename Evaluator, Index Start>
126 struct redux_novec_unroller<Func, Evaluator, Start, 0> {
127  typedef typename Evaluator::Scalar Scalar;
128  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator&, const Func&) { return Scalar(); }
129 };
130 
131 template <typename Func, typename Evaluator, Index Start, Index Length>
133  static constexpr Index HalfLength = Length / 2;
134 
135  typedef typename Evaluator::Scalar Scalar;
136 
137  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func& func) {
140  }
141 };
142 
143 template <typename Func, typename Evaluator, Index Start>
144 struct redux_novec_linear_unroller<Func, Evaluator, Start, 1> {
145  typedef typename Evaluator::Scalar Scalar;
146 
147  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func&) {
148  return eval.coeff(Start);
149  }
150 };
151 
152 // This is actually dead code and will never be called. It is required
153 // to prevent false warnings regarding failed inlining though
154 // for 0 length run() will never be called at all.
155 template <typename Func, typename Evaluator, Index Start>
156 struct redux_novec_linear_unroller<Func, Evaluator, Start, 0> {
157  typedef typename Evaluator::Scalar Scalar;
158  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator&, const Func&) { return Scalar(); }
159 };
160 
161 /*** vectorization ***/
162 
163 template <typename Func, typename Evaluator, Index Start, Index Length>
165  template <typename PacketType>
166  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE PacketType run(const Evaluator& eval, const Func& func) {
167  constexpr Index HalfLength = Length / 2;
168 
169  return func.packetOp(
172  func));
173  }
174 };
175 
176 template <typename Func, typename Evaluator, Index Start>
177 struct redux_vec_unroller<Func, Evaluator, Start, 1> {
178  template <typename PacketType>
179  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE PacketType run(const Evaluator& eval, const Func&) {
180  constexpr Index PacketSize = unpacket_traits<PacketType>::size;
181  constexpr Index index = Start * PacketSize;
182  constexpr Index outer = index / int(Evaluator::InnerSizeAtCompileTime);
183  constexpr Index inner = index % int(Evaluator::InnerSizeAtCompileTime);
184  constexpr int alignment = Evaluator::Alignment;
185 
186  return eval.template packetByOuterInner<alignment, PacketType>(outer, inner);
187  }
188 };
189 
190 template <typename Func, typename Evaluator, Index Start, Index Length>
192  template <typename PacketType>
193  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE PacketType run(const Evaluator& eval, const Func& func) {
194  constexpr Index HalfLength = Length / 2;
195 
196  return func.packetOp(
199  eval, func));
200  }
201 };
202 
203 template <typename Func, typename Evaluator, Index Start>
204 struct redux_vec_linear_unroller<Func, Evaluator, Start, 1> {
205  template <typename PacketType>
206  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE PacketType run(const Evaluator& eval, const Func&) {
207  constexpr Index PacketSize = unpacket_traits<PacketType>::size;
208  constexpr Index index = (Start * PacketSize);
209  constexpr int alignment = Evaluator::Alignment;
210  return eval.template packet<alignment, PacketType>(index);
211  }
212 };
213 
214 /***************************************************************************
215  * Part 3 : implementation of all cases
216  ***************************************************************************/
217 
218 template <typename Func, typename Evaluator, int Traversal = redux_traits<Func, Evaluator>::Traversal,
219  int Unrolling = redux_traits<Func, Evaluator>::Unrolling>
220 struct redux_impl;
221 
222 template <typename Func, typename Evaluator>
223 struct redux_impl<Func, Evaluator, DefaultTraversal, NoUnrolling> {
224  typedef typename Evaluator::Scalar Scalar;
225 
226  template <typename XprType>
227  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func& func, const XprType& xpr) {
228  eigen_assert(xpr.rows() > 0 && xpr.cols() > 0 && "you are using an empty matrix");
229  Scalar res = eval.coeffByOuterInner(0, 0);
230  for (Index i = 1; i < xpr.innerSize(); ++i) res = func(res, eval.coeffByOuterInner(0, i));
231  for (Index i = 1; i < xpr.outerSize(); ++i)
232  for (Index j = 0; j < xpr.innerSize(); ++j) res = func(res, eval.coeffByOuterInner(i, j));
233  return res;
234  }
235 };
236 
237 template <typename Func, typename Evaluator>
238 struct redux_impl<Func, Evaluator, LinearTraversal, NoUnrolling> {
239  typedef typename Evaluator::Scalar Scalar;
240 
241  template <typename XprType>
242  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func& func, const XprType& xpr) {
243  eigen_assert(xpr.size() > 0 && "you are using an empty matrix");
244  Scalar res = eval.coeff(0);
245  for (Index k = 1; k < xpr.size(); ++k) res = func(res, eval.coeff(k));
246  return res;
247  }
248 };
249 
250 template <typename Func, typename Evaluator>
252  : redux_novec_unroller<Func, Evaluator, 0, Evaluator::SizeAtCompileTime> {
254  typedef typename Evaluator::Scalar Scalar;
255  template <typename XprType>
256  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func& func,
257  const XprType& /*xpr*/) {
258  return Base::run(eval, func);
259  }
260 };
261 
262 template <typename Func, typename Evaluator>
264  : redux_novec_linear_unroller<Func, Evaluator, 0, Evaluator::SizeAtCompileTime> {
266  typedef typename Evaluator::Scalar Scalar;
267  template <typename XprType>
268  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func& func,
269  const XprType& /*xpr*/) {
270  return Base::run(eval, func);
271  }
272 };
273 
274 template <typename Func, typename Evaluator>
276  typedef typename Evaluator::Scalar Scalar;
278 
279  template <typename XprType>
280  static Scalar run(const Evaluator& eval, const Func& func, const XprType& xpr) {
281  const Index size = xpr.size();
282 
283  constexpr Index packetSize = redux_traits<Func, Evaluator>::PacketSize;
284  constexpr int packetAlignment = unpacket_traits<PacketScalar>::alignment;
285  constexpr int alignment0 =
287  ? int(packetAlignment)
288  : int(Unaligned);
289  constexpr int alignment = plain_enum_max(alignment0, Evaluator::Alignment);
290  const Index alignedStart = internal::first_default_aligned(xpr);
291  const Index alignedSize2 = ((size - alignedStart) / (2 * packetSize)) * (2 * packetSize);
292  const Index alignedSize = ((size - alignedStart) / (packetSize)) * (packetSize);
293  const Index alignedEnd2 = alignedStart + alignedSize2;
294  const Index alignedEnd = alignedStart + alignedSize;
295  Scalar res;
296  if (alignedSize) {
297  PacketScalar packet_res0 = eval.template packet<alignment, PacketScalar>(alignedStart);
298  if (alignedSize > packetSize) // we have at least two packets to partly unroll the loop
299  {
300  PacketScalar packet_res1 = eval.template packet<alignment, PacketScalar>(alignedStart + packetSize);
301  for (Index index = alignedStart + 2 * packetSize; index < alignedEnd2; index += 2 * packetSize) {
302  packet_res0 = func.packetOp(packet_res0, eval.template packet<alignment, PacketScalar>(index));
303  packet_res1 = func.packetOp(packet_res1, eval.template packet<alignment, PacketScalar>(index + packetSize));
304  }
305 
306  packet_res0 = func.packetOp(packet_res0, packet_res1);
307  if (alignedEnd > alignedEnd2)
308  packet_res0 = func.packetOp(packet_res0, eval.template packet<alignment, PacketScalar>(alignedEnd2));
309  }
310  res = func.predux(packet_res0);
311 
312  for (Index index = 0; index < alignedStart; ++index) res = func(res, eval.coeff(index));
313 
314  for (Index index = alignedEnd; index < size; ++index) res = func(res, eval.coeff(index));
315  } else // too small to vectorize anything.
316  // since this is dynamic-size hence inefficient anyway for such small sizes, don't try to optimize.
317  {
318  res = eval.coeff(0);
319  for (Index index = 1; index < size; ++index) res = func(res, eval.coeff(index));
320  }
321 
322  return res;
323  }
324 };
325 
326 // NOTE: for SliceVectorizedTraversal we simply bypass unrolling
327 template <typename Func, typename Evaluator, int Unrolling>
328 struct redux_impl<Func, Evaluator, SliceVectorizedTraversal, Unrolling> {
329  typedef typename Evaluator::Scalar Scalar;
331 
332  template <typename XprType>
333  EIGEN_DEVICE_FUNC static Scalar run(const Evaluator& eval, const Func& func, const XprType& xpr) {
334  eigen_assert(xpr.rows() > 0 && xpr.cols() > 0 && "you are using an empty matrix");
335  constexpr Index packetSize = redux_traits<Func, Evaluator>::PacketSize;
336  const Index innerSize = xpr.innerSize();
337  const Index outerSize = xpr.outerSize();
338  const Index packetedInnerSize = ((innerSize) / packetSize) * packetSize;
339  Scalar res;
340  if (packetedInnerSize) {
341  PacketType packet_res = eval.template packet<Unaligned, PacketType>(0, 0);
342  for (Index j = 0; j < outerSize; ++j)
343  for (Index i = (j == 0 ? packetSize : 0); i < packetedInnerSize; i += Index(packetSize))
344  packet_res = func.packetOp(packet_res, eval.template packetByOuterInner<Unaligned, PacketType>(j, i));
345 
346  res = func.predux(packet_res);
347  for (Index j = 0; j < outerSize; ++j)
348  for (Index i = packetedInnerSize; i < innerSize; ++i) res = func(res, eval.coeffByOuterInner(j, i));
349  } else // too small to vectorize anything.
350  // since this is dynamic-size hence inefficient anyway for such small sizes, don't try to optimize.
351  {
353  }
354 
355  return res;
356  }
357 };
358 
359 template <typename Func, typename Evaluator>
361  typedef typename Evaluator::Scalar Scalar;
362 
364  static constexpr Index PacketSize = redux_traits<Func, Evaluator>::PacketSize;
365  static constexpr Index Size = Evaluator::SizeAtCompileTime;
366  static constexpr Index VectorizedSize = (int(Size) / int(PacketSize)) * int(PacketSize);
367 
368  template <typename XprType>
369  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Evaluator& eval, const Func& func, const XprType& xpr) {
371  eigen_assert(xpr.rows() > 0 && xpr.cols() > 0 && "you are using an empty matrix");
372  if (VectorizedSize > 0) {
373  Scalar res = func.predux(
375  if (VectorizedSize != Size)
376  res = func(
378  return res;
379  } else {
381  }
382  }
383 };
384 
385 // evaluator adaptor
386 template <typename XprType_>
387 class redux_evaluator : public internal::evaluator<XprType_> {
389 
390  public:
391  typedef XprType_ XprType;
393 
394  typedef typename XprType::Scalar Scalar;
395  typedef typename XprType::CoeffReturnType CoeffReturnType;
396  typedef typename XprType::PacketScalar PacketScalar;
397 
398  enum {
399  MaxRowsAtCompileTime = XprType::MaxRowsAtCompileTime,
400  MaxColsAtCompileTime = XprType::MaxColsAtCompileTime,
401  // TODO we should not remove DirectAccessBit and rather find an elegant way to query the alignment offset at runtime
402  // from the evaluator
403  Flags = Base::Flags & ~DirectAccessBit,
404  IsRowMajor = XprType::IsRowMajor,
405  SizeAtCompileTime = XprType::SizeAtCompileTime,
406  InnerSizeAtCompileTime = XprType::InnerSizeAtCompileTime
407  };
408 
410  return Base::coeff(IsRowMajor ? outer : inner, IsRowMajor ? inner : outer);
411  }
412 
413  template <int LoadMode, typename PacketType>
415  return Base::template packet<LoadMode, PacketType>(IsRowMajor ? outer : inner, IsRowMajor ? inner : outer);
416  }
417 };
418 
419 } // end namespace internal
420 
421 /***************************************************************************
422  * Part 4 : public API
423  ***************************************************************************/
424 
434 template <typename Derived>
435 template <typename Func>
437  const Func& func) const {
438  eigen_assert(this->rows() > 0 && this->cols() > 0 && "you are using an empty matrix");
439 
440  typedef typename internal::redux_evaluator<Derived> ThisEvaluator;
441  ThisEvaluator thisEval(derived());
442 
443  // The initial expression is passed to the reducer as an additional argument instead of
444  // passing it as a member of redux_evaluator to help
445  return internal::redux_impl<Func, ThisEvaluator>::run(thisEval, func, derived());
446 }
447 
455 template <typename Derived>
456 template <int NaNPropagation>
459 }
460 
468 template <typename Derived>
469 template <int NaNPropagation>
472 }
473 
480 template <typename Derived>
482  if (SizeAtCompileTime == 0 || (SizeAtCompileTime == Dynamic && size() == 0)) return Scalar(0);
483  return derived().redux(Eigen::internal::scalar_sum_op<Scalar, Scalar>());
484 }
485 
490 template <typename Derived>
492 #ifdef __INTEL_COMPILER
493 #pragma warning push
494 #pragma warning(disable : 2259)
495 #endif
496  return Scalar(derived().redux(Eigen::internal::scalar_sum_op<Scalar, Scalar>())) / Scalar(this->size());
497 #ifdef __INTEL_COMPILER
498 #pragma warning pop
499 #endif
500 }
501 
509 template <typename Derived>
511  if (SizeAtCompileTime == 0 || (SizeAtCompileTime == Dynamic && size() == 0)) return Scalar(1);
512  return derived().redux(Eigen::internal::scalar_product_op<Scalar>());
513 }
514 
521 template <typename Derived>
523  return derived().diagonal().sum();
524 }
525 
526 } // end namespace Eigen
527 
528 #endif // EIGEN_REDUX_H
int i
Definition: BiCGSTAB_step_by_step.cpp:9
#define EIGEN_DEBUG_VAR(x)
Definition: Macros.h:815
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define EIGEN_ONLY_USED_FOR_DEBUG(x)
Definition: Macros.h:922
#define eigen_assert(x)
Definition: Macros.h:910
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition: PartialRedux_count.cpp:3
#define EIGEN_UNROLLING_LIMIT
Definition: Settings.h:23
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition: CwiseBinaryOp.h:79
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: CwiseBinaryOp.h:116
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: CwiseBinaryOp.h:111
EIGEN_DEVICE_FUNC internal::traits< Derived >::Scalar maxCoeff() const
EIGEN_DEVICE_FUNC internal::traits< Derived >::Scalar minCoeff() const
EIGEN_DEVICE_FUNC Scalar prod() const
Definition: Redux.h:510
EIGEN_DEVICE_FUNC Scalar redux(const BinaryOp &func) const
EIGEN_DEVICE_FUNC Scalar sum() const
Definition: Redux.h:481
EIGEN_DEVICE_FUNC Scalar mean() const
Definition: Redux.h:491
EIGEN_DEVICE_FUNC Scalar trace() const
Definition: Redux.h:522
Definition: Redux.h:387
XprType::CoeffReturnType CoeffReturnType
Definition: Redux.h:395
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeffByOuterInner(Index outer, Index inner) const
Definition: Redux.h:409
@ InnerSizeAtCompileTime
Definition: Redux.h:406
@ MaxRowsAtCompileTime
Definition: Redux.h:399
@ SizeAtCompileTime
Definition: Redux.h:405
@ IsRowMajor
Definition: Redux.h:404
@ MaxColsAtCompileTime
Definition: Redux.h:400
XprType::Scalar Scalar
Definition: Redux.h:394
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetByOuterInner(Index outer, Index inner) const
Definition: Redux.h:414
internal::evaluator< XprType_ > Base
Definition: Redux.h:388
XprType_ XprType
Definition: Redux.h:391
XprType::PacketScalar PacketScalar
Definition: Redux.h:396
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE redux_evaluator(const XprType &xpr)
Definition: Redux.h:392
@ LinearVectorizedTraversal
Definition: Constants.h:287
@ DefaultTraversal
Definition: Constants.h:279
@ SliceVectorizedTraversal
Definition: Constants.h:290
@ LinearTraversal
Definition: Constants.h:281
@ Unaligned
Definition: Constants.h:235
@ CompleteUnrolling
Definition: Constants.h:306
@ NoUnrolling
Definition: Constants.h:301
const unsigned int LinearAccessBit
Definition: Constants.h:133
const unsigned int DirectAccessBit
Definition: Constants.h:159
return int(ret)+1
func(actual_m, actual_n, a, *lda, actual_b, 1, actual_c, 1, alpha)
char char char int int * k
Definition: level2_impl.h:374
constexpr int plain_enum_max(A a, B b)
Definition: Meta.h:656
static Index first_default_aligned(const DenseBase< Derived > &m)
Definition: DenseCoeffsBase.h:539
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
const unsigned int ActualPacketAccessBit
Definition: Constants.h:110
const int HugeCost
Definition: Constants.h:48
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
const int Dynamic
Definition: Constants.h:25
Extend namespace for flags.
Definition: fsi_chan_precond_driver.cc:56
double Length
Length of the pipe.
Definition: pipe.cc:52
Definition: Eigen_Colamd.h:49
string name
Definition: plotDoE.py:33
CwiseBinaryOp< internal::scalar_sum_op< double, double >, const CpyMatrixXd, const CpyMatrixXd > XprType
Definition: nestbyvalue.cpp:15
internal::nested_eval< T, 1 >::type eval(const T &xpr)
Definition: sparse_permutations.cpp:47
Definition: TensorMeta.h:47
Definition: XprHelper.h:427
Definition: CoreEvaluators.h:104
find_best_packet_helper< Size, typename packet_traits< T >::type >::type type
Definition: XprHelper.h:290
Definition: XprHelper.h:205
Definition: GenericPacketMath.h:108
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &func, const XprType &)
Definition: Redux.h:256
redux_novec_unroller< Func, Evaluator, 0, Evaluator::SizeAtCompileTime > Base
Definition: Redux.h:253
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &func, const XprType &xpr)
Definition: Redux.h:227
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &func, const XprType &)
Definition: Redux.h:268
redux_novec_linear_unroller< Func, Evaluator, 0, Evaluator::SizeAtCompileTime > Base
Definition: Redux.h:265
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &func, const XprType &xpr)
Definition: Redux.h:242
redux_traits< Func, Evaluator >::PacketType PacketType
Definition: Redux.h:363
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &func, const XprType &xpr)
Definition: Redux.h:369
redux_traits< Func, Evaluator >::PacketType PacketScalar
Definition: Redux.h:277
static Scalar run(const Evaluator &eval, const Func &func, const XprType &xpr)
Definition: Redux.h:280
static EIGEN_DEVICE_FUNC Scalar run(const Evaluator &eval, const Func &func, const XprType &xpr)
Definition: Redux.h:333
redux_traits< Func, Evaluator >::PacketType PacketType
Definition: Redux.h:330
Definition: Redux.h:220
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &, const Func &)
Definition: Redux.h:158
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &)
Definition: Redux.h:147
static constexpr Index HalfLength
Definition: Redux.h:133
Evaluator::Scalar Scalar
Definition: Redux.h:135
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &func)
Definition: Redux.h:137
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &, const Func &)
Definition: Redux.h:128
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &)
Definition: Redux.h:117
static constexpr Index HalfLength
Definition: Redux.h:100
Evaluator::Scalar Scalar
Definition: Redux.h:102
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &func)
Definition: Redux.h:104
Definition: Redux.h:30
find_best_packet< typename Evaluator::Scalar, Evaluator::SizeAtCompileTime >::type PacketType
Definition: Redux.h:32
@ SliceVectorizedWork
Definition: Redux.h:37
@ InnerMaxSize
Definition: Redux.h:35
@ PacketSize
Definition: Redux.h:34
@ OuterMaxSize
Definition: Redux.h:36
@ MayLinearVectorize
Definition: Redux.h:45
@ MaySliceVectorize
Definition: Redux.h:46
@ MayLinearize
Definition: Redux.h:43
@ MightVectorize
Definition: Redux.h:44
@ Traversal
Definition: Redux.h:51
@ UnrollingLimit
Definition: Redux.h:63
@ Cost
Definition: Redux.h:59
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType run(const Evaluator &eval, const Func &)
Definition: Redux.h:206
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType run(const Evaluator &eval, const Func &func)
Definition: Redux.h:193
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType run(const Evaluator &eval, const Func &)
Definition: Redux.h:179
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType run(const Evaluator &eval, const Func &func)
Definition: Redux.h:166
Template functor to compute the max of two scalars.
Definition: BinaryFunctors.h:171
Template functor to compute the min of two scalars.
Definition: BinaryFunctors.h:142
Template functor to compute the product of two scalars.
Definition: BinaryFunctors.h:73
Template functor to compute the sum of two scalars.
Definition: BinaryFunctors.h:34
Definition: ForwardDeclarations.h:21
Definition: GenericPacketMath.h:134
Definition: benchGeometry.cpp:21
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2
void run(const string &dir_name, LinearSolver *linear_solver_pt, const unsigned nel_1d, bool mess_up_order)
Definition: two_d_poisson_compare_solvers.cc:317