From fc6369dd3c759c487ed5f2fbbb242d07f98870df Mon Sep 17 00:00:00 2001
From: foreman
Date: Tue, 23 Sep 2014 13:13:57 -0400
Subject: [PATCH] P4 to Git Change 1079967 by bdhanase@bala_workpc_ocl on
2014/09/23 12:59:41
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.
Reviewed by: German
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#463 edit
[ROCm/clr commit: a16bef54821be62ec1bc3aef8703d90361955ce7]
---
projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
index afcfae562b..de63f18530 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
@@ -538,6 +538,12 @@ void Device::fillDeviceInfo(
cl_ulong(calStatus.largestBlockVisibleHeap * Mi),
cl_ulong(calStatus.largestBlockInvisibleHeap * Mi));
+ if (settings().apuSystem_) {
+ info_.maxMemAllocSize_ = std::max(
+ ((static_cast(calAttr.uncachedRemoteRAM) * Mi) / 2),
+ info_.maxMemAllocSize_);
+ }
+
info_.maxMemAllocSize_ = cl_ulong(info_.maxMemAllocSize_ *
std::min(GPU_MAX_ALLOC_PERCENT, 100u) / 100u);