2
0

SWDEV-248293 - Fix elapsedTime

Fixes the elapsed time for the scenarios where HIP API takes one of the start/stop events
and another one is recorded using hipEventRecord.


Change-Id: I51831b2651fc8e7207ff0e3fcc6dc7c1b4239fa8
Este cometimento está contido em:
Satyanvesh Dittakavi
2020-08-20 13:03:52 +00:00
ascendente 9124285f18
cometimento f80044bd6a
2 ficheiros modificados com 7 adições e 7 eliminações
+6 -6
Ver ficheiro
@@ -90,12 +90,10 @@ hipError_t Event::elapsedTime(Event& eStop, float& ms) {
return hipErrorNotReady;
}
// For certain HIP API's that take start and stop event
// and no hipEventRecord needs to be called
if (event_ == eStop.event_ && !recorded_ && !eStop.recorded_) {
if (event_ != eStop.event_ && recorded_ && eStop.recorded_) {
ms = static_cast<float>(static_cast<int64_t>(eStop.event_->profilingInfo().end_ -
event_->profilingInfo().start_))/1000000.f;
} else if (event_ == eStop.event_) {
event_->profilingInfo().end_))/1000000.f;
} else if (event_ == eStop.event_ && (recorded_ || eStop.recorded_)) {
// Events are the same, which indicates the stream is empty and likely
// eventRecord is called on another stream. For such cases insert and measure a
// marker.
@@ -107,8 +105,10 @@ hipError_t Event::elapsedTime(Event& eStop, float& ms) {
command->release();
} else {
// For certain HIP API's that take both start and stop event
// or scenarios where HIP API takes one of the events and the other event is recorded with hipEventRecord
ms = static_cast<float>(static_cast<int64_t>(eStop.event_->profilingInfo().end_ -
event_->profilingInfo().end_))/1000000.f;
event_->profilingInfo().start_))/1000000.f;
}
return hipSuccess;
}
+1 -1
Ver ficheiro
@@ -287,7 +287,7 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX,
}
}
profileNDRange = (startEvent != nullptr && stopEvent != nullptr);
profileNDRange = (startEvent != nullptr || stopEvent != nullptr);
// Flag set to 1 signifies that kernel can be launched in anyorder
if (flags & hipExtAnyOrderLaunch) {