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

Commit

Permalink
Fixed CubDebug usage in CachingDeviceAllocator::DeviceAllocate
Browse files Browse the repository at this point in the history
  • Loading branch information
ahehn-nv authored and alliepiper committed Oct 14, 2020
1 parent a39e385 commit 52d58a8
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions cub/util_allocator.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,22 @@ struct CachingDeviceAllocator
// To prevent races with reusing blocks returned by the host but still
// in use by the device, only consider cached blocks that are
// either (from the active stream) or (from an idle stream)
if ((active_stream == block_itr->associated_stream) ||
(CubDebug(cudaEventQuery(block_itr->ready_event) != cudaErrorNotReady)))
bool is_reusable = false;
if (active_stream == block_itr->associated_stream)
{
is_reusable = true;
}
else
{
const cudaError_t event_status = cudaEventQuery(block_itr->ready_event);
if(event_status != cudaErrorNotReady)
{
CubDebug(event_status);
is_reusable = true;
}
}

if(is_reusable)
{
// Reuse existing cache block. Insert into live blocks.
found = true;
Expand Down

0 comments on commit 52d58a8

Please sign in to comment.