From fb67f621b87ec465c5ed9d68e742b211347f61cf Mon Sep 17 00:00:00 2001 From: foreman Date: Tue, 13 Feb 2018 07:40:19 -0500 Subject: [PATCH] P4 to Git Change 1515527 by emankov@em-hsa on 2018/02/13 07:35:08 SWDEV-143465 - Fix crashes while mixed work with hsail and amdil (legacy) paths Redirect (where it is possible) ACL API calls from HSAIL lib to legacy AMDIL lib if target is AMDIL. For those functions (aclCreateFromBinary, aclReadFromMem), where redirect is impossible, explicit loadLibrary for AMDIL lib and call of corresponding function from AMDIL lib is performed. [Reviewed] by Stas (http://ocltc.amd.com/reviews/r/14238) [Testing] rga offline for all the targets supported by HSAIL and AMDIL (from Family_SI up to Family_VI): tahiti, pitcairn, capeverde, spectre, spooky, kalindi, hawaii, oland, bonaire, hainan, carrizo, iceland, tonga, fiji, stoney, baffin, ellesmere. Affected files ... ... //depot/stg/opencl/drivers/opencl/compiler/lib/api/v0_8/acl.cpp#45 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/api/v0_8/aclValidation.cpp#8 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/api/v0_8/aclValidation.h#3 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/v0_8/libUtils.cpp#29 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/v0_8/libUtils.h#30 edit [ROCm/clr commit: a9ac031e6efcc766c2b8f6c5cdd2a2b7eb652311] --- projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.cpp | 6 ++++++ projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.cpp b/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.cpp index 3b831682fb..d68f150edc 100644 --- a/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.cpp +++ b/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.cpp @@ -33,6 +33,8 @@ static const std::string sgfx907 = "AMD:AMDGPU:9:0:7"; static const std::string sgfx1000 = "AMD:AMDGPU:10:0:0"; static const std::string sgfx1001 = "AMD:AMDGPU:10:0:1"; +static const std::string legacyLibName = LINUX_ONLY("lib") "amdocl12cl" LP64_SWITCH(LINUX_SWITCH("32", ""), "64") LINUX_SWITCH(".so", ".dll"); + // Utility function to set a flag in option structure // of the aclDevCaps. void @@ -1139,3 +1141,7 @@ void dump(aclBinary *bin) { bifbase *elfBin = reinterpret_cast(bin->bin); elfBin->dump(); } + +const std::string &getLegacyLibName() { + return legacyLibName; +} diff --git a/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.h b/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.h index ebbbfffe90..3d288359ea 100644 --- a/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.h +++ b/projects/clr/rocclr/compiler/lib/utils/v0_8/libUtils.h @@ -291,6 +291,8 @@ inline bool isHSAILTarget(const aclTargetInfo& target) return (target.arch_id == aclHSAIL || target.arch_id == aclHSAIL64); } +const std::string& getLegacyLibName(); + enum scId { SC_AMDIL = 0, SC_HSAIL = 0,