-
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
[Opt] Expose the detail::popc
as public API
#2346
Conversation
* @param[out] counter Device scalar view to store the number of bits that are set to 1. | ||
*/ | ||
template <typename value_t, typename index_t> | ||
void popc(const raft::resources& res, |
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.
To be quite honest, I'm not sure this is something that belongs in raft::core
.
Also, I'm a little confused by the max_len- can you explain why this additional argument is needed? This API seems a little implementation-specific, which makes me wonder if it should be more strongly coupled to the bitset
/bitmap
.
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.
The original wrap of popc
is here: https://github.com/rapidsai/raft/blob/branch-24.08/cpp/include/raft/core/detail/mdspan_util.cuh#L48. But it can only calc nonzero bits in one int32/int64, while this one can calculate on an integer array. Would you have some recommendations on the namespace
? Maybe the raft::linalg
is another choice.
The max_len
should be required to indicate the max bits to be processed. For example, we have 100 bits needed to be calculated and at least 4 uint32_t
s to present them(get 128 bits physically). In this situation, a max_len
or similar parameter is needed to tell the popc
to stop on the right bits.
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.
This API is mainly for clean code. The detail::popc
includes at least 10 lines of code because it has to process the corner cases. If we were using the original code, we would have to copy that block of code anywhere, that is ugly.
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.
Since this is a computational function, I don't think it belongs in raft/core
. I question whether or not it actually belongs in raft/matrix
or in raft/utils
, though. Hmm.
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 prefer raft/utils
as it seems more reasonable. If you agree, I will move it there. @cjnolet
/merge |
rapidsai/raft#2346 introduced a breaking change in the API. This PR fixes the API usage. Authors: - Divye Gala (https://github.com/divyegala) Approvers: - Corey J. Nolet (https://github.com/cjnolet) URL: #249
rapidsai/raft#2346 introduced a breaking change in the API. This PR fixes the API usage. Authors: - Divye Gala (https://github.com/divyegala) Approvers: - Corey J. Nolet (https://github.com/cjnolet) URL: rapidsai#249
raft::xx::detail:
calling for prefiltered brute-force toraft::xx
namespace cuvs#158