From 598c3f28210d8e438be31f4026a120ff997efe99 Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 7 Mar 2019 17:24:23 -0500
Subject: [PATCH] P4 to Git Change 1753099 by cpaquot@cpaquot-ocl-lc-lnx on
2019/03/07 16:43:54
SWDEV-145570 - [HIP] Change IS_HIP into a dynamic variable set by HIP layer
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_context.cpp#16 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#127 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palsettings.cpp#69 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.cpp#18 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#303 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/macros.hpp#11 edit
---
rocclr/runtime/device/pal/paldevice.cpp | 2 +-
rocclr/runtime/device/pal/palsettings.cpp | 2 +-
rocclr/runtime/utils/flags.cpp | 1 +
rocclr/runtime/utils/flags.hpp | 6 ++++--
rocclr/runtime/utils/macros.hpp | 7 -------
5 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/rocclr/runtime/device/pal/paldevice.cpp b/rocclr/runtime/device/pal/paldevice.cpp
index 0aac80f223..3d0ef1858d 100644
--- a/rocclr/runtime/device/pal/paldevice.cpp
+++ b/rocclr/runtime/device/pal/paldevice.cpp
@@ -1258,7 +1258,7 @@ bool Device::init() {
uint ordinal = 0;
const char* selectDeviceByName = nullptr;
- const char* requestedDeviceList = IS_HIP ? ((HIP_VISIBLE_DEVICES[0] != '\0') ?
+ const char* requestedDeviceList = amd::IS_HIP ? ((HIP_VISIBLE_DEVICES[0] != '\0') ?
HIP_VISIBLE_DEVICES : CUDA_VISIBLE_DEVICES)
: GPU_DEVICE_ORDINAL;
diff --git a/rocclr/runtime/device/pal/palsettings.cpp b/rocclr/runtime/device/pal/palsettings.cpp
index b2995a9c71..4fba0649b5 100644
--- a/rocclr/runtime/device/pal/palsettings.cpp
+++ b/rocclr/runtime/device/pal/palsettings.cpp
@@ -301,7 +301,7 @@ bool Settings::create(const Pal::DeviceProperties& palProp,
supportDepthsRGB_ = true;
}
if (use64BitPtr_) {
- if (IS_HIP || (GPU_ENABLE_LARGE_ALLOCATION && wscaps.workStationBoard)) {
+ if (amd::IS_HIP || (GPU_ENABLE_LARGE_ALLOCATION && wscaps.workStationBoard)) {
maxAllocSize_ = 64ULL * Gi;
} else {
maxAllocSize_ = 4048 * Mi;
diff --git a/rocclr/runtime/utils/flags.cpp b/rocclr/runtime/utils/flags.cpp
index d45ec6b5a3..adf20b3d5d 100644
--- a/rocclr/runtime/utils/flags.cpp
+++ b/rocclr/runtime/utils/flags.cpp
@@ -65,6 +65,7 @@ namespace amd {
#include
#endif // __APPLE__
+bool IS_HIP = false;
// static
char* Flag::envstr_;
diff --git a/rocclr/runtime/utils/flags.hpp b/rocclr/runtime/utils/flags.hpp
index 5ae928049c..e3da2e39aa 100644
--- a/rocclr/runtime/utils/flags.hpp
+++ b/rocclr/runtime/utils/flags.hpp
@@ -12,7 +12,7 @@ debug(int, LOG_LEVEL, 0, \
"The default log level") \
debug(uint, DEBUG_GPU_FLAGS, 0, \
"The debug options for GPU device") \
-release(uint, GPU_MAX_COMMAND_QUEUES, IF(IS_HIP, 300, 70), \
+release(uint, GPU_MAX_COMMAND_QUEUES, 300, \
"The maximum number of concurrent Virtual GPUs") \
release(size_t, CQ_THREAD_STACK_SIZE, 256*Ki, /* @todo: that much! */ \
"The default command queue thread stack size") \
@@ -131,7 +131,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, IF(IS_HIP, 4*16384, 4096), \
+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") \
@@ -184,6 +184,8 @@ release(bool, GPU_ENABLE_WGP_MODE, true, \
namespace amd {
+extern bool IS_HIP;
+
//! \addtogroup Utils
// @{
diff --git a/rocclr/runtime/utils/macros.hpp b/rocclr/runtime/utils/macros.hpp
index 30a549a45a..576e44c78d 100644
--- a/rocclr/runtime/utils/macros.hpp
+++ b/rocclr/runtime/utils/macros.hpp
@@ -107,10 +107,6 @@
#define NOT_LIGHTNING(x) x
#endif /* !WITH_LIGHTNING_COMPILER */
-#ifdef BUILD_HIP
-#define IS_HIP true
-#endif
-
#ifndef IS_LINUX
#define IS_LINUX false
#endif
@@ -123,9 +119,6 @@
#ifndef IS_LIGHTNING
#define IS_LIGHTNING false
#endif
-#ifndef IS_HIP
-#define IS_HIP false
-#endif
#define IF_LEFT_true(x) x
#define IF_LEFT_false(x)