| Message ID | 20250911113917.350920-1-luc.grosheintz@gmail.com |
|---|---|
| Headers |
Return-Path: <gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BE281385843A for <patchwork@sourceware.org>; Thu, 11 Sep 2025 11:42:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BE281385843A Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=E/XcPiJi X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id B3DFE3858C78 for <gcc-patches@gcc.gnu.org>; Thu, 11 Sep 2025 11:39:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B3DFE3858C78 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B3DFE3858C78 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::332 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1757590773; cv=none; b=QD9bbHY1xFT5KXqTmpwrxeMsmo4EKlG+duIpCc0BUAmpK2eBFfJZA9PgTVX49u6lfH5vD53SZtWs0KS0wrYcPPI3zbJmm6TZ2rB6e5eynH4DQD6rKRp1hOVy4SPaWJLUl+5mfsutOEf1uBPr5jsCDii31+yk9w1id2KUpYb7yqk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1757590773; c=relaxed/simple; bh=2CLIyRB0G04cv6XyEQTArLcWzD4hLGY3FNaT0GGaH1w=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=coWYvy/B2zcpA9bhXX1FhvbhXFEZ9fXtLBSIWiWsOthZcc4a1xWIHScoE9PGXWWZ/RBNdCkNaEdF48bhGaHKwdg9gDRap5N/7IUOG2kAhGfADaro07vIzdX1v+iCnRmk+JsDYPeIZp1PRZWRgKz5xwC4k/ssDgyN2mzzunJ5Gkk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3DFE3858C78 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-45cb6428c46so7796255e9.1 for <gcc-patches@gcc.gnu.org>; Thu, 11 Sep 2025 04:39:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1757590771; x=1758195571; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=MYsnVB1zHWuNBdsn1hX08D5glg5VjqhelCoe0h1/RjA=; b=E/XcPiJiZa4iqz/wHK+HxI2ALtPFj9bGocVstllnrvButYoMm+5M98WObEqBc9+q12 Uuh9pTb6nucYkH477wCBCPfJUDmCOC2kaA+DzAYkib88THLw7OlMIDkzdjMVsZ5lhFJn S7IJSvWITMneSVbkQ2K39QBDDhLAu5rN7wbf11ulMFh5pCcDkOZvOwJOBMfYKPGXBDu1 lfA6JYOCbBOFTLo8hsLbxtOlkNfQA74W9ENQVDTkItGT5V03oDdaf7p7KNaBPc0uRX20 f/QqvNOu8HyFmS4D4edjDKPiWyzyZqnm7z2S6OgeFqSXKJXKwOKFn/dwJoJbNWu67OMW Xi3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757590771; x=1758195571; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MYsnVB1zHWuNBdsn1hX08D5glg5VjqhelCoe0h1/RjA=; b=eYuy0enSXkR0lNjxyP8ZdfF6A+Pyr1gg5zvJ/5KZKOv+6nsIHt7nHL+hXf3XFUQ/jp LWr4RBqKVR0+H6xcW8pscjnMIdadpvGDS/MfQ7Zaja5jPacce20EDUm0fG6rzoTkd7sw fpOR6PFxlxvH+Ec+PhJ5EpVaYmDp/1tzmrbhxDefHrMX4UvaEyurrVoTGgUDt3m/0foj v9mBpeMiyXk6B9ctPuKlMTKjZ4+btjxck9I4B8St4vnGI/m+8S2+eq+TxOCsBpJN8nLd MLjF/NjpvRy6U0zmORqY2wrrt+c1qd4eHOhgH4+B8omQ5caTebRlCj8okc4piGD4W6D6 QC7A== X-Gm-Message-State: AOJu0Yxp/8n5xAnMkA5mHz692KefFMUyOEC9kTpXPOmsw7USdCRVGmNs 9Ppne+1ZqAl8lzmsGTkREbHBVx6vbRm30Z5jVAx/erUPf0WAFl8/lhs1 X-Gm-Gg: ASbGncu9XN3cPqMIc1AewXmIw0dvczWqp8/NKlXhWUpbz71G8Myq+dP4GJ08YMNoUcv oaYbLG7Fxxeqq8HbOlfqFSAd7shGBC3sdk21OTdsZh6HM4nYeF2JBHHYf4EFZAI1MkQ8WZbtHbY csA4qfHGTrYaPibfufj//E/LnQxOdSdXIV3/ODJ0j61qkv+TfXcMpOdFHDgTMV1H86o5nhjrD10 dHKzoym7N6RR9OonFa+SyQhJG/IHN/xIYmJr09wCgm+Z39zJDbnJfpiO2jBjnfkwVuEdtc7jSQT Yzx3pQLFpKnmYuPkAlmqnxKYMStIuZ8FY2ywvlQoeX6phjAufty5/08dMTWOwUfDQQeR/reSHMx pnTCV3NVcnuyVnR5AyOx7JYmc88kBjhuM+HPxdYqQETJ5+gIuBi8JEtORVNYfT417OUYTgiKfFM NZ9KTf X-Google-Smtp-Source: AGHT+IFuYmMp6JFrqkX9x+JQKWb/S3bL2ikPGTZzAC+d1vt0tM90I1UuXQks2mK48aNF5ey5EF8FGQ== X-Received: by 2002:a05:600c:4ed0:b0:45d:d0d6:223f with SMTP id 5b1f17b1804b1-45de5ff494cmr131185895e9.0.1757590770771; Thu, 11 Sep 2025 04:39:30 -0700 (PDT) Received: from rogui.localdomain (212-51-146-223.fiber7.init7.net. [212.51.146.223]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45e037b922csm21272855e9.15.2025.09.11.04.39.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Sep 2025 04:39:30 -0700 (PDT) From: Luc Grosheintz <luc.grosheintz@gmail.com> To: libstdc++@gcc.gnu.org Cc: gcc-patches@gcc.gnu.org, Luc Grosheintz <luc.grosheintz@gmail.com> Subject: [PATCH v2 0/5] libstdc++: Implement std::layout_left_padded. Date: Thu, 11 Sep 2025 13:39:12 +0200 Message-ID: <20250911113917.350920-1-luc.grosheintz@gmail.com> X-Mailer: git-send-email 2.50.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org |
| Series |
libstdc++: Implement std::layout_left_padded.
|
|
Message
Luc Grosheintz
Sept. 11, 2025, 11:39 a.m. UTC
Changes since v1:
- Use cmp_* when comparing two integers of differnt types.
- Remove the FTM submdspan and replace it with an unofficial
purely internal FTM called padded_layouts.
- Make __get_static_stride consteval.
- Make __is_*_padded_layout only available inside
__glibcxx_padded_layout regions.
- Use size_t for __least_multiple_at_least.
- Implement checks (mandate and prerequisite) for representable padded
static stride.
- Implement checks for representable padded "size", i.e. the product
of padded extents. This product might be larger than the
required_span_size, but the standard requires the product to be
representable (not just required_span_size).
- New overload for __static_extents(__begin, __end).
- Remove the double checked prerequisite.
- Skip some calculations for static first stride (2x).
- Replace array<..., ...> with _Stride.
- s/_S_stride_type/_Stride
- Test additional cases for default ctor.
- Rename ConversionRule::Conventional to Regular.
- Remove empty file testsuite/mdspan/layouts/debug/padded_neg.cc.
- Ensure all tests are run.
- Test remaining prerequisite in mapping(layout_stride).
I also noticed that some of the changes can be split into separate
commits.
Luc Grosheintz (5):
libstdc++: Refactor layout mapping tests to use a concept.
libstdc++: Fix bug in layout mapping tests.
libstdc++: Prepare mapping layout tests for left padded.
libstdc++: Refactor __mdspan::__static_quotient.
libstdc++: Implement std::layout_left_padded.
libstdc++-v3/include/bits/version.def | 10 +
libstdc++-v3/include/bits/version.h | 9 +
libstdc++-v3/include/std/mdspan | 541 +++++++++++++++-
libstdc++-v3/src/c++23/std.cc.in | 8 +-
.../mdspan/layouts/class_mandate_neg.cc | 1 +
.../23_containers/mdspan/layouts/ctors.cc | 61 +-
.../mdspan/layouts/debug/padded_neg.cc | 22 +
.../23_containers/mdspan/layouts/empty.cc | 12 +-
.../23_containers/mdspan/layouts/mapping.cc | 204 ++++--
.../23_containers/mdspan/layouts/padded.cc | 611 ++++++++++++++++++
.../mdspan/layouts/padded_neg.cc | 280 ++++++++
11 files changed, 1692 insertions(+), 67 deletions(-)
create mode 100644 libstdc++-v3/testsuite/23_containers/mdspan/layouts/debug/padded_neg.cc
create mode 100644 libstdc++-v3/testsuite/23_containers/mdspan/layouts/padded.cc
create mode 100644 libstdc++-v3/testsuite/23_containers/mdspan/layouts/padded_neg.cc
Comments
On Thu, Sep 11, 2025 at 1:50 PM Luc Grosheintz <luc.grosheintz@gmail.com> wrote: > Changes since v1: > > - Use cmp_* when comparing two integers of differnt types. > - Remove the FTM submdspan and replace it with an unofficial > purely internal FTM called padded_layouts. > - Make __get_static_stride consteval. > - Make __is_*_padded_layout only available inside > __glibcxx_padded_layout regions. > - Use size_t for __least_multiple_at_least. > - Implement checks (mandate and prerequisite) for representable padded > static stride. > - Implement checks for representable padded "size", i.e. the product > of padded extents. This product might be larger than the > required_span_size, but the standard requires the product to be > representable (not just required_span_size). > - New overload for __static_extents(__begin, __end). > - Remove the double checked prerequisite. > - Skip some calculations for static first stride (2x). > - Replace array<..., ...> with _Stride. > - s/_S_stride_type/_Stride > - Test additional cases for default ctor. > - Rename ConversionRule::Conventional to Regular. > - Remove empty file testsuite/mdspan/layouts/debug/padded_neg.cc. > - Ensure all tests are run. > - Test remaining prerequisite in mapping(layout_stride). > > I also noticed that some of the changes can be split into separate > commits. > Hi, The first four patches LGTM, however I will put them in one patch, that just least all made changes, they are really small. I do not think I will be able to review layout_left_padded today fully, and I will continue review in two weeks. I will post a partial notes marking them as so. > > Luc Grosheintz (5): > libstdc++: Refactor layout mapping tests to use a concept. > libstdc++: Fix bug in layout mapping tests. > libstdc++: Prepare mapping layout tests for left padded. > libstdc++: Refactor __mdspan::__static_quotient. > libstdc++: Implement std::layout_left_padded. > > libstdc++-v3/include/bits/version.def | 10 + > libstdc++-v3/include/bits/version.h | 9 + > libstdc++-v3/include/std/mdspan | 541 +++++++++++++++- > libstdc++-v3/src/c++23/std.cc.in | 8 +- > .../mdspan/layouts/class_mandate_neg.cc | 1 + > .../23_containers/mdspan/layouts/ctors.cc | 61 +- > .../mdspan/layouts/debug/padded_neg.cc | 22 + > .../23_containers/mdspan/layouts/empty.cc | 12 +- > .../23_containers/mdspan/layouts/mapping.cc | 204 ++++-- > .../23_containers/mdspan/layouts/padded.cc | 611 ++++++++++++++++++ > .../mdspan/layouts/padded_neg.cc | 280 ++++++++ > 11 files changed, 1692 insertions(+), 67 deletions(-) > create mode 100644 > libstdc++-v3/testsuite/23_containers/mdspan/layouts/debug/padded_neg.cc > create mode 100644 > libstdc++-v3/testsuite/23_containers/mdspan/layouts/padded.cc > create mode 100644 > libstdc++-v3/testsuite/23_containers/mdspan/layouts/padded_neg.cc > > -- > 2.50.1 > >
On 9/11/25 14:41, Tomasz Kaminski wrote: > On Thu, Sep 11, 2025 at 1:50 PM Luc Grosheintz <luc.grosheintz@gmail.com> > wrote: > >> Changes since v1: >> >> - Use cmp_* when comparing two integers of differnt types. >> - Remove the FTM submdspan and replace it with an unofficial >> purely internal FTM called padded_layouts. >> - Make __get_static_stride consteval. >> - Make __is_*_padded_layout only available inside >> __glibcxx_padded_layout regions. >> - Use size_t for __least_multiple_at_least. >> - Implement checks (mandate and prerequisite) for representable padded >> static stride. >> - Implement checks for representable padded "size", i.e. the product >> of padded extents. This product might be larger than the >> required_span_size, but the standard requires the product to be >> representable (not just required_span_size). >> - New overload for __static_extents(__begin, __end). >> - Remove the double checked prerequisite. >> - Skip some calculations for static first stride (2x). >> - Replace array<..., ...> with _Stride. >> - s/_S_stride_type/_Stride >> - Test additional cases for default ctor. >> - Rename ConversionRule::Conventional to Regular. >> - Remove empty file testsuite/mdspan/layouts/debug/padded_neg.cc. >> - Ensure all tests are run. >> - Test remaining prerequisite in mapping(layout_stride). >> >> I also noticed that some of the changes can be split into separate >> commits. >> > Hi, > The first four patches LGTM, however I will put them in one patch, > that just least all made changes, they are really small. > I do not think I will be able to review layout_left_padded today fully, > and I will continue review in two weeks. I will post a partial notes > marking them as so. Thank you for the reviews. Sorry for reacting slowly, but it might be easiest to postpone the review. I'll likely be able to make progress on layout_right_padded (now that many things are cleared up). The right-padded layout will likely require that I generalize certain concepts, e.g. a "padded stride" instead of a first/last stride. > > >> >> Luc Grosheintz (5): >> libstdc++: Refactor layout mapping tests to use a concept. >> libstdc++: Fix bug in layout mapping tests. >> libstdc++: Prepare mapping layout tests for left padded. >> libstdc++: Refactor __mdspan::__static_quotient. >> libstdc++: Implement std::layout_left_padded. >> >> libstdc++-v3/include/bits/version.def | 10 + >> libstdc++-v3/include/bits/version.h | 9 + >> libstdc++-v3/include/std/mdspan | 541 +++++++++++++++- >> libstdc++-v3/src/c++23/std.cc.in | 8 +- >> .../mdspan/layouts/class_mandate_neg.cc | 1 + >> .../23_containers/mdspan/layouts/ctors.cc | 61 +- >> .../mdspan/layouts/debug/padded_neg.cc | 22 + >> .../23_containers/mdspan/layouts/empty.cc | 12 +- >> .../23_containers/mdspan/layouts/mapping.cc | 204 ++++-- >> .../23_containers/mdspan/layouts/padded.cc | 611 ++++++++++++++++++ >> .../mdspan/layouts/padded_neg.cc | 280 ++++++++ >> 11 files changed, 1692 insertions(+), 67 deletions(-) >> create mode 100644 >> libstdc++-v3/testsuite/23_containers/mdspan/layouts/debug/padded_neg.cc >> create mode 100644 >> libstdc++-v3/testsuite/23_containers/mdspan/layouts/padded.cc >> create mode 100644 >> libstdc++-v3/testsuite/23_containers/mdspan/layouts/padded_neg.cc >> >> -- >> 2.50.1 >> >> >
On 9/11/25 3:58 PM, Luc Grosheintz wrote: > > > On 9/11/25 14:41, Tomasz Kaminski wrote: >> On Thu, Sep 11, 2025 at 1:50 PM Luc Grosheintz <luc.grosheintz@gmail.com> >> wrote: >> >>> Changes since v1: >>> >>> - Use cmp_* when comparing two integers of differnt types. >>> - Remove the FTM submdspan and replace it with an unofficial >>> purely internal FTM called padded_layouts. >>> - Make __get_static_stride consteval. >>> - Make __is_*_padded_layout only available inside >>> __glibcxx_padded_layout regions. >>> - Use size_t for __least_multiple_at_least. >>> - Implement checks (mandate and prerequisite) for representable >>> padded >>> static stride. >>> - Implement checks for representable padded "size", i.e. the product >>> of padded extents. This product might be larger than the >>> required_span_size, but the standard requires the product to be >>> representable (not just required_span_size). >>> - New overload for __static_extents(__begin, __end). >>> - Remove the double checked prerequisite. >>> - Skip some calculations for static first stride (2x). >>> - Replace array<..., ...> with _Stride. >>> - s/_S_stride_type/_Stride >>> - Test additional cases for default ctor. >>> - Rename ConversionRule::Conventional to Regular. >>> - Remove empty file testsuite/mdspan/layouts/debug/padded_neg.cc. >>> - Ensure all tests are run. >>> - Test remaining prerequisite in mapping(layout_stride). >>> >>> I also noticed that some of the changes can be split into separate >>> commits. >>> >> Hi, >> The first four patches LGTM, however I will put them in one patch, >> that just least all made changes, they are really small. >> I do not think I will be able to review layout_left_padded today fully, >> and I will continue review in two weeks. I will post a partial notes >> marking them as so. > > Thank you for the reviews. Sorry for reacting slowly, but it might be > easiest to postpone the review. I'll likely be able to make progress > on layout_right_padded (now that many things are cleared up). > > The right-padded layout will likely require that I generalize certain > concepts, e.g. a "padded stride" instead of a first/last stride. > Earlier last week, I implemented the layout_right_padded. It's essentially identical if one replaces s/0/rank-1/ s/1/rank-2/ (more or less). One can avoid duplicating the entire logic for checking mandates/prerequisites by creating a object "storage" that contains the _M_stride and _M_extents. The padded tests all get indented, because one needs to pass in the layout template; and some other changes to make it work for both layouts. Since a lot of code changes/moves around, how would you like to review it: 1. A v3 with just the fixes for layout_left_padded. Then a refactor commit. Followed by layout_right_padded? 2. Squash the refactoring into the v3 of layout_left_padded. Then add layout_right_padded? >> >> >>> >>> Luc Grosheintz (5): >>> libstdc++: Refactor layout mapping tests to use a concept. >>> libstdc++: Fix bug in layout mapping tests. >>> libstdc++: Prepare mapping layout tests for left padded. >>> libstdc++: Refactor __mdspan::__static_quotient. >>> libstdc++: Implement std::layout_left_padded. >>> >>> libstdc++-v3/include/bits/version.def | 10 + >>> libstdc++-v3/include/bits/version.h | 9 + >>> libstdc++-v3/include/std/mdspan | 541 +++++++++++++++- >>> libstdc++-v3/src/c++23/std.cc.in | 8 +- >>> .../mdspan/layouts/class_mandate_neg.cc | 1 + >>> .../23_containers/mdspan/layouts/ctors.cc | 61 +- >>> .../mdspan/layouts/debug/padded_neg.cc | 22 + >>> .../23_containers/mdspan/layouts/empty.cc | 12 +- >>> .../23_containers/mdspan/layouts/mapping.cc | 204 ++++-- >>> .../23_containers/mdspan/layouts/padded.cc | 611 ++++++++++++++++++ >>> .../mdspan/layouts/padded_neg.cc | 280 ++++++++ >>> 11 files changed, 1692 insertions(+), 67 deletions(-) >>> create mode 100644 >>> libstdc++-v3/testsuite/23_containers/mdspan/layouts/debug/padded_neg.cc >>> create mode 100644 >>> libstdc++-v3/testsuite/23_containers/mdspan/layouts/padded.cc >>> create mode 100644 >>> libstdc++-v3/testsuite/23_containers/mdspan/layouts/padded_neg.cc >>> >>> -- >>> 2.50.1 >>> >>> >> >
On Mon, Sep 22, 2025 at 7:40 AM Luc Grosheintz <luc.grosheintz@gmail.com> wrote: > > > On 9/11/25 3:58 PM, Luc Grosheintz wrote: > > > > > > On 9/11/25 14:41, Tomasz Kaminski wrote: > >> On Thu, Sep 11, 2025 at 1:50 PM Luc Grosheintz < > luc.grosheintz@gmail.com> > >> wrote: > >> > >>> Changes since v1: > >>> > >>> - Use cmp_* when comparing two integers of differnt types. > >>> - Remove the FTM submdspan and replace it with an unofficial > >>> purely internal FTM called padded_layouts. > >>> - Make __get_static_stride consteval. > >>> - Make __is_*_padded_layout only available inside > >>> __glibcxx_padded_layout regions. > >>> - Use size_t for __least_multiple_at_least. > >>> - Implement checks (mandate and prerequisite) for representable > >>> padded > >>> static stride. > >>> - Implement checks for representable padded "size", i.e. the product > >>> of padded extents. This product might be larger than the > >>> required_span_size, but the standard requires the product to be > >>> representable (not just required_span_size). > >>> - New overload for __static_extents(__begin, __end). > >>> - Remove the double checked prerequisite. > >>> - Skip some calculations for static first stride (2x). > >>> - Replace array<..., ...> with _Stride. > >>> - s/_S_stride_type/_Stride > >>> - Test additional cases for default ctor. > >>> - Rename ConversionRule::Conventional to Regular. > >>> - Remove empty file testsuite/mdspan/layouts/debug/padded_neg.cc. > >>> - Ensure all tests are run. > >>> - Test remaining prerequisite in mapping(layout_stride). > >>> > >>> I also noticed that some of the changes can be split into separate > >>> commits. > >>> > >> Hi, > >> The first four patches LGTM, however I will put them in one patch, > >> that just least all made changes, they are really small. > >> I do not think I will be able to review layout_left_padded today fully, > >> and I will continue review in two weeks. I will post a partial notes > >> marking them as so. > > > > Thank you for the reviews. Sorry for reacting slowly, but it might be > > easiest to postpone the review. I'll likely be able to make progress > > on layout_right_padded (now that many things are cleared up). > > > > The right-padded layout will likely require that I generalize certain > > concepts, e.g. a "padded stride" instead of a first/last stride. > > > > Earlier last week, I implemented the layout_right_padded. It's > essentially identical if one replaces > s/0/rank-1/ > s/1/rank-2/ > > (more or less). One can avoid duplicating the entire logic > for checking mandates/prerequisites by creating a object > "storage" that contains the _M_stride and _M_extents. > We could then also provide enough interface for this storage object, so it could be used with indexing operators, if we make them templated on just typename _Extents. I think just having an extent function that would return adjusted for stride will be sufficient. I think we could do something similar with representable size and empty, for storage object: __static_extents -> drop the leftmost/rightmost extent __dynamic_extents -> drop the leftmost/rightmost extent __padded_extents -> return: * integral_constant<size_t, 1> for non-padded layouts, this way we can always add it, but it will not affect computation * integral_constant<size_t, X> for padded with static strides * size_t for padded with dynamic stride Or __padded_extents could return: extents<IndexType> const& for extents, just have constexpr inline global variable that we would return address off, extents<IndexType, X> const& for padded storage. > > The padded tests all get indented, because one needs to pass > in the layout template; and some other changes to make it > work for both layouts. > > Since a lot of code changes/moves around, how would you like > to review it: > > 1. A v3 with just the fixes for layout_left_padded. Then > a refactor commit. Followed by layout_right_padded? > > 2. Squash the refactoring into the v3 of layout_left_padded. > Then add layout_right_padded? > If the suggestion above would allow us to merge a lot of the now separate code, I would prefer squashed refactoring of v3 of layout_left padded. > > >> > >> > >>> > >>> Luc Grosheintz (5): > >>> libstdc++: Refactor layout mapping tests to use a concept. > >>> libstdc++: Fix bug in layout mapping tests. > >>> libstdc++: Prepare mapping layout tests for left padded. > >>> libstdc++: Refactor __mdspan::__static_quotient. > >>> libstdc++: Implement std::layout_left_padded. > >>> > >>> libstdc++-v3/include/bits/version.def | 10 + > >>> libstdc++-v3/include/bits/version.h | 9 + > >>> libstdc++-v3/include/std/mdspan | 541 +++++++++++++++- > >>> libstdc++-v3/src/c++23/std.cc.in | 8 +- > >>> .../mdspan/layouts/class_mandate_neg.cc | 1 + > >>> .../23_containers/mdspan/layouts/ctors.cc | 61 +- > >>> .../mdspan/layouts/debug/padded_neg.cc | 22 + > >>> .../23_containers/mdspan/layouts/empty.cc | 12 +- > >>> .../23_containers/mdspan/layouts/mapping.cc | 204 ++++-- > >>> .../23_containers/mdspan/layouts/padded.cc | 611 > ++++++++++++++++++ > >>> .../mdspan/layouts/padded_neg.cc | 280 ++++++++ > >>> 11 files changed, 1692 insertions(+), 67 deletions(-) > >>> create mode 100644 > >>> libstdc++-v3/testsuite/23_containers/mdspan/layouts/debug/padded_neg.cc > >>> create mode 100644 > >>> libstdc++-v3/testsuite/23_containers/mdspan/layouts/padded.cc > >>> create mode 100644 > >>> libstdc++-v3/testsuite/23_containers/mdspan/layouts/padded_neg.cc > >>> > >>> -- > >>> 2.50.1 > >>> > >>> > >> > > > >