diff --git a/include/cuco/detail/storage/aow_storage.inl b/include/cuco/detail/storage/aow_storage.inl index dfbb90327..5d976e658 100644 --- a/include/cuco/detail/storage/aow_storage.inl +++ b/include/cuco/detail/storage/aow_storage.inl @@ -74,6 +74,8 @@ template void aow_storage::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); diff --git a/tests/utility/storage_test.cu b/tests/utility/storage_test.cu index 8cbd8c08d..8fb923fb8 100644 --- a/tests/utility/storage_test.cu +++ b/tests/utility/storage_test.cu @@ -37,6 +37,15 @@ TEMPLATE_TEST_CASE_SIG("Storage tests", using allocator_type = cuco::cuda_allocator; auto allocator = allocator_type{}; + SECTION("Initialize empty storage is allowed.") + { + auto s = cuco:: + aow_storage, window_size, cuco::extent, allocator_type>{ + cuco::extent{0}, allocator}; + + s.initialize(cuco::pair{1, 1}); + } + SECTION("Allocate array of pairs with AoS storage.") { auto s = cuco::