From 1c65bb1684d79df52deea0111c24f5c2c39bc246 Mon Sep 17 00:00:00 2001 From: Ben Sander Date: Sun, 5 Nov 2017 10:32:24 -0600 Subject: [PATCH] Set event state AFTER it is recorded. --- hipamd/src/hip_event.cpp | 5 ++--- hipamd/src/hip_stream.cpp | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/hipamd/src/hip_event.cpp b/hipamd/src/hip_event.cpp index d1ee37a45e..91c3f9cb55 100644 --- a/hipamd/src/hip_event.cpp +++ b/hipamd/src/hip_event.cpp @@ -45,10 +45,10 @@ ihipEvent_t::ihipEvent_t(unsigned flags) void ihipEvent_t::attachToCompletionFuture(const hc::completion_future *cf, hipStream_t stream, ihipEventType_t eventType) { - _state = hipEventStatusRecording; _marker = *cf; _type = eventType; _stream = stream; + _state = hipEventStatusRecording; } @@ -157,13 +157,12 @@ hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream) event->_state = hipEventStatusComplete; return ihipLogStatus(hipSuccess); } else { - event->_state = hipEventStatusRecording; // Clear timestamps event->_timestamp = 0; // Record the event in the stream: stream->locked_recordEvent(event); - + event->_state = hipEventStatusRecording; return ihipLogStatus(hipSuccess); } } else { diff --git a/hipamd/src/hip_stream.cpp b/hipamd/src/hip_stream.cpp index f62be31b9e..0cb5e732ab 100644 --- a/hipamd/src/hip_stream.cpp +++ b/hipamd/src/hip_stream.cpp @@ -103,7 +103,7 @@ hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int 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. + // This will use create_blocking_marker to wait on the specified queue. stream->locked_streamWaitEvent(event); }