TensorShuffling.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_SHUFFLING_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_SHUFFLING_H
12 
13 // IWYU pragma: private
14 #include "./InternalHeaderCheck.h"
15 
16 namespace Eigen {
17 
25 namespace internal {
26 template <typename Shuffle, typename XprType>
27 struct traits<TensorShufflingOp<Shuffle, XprType> > : public traits<XprType> {
28  typedef typename XprType::Scalar Scalar;
30  typedef typename XprTraits::StorageKind StorageKind;
31  typedef typename XprTraits::Index Index;
32  typedef typename XprType::Nested Nested;
33  typedef std::remove_reference_t<Nested> Nested_;
34  static constexpr int NumDimensions = XprTraits::NumDimensions;
35  static constexpr int Layout = XprTraits::Layout;
36  typedef typename XprTraits::PointerType PointerType;
37 };
38 
39 template <typename Shuffle, typename XprType>
40 struct eval<TensorShufflingOp<Shuffle, XprType>, Eigen::Dense> {
42 };
43 
44 template <typename Shuffle, typename XprType>
45 struct nested<TensorShufflingOp<Shuffle, XprType>, 1, typename eval<TensorShufflingOp<Shuffle, XprType> >::type> {
47 };
48 
49 } // end namespace internal
50 
51 template <typename Shuffle, typename XprType>
52 class TensorShufflingOp : public TensorBase<TensorShufflingOp<Shuffle, XprType> > {
53  public:
57  typedef typename XprType::CoeffReturnType CoeffReturnType;
61 
63  : m_xpr(expr), m_shuffle(shfl) {}
64 
65  EIGEN_DEVICE_FUNC const Shuffle& shufflePermutation() const { return m_shuffle; }
66 
68 
70 
71  protected:
72  typename XprType::Nested m_xpr;
73  const Shuffle m_shuffle;
74 };
75 
76 // Eval as rvalue
77 template <typename Shuffle, typename ArgType, typename Device>
78 struct TensorEvaluator<const TensorShufflingOp<Shuffle, ArgType>, Device> {
81  typedef typename XprType::Index Index;
84  typedef typename XprType::Scalar Scalar;
90 
92  enum {
93  IsAligned = false,
96  PreferBlockAccess = true,
97  CoordAccess = false, // to be implemented
98  RawAccess = false
99  };
100 
101  typedef std::remove_const_t<Scalar> ScalarNoConst;
102 
103  //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
106 
108  //===--------------------------------------------------------------------===//
109 
110  EIGEN_STRONG_INLINE TensorEvaluator(const XprType& op, const Device& device)
111  : m_device(device), m_impl(op.expression(), device) {
112  const typename TensorEvaluator<ArgType, Device>::Dimensions& input_dims = m_impl.dimensions();
113  const Shuffle& shuffle = op.shufflePermutation();
114  m_is_identity = true;
115  for (int i = 0; i < NumDims; ++i) {
116  m_shuffle[i] = static_cast<int>(shuffle[i]);
117  m_dimensions[i] = input_dims[shuffle[i]];
118  m_inverseShuffle[shuffle[i]] = i;
119  if (m_is_identity && shuffle[i] != i) {
120  m_is_identity = false;
121  }
122  }
123 
124  if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
125  m_unshuffledInputStrides[0] = 1;
126  m_outputStrides[0] = 1;
127 
128  for (int i = 1; i < NumDims; ++i) {
129  m_unshuffledInputStrides[i] = m_unshuffledInputStrides[i - 1] * input_dims[i - 1];
130  m_outputStrides[i] = m_outputStrides[i - 1] * m_dimensions[i - 1];
131  m_fastOutputStrides[i] =
132  internal::TensorIntDivisor<Index>(m_outputStrides[i] > 0 ? m_outputStrides[i] : Index(1));
133  }
134  } else {
135  m_unshuffledInputStrides[NumDims - 1] = 1;
136  m_outputStrides[NumDims - 1] = 1;
137  for (int i = NumDims - 2; i >= 0; --i) {
138  m_unshuffledInputStrides[i] = m_unshuffledInputStrides[i + 1] * input_dims[i + 1];
139  m_outputStrides[i] = m_outputStrides[i + 1] * m_dimensions[i + 1];
140  m_fastOutputStrides[i] =
141  internal::TensorIntDivisor<Index>(m_outputStrides[i] > 0 ? m_outputStrides[i] : Index(1));
142  }
143  }
144 
145  for (int i = 0; i < NumDims; ++i) {
146  m_inputStrides[i] = m_unshuffledInputStrides[shuffle[i]];
147  }
148  }
149 
150  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions& dimensions() const { return m_dimensions; }
151 
153  m_impl.evalSubExprsIfNeeded(NULL);
154  return true;
155  }
156 
157 #ifdef EIGEN_USE_THREADS
158  template <typename EvalSubExprsCallback>
159  EIGEN_STRONG_INLINE void evalSubExprsIfNeededAsync(EvaluatorPointerType, EvalSubExprsCallback done) {
160  m_impl.evalSubExprsIfNeededAsync(nullptr, [done](bool) { done(true); });
161  }
162 #endif // EIGEN_USE_THREADS
163 
164  EIGEN_STRONG_INLINE void cleanup() { m_impl.cleanup(); }
165 
167  if (m_is_identity) {
168  return m_impl.coeff(index);
169  } else {
170  return m_impl.coeff(srcCoeff(index));
171  }
172  }
173 
174  template <int LoadMode, typename Self, bool ImplPacketAccess>
175  struct PacketLoader {
177  EIGEN_ALIGN_MAX std::remove_const_t<CoeffReturnType> values[PacketSize];
179  for (int i = 0; i < PacketSize; ++i) {
180  values[i] = self.coeff(index + i);
181  }
182  PacketReturnType rslt = internal::pload<PacketReturnType>(values);
183  return rslt;
184  }
185  };
186 
187  template <int LoadMode, typename Self>
188  struct PacketLoader<LoadMode, Self, true> {
190  if (self.m_is_identity) {
191  return self.m_impl.template packet<LoadMode>(index);
192  } else {
193  EIGEN_ALIGN_MAX std::remove_const_t<CoeffReturnType> values[PacketSize];
195  for (int i = 0; i < PacketSize; ++i) {
196  values[i] = self.coeff(index + i);
197  }
198  PacketReturnType rslt = internal::pload<PacketReturnType>(values);
199  return rslt;
200  }
201  }
202  };
203 
204  template <int LoadMode>
206  eigen_assert(index + PacketSize - 1 < dimensions().TotalSize());
207  return PacketLoader<LoadMode, Self, TensorEvaluator<ArgType, Device>::PacketAccess>::Run(*this, index);
208  }
209 
211  static const int inner_dim = Layout == static_cast<int>(ColMajor) ? 0 : NumDims - 1;
212 
213  const size_t target_size = m_device.firstLevelCacheSize();
214  const bool inner_dim_shuffled = m_shuffle[inner_dim] != inner_dim;
215 
216  // Shuffled inner dimensions leads to a random memory access, which is not
217  // captured by default cost model bytes loaded/stored. We add this cost
218  // explicitly. The number of cycles picked based on the benchmarks.
219  // TODO(ezhulenev): This number was picked based on a very questionable
220  // benchmarks, add benchmarks that are representative of real workloads.
221  using BlockRequirements = internal::TensorBlockResourceRequirements;
222  if (inner_dim_shuffled) {
223  return BlockRequirements::uniform<Scalar>(target_size).addCostPerCoeff({0, 0, NumDims * 28});
224  } else {
225  return BlockRequirements::skewed<Scalar>(target_size);
226  }
227  }
228 
230  bool root_of_expr_ast = false) const {
231  eigen_assert(m_impl.data() != NULL);
232 
234  typedef typename TensorBlockIO::Dst TensorBlockIODst;
235  typedef typename TensorBlockIO::Src TensorBlockIOSrc;
236 
237  const typename TensorBlock::Storage block_storage =
238  TensorBlock::prepareStorage(desc, scratch, /*allow_strided_storage=*/root_of_expr_ast);
239 
240  typename TensorBlockIO::Dimensions input_strides(m_unshuffledInputStrides);
241  TensorBlockIOSrc src(input_strides, m_impl.data(), srcCoeff(desc.offset()));
242 
243  TensorBlockIODst dst(block_storage.dimensions(), block_storage.strides(), block_storage.data());
244 
245  typename TensorBlockIO::DimensionsMap dst_to_src_dim_map(m_shuffle);
246  TensorBlockIO::Copy(dst, src, dst_to_src_dim_map);
247 
248  return block_storage.AsTensorMaterializedBlock();
249  }
250 
252  const double compute_cost = m_is_identity
253  ? TensorOpCost::AddCost<Index>()
254  : NumDims * (2 * TensorOpCost::AddCost<Index>() +
255  2 * TensorOpCost::MulCost<Index>() + TensorOpCost::DivCost<Index>());
256  return m_impl.costPerCoeff(vectorized) +
257  TensorOpCost(0, 0, compute_cost, m_is_identity /* vectorized */, PacketSize);
258  }
259 
260  EIGEN_DEVICE_FUNC typename Storage::Type data() const { return NULL; }
261 
262  protected:
264  GetBlockOutputIndex(Index input_index, const DSizes<Index, NumDims>& input_block_strides,
265  const DSizes<Index, NumDims>& output_block_strides,
266  const DSizes<internal::TensorIntDivisor<Index>, NumDims>& fast_input_block_strides) const {
267  Index output_index = 0;
268  if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
269  for (int i = NumDims - 1; i > 0; --i) {
270  const Index idx = input_index / fast_input_block_strides[i];
271  output_index += idx * output_block_strides[m_inverseShuffle[i]];
272  input_index -= idx * input_block_strides[i];
273  }
274  return output_index + input_index * output_block_strides[m_inverseShuffle[0]];
275  } else {
276  for (int i = 0; i < NumDims - 1; ++i) {
277  const Index idx = input_index / fast_input_block_strides[i];
278  output_index += idx * output_block_strides[m_inverseShuffle[i]];
279  input_index -= idx * input_block_strides[i];
280  }
281  return output_index + input_index * output_block_strides[m_inverseShuffle[NumDims - 1]];
282  }
283  }
284 
286  Index inputIndex = 0;
287  if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
288  for (int i = NumDims - 1; i > 0; --i) {
289  const Index idx = index / m_fastOutputStrides[i];
290  inputIndex += idx * m_inputStrides[i];
291  index -= idx * m_outputStrides[i];
292  }
293  return inputIndex + index * m_inputStrides[0];
294  } else {
295  for (int i = 0; i < NumDims - 1; ++i) {
296  const Index idx = index / m_fastOutputStrides[i];
297  inputIndex += idx * m_inputStrides[i];
298  index -= idx * m_outputStrides[i];
299  }
300  return inputIndex + index * m_inputStrides[NumDims - 1];
301  }
302  }
303 
307  array<Index, NumDims> m_inverseShuffle; // TODO(ezhulenev): Make it int type.
312 
315 };
316 
317 // Eval as lvalue
318 template <typename Shuffle, typename ArgType, typename Device>
319 struct TensorEvaluator<TensorShufflingOp<Shuffle, ArgType>, Device>
320  : public TensorEvaluator<const TensorShufflingOp<Shuffle, ArgType>, Device> {
322 
324  typedef typename XprType::Index Index;
327  typedef typename XprType::Scalar Scalar;
332 
333  enum {
334  IsAligned = false,
337  PreferBlockAccess = true,
338  RawAccess = false
339  };
340 
341  typedef std::remove_const_t<Scalar> ScalarNoConst;
342 
343  //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
345  //===--------------------------------------------------------------------===//
346 
347  EIGEN_STRONG_INLINE TensorEvaluator(const XprType& op, const Device& device) : Base(op, device) {}
348 
350  return this->m_impl.coeffRef(this->srcCoeff(index));
351  }
352 
353  template <int StoreMode>
355  EIGEN_ALIGN_MAX std::remove_const_t<CoeffReturnType> values[PacketSize];
356  internal::pstore<CoeffReturnType, PacketReturnType>(values, x);
358  for (int i = 0; i < PacketSize; ++i) {
359  this->coeffRef(index + i) = values[i];
360  }
361  }
362 
363  template <typename TensorBlock>
365  eigen_assert(this->m_impl.data() != NULL);
366 
368  typedef typename TensorBlockIO::Dst TensorBlockIODst;
369  typedef typename TensorBlockIO::Src TensorBlockIOSrc;
370 
371  const Scalar* block_buffer = block.data();
372 
373  // TODO(ezhulenev): TensorBlockIO should be able to read from any Eigen
374  // expression with coefficient and packet access as `src`.
375  void* mem = NULL;
376  if (block_buffer == NULL) {
377  mem = this->m_device.allocate(desc.size() * sizeof(Scalar));
378  ScalarNoConst* buf = static_cast<ScalarNoConst*>(mem);
379 
381  TensorBlockAssignment;
382 
383  TensorBlockAssignment::Run(
384  TensorBlockAssignment::target(desc.dimensions(), internal::strides<Layout>(desc.dimensions()), buf),
385  block.expr());
386 
387  block_buffer = buf;
388  }
389 
390  // Read from block.
391  TensorBlockIOSrc src(internal::strides<Layout>(desc.dimensions()), block_buffer);
392 
393  // Write to the output buffer.
394  typename TensorBlockIO::Dimensions output_strides(this->m_unshuffledInputStrides);
395  typename TensorBlockIO::Dimensions output_dimensions;
396  for (int i = 0; i < NumDims; ++i) {
397  output_dimensions[this->m_shuffle[i]] = desc.dimension(i);
398  }
399  TensorBlockIODst dst(output_dimensions, output_strides, this->m_impl.data(), this->srcCoeff(desc.offset()));
400 
401  // Reorder dimensions according to the shuffle.
402  typename TensorBlockIO::DimensionsMap dst_to_src_dim_map;
403  for (int i = 0; i < NumDims; ++i) {
404  dst_to_src_dim_map[i] = static_cast<int>(this->m_inverseShuffle[i]);
405  }
406  TensorBlockIO::Copy(dst, src, dst_to_src_dim_map);
407 
408  // Deallocate temporary buffer used for the block materialization.
409  if (mem != NULL) this->m_device.deallocate(mem);
410  }
411 };
412 
413 } // end namespace Eigen
414 
415 #endif // EIGEN_CXX11_TENSOR_TENSOR_SHUFFLING_H
int i
Definition: BiCGSTAB_step_by_step.cpp:9
#define EIGEN_ALIGN_MAX
Definition: ConfigureVectorization.h:146
#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_TENSOR_INHERIT_ASSIGNMENT_OPERATORS(Derived)
Macro to manually inherit assignment operators. This is necessary, because the implicitly defined ass...
Definition: TensorMacros.h:81
#define EIGEN_DEVICE_REF
Definition: TensorMacros.h:34
SCALAR Scalar
Definition: bench_gemm.cpp:45
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition: CwiseBinaryOp.h:79
The tensor base class.
Definition: TensorBase.h:1026
Definition: TensorCostModel.h:28
Definition: TensorShuffling.h:52
XprType::Nested m_xpr
Definition: TensorShuffling.h:72
Eigen::internal::nested< TensorShufflingOp >::type Nested
Definition: TensorShuffling.h:58
EIGEN_DEVICE_FUNC const Shuffle & shufflePermutation() const
Definition: TensorShuffling.h:65
Eigen::internal::traits< TensorShufflingOp >::StorageKind StorageKind
Definition: TensorShuffling.h:59
XprType::CoeffReturnType CoeffReturnType
Definition: TensorShuffling.h:57
TensorBase< TensorShufflingOp< Shuffle, XprType > > Base
Definition: TensorShuffling.h:54
Eigen::NumTraits< Scalar >::Real RealScalar
Definition: TensorShuffling.h:56
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorShufflingOp(const XprType &expr, const Shuffle &shfl)
Definition: TensorShuffling.h:62
Eigen::internal::traits< TensorShufflingOp >::Scalar Scalar
Definition: TensorShuffling.h:55
const Shuffle m_shuffle
Definition: TensorShuffling.h:73
EIGEN_DEVICE_FUNC const internal::remove_all_t< typename XprType::Nested > & expression() const
Definition: TensorShuffling.h:67
Eigen::internal::traits< TensorShufflingOp >::Index Index
Definition: TensorShuffling.h:60
Definition: TensorBlock.h:1314
IndexType size() const
Definition: TensorBlock.h:273
IndexType offset() const
Definition: TensorBlock.h:270
IndexType dimension(int index) const
Definition: TensorBlock.h:272
const Dimensions & dimensions() const
Definition: TensorBlock.h:271
Definition: TensorBlock.h:1093
TensorMaterializedBlock AsTensorMaterializedBlock() const
Definition: TensorBlock.h:644
Scalar * data() const
Definition: TensorBlock.h:640
const Dimensions & strides() const
Definition: TensorBlock.h:642
const Dimensions & dimensions() const
Definition: TensorBlock.h:641
Definition: TensorBlock.h:604
const Scalar * data() const
Definition: TensorBlock.h:625
const XprType & expr() const
Definition: TensorBlock.h:621
static EIGEN_STRONG_INLINE Storage prepareStorage(TensorBlockDesc &desc, TensorBlockScratch &scratch, bool allow_strided_storage=false)
Definition: TensorBlock.h:671
@ ColMajor
Definition: Constants.h:318
char char * op
Definition: level2_impl.h:374
EIGEN_STRONG_INLINE Packet2d shuffle(const Packet2d &m, const Packet2d &n, int mask)
Definition: LSX/PacketMath.h:150
typename remove_all< T >::type remove_all_t
Definition: Meta.h:142
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
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
Definition: Eigen_Colamd.h:49
list x
Definition: plotDoE.py:28
Definition: Constants.h:519
T Real
Definition: NumTraits.h:183
Definition: TensorMeta.h:47
Definition: TensorForwardDeclarations.h:42
EIGEN_STRONG_INLINE void writePacket(Index index, const PacketReturnType &x) const
Definition: TensorShuffling.h:354
XprType::CoeffReturnType CoeffReturnType
Definition: TensorShuffling.h:328
XprType::Scalar Scalar
Definition: TensorShuffling.h:327
std::remove_const_t< Scalar > ScalarNoConst
Definition: TensorShuffling.h:341
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType & coeffRef(Index index) const
Definition: TensorShuffling.h:349
EIGEN_STRONG_INLINE TensorEvaluator(const XprType &op, const Device &device)
Definition: TensorShuffling.h:347
XprType::Index Index
Definition: TensorShuffling.h:324
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writeBlock(const TensorBlockDesc &desc, const TensorBlock &block)
Definition: TensorShuffling.h:364
TensorShufflingOp< Shuffle, ArgType > XprType
Definition: TensorShuffling.h:323
DSizes< Index, NumDims > Dimensions
Definition: TensorShuffling.h:326
TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device > Base
Definition: TensorShuffling.h:321
internal::TensorBlockDescriptor< NumDims, Index > TensorBlockDesc
Definition: TensorShuffling.h:344
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition: TensorShuffling.h:329
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE PacketReturnType Run(const Self &self, Index index)
Definition: TensorShuffling.h:189
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE PacketReturnType Run(const Self &self, Index index)
Definition: TensorShuffling.h:176
DSizes< Index, NumDims > Dimensions
Definition: TensorShuffling.h:83
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
Definition: TensorShuffling.h:251
array< Index, NumDims > m_unshuffledInputStrides
Definition: TensorShuffling.h:311
array< int, NumDims > m_shuffle
Definition: TensorShuffling.h:306
array< internal::TensorIntDivisor< Index >, NumDims > m_fastOutputStrides
Definition: TensorShuffling.h:309
std::remove_const_t< Scalar > ScalarNoConst
Definition: TensorShuffling.h:101
TensorShufflingOp< Shuffle, ArgType > XprType
Definition: TensorShuffling.h:80
TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device > Self
Definition: TensorShuffling.h:79
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::TensorBlockResourceRequirements getResourceRequirements() const
Definition: TensorShuffling.h:210
Storage::Type EvaluatorPointerType
Definition: TensorShuffling.h:89
EIGEN_STRONG_INLINE TensorEvaluator(const XprType &op, const Device &device)
Definition: TensorShuffling.h:110
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: TensorShuffling.h:166
TensorEvaluator< ArgType, Device > m_impl
Definition: TensorShuffling.h:314
EIGEN_DEVICE_FUNC Storage::Type data() const
Definition: TensorShuffling.h:260
internal::TensorBlockScratchAllocator< Device > TensorBlockScratch
Definition: TensorShuffling.h:105
array< Index, NumDims > m_inverseShuffle
Definition: TensorShuffling.h:307
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index GetBlockOutputIndex(Index input_index, const DSizes< Index, NumDims > &input_block_strides, const DSizes< Index, NumDims > &output_block_strides, const DSizes< internal::TensorIntDivisor< Index >, NumDims > &fast_input_block_strides) const
Definition: TensorShuffling.h:264
internal::TensorBlockDescriptor< NumDims, Index > TensorBlockDesc
Definition: TensorShuffling.h:104
array< Index, NumDims > m_outputStrides
Definition: TensorShuffling.h:308
EIGEN_STRONG_INLINE void cleanup()
Definition: TensorShuffling.h:164
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
Definition: TensorShuffling.h:205
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition: TensorShuffling.h:86
StorageMemory< CoeffReturnType, Device > Storage
Definition: TensorShuffling.h:88
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlock block(TensorBlockDesc &desc, TensorBlockScratch &scratch, bool root_of_expr_ast=false) const
Definition: TensorShuffling.h:229
const Device EIGEN_DEVICE_REF m_device
Definition: TensorShuffling.h:313
internal::TensorMaterializedBlock< ScalarNoConst, NumDims, Layout, Index > TensorBlock
Definition: TensorShuffling.h:107
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType)
Definition: TensorShuffling.h:152
XprType::CoeffReturnType CoeffReturnType
Definition: TensorShuffling.h:85
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index srcCoeff(Index index) const
Definition: TensorShuffling.h:285
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
Definition: TensorShuffling.h:150
array< Index, NumDims > m_inputStrides
Definition: TensorShuffling.h:310
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
const Device EIGEN_DEVICE_REF m_device
Definition: TensorEvaluator.h:170
Storage::Type EvaluatorPointerType
Definition: TensorEvaluator.h:41
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType & coeffRef(Index index) const
Definition: TensorEvaluator.h:94
@ PacketAccess
Definition: TensorEvaluator.h:50
@ IsAligned
Definition: TensorEvaluator.h:49
static constexpr int PacketSize
Definition: TensorEvaluator.h:38
Derived::Index Index
Definition: TensorEvaluator.h:32
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 TensorBlockResourceRequirements & addCostPerCoeff(TensorOpCost cost)
Definition: TensorBlock.h:135
Definition: Meta.h:305
const TensorShufflingOp< Shuffle, XprType > & type
Definition: TensorShuffling.h:41
Definition: XprHelper.h:427
Definition: TensorTraits.h:152
ref_selector< T >::type type
Definition: TensorTraits.h:153
XprTraits::Index Index
Definition: TensorShuffling.h:31
XprType::Nested Nested
Definition: TensorShuffling.h:32
XprTraits::PointerType PointerType
Definition: TensorShuffling.h:36
XprTraits::StorageKind StorageKind
Definition: TensorShuffling.h:30
XprType::Scalar Scalar
Definition: TensorShuffling.h:28
traits< XprType > XprTraits
Definition: TensorShuffling.h:29
std::remove_reference_t< Nested > Nested_
Definition: TensorShuffling.h:33
Definition: ForwardDeclarations.h:21