[PATCH v1 0/6] libstdc++: submdspan for layout_{left,right,stride}.
Luc Grosheintz
luc.grosheintz@gmail.com
Sun Nov 16 19:26:09 GMT 2025
Hi Tomasz,
I've finished submdspan for the padded layouts. Essentially,
it can reuse everything that's already here. There's a few
small changes.
Do you want to first review v1; or should a immediately
replace it with v2?
Thank you,
Luc
On 11/14/25 15:09, Luc Grosheintz wrote:
> This sequence of 6 patches implements submdspan for layout_left,
> layout_right and layout_stride.
>
> The first commit is preparatory (move code, generalize code
> and fix some formatting issues). Then, each commit implements:
>
> - submdspan_canonicalize_slices,
> - submdspan_extents (with review comments on previous patch),
> - submdspan_mapping: layout_left, layout_right, layout_stride.
>
> There's one deviation related to checking:
>
> 0 <= slice_begin[k] <= slice_end[k] <= exts.extent(k)
>
> explained in detail in the corresponding commit message.
>
> The check that if slice_begin[k] == exts.extent(k) when computing the
> offset, adds a "chunk of code" that's not needed and blocks certain
> optimizations. The corresponding commit message has more details.
>
> Luc Grosheintz (6):
> libstdc++: Prepare mdspan-related code for submdspan.
> libstdc++: Implement submdspan_canonicalize_slices. [PR110352]
> libstdc++: Implement submdspan_extents. [PR110352]
> libstdc++: Implement submdspan and submdspan_mapping for layout_left.
> [PR110352]
> libstdc++: Implement submdspan_mapping for layout_right. [PR110352]
> libstdc++: Implement submdspan_mapping for layout_stride. [PR110352]
>
> libstdc++-v3/include/std/mdspan | 841 +++++++++++++++++-
> libstdc++-v3/src/c++23/std.cc.in | 6 +-
> .../testsuite/23_containers/mdspan/int_like.h | 34 +-
> .../padded_traits.h => layout_traits.h} | 65 +-
> .../23_containers/mdspan/layouts/ctors.cc | 2 +-
> .../23_containers/mdspan/layouts/mapping.cc | 2 +-
> .../23_containers/mdspan/layouts/padded.cc | 2 +-
> .../mdspan/layouts/padded_neg.cc | 2 +-
> .../mdspan/submdspan/submdspan.cc | 371 ++++++++
> .../submdspan_canonicalize_slices.cc | 212 +++++
> .../submdspan_canonicalize_slices_neg.cc | 208 +++++
> .../mdspan/submdspan/submdspan_extents.cc | 169 ++++
> .../mdspan/submdspan/submdspan_extents_neg.cc | 48 +
> .../mdspan/submdspan/submdspan_mapping.cc | 160 ++++
> .../mdspan/submdspan/submdspan_neg.cc | 120 +++
> 15 files changed, 2194 insertions(+), 48 deletions(-)
> rename libstdc++-v3/testsuite/23_containers/mdspan/{layouts/padded_traits.h => layout_traits.h} (70%)
> create mode 100644 libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan.cc
> create mode 100644 libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_canonicalize_slices.cc
> create mode 100644 libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_canonicalize_slices_neg.cc
> create mode 100644 libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_extents.cc
> create mode 100644 libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_extents_neg.cc
> create mode 100644 libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_mapping.cc
> create mode 100644 libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_neg.cc
>
More information about the Libstdc++
mailing list