Skip to content

Commit

Permalink
Fix parsing error exposed on MSVC
Browse files Browse the repository at this point in the history
Also fixes missing constexpr
  • Loading branch information
crtrott committed Jun 17, 2024
1 parent 1ba37ba commit 4409714
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/experimental/__p2642_bits/layout_padded.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class layout_left_padded<PaddingValue>::mapping {
#endif

MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping(const mapping&) noexcept = default;
MDSPAN_INLINE_FUNCTION_DEFAULTED mapping& operator=(const mapping&) noexcept = default;
MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping& operator=(const mapping&) noexcept = default;

/**
* Initializes the mapping with the given extents.
Expand Down Expand Up @@ -584,7 +584,7 @@ class layout_right_padded<PaddingValue>::mapping {
#endif

MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping(const mapping&) noexcept = default;
MDSPAN_INLINE_FUNCTION_DEFAULTED mapping& operator=(const mapping&) noexcept = default;
MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping& operator=(const mapping&) noexcept = default;

/**
* Initializes the mapping with the given extents.
Expand Down
9 changes: 5 additions & 4 deletions tests/test_submdspan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ using submdspan_test_types =
, std::tuple<layout_left_padded<dyn>, Kokkos::layout_stride, Kokkos::dextents<size_t,3>, args_t<10,20,30>, Kokkos::dextents<size_t,3>, Kokkos::full_extent_t, Kokkos::strided_slice<int,int,int>, Kokkos::full_extent_t>
, std::tuple<layout_left_padded<dyn>, Kokkos::layout_stride, Kokkos::dextents<size_t,3>, args_t<10,20,30>, Kokkos::dextents<size_t,2>, Kokkos::full_extent_t, int, Kokkos::strided_slice<int,int,int>>
, std::tuple<layout_left_padded<dyn>, Kokkos::layout_stride, Kokkos::dextents<size_t,4>, args_t<10,20,30,40>, Kokkos::dextents<size_t,3>, Kokkos::full_extent_t, Kokkos::full_extent_t, int, Kokkos::full_extent_t>

// layout_right_padded to layout_right
, std::tuple<layout_right_padded<dyn>, Kokkos::layout_right, Kokkos::dextents<size_t,2>, args_t<10,20>, Kokkos::dextents<size_t,0>, int, int>
, std::tuple<layout_right_padded<dyn>, Kokkos::layout_right, Kokkos::dextents<size_t,2>, args_t<10,20>, Kokkos::dextents<size_t,1>, int, std::pair<int,int>>
Expand Down Expand Up @@ -341,18 +342,18 @@ struct TestSubMDSpan<
}

static void run() {
typename mds_org_t::mapping_type map(typename mds_org_t::extents_type(ConstrArgs...));
int data[25000];
// MSVC seems to have an issue with taking just data here
mds_org_t src(&data[0], map);
size_t* result = allocate_array<size_t>(1);
int* data = allocate_array<int>(25000);
map_t map{ typename mds_org_t::extents_type(ConstrArgs...) };
mds_org_t src(data, map);

dispatch([=] _MDSPAN_HOST_DEVICE () {
auto sub = Kokkos::submdspan(src, create_slice_arg(SubArgs())...);
bool match = check_submdspan_match(0, 0, src, sub, std::index_sequence<>(), std::index_sequence<>(), create_slice_arg(SubArgs())...);
result[0] = match?1:0;
});
EXPECT_EQ(result[0], 1);
free_array(data);
free_array(result);
}

Expand Down

0 comments on commit 4409714

Please sign in to comment.