diff --git a/rocclr/hip_event.cpp b/rocclr/hip_event.cpp index dddadd1bfd..2e4870834f 100644 --- a/rocclr/hip_event.cpp +++ b/rocclr/hip_event.cpp @@ -90,9 +90,15 @@ hipError_t Event::elapsedTime(Event& eStop, float& ms) { return hipErrorNotReady; } - ms = static_cast(static_cast(eStop.event_->profilingInfo().end_ - + // For certain HIP Api's that take start and stop event + // the command is the same + if (event_ == eStop.event_) { + ms = static_cast(static_cast(eStop.event_->profilingInfo().end_ - + event_->profilingInfo().start_))/1000000.f; + } else { + ms = static_cast(static_cast(eStop.event_->profilingInfo().end_ - event_->profilingInfo().end_))/1000000.f; - + } return hipSuccess; }