From e2d2fad56cf931f4753fb12321348cdf49ff84c8 Mon Sep 17 00:00:00 2001 From: German Andryeyev Date: Thu, 22 Feb 2024 18:21:14 -0500 Subject: [PATCH] SWDEV-440746 - Fix a crash during RGP capture With multiple HIP streams it's possible to have a race condition when one thread stops the traces, but another still performs submisisons. That may cause a crash on the barrier callback. Change-Id: Ic56f8277fcfd2c2142a4821d927b938b9f313add --- rocclr/device/pal/palgpuopen.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rocclr/device/pal/palgpuopen.cpp b/rocclr/device/pal/palgpuopen.cpp index e5f7dd2eef..cfe876becc 100644 --- a/rocclr/device/pal/palgpuopen.cpp +++ b/rocclr/device/pal/palgpuopen.cpp @@ -874,7 +874,9 @@ void RgpCaptureMgr::WriteBarrierStartMarker(const VirtualGPU* gpu, RgpSqttMarkerBarrierStart marker = {}; marker.identifier = RgpSqttMarkerIdentifierBarrierStart; - marker.cbId = trace_.begin_queue_->queue(MainEngine).cmdBufId(); + if (trace_.begin_queue_ != nullptr) { + marker.cbId = trace_.begin_queue_->queue(MainEngine).cmdBufId(); + } marker.dword02 = data.reason; marker.internal = true; @@ -898,8 +900,9 @@ void RgpCaptureMgr::WriteBarrierEndMarker(const VirtualGPU* gpu, RgpSqttMarkerBarrierEnd marker = {}; marker.identifier = RgpSqttMarkerIdentifierBarrierEnd; - marker.cbId = trace_.begin_queue_->queue(MainEngine).cmdBufId(); - + if (trace_.begin_queue_ != nullptr) { + marker.cbId = trace_.begin_queue_->queue(MainEngine).cmdBufId(); + } marker.waitOnEopTs = operations.pipelineStalls.eopTsBottomOfPipe; marker.vsPartialFlush = operations.pipelineStalls.vsPartialFlush; marker.psPartialFlush = operations.pipelineStalls.psPartialFlush;