From f34c1b9ff845b0689f819eb113191416e3655983 Mon Sep 17 00:00:00 2001 From: German Andryeyev Date: Fri, 9 Jul 2021 18:19:44 -0400 Subject: [PATCH] SWDEV-292820 - Add a new notify lock HSA signal calback may occur during the actual marker submit. That may cause a deadlock, because shared lock_ object. Create the new notify_lock_ field to protect the notification. Change-Id: I9752af84e59895530620fac3932c6fc276de8658 --- rocclr/platform/command.cpp | 2 +- rocclr/platform/command.hpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/rocclr/platform/command.cpp b/rocclr/platform/command.cpp index 9cc8b4cce9..4c53d55c52 100644 --- a/rocclr/platform/command.cpp +++ b/rocclr/platform/command.cpp @@ -265,7 +265,7 @@ bool Event::awaitCompletion() { bool Event::notifyCmdQueue() { HostQueue* queue = command().queue(); if (AMD_DIRECT_DISPATCH) { - ScopedLock l(lock_); + ScopedLock l(notify_lock_); if ((status() > CL_COMPLETE) && (nullptr != queue) && // If HW event was assigned, then notification can be ignored, since a barrier was issued (HwEvent() == nullptr) && diff --git a/rocclr/platform/command.hpp b/rocclr/platform/command.hpp index 487b7a98db..36e71360a7 100644 --- a/rocclr/platform/command.hpp +++ b/rocclr/platform/command.hpp @@ -89,6 +89,7 @@ class Event : public RuntimeObject { private: Monitor lock_; + Monitor notify_lock_; //!< Lock used for notification with direct dispatch only std::atomic callbacks_; //!< linked list of callback entries. std::atomic status_; //!< current execution status.