SWDEV-360031 - Erase destroyed stream from capture

Parallel streams can be destroyed during capture. Make sure runtime
removes the destoryed streams from the list of parallel captured streams

Change-Id: I46b6cbb951e8711f0bf02f2826c3b890b2541ffe


[ROCm/clr commit: 38ad6234f9]
Šī revīzija ir iekļauta:
German Andryeyev committed 2023-01-03 13:34:07 -05:00
1 vecāks 47167d7e7a
revīzija d8f1606489
4 files changed
+29 -6

No files matched your search

+9 -1
Parādīt failu
@@ -53,6 +53,7 @@ Stream::~Stream() {
}
}
// ================================================================================================
hipError_t Stream::EndCapture() {
for (auto event : captureEvents_) {
hip::Event* e = reinterpret_cast<hip::Event*>(event);
@@ -73,6 +74,7 @@ hipError_t Stream::EndCapture() {
return hipSuccess;
}
// ================================================================================================
bool Stream::Create() {
amd::CommandQueue::Priority p;
@@ -468,7 +470,12 @@ hipError_t hipStreamDestroy(hipStream_t stream) {
HIP_RETURN(hipErrorContextIsDestroyed);
}
hip::Stream* s = reinterpret_cast<hip::Stream*>(stream);
if (s->GetCaptureStatus() != hipStreamCaptureStatusNone) {
if (s->GetParentStream() != nullptr) {
reinterpret_cast<hip::Stream*>(s->GetParentStream())->EraseParallelCaptureStream(stream);
}
auto error = s->EndCapture();
}
s->GetDevice()->RemoveStreamFromPools(s);
amd::ScopedLock lock(g_captureStreamsLock);
@@ -486,6 +493,7 @@ hipError_t hipStreamDestroy(hipStream_t stream) {
HIP_RETURN(hipSuccess);
}
// ================================================================================================
void WaitThenDecrementSignal(hipStream_t stream, hipError_t status, void* user_data) {
CallbackData* data = reinterpret_cast<CallbackData*>(user_data);
int offset = data->previous_read_index % IPC_SIGNALS_PER_EVENT;