From 13c3327f5cf829fd9d04a2ab46861e722cd74ca0 Mon Sep 17 00:00:00 2001 From: Eugene Zhulenev Date: Tue, 12 Nov 2019 10:12:28 -0800 Subject: Remove legacy block evaluation support --- unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h | 108 --------------------- 1 file changed, 108 deletions(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h') 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, Device enum { IsAligned = false, PacketAccess = TensorEvaluator::PacketAccess, - BlockAccess = true, BlockAccessV2 = NumDims > 0, PreferBlockAccess = true, Layout = TensorEvaluator::Layout, @@ -248,112 +247,6 @@ struct TensorEvaluator, 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::BlockAccess && - // TensorEvaluator::PreferBlockAccess; - - static const bool isColMajor = - static_cast(Layout) == static_cast(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 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, Device> enum { IsAligned = false, PacketAccess = TensorEvaluator::PacketAccess, - BlockAccess = false, BlockAccessV2 = false, PreferBlockAccess = false, Layout = TensorEvaluator::Layout, -- cgit v1.2.3