Make hipEvent_t thread safe.
Support re-recording of same event by different threads. - Add criticalData structure to hipEvent_t, similar to mechanism used for streams, contexts, device. Events are always locked after streams to avoid deadlock. - ihipEvent_t::locked_copyCrit can be used to copy critical state including marker. The critical state in the event can then be re-recorded. - refactor hipEventElapsedTime. Remmove stale debug code, native signal refs.
이 커밋은 다음에 포함됨:
+12
-9
@@ -339,12 +339,11 @@ void ihipStream_t::locked_wait()
|
||||
|
||||
// Causes current stream to wait for specified event to complete:
|
||||
// Note this does not provide any kind of host serialization.
|
||||
void ihipStream_t::locked_streamWaitEvent(hipEvent_t event)
|
||||
void ihipStream_t::locked_streamWaitEvent(ihipEventData_t &ecd)
|
||||
{
|
||||
LockedAccessor_StreamCrit_t crit(_criticalData);
|
||||
|
||||
|
||||
crit->_av.create_blocking_marker(event->marker(), hc::accelerator_scope);
|
||||
crit->_av.create_blocking_marker(ecd.marker(), hc::accelerator_scope);
|
||||
}
|
||||
|
||||
|
||||
@@ -352,24 +351,28 @@ void ihipStream_t::locked_streamWaitEvent(hipEvent_t event)
|
||||
// Note this does not provide any kind of host serialization.
|
||||
bool ihipStream_t::locked_eventIsReady(hipEvent_t event)
|
||||
{
|
||||
|
||||
// Event query that returns "Complete" may cause HCC to manipulate
|
||||
// internal queue state so lock the stream's queue here.
|
||||
LockedAccessor_StreamCrit_t crit(_criticalData);
|
||||
LockedAccessor_StreamCrit_t scrit(_criticalData);
|
||||
|
||||
return (event->marker().is_ready());
|
||||
LockedAccessor_EventCrit_t ecrit(event->criticalData());
|
||||
|
||||
return (ecrit->_eventData.marker().is_ready());
|
||||
}
|
||||
|
||||
void ihipStream_t::locked_eventWaitComplete(hipEvent_t event, hc::hcWaitMode waitMode)
|
||||
// Waiting on event can cause HCC to reclaim stream resources - so need to lock the stream.
|
||||
void ihipStream_t::locked_eventWaitComplete(hc::completion_future &marker, hc::hcWaitMode waitMode)
|
||||
{
|
||||
LockedAccessor_StreamCrit_t crit(_criticalData);
|
||||
|
||||
event->marker().wait(waitMode);
|
||||
marker.wait(waitMode);
|
||||
}
|
||||
|
||||
|
||||
// Create a marker in this stream.
|
||||
// Save state in the event so it can track the status of the event.
|
||||
void ihipStream_t::locked_recordEvent(hipEvent_t event)
|
||||
hc::completion_future ihipStream_t::locked_recordEvent(hipEvent_t event)
|
||||
{
|
||||
// Lock the stream to prevent simultaneous access
|
||||
LockedAccessor_StreamCrit_t crit(_criticalData);
|
||||
@@ -385,7 +388,7 @@ void ihipStream_t::locked_recordEvent(hipEvent_t event)
|
||||
scopeFlag = HIP_EVENT_SYS_RELEASE ? hc::system_scope : hc::accelerator_scope;
|
||||
}
|
||||
|
||||
event->marker(crit->_av.create_marker(scopeFlag));
|
||||
return crit->_av.create_marker(scopeFlag);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
|
||||
새 이슈에서 참조
사용자 차단