From 083efcd692c8dbc85813cb7c79a42fb76e9bec13 Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 28 Sep 2017 13:03:15 -0400
Subject: [PATCH] P4 to Git Change 1464512 by gandryey@gera-w8 on 2017/09/28
12:57:40
SWDEV-133851 - [CQE OCL][1.2][LNX-PRO] A subtest from OCLcompiler is failing due to faulty cl#1458879
- If pinning failed and allocation was forced to system memory, then copy the original data
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#577 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#64 edit
[ROCm/clr commit: af98be0351495521d5c14490762a76c955ecf145]
---
projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp | 3 ++-
projects/clr/rocclr/runtime/device/pal/paldevice.cpp | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
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,