From 39d9b2c81fdc377492b04f406aee5874a862011d Mon Sep 17 00:00:00 2001 From: foreman Date: Tue, 12 Sep 2017 14:42:44 -0400 Subject: [PATCH] P4 to Git Change 1457957 by asalmanp@asalmanp-ocl-stg on 2017/09/12 14:27:56 SWDEV-79278 - [OCL] Dont add gfx804 device into the offline device list twice. ReviewBoardURL = http://ocltc.amd.com/reviews/r/13432/ Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#573 edit [ROCm/clr commit: 7efd5f7f984fc421b3cfc620f60047d8c6e2b23b] --- .../rocclr/runtime/device/gpu/gpudevice.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp index e33ae73aea..5baa2bca91 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp +++ b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp @@ -73,6 +73,7 @@ bool NullDevice::init() { // Loop through all supported devices and create each of them for (uint id = CAL_TARGET_TAHITI; id <= CAL_TARGET_LAST; ++id) { bool foundActive = false; + bool foundDuplicate = false; if (gpu::DeviceInfo[id].targetName_[0] == '\0') { continue; @@ -91,6 +92,24 @@ bool NullDevice::init() { continue; } + // Loop through all previous devices in the DeviceInfo list and compare them with the + // current entry to see if the current entry was listed previously in the DeviceInfo, + // if so, then it means the current entry already has been added in the offline device list + for (uint j = 0; j < id; ++j) { + if (gpu::DeviceInfo[j].targetName_[0] == '\0') { + continue; + } + if (strcmp(gpu::DeviceInfo[j].targetName_, gpu::DeviceInfo[id].targetName_) == 0) { + foundDuplicate = true; + break; + } + } + + // Don't report an offline device twice + if (foundDuplicate) { + continue; + } + NullDevice* dev = new NullDevice(); if (NULL != dev) { if (!dev->create(static_cast(id))) {