diff --git a/opencl/source/command_queue/hardware_interface_xehp_and_later.inl b/opencl/source/command_queue/hardware_interface_xehp_and_later.inl index 8fa989d4d4..d7889c60db 100644 --- a/opencl/source/command_queue/hardware_interface_xehp_and_later.inl +++ b/opencl/source/command_queue/hardware_interface_xehp_and_later.inl @@ -104,7 +104,7 @@ inline void HardwareInterface::programWalker( if constexpr (heaplessModeEnabled) { auto &productHelper = rootDeviceEnvironment.getHelper(); - bool flushL3AfterPostSyncForHostUsm = kernelSystemAllocation; + bool flushL3AfterPostSyncForHostUsm = kernelSystemAllocation || kernel.isAnyKernelArgumentUsingZeroCopyMemory(); bool flushL3AfterPostSyncForExternalAllocation = kernel.isUsingSharedObjArgs(); if (debugManager.flags.DisableFlushL3ForHostUsm.get() && flushL3AfterPostSyncForHostUsm) { diff --git a/opencl/source/kernel/kernel.cpp b/opencl/source/kernel/kernel.cpp index 5f91a5b6a9..4eba8b2c92 100644 --- a/opencl/source/kernel/kernel.cpp +++ b/opencl/source/kernel/kernel.cpp @@ -1469,6 +1469,8 @@ cl_int Kernel::setArgBuffer(uint32_t argIndex, this->anyKernelArgumentUsingSystemMemory |= Kernel::graphicsAllocationTypeUseSystemMemory(gfxAllocationType); } + this->anyKernelArgumentUsingZeroCopyMemory |= buffer->isMemObjZeroCopy(); + if (buffer->peekSharingHandler()) { usingSharedObjArgs = true; } diff --git a/opencl/source/kernel/kernel.h b/opencl/source/kernel/kernel.h index 269f0f5e18..1eb25c9fb8 100644 --- a/opencl/source/kernel/kernel.h +++ b/opencl/source/kernel/kernel.h @@ -375,6 +375,10 @@ class Kernel : public ReferenceTrackedObject, NEO::NonCopyableAndNonMova return anyKernelArgumentUsingSystemMemory; } + bool isAnyKernelArgumentUsingZeroCopyMemory() const { + return anyKernelArgumentUsingZeroCopyMemory; + } + static bool graphicsAllocationTypeUseSystemMemory(AllocationType type); void setDestinationAllocationInSystemMemory(bool value) { isDestinationAllocationInSystemMemory = value; @@ -471,6 +475,7 @@ class Kernel : public ReferenceTrackedObject, NEO::NonCopyableAndNonMova bool isUnifiedMemorySyncRequired = true; bool kernelHasIndirectAccess = true; bool anyKernelArgumentUsingSystemMemory = false; + bool anyKernelArgumentUsingZeroCopyMemory = false; bool isDestinationAllocationInSystemMemory = false; };