From e5a159065b9d4db5595aae1820a1db6c0e34ca5a Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 11 Apr 2018 12:43:38 -0400
Subject: [PATCH] P4 to Git Change 1539828 by wchau@wchau_OCL_PAL_LC on
2018/04/11 12:14:48
SWDEV-134107 - Add support for respecting target's xnack setting - handle the new format of target name
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprogram.cpp#61 edit
---
rocclr/runtime/device/pal/palprogram.cpp | 27 +++++++++++++++---------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/rocclr/runtime/device/pal/palprogram.cpp b/rocclr/runtime/device/pal/palprogram.cpp
index 9a841319b8..ec219fb011 100644
--- a/rocclr/runtime/device/pal/palprogram.cpp
+++ b/rocclr/runtime/device/pal/palprogram.cpp
@@ -868,16 +868,23 @@ hsa_isa_t PALHSALoaderContext::IsaFromName(const char* name) {
hsa_isa_t isa = {0};
uint32_t gfxip = 0;
std::string gfx_target(name);
- uint32_t shift = 1;
- size_t last = gfx_target.length();
- std::string ver;
- do {
- size_t first = gfx_target.find_last_of(':', last);
- ver = gfx_target.substr(first + 1, last - first);
- last = first - 1;
- gfxip += static_cast(atoi(ver.c_str())) * shift;
- shift *= 10;
- } while (shift <= 100);
+ if (gfx_target.find("amdgcn-") == 0) {
+ std::string gfxip_version_str = gfx_target.substr(gfx_target.find("gfx") + 3);
+ gfxip = std::atoi(gfxip_version_str.c_str());
+ }
+ else {
+ // FIXME: Old way. To be remove.
+ uint32_t shift = 1;
+ size_t last = gfx_target.length();
+ std::string ver;
+ do {
+ size_t first = gfx_target.find_last_of(':', last);
+ ver = gfx_target.substr(first + 1, last - first);
+ last = first - 1;
+ gfxip += static_cast(atoi(ver.c_str())) * shift;
+ shift *= 10;
+ } while (shift <= 100);
+ }
isa.handle = gfxip;
return isa;
}