[PATCH v2 1/5] libstdc++: Refactor layout mapping tests to use a concept.

2025-09-12 Thread Luc Grosheintz
youts/mapping.cc (has_static_is_exhaustive): New concept. (test_mapping_properties): Update test. Signed-off-by: Luc Grosheintz --- .../testsuite/23_containers/mdspan/layouts/mapping.cc | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libstdc

Re: [PATCH v1] libstdc++: Implement std::layout_left_padded.

2025-09-11 Thread Luc Grosheintz
On 9/9/25 15:54, Tomasz Kaminski wrote: On Mon, Sep 8, 2025 at 10:14 PM Luc Grosheintz wrote: I decided to deviate once (described in detail in the commit message). Without this deviation writing tests is very clumsy and sometimes not possible, e.g. when mixing uint8_t and dynamic padding

Re: [PATCH v2 5/5] libstdc++: Implement std::layout_left_padded.

2025-09-11 Thread Luc Grosheintz
On 9/11/25 17:05, Luc Grosheintz wrote: Static checks already cover this. but what if `_M_exents is completely dynamic, e.g.   std::extents{128, 4} I see, we can constexpr if the check away for fully static extents.

[PATCH v1] libstdc++: Rename _S-prefixed identifiers in .

2025-09-11 Thread Luc Grosheintz
ssage. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 33 ++- .../23_containers/mdspan/class_mandate_neg.cc | 2 +- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan

Re: [PATCH v2 0/5] libstdc++: Implement std::layout_left_padded.

2025-09-11 Thread Luc Grosheintz
On 9/11/25 14:41, Tomasz Kaminski wrote: On Thu, Sep 11, 2025 at 1:50 PM Luc Grosheintz 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

[PATCH v2 2/5] libstdc++: Fix bug in layout mapping tests.

2025-09-11 Thread Luc Grosheintz
libstdc++-v3/ChangeLog: * testsuite/23_containers/mdspan/layouts/mapping.cc (test_stride_1d): Fix test. Signed-off-by: Luc Grosheintz --- libstdc++-v3/testsuite/23_containers/mdspan/layouts/mapping.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc

[PATCH v2 0/5] libstdc++: Implement std::layout_left_padded.

2025-09-11 Thread Luc Grosheintz
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::_

Re: [PATCH v1] libstdc++: Implement std::layout_left_padded.

2025-09-11 Thread Luc Grosheintz
On 9/11/25 9:40 AM, Tomasz Kaminski wrote: - The tests contain a function: constexpr bool is_same_mapping(const auto& lhs, const auto& rhs) // ... for (size_t i = 0; i < lhs.extents().rank(); ++i)

Re: [PATCH v1] libstdc++: Implement std::layout_left_padded.

2025-09-11 Thread Luc Grosheintz
On 9/9/25 9:48 AM, Tomasz Kaminski wrote: On Mon, Sep 8, 2025 at 10:14 PM Luc Grosheintz wrote: I decided to deviate once (described in detail in the commit message). Without this deviation writing tests is very clumsy and sometimes not possible, e.g. when mixing uint8_t and dynamic

Re: [PATCH v1] libstdc++: Implement std::layout_left_padded.

2025-09-10 Thread Luc Grosheintz
On 9/9/25 12:00 PM, Tomasz Kaminski wrote: On Mon, Sep 8, 2025 at 10:14 PM Luc Grosheintz wrote: I decided to deviate once (described in detail in the commit message). Without this deviation writing tests is very clumsy and sometimes not possible, e.g. when mixing uint8_t and dynamic

[PATCH v2] libstdc++: Rename _S-prefixed identifiers in .

2025-09-10 Thread Luc Grosheintz
e new error message. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 34 +-- .../23_containers/mdspan/class_mandate_neg.cc | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/in

[PATCH v2] libstdc++: Convertibility of rank == 0 layouts, LWG4272.

2025-09-09 Thread Luc Grosheintz
new behavior. * testsuite/23_containers/mdspan/layouts/padded.cc: Update test for new behavior. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 15 +++- .../23_containers/mdspan/layouts/ctors.cc | 82 +++ .../23_containers/mdspan/layouts/padd

[PATCH v1] libstdc++: Implement std::layout_left_padded.

2025-09-08 Thread Luc Grosheintz
te/23_containers/mdspan/layouts/debug/padded_neg.cc: New test. * testsuite/23_containers/mdspan/layouts/padded.cc: New test. * testsuite/23_containers/mdspan/layouts/padded_neg.cc: New test. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/bits/version.def |

Re: [PATCH v1] libstdc++: Apply LWG4351 to CTAD of span/mdspan.

2025-09-08 Thread Luc Grosheintz
On 9/7/25 5:34 PM, Jonathan Wakely wrote: On Sat, 6 Sept 2025 at 14:12, Luc Grosheintz wrote: The concept __integral_constant_like doesn't consider traits with a boolean member `value` as an integer constant. This is done to reject various completely unrelated traits like is_

Re: [PATCH v2 2/3] libstdc++: Implement constant_wrapper, cw from P2781R9.

2025-09-07 Thread Luc Grosheintz
On 9/4/25 11:40, Tomasz Kaminski wrote: On Wed, Sep 3, 2025 at 4:54 PM Luc Grosheintz wrote: On 9/2/25 13:45, Tomasz Kaminski wrote: On Tue, Sep 2, 2025 at 10:07 AM Luc Grosheintz This is a partial implementation of P2781R9. It adds std::cw and std::constant_wrapper, but doesn't m

[PATCH v3 0/2] libstdc++: Implement the constant_wrapper paper P2781R9.

2025-09-07 Thread Luc Grosheintz
Removed adl.cc because instantiate.cc is a better test of the ADL behaviour. Luc Grosheintz (2): libstdc++: Implement constant_wrapper, cw from P2781R9. libstdc++: Adjust span/mdspan CTAD for P2781R9. libstdc++-v3/include/bits/version.def | 8 + libstdc++-v3/include/bits/version.h

Re: [PATCH v3 2/2] libstdc++: Adjust span/mdspan CTAD for P2781R9.

2025-09-06 Thread Luc Grosheintz
On 9/5/25 19:58, Jonathan Wakely wrote: On Fri, 5 Sept 2025 at 16:26, Jonathan Wakely wrote: On Thu, 4 Sept 2025 at 13:22, Luc Grosheintz wrote: A usecase for P2781R9 is more ergonomic creation of span and mdspan with mixed static and dynamic extents, e.g.: span(ptr, cw&l

[PATCH v1] libstdc++: Apply LWG4351 to CTAD of span/mdspan.

2025-09-06 Thread Luc Grosheintz
g if _Tp::value is boolean. * testsuite/23_containers/mdspan/extents/misc.cc: Update test. * testsuite/23_containers/mdspan/mdspan.cc: Ditto. * testsuite/23_containers/span/deduction.cc: Ditto. Signed-off-by: Luc Grosheintz --- libstdc++-v3/i

Re: [PATCH v3 0/2] libstdc++: Implement the constant_wrapper paper P2781R9.

2025-09-05 Thread Luc Grosheintz
the patches merged. On Thu, Sep 4, 2025 at 2:21 PM Luc Grosheintz wrote: The changes since v2 are in the test code: - There's a short test for string literals. I had trouble doing much with them. - Convert commented out invalid code into neg test using static_assert

[PATCH v3 1/2] libstdc++: Implement constant_wrapper, cw from P2781R9.

2025-09-04 Thread Luc Grosheintz
apper/instantiate.cc: New test. * testsuite/20_util/constant_wrapper/op_comma_neg.cc: New test. * testsuite/20_util/constant_wrapper/version.cc: New test. Co-authored-by: Tomasz Kamiński Signed-off-by: Tomasz Kamiński Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/bits/versio

Re: [PATCH v3 1/2] libstdc++: Implement constant_wrapper, cw from P2781R9.

2025-09-04 Thread Luc Grosheintz
On 9/4/25 2:20 PM, Luc Grosheintz wrote: This is a partial implementation of P2781R9. It adds std::cw and std::constant_wrapper, but doesn't modify __integral_constant_like for span/mdspan. libstdc++-v3/ChangeLog: * include/bits/version.def (constant_wrapper): Add. * in

[PATCH v3 2/2] libstdc++: Adjust span/mdspan CTAD for P2781R9.

2025-09-04 Thread Luc Grosheintz
tant_wrapper. * testsuite/23_containers/mdspan/mdspan.cc: Ditto. * testsuite/23_containers/span/deduction.cc: Ditto. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/span | 3 ++- .../23_containers/mdspan/extents/misc.cc | 22 ++

Re: [PATCH v2 3/3] libstdc++: Adjust span/mdspan CTAD for P2781R9.

2025-09-03 Thread Luc Grosheintz
On 9/2/25 10:21, Tomasz Kaminski wrote: On Tue, Sep 2, 2025 at 10:15 AM Luc Grosheintz wrote: A usecase for P2781R9 is more ergonomic creation of span and mdspan with mixed static and dynamic extents, e.g.: span(ptr, cw<3>) extents(cw<3>, 5, cw<7>) mdspan

[PATCH v1] libstdc++: Add _GLIBCXX_RESOLVE_LIB_DEFECTS for 4314 in .

2025-09-03 Thread Luc Grosheintz
rator()): Ditto. (layout_stride::mapping::operator()): Ditto. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan index 6c7469

Re: [PATCH v2 2/3] libstdc++: Implement constant_wrapper, cw from P2781R9.

2025-09-03 Thread Luc Grosheintz
On 9/2/25 13:45, Tomasz Kaminski wrote: On Tue, Sep 2, 2025 at 10:07 AM Luc Grosheintz wrote: This is a partial implementation of P2781R9. It adds std::cw and std::constant_wrapper, but doesn't modify __integral_constant_like for span/mdspan. libstdc++-v3/ChangeLog: * in

Re: [PATCH v2 2/3] libstdc++: Implement constant_wrapper, cw from P2781R9.

2025-09-03 Thread Luc Grosheintz
Two more comments (see below). On 9/2/25 13:45, Tomasz Kaminski wrote: On Tue, Sep 2, 2025 at 10:07 AM Luc Grosheintz wrote: This is a partial implementation of P2781R9. It adds std::cw and std::constant_wrapper, but doesn't modify __integral_constant_like for span/mdspan. libstdc

Re: [PATCH v2 3/3] libstdc++: Adjust span/mdspan CTAD for P2781R9.

2025-09-03 Thread Luc Grosheintz
On 9/2/25 10:21, Tomasz Kaminski wrote: On Tue, Sep 2, 2025 at 10:15 AM Luc Grosheintz wrote: A usecase for P2781R9 is more ergonomic creation of span and mdspan with mixed static and dynamic extents, e.g.: span(ptr, cw<3>) extents(cw<3>, 5, cw<7>) mdspan

[PATCH v2 2/3] libstdc++: Implement constant_wrapper, cw from P2781R9.

2025-09-02 Thread Luc Grosheintz
apper/instantiate.cc: New test. * testsuite/20_util/constant_wrapper/op_comma_neg.cc: New test. * testsuite/20_util/constant_wrapper/version.cc: New test. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/bits/version.def | 8 + libstdc++-v3/include/bits/version.h

Re: [PATCH v2 2/3] libstdc++: Implement constant_wrapper, cw from P2781R9.

2025-09-02 Thread Luc Grosheintz
On 9/2/25 13:45, Tomasz Kaminski wrote: On Tue, Sep 2, 2025 at 10:07 AM Luc Grosheintz wrote: This is a partial implementation of P2781R9. It adds std::cw and std::constant_wrapper, but doesn't modify __integral_constant_like for span/mdspan. libstdc++-v3/ChangeLog: * in

[PATCH v2 3/3] libstdc++: Adjust span/mdspan CTAD for P2781R9.

2025-09-02 Thread Luc Grosheintz
tant_wrapper. * testsuite/23_containers/mdspan/mdspan.cc: Ditto. * testsuite/23_containers/span/deduction.cc: Ditto. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/span | 3 ++- .../23_containers/mdspan/extents/misc.cc | 20 +++

[PATCH v2 0/3] libstdc++: Implement constant_wrapper, cw from P2781R9.

2025-09-02 Thread Luc Grosheintz
The full paper P2781R9 is implemented in three steps: 1. Prepare libstdc++ by moving internal code we need later. 2. Implement constant_wrapper and cw. 3. Implement the change to the CTAD for span/mdspan. Luc Grosheintz (3): libstdc++: Move _Index_tuple, _Build_index_tuple to . libstdc

[PATCH v2 1/3] libstdc++: Move _Index_tuple, _Build_index_tuple to .

2025-09-02 Thread Luc Grosheintz
/bits/utility.h (_Index_tuple): Move to . (_Build_index_tuple): Ditto. * include/std/type_traits (_Index_tuple): Ditto. (_Build_index_tuple): Ditto. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/bits/utility.h | 20 libstdc++-v3/include/std/t

[PATCH v1][RFC] libstdc++: Implement constant_wrapper, cw from P2781R8.

2025-08-13 Thread Luc Grosheintz
suite/20_util/constant_wrapper/adl.cc: New test. * testsuite/20_util/constant_wrapper/ex.cc: New test. * testsuite/20_util/constant_wrapper/generic.cc: New test. * testsuite/20_util/constant_wrapper/version.cc: New test. Signed-off-by: Luc Grosheintz --- This is a previ

[PATCH v2 2/2] libstdc++: Simplify precomputed partial products in .

2025-08-11 Thread Luc Grosheintz
): Delete. (__fwd_partial_prods): Compute at compile-time in O(rank), not O(rank**2). (__rev_partial_prods): Ditto. (__size): Inline __static_prod. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 44 + 1 file

[PATCH v2 0/2] Two cleanup patches for .

2025-08-11 Thread Luc Grosheintz
This second iteration: - fixes the commit message of both patches, - prefers if over multiplying with 1, - use a span instead of a const array&, - use constexpr for __sta_prod. Luc Grosheintz (2): libstdc++: Reduce size static storage for __fwd_prod in mdspan. libstdc++: Simp

[PATCH v2 1/2] libstdc++: Reduce size static storage for __fwd_prod in mdspan.

2025-08-11 Thread Luc Grosheintz
prods): Reduce size of the array by 1 element. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan index 351018a59a5..8f974257e96 100644

Re: [PATCH v1 2/2] libstdc++: Simplify precomputed partial products in .

2025-08-11 Thread Luc Grosheintz
On 8/11/25 15:29, Tomasz Kaminski wrote: On Mon, Aug 11, 2025 at 3:23 PM Luc Grosheintz wrote: Prior to this commit, the partial producs of static extents in was done in a loop that calls a function that computes the partial product. The complexity is quadratic in the rank. This commit

[PATCH v1 1/2] libstdc++: Reduce size static storage for __fwd_prod in mdspan.

2025-08-11 Thread Luc Grosheintz
clude/std/mdspan (__fwd_partial_prods): Reduce size of the array by 1 element. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan

[PATCH v1 2/2] libstdc++: Simplify precomputed partial products in .

2025-08-11 Thread Luc Grosheintz
): Delete. (__fwd_partial_prods): Compute at compile-time in O(rank), not O(rank**2). (__rev_partial_prods): Ditto. (__size): Inline __static_prod. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 33 +++-- 1 file

[PATCH v1 0/2] Two cleanup patches for .

2025-08-11 Thread Luc Grosheintz
As part of the review of: we agreed to prepare patches to fix two things: - shrink the size of __fwd_partial_prod, - compute __*_partial_prod in linear time. Luc Grosheintz (2): libstdc++: Reduce size static storage for __fwd_prod in mdspan. libstdc++: Simplify precomputed partial

Re: [PATCH v2 0/8] libstdc++: Sequence of improvements to .

2025-08-05 Thread Luc Grosheintz
On 8/5/25 14:55, Tomasz Kaminski wrote: On Tue, Aug 5, 2025 at 2:49 PM Tomasz Kaminski wrote: On Tue, Aug 5, 2025 at 2:14 PM Luc Grosheintz wrote: On 8/5/25 13:25, Tomasz Kaminski wrote: On Tue, Aug 5, 2025 at 1:14 PM Luc Grosheintz On 8/5/25 10:16, Tomasz Kaminski wrote: Hi

Re: [PATCH v2 0/8] libstdc++: Sequence of improvements to .

2025-08-05 Thread Luc Grosheintz
On 8/5/25 13:25, Tomasz Kaminski wrote: On Tue, Aug 5, 2025 at 1:14 PM Luc Grosheintz wrote: On 8/5/25 10:16, Tomasz Kaminski wrote: Hi, I have posted v3 patches with changes I have made locally for first 6 patches, and I think this series is ready to land, in addition to https

Re: [PATCH v2 0/8] libstdc++: Sequence of improvements to .

2025-08-05 Thread Luc Grosheintz
e_t __sta_prod = __rev_partial_prods<__sta_exts>[__r-1]; // size reduced by one here. return __extents_prod(__exts, __sta_prod, __r + 1, __rank); } Regards, Tomasz On Mon, Aug 4, 2025 at 7:51 PM Luc Grosheintz wrote: On 8/4/25 17:42, Tomasz Kaminski wrote: On Mon, Aug 4, 2

Re: [PATCH v2 3/8] libstdc++: Improve low-rank layout_{left, right}::stride.

2025-08-05 Thread Luc Grosheintz
On 8/5/25 12:44, Tomasz Kaminski wrote: On Tue, Aug 5, 2025 at 12:39 PM Tomasz Kaminski wrote: On Tue, Aug 5, 2025 at 12:33 PM Luc Grosheintz wrote: On 8/5/25 09:36, Tomasz Kaminski wrote: On Sun, Aug 3, 2025 at 11:07 PM Luc Grosheintz < luc.groshei...@gmail.com> wrote:

Re: [PATCH v2 3/8] libstdc++: Improve low-rank layout_{left, right}::stride.

2025-08-05 Thread Luc Grosheintz
On 8/5/25 09:36, Tomasz Kaminski wrote: On Sun, Aug 3, 2025 at 11:07 PM Luc Grosheintz wrote: The methods layout_{left,right}::mapping::stride are defined as \prod_{i = 0}^r E[i] \prod_{i = r+1}^n E[i] This is computed as the product of a precomputed static product and the product

Re: [PATCH v2 3/8] libstdc++: Improve low-rank layout_{left, right}::stride.

2025-08-04 Thread Luc Grosheintz
On 8/4/25 17:26, Tomasz Kaminski wrote: On Sun, Aug 3, 2025 at 11:07 PM Luc Grosheintz wrote: The methods layout_{left,right}::mapping::stride are defined as \prod_{i = 0}^r E[i] \prod_{i = r+1}^n E[i] This is computed as the product of a precomputed static product and the product

Re: [PATCH v2 0/8] libstdc++: Sequence of improvements to .

2025-08-04 Thread Luc Grosheintz
On 8/4/25 17:42, Tomasz Kaminski wrote: On Mon, Aug 4, 2025 at 1:14 PM Tomasz Kaminski wrote: On Mon, Aug 4, 2025 at 1:08 PM Luc Grosheintz wrote: Hi Tomasz, Thank you for the review! Sorry about the missing parens, even after "Ctrl+F"ing each of the emails I can't fi

Re: [PATCH v2 0/8] libstdc++: Sequence of improvements to .

2025-08-04 Thread Luc Grosheintz
n first commits, and they look solid to me, and I haven't noticed anything I would like to change (except parentheses around requires, but I will handle that locally). I will try to do a full review during this week. Regards, Tomasz On Sun, Aug 3, 2025 at 10:59 PM Luc Grosheintz wrote:

[PATCH v4 2/2] libstdc++: Implement aligned_accessor from mdspan [PR120994]

2025-08-04 Thread Luc Grosheintz
/23_containers/mdspan/version.cc: Add test for __cpp_lib_aligned_accessor. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/bits/version.def | 10 libstdc++-v3/include/bits/version.h | 10 libstdc++-v3/include/std/mdspan | 54

[PATCH v4 1/2] libstdc++: Implement is_sufficiently_aligned [PR120994]

2025-08-04 Thread Luc Grosheintz
/is_sufficiently_aligned/1.cc: New test. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/bits/align.h | 16 ++ libstdc++-v3/include/bits/version.def | 8 + libstdc++-v3/include/bits/version.h | 10 ++ libstdc++-v3/include/std/memory

[PATCH v4 0/2] libstdc++: Implement aligned_accessor [P2897R7]

2025-08-04 Thread Luc Grosheintz
ht be safer to also apply the "Improvements" patch series first, since updating std::dims and std::aligned_accessor is much easier than the reverse. Luc Grosheintz (2): libstdc++: Implement is_sufficiently_aligned [PR120994] libstdc++: Implement aligned_accessor from mdspan [PR120994]

[PATCH v2 7/8] libstdc++: Improve extents::operator==.

2025-08-03 Thread Luc Grosheintz
tible_extents<...>) return false; is no longer needed, because the optimizer correctly handles this case. However, it's retained for clarity/certainty. libstdc++-v3/ChangeLog: * include/std/mdspan (extents::operator==): Replace loop with pack expansion. Signed-off-b

[PATCH v2 8/8] libstdc++: Replace numeric_limit with __int_traits in mdspan.

2025-08-03 Thread Luc Grosheintz
. (mdspan::size): Ditto. * testsuite/23_containers/mdspan/extents/class_mandates_neg.cc: Update test with additional diagnostics. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 26 ++- .../mdspan/extents/class_mandates_neg.cc

[PATCH v2 5/8] libstdc++: Improve nearly fully dynamic extents in mdspan.

2025-08-03 Thread Luc Grosheintz
): Add arguments __begin and __end. (__fwd_prods): Relax condition for fully-dynamic extents to cover (dyn, ..., dyn, X). (__rev_partial_prods): Analogous for (X, dyn, ..., dyn). Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 11 ++-

[PATCH v2 1/8] libstdc++: Reduce template instantiations in .

2025-08-03 Thread Luc Grosheintz
_zero): New overload. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 54 ++--- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan index 5e79d4bfb59..7b73df8550e 100644

[PATCH v2 4/8] libstdc++: Improve fully dynamic extents in mdspan.

2025-08-03 Thread Luc Grosheintz
: New constexpr if branch to avoid instantiating __fwd_partial_prods. (__mdspan::__rev_prod): Ditto. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 64 +++-- 1 file changed, 54 insertions(+), 10 deletions(-) diff --git a/libstdc++-v3/include/std/mdspan

[PATCH v2 3/8] libstdc++: Improve low-rank layout_{left, right}::stride.

2025-08-03 Thread Luc Grosheintz
omputed product, not a partial product. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 32 ++-- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan index dc1b44e

[PATCH v2 6/8] libstdc++: Reduce indirection in extents::extent.

2025-08-03 Thread Luc Grosheintz
mic): New method. (__mdspan::_ExtentsStorage::_M_extent): Use _S_is_dynamic. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 35 +++-- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/libstdc++-v3/include/std/mdspan b/lib

[PATCH v2 2/8] libstdc++: Precompute products of static extents.

2025-08-03 Thread Luc Grosheintz
prod and refactored. include/std/mdspan (__mdspan::__fwd_prod): Compute as the product of pre-computed static static and the product of dynamic extents. (__mdspan::__rev_prod): Ditto. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 77 ++

[PATCH v2 0/8] libstdc++: Sequence of improvements to .

2025-08-03 Thread Luc Grosheintz
effectiveness of these changes, likely the stronger argument is presented in each commit: a) each change removes needless complexity, b) before/after examples of generated code show the effectiveness. Luc Grosheintz (8): libstdc++: Reduce template instantiations in . libstdc++: Precompute

Re: [PATCH v1 3/6] libstdc++: Improve low-rank layout_{left, right}::stride.

2025-07-30 Thread Luc Grosheintz
On 7/30/25 11:59, Tomasz Kaminski wrote: On Wed, Jul 30, 2025 at 10:56 AM Luc Grosheintz wrote: On 7/28/25 13:04, Tomasz Kaminski wrote: On Mon, Jul 28, 2025 at 10:24 AM Tomasz Kaminski wrote: On Mon, Jul 28, 2025 at 10:03 AM Luc Grosheintz < luc.groshei...@gmail.com>

Re: [PATCH v1 3/6] libstdc++: Improve low-rank layout_{left, right}::stride.

2025-07-30 Thread Luc Grosheintz
On 7/28/25 13:04, Tomasz Kaminski wrote: On Mon, Jul 28, 2025 at 10:24 AM Tomasz Kaminski wrote: On Mon, Jul 28, 2025 at 10:03 AM Luc Grosheintz wrote: On 7/28/25 08:02, Tomasz Kaminski wrote: On Sun, Jul 27, 2025 at 2:47 PM Luc Grosheintz < luc.groshei...@gmail.com>

Re: [PATCH v1 2/6] libstdc++: Precompute products of static extents.

2025-07-28 Thread Luc Grosheintz
n, Jul 27, 2025 at 2:53 PM Luc Grosheintz wrote: Let E denote an multi-dimensional extent; n the rank of E; r = 0, ..., n; E[i] the i-th extent; and D[k] be the (possibly empty) array of dynamic extents. The two partial products for r = 0, ..., n: \prod_{i = 0}^r E[i] (fwd) \prod_{i

Re: [PATCH v1 5/6] libstdc++: Reduce template instantiations in .

2025-07-28 Thread Luc Grosheintz
On 7/28/25 08:13, Tomasz Kaminski wrote: On Sun, Jul 27, 2025 at 2:57 PM Luc Grosheintz wrote: In mdspan related code involving static extents, often the IndexType is part of the template parameters, even though it's not needed. This commit extracts the parts of _ExtentsStorag

Re: [PATCH v1] libstdc++: Refactor tests for mdspan related accessors.

2025-07-28 Thread Luc Grosheintz
On 7/28/25 10:15, Tomasz Kaminski wrote: On Sun, Jul 27, 2025 at 3:38 PM Luc Grosheintz wrote: Versions 1, 2 and 3 of the patch for adding aligned_accessor had a bug in the constraints that allowed conversion of aligned_accessor a = aligned_accessor{}; and prevented the reverse. The

Re: [PATCH v1 3/6] libstdc++: Improve low-rank layout_{left, right}::stride.

2025-07-28 Thread Luc Grosheintz
e indirection E[i] := D[k[i]] is not needed because k[i] == i. Therefore, since the series already had several commits, I chose to leave it for later. On Mon, Jul 28, 2025 at 8:02 AM Tomasz Kaminski wrote: On Sun, Jul 27, 2025 at 2:47 PM Luc Grosheintz wrote: The methods layout_{left,right}

Re: [PATCH v1 3/6] libstdc++: Improve low-rank layout_{left, right}::stride.

2025-07-28 Thread Luc Grosheintz
On 7/28/25 08:02, Tomasz Kaminski wrote: On Sun, Jul 27, 2025 at 2:47 PM Luc Grosheintz wrote: The methods layout_{left,right}::mapping::stride are defined as \prod_{i = 0}^r E[i] \prod_{i = r+1}^n E[i] This is computed as the product of a pre-comupted static product and the

[PATCH v1] libstdc++: Refactor tests for mdspan related accessors.

2025-07-27 Thread Luc Grosheintz
commit allows passing in two different accessors. Enabling it to be reused more widely. libstdc++-v3/ChangeLog: * testsuite/23_containers/mdspan/accessors/generic.cc: Refactor test_ctor. Signed-off-by: Luc Grosheintz --- .../23_containers/mdspan/accessors/generic.cc | 61

[PATCH v1 5/6] libstdc++: Reduce template instantiations in .

2025-07-27 Thread Luc Grosheintz
(__mdspan::__static_prod): Use NTTP for static extents. (__mdspan::_FwdProd): Ditto. (__mdspan::_RevProd): Ditto. (__mdspan::__contains_zero): New overload for const array&. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 70 +---

[PATCH v1 4/6] libstdc++: Improve extents::operator==.

2025-07-27 Thread Luc Grosheintz
tible_extents<...>) return false; is no longer needed, because the optimizer correctly handles this case. However, it's retained for clarity/certainty. libstdc++-v3/ChangeLog: * include/std/mdspan (extents::operator==): Replace loop with pack expansion. Signed-off-b

[PATCH v1 3/6] libstdc++: Improve low-rank layout_{left, right}::stride.

2025-07-27 Thread Luc Grosheintz
x27;t require loading any values. libstdc++-v3/ChangeLog: * include/std/mdspan (layout_left::mapping::stride): Optimize for rank <= 2. (layout_right::mapping::stride): Ditto. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 14 -- 1 file cha

[PATCH v1 2/6] libstdc++: Precompute products of static extents.

2025-07-27 Thread Luc Grosheintz
_prod): Ditto. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 81 +++-- 1 file changed, 56 insertions(+), 25 deletions(-) diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan index 5e79d4bfb59..06ccf3e3827 100644 --- a

[PATCH v1 6/6] libstdc++: Replace numeric_limit with __int_traits in mdspan.

2025-07-27 Thread Luc Grosheintz
. * testsuite/23_containers/mdspan/extents/class_mandates_neg.cc: Update test with additional diagnostics. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 26 ++- .../mdspan/extents/class_mandates_neg.cc | 3 +++ 2 files changed

Sequence of improvements to .

2025-07-27 Thread Luc Grosheintz
ded, please let me know if I should shorten them. Luc Grosheintz (6): libstdc++: Fix style issues in . libstdc++: Precompute products of static extents. libstdc++: Improve low-rank layout_{left,right}::stride. libstdc++: Improve extents::operator==. libstdc++: Reduce template insta

[PATCH v1 1/6] libstdc++: Fix style issues in .

2025-07-27 Thread Luc Grosheintz
libstdc++-v3/ChangeLog: * include/std/mdspan: Small stylistic adjustments. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 17 - 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std

Re: [PATCH v3 3/3] libstdc++: Implement aligned_accessor from mdspan [PR120994]

2025-07-25 Thread Luc Grosheintz
On 7/23/25 11:25, Luc Grosheintz wrote: This commit completes the implementation of P2897R7 by implementing and testing the template class aligned_accessor. PR libstdc++/120994 libstdc++-v3/ChangeLog: * include/bits/version.def (aligned_accessor): Add. * include

Re: [PATCH v3 3/3] libstdc++: Implement aligned_accessor from mdspan [PR120994]

2025-07-23 Thread Luc Grosheintz
On 7/23/25 13:20, Tomasz Kaminski wrote: On Wed, Jul 23, 2025 at 11:34 AM Luc Grosheintz wrote: This commit completes the implementation of P2897R7 by implementing and testing the template class aligned_accessor. PR libstdc++/120994 libstdc++-v3/ChangeLog: * include

[PATCH v3 2/3] libstdc++: Prepare test code for default_accessor for reuse.

2025-07-23 Thread Luc Grosheintz
/ChangeLog: * testsuite/23_containers/mdspan/accessors/default.cc: Delete. * testsuite/23_containers/mdspan/accessors/generic.cc: Slightly generalize the test code previously in default.cc. Signed-off-by: Luc Grosheintz --- .../23_containers/mdspan/accessors/default.cc | 99

[PATCH v3 3/3] libstdc++: Implement aligned_accessor from mdspan [PR120994]

2025-07-23 Thread Luc Grosheintz
/23_containers/mdspan/accessors/aligned_neg.cc: New test. * testsuite/23_containers/mdspan/version.cc: Add test for __cpp_lib_aligned_accessor. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/bits/version.def | 10 +++ libstdc++-v3/include/bits/version.h | 10

[PATCH v3 1/3] libstdc++: Implement is_sufficiently_aligned [PR120994]

2025-07-23 Thread Luc Grosheintz
/is_sufficiently_aligned/1.cc: New test. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/bits/align.h | 16 ++ libstdc++-v3/include/bits/version.def | 8 + libstdc++-v3/include/bits/version.h | 10 ++ libstdc++-v3/include/std/memory

[PATCH v3 0/3] Implement aligned_accessor [P2897R7]

2025-07-23 Thread Luc Grosheintz
Replaces v2: https://gcc.gnu.org/pipermail/libstdc++/2025-July/062712.html This iteration rebases on top of v3 of the std::dims patch; and makes several small changes to the test code. Luc Grosheintz (3): libstdc++: Implement is_sufficiently_aligned [PR120994] libstdc++: Prepare test code

Re: [PATCH v2 0/3] Implement aligned_accessor [P2897R7]

2025-07-22 Thread Luc Grosheintz
is for some time. However, we could land a (test rewrite) patch soon, as it does not introduce any functional changes, so you could send a v2 of that, and then patch series with only functional patches, but there is no strong need for that. On Mon, Jul 21, 2025 at 10:22 AM Luc Grosheintz wrote: T

[PATCH v3] libstdc++: Implement std::dims from .

2025-07-21 Thread Luc Grosheintz
: Regenerate. * include/std/mdspan (dims): Add. * src/c++23/std.cc.in (dims): Add. * testsuite/23_containers/mdspan/extents/misc.cc: Add tests. * testsuite/23_containers/mdspan/version.cc: Update test. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/bits

Re: [PATCH v2] libstdc++: Implement std::dims from .

2025-07-21 Thread Luc Grosheintz
I just saw a patch by Jakub Jelinek that fixed the omission of exporting std::dextents also addressed by this patch. Since this is also mentioned in the commit message, I think it's least work if I immediately create v3. On 7/21/25 09:43, Luc Grosheintz wrote: This commit implements the

[PATCH v1] libstdc++: Remove redundant parens in mdspan testsuite.

2025-07-21 Thread Luc Grosheintz
/23_containers/mdspan/extents/ctor_shape.cc: Ditto. * testsuite/23_containers/mdspan/mdspan.cc: Ditto. Signed-off-by: Luc Grosheintz --- .../23_containers/mdspan/extents/ctor_ints.cc | 20 .../mdspan/extents/ctor_shape.cc | 10 .../testsuite/23_containers

Re: [PATCH v4 0/6] Implement mdspan.

2025-07-21 Thread Luc Grosheintz
TLDR; there should be patches in review for everything reported here. Thank you for running the libc++ tests! Let me know if you change your mind and think it would be good if I learnt to run their tests. I'm optimistic (or deluded) I can eventually figure it out. On 7/15/25 13:35, Jonathan Wake

[PATCH v1 2/2] libstdc++: Make the default ctor of mdspan conditionally noexcept.

2025-07-21 Thread Luc Grosheintz
(mdspan::mdspan): Make default ctor conditionally noexcept. * testsuite/23_containers/mdspan/mdspan.cc: Add tests. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 12 +++--- .../testsuite/23_containers/mdspan/mdspan.cc | 37 +++ 2

[PATCH v1 1/2] libstdc++: Strengthen exception guarantee for mdspan methods.

2025-07-21 Thread Luc Grosheintz
s for noexcept. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/std/mdspan | 21 ++- .../23_containers/mdspan/layout_like.h| 134 +- .../testsuite/23_containers/mdspan/mdspan.cc | 17 +++ 3 files changed, 101 insertions(+), 71 deletions(-) diff --

[PATCH v1 0/2] Strengthen exception guarantee for mdspan.

2025-07-21 Thread Luc Grosheintz
++/2025-July/062572.html Luc Grosheintz (2): libstdc++: Strengthen exception guarantee for mdspan methods. libstdc++: Make the default ctor of mdspan conditionally noexcept. libstdc++-v3/include/std/mdspan | 33 +++-- .../23_containers/mdspan/layout_like.h| 134

[PATCH v2 3/3] libstdc++: Implement aligned_accessor from mdspan [PR120994]

2025-07-21 Thread Luc Grosheintz
/23_containers/mdspan/accessors/aligned_neg.cc: New test. * testsuite/23_containers/mdspan/version.cc: Add test for __cpp_lib_aligned_accessor. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/bits/version.def | 10 +++ libstdc++-v3/include/bits/version.h | 10

[PATCH v2 2/3] libstdc++: Prepare test code for default_accessor for reuse.

2025-07-21 Thread Luc Grosheintz
/ChangeLog: * testsuite/23_containers/mdspan/accessors/default.cc: Delete. * testsuite/23_containers/mdspan/accessors/generic.cc: Slightly generalize the test code previously in default.cc. Signed-off-by: Luc Grosheintz --- .../23_containers/mdspan/accessors/default.cc | 99

[PATCH v2 0/3] Implement aligned_accessor [P2897R7]

2025-07-21 Thread Luc Grosheintz
/062628.html Luc Grosheintz (3): libstdc++: Implement is_sufficiently_aligned [PR120994] libstdc++: Prepare test code for default_accessor for reuse. libstdc++: Implement aligned_accessor from mdspan [PR120994] libstdc++-v3/include/bits/align.h | 16 ++ libstdc++-v3/include/bits

[PATCH v2 1/3] libstdc++: Implement is_sufficiently_aligned [PR120994]

2025-07-21 Thread Luc Grosheintz
/is_sufficiently_aligned/1.cc: New test. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/bits/align.h | 16 ++ libstdc++-v3/include/bits/version.def | 8 + libstdc++-v3/include/bits/version.h | 10 ++ libstdc++-v3/include/std/memory

[PATCH v2] libstdc++: Implement std::dims from .

2025-07-21 Thread Luc Grosheintz
-off-by: Luc Grosheintz --- libstdc++-v3/include/bits/version.def | 4 libstdc++-v3/include/bits/version.h | 7 ++- libstdc++-v3/include/std/mdspan | 5 + libstdc++-v3/src/c++23/std.cc.in | 4

Re: [PATCH v1 0/3] Fix custom IndexType related bugs in mdspan.

2025-07-17 Thread Luc Grosheintz
On 7/17/25 16:16, Tomasz Kaminski wrote: Thank you for the fast response and fixes. I will next week experiment with running libc++ test, so will confirm here if they are all fixed. On Wed, Jul 16, 2025 at 3:47 PM Luc Grosheintz wrote: These three commits fix PR121061. The first prepares

Re: [PATCH v1 1/3] libstdc++: Implement is_sufficiently_aligned.

2025-07-17 Thread Luc Grosheintz
On 7/17/25 11:14, Jonathan Wakely wrote: On Thu, 17 Jul 2025 at 10:05, Luc Grosheintz wrote: On 7/8/25 16:56, Tomasz Kaminski wrote: On Thu, Jul 3, 2025 at 12:36 PM Luc Grosheintz wrote: This commit implements and tests the function is_sufficiently_aligned from P2897R7. libstdc++-v3

Re: [PATCH v1 3/3] libstdc++: Implement aligned_accessor from mdspan.

2025-07-17 Thread Luc Grosheintz
On 7/8/25 17:37, Tomasz Kaminski wrote: On Thu, Jul 3, 2025 at 12:38 PM Luc Grosheintz wrote: This commit completes the implementation of P2897R7 by implementing and testing the template class aligned_accessor. libstdc++-v3/ChangeLog: * include/bits/version.def (aligned_accessor

Re: [PATCH v1 1/3] libstdc++: Implement is_sufficiently_aligned.

2025-07-17 Thread Luc Grosheintz
On 7/8/25 16:56, Tomasz Kaminski wrote: On Thu, Jul 3, 2025 at 12:36 PM Luc Grosheintz wrote: This commit implements and tests the function is_sufficiently_aligned from P2897R7. libstdc++-v3/ChangeLog: * include/bits/align.h (is_sufficiently_aligned): New function

Re: [PATCH v1] libstdc++: Implement std::dims.

2025-07-17 Thread Luc Grosheintz
On 7/17/25 09:07, Luc Grosheintz wrote: This commit implements the C++26 feature std::dims, sets the feature testing macro to 202403 and adds tests. libstdc++-v3/ChangeLog: * include/bits/version.def (mdspan): Set value for C++26. * include/bits/version.h: Regenerate

[PATCH v1] libstdc++: Implement std::dims.

2025-07-17 Thread Luc Grosheintz
. * testsuite/23_containers/mdspan/extents/misc.cc: Add tests. * testsuite/23_containers/mdspan/version.cc: Update test. Signed-off-by: Luc Grosheintz --- libstdc++-v3/include/bits/version.def | 4 libstdc++-v3/include/bits/version.h| 7

  1   2   3   4   >