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

Fixed CubDebug usage in CachingDeviceAllocator::DeviceAllocate #207

Merged
merged 1 commit into from
Oct 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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