From 66f34b4c466a3bfae9c4908b0fd4a7802a30da0b Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 16 Oct 2014 23:25:14 -0400
Subject: [PATCH] P4 to Git Change 1088461 by bdhanase@bala_workpc_ocl on
2014/10/16 23:15:14
EPR #405824 - On apus, if we run out of local memory to allocate cl_mem objects, ocl runtime will use remote (system) memory. Update maxMemAllocSize_ to include that.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#469 edit
[ROCm/clr commit: 1dfb720281fae3457be88eba2b50640c937eebaf]
---
projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
index 004fc66b58..0d1ed2061e 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
@@ -529,7 +529,14 @@ void Device::fillDeviceInfo(
info_.maxMemAllocSize_ = std::max(
cl_ulong(calStatus.largestBlockVisibleHeap * Mi),
cl_ulong(calStatus.largestBlockInvisibleHeap * Mi));
-
+
+#if defined(ATI_OS_WIN)
+ if (settings().apuSystem_) {
+ info_.maxMemAllocSize_ = std::max(
+ ((static_cast(calAttr.uncachedRemoteRAM) * Mi) / 2),
+ info_.maxMemAllocSize_);
+ }
+#endif
info_.maxMemAllocSize_ = cl_ulong(info_.maxMemAllocSize_ *
std::min(GPU_MAX_ALLOC_PERCENT, 100u) / 100u);