Fix elapsed time calc for hipEventElapsedTime

If the start and stop events have same command internally
then measure command end to command start
Change-Id: Ie70cfa37c06c06573f0ed58dab2bbe4434c1724b


[ROCm/hip commit: 50be95e169]
Этот коммит содержится в:
Saleel Kudchadker
2020-05-20 10:54:57 -07:00
родитель 20e64e1450
Коммит 7836dfd322
+8 -2
Просмотреть файл
@@ -90,9 +90,15 @@ hipError_t Event::elapsedTime(Event& eStop, float& ms) {
return hipErrorNotReady;
}
ms = static_cast<float>(static_cast<int64_t>(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<float>(static_cast<int64_t>(eStop.event_->profilingInfo().end_ -
event_->profilingInfo().start_))/1000000.f;
} else {
ms = static_cast<float>(static_cast<int64_t>(eStop.event_->profilingInfo().end_ -
event_->profilingInfo().end_))/1000000.f;
}
return hipSuccess;
}