Skip to content

Commit

Permalink
Allow initializations for empty storage
Browse files Browse the repository at this point in the history
  • Loading branch information
PointKernel committed Aug 14, 2024
1 parent 118fd1f commit 2bc5347
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/cuco/detail/storage/aow_storage.inl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ template <typename T, int32_t WindowSize, typename Extent, typename Allocator>
void aow_storage<T, WindowSize, Extent, Allocator>::initialize_async(
value_type key, cuda::stream_ref stream) noexcept
{
if (this->num_windows() == 0) { return; }

auto constexpr cg_size = 1;
auto constexpr stride = 4;
auto const grid_size = cuco::detail::grid_size(this->num_windows(), cg_size, stride);
Expand Down
9 changes: 9 additions & 0 deletions tests/utility/storage_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ TEMPLATE_TEST_CASE_SIG("Storage tests",
using allocator_type = cuco::cuda_allocator<char>;
auto allocator = allocator_type{};

SECTION("Initialize empty storage is allowed.")
{
auto s = cuco::
aow_storage<cuco::pair<Key, Value>, window_size, cuco::extent<std::size_t>, allocator_type>{
cuco::extent<std::size_t>{0}, allocator};

s.initialize(cuco::pair<Key, Value>{1, 1});
}

SECTION("Allocate array of pairs with AoS storage.")
{
auto s = cuco::
Expand Down

0 comments on commit 2bc5347

Please sign in to comment.