SWDEV-290367 - Make sure HIP checks for GPU signal

Check GPU signal status for event before falling into CPU command
status validation

Change-Id: I66f15752d7dca550c0fa1a2252ec5a63817391c3
이 커밋은 다음에 포함됨:
German Andryeyev
2021-06-10 20:30:32 -04:00
부모 37be0e449a
커밋 dd8265fc87
2개의 변경된 파일21개의 추가작업 그리고 6개의 파일을 삭제
+15 -5
파일 보기
@@ -35,8 +35,12 @@ bool Event::ready() {
if (event_->status() != CL_COMPLETE) {
event_->notifyCmdQueue();
}
return (event_->status() == CL_COMPLETE);
// Check HW status of the ROCcrl event. Note: not all ROCclr modes support HW status
bool ready = g_devices[deviceId()]->devices()[0]->IsHwEventReady(*event_);
if (!ready) {
ready = (event_->status() == CL_COMPLETE);
}
return ready;
}
hipError_t Event::query() {
@@ -58,7 +62,11 @@ hipError_t Event::synchronize() {
return hipSuccess;
}
event_->awaitCompletion();
// Check HW status of the ROCcrl event. Note: not all ROCclr modes support HW status
static constexpr bool kWaitCompletion = true;
if (!g_devices[deviceId()]->devices()[0]->IsHwEventReady(*event_, kWaitCompletion)) {
event_->awaitCompletion();
}
return hipSuccess;
}
@@ -84,8 +92,7 @@ hipError_t Event::elapsedTime(Event& eStop, float& ms) {
}
amd::ScopedLock stopLock(eStop.lock_);
if (event_ == nullptr ||
eStop.event_ == nullptr) {
if (event_ == nullptr || eStop.event_ == nullptr) {
return hipErrorInvalidHandle;
}
@@ -107,6 +114,9 @@ hipError_t Event::elapsedTime(Event& eStop, float& ms) {
ms = static_cast<float>(static_cast<int64_t>(command->event().profilingInfo().end_) - time())/1000000.f;
command->release();
} else {
// Note: with direct dispatch eStop.ready() relies on HW event, but CPU status can be delayed.
// Hence for now make sure CPU status is updated by calling awaitCompletion();
eStop.event_->awaitCompletion();
ms = static_cast<float>(eStop.time() - time())/1000000.f;
}
return hipSuccess;
+6 -1
파일 보기
@@ -421,7 +421,12 @@ hipError_t hipStreamQuery(hipStream_t stream) {
if (command->type() != 0) {
event.notifyCmdQueue();
}
hipError_t status = (command->status() == CL_COMPLETE) ? hipSuccess : hipErrorNotReady;
// Check HW status of the ROCcrl event. Note: not all ROCclr modes support HW status
bool ready = command->queue()->device().IsHwEventReady(event);
if (!ready) {
ready = (command->status() == CL_COMPLETE);
}
hipError_t status = ready ? hipSuccess : hipErrorNotReady;
command->release();
HIP_RETURN(status);
}