diff --git a/projects/clr/rocclr/runtime/device/pal/paldevice.cpp b/projects/clr/rocclr/runtime/device/pal/paldevice.cpp index 3011c60b74..59721a9923 100644 --- a/projects/clr/rocclr/runtime/device/pal/paldevice.cpp +++ b/projects/clr/rocclr/runtime/device/pal/paldevice.cpp @@ -1511,7 +1511,8 @@ pal::Memory* Device::createBuffer(amd::Memory& owner, bool directAccess) const { (settings().remoteAlloc_)) { // Allocate remote memory if AHP allocation and context has just 1 device if ((owner.getMemFlags() & CL_MEM_ALLOC_HOST_PTR) && - (owner.getContext().devices().size() == 1)) { + (owner.getContext().devices().size() == 1) && + (owner.getSize() < static_cast(GPU_MAX_USWC_ALLOC_SIZE) * Mi)) { if (owner.getMemFlags() & (CL_MEM_READ_ONLY | CL_MEM_HOST_WRITE_ONLY | CL_MEM_HOST_NO_ACCESS)) { // GPU will be reading from this host memory buffer, diff --git a/projects/clr/rocclr/runtime/utils/flags.hpp b/projects/clr/rocclr/runtime/utils/flags.hpp index 14699238a5..339e31845f 100644 --- a/projects/clr/rocclr/runtime/utils/flags.hpp +++ b/projects/clr/rocclr/runtime/utils/flags.hpp @@ -183,6 +183,9 @@ release(bool, GPU_ENABLE_WGP_MODE, true, \ "Enables WGP Mode in HW if available") \ release(bool, OCL_DUMP_CODE_OBJECT, false, \ "Enable dump code object") \ +release(uint, GPU_MAX_USWC_ALLOC_SIZE, 2048, \ + "Set a limit in Mb on the maximum USWC allocation size" \ + "-1 = No limit") namespace amd {