Make ihipDevice_t thread-safe.
Move critical data into separate class and protect with LockAccessor wrapper class. For device, the streams list is the critical data since it is modified when streams are created or destroyed. The streams list is accessed in several places including when synchronizing across all streams on the device (ie from the default stream). Other device data is set once by the device cosntructor and is not critical so All functions which acquire the LockAccessor now named with "locked_" prefix.
This commit is contained in:
@@ -459,7 +459,7 @@ hipError_t hipFree(void* ptr)
|
||||
hipError_t hipStatus = hipErrorInvalidDevicePointer;
|
||||
|
||||
// Synchronize to ensure all work has finished.
|
||||
ihipGetTlsDefaultDevice()->waitAllStreams(); // ignores non-blocking streams, this waits for all activity to finish.
|
||||
ihipGetTlsDefaultDevice()->locked_waitAllStreams(); // ignores non-blocking streams, this waits for all activity to finish.
|
||||
|
||||
if (ptr) {
|
||||
hc::accelerator acc;
|
||||
|
||||
Reference in New Issue
Block a user