Skip to content

Commit

Permalink
Fix insert_or_apply bug (#546)
Browse files Browse the repository at this point in the history
  • Loading branch information
srinivasyadav18 authored Jul 16, 2024
1 parent e7b5a38 commit ee5c104
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions include/cuco/detail/static_map/static_map_ref.inl
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,9 @@ class operator_impl<

// If the key is already in the container, update the payload and return
if (eq_res == detail::equal_result::EQUAL) {
if constexpr (sizeof(value_type) > 8) {
ref_.impl_.wait_for_payload(slot_ptr->second, empty_value);
}
op(cuda::atomic_ref<T, Scope>{slot_ptr->second}, val.second);
return;
}
Expand Down Expand Up @@ -689,6 +692,9 @@ class operator_impl<
if (group_contains_equal) {
auto const src_lane = __ffs(group_contains_equal) - 1;
if (group.thread_rank() == src_lane) {
if constexpr (sizeof(value_type) > 8) {
ref_.impl_.wait_for_payload(slot_ptr->second, empty_value);
}
op(cuda::atomic_ref<T, Scope>{slot_ptr->second}, val.second);
}
return;
Expand Down
2 changes: 1 addition & 1 deletion tests/static_map/insert_or_apply_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ TEMPLATE_TEST_CASE_SIG(
(int64_t, int32_t, cuco::test::probe_sequence::linear_probing, 2),
(int64_t, int64_t, cuco::test::probe_sequence::linear_probing, 2))
{
constexpr size_type num_keys{400};
constexpr size_type num_keys{10'000};
constexpr size_type num_unique_keys{100};

using probe = std::conditional_t<
Expand Down

0 comments on commit ee5c104

Please sign in to comment.