From b739fb879d2fb05acb4ba0903ff745cb6e55908a Mon Sep 17 00:00:00 2001 From: Vladislav Sytchenko Date: Wed, 5 May 2021 12:19:52 -0400 Subject: [PATCH] SWDEV-280473 - Remove dependancy on internal ACL API aclutGetTargetInfo() is an internal compiler lib helper functions. This will not be imported in the HSAIL shared library build, however it is simple enough that we can maintain our own local copy of it. Change-Id: I91d1a336c7da027bf8a7df8fae86a25add533611 [ROCm/clr commit: 7fd1e9c10a9ebf07fd4712a5d3ba6d41415da4a4] --- projects/clr/rocclr/platform/program.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/projects/clr/rocclr/platform/program.cpp b/projects/clr/rocclr/platform/program.cpp index 9dd8b0a0ae..35bb2bcccb 100644 --- a/projects/clr/rocclr/platform/program.cpp +++ b/projects/clr/rocclr/platform/program.cpp @@ -38,6 +38,22 @@ namespace amd { +#if defined(WITH_COMPILER_LIB) +static aclTargetInfo *aclutGetTargetInfo(aclBinary *binary) +{ + aclTargetInfo *tgt = NULL; + if (binary->struct_size == sizeof(aclBinary_0_8)) { + tgt = &reinterpret_cast(binary)->target; + } else if (binary->struct_size == sizeof(aclBinary_0_8_1)) { + tgt = &reinterpret_cast(binary)->target; + } else { + assert(!"Binary format not supported!"); + tgt = &binary->target; + } + return tgt; +} +#endif + static void remove_g_option(std::string &option) { // Remove " -g " option from application. @@ -142,8 +158,8 @@ int32_t Program::addDeviceProgram(Device& device, const void* image, size_t leng } } options->oVariables->Legacy = !device.settings().useLightning_ ? - isAMDILTarget(*aclutGetTargetInfo(binary)) : - isHSAILTarget(*aclutGetTargetInfo(binary)); + isAMDILTarget(*amd::aclutGetTargetInfo(binary)) : + isHSAILTarget(*amd::aclutGetTargetInfo(binary)); amd::Hsail::BinaryFini(binary); } #endif // defined(WITH_COMPILER_LIB) @@ -356,10 +372,10 @@ int32_t Program::link(const std::vector& devices, size_t numInputs, LogWarning("Error while linking: Could not read from raw binary."); return CL_INVALID_BINARY; } - if (isHSAILTarget(*aclutGetTargetInfo(aclBin))) { + if (isHSAILTarget(*amd::aclutGetTargetInfo(aclBin))) { parsedOptions.oVariables->Frontend = "clang"; parsedOptions.oVariables->Legacy = it->settings().useLightning_; - } else if (isAMDILTarget(*aclutGetTargetInfo(aclBin))) { + } else if (isAMDILTarget(*amd::aclutGetTargetInfo(aclBin))) { parsedOptions.oVariables->Frontend = "edg"; } amd::Hsail::BinaryFini(aclBin);