Make device contains take a template key parameter#174
Make device contains take a template key parameter#174PointKernel merged 16 commits intoNVIDIA:devfrom
contains take a template key parameter#174Conversation
|
rerun tests |
| Key const& k, | ||
| Hash hash = Hash{}, | ||
| KeyEqual key_equal = KeyEqual{}) const noexcept; | ||
| __device__ std::enable_if_t<std::is_invocable_v<KeyEqual, ProbeKey, Key>, bool> contains( |
There was a problem hiding this comment.
| __device__ std::enable_if_t<std::is_invocable_v<KeyEqual, ProbeKey, Key>, bool> contains( | |
| __device__ std::enable_if_t<std::is_invocable_r_v<bool, KeyEqual, ProbeKey, Key> && std::is_invocable_r_v<bool, KeyEqual, Key, ProbeKey>, bool> contains( |
There was a problem hiding this comment.
The condition here is not a requirement check. It's just to differentiate CG API and non-CG API cause if we pass three template parameters to contains, the compiler cannot know which one we are referring to. e.g. https://github.com/PointKernel/cuCollections/blob/3b0adf597ed828f3813030452fb39f9b1735c90b/tests/static_map/custom_type_test.cu#L217
|
This looks good to me. I will try to test and will update. |
|
Update: I have successfully adopted this: rapidsai/cudf#10656 (code). Thanks again for working on it. |
| ProbeKey const& k, | ||
| KeyEqual key_equal) noexcept | ||
| { | ||
| static_assert(std::is_invocable_r_v<bool, KeyEqual, ProbeKey, Key>, |
There was a problem hiding this comment.
tbh, all these static_asserts are overkill. If someone passes in an invalid callable, it will still fail to compile, just with a different error message. This feels like a ton of complexity to maintain.
There was a problem hiding this comment.
I pointed to is_invocable just for the purposes of documentation. I didn't intend that we need to static_assert all of the requirements of the function.
There was a problem hiding this comment.
I've removed those static_assert as requested and updated corresponding docs.
I agree that so many asserts are painful to maintain now but the situation will be improved after the grand refactor where we only need one set of those static asserts in the base class as opposed to putting them in every involved function for all map types.
Contributes to #26
Closes #172
This PR makes the device
containsAPIs take a template key parameter. It also includesthrust::identity