From 3faf36fb259429a4f4f0da7dcf0e44f9f631c32f Mon Sep 17 00:00:00 2001 From: Ioannis Assiouras <38722728+iassiour@users.noreply.github.com> Date: Mon, 8 Dec 2025 12:30:23 +0000 Subject: [PATCH] Fix Unit_hipStreamBeginCaptureToGraph_CapturePartialInThreads (#2072) https://mlsejenkinsvm.amd.com/job/rocm-systems/job/hip/view/change-requests/job/PR-2072/6/ The last windowsCI has passed successfully --- projects/clr/hipamd/src/hip_event.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/clr/hipamd/src/hip_event.cpp b/projects/clr/hipamd/src/hip_event.cpp index 8b533712c8..3a97124899 100644 --- a/projects/clr/hipamd/src/hip_event.cpp +++ b/projects/clr/hipamd/src/hip_event.cpp @@ -396,6 +396,13 @@ hipError_t hipEventRecord_common(hipEvent_t event, hipStream_t stream, unsigned hip::Event* e = reinterpret_cast(event); hip::Stream* s = reinterpret_cast(stream); hip::Stream* hip_stream = hip::getStream(stream); + if (hipStream_t lastCaptureStream = e->GetCaptureStream()) { + if (hip::isValid(lastCaptureStream)) { + if ((lastCaptureStream != nullptr) && (lastCaptureStream != hipStreamLegacy)) { + reinterpret_cast(e->GetCaptureStream())->EraseCaptureEvent(event); + } + } + } e->SetCaptureStream(stream); if ((stream != nullptr && stream != hipStreamLegacy) && (s->GetCaptureStatus() == hipStreamCaptureStatusActive)) {