1#ifndef FUSED_PERMUTED_VIEW_CONSTEXPR_H
2#define FUSED_PERMUTED_VIEW_CONSTEXPR_H
34template <
typename Tensor,
my_size_t... Perm>
38 static_assert(
sizeof...(Perm) == Tensor::NumDims,
39 "Permutation pack must match tensor's number of dimensions");
42 "Permutation indices must be unique");
44 static_assert(
max_value<Perm...>() < Tensor::NumDims,
45 "Max value of permutation pack is greater than the tensor's number of dimensions");
48 "Min value of permutation pack is not equal to 0");
52 using PadPolicy =
typename Tensor::AccessPolicy::PadPolicy;
71 template <
typename Output>
74 return t_.may_alias(output);
78 template <
typename... Indices>
79 requires(
sizeof...(Indices) ==
NumDims)
123 template <
typename T, my_
size_t Bits,
typename Arch>
127 constexpr my_size_t width = K::simdWidth;
133 return K::gather(t_.data_.data(), idxList);
136 template <
typename T, my_
size_t Bits,
typename Arch>
140 return evalu<T, Bits, Arch>(logical_flat);
175 std::string shape =
"(";
178 shape += std::to_string(
getDim(i));
static void log(const T &msg, ErrorLevel level=ErrorLevel::Plain)
Definition error_handler.h:18
Compile-time permuted view over a tensor.
Definition permuted_view_constexpr.h:36
bool may_alias(const Output &output) const noexcept
Definition permuted_view_constexpr.h:72
static FORCE_INLINE constexpr my_size_t getTotalSize() noexcept
Definition permuted_view_constexpr.h:155
PermutedViewConstExpr(const PermutedViewConstExpr &)=delete
FORCE_INLINE Microkernel< T, Bits, Arch >::VecType evalu(my_size_t logical_flat) const noexcept
SIMD EVALUATION — logical flat, K::gather.
Definition permuted_view_constexpr.h:124
static constexpr my_size_t Dim[]
Definition permuted_view_constexpr.h:56
static FORCE_INLINE constexpr my_size_t getDim(my_size_t i) TESSERACT_CONDITIONAL_NOEXCEPT
Definition permuted_view_constexpr.h:143
FORCE_INLINE Microkernel< T, Bits, Arch >::VecType logical_evalu(my_size_t logical_flat) const noexcept
Definition permuted_view_constexpr.h:137
static constexpr my_size_t NumDims
Definition permuted_view_constexpr.h:55
FORCE_INLINE const value_type & operator()(const my_size_t *indices) const TESSERACT_CONDITIONAL_NOEXCEPT
Definition permuted_view_constexpr.h:92
std::string getShape() const
Definition permuted_view_constexpr.h:173
void printLayoutInfo() const
Definition permuted_view_constexpr.h:158
typename Tensor::value_type value_type
Definition permuted_view_constexpr.h:51
PermutedViewConstExpr & operator=(PermutedViewConstExpr &&)=delete
FORCE_INLINE constexpr const value_type * data() const noexcept
Definition permuted_view_constexpr.h:186
static FORCE_INLINE constexpr my_size_t getStride(my_size_t i) TESSERACT_CONDITIONAL_NOEXCEPT
Definition permuted_view_constexpr.h:148
typename Tensor::AccessPolicy::PadPolicy PadPolicy
Definition permuted_view_constexpr.h:52
FORCE_INLINE constexpr value_type * data() noexcept
Definition permuted_view_constexpr.h:187
static FORCE_INLINE constexpr my_size_t getNumDims() noexcept
Definition permuted_view_constexpr.h:153
PermutedViewConstExpr(PermutedViewConstExpr &&)=delete
FORCE_INLINE const value_type & operator()(my_size_t(&indices)[NumDims]) const TESSERACT_CONDITIONAL_NOEXCEPT
Definition permuted_view_constexpr.h:87
static constexpr my_size_t TotalSize
Definition permuted_view_constexpr.h:57
PermutedViewConstExpr & operator=(const PermutedViewConstExpr &)=delete
FORCE_INLINE const Tensor & transpose() const noexcept
Definition permuted_view_constexpr.h:170
PermutedViewConstExpr(const Tensor &t) noexcept
Definition permuted_view_constexpr.h:59
Global configuration for the tesseract tensor library.
#define my_size_t
Size/index type used throughout the library.
Definition config.h:126
#define TESSERACT_CONDITIONAL_NOEXCEPT
Definition config.h:56
#define FORCE_INLINE
Hint the compiler to always inline a function.
Definition config.h:26
consteval my_size_t max_value()
Compile-time maximum of a non-type parameter pack.
Definition helper_traits.h:49
consteval my_size_t min_value()
Compile-time minimum of a non-type parameter pack.
Definition helper_traits.h:68
consteval bool all_unique()
Check if all values in a pack are unique.
Definition helper_traits.h:133
Definition microkernel_base.h:16
T VecType
Definition microkernel_base.h:18
Compile-time strided layout with optional permutation.
Definition strided_layout_constexpr.h:38
static constexpr my_size_t NumDims
Definition strided_layout_constexpr.h:39
static FORCE_INLINE constexpr my_size_t logical_flat_to_physical_flat(my_size_t logical_flat) TESSERACT_CONDITIONAL_NOEXCEPT
Definition strided_layout_constexpr.h:290
static FORCE_INLINE constexpr my_size_t stride(my_size_t i) TESSERACT_CONDITIONAL_NOEXCEPT
Get physical stride at dimension i (with permutation applied).
Definition strided_layout_constexpr.h:263
static FORCE_INLINE constexpr my_size_t logical_coords_to_physical_flat(const my_size_t(&indices)[NumDims]) TESSERACT_CONDITIONAL_NOEXCEPT
Logical coordinates (Array multi-index) to physical flat index (bounds-checked).
Definition strided_layout_constexpr.h:328
static FORCE_INLINE constexpr my_size_t logical_dim(my_size_t i) TESSERACT_CONDITIONAL_NOEXCEPT
Get logical dimension at index i (with permutation applied).
Definition strided_layout_constexpr.h:239