From c18892a590d25b805bf307d6bcc478938e29d691 Mon Sep 17 00:00:00 2001 From: German Andryeyev Date: Fri, 19 Jun 2020 13:49:43 -0400 Subject: [PATCH] Remove extra barriers Don't flush current batch if the dependent wait is a nop Change-Id: I8a8722b9011fe042c1a4ce195938290fc75e7c86 --- rocclr/platform/commandqueue.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rocclr/platform/commandqueue.cpp b/rocclr/platform/commandqueue.cpp index 4ab1a2de69..a1e96023df 100644 --- a/rocclr/platform/commandqueue.cpp +++ b/rocclr/platform/commandqueue.cpp @@ -140,9 +140,12 @@ void HostQueue::loop(device::VirtualDevice* virtualDevice) { for (const auto& it : events) { // Only wait if the command is enqueued into another queue. if (it->command().queue() != this) { - virtualDevice->flush(head, true); - tail = head = NULL; - dependencyFailed |= !it->awaitCompletion(); + // Runtime has to flush the current batch only if the dependent wait is blocking + if (it->command().status() != CL_COMPLETE) { + virtualDevice->flush(head, true); + tail = head = NULL; + dependencyFailed |= !it->awaitCompletion(); + } } }