-
Notifications
You must be signed in to change notification settings - Fork 197
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
[FEA] Helpers for identifying contiguous layouts. #1861
[FEA] Helpers for identifying contiguous layouts. #1861
Conversation
{ | ||
std::uint64_t stride = 1; | ||
for (auto r = extents.rank(); r > 0; r--) { | ||
if (stride != strides[r - 1]) { return false; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In your test case, in the first iteration isn't stride = 1
and strides[r - 1] = 8
where r = 3
? I don't understand how this doesn't exit in the first iteration itself
cpp/test/core/mdspan_utils.cu
Outdated
{ | ||
extents<std::int64_t, dynamic_extent, dynamic_extent, dynamic_extent> exts{10, 10, 10}; | ||
{ | ||
std::array<std::size_t, 3> strides{128, 32, 8}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be {800, 80, 8}
? I must be really misunderstanding something here
@divyegala Apologies for the error, I got a bit confused now that I pick up the PR, how did I get the tests to pass (along with CI) ...
|
/merge |
- Use strides to determine whether we can use a contiguous layout. Useful for accepting inputs with stride information like numpy array or legate stores. The code is mostly copied and pasted from mdspan layout_left/right constructors. These constructors can optionally accept a stride layout if the underlying memory is contiguous, otherwise throw an exception. We change the exception into a boolean return value. Authors: - Jiaming Yuan (https://github.com/trivialfis) - Corey J. Nolet (https://github.com/cjnolet) Approvers: - Divye Gala (https://github.com/divyegala) URL: rapidsai#1861
Useful for accepting inputs with stride information like numpy array or legate stores. The code is mostly copied and pasted from mdspan layout_left/right constructors. These constructors can optionally accept a stride layout if the underlying memory is contiguous, otherwise throw an exception. We change the exception into a boolean return value.