TR-mbed 1.0
Loading...
Searching...
No Matches
TensorContractionBlocking.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_CONTRACTION_BLOCKING_H
11#define EIGEN_CXX11_TENSOR_TENSOR_CONTRACTION_BLOCKING_H
12
13
14namespace Eigen {
15namespace internal {
16
17enum {
19 ShardByCol = 1
20};
21
22
23// Default Blocking Strategy
24template<typename ResScalar, typename LhsScalar, typename RhsScalar, typename StorageIndex, int ShardingType = ShardByCol>
26 public:
27
28 /*
29 adding EIGEN_DEVICE_FUNC unconditionally to 'TensorContractionBlocking' constructor in `TensorContractionBlocking.h`
30 requires adding EIGEN_DEVICE_FUNC to `computeProductBlockingSizes` in `GeneralBlockPanelKernel.h`
31 which in turn, requires adding EIGEN_DEVICE_FUNC to `evaluateProductBlockingSizesHeuristic` in `GeneralBlockPanelKernel.h`
32 which in turn, requires adding EIGEN_DEVICE_FUNC to `manage_caching_sizes` in `GeneralBlockPanelKernel.h`
33 (else HIPCC will error out)
34
35 However adding EIGEN_DEVICE_FUNC to `manage_caching_sizes` in `GeneralBlockPanelKernel.h`
36 results in NVCC erroring out with the following error
37
38 ../Eigen/src/Core/products/GeneralBlockPanelKernel.h(57): error #2901:
39 dynamic initialization is not supported for function-scope static variables within a __device__/__global__ function
40 */
41
42 #if !defined(EIGEN_HIPCC)
44 #endif
45 TensorContractionBlocking(StorageIndex k, StorageIndex m, StorageIndex n, StorageIndex num_threads = 1) :
46 kc_(k), mc_(m), nc_(n)
47 {
48 if (ShardingType == ShardByCol) {
50 }
51 else {
53 }
54
56 kc_ = (rhs_packet_size <= 8 || kc_ <= rhs_packet_size) ?
57 kc_ : (kc_ / rhs_packet_size) * rhs_packet_size;
58 }
59
60 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE StorageIndex kc() const { return kc_; }
61 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE StorageIndex mc() const { return mc_; }
62 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE StorageIndex nc() const { return nc_; }
63
64 private:
65 StorageIndex kc_;
66 StorageIndex mc_;
67 StorageIndex nc_;
68};
69
70} // end namespace internal
71} // end namespace Eigen
72
73#endif // EIGEN_CXX11_TENSOR_TENSOR_CONTRACTION_BLOCKING_H
Matrix3f m
Definition AngleAxis_mimic_euler.cpp:1
int n
Definition BiCGSTAB_simple.cpp:1
#define EIGEN_ALWAYS_INLINE
Definition Macros.h:932
#define EIGEN_DEVICE_FUNC
Definition Macros.h:976
Definition TensorContractionBlocking.h:25
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE StorageIndex nc() const
Definition TensorContractionBlocking.h:62
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE StorageIndex mc() const
Definition TensorContractionBlocking.h:61
EIGEN_DEVICE_FUNC TensorContractionBlocking(StorageIndex k, StorageIndex m, StorageIndex n, StorageIndex num_threads=1)
Definition TensorContractionBlocking.h:45
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE StorageIndex kc() const
Definition TensorContractionBlocking.h:60
@ ShardByCol
Definition TensorContractionBlocking.h:19
@ ShardByRow
Definition TensorContractionBlocking.h:18
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
Definition BandTriangularSolver.h:13
Definition GenericPacketMath.h:107
Definition ForwardDeclarations.h:17