TensorEvaluator.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) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_EVALUATOR_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_EVALUATOR_H
12 
13 // IWYU pragma: private
14 #include "./InternalHeaderCheck.h"
15 
16 namespace Eigen {
17 
29 // Generic evaluator
30 template <typename Derived, typename Device>
32  typedef typename Derived::Index Index;
33  typedef typename Derived::Scalar Scalar;
34  typedef typename Derived::Scalar CoeffReturnType;
36  typedef typename Derived::Dimensions Dimensions;
37  typedef Derived XprType;
42 
43  // NumDimensions is -1 for variable dim tensors
44  static constexpr int NumCoords =
46  static constexpr int Layout = Derived::Layout;
47 
48  enum {
49  IsAligned = Derived::IsAligned,
51  BlockAccess = internal::is_arithmetic<std::remove_const_t<Scalar>>::value,
52  PreferBlockAccess = false,
53  CoordAccess = NumCoords > 0,
54  RawAccess = true
55  };
56 
57  typedef std::remove_const_t<Scalar> ScalarNoConst;
58 
59  //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
62 
64  //===--------------------------------------------------------------------===//
65 
66  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorEvaluator(const Derived& m, const Device& device)
67  : m_data(device.get((const_cast<TensorPointerType>(m.data())))), m_dims(m.dimensions()), m_device(device) {}
68 
70 
72  if (!NumTraits<std::remove_const_t<Scalar>>::RequireInitialization && dest) {
73  m_device.memcpy((void*)(m_device.get(dest)), m_device.get(m_data), m_dims.TotalSize() * sizeof(Scalar));
74  return false;
75  }
76  return true;
77  }
78 
79 #ifdef EIGEN_USE_THREADS
80  template <typename EvalSubExprsCallback>
81  EIGEN_STRONG_INLINE void evalSubExprsIfNeededAsync(EvaluatorPointerType dest, EvalSubExprsCallback done) {
82  // TODO(ezhulenev): ThreadPoolDevice memcpy is blockign operation.
83  done(evalSubExprsIfNeeded(dest));
84  }
85 #endif // EIGEN_USE_THREADS
86 
88 
90  eigen_assert(m_data != NULL);
91  return m_data[index];
92  }
93 
95  eigen_assert(m_data != NULL);
96  return m_data[index];
97  }
98 
99  template <int LoadMode>
101  return internal::ploadt<PacketReturnType, LoadMode>(m_data + index);
102  }
103 
104  // Return a packet starting at `index` where `umask` specifies which elements
105  // have to be loaded. Type/size of mask depends on PacketReturnType, e.g. for
106  // Packet16f, `umask` is of type uint16_t and if a bit is 1, corresponding
107  // float element will be loaded, otherwise 0 will be loaded.
108  // Function has been templatized to enable Sfinae.
109  template <typename PacketReturnTypeT>
111  std::enable_if_t<internal::unpacket_traits<PacketReturnTypeT>::masked_load_available, PacketReturnTypeT>
113  return internal::ploadu<PacketReturnTypeT>(m_data + index, umask);
114  }
115 
116  template <int StoreMode>
118  return internal::pstoret<Scalar, PacketReturnType, StoreMode>(m_data + index, x);
119  }
120 
122  eigen_assert(m_data != NULL);
123  if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
124  return m_data[m_dims.IndexOfColMajor(coords)];
125  } else {
126  return m_data[m_dims.IndexOfRowMajor(coords)];
127  }
128  }
129 
131  eigen_assert(m_data != NULL);
132  if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
133  return m_data[m_dims.IndexOfColMajor(coords)];
134  } else {
135  return m_data[m_dims.IndexOfRowMajor(coords)];
136  }
137  }
138 
141  }
142 
145  }
146 
148  bool /*root_of_expr_ast*/ = false) const {
149  eigen_assert(m_data != NULL);
150  return TensorBlock::materialize(m_data, m_dims, desc, scratch);
151  }
152 
153  template <typename TensorBlock>
155  eigen_assert(m_data != NULL);
156 
157  typedef typename TensorBlock::XprType TensorBlockExpr;
159 
160  TensorBlockAssign::Run(
161  TensorBlockAssign::target(desc.dimensions(), internal::strides<Layout>(m_dims), m_data, desc.offset()),
162  block.expr());
163  }
164 
166 
167  protected:
171 };
172 
173 namespace internal {
174 template <typename T>
176  return *address;
177 }
178 // Use the texture cache on CUDA devices whenever possible
179 #if defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 350
180 template <>
181 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float loadConstant(const float* address) {
182  return __ldg(address);
183 }
184 template <>
185 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE double loadConstant(const double* address) {
186  return __ldg(address);
187 }
188 template <>
190  return Eigen::half(half_impl::raw_uint16_to_half(__ldg(&address->x)));
191 }
192 #endif
193 
194 } // namespace internal
195 
196 // Default evaluator for rvalues
197 template <typename Derived, typename Device>
198 struct TensorEvaluator<const Derived, Device> {
199  typedef typename Derived::Index Index;
200  typedef typename Derived::Scalar Scalar;
203  typedef typename Derived::Dimensions Dimensions;
204  typedef const Derived XprType;
208 
209  typedef std::remove_const_t<Scalar> ScalarNoConst;
210 
211  // NumDimensions is -1 for variable dim tensors
212  static constexpr int NumCoords =
215  static constexpr int Layout = Derived::Layout;
216 
217  enum {
218  IsAligned = Derived::IsAligned,
221  PreferBlockAccess = false,
222  CoordAccess = NumCoords > 0,
223  RawAccess = true
224  };
225 
226  //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
229 
231  //===--------------------------------------------------------------------===//
232 
233  EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC TensorEvaluator(const Derived& m, const Device& device)
234  : m_data(device.get(m.data())), m_dims(m.dimensions()), m_device(device) {}
235 
237 
239  if (!NumTraits<std::remove_const_t<Scalar>>::RequireInitialization && data) {
240  m_device.memcpy((void*)(m_device.get(data)), m_device.get(m_data), m_dims.TotalSize() * sizeof(Scalar));
241  return false;
242  }
243  return true;
244  }
245 
246 #ifdef EIGEN_USE_THREADS
247  template <typename EvalSubExprsCallback>
248  EIGEN_STRONG_INLINE void evalSubExprsIfNeededAsync(EvaluatorPointerType dest, EvalSubExprsCallback done) {
249  // TODO(ezhulenev): ThreadPoolDevice memcpy is a blockign operation.
250  done(evalSubExprsIfNeeded(dest));
251  }
252 #endif // EIGEN_USE_THREADS
253 
255 
257  eigen_assert(m_data != NULL);
258  return internal::loadConstant(m_data + index);
259  }
260 
261  template <int LoadMode>
263  return internal::ploadt_ro<PacketReturnType, LoadMode>(m_data + index);
264  }
265 
266  // Return a packet starting at `index` where `umask` specifies which elements
267  // have to be loaded. Type/size of mask depends on PacketReturnType, e.g. for
268  // Packet16f, `umask` is of type uint16_t and if a bit is 1, corresponding
269  // float element will be loaded, otherwise 0 will be loaded.
270  // Function has been templatized to enable Sfinae.
271  template <typename PacketReturnTypeT>
273  std::enable_if_t<internal::unpacket_traits<PacketReturnTypeT>::masked_load_available, PacketReturnTypeT>
275  return internal::ploadu<PacketReturnTypeT>(m_data + index, umask);
276  }
277 
279  eigen_assert(m_data != NULL);
280  const Index index = (static_cast<int>(Layout) == static_cast<int>(ColMajor)) ? m_dims.IndexOfColMajor(coords)
281  : m_dims.IndexOfRowMajor(coords);
282  return internal::loadConstant(m_data + index);
283  }
284 
287  }
288 
291  }
292 
294  bool /*root_of_expr_ast*/ = false) const {
295  eigen_assert(m_data != NULL);
296  return TensorBlock::materialize(m_data, m_dims, desc, scratch);
297  }
298 
300 
301  protected:
305 };
306 
307 // -------------------- CwiseNullaryOp --------------------
308 
309 template <typename NullaryOp, typename ArgType, typename Device>
310 struct TensorEvaluator<const TensorCwiseNullaryOp<NullaryOp, ArgType>, Device> {
312 
313  EIGEN_DEVICE_FUNC TensorEvaluator(const XprType& op, const Device& device)
314  : m_functor(op.functor()), m_argImpl(op.nestedExpression(), device), m_wrapper() {}
315 
316  typedef typename XprType::Index Index;
317  typedef typename XprType::Scalar Scalar;
324 
326  enum {
327  IsAligned = true,
329 #ifdef EIGEN_USE_SYCL
331 #endif
332  ,
333  BlockAccess = false,
334  PreferBlockAccess = false,
335  CoordAccess = false, // to be implemented
336  RawAccess = false
337  };
338 
339  //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
341  //===--------------------------------------------------------------------===//
342 
343  EIGEN_DEVICE_FUNC const Dimensions& dimensions() const { return m_argImpl.dimensions(); }
344 
346 
347 #ifdef EIGEN_USE_THREADS
348  template <typename EvalSubExprsCallback>
349  EIGEN_STRONG_INLINE void evalSubExprsIfNeededAsync(EvaluatorPointerType, EvalSubExprsCallback done) {
350  done(true);
351  }
352 #endif // EIGEN_USE_THREADS
353 
355 
356  EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const { return m_wrapper(m_functor, index); }
357 
358  template <int LoadMode>
360  return m_wrapper.template packetOp<PacketReturnType, Index>(m_functor, index);
361  }
362 
365  }
366 
367  EIGEN_DEVICE_FUNC EvaluatorPointerType data() const { return NULL; }
368 
369  private:
370  const NullaryOp m_functor;
373 };
374 
375 // -------------------- CwiseUnaryOp --------------------
376 
377 template <typename UnaryOp, typename ArgType, typename Device>
378 struct TensorEvaluator<const TensorCwiseUnaryOp<UnaryOp, ArgType>, Device> {
380 
382  enum {
384  PacketAccess =
388  CoordAccess = false, // to be implemented
389  RawAccess = false
390  };
391 
392  EIGEN_DEVICE_FUNC TensorEvaluator(const XprType& op, const Device& device)
393  : m_device(device), m_functor(op.functor()), m_argImpl(op.nestedExpression(), device) {}
394 
395  typedef typename XprType::Index Index;
396  typedef typename XprType::Scalar Scalar;
397  typedef std::remove_const_t<Scalar> ScalarNoConst;
404  static constexpr int NumDims = internal::array_size<Dimensions>::value;
405 
406  //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
409 
411 
413  //===--------------------------------------------------------------------===//
414 
415  EIGEN_DEVICE_FUNC const Dimensions& dimensions() const { return m_argImpl.dimensions(); }
416 
418  m_argImpl.evalSubExprsIfNeeded(NULL);
419  return true;
420  }
421 
422 #ifdef EIGEN_USE_THREADS
423  template <typename EvalSubExprsCallback>
424  EIGEN_STRONG_INLINE void evalSubExprsIfNeededAsync(EvaluatorPointerType, EvalSubExprsCallback done) {
425  m_argImpl.evalSubExprsIfNeededAsync(nullptr, [done](bool) { done(true); });
426  }
427 #endif // EIGEN_USE_THREADS
428 
429  EIGEN_STRONG_INLINE void cleanup() { m_argImpl.cleanup(); }
430 
431  EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const { return m_functor(m_argImpl.coeff(index)); }
432 
433  template <int LoadMode>
435  return m_functor.packetOp(m_argImpl.template packet<LoadMode>(index));
436  }
437 
439  const double functor_cost = internal::functor_traits<UnaryOp>::Cost;
440  return m_argImpl.costPerCoeff(vectorized) + TensorOpCost(0, 0, functor_cost, vectorized, PacketSize);
441  }
442 
444  static const double functor_cost = internal::functor_traits<UnaryOp>::Cost;
445  return m_argImpl.getResourceRequirements().addCostPerCoeff({0, 0, functor_cost / PacketSize});
446  }
447 
449  bool /*root_of_expr_ast*/ = false) const {
450  return TensorBlock(m_argImpl.block(desc, scratch), m_functor);
451  }
452 
453  EIGEN_DEVICE_FUNC EvaluatorPointerType data() const { return NULL; }
454 
455  private:
457  const UnaryOp m_functor;
459 };
460 
461 // -------------------- CwiseBinaryOp --------------------
462 
463 template <typename BinaryOp, typename LeftArgType, typename RightArgType, typename Device>
464 struct TensorEvaluator<const TensorCwiseBinaryOp<BinaryOp, LeftArgType, RightArgType>, Device> {
466 
468  enum {
469  IsAligned =
478  CoordAccess = false, // to be implemented
479  RawAccess = false
480  };
481 
482  EIGEN_DEVICE_FUNC TensorEvaluator(const XprType& op, const Device& device)
483  : m_device(device),
484  m_functor(op.functor()),
485  m_leftImpl(op.lhsExpression(), device),
486  m_rightImpl(op.rhsExpression(), device) {
490  YOU_MADE_A_PROGRAMMING_MISTAKE);
491  eigen_assert(dimensions_match(m_leftImpl.dimensions(), m_rightImpl.dimensions()));
492  }
493 
494  typedef typename XprType::Index Index;
495  typedef typename XprType::Scalar Scalar;
502 
504 
505  //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
508 
511 
513  //===--------------------------------------------------------------------===//
514 
516  // TODO: use right impl instead if right impl dimensions are known at compile time.
517  return m_leftImpl.dimensions();
518  }
519 
521  m_leftImpl.evalSubExprsIfNeeded(NULL);
522  m_rightImpl.evalSubExprsIfNeeded(NULL);
523  return true;
524  }
525 
526 #ifdef EIGEN_USE_THREADS
527  template <typename EvalSubExprsCallback>
528  EIGEN_STRONG_INLINE void evalSubExprsIfNeededAsync(EvaluatorPointerType, EvalSubExprsCallback done) {
529  // TODO(ezhulenev): Evaluate two expression in parallel?
530  m_leftImpl.evalSubExprsIfNeededAsync(
531  nullptr, [this, done](bool) { m_rightImpl.evalSubExprsIfNeededAsync(nullptr, [done](bool) { done(true); }); });
532  }
533 #endif // EIGEN_USE_THREADS
534 
536  m_leftImpl.cleanup();
537  m_rightImpl.cleanup();
538  }
539 
541  return m_functor(m_leftImpl.coeff(index), m_rightImpl.coeff(index));
542  }
543  template <int LoadMode>
545  return m_functor.packetOp(m_leftImpl.template packet<LoadMode>(index),
546  m_rightImpl.template packet<LoadMode>(index));
547  }
548 
550  const double functor_cost = internal::functor_traits<BinaryOp>::Cost;
551  return m_leftImpl.costPerCoeff(vectorized) + m_rightImpl.costPerCoeff(vectorized) +
552  TensorOpCost(0, 0, functor_cost, vectorized, PacketSize);
553  }
554 
556  static const double functor_cost = internal::functor_traits<BinaryOp>::Cost;
557  return internal::TensorBlockResourceRequirements::merge(m_leftImpl.getResourceRequirements(),
558  m_rightImpl.getResourceRequirements())
559  .addCostPerCoeff({0, 0, functor_cost / PacketSize});
560  }
561 
563  bool /*root_of_expr_ast*/ = false) const {
564  desc.DropDestinationBuffer();
565  return TensorBlock(m_leftImpl.block(desc, scratch), m_rightImpl.block(desc, scratch), m_functor);
566  }
567 
568  EIGEN_DEVICE_FUNC EvaluatorPointerType data() const { return NULL; }
569 
570  private:
572  const BinaryOp m_functor;
575 };
576 
577 // -------------------- CwiseTernaryOp --------------------
578 
579 template <typename TernaryOp, typename Arg1Type, typename Arg2Type, typename Arg3Type, typename Device>
580 struct TensorEvaluator<const TensorCwiseTernaryOp<TernaryOp, Arg1Type, Arg2Type, Arg3Type>, Device> {
582 
584  enum {
589  BlockAccess = false,
593  CoordAccess = false, // to be implemented
594  RawAccess = false
595  };
596 
597  EIGEN_DEVICE_FUNC TensorEvaluator(const XprType& op, const Device& device)
598  : m_functor(op.functor()),
599  m_arg1Impl(op.arg1Expression(), device),
600  m_arg2Impl(op.arg2Expression(), device),
601  m_arg3Impl(op.arg3Expression(), device) {
603  static_cast<int>(TensorEvaluator<Arg3Type, Device>::Layout) ||
605  YOU_MADE_A_PROGRAMMING_MISTAKE);
606 
609  STORAGE_KIND_MUST_MATCH)
612  STORAGE_KIND_MUST_MATCH)
615  STORAGE_INDEX_MUST_MATCH)
618  STORAGE_INDEX_MUST_MATCH)
619 
620  eigen_assert(dimensions_match(m_arg1Impl.dimensions(), m_arg2Impl.dimensions()) &&
621  dimensions_match(m_arg1Impl.dimensions(), m_arg3Impl.dimensions()));
622  }
623 
624  typedef typename XprType::Index Index;
625  typedef typename XprType::Scalar Scalar;
632 
633  //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
635  //===--------------------------------------------------------------------===//
636 
638  // TODO: use arg2 or arg3 dimensions if they are known at compile time.
639  return m_arg1Impl.dimensions();
640  }
641 
643  m_arg1Impl.evalSubExprsIfNeeded(NULL);
644  m_arg2Impl.evalSubExprsIfNeeded(NULL);
645  m_arg3Impl.evalSubExprsIfNeeded(NULL);
646  return true;
647  }
649  m_arg1Impl.cleanup();
650  m_arg2Impl.cleanup();
651  m_arg3Impl.cleanup();
652  }
653 
655  return m_functor(m_arg1Impl.coeff(index), m_arg2Impl.coeff(index), m_arg3Impl.coeff(index));
656  }
657  template <int LoadMode>
659  return m_functor.packetOp(m_arg1Impl.template packet<LoadMode>(index), m_arg2Impl.template packet<LoadMode>(index),
660  m_arg3Impl.template packet<LoadMode>(index));
661  }
662 
664  const double functor_cost = internal::functor_traits<TernaryOp>::Cost;
665  return m_arg1Impl.costPerCoeff(vectorized) + m_arg2Impl.costPerCoeff(vectorized) +
666  m_arg3Impl.costPerCoeff(vectorized) + TensorOpCost(0, 0, functor_cost, vectorized, PacketSize);
667  }
668 
669  EIGEN_DEVICE_FUNC EvaluatorPointerType data() const { return NULL; }
670 
671  private:
672  const TernaryOp m_functor;
676 };
677 
678 // -------------------- SelectOp --------------------
679 
680 template <typename IfArgType, typename ThenArgType, typename ElseArgType, typename Device>
681 struct TensorEvaluator<const TensorSelectOp<IfArgType, ThenArgType, ElseArgType>, Device> {
683  typedef typename XprType::Scalar Scalar;
684 
688  static constexpr bool TernaryPacketAccess =
691 
693  enum {
697  TernaryPacketAccess,
704  CoordAccess = false, // to be implemented
705  RawAccess = false
706  };
707 
708  EIGEN_DEVICE_FUNC TensorEvaluator(const XprType& op, const Device& device)
709  : m_condImpl(op.ifExpression(), device),
710  m_thenImpl(op.thenExpression(), device),
711  m_elseImpl(op.elseExpression(), device) {
714  YOU_MADE_A_PROGRAMMING_MISTAKE);
717  YOU_MADE_A_PROGRAMMING_MISTAKE);
718  eigen_assert(dimensions_match(m_condImpl.dimensions(), m_thenImpl.dimensions()));
719  eigen_assert(dimensions_match(m_thenImpl.dimensions(), m_elseImpl.dimensions()));
720  }
721 
722  typedef typename XprType::Index Index;
729 
730  static constexpr int NumDims = internal::array_size<Dimensions>::value;
731 
732  //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
735 
739 
740  struct TensorSelectOpBlockFactory {
741  template <typename IfArgXprType, typename ThenArgXprType, typename ElseArgXprType>
742  struct XprType {
744  };
745 
746  template <typename IfArgXprType, typename ThenArgXprType, typename ElseArgXprType>
748  const ThenArgXprType& then_expr,
749  const ElseArgXprType& else_expr) const {
750  return typename XprType<IfArgXprType, ThenArgXprType, ElseArgXprType>::type(if_expr, then_expr, else_expr);
751  }
752  };
753 
754  typedef internal::TensorTernaryExprBlock<TensorSelectOpBlockFactory, IfArgTensorBlock, ThenArgTensorBlock,
755  ElseArgTensorBlock>
757  //===--------------------------------------------------------------------===//
758 
760  // TODO: use then or else impl instead if they happen to be known at compile time.
761  return m_condImpl.dimensions();
762  }
763 
765  m_condImpl.evalSubExprsIfNeeded(NULL);
766  m_thenImpl.evalSubExprsIfNeeded(NULL);
767  m_elseImpl.evalSubExprsIfNeeded(NULL);
768  return true;
769  }
770 
771 #ifdef EIGEN_USE_THREADS
772  template <typename EvalSubExprsCallback>
773  EIGEN_STRONG_INLINE void evalSubExprsIfNeededAsync(EvaluatorPointerType, EvalSubExprsCallback done) {
774  m_condImpl.evalSubExprsIfNeeded(nullptr, [this, done](bool) {
775  m_thenImpl.evalSubExprsIfNeeded(
776  nullptr, [this, done](bool) { m_elseImpl.evalSubExprsIfNeeded(nullptr, [done](bool) { done(true); }); });
777  });
778  }
779 #endif // EIGEN_USE_THREADS
780 
782  m_condImpl.cleanup();
783  m_thenImpl.cleanup();
784  m_elseImpl.cleanup();
785  }
786 
788  return m_condImpl.coeff(index) ? m_thenImpl.coeff(index) : m_elseImpl.coeff(index);
789  }
790 
791  template <int LoadMode, bool UseTernary = TernaryPacketAccess, std::enable_if_t<!UseTernary, bool> = true>
795  for (Index i = 0; i < PacketSize; ++i) {
796  select.select[i] = m_condImpl.coeff(index + i);
797  }
798  return internal::pblend(select, m_thenImpl.template packet<LoadMode>(index),
799  m_elseImpl.template packet<LoadMode>(index));
800  }
801 
802  template <int LoadMode, bool UseTernary = TernaryPacketAccess, std::enable_if_t<UseTernary, bool> = true>
804  return TernarySelectOp().template packetOp<PacketReturnType>(m_thenImpl.template packet<LoadMode>(index),
805  m_elseImpl.template packet<LoadMode>(index),
806  m_condImpl.template packet<LoadMode>(index));
807  }
808 
810  return m_condImpl.costPerCoeff(vectorized) +
811  m_thenImpl.costPerCoeff(vectorized).cwiseMax(m_elseImpl.costPerCoeff(vectorized));
812  }
813 
815  auto then_req = m_thenImpl.getResourceRequirements();
816  auto else_req = m_elseImpl.getResourceRequirements();
817 
818  auto merged_req = internal::TensorBlockResourceRequirements::merge(then_req, else_req);
819  merged_req.cost_per_coeff = then_req.cost_per_coeff.cwiseMax(else_req.cost_per_coeff);
820 
821  return internal::TensorBlockResourceRequirements::merge(m_condImpl.getResourceRequirements(), merged_req);
822  }
823 
825  bool /*root_of_expr_ast*/ = false) const {
826  // It's unsafe to pass destination buffer to underlying expressions, because
827  // output might be aliased with one of the inputs.
828  desc.DropDestinationBuffer();
829 
830  return TensorBlock(m_condImpl.block(desc, scratch), m_thenImpl.block(desc, scratch),
831  m_elseImpl.block(desc, scratch), TensorSelectOpBlockFactory());
832  }
833 
835 
836 #ifdef EIGEN_USE_SYCL
837  // binding placeholder accessors to a command group handler for SYCL
838  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void bind(cl::sycl::handler& cgh) const {
839  m_condImpl.bind(cgh);
840  m_thenImpl.bind(cgh);
841  m_elseImpl.bind(cgh);
842  }
843 #endif
844  private:
848 };
849 
850 } // end namespace Eigen
851 
852 #if defined(EIGEN_USE_SYCL) && defined(SYCL_COMPILER_IS_DPCPP)
853 template <typename Derived, typename Device>
854 struct cl::sycl::is_device_copyable<
855  Eigen::TensorEvaluator<Derived, Device>,
856  std::enable_if_t<!std::is_trivially_copyable<Eigen::TensorEvaluator<Derived, Device>>::value>> : std::true_type {};
857 #endif
858 
859 #endif // EIGEN_CXX11_TENSOR_TENSOR_EVALUATOR_H
int i
Definition: BiCGSTAB_step_by_step.cpp:9
#define EIGEN_ALWAYS_INLINE
Definition: Macros.h:845
#define EIGEN_UNROLL_LOOP
Definition: Macros.h:1298
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define eigen_assert(x)
Definition: Macros.h:910
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
#define EIGEN_STATIC_ASSERT(X, MSG)
Definition: StaticAssert.h:26
#define EIGEN_DEVICE_REF
Definition: TensorMacros.h:34
SCALAR Scalar
Definition: bench_gemm.cpp:45
Definition: TensorExpr.h:162
Eigen::internal::traits< TensorCwiseBinaryOp >::Index Index
Definition: TensorExpr.h:171
Eigen::internal::traits< TensorCwiseBinaryOp >::Scalar Scalar
Definition: TensorExpr.h:166
Definition: TensorExpr.h:49
Eigen::internal::traits< TensorCwiseNullaryOp >::Scalar Scalar
Definition: TensorExpr.h:51
Eigen::internal::traits< TensorCwiseNullaryOp >::Index Index
Definition: TensorExpr.h:56
Definition: TensorExpr.h:233
Eigen::internal::traits< TensorCwiseTernaryOp >::Index Index
Definition: TensorExpr.h:240
Eigen::internal::traits< TensorCwiseTernaryOp >::Scalar Scalar
Definition: TensorExpr.h:235
Definition: TensorExpr.h:97
Eigen::internal::traits< TensorCwiseUnaryOp >::Scalar Scalar
Definition: TensorExpr.h:101
Eigen::internal::traits< TensorCwiseUnaryOp >::Index Index
Definition: TensorExpr.h:106
Definition: TensorCostModel.h:28
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost cwiseMax(const TensorOpCost &rhs) const
Definition: TensorCostModel.h:92
Definition: TensorExpr.h:302
Eigen::internal::traits< TensorSelectOp >::Index Index
Definition: TensorExpr.h:310
Eigen::internal::traits< TensorSelectOp >::Scalar Scalar
Definition: TensorExpr.h:304
Definition: TensorBlock.h:1314
Definition: TensorBlock.h:171
IndexType offset() const
Definition: TensorBlock.h:270
TensorBlockDescriptor & DropDestinationBuffer()
Definition: TensorBlock.h:289
const Dimensions & dimensions() const
Definition: TensorBlock.h:271
Definition: TensorBlock.h:566
Definition: TensorBlock.h:796
Definition: TensorBlock.h:767
Definition: TensorBlock.h:604
static EIGEN_STRONG_INLINE TensorMaterializedBlock materialize(const Scalar *data, const DataDimensions &data_dims, TensorBlockDesc &desc, TensorBlockScratch &scratch)
Definition: TensorBlock.h:699
const XprType & expr() const
Definition: TensorBlock.h:621
Definition: TensorBlock.h:861
@ ColMajor
Definition: Constants.h:318
return int(ret)+1
int * m
Definition: level2_cplx_impl.h:294
char char * op
Definition: level2_impl.h:374
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR __half_raw raw_uint16_to_half(numext::uint16_t x)
Definition: Half.h:496
EIGEN_STRONG_INLINE Packet4i pblend(const Selector< 4 > &ifPacket, const Packet4i &thenPacket, const Packet4i &elsePacket)
Definition: AltiVec/PacketMath.h:3075
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T loadConstant(const T *address)
Definition: TensorEvaluator.h:175
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool dimensions_match(Dims1 dims1, Dims2 dims2)
Definition: TensorDimensions.h:322
std::array< T, N > array
Definition: EmulateArray.h:231
squared absolute value
Definition: GlobalFunctions.h:87
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
type
Definition: compute_granudrum_aor.py:141
Definition: Eigen_Colamd.h:49
list x
Definition: plotDoE.py:28
Container::iterator get(Container &c, Position position)
Definition: stdlist_overload.cpp:29
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:217
Definition: TensorMeta.h:47
Definition: TensorForwardDeclarations.h:42
EvaluatorPointerType m_data
Definition: TensorEvaluator.h:302
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Definition: TensorEvaluator.h:299
internal::TensorBlockDescriptor< NumCoords, Index > TensorBlockDesc
Definition: TensorEvaluator.h:227
const Device EIGEN_DEVICE_REF m_device
Definition: TensorEvaluator.h:304
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC TensorEvaluator(const Derived &m, const Device &device)
Definition: TensorEvaluator.h:233
const Derived XprType
Definition: TensorEvaluator.h:204
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(const array< DenseIndex, NumCoords > &coords) const
Definition: TensorEvaluator.h:278
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
Definition: TensorEvaluator.h:285
EIGEN_STRONG_INLINE void cleanup()
Definition: TensorEvaluator.h:254
Derived::Scalar Scalar
Definition: TensorEvaluator.h:200
Storage::Type EvaluatorPointerType
Definition: TensorEvaluator.h:207
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
Definition: TensorEvaluator.h:236
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
Definition: TensorEvaluator.h:262
Derived::Dimensions Dimensions
Definition: TensorEvaluator.h:203
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition: TensorEvaluator.h:202
StorageMemory< const Scalar, Device > Storage
Definition: TensorEvaluator.h:206
internal::traits< Derived >::template MakePointer< const Scalar >::Type TensorPointerType
Definition: TensorEvaluator.h:205
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::enable_if_t< internal::unpacket_traits< PacketReturnTypeT >::masked_load_available, PacketReturnTypeT > partialPacket(Index index, typename internal::unpacket_traits< PacketReturnTypeT >::mask_t umask) const
Definition: TensorEvaluator.h:274
Derived::Index Index
Definition: TensorEvaluator.h:199
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::TensorBlockResourceRequirements getResourceRequirements() const
Definition: TensorEvaluator.h:289
internal::TensorMaterializedBlock< ScalarNoConst, NumCoords, Layout, Index > TensorBlock
Definition: TensorEvaluator.h:230
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType data)
Definition: TensorEvaluator.h:238
internal::TensorBlockScratchAllocator< Device > TensorBlockScratch
Definition: TensorEvaluator.h:228
Derived::Scalar CoeffReturnType
Definition: TensorEvaluator.h:201
std::remove_const_t< Scalar > ScalarNoConst
Definition: TensorEvaluator.h:209
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: TensorEvaluator.h:256
Dimensions m_dims
Definition: TensorEvaluator.h:303
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlock block(TensorBlockDesc &desc, TensorBlockScratch &scratch, bool=false) const
Definition: TensorEvaluator.h:293
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
Definition: TensorEvaluator.h:544
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::TensorBlockResourceRequirements getResourceRequirements() const
Definition: TensorEvaluator.h:555
internal::TensorCwiseBinaryBlock< BinaryOp, LeftTensorBlock, RightTensorBlock > TensorBlock
Definition: TensorEvaluator.h:512
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType)
Definition: TensorEvaluator.h:520
EIGEN_DEVICE_FUNC TensorEvaluator(const XprType &op, const Device &device)
Definition: TensorEvaluator.h:482
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Definition: TensorEvaluator.h:568
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
Definition: TensorEvaluator.h:540
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlock block(TensorBlockDesc &desc, TensorBlockScratch &scratch, bool=false) const
Definition: TensorEvaluator.h:562
EIGEN_DEVICE_FUNC const Dimensions & dimensions() const
Definition: TensorEvaluator.h:515
TensorEvaluator< LeftArgType, Device >::Dimensions Dimensions
Definition: TensorEvaluator.h:499
TensorCwiseBinaryOp< BinaryOp, LeftArgType, RightArgType > XprType
Definition: TensorEvaluator.h:465
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition: TensorEvaluator.h:497
TensorEvaluator< RightArgType, Device > m_rightImpl
Definition: TensorEvaluator.h:574
internal::TensorBlockDescriptor< NumDims, Index > TensorBlockDesc
Definition: TensorEvaluator.h:506
TensorEvaluator< const LeftArgType, Device >::TensorBlock LeftTensorBlock
Definition: TensorEvaluator.h:509
TensorEvaluator< LeftArgType, Device > m_leftImpl
Definition: TensorEvaluator.h:573
TensorEvaluator< const RightArgType, Device >::TensorBlock RightTensorBlock
Definition: TensorEvaluator.h:510
internal::traits< XprType >::Scalar CoeffReturnType
Definition: TensorEvaluator.h:496
StorageMemory< CoeffReturnType, Device > Storage
Definition: TensorEvaluator.h:500
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
Definition: TensorEvaluator.h:549
internal::TensorBlockScratchAllocator< Device > TensorBlockScratch
Definition: TensorEvaluator.h:507
EIGEN_DEVICE_FUNC const Dimensions & dimensions() const
Definition: TensorEvaluator.h:343
internal::traits< XprType >::Scalar CoeffReturnType
Definition: TensorEvaluator.h:318
internal::TensorBlockNotImplemented TensorBlock
Definition: TensorEvaluator.h:340
EIGEN_DEVICE_FUNC TensorEvaluator(const XprType &op, const Device &device)
Definition: TensorEvaluator.h:313
EIGEN_STRONG_INLINE void cleanup()
Definition: TensorEvaluator.h:354
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
Definition: TensorEvaluator.h:356
TensorCwiseNullaryOp< NullaryOp, ArgType > XprType
Definition: TensorEvaluator.h:311
TensorEvaluator< ArgType, Device > m_argImpl
Definition: TensorEvaluator.h:371
TensorEvaluator< ArgType, Device >::Dimensions Dimensions
Definition: TensorEvaluator.h:321
const internal::nullary_wrapper< CoeffReturnType, NullaryOp > m_wrapper
Definition: TensorEvaluator.h:372
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition: TensorEvaluator.h:319
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType)
Definition: TensorEvaluator.h:345
StorageMemory< CoeffReturnType, Device > Storage
Definition: TensorEvaluator.h:322
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
Definition: TensorEvaluator.h:363
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
Definition: TensorEvaluator.h:359
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Definition: TensorEvaluator.h:367
TensorEvaluator< Arg1Type, Device > m_arg1Impl
Definition: TensorEvaluator.h:673
internal::traits< XprType >::Scalar CoeffReturnType
Definition: TensorEvaluator.h:626
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
Definition: TensorEvaluator.h:654
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Definition: TensorEvaluator.h:669
EIGEN_DEVICE_FUNC TensorEvaluator(const XprType &op, const Device &device)
Definition: TensorEvaluator.h:597
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
Definition: TensorEvaluator.h:663
TensorCwiseTernaryOp< TernaryOp, Arg1Type, Arg2Type, Arg3Type > XprType
Definition: TensorEvaluator.h:581
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType)
Definition: TensorEvaluator.h:642
StorageMemory< CoeffReturnType, Device > Storage
Definition: TensorEvaluator.h:630
TensorEvaluator< Arg2Type, Device > m_arg2Impl
Definition: TensorEvaluator.h:674
EIGEN_DEVICE_FUNC const Dimensions & dimensions() const
Definition: TensorEvaluator.h:637
TensorEvaluator< Arg1Type, Device >::Dimensions Dimensions
Definition: TensorEvaluator.h:629
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition: TensorEvaluator.h:627
internal::TensorBlockNotImplemented TensorBlock
Definition: TensorEvaluator.h:634
TensorEvaluator< Arg3Type, Device > m_arg3Impl
Definition: TensorEvaluator.h:675
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
Definition: TensorEvaluator.h:658
TensorEvaluator< ArgType, Device > m_argImpl
Definition: TensorEvaluator.h:458
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
Definition: TensorEvaluator.h:431
TensorEvaluator< const ArgType, Device >::TensorBlock ArgTensorBlock
Definition: TensorEvaluator.h:410
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlock block(TensorBlockDesc &desc, TensorBlockScratch &scratch, bool=false) const
Definition: TensorEvaluator.h:448
EIGEN_STRONG_INLINE void cleanup()
Definition: TensorEvaluator.h:429
const Device EIGEN_DEVICE_REF m_device
Definition: TensorEvaluator.h:456
internal::TensorBlockDescriptor< NumDims, Index > TensorBlockDesc
Definition: TensorEvaluator.h:407
internal::TensorBlockScratchAllocator< Device > TensorBlockScratch
Definition: TensorEvaluator.h:408
internal::TensorCwiseUnaryBlock< UnaryOp, ArgTensorBlock > TensorBlock
Definition: TensorEvaluator.h:412
internal::traits< XprType >::Scalar CoeffReturnType
Definition: TensorEvaluator.h:398
EIGEN_DEVICE_FUNC TensorEvaluator(const XprType &op, const Device &device)
Definition: TensorEvaluator.h:392
TensorCwiseUnaryOp< UnaryOp, ArgType > XprType
Definition: TensorEvaluator.h:379
StorageMemory< CoeffReturnType, Device > Storage
Definition: TensorEvaluator.h:402
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::TensorBlockResourceRequirements getResourceRequirements() const
Definition: TensorEvaluator.h:443
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
Definition: TensorEvaluator.h:438
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Definition: TensorEvaluator.h:453
std::remove_const_t< Scalar > ScalarNoConst
Definition: TensorEvaluator.h:397
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType)
Definition: TensorEvaluator.h:417
Storage::Type EvaluatorPointerType
Definition: TensorEvaluator.h:403
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
Definition: TensorEvaluator.h:434
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition: TensorEvaluator.h:399
TensorEvaluator< ArgType, Device >::Dimensions Dimensions
Definition: TensorEvaluator.h:401
EIGEN_DEVICE_FUNC const Dimensions & dimensions() const
Definition: TensorEvaluator.h:415
TensorSelectOp< const IfArgXprType, const ThenArgXprType, const ElseArgXprType > type
Definition: TensorEvaluator.h:743
XprType< IfArgXprType, ThenArgXprType, ElseArgXprType >::type expr(const IfArgXprType &if_expr, const ThenArgXprType &then_expr, const ElseArgXprType &else_expr) const
Definition: TensorEvaluator.h:747
TensorEvaluator< ElseArgType, Device > m_elseImpl
Definition: TensorEvaluator.h:847
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlock block(TensorBlockDesc &desc, TensorBlockScratch &scratch, bool=false) const
Definition: TensorEvaluator.h:824
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
Definition: TensorEvaluator.h:787
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
Definition: TensorEvaluator.h:809
TensorEvaluator< ThenArgType, Device > m_thenImpl
Definition: TensorEvaluator.h:846
EIGEN_DEVICE_FUNC TensorEvaluator(const XprType &op, const Device &device)
Definition: TensorEvaluator.h:708
internal::TensorBlockScratchAllocator< Device > TensorBlockScratch
Definition: TensorEvaluator.h:734
TensorEvaluator< const ElseArgType, Device >::TensorBlock ElseArgTensorBlock
Definition: TensorEvaluator.h:738
internal::TensorBlockDescriptor< NumDims, Index > TensorBlockDesc
Definition: TensorEvaluator.h:733
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::TensorBlockResourceRequirements getResourceRequirements() const
Definition: TensorEvaluator.h:814
EIGEN_DEVICE_FUNC PacketReturnType packet(Index index) const
Definition: TensorEvaluator.h:792
EIGEN_DEVICE_FUNC const Dimensions & dimensions() const
Definition: TensorEvaluator.h:759
TensorEvaluator< const IfArgType, Device >::TensorBlock IfArgTensorBlock
Definition: TensorEvaluator.h:736
StorageMemory< CoeffReturnType, Device > Storage
Definition: TensorEvaluator.h:727
TensorSelectOp< IfArgType, ThenArgType, ElseArgType > XprType
Definition: TensorEvaluator.h:682
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition: TensorEvaluator.h:724
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType)
Definition: TensorEvaluator.h:764
internal::traits< XprType >::Scalar CoeffReturnType
Definition: TensorEvaluator.h:723
TensorEvaluator< IfArgType, Device > m_condImpl
Definition: TensorEvaluator.h:845
internal::TensorTernaryExprBlock< TensorSelectOpBlockFactory, IfArgTensorBlock, ThenArgTensorBlock, ElseArgTensorBlock > TensorBlock
Definition: TensorEvaluator.h:756
TensorEvaluator< IfArgType, Device >::Dimensions Dimensions
Definition: TensorEvaluator.h:726
TensorEvaluator< const ThenArgType, Device >::TensorBlock ThenArgTensorBlock
Definition: TensorEvaluator.h:737
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EvaluatorPointerType data() const
Definition: TensorEvaluator.h:834
A cost model used to limit the number of threads used for evaluating tensor expression.
Definition: TensorEvaluator.h:31
static constexpr int Layout
Definition: TensorEvaluator.h:46
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType dest)
Definition: TensorEvaluator.h:71
Derived::Scalar Scalar
Definition: TensorEvaluator.h:33
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::enable_if_t< internal::unpacket_traits< PacketReturnTypeT >::masked_load_available, PacketReturnTypeT > partialPacket(Index index, typename internal::unpacket_traits< PacketReturnTypeT >::mask_t umask) const
Definition: TensorEvaluator.h:112
const Device EIGEN_DEVICE_REF m_device
Definition: TensorEvaluator.h:170
internal::TensorBlockScratchAllocator< Device > TensorBlockScratch
Definition: TensorEvaluator.h:61
Storage::Type EvaluatorPointerType
Definition: TensorEvaluator.h:41
internal::TensorBlockDescriptor< NumCoords, Index > TensorBlockDesc
Definition: TensorEvaluator.h:60
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType & coeffRef(Index index) const
Definition: TensorEvaluator.h:94
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorEvaluator(const Derived &m, const Device &device)
Definition: TensorEvaluator.h:66
@ PacketAccess
Definition: TensorEvaluator.h:50
@ IsAligned
Definition: TensorEvaluator.h:49
Dimensions m_dims
Definition: TensorEvaluator.h:169
static constexpr int PacketSize
Definition: TensorEvaluator.h:38
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Definition: TensorEvaluator.h:165
Derived::Scalar CoeffReturnType
Definition: TensorEvaluator.h:34
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: TensorEvaluator.h:89
EIGEN_STRONG_INLINE void cleanup()
Definition: TensorEvaluator.h:87
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType & coeffRef(const array< DenseIndex, NumCoords > &coords) const
Definition: TensorEvaluator.h:130
internal::traits< Derived >::template MakePointer< Scalar >::Type TensorPointerType
Definition: TensorEvaluator.h:39
Derived XprType
Definition: TensorEvaluator.h:37
static constexpr int NumCoords
Definition: TensorEvaluator.h:44
Derived::Index Index
Definition: TensorEvaluator.h:32
internal::TensorMaterializedBlock< ScalarNoConst, NumCoords, Layout, Index > TensorBlock
Definition: TensorEvaluator.h:63
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index index, const PacketReturnType &x) const
Definition: TensorEvaluator.h:117
StorageMemory< Scalar, Device > Storage
Definition: TensorEvaluator.h:40
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::TensorBlockResourceRequirements getResourceRequirements() const
Definition: TensorEvaluator.h:143
std::remove_const_t< Scalar > ScalarNoConst
Definition: TensorEvaluator.h:57
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition: TensorEvaluator.h:35
Derived::Dimensions Dimensions
Definition: TensorEvaluator.h:36
EvaluatorPointerType m_data
Definition: TensorEvaluator.h:168
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writeBlock(const TensorBlockDesc &desc, const TensorBlock &block)
Definition: TensorEvaluator.h:154
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(const array< DenseIndex, NumCoords > &coords) const
Definition: TensorEvaluator.h:121
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
Definition: TensorEvaluator.h:139
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
Definition: TensorEvaluator.h:69
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlock block(TensorBlockDesc &desc, TensorBlockScratch &scratch, bool=false) const
Definition: TensorEvaluator.h:147
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
Definition: TensorEvaluator.h:100
numext::uint16_t x
Definition: Half.h:101
Definition: Half.h:139
Definition: GenericPacketMath.h:1421
bool select[N]
Definition: GenericPacketMath.h:1422
EIGEN_DEVICE_FUNC TensorBlockResourceRequirements & addCostPerCoeff(TensorOpCost cost)
Definition: TensorBlock.h:135
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlockResourceRequirements any()
Definition: TensorBlock.h:143
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlockResourceRequirements merge(const TensorBlockResourceRequirements &lhs, const TensorBlockResourceRequirements &rhs)
Definition: TensorBlock.h:129
Definition: Meta.h:305
Definition: XprHelper.h:205
Definition: Meta.h:145
Definition: Meta.h:205
Definition: TernaryFunctors.h:23
Definition: ForwardDeclarations.h:21
Definition: GenericPacketMath.h:134