From e07ddab2d9c62ddb80525f84fee78f1f4e4094e6 Mon Sep 17 00:00:00 2001 From: foreman Date: Fri, 28 Jun 2019 08:06:23 -0400 Subject: [PATCH] P4 to Git Change 1917620 by yaxunl@yaxunl-lc10 on 2019/06/28 07:57:46 SWDEV-145570 - Fix device name mismatch. Not only gfx906 can have device name with +xnack etc. Other devices e.g. gfx900 could have that too. Make the previous fix more generic. Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_platform.cpp#33 edit [ROCm/hip commit: 97a079826eb7be971e6b9a6ada47079e8d608333] --- projects/hip/api/hip/hip_platform.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/projects/hip/api/hip/hip_platform.cpp b/projects/hip/api/hip/hip_platform.cpp index 07a68faccf..c358f8c4b3 100644 --- a/projects/hip/api/hip/hip_platform.cpp +++ b/projects/hip/api/hip/hip_platform.cpp @@ -66,12 +66,17 @@ hipError_t ihipCreateGlobalVarObj(const char* name, hipModule_t hmod, amd::Memor static bool isCompatibleCodeObject(const std::string& codeobj_target_id, const char* device_name) { - // Workaround for gfx906 device name mismatch. - // If bundle target id starts with gfx906 and device name starts with - // gfx906, treat them as match. - return codeobj_target_id.compare(device_name) == 0 || - (codeobj_target_id.find("gfx906") == 0 && - std::string(device_name).find("gfx906") == 0); + // Workaround for device name mismatch. + // Device name may contain feature strings delimited by '+', e.g. + // gfx900+xnack. Currently HIP-Clang does not include feature strings + // in code object target id in fat binary. Therefore drop the feature + // strings from device name before comparing it with code object target id. + std::string short_name(device_name); + auto feature_loc = short_name.find('+'); + if (feature_loc != std::string::npos) { + short_name.erase(feature_loc); + } + return codeobj_target_id == short_name; } // Extracts code objects from fat binary in data for device names given in devices.