-
Notifications
You must be signed in to change notification settings - Fork 113
Make device contains take a template key parameter
#174
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
Changes from 10 commits
25befef
8103c79
3b0adf5
a3ea3c2
b0a95ca
ad321f4
aadf4a2
fcd9d45
c1ba451
55bba1f
faedd75
e4341bf
c3fc8de
111734a
b35f7b6
d19d09d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,7 +108,7 @@ template <typename Key, | |
| class ProbeSequence> | ||
| template <typename InputIt, typename OutputIt, typename KeyEqual> | ||
| void static_multimap<Key, Value, Scope, Allocator, ProbeSequence>::contains( | ||
| InputIt first, InputIt last, OutputIt output_begin, cudaStream_t stream, KeyEqual key_equal) const | ||
| InputIt first, InputIt last, OutputIt output_begin, KeyEqual key_equal, cudaStream_t stream) const | ||
| { | ||
| auto const num_keys = std::distance(first, last); | ||
| if (num_keys == 0) { return; } | ||
|
|
@@ -536,13 +536,37 @@ template <typename Key, | |
| cuda::thread_scope Scope, | ||
| typename Allocator, | ||
| class ProbeSequence> | ||
| template <typename KeyEqual> | ||
| template <typename ProbeKey, typename KeyEqual> | ||
| __device__ __forceinline__ bool | ||
| static_multimap<Key, Value, Scope, Allocator, ProbeSequence>::device_view::contains( | ||
| cooperative_groups::thread_block_tile<ProbeSequence::cg_size> const& g, | ||
| Key const& k, | ||
| ProbeKey const& k, | ||
| KeyEqual key_equal) noexcept | ||
| { | ||
| static_assert(std::is_invocable_r_v<bool, KeyEqual, ProbeKey, Key>, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I pointed to
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've removed those 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. |
||
| "KeyEqual(ProbeKey{}, Key{}) must be a valid callable."); | ||
|
PointKernel marked this conversation as resolved.
Outdated
|
||
|
|
||
| if constexpr (ProbeSequence::is_linear_probing) { | ||
| static_assert(std::is_invocable_r_v<cuco::hash_value_type, typename ProbeSequence::hasher, Key>, | ||
| "ProbeSequence::hasher(Key{}) must be a valid callable."); | ||
| static_assert( | ||
| std::is_invocable_r_v<cuco::hash_value_type, typename ProbeSequence::hasher, ProbeKey>, | ||
| "ProbeSequence::hasher(ProbeKey{}) must be a valid callable."); | ||
| } else { | ||
| static_assert( | ||
| std::is_invocable_r_v<cuco::hash_value_type, typename ProbeSequence::hasher1, Key>, | ||
| "ProbeSequence::hasher1(Key{}) must be a valid callable."); | ||
| static_assert( | ||
| std::is_invocable_r_v<cuco::hash_value_type, typename ProbeSequence::hasher2, Key>, | ||
| "ProbeSequence::hasher2(Key{}) must be a valid callable."); | ||
| static_assert( | ||
| std::is_invocable_r_v<cuco::hash_value_type, typename ProbeSequence::hasher1, ProbeKey>, | ||
| "ProbeSequence::hasher1(ProbeKey{}) must be a valid callable."); | ||
| static_assert( | ||
| std::is_invocable_r_v<cuco::hash_value_type, typename ProbeSequence::hasher2, ProbeKey>, | ||
| "ProbeSequence::hasher2(ProbeKey{}) must be a valid callable."); | ||
| } | ||
|
|
||
| return impl_.contains<uses_vector_load()>(g, k, key_equal); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.