From 808b68ab63e153b97ad527cd0a303a7dc3bfb431 Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 27 Oct 2017 16:31:04 -0400
Subject: [PATCH] P4 to Git Change 1475895 by gandryey@gera-w8 on 2017/10/27
16:20:31
SWDEV-79445 - Don't enable HostMemoryDirectAccess flag for persistent memory
- Update Memory::allocMapTarget() method
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.cpp#28 edit
[ROCm/clr commit: 3839a2fe8c8715e05dc139e99502c56b2a6f384a]
---
projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp b/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp
index c464ce391e..29fdb72ae2 100644
--- a/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp
+++ b/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp
@@ -93,7 +93,8 @@ void* Memory::allocMapTarget(const amd::Coord3D& origin, const amd::Coord3D& reg
incIndMapCount();
// If the device backing storage is direct accessible, use it.
- if (isHostMemDirectAccess()) {
+ const cl_mem_flags memFlags = owner()->getMemFlags();
+ if (isHostMemDirectAccess() || (memFlags & CL_MEM_USE_PERSISTENT_MEM_AMD))
if (owner()->getHostMem() != nullptr) {
return (static_cast(owner()->getHostMem()) + origin[0]);
}
@@ -1031,8 +1032,7 @@ void* Image::allocMapTarget(const amd::Coord3D& origin, const amd::Coord3D& regi
size_t elementSize = image->getImageFormat().getElementSize();
size_t offset = origin[0] * elementSize;
- const cl_mem_flags memFlags = owner()->getMemFlags();
- if ((pHostMem == nullptr) || (memFlags & CL_MEM_USE_PERSISTENT_MEM_AMD)) {
+ if (pHostMem == nullptr) {
if (indirectMapCount_ == 1) {
if (!allocateMapMemory(owner()->getSize())) {
decIndMapCount();