Closed mhoemmen closed 2 years ago
@youyu3 discovered that the layout_stride::mapping(const extents_type&, span<OtherIndexType, rank()>) constructor doesn't compile. Here is an example:
layout_stride::mapping(const extents_type&, span<OtherIndexType, rank()>)
https://godbolt.org/z/Tf57xdrGq
using extents_type = stdex::dextents<int, 2>; extents_type ex{2, 2}; // this one works fine stdex::layout_stride::mapping map0{ex, std::array{3, 3}}; std::array<int, 2> strides{3, 3}; std::span<int, 2> strides_span{strides.begin(), strides.end()}; // Neither of these compile stdex::layout_stride::mapping map1{ex, strides_span}; stdex::layout_stride::mapping<extents_type> map2{ex, strides_span};
@youyu3 suggests a fix: add a __deduction_workaround::fill_strides overload taking span<IntegerType, extents_type::rank()>, like the existing one that takes array<IntegerType, extents_type::rank()> ( https://github.com/kokkos/mdspan/blob/760060059fb746018a9849234e02dc9bf003861b/include/experimental/__p0009_bits/layout_stride.hpp#L197 ):
__deduction_workaround::fill_strides
span<IntegerType, extents_type::rank()>
array<IntegerType, extents_type::rank()>
template<class IntegralType> MDSPAN_INLINE_FUNCTION static constexpr const __strides_storage_t fill_strides(const span<IntegralType, extents_type::rank()>& s) { return __strides_storage_t{static_cast<index_type>(s[Idxs])...}; }
@youyu3 discovered that the
layout_stride::mapping(const extents_type&, span<OtherIndexType, rank()>)
constructor doesn't compile. Here is an example:https://godbolt.org/z/Tf57xdrGq
@youyu3 suggests a fix: add a
__deduction_workaround::fill_strides
overload takingspan<IntegerType, extents_type::rank()>
, like the existing one that takesarray<IntegerType, extents_type::rank()>
( https://github.com/kokkos/mdspan/blob/760060059fb746018a9849234e02dc9bf003861b/include/experimental/__p0009_bits/layout_stride.hpp#L197 ):