-
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] Implement unravel_index for row-major array. #723
[FEA] Implement unravel_index for row-major array. #723
Conversation
rerun tests |
cpp/include/raft/core/mdarray.hpp
Outdated
*/ | ||
template <typename LayoutPolicy, std::size_t... Exts> | ||
MDSPAN_INLINE_FUNCTION auto unravel_index(size_t idx, |
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.
std::size_t idx
as even extents are expressed as that type?
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.
I haven't tested the updated mdspan and its new extent type yet.
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.
Fair. We'll update it when we update mdspan
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.
Could this parameter possibly be optional with a default type/value? For those wishing to use the template param directly?
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.
Yes. I will update the parameter type
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.
Done.
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.
Am I missing the updates?
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.
I changed the parameter type of std::size_t idx
into template Idx idx
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.
LGTM. Thanks @trivialfis for the change to use std::tuple
instead of exposing thrust
.
@gpucibot merge |
Revised version of #631 with
thrust::tuple
replaced bystd::tuple
and customapply
function replaced bystd::apply
.Related: #629
The implementation is mostly copied from XGBoost https://github.com/dmlc/xgboost/blob/fdf533f2b9af9c068cddba50839574c6abb58dc3/include/xgboost/linalg.h#L523 .
In the tests, I have used both
__host__ __device__
and__device__
lambdas to make surestd::tuple
andstd::apply
are working correctly with CUDA kernel.