Layouts take padding parameter: layout_left_padded<PaddingValue>
The padding stride (i.e. stride(1) for layout_left_padded or stride(extents_type::rank()-1) for layout_right_padded) is the next larger multiple of PaddingValue for the corresponding extent.
Padded Layouts
layout_left_padded
andlayout_right_padded
layout_left
andlayout_right
but store one stride, allowing padding of the leftmost or rightmost dimensionCompare memory storage of
layout_left
andlayout_left_padded
:layout_left_padded<PaddingValue>
stride(1)
forlayout_left_padded
orstride(extents_type::rank()-1)
forlayout_right_padded
) is the next larger multiple ofPaddingValue
for the corresponding extent.PaddingValue
can be static or dynamic (std::dynamic_extent
)Use cases:
submdspan
forlayout_left
,layout_right
layout_stride
but preserve the stride-1 compile time knowledge for a lot of common caseslinalg
proposalmdspan
predecessorKokkos::View
Impact on existing elements in C++23/26 draft
layout_left
andlayout_right
stride(0) == extents().extent(0)
etc.layout_left_padded
tolayout_right
etc.submdspan