From 4870c8d7b79d9ee0cf7688234ff93aae67446180 Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 21 Oct 2015 17:35:18 -0400
Subject: [PATCH] P4 to Git Change 1202323 by xcui@merged_opencl_jxcwin on
2015/10/21 17:01:58
SWDEV-79347 - added a env variable to change the size of the minimum system memory requirement to avoid downgrade OCL support. The default is 2, which means 2GB
code review:
http://ocltc.amd.com/reviews/r/8754/
precheckin:
http://ocltc.amd.com:8111/viewModification.html?modId=60516&personal=true&buildTypeId=&tab=vcsModificationBuilds&show_all_builds=true
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpudevice.cpp#278 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#532 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#243 edit
[ROCm/clr commit: 0bb91b89ba20c84b32d6b054cdefa8f12df3d3e3]
---
projects/clr/rocclr/runtime/device/cpu/cpudevice.cpp | 3 ++-
projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp | 2 +-
projects/clr/rocclr/runtime/utils/flags.hpp | 2 ++
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/projects/clr/rocclr/runtime/device/cpu/cpudevice.cpp b/projects/clr/rocclr/runtime/device/cpu/cpudevice.cpp
index 5fd20143b7..4ac3b0fad8 100644
--- a/projects/clr/rocclr/runtime/device/cpu/cpudevice.cpp
+++ b/projects/clr/rocclr/runtime/device/cpu/cpudevice.cpp
@@ -5,6 +5,7 @@
#include "device/cpu/cpudevice.hpp"
#include "device/cpu/cpuprogram.hpp"
#include "utils/versions.hpp"
+#include "utils/flags.hpp"
#include "amdocl/cl_common.hpp"
@@ -236,7 +237,7 @@ Device::init()
(uintptr_t) std::min(statex.ullTotalPageFile, statex.ullTotalVirtual);
#endif
//disable CPU device if system memory is equal to or less than 2GB
- if (info.globalMemSize_ <= 2 * Gi) {
+ if (info.globalMemSize_ <= OCL_SYSMEM_REQUIREMENT * Gi) {
return true;
}
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
index 134db00f65..29eeb46b99 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
@@ -763,7 +763,7 @@ Device::create(CALuint ordinal, CALuint numOfDevices)
appProfile_.init();
bool smallMemSystem = false;
- if (amd::Os::hostTotalPhysicalMemory() < 2 * Gi) {
+ if (amd::Os::hostTotalPhysicalMemory() < OCL_SYSMEM_REQUIREMENT * Gi) {
smallMemSystem = true;
}
diff --git a/projects/clr/rocclr/runtime/utils/flags.hpp b/projects/clr/rocclr/runtime/utils/flags.hpp
index 3e4db8c522..a9838d127f 100644
--- a/projects/clr/rocclr/runtime/utils/flags.hpp
+++ b/projects/clr/rocclr/runtime/utils/flags.hpp
@@ -166,6 +166,8 @@ release(int, AMD_GPU_FORCE_SINGLE_FP_DENORM, -1, \
"Force denorm for single precision: -1 - don't force, 0 - disable, 1 - enable") \
debug(bool, OCL_FORCE_CPU_SVM, false, \
"force svm support for CPU") \
+debug(uint, OCL_SYSMEM_REQUIREMENT, 2, \
+ "Use flag to change the minimum requirement of system memory not to downgrade") \
debug(bool, GPU_ENABLE_HW_DEBUG, false, \
"Enable HW DEBUG for GPU") \
release(uint, GPU_WAVES_PER_SIMD, 0, \