diff --git a/projects/clr/rocclr/runtime/device/pal/paldevice.cpp b/projects/clr/rocclr/runtime/device/pal/paldevice.cpp index 03750a6254..1d4a24d4b2 100644 --- a/projects/clr/rocclr/runtime/device/pal/paldevice.cpp +++ b/projects/clr/rocclr/runtime/device/pal/paldevice.cpp @@ -1228,6 +1228,12 @@ pal::Memory* Device::createBuffer(amd::Memory& owner, bool directAccess) const { ? Resource::Remote : Resource::Local; + // Check if runtime can force a tiny buffer into USWC memory + if ((size <= (GPU_MAX_REMOTE_MEM_SIZE * Ki)) && (type == Resource::Local) && + (owner.getMemFlags() & CL_MEM_READ_ONLY)) { + type = Resource::RemoteUSWC; + } + if (owner.getMemFlags() & CL_MEM_BUS_ADDRESSABLE_AMD) { type = Resource::BusAddressable; } else if (owner.getMemFlags() & CL_MEM_EXTERNAL_PHYSICAL_AMD) { diff --git a/projects/clr/rocclr/runtime/utils/flags.hpp b/projects/clr/rocclr/runtime/utils/flags.hpp index 88ba4b50aa..9d0858ecdb 100644 --- a/projects/clr/rocclr/runtime/utils/flags.hpp +++ b/projects/clr/rocclr/runtime/utils/flags.hpp @@ -187,6 +187,8 @@ release(bool, OCL_STUB_PROGRAMS, false, \ "1 = Enables OCL programs stubing") \ release(bool, GPU_ANALYZE_HANG, false, \ "1 = Enables GPU hang analysis") \ +release(uint, GPU_MAX_REMOTE_MEM_SIZE, 2, \ + "Maximum size (in Ki) that allows device memory substitution with system") \ release_on_stg(uint, GPU_WAVE_LIMIT_CU_PER_SH, 0, \ "Assume the number of CU per SH for wave limiter") \ release_on_stg(uint, GPU_WAVE_LIMIT_MAX_WAVE, 10, \