On 03/08/25 22:57 +0200, Luc Grosheintz wrote:
The combined effect of this sequence of change is:
* a reduction in the number of template instantiations, by
- avoiding needless dependency of IndexType,
- special formulas for low-rank extents,
- special formulas for (nearly) fully dynamic extents.
* improved code quality, by
- precomputing partial products of the static extents,
- special cases for low-rank extents,
- rewriting the condition E[i] == dynamic_extent in a more
optimizer friendly manner.
- effectively loop-unrolling extents::operator==.
While simplistic micro-benchmarking shows the 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 <mdspan>.
libstdc++: Precompute products of static extents.
libstdc++: Improve low-rank layout_{left,right}::stride.
libstdc++: Improve fully dynamic extents in mdspan.
libstdc++: Improve nearly fully dynamic extents in mdspan.
libstdc++: Reduce indirection in extents::extent.
libstdc++: Improve extents::operator==.
libstdc++: Replace numeric_limit with __int_traits in mdspan.
libstdc++-v3/include/std/mdspan | 282 +++++++++++++-----
.../mdspan/extents/class_mandates_neg.cc | 3 +
2 files changed, 208 insertions(+), 77 deletions(-)
I've now reviewed all the patches in this series, with all Tomasz's v3
patches making adjustments, and the whole series is OK for trunk.
Some really nice codegen improvemens here, thanks!