Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Commit 52d58a8

Browse files
ahehn-nvalliepiper
authored andcommitted
Fixed CubDebug usage in CachingDeviceAllocator::DeviceAllocate
1 parent a39e385 commit 52d58a8

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

cub/util_allocator.cuh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,22 @@ struct CachingDeviceAllocator
405405
// To prevent races with reusing blocks returned by the host but still
406406
// in use by the device, only consider cached blocks that are
407407
// either (from the active stream) or (from an idle stream)
408-
if ((active_stream == block_itr->associated_stream) ||
409-
(CubDebug(cudaEventQuery(block_itr->ready_event) != cudaErrorNotReady)))
408+
bool is_reusable = false;
409+
if (active_stream == block_itr->associated_stream)
410+
{
411+
is_reusable = true;
412+
}
413+
else
414+
{
415+
const cudaError_t event_status = cudaEventQuery(block_itr->ready_event);
416+
if(event_status != cudaErrorNotReady)
417+
{
418+
CubDebug(event_status);
419+
is_reusable = true;
420+
}
421+
}
422+
423+
if(is_reusable)
410424
{
411425
// Reuse existing cache block. Insert into live blocks.
412426
found = true;

0 commit comments

Comments
 (0)