From 1b21e4295b61178a6f0dce39d6f138fecb5077bf Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 23 Mar 2018 11:01:31 -0400
Subject: [PATCH] P4 to Git Change 1531403 by wchau@wchau_OCL_boltzmann on
2018/03/23 10:07:08
SWDEV-134107 - Add support for respecting target's xnack setting
- Port Konstantin's change of "Bring naming o par with the spec" in git (Change 139283)
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#85 edit
[ROCm/clr commit: 600247709167b413305f6ec10d0a5a25fba59f21]
---
.../rocclr/runtime/device/rocm/rocdevice.cpp | 67 +++++++++++++------
1 file changed, 48 insertions(+), 19 deletions(-)
diff --git a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
index f9bc0af9e3..eb43933c0c 100644
--- a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
+++ b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
@@ -466,28 +466,57 @@ bool Device::init() {
isaName[isaNameLength] = '\0';
std::string str(isaName);
- std::vector tokens;
- size_t end, pos = 0;
- do {
- end = str.find_first_of(':', pos);
- tokens.push_back(str.substr(pos, end - pos));
- pos = end + 1;
- } while (end != std::string::npos);
- if (tokens.size() != 5 || tokens[0] != "AMD" || tokens[1] != "AMDGPU") {
- LogError("Not an AMD:AMDGPU ISA name");
- continue;
+ unsigned gfxipVersionNum = (unsigned)-1;
+ if (str.find("amdgcn-") == 0) {
+ // New way.
+ std::vector tokens;
+ size_t end, pos = 0;
+ do {
+ end = str.find_first_of('-', pos);
+ tokens.push_back(str.substr(pos, end - pos));
+ pos = end + 1;
+ } while (end != std::string::npos);
+
+ if (tokens.size() != 5 && tokens.size() != 6) {
+ LogError("Not an amdgcn name");
+ continue;
+ }
+
+ if (tokens[4].find("gfx") != 0) {
+ LogError("Invalid ISA string");
+ continue;
+ }
+
+ std::string gfxipVersionStr = tokens[4].substr(tokens[4].find("gfx") + 3);
+ gfxipVersionNum = std::atoi(gfxipVersionStr.c_str());
+ } else {
+ // FIXME(kzhuravl): Old way. Remove.
+ std::vector tokens;
+ size_t end, pos = 0;
+ do {
+ end = str.find_first_of(':', pos);
+ tokens.push_back(str.substr(pos, end - pos));
+ pos = end + 1;
+ } while (end != std::string::npos);
+
+ if (tokens.size() != 5 || tokens[0] != "AMD" || tokens[1] != "AMDGPU") {
+ LogError("Not an AMD:AMDGPU ISA name");
+ continue;
+ }
+
+ uint major = atoi(tokens[2].c_str());
+ uint minor = atoi(tokens[3].c_str());
+ uint stepping = atoi(tokens[4].c_str());
+ if (minor >= 10 && stepping >= 10) {
+ LogError("Invalid ISA string");
+ continue;
+ }
+ gfxipVersionNum = major * 100 + minor * 10 + stepping;
}
+ assert(gfxipVersionNum != (unsigned)-1);
- uint major = atoi(tokens[2].c_str());
- uint minor = atoi(tokens[3].c_str());
- uint stepping = atoi(tokens[4].c_str());
- if (minor >= 10 && stepping >= 10) {
- LogError("Invalid ISA string");
- continue;
- }
-
- roc_device->deviceInfo_.gfxipVersion_ = major * 100 + minor * 10 + stepping;
+ roc_device->deviceInfo_.gfxipVersion_ = gfxipVersionNum;
if (!roc_device->create()) {
LogError("Error creating new instance of Device.");