Refactor hipStreamWaitEvent
- Null streams use same flow as non-null. - Add HIP_SYNC_STREAM_WAIT - Resolve null stream.
This commit is contained in:
@@ -88,6 +88,8 @@ int HIP_HOST_COHERENT = 1;
|
||||
|
||||
int HIP_SYNC_HOST_ALLOC = 1;
|
||||
|
||||
int HIP_SYNC_STREAM_WAIT = 0;
|
||||
|
||||
|
||||
#if (__hcc_workweek__ >= 17300)
|
||||
// Make sure we have required bug fix in HCC
|
||||
@@ -1249,6 +1251,7 @@ void HipReadEnv()
|
||||
|
||||
READ_ENV_I(release, HIP_SYNC_HOST_ALLOC, 0, "Sync before and after all host memory allocations. May help stability");
|
||||
READ_ENV_I(release, HIP_SYNC_NULL_STREAM, 0, "Synchronize on host for null stream submissions");
|
||||
READ_ENV_I(release, HIP_SYNC_STREAM_WAIT, 0, "hipStreamWaitEvent will synchronize to host");
|
||||
|
||||
|
||||
READ_ENV_I(release, HIP_HOST_COHERENT, 0, "If set, all host memory will be allocated as fine-grained system memory. This allows threadfence_system to work but prevents host memory from being cached on GPU which may have performance impact.");
|
||||
|
||||
@@ -65,6 +65,7 @@ extern int HIP_HIDDEN_FREE_MEM;
|
||||
//---
|
||||
// Chicken bits for disabling functionality to work around potential issues:
|
||||
extern int HIP_SYNC_HOST_ALLOC;
|
||||
extern int HIP_SYNC_STREAM_WAIT;
|
||||
|
||||
extern int HIP_SYNC_NULL_STREAM;
|
||||
|
||||
|
||||
@@ -93,18 +93,15 @@ hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int
|
||||
|
||||
} else if (event->_state != hipEventStatusUnitialized) {
|
||||
|
||||
if (stream != hipStreamNull) {
|
||||
|
||||
if (HIP_SYNC_STREAM_WAIT || (HIP_SYNC_NULL_STREAM && (stream == 0))) {
|
||||
// conservative wait on host for the specified event to complete:
|
||||
event->locked_waitComplete((event->_flags & hipEventBlockingSync) ? hc::hcWaitModeBlocked : hc::hcWaitModeActive);
|
||||
} else {
|
||||
stream = ihipSyncAndResolveStream(stream);
|
||||
// This will user create_blocking_marker to wait on the specified queue.
|
||||
stream->locked_streamWaitEvent(event);
|
||||
|
||||
} else {
|
||||
// TODO-hcc Convert to use create_blocking_marker(...) functionality.
|
||||
// Currently we have a super-conservative version of this - block on host, and drain the queue.
|
||||
// This should create a barrier packet in the target queue.
|
||||
// TODO-HIP_SYNC_NULL_STREAM
|
||||
stream->locked_wait();
|
||||
}
|
||||
|
||||
} // else event not recorded, return immediately and don't create marker.
|
||||
|
||||
return ihipLogStatus(e);
|
||||
|
||||
Reference in New Issue
Block a user