From f9ad5643808091c14529a7fbb73c301f4808db76 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 [ROCm/hip commit: 85080905c0594170834ecf6b37654f73f4d546b3] --- projects/hip/src/hip_event.cpp | 32 ++++++++++++----------------- projects/hip/src/hip_hcc.cpp | 8 -------- projects/hip/src/hip_hcc_internal.h | 2 -- 3 files changed, 13 insertions(+), 29 deletions(-) diff --git a/projects/hip/src/hip_event.cpp b/projects/hip/src/hip_event.cpp index 7e84971813..dcab059774 100644 --- a/projects/hip/src/hip_event.cpp +++ b/projects/hip/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/projects/hip/src/hip_hcc.cpp b/projects/hip/src/hip_hcc.cpp index 7150140e12..5c64eee317 100644 --- a/projects/hip/src/hip_hcc.cpp +++ b/projects/hip/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/projects/hip/src/hip_hcc_internal.h b/projects/hip/src/hip_hcc_internal.h index 8c1827535c..8ee47eba4a 100644 --- a/projects/hip/src/hip_hcc_internal.h +++ b/projects/hip/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; }; //---