From f33637b1c65b25bb5d6ca94b3d03ee2532eee517 Mon Sep 17 00:00:00 2001 From: taosang2 Date: Fri, 19 Jul 2024 13:12:07 -0400 Subject: [PATCH] =?UTF-8?q?SWDEV-474091=20=E2=80=93=20Fix=20sporadic=20cra?= =?UTF-8?q?sh=20in=20streamcallback=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also in the scope of SWDEV-467540. Fix sporadic crash in Unit_hipStreamAddCallback_MultipleThreads by deferring release() of block_command. The test will invoke 1000 threads on the same stream thus there is a chance to free block_command too early in original code. By deferring release() of block_command we can make sure block_command is always valid during calling block_command->notifyCmdQueue(). Change-Id: I31555ee18e6958e34b89f04181867fa4e932a38c [ROCm/clr commit: e3ef19e22a980b00e525400bcd6a9500b5840ca0] --- projects/clr/hipamd/src/hip_stream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/clr/hipamd/src/hip_stream.cpp b/projects/clr/hipamd/src/hip_stream.cpp index 7152ed1ba2..afa526b7d6 100644 --- a/projects/clr/hipamd/src/hip_stream.cpp +++ b/projects/clr/hipamd/src/hip_stream.cpp @@ -581,13 +581,13 @@ hipError_t streamCallback_common(hipStream_t stream, StreamCallback* cbo, void* return hipErrorInvalidValue; } block_command->enqueue(); - block_command->release(); // Release the callback marker command->release(); // Notify the command queue about a possible waiter for the calback block_command->notifyCmdQueue(); + block_command->release(); return hipSuccess; }