From 0e4baf14ed1652761deb6fc0c762ead4eca5055e Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 15 May 2019 12:17:35 -0400
Subject: [PATCH] P4 to Git Change 1783299 by cpaquot@cpaquot-ocl-lc-lnx on
2019/05/15 11:56:14
SWDEV-189541 - [HIP] Increase SVM size to 64Gb for HIP.
Introducing HIP_SET_SVM_SIZE to set SVM size specifically for HIP.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#135 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#307 edit
[ROCm/clr commit: 38a5fe9b0a468c4853c07588b07b906215a3dfa6]
---
projects/clr/rocclr/runtime/device/pal/paldevice.cpp | 9 +++++++++
projects/clr/rocclr/runtime/utils/flags.hpp | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/projects/clr/rocclr/runtime/device/pal/paldevice.cpp b/projects/clr/rocclr/runtime/device/pal/paldevice.cpp
index 0faec34786..12b4cc47fe 100644
--- a/projects/clr/rocclr/runtime/device/pal/paldevice.cpp
+++ b/projects/clr/rocclr/runtime/device/pal/paldevice.cpp
@@ -1294,6 +1294,15 @@ bool Device::init() {
info.pSettingsPath = "OCL";
info.maxSvmSize = static_cast(OCL_SET_SVM_SIZE * Mi);
+ if (IS_LINUX) {
+ //! @note: Linux may have a deadlock if runtime will attempt to reserve
+ //! VA range, which is much bigger than sysmem size
+ size_t maxVirtualReserve = amd::Os::getPhysicalMemSize() << 1;
+ if (info.maxSvmSize > maxVirtualReserve) {
+ info.maxSvmSize = maxVirtualReserve;
+ }
+ }
+
// PAL init
if (Pal::Result::Success != Pal::CreatePlatform(info, platformObj_, &platform_)) {
return false;
diff --git a/projects/clr/rocclr/runtime/utils/flags.hpp b/projects/clr/rocclr/runtime/utils/flags.hpp
index ec357bd826..1c48880088 100644
--- a/projects/clr/rocclr/runtime/utils/flags.hpp
+++ b/projects/clr/rocclr/runtime/utils/flags.hpp
@@ -129,7 +129,7 @@ release(bool, DISABLE_DEFERRED_ALLOC, false, \
"Disables deferred memory allocation on device") \
release(int, AMD_GPU_FORCE_SINGLE_FP_DENORM, -1, \
"Force denorm for single precision: -1 - don't force, 0 - disable, 1 - enable") \
-release(uint, OCL_SET_SVM_SIZE, 16384, \
+release(uint, OCL_SET_SVM_SIZE, 4*16384, \
"set SVM space size for discrete GPU") \
debug(uint, OCL_SYSMEM_REQUIREMENT, 2, \
"Use flag to change the minimum requirement of system memory not to downgrade") \