From 06ebb8835022b92ea64c5b10bdb3f5afbad0e5f8 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 18 Dec 2025 12:28:37 +0200 Subject: Update mdspan headers to 546d4dd63697c6a331554adb6fe650e09b690812 --- .../experimental/__p2630_bits/strided_slice.hpp | 18 +++++----- .../__p2630_bits/submdspan_mapping.hpp | 42 ++++++++++------------ 2 files changed, 27 insertions(+), 33 deletions(-) (limited to 'ext/mdspan/include/experimental/__p2630_bits') diff --git a/ext/mdspan/include/experimental/__p2630_bits/strided_slice.hpp b/ext/mdspan/include/experimental/__p2630_bits/strided_slice.hpp index 89ba820..7f4a018 100644 --- a/ext/mdspan/include/experimental/__p2630_bits/strided_slice.hpp +++ b/ext/mdspan/include/experimental/__p2630_bits/strided_slice.hpp @@ -21,12 +21,12 @@ namespace MDSPAN_IMPL_STANDARD_NAMESPACE { -namespace { +namespace detail { template - struct __mdspan_is_integral_constant: std::false_type {}; + struct mdspan_is_integral_constant: std::false_type {}; template - struct __mdspan_is_integral_constant>: std::true_type {}; + struct mdspan_is_integral_constant>: std::true_type {}; } // Slice Specifier allowing for strides and compile time extent @@ -36,13 +36,13 @@ struct strided_slice { using extent_type = ExtentType; using stride_type = StrideType; - _MDSPAN_NO_UNIQUE_ADDRESS OffsetType offset{}; - _MDSPAN_NO_UNIQUE_ADDRESS ExtentType extent{}; - _MDSPAN_NO_UNIQUE_ADDRESS StrideType stride{}; + MDSPAN_IMPL_NO_UNIQUE_ADDRESS OffsetType offset{}; + MDSPAN_IMPL_NO_UNIQUE_ADDRESS ExtentType extent{}; + MDSPAN_IMPL_NO_UNIQUE_ADDRESS StrideType stride{}; - static_assert(std::is_integral_v || __mdspan_is_integral_constant::value); - static_assert(std::is_integral_v || __mdspan_is_integral_constant::value); - static_assert(std::is_integral_v || __mdspan_is_integral_constant::value); + static_assert(std::is_integral_v || detail::mdspan_is_integral_constant::value); + static_assert(std::is_integral_v || detail::mdspan_is_integral_constant::value); + static_assert(std::is_integral_v || detail::mdspan_is_integral_constant::value); }; } // MDSPAN_IMPL_STANDARD_NAMESPACE diff --git a/ext/mdspan/include/experimental/__p2630_bits/submdspan_mapping.hpp b/ext/mdspan/include/experimental/__p2630_bits/submdspan_mapping.hpp index 46ccbaa..3a87dff 100644 --- a/ext/mdspan/include/experimental/__p2630_bits/submdspan_mapping.hpp +++ b/ext/mdspan/include/experimental/__p2630_bits/submdspan_mapping.hpp @@ -46,7 +46,7 @@ namespace MDSPAN_IMPL_STANDARD_NAMESPACE { // Return type of submdspan_mapping overloads //****************************************** template struct submdspan_mapping_result { - _MDSPAN_NO_UNIQUE_ADDRESS LayoutMapping mapping{}; + MDSPAN_IMPL_NO_UNIQUE_ADDRESS LayoutMapping mapping{}; size_t offset; }; @@ -72,7 +72,7 @@ MDSPAN_INLINE_FUNCTION constexpr bool any_slice_out_of_bounds_helper(std::index_sequence, const extents &exts, const Slices &... slices) { - return _MDSPAN_FOLD_OR( + return MDSPAN_IMPL_FOLD_OR( (one_slice_out_of_bounds(exts.extent(RankIndices), slices))); } @@ -182,7 +182,7 @@ struct deduce_layout_left_submapping< // e.g. R I I I F F F R I I for obtaining a rank-5 from a rank-10 return ((((Idx == 0) && is_range_slice_v) || ((Idx > 0 && Idx <= gap_len) && is_index_slice_v) || - ((Idx > gap_len && Idx < gap_len + SubRank - 1) && std::is_same_v) || + ((Idx > gap_len && Idx < gap_len + SubRank - 1) && std::is_same_v) || ((Idx == gap_len + SubRank - 1) && is_range_slice_v) || ((Idx > gap_len + SubRank - 1) && is_index_slice_v)) && ... ); } @@ -190,18 +190,15 @@ struct deduce_layout_left_submapping< // We are reusing the same thing for layout_left and layout_left_padded // For layout_left as source StaticStride is static_extent(0) -template -struct compute_s_static_layout_left { +template +MDSPAN_INLINE_FUNCTION constexpr size_t +compute_s_static_layout_left(std::index_sequence) { // Neither StaticStride nor any of the provided extents can be zero. // StaticStride can never be zero, the static_extents we are looking at are associated with // integral slice specifiers - which wouldn't be valid for zero extent - template - MDSPAN_INLINE_FUNCTION - static constexpr size_t value(std::index_sequence) { size_t val = ((Idx>0 && Idx<=NumGaps ? (Extents::static_extent(Idx) == dynamic_extent?0:Extents::static_extent(Idx)) : 1) * ... * (StaticStride == dynamic_extent?0:StaticStride)); return val == 0?dynamic_extent:val; } -}; } // namespace detail @@ -237,7 +234,7 @@ layout_left::mapping::submdspan_mapping_impl( return submdspan_mapping_result{dst_mapping_t(dst_ext), offset}; } else if constexpr (deduce_layout::layout_left_padded_value()) { - constexpr size_t S_static = MDSPAN_IMPL_STANDARD_NAMESPACE::detail::compute_s_static_layout_left::value(std::make_index_sequence()); + constexpr size_t S_static = MDSPAN_IMPL_STANDARD_NAMESPACE::detail::compute_s_static_layout_left(std::make_index_sequence()); using dst_mapping_t = typename MDSPAN_IMPL_PROPOSED_NAMESPACE::layout_left_padded::template mapping; return submdspan_mapping_result{ dst_mapping_t(dst_ext, stride(1 + deduce_layout::gap_len)), offset}; @@ -254,7 +251,7 @@ layout_left::mapping::submdspan_mapping_impl( // NVCC 11.0 has a bug with deduction guide here, tested that 11.2 does not have // the issue but Clang-CUDA also doesn't accept the use of deduction guide so // disable it for CUDA altogether -#if defined(_MDSPAN_HAS_HIP) || defined(_MDSPAN_HAS_CUDA) +#if defined(MDSPAN_IMPL_HAS_HIP) || defined(MDSPAN_IMPL_HAS_CUDA) detail::tuple{ detail::stride_of(slices)...}).values), #else @@ -316,7 +313,7 @@ MDSPAN_IMPL_PROPOSED_NAMESPACE::layout_left_padded::mapping; return submdspan_mapping_result{dst_mapping_t{dst_ext}, offset}; } else if constexpr (deduce_layout::layout_left_padded_value()) { // can keep layout_left_padded - constexpr size_t S_static = MDSPAN_IMPL_STANDARD_NAMESPACE::detail::compute_s_static_layout_left::value(std::make_index_sequence()); + constexpr size_t S_static = MDSPAN_IMPL_STANDARD_NAMESPACE::detail::compute_s_static_layout_left(std::make_index_sequence()); using dst_mapping_t = typename MDSPAN_IMPL_PROPOSED_NAMESPACE::layout_left_padded::template mapping; return submdspan_mapping_result{ dst_mapping_t(dst_ext, stride(1 + deduce_layout::gap_len)), offset}; @@ -332,7 +329,7 @@ MDSPAN_IMPL_PROPOSED_NAMESPACE::layout_left_padded::mapping{ MDSPAN_IMPL_STANDARD_NAMESPACE::detail::stride_of(slices)...}).values), #else @@ -421,18 +418,15 @@ struct deduce_layout_right_submapping< // We are reusing the same thing for layout_right and layout_right_padded // For layout_right as source StaticStride is static_extent(Rank-1) -template -struct compute_s_static_layout_right { +template +MDSPAN_INLINE_FUNCTION constexpr size_t +compute_s_static_layout_right (std::index_sequence) { // Neither StaticStride nor any of the provided extents can be zero. // StaticStride can never be zero, the static_extents we are looking at are associated with // integral slice specifiers - which wouldn't be valid for zero extent - template - MDSPAN_INLINE_FUNCTION - static constexpr size_t value(std::index_sequence) { size_t val = ((Idx >= Extents::rank() - 1 - NumGaps && Idx < Extents::rank() - 1 ? (Extents::static_extent(Idx) == dynamic_extent?0:Extents::static_extent(Idx)) : 1) * ... * (StaticStride == dynamic_extent?0:StaticStride)); return val == 0?dynamic_extent:val; } -}; } // namespace detail @@ -468,7 +462,7 @@ layout_right::mapping::submdspan_mapping_impl( return submdspan_mapping_result{dst_mapping_t(dst_ext), offset}; } else if constexpr (deduce_layout::layout_right_padded_value()) { - constexpr size_t S_static = MDSPAN_IMPL_STANDARD_NAMESPACE::detail::compute_s_static_layout_left::value(std::make_index_sequence()); + constexpr size_t S_static = MDSPAN_IMPL_STANDARD_NAMESPACE::detail::compute_s_static_layout_left(std::make_index_sequence()); using dst_mapping_t = typename MDSPAN_IMPL_PROPOSED_NAMESPACE::layout_right_padded::template mapping; return submdspan_mapping_result{ dst_mapping_t(dst_ext, @@ -487,7 +481,7 @@ layout_right::mapping::submdspan_mapping_impl( // NVCC 11.0 has a bug with deduction guide here, tested that 11.2 does not have // the issue but Clang-CUDA also doesn't accept the use of deduction guide so // disable it for CUDA altogether -#if defined(_MDSPAN_HAS_HIP) || defined(_MDSPAN_HAS_CUDA) +#if defined(MDSPAN_IMPL_HAS_HIP) || defined(MDSPAN_IMPL_HAS_CUDA) MDSPAN_IMPL_STANDARD_NAMESPACE::detail::tuple{ detail::stride_of(slices)...}).values), #else @@ -541,7 +535,7 @@ MDSPAN_IMPL_PROPOSED_NAMESPACE::layout_right_padded::mapping; return submdspan_mapping_result{dst_mapping_t{dst_ext}, offset}; } else if constexpr (deduce_layout::layout_right_padded_value()) { // can keep layout_right_padded - constexpr size_t S_static = MDSPAN_IMPL_STANDARD_NAMESPACE::detail::compute_s_static_layout_right::value(std::make_index_sequence()); + constexpr size_t S_static = MDSPAN_IMPL_STANDARD_NAMESPACE::detail::compute_s_static_layout_right(std::make_index_sequence()); using dst_mapping_t = typename MDSPAN_IMPL_PROPOSED_NAMESPACE::layout_right_padded::template mapping; return submdspan_mapping_result{ dst_mapping_t(dst_ext, stride(Extents::rank() - 2 - deduce_layout::gap_len)), offset}; @@ -557,7 +551,7 @@ MDSPAN_IMPL_PROPOSED_NAMESPACE::layout_right_padded::mapping{ MDSPAN_IMPL_STANDARD_NAMESPACE::detail::stride_of(slices)...}).values), #else @@ -605,7 +599,7 @@ layout_stride::mapping::submdspan_mapping_impl( // NVCC 11.0 has a bug with deduction guide here, tested that 11.2 does not have // the issue but Clang-CUDA also doesn't accept the use of deduction guide so // disable it for CUDA alltogether -#if defined(_MDSPAN_HAS_HIP) || defined(_MDSPAN_HAS_CUDA) +#if defined(MDSPAN_IMPL_HAS_HIP) || defined(MDSPAN_IMPL_HAS_CUDA) MDSPAN_IMPL_STANDARD_NAMESPACE::detail::tuple( detail::stride_of(slices)...)).values), #else -- cgit v1.2.3