From 3f4e9566b751da7ad2fb409e8b6e0df1d4318347 Mon Sep 17 00:00:00 2001 From: foreman Date: Mon, 2 Apr 2018 11:17:14 -0400 Subject: [PATCH] P4 to Git Change 1535437 by asalmanp@asalmanp-ocl-stg on 2018/04/02 10:42:28 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SWDEV-79278 - [OCL][PAL] don’t report gfx902/gfx903 into the offline device list twice. Both Raven and Raven2 are exposed as gfx902/gfx903, so we ended up reporting each gfx902 and gfx903 twice for the offline devices list. To avoid this issue, check the list and if a device is already reported don’t add it into the list. http://ocltc.amd.com/reviews/r/14523/ Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#78 edit --- rocclr/runtime/device/pal/paldevice.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/rocclr/runtime/device/pal/paldevice.cpp b/rocclr/runtime/device/pal/paldevice.cpp index 419a455952..b7234df983 100644 --- a/rocclr/runtime/device/pal/paldevice.cpp +++ b/rocclr/runtime/device/pal/paldevice.cpp @@ -109,6 +109,7 @@ bool NullDevice::init() { for (uint id = 0; id < sizeof(Gfx9PlusSubDeviceInfo)/sizeof(AMDDeviceInfo); ++id) { bool foundActive = false; + bool foundDuplicate = false; uint gfxipVersion = pal::Gfx9PlusSubDeviceInfo[id].gfxipVersion_; if (pal::Gfx9PlusSubDeviceInfo[id].targetName_[0] == '\0') { @@ -132,6 +133,26 @@ bool NullDevice::init() { continue; } + // Loop through all previous devices in the Gfx9PlusSubDeviceInfo list + // and compare them with the current entry to see if the current entry + // was listed previously in the Gfx9PlusSubDeviceInfo, 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 (pal::Gfx9PlusSubDeviceInfo[j].targetName_[0] == '\0') { + continue; + } + if (strcmp(pal::Gfx9PlusSubDeviceInfo[j].targetName_, + pal::Gfx9PlusSubDeviceInfo[id].targetName_) == 0) { + foundDuplicate = true; + break; + } + } + + // Don't report an offline device twice + if (foundDuplicate) { + continue; + } + Pal::GfxIpLevel ipLevel = Pal::GfxIpLevel::_None; uint ipLevelMajor = round(pal::Gfx9PlusSubDeviceInfo[id].gfxipVersion_ / 100); switch (ipLevelMajor) {