From 8b359d4f5a58f93bcadf5cc1e16931eecc03095e Mon Sep 17 00:00:00 2001
From: foreman
Date: Tue, 20 Jan 2015 12:31:31 -0500
Subject: [PATCH] P4 to Git Change 1113301 by gandryey@gera-dev-w7 on
2015/01/20 12:25:37
ECR #304775 - Add remote alloc check for direct host access optimization.
- If runtime forces allocations into remote memory, then AHP check won't cover normal allocations.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpumemory.cpp#115 edit
---
rocclr/runtime/device/gpu/gpumemory.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
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;
}