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
Este commit está contenido en:
Saleel Kudchadker
2020-05-20 10:54:57 -07:00
padre 4503d44e12
commit 50be95e169
+8 -2
Ver fichero
@@ -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;
}