From c1cd5b9e43921fee4a2199c4e336a4117467b392 Mon Sep 17 00:00:00 2001
From: foreman
Date: Mon, 29 Apr 2019 14:30:36 -0400
Subject: [PATCH] P4 to Git Change 1776019 by gandryey@gera-w8 on 2019/04/29
14:13:29
SWDEV-79445 - OCL generic changes and code clean-up
- Remove GPU_DEVICE_NAME support
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#605 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#131 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#125 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#305 edit
[ROCm/clr commit: 5f99d6ed66cce3718ef73c32576b698c806bce11]
---
projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp | 8 ++------
projects/clr/rocclr/runtime/device/pal/paldevice.cpp | 9 ++-------
projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp | 7 ++-----
projects/clr/rocclr/runtime/utils/flags.hpp | 2 --
4 files changed, 6 insertions(+), 20 deletions(-)
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
index 6371399403..b44312fad9 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
@@ -1216,25 +1216,21 @@ bool Device::init() {
// Count up all the devices in the system.
numDevices = gsAdaptor::enumerateAdaptors();
- CALuint ordinal = 0;
const char* selectDeviceByName = NULL;
if (!flagIsDefault(GPU_DEVICE_ORDINAL)) {
useDeviceList = true;
parseRequestedDeviceList(requestedDevices);
- } else if (!flagIsDefault(GPU_DEVICE_NAME)) {
- selectDeviceByName = GPU_DEVICE_NAME;
}
// Loop through all active devices and initialize the device info structure
- for (; ordinal < numDevices; ++ordinal) {
+ for (CALuint ordinal = 0; ordinal < numDevices; ++ordinal) {
// Create the GPU device object
Device* d = new Device();
bool result = (NULL != d) && d->create(ordinal, numDevices);
if (useDeviceList) {
result &= (requestedDevices.find(ordinal) != requestedDevices.end());
}
- if (result && ((NULL == selectDeviceByName) || ('\0' == selectDeviceByName[0]) ||
- (strstr(selectDeviceByName, d->info().name_) != NULL))) {
+ if (result) {
d->registerDevice();
} else {
delete d;
diff --git a/projects/clr/rocclr/runtime/device/pal/paldevice.cpp b/projects/clr/rocclr/runtime/device/pal/paldevice.cpp
index 3e7ce6d78f..e273cbef3f 100644
--- a/projects/clr/rocclr/runtime/device/pal/paldevice.cpp
+++ b/projects/clr/rocclr/runtime/device/pal/paldevice.cpp
@@ -1310,8 +1310,6 @@ bool Device::init() {
// Count up all the devices in the system.
platform_->EnumerateDevices(&gNumDevices, &gDeviceList[0]);
- uint ordinal = 0;
- const char* selectDeviceByName = nullptr;
const char* requestedDeviceList = amd::IS_HIP ? ((HIP_VISIBLE_DEVICES[0] != '\0') ?
HIP_VISIBLE_DEVICES : CUDA_VISIBLE_DEVICES)
: GPU_DEVICE_ORDINAL;
@@ -1319,14 +1317,12 @@ bool Device::init() {
if (requestedDeviceList[0] != '\0') {
useDeviceList = true;
parseRequestedDeviceList(requestedDeviceList, requestedDevices, gNumDevices);
- } else if (GPU_DEVICE_NAME[0] != '\0') {
- selectDeviceByName = GPU_DEVICE_NAME;
}
bool foundDevice = false;
// Loop through all active devices and initialize the device info structure
- for (; ordinal < gNumDevices; ++ordinal) {
+ for (uint ordinal = 0; ordinal < gNumDevices; ++ordinal) {
bool result = true;
if (useDeviceList) {
result = (requestedDevices.find(ordinal) != requestedDevices.end());
@@ -1335,8 +1331,7 @@ bool Device::init() {
Device* d = new Device();
result = result && (nullptr != d) && d->create(gDeviceList[ordinal]);
- if (result && ((nullptr == selectDeviceByName) || ('\0' == selectDeviceByName[0]) ||
- (strstr(selectDeviceByName, d->info().name_) != nullptr))) {
+ if (result) {
foundDevice = true;
d->registerDevice();
} else {
diff --git a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
index f31e9cdc7e..1f4d0081e7 100644
--- a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
+++ b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
@@ -560,11 +560,8 @@ bool Device::init() {
}
}
- if (!useDeviceList && (flagIsDefault(GPU_DEVICE_NAME) || GPU_DEVICE_NAME == 0
- || GPU_DEVICE_NAME[0] == '\0' || !strcmp(GPU_DEVICE_NAME, roc_device->info_.name_))) {
- roc_device.release()->registerDevice();
- } else if (useDeviceList && selectedDevices[ordinal++]) {
- roc_device.release()->registerDevice();
+ if (!useDeviceList || selectedDevices[ordinal++]) {
+ roc_device.release()->registerDevice();
}
}
diff --git a/projects/clr/rocclr/runtime/utils/flags.hpp b/projects/clr/rocclr/runtime/utils/flags.hpp
index fcae43d04f..f346f07985 100644
--- a/projects/clr/rocclr/runtime/utils/flags.hpp
+++ b/projects/clr/rocclr/runtime/utils/flags.hpp
@@ -38,8 +38,6 @@ debug(size_t, PARAMETERS_MIN_ALIGNMENT, 16, \
"Minimum alignment required for the abstract parameters stack") \
debug(size_t, MEMOBJ_BASE_ADDR_ALIGN, 4*Ki, \
"Alignment of the base address of any allocate memory object") \
-release(cstring, GPU_DEVICE_NAME, "", \
- "Select the device ordinal (will only report a single device)") \
release(cstring, GPU_DEVICE_ORDINAL, "", \
"Select the device ordinal (comma seperated list of available devices)") \
release(bool, REMOTE_ALLOC, false, \