Skip to content

Commit

Permalink
kokkos#6805: fix host function call from device and fix more cuda war…
Browse files Browse the repository at this point in the history
…nings in mdspan
  • Loading branch information
nmm0 committed Feb 23, 2024
1 parent 49162ef commit c5711c1
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion core/src/View/MDSpan/Kokkos_MDSpan_Extents.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ static_assert(false,
#define KOKKOS_EXPERIMENTAL_MDSPAN_EXTENTS_HPP

#include "Kokkos_MDSpan_Header.hpp"
#include <Kokkos_Core_fwd.hpp>

namespace Kokkos::Impl {

Expand Down Expand Up @@ -110,7 +111,7 @@ struct DataTypeFromExtents {
/// Convert from a mdspan extent to a Kokkos extent, inserting 0s for static
/// extents
template <class Extents>
auto dimension_from_extent(const Extents &e, std::size_t r) noexcept {
KOKKOS_INLINE_FUNCTION auto dimension_from_extent(const Extents &e, std::size_t r) noexcept {
return Extents::static_extent(r) == dynamic_extent ? e.extent(r) : 0;
}
} // namespace Kokkos::Experimental::Impl
Expand Down
4 changes: 2 additions & 2 deletions core/src/View/MDSpan/Kokkos_MDSpan_Layout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct ViewOffsetFromExtents {

template <class ElementType, class Extents, class LayoutPolicy,
class AccessorPolicy>
auto array_layout_from_mdspan(
KOKKOS_INLINE_FUNCTION auto array_layout_from_mdspan(
const mdspan<ElementType, Extents, LayoutPolicy, AccessorPolicy> &mds) {
using layout_type = typename ArrayLayoutFromLayout<LayoutPolicy>::type;
const auto &ext = mds.extents();
Expand All @@ -81,7 +81,7 @@ auto array_layout_from_mdspan(

template <class ElementType, class Extents, class LayoutPolicy,
class AccessorPolicy>
auto view_offset_from_mdspan(
KOKKOS_INLINE_FUNCTION auto view_offset_from_mdspan(
const mdspan<ElementType, Extents, LayoutPolicy, AccessorPolicy> &mds) {
using offset_type =
typename ViewOffsetFromExtents<ElementType, Extents, LayoutPolicy>::type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ class layout_left::mapping {

// [mdspan.submdspan.mapping], submdspan mapping specialization
template<class... SliceSpecifiers>
constexpr auto submdspan_mapping_impl(
MDSPAN_INLINE_FUNCTION
constexpr auto submdspan_mapping_impl(
SliceSpecifiers... slices) const;

template<class... SliceSpecifiers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ class layout_right::mapping {

// [mdspan.submdspan.mapping], submdspan mapping specialization
template<class... SliceSpecifiers>
constexpr auto submdspan_mapping_impl(
MDSPAN_INLINE_FUNCTION
constexpr auto submdspan_mapping_impl(
SliceSpecifiers... slices) const;

template<class... SliceSpecifiers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,8 @@ struct layout_stride {

// [mdspan.submdspan.mapping], submdspan mapping specialization
template<class... SliceSpecifiers>
constexpr auto submdspan_mapping_impl(
MDSPAN_INLINE_FUNCTION
constexpr auto submdspan_mapping_impl(
SliceSpecifiers... slices) const;

template<class... SliceSpecifiers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ template <class LayoutMapping> struct submdspan_mapping_result {
};

namespace detail {
using detail::first_of;
using detail::stride_of;
using detail::inv_map_rank;

// constructs sub strides
template <class SrcMapping, class... slice_strides, size_t... InvMapIdxs>
MDSPAN_INLINE_FUNCTION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ struct padded_extent {
return {find_next_multiple(pv,
exts.extent(_ExtentToPadIdx))};
} else {
(void)pv; // Some compilers complain about pv not being used here
return {};
}
}
Expand Down

0 comments on commit c5711c1

Please sign in to comment.