From d9c2aee52642f6bfeb7e23e0f28f46b77753f1ac Mon Sep 17 00:00:00 2001 From: Saleel Kudchadker Date: Mon, 25 Apr 2022 15:29:25 -0700 Subject: [PATCH] SWDEV-334152 - Set release as systemscope Set release scope as system for dispatch AQL when events are passed to hip*LaunchKernelGGL* Change-Id: I93b91591e0ab023f1ecc5247f7905eca26147358 [ROCm/clr commit: 02566677cf07c5cc90f04a460176e562470d213f] --- projects/clr/rocclr/device/rocm/rocvirtual.cpp | 15 ++++++++------- projects/clr/rocclr/platform/command.cpp | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/projects/clr/rocclr/device/rocm/rocvirtual.cpp b/projects/clr/rocclr/device/rocm/rocvirtual.cpp index 37c4f6f011..754c796673 100644 --- a/projects/clr/rocclr/device/rocm/rocvirtual.cpp +++ b/projects/clr/rocclr/device/rocm/rocvirtual.cpp @@ -1081,14 +1081,12 @@ VirtualGPU::VirtualGPU(Device& device, bool profiling, bool cooperative, dispatchPacketHeaderNoSync_ = (HSA_PACKET_TYPE_KERNEL_DISPATCH << HSA_PACKET_HEADER_TYPE) | (HSA_FENCE_SCOPE_AGENT << HSA_PACKET_HEADER_ACQUIRE_FENCE_SCOPE) | - (HSA_FENCE_SCOPE_AGENT << HSA_PACKET_HEADER_RELEASE_FENCE_SCOPE) | - (HSA_FENCE_SCOPE_NONE << HSA_PACKET_HEADER_RELEASE_FENCE_SCOPE); + (HSA_FENCE_SCOPE_AGENT << HSA_PACKET_HEADER_RELEASE_FENCE_SCOPE); dispatchPacketHeader_= (HSA_PACKET_TYPE_KERNEL_DISPATCH << HSA_PACKET_HEADER_TYPE) | (1 << HSA_PACKET_HEADER_BARRIER) | (HSA_FENCE_SCOPE_AGENT << HSA_PACKET_HEADER_ACQUIRE_FENCE_SCOPE) | - (HSA_FENCE_SCOPE_AGENT << HSA_PACKET_HEADER_RELEASE_FENCE_SCOPE) | - (HSA_FENCE_SCOPE_NONE << HSA_PACKET_HEADER_RELEASE_FENCE_SCOPE); + (HSA_FENCE_SCOPE_AGENT << HSA_PACKET_HEADER_RELEASE_FENCE_SCOPE); } else { dispatchPacketHeaderNoSync_ = (HSA_PACKET_TYPE_KERNEL_DISPATCH << HSA_PACKET_HEADER_TYPE) | @@ -2971,9 +2969,12 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes, const aqlHeaderWithOrder &= kAqlHeaderMask; } - if (addSystemScope_) { - aqlHeaderWithOrder &= ~(HSA_FENCE_SCOPE_AGENT << HSA_PACKET_HEADER_ACQUIRE_FENCE_SCOPE); - aqlHeaderWithOrder |= (HSA_FENCE_SCOPE_SYSTEM << HSA_PACKET_HEADER_ACQUIRE_FENCE_SCOPE); + if (addSystemScope_ || (vcmd != nullptr && + vcmd->getEventScope() == amd::Device::kCacheStateSystem)) { + aqlHeaderWithOrder &= ~(HSA_FENCE_SCOPE_AGENT << HSA_PACKET_HEADER_ACQUIRE_FENCE_SCOPE | + HSA_FENCE_SCOPE_AGENT << HSA_PACKET_HEADER_RELEASE_FENCE_SCOPE); + aqlHeaderWithOrder |= (HSA_FENCE_SCOPE_SYSTEM << HSA_PACKET_HEADER_ACQUIRE_FENCE_SCOPE | + HSA_FENCE_SCOPE_SYSTEM << HSA_PACKET_HEADER_RELEASE_FENCE_SCOPE); addSystemScope_ = false; } diff --git a/projects/clr/rocclr/platform/command.cpp b/projects/clr/rocclr/platform/command.cpp index e8b5970fec..3de326f185 100644 --- a/projects/clr/rocclr/platform/command.cpp +++ b/projects/clr/rocclr/platform/command.cpp @@ -432,6 +432,7 @@ NDRangeKernelCommand::NDRangeKernelCommand(HostQueue& queue, const EventWaitList profilingInfo_.clear(); profilingInfo_.callback_ = nullptr; profilingInfo_.marker_ts_ = true; + setEventScope(amd::Device::kCacheStateSystem); } kernel_.retain(); }