From: Wolfgang Bangerth Date: Sat, 30 Mar 2024 15:03:26 +0000 (-0600) Subject: Revert "Align Tensor to make vectorization possible." X-Git-Tag: v9.6.0-rc1~423^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91d639ccbe11137db0ca5d0b3266bfa2cbe3e6aa;p=dealii.git Revert "Align Tensor to make vectorization possible." This reverts commit d6a65a9b929b1862a78de843ceaa7848e5a588e3. --- diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index 3cba07e361..03c3b5f3f0 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -393,55 +393,6 @@ private: -namespace internal -{ - namespace TensorImplementation - { - /** - * Whether or not the 'values' array of Tensor can be treated as (i.e., - * bitcasted to) a vectorized array (of possibly more than 'dim' elements, - * where the padding elements would then have to - * be ignored by all functions). - * - * We can store the values as an array that can be casted to VectorizedArray - * if we are considering a rank-1 tensor, and if it stores `double` or - * `float` values, and if there are at most 4 values -- we do not try to - * vectorize the uncommon case of `dim>4`. We also don't consider the case - * `dim==1` because in that case vectorization does not provide any benefit. - * - * Note that this leads to a platform dependent alignment given that - * we want to treat the elements as VectorizedArray and that whether - * or not a VectorizedArray of sufficiently large size exists depends - * on the platform we're on. - */ - template - constexpr bool can_treat_values_as_vectorized_array = - ((rank == 1) && - /* Only if dim==2,3,4 */ - (dim > 1) && (dim <= 4) && - /* Only for float and double tensors */ - (std::is_same_v || std::is_same_v)&& - /* Only if a VectorizedArray is avaiable where N>=dim - (but we only have to consider N=2 or 4 because dim==2,3,4). */ - (internal::VectorizedArrayWidthSpecifier::max_width >= - (dim <= 2 ? 2 : 4))); - - /** - * Compute the alignment to be used for Tensor objects. We align it - * by 2 or 4 times the size of the scalar object for rank-1 tensors if - * rank-1 tensors can be treated as vectorized arrays (which makes sure that - * the higher-rank tensors are then also so aligned). Otherwise, set the - * alignment to the alignment of `Number`. - */ - template - constexpr size_t tensor_alignment = - (can_treat_values_as_vectorized_array<1, dim, Number> ? - (dim <= 2 ? 2 : 4) * sizeof(Number) : - alignof(Number)); - } // namespace TensorImplementation -} // namespace internal - - /** * A general tensor class with an arbitrary rank, i.e. with an arbitrary * number of indices. The Tensor class provides an indexing operator and a bit @@ -516,8 +467,7 @@ namespace internal * @ingroup geomprimitives */ template -class alignas( - internal::TensorImplementation::tensor_alignment) Tensor +class Tensor { public: static_assert(rank_ >= 1,