Skip to content

Commit ed9cc18

Browse files
committed
Fix missing deallocate in cub
1 parent 221fde4 commit ed9cc18

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

cub/cub/detail/device_memory_resource.cuh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ struct device_memory_resource
6868
return ptr;
6969
}
7070

71+
CUB_RUNTIME_FUNCTION void deallocate(::cuda::stream_ref stream, void* ptr, size_t bytes, size_t /* alignment */)
72+
{
73+
deallocate(stream, ptr, bytes);
74+
}
75+
7176
CUB_RUNTIME_FUNCTION void deallocate(::cuda::stream_ref stream, void* ptr, size_t /* bytes */)
7277
{
7378
NV_IF_TARGET( //

cub/cub/detail/temporary_storage.cuh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,9 @@ deallocate(::cuda::stream_ref stream, void* d_temp_storage, size_t temp_storage_
367367
NV_IF_ELSE_TARGET(
368368
NV_IS_HOST,
369369
(
370-
try { mr.deallocate(stream, d_temp_storage, temp_storage_bytes, alignof(::cuda::std::max_align_t)); } catch (...) {
371-
return cudaErrorMemoryAllocation;
372-
}),
370+
try {
371+
mr.deallocate(stream, d_temp_storage, temp_storage_bytes, alignof(::cuda::std::max_align_t));
372+
} catch (...) { return cudaErrorMemoryAllocation; }),
373373
(mr.deallocate(stream, d_temp_storage, temp_storage_bytes, alignof(::cuda::std::max_align_t));));
374374
return cudaSuccess;
375375
}

libcudacxx/include/cuda/__memory_resource/any_resource.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ struct __ibasic_resource : __basic_interface<__ibasic_resource>
133133
}
134134

135135
CCCL_DEPRECATED_BECAUSE("Specify an explicit alignment argument. The default alignment will be removed in a future "
136-
"release.")
137-
_CCCL_PUBLIC_HOST_API void* allocate_sync(size_t __bytes)
136+
"release.") _CCCL_PUBLIC_HOST_API void*
137+
allocate_sync(size_t __bytes)
138138
{
139139
return allocate_sync(__bytes, alignof(::cuda::std::max_align_t));
140140
}
@@ -145,8 +145,8 @@ struct __ibasic_resource : __basic_interface<__ibasic_resource>
145145
}
146146

147147
CCCL_DEPRECATED_BECAUSE("Specify an explicit alignment argument. The default alignment will be removed in a future "
148-
"release.")
149-
_CCCL_PUBLIC_HOST_API void deallocate_sync(void* __pv, size_t __bytes) noexcept
148+
"release.") _CCCL_PUBLIC_HOST_API void
149+
deallocate_sync(void* __pv, size_t __bytes) noexcept
150150
{
151151
return deallocate_sync(__pv, __bytes, alignof(::cuda::std::max_align_t));
152152
}
@@ -164,8 +164,8 @@ struct __ibasic_async_resource : __basic_interface<__ibasic_async_resource>
164164
}
165165

166166
CCCL_DEPRECATED_BECAUSE("Specify an explicit alignment argument. The default alignment will be removed in a future "
167-
"release.")
168-
_CCCL_PUBLIC_HOST_API void* allocate(::cuda::stream_ref __stream, size_t __bytes)
167+
"release.") _CCCL_PUBLIC_HOST_API void*
168+
allocate(::cuda::stream_ref __stream, size_t __bytes)
169169
{
170170
return ::cuda::__virtcall<&__allocate_async<__ibasic_async_resource>>(
171171
this, __stream, __bytes, alignof(::cuda::std::max_align_t));
@@ -178,8 +178,8 @@ struct __ibasic_async_resource : __basic_interface<__ibasic_async_resource>
178178
}
179179

180180
CCCL_DEPRECATED_BECAUSE("Specify an explicit alignment argument. The default alignment will be removed in a future "
181-
"release.")
182-
_CCCL_PUBLIC_HOST_API void deallocate(::cuda::stream_ref __stream, void* __pv, size_t __bytes) noexcept
181+
"release.") _CCCL_PUBLIC_HOST_API void
182+
deallocate(::cuda::stream_ref __stream, void* __pv, size_t __bytes) noexcept
183183
{
184184
return ::cuda::__virtcall<&__deallocate_async<__ibasic_async_resource>>(
185185
this, __stream, __pv, __bytes, alignof(::cuda::std::max_align_t));

0 commit comments

Comments
 (0)