From f5f0a6c618839deb660f378d1ff4ef0f6d5ccbc6 Mon Sep 17 00:00:00 2001 From: German Date: Fri, 21 Oct 2022 17:49:08 -0400 Subject: [PATCH] SWDEV-352487 - Don't add notifications as the last command Change-Id: Ifed34485839ef2c9491e8e8f6bb3569932160b1c [ROCm/clr commit: e223b0f678e49dad447faac8a3414dd16ef82d90] --- projects/clr/rocclr/platform/commandqueue.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/projects/clr/rocclr/platform/commandqueue.cpp b/projects/clr/rocclr/platform/commandqueue.cpp index 9ecd870e19..8eddcfa72f 100644 --- a/projects/clr/rocclr/platform/commandqueue.cpp +++ b/projects/clr/rocclr/platform/commandqueue.cpp @@ -113,7 +113,7 @@ void HostQueue::finish() { Command* command = nullptr; if (IS_HIP) { command = getLastQueuedCommand(true); - if (AMD_DIRECT_DISPATCH && command == nullptr) { + if (command == nullptr) { return; } } @@ -233,9 +233,12 @@ void HostQueue::append(Command& command) { } // Set last submitted command - Command* prevLastEnqueueCommand; - command.retain(); - { + Command* prevLastEnqueueCommand = nullptr; + + // Attach only real commands and skip internal notifications for CPU queue + if (command.waitingEvent() == nullptr) { + command.retain(); + // lastCmdLock_ ensures that lastEnqueueCommand() can retain the command before it is swapped // out. We want to keep this critical section as short as possible, so the command should be // released outside this section.