Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a race for CUDA event in CachingHostAllocator #237

Merged
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
9 changes: 5 additions & 4 deletions HeterogeneousCore/CUDAServices/src/CachingHostAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,6 @@ struct CachingHostAllocator
}
}

// Unlock
mutex.Unlock();

if (CubDebug(error = cudaGetDevice(&entrypoint_device))) return error;
if (entrypoint_device != search_key.device) {
if (CubDebug(error = cudaSetDevice(search_key.device))) return error;
Expand All @@ -550,7 +547,11 @@ struct CachingHostAllocator
// Insert the ready event in the associated stream (must have current device set properly)
if (CubDebug(error = cudaEventRecord(search_key.ready_event, search_key.associated_stream))) return error;
}
else

// Unlock
mutex.Unlock();

if (!recached)
{
// Free the allocation from the runtime and cleanup the event.
if (CubDebug(error = cudaFreeHost(d_ptr))) return error;
Expand Down