Skip to content

Commit

Permalink
SWDEV-438181 - check stream associated with event
Browse files Browse the repository at this point in the history
...before we dereference it. It might have been deleted.

Change-Id: Ief832ee0907658a40ca42b9d78d19658153a05dd
  • Loading branch information
cjatin authored and mangupta committed Dec 22, 2023
1 parent d62f6a1 commit a75072c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion hipamd/src/hip_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,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,
Expand Down

0 comments on commit a75072c

Please sign in to comment.