aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h
diff options
context:
space:
mode:
authorGravatar Eugene Zhulenev <ezhulenev@google.com>2019-11-12 10:12:28 -0800
committerGravatar Eugene Zhulenev <ezhulenev@google.com>2019-11-12 10:12:28 -0800
commit13c3327f5cf829fd9d04a2ab46861e722cd74ca0 (patch)
tree20bd1a5f361023db822298696efbcff7378ab4a7 /unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h
parent71aa53dd6dfdc497324d9e87f59c4ba820191856 (diff)
Remove legacy block evaluation support
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h')
-rw-r--r--unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h108
1 files changed, 0 insertions, 108 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h b/unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h
index ae3ab5f81..1db5d2e5e 100644
--- a/unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h
+++ b/unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h
@@ -115,7 +115,6 @@ struct TensorEvaluator<const TensorReverseOp<ReverseDimensions, ArgType>, Device
enum {
IsAligned = false,
PacketAccess = TensorEvaluator<ArgType, Device>::PacketAccess,
- BlockAccess = true,
BlockAccessV2 = NumDims > 0,
PreferBlockAccess = true,
Layout = TensorEvaluator<ArgType, Device>::Layout,
@@ -248,112 +247,6 @@ struct TensorEvaluator<const TensorReverseOp<ReverseDimensions, ArgType>, Device
internal::kSkewedInnerDims, block_total_size_max));
}
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void block(
- OutputTensorBlock* output_block) const {
- if (NumDims <= 0) return;
-
- // TODO(ezhulenev): If underlying tensor expression supports and prefers
- // block evaluation we must use it. Currently we use coeff and packet
- // access into the underlying tensor expression.
- // static const bool useBlockAccessForArgType =
- // TensorEvaluator<ArgType, Device>::BlockAccess &&
- // TensorEvaluator<ArgType, Device>::PreferBlockAccess;
-
- static const bool isColMajor =
- static_cast<int>(Layout) == static_cast<int>(ColMajor);
-
- static const Index inner_dim_idx = isColMajor ? 0 : NumDims - 1;
- const bool inner_dim_reversed = m_reverse[inner_dim_idx];
-
- CoeffReturnType* data = output_block->data();
- Index block_offset = 0;
-
- Index input_offset = reverseIndex(output_block->first_coeff_index());
-
- // Initialize output block iterator state. Dimension in this array are
- // always in inner_most -> outer_most order (col major layout).
- array<BlockIteratorState, NumDims> it;
- for (Index i = 0; i < NumDims; ++i) {
- const Index dim = isColMajor ? i : NumDims - 1 - i;
- it[i].size = output_block->block_sizes()[dim];
- it[i].count = 0;
- it[i].reverse = m_reverse[dim];
-
- it[i].block_stride = output_block->block_strides()[dim];
- it[i].block_span = it[i].block_stride * (it[i].size - 1);
-
- it[i].input_stride = m_strides[dim];
- it[i].input_span = it[i].input_stride * (it[i].size - 1);
-
- if (it[i].reverse) {
- it[i].input_stride = -1 * it[i].input_stride;
- it[i].input_span = -1 * it[i].input_span;
- }
- }
-
- // If multiple inner dimensions have the same reverse flag, check if we can
- // merge them into a single virtual inner dimension.
- int effective_inner_dim = 0;
- for (int i = 1; i < NumDims; ++i) {
- if (it[i].reverse != it[effective_inner_dim].reverse) break;
- if (it[i].block_stride != it[effective_inner_dim].size) break;
- if (it[i].block_stride != numext::abs(it[i].input_stride)) break;
-
- it[i].size = it[effective_inner_dim].size * it[i].size;
-
- it[i].block_stride = 1;
- it[i].input_stride = (inner_dim_reversed ? -1 : 1);
-
- it[i].block_span = it[i].block_stride * (it[i].size - 1);
- it[i].input_span = it[i].input_stride * (it[i].size - 1);
-
- effective_inner_dim = i;
- }
-
- eigen_assert(it[effective_inner_dim].block_stride == 1);
- eigen_assert(it[effective_inner_dim].input_stride ==
- (inner_dim_reversed ? -1 : 1));
-
- const Index inner_dim_size = it[effective_inner_dim].size;
-
- while (it[NumDims - 1].count < it[NumDims - 1].size) {
- // Copy inner-most dimension data from reversed location in input.
- Index dst = block_offset;
- Index src = input_offset;
-
- // NOTE(ezhulenev): Adding vectorized path with internal::preverse showed
- // worse results in benchmarks than a simple coefficient loop.
- if (inner_dim_reversed) {
- for (Index i = 0; i < inner_dim_size; ++i) {
- data[dst] = m_impl.coeff(src);
- ++dst;
- --src;
- }
- } else {
- for (Index i = 0; i < inner_dim_size; ++i) {
- data[dst] = m_impl.coeff(src);
- ++dst;
- ++src;
- }
- }
-
- // For the 1d tensor we need to generate only one inner-most dimension.
- if ((NumDims - effective_inner_dim) == 1) break;
-
- // Update offset.
- for (Index i = effective_inner_dim + 1; i < NumDims; ++i) {
- if (++it[i].count < it[i].size) {
- block_offset += it[i].block_stride;
- input_offset += it[i].input_stride;
- break;
- }
- if (i != NumDims - 1) it[i].count = 0;
- block_offset -= it[i].block_span;
- input_offset -= it[i].input_span;
- }
- }
- }
-
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlockV2
blockV2(TensorBlockDesc& desc, TensorBlockScratch& scratch,
bool /*root_of_expr_ast*/ = false) const {
@@ -535,7 +428,6 @@ struct TensorEvaluator<TensorReverseOp<ReverseDimensions, ArgType>, Device>
enum {
IsAligned = false,
PacketAccess = TensorEvaluator<ArgType, Device>::PacketAccess,
- BlockAccess = false,
BlockAccessV2 = false,
PreferBlockAccess = false,
Layout = TensorEvaluator<ArgType, Device>::Layout,