SWDEV-438181 - check stream associated with event

...before we dereference it. It might have been deleted.

Change-Id: Ief832ee0907658a40ca42b9d78d19658153a05dd
This commit is contained in:
Jatin Chaudhary
2023-12-20 01:28:00 +00:00
committato da Rakesh Roy
parent c5ab5680b4
commit 2cfb8bc3c1
+8 -1
Vedi File
@@ -534,8 +534,15 @@ hipError_t hipStreamWaitEvent_common(hipStream_t stream, hipEvent_t event, unsig
}
hip::Stream* waitStream = reinterpret_cast<hip::Stream*>(stream);
hip::Event* e = reinterpret_cast<hip::Event*>(event);
hip::Stream* eventStream = reinterpret_cast<hip::Stream*>(e->GetCaptureStream());
auto eventStreamHandle = reinterpret_cast<hipStream_t>(e->GetCaptureStream());
// the stream associated with the device might have been destroyed
if (!hip::isValid(eventStreamHandle)) {
// Stream associated with the event has been released
// meaning the event has been completed and we can resume the current stream
return hipSuccess;
}
hip::Stream* eventStream = reinterpret_cast<hip::Stream*>(eventStreamHandle);
if (eventStream != nullptr && eventStream->IsEventCaptured(event) == true) {
ClPrint(amd::LOG_INFO, amd::LOG_API,
"[hipGraph] Current capture node StreamWaitEvent on stream : %p, Event %p", stream,