Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix is_row/col_order for strided layouts #2173

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions cpp/include/raft/util/input_validation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ constexpr bool is_row_or_column_major(mdspan<ElementType, Extents, layout_right,
template <class ElementType, class Extents, class Accessor>
constexpr bool is_row_or_column_major(mdspan<ElementType, Extents, layout_stride, Accessor> m)
{
return m.stride(0) == typename Extents::index_type(1) ||
m.stride(1) == typename Extents::index_type(1);
return is_row_major(m) || is_col_major(m);
}

template <class ElementType, class Extents, class Layout, class Accessor>
Expand All @@ -64,7 +63,7 @@ constexpr bool is_row_major(mdspan<ElementType, Extents, layout_right, Accessor>
template <class ElementType, class Extents, class Accessor>
constexpr bool is_row_major(mdspan<ElementType, Extents, layout_stride, Accessor> m)
{
return m.stride(1) == typename Extents::index_type(1);
return m.stride(1) == typename Extents::index_type(1) && m.stride(0) >= m.extent(1);
}

template <class ElementType, class Extents, class Layout, class Accessor>
Expand All @@ -88,7 +87,7 @@ constexpr bool is_col_major(mdspan<ElementType, Extents, layout_right, Accessor>
template <class ElementType, class Extents, class Accessor>
constexpr bool is_col_major(mdspan<ElementType, Extents, layout_stride, Accessor> m)
{
return m.stride(0) == typename Extents::index_type(1);
return m.stride(0) == typename Extents::index_type(1) && m.stride(1) >= m.extent(0);
}

template <class ElementType, class IndexType, size_t... Exts, class Layout, class Accessor>
Expand Down
Loading