From b2af1820f5a656b3f58c593ba681fabfa7eeaa2e Mon Sep 17 00:00:00 2001 From: Jeff Daily Date: Wed, 6 Nov 2019 15:56:32 +0000 Subject: [PATCH] hipEventRecord only needs one lock; remove locked_eventIsReady --- hipamd/src/hip_event.cpp | 32 +++++++++++++------------------- hipamd/src/hip_hcc.cpp | 8 -------- hipamd/src/hip_hcc_internal.h | 2 -- 3 files changed, 13 insertions(+), 29 deletions(-) diff --git a/hipamd/src/hip_event.cpp b/hipamd/src/hip_event.cpp index 7e84971813..dcab059774 100644 --- a/hipamd/src/hip_event.cpp +++ b/hipamd/src/hip_event.cpp @@ -222,25 +222,19 @@ hipError_t hipEventElapsedTime(float* ms, hipEvent_t start, hipEvent_t stop) { hipError_t hipEventQuery(hipEvent_t event) { HIP_INIT_SPECIAL_API(hipEventQuery, TRACE_QUERY, event); - hipError_t status = hipSuccess; + if (!event) return ihipLogStatus(hipErrorInvalidResourceHandle); - if ( NULL == event) - { - status = hipErrorInvalidResourceHandle; - } else { - if (!(event->_flags & hipEventReleaseToSystem)) { - tprintf(DB_WARN, - "hipEventQuery on event without system-scope fence ; consider creating with " - "hipEventReleaseToSystem\n"); - } - - auto ecd = event->locked_copyCrit(); - - if ((ecd._state == hipEventStatusRecording) && !ecd._stream->locked_eventIsReady(event)) { - status = hipErrorNotReady; - } else { - status = hipSuccess; - } + if (!(event->_flags & hipEventReleaseToSystem)) { + tprintf(DB_WARN, + "hipEventQuery on event without system-scope fence ; consider creating with " + "hipEventReleaseToSystem\n"); } - return ihipLogStatus(status); + + auto ecd = event->locked_copyCrit(); + + if (ecd._state == hipEventStatusRecording && !ecd.marker().is_ready()) { + return ihipLogStatus(hipErrorNotReady); + } + + return ihipLogStatus(hipSuccess); } diff --git a/hipamd/src/hip_hcc.cpp b/hipamd/src/hip_hcc.cpp index 7150140e12..5c64eee317 100644 --- a/hipamd/src/hip_hcc.cpp +++ b/hipamd/src/hip_hcc.cpp @@ -325,14 +325,6 @@ void ihipStream_t::locked_streamWaitEvent(ihipEventData_t& ecd) { } -// Causes current stream to wait for specified event to complete: -// Note this does not provide any kind of host serialization. -bool ihipStream_t::locked_eventIsReady(hipEvent_t event) { - LockedAccessor_EventCrit_t ecrit(event->criticalData()); - - return (ecrit->_eventData.marker().is_ready()); -} - // Create a marker in this stream. // Save state in the event so it can track the status of the event. hc::completion_future ihipStream_t::locked_recordEvent(hipEvent_t event) { diff --git a/hipamd/src/hip_hcc_internal.h b/hipamd/src/hip_hcc_internal.h index 8c1827535c..8ee47eba4a 100644 --- a/hipamd/src/hip_hcc_internal.h +++ b/hipamd/src/hip_hcc_internal.h @@ -583,8 +583,6 @@ class ihipStream_t { void locked_streamWaitEvent(ihipEventData_t& event); hc::completion_future locked_recordEvent(hipEvent_t event); - bool locked_eventIsReady(hipEvent_t event); - ihipStreamCritical_t& criticalData() { return _criticalData; }; //---