diff --git a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp index 6919f7701c..0f33f541c2 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp +++ b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp @@ -1436,7 +1436,8 @@ gpu::Memory* Device::createBuffer(amd::Memory& owner, bool directAccess) const { void* address = gpuMemory->map(NULL); if (address != NULL) { // Copy saved memory - if (owner.getMemFlags() & CL_MEM_COPY_HOST_PTR) { + // Note: UHP is an optional check if pinning failed and sysmem alloc was forced + if (owner.getMemFlags() & (CL_MEM_COPY_HOST_PTR | CL_MEM_USE_HOST_PTR)) { memcpy(address, owner.getHostMem(), owner.getSize()); } // It should be safe to change the host memory pointer, diff --git a/projects/clr/rocclr/runtime/device/pal/paldevice.cpp b/projects/clr/rocclr/runtime/device/pal/paldevice.cpp index 2e448255d9..c31408cd15 100644 --- a/projects/clr/rocclr/runtime/device/pal/paldevice.cpp +++ b/projects/clr/rocclr/runtime/device/pal/paldevice.cpp @@ -1342,7 +1342,8 @@ pal::Memory* Device::createBuffer(amd::Memory& owner, bool directAccess) const { void* address = gpuMemory->map(nullptr); if (address != nullptr) { // Copy saved memory - if (owner.getMemFlags() & CL_MEM_COPY_HOST_PTR) { + // Note: UHP is an optional check if pinning failed and sysmem alloc was forced + if (owner.getMemFlags() & (CL_MEM_COPY_HOST_PTR | CL_MEM_USE_HOST_PTR)) { memcpy(address, owner.getHostMem(), owner.getSize()); } // It should be safe to change the host memory pointer,