diff --git a/rocclr/runtime/device/gpu/gpumemory.cpp b/rocclr/runtime/device/gpu/gpumemory.cpp index 5f77777391..e9a4590329 100644 --- a/rocclr/runtime/device/gpu/gpumemory.cpp +++ b/rocclr/runtime/device/gpu/gpumemory.cpp @@ -210,11 +210,14 @@ Memory::create( reinterpret_cast(params); // Check if parent was allocated in system memory if ((view->resource_->memoryType() == Resource::Pinned) || - // @todo Enable unconditional optimization for remote memory (((view->resource_->memoryType() == Resource::Remote) || (view->resource_->memoryType() == Resource::RemoteUSWC)) && + // @todo Enable unconditional optimization for remote memory + // Check for external allocation, to avoid the optimization + // for non-VM (double copy) mode (owner() != NULL) && - (owner()->getMemFlags() & CL_MEM_ALLOC_HOST_PTR))) { + ((owner()->getMemFlags() & CL_MEM_ALLOC_HOST_PTR) || + dev().settings().remoteAlloc_))) { // Marks memory object for direct GPU access to the host memory flags_ |= HostMemoryDirectAccess; }