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
Šī revīzija ir iekļauta:
Saleel Kudchadker committed 2020-05-20 16:02:48 -04:00
1 vecāks 4503d44e12
revīzija 50be95e169
1 file changed
+8 -2
+8 -2
Parādīt failu
@@ -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;
}