[all-commits] [llvm/llvm-project] fcaccf: [libcxx] Add mdspan/extents

Christian Trott via All-commits all-commits at lists.llvm.org
Tue May 16 14:31:28 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fcaccf817d31d39096f7d0e7014cd6fe2fa3a683
      https://github.com/llvm/llvm-project/commit/fcaccf817d31d39096f7d0e7014cd6fe2fa3a683
  Author: Christian Trott <crtrott at sandia.gov>
  Date:   2023-05-16 (Tue, 16 May 2023)

  Changed paths:
    M libcxx/CREDITS.TXT
    M libcxx/docs/FeatureTestMacroTable.rst
    M libcxx/docs/Status/Cxx2bPapers.csv
    M libcxx/include/CMakeLists.txt
    A libcxx/include/__mdspan/extents.h
    M libcxx/include/libcxx.imp
    A libcxx/include/mdspan
    M libcxx/include/module.modulemap.in
    M libcxx/include/version
    M libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp
    M libcxx/test/libcxx/clang_tidy.sh.cpp
    M libcxx/test/libcxx/double_include.sh.cpp
    M libcxx/test/libcxx/min_max_macros.compile.pass.cpp
    M libcxx/test/libcxx/modules_include.sh.cpp
    M libcxx/test/libcxx/nasty_macros.compile.pass.cpp
    M libcxx/test/libcxx/no_assert_include.compile.pass.cpp
    M libcxx/test/libcxx/private_headers.verify.cpp
    M libcxx/test/libcxx/transitive_includes.sh.cpp
    M libcxx/test/libcxx/transitive_includes/cxx03.csv
    M libcxx/test/libcxx/transitive_includes/cxx11.csv
    M libcxx/test/libcxx/transitive_includes/cxx14.csv
    M libcxx/test/libcxx/transitive_includes/cxx17.csv
    M libcxx/test/libcxx/transitive_includes/cxx20.csv
    M libcxx/test/libcxx/transitive_includes/cxx2b.csv
    A libcxx/test/std/containers/views/mdspan/extents/ConvertibleToIntegral.h
    A libcxx/test/std/containers/views/mdspan/extents/CtorTestCombinations.h
    A libcxx/test/std/containers/views/mdspan/extents/assert.conversion.pass.cpp
    A libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp
    A libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp
    A libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp
    A libcxx/test/std/containers/views/mdspan/extents/assert.obs.pass.cpp
    A libcxx/test/std/containers/views/mdspan/extents/comparison.pass.cpp
    A libcxx/test/std/containers/views/mdspan/extents/conversion.pass.cpp
    A libcxx/test/std/containers/views/mdspan/extents/ctad.pass.cpp
    A libcxx/test/std/containers/views/mdspan/extents/ctor_default.pass.cpp
    A libcxx/test/std/containers/views/mdspan/extents/ctor_from_array.pass.cpp
    A libcxx/test/std/containers/views/mdspan/extents/ctor_from_integral.pass.cpp
    A libcxx/test/std/containers/views/mdspan/extents/ctor_from_span.pass.cpp
    A libcxx/test/std/containers/views/mdspan/extents/dextents.pass.cpp
    A libcxx/test/std/containers/views/mdspan/extents/obs_static.pass.cpp
    A libcxx/test/std/containers/views/mdspan/extents/types.pass.cpp
    A libcxx/test/std/language.support/support.limits/support.limits.general/mdspan.version.compile.pass.cpp
    M libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
    M libcxx/utils/generate_feature_test_macro_components.py

  Log Message:
  -----------
  [libcxx] Add mdspan/extents

This patch adds std::extents. extents is one of the core classes used by std::mdspan. It describes a multi-dimensional index space with a mix of compile time and runtime sizes. Furthermore, it is templated on the index type used to describe the multi-dimensional index space.

The class is designed to be highly optimizable in performance critical code sections, and is fully useable in constant expressions contexts.

Testing of this class tends to be somewhat combinatorical, due to the large number of possible corner cases involved in situations where we have both runtime and compile time extents. To add to this, the class is designed to be interoperable (in particular constructible) from arguments which only need to be convertible to the index_type, but are otherwise arbitrary user types. For a larger discussion on the design of this class refer to: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0009r18.html

Co-authored-by: Damien L-G <dalg24 at gmail.com>

Reviewed By: ldionne, #libc

Spies: libcxx-commits, H-G-Hristov, tschuett, philnik, arichardson, Mordante, crtrott

Differential Revision: https://reviews.llvm.org/D148067




More information about the All-commits mailing list