From 67cf4a5107b4d2ee121d2215da57c8b232593bdd Mon Sep 17 00:00:00 2001 From: kjayapra-amd Date: Mon, 24 Oct 2022 14:00:20 -0700 Subject: [PATCH] SWDEV-363865 - Use COMGR path to unbundle code object in HIPRTC. Change-Id: Ifca29ea0c6ff319c3f584397e542a1658d220c4a [ROCm/clr commit: 2f8847bfbd78e0de96a22698c4019b9997d6430b] --- projects/clr/hipamd/src/hiprtc/hiprtcComgrHelper.hpp | 2 +- projects/clr/hipamd/src/hiprtc/hiprtcInternal.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/projects/clr/hipamd/src/hiprtc/hiprtcComgrHelper.hpp b/projects/clr/hipamd/src/hiprtc/hiprtcComgrHelper.hpp index d8f0e61be0..4e16d8c3fd 100644 --- a/projects/clr/hipamd/src/hiprtc/hiprtcComgrHelper.hpp +++ b/projects/clr/hipamd/src/hiprtc/hiprtcComgrHelper.hpp @@ -32,7 +32,7 @@ THE SOFTWARE. namespace hiprtc { namespace helpers { bool UnbundleBitCode(const std::vector& bundled_bit_code, const std::string& isa, - size_t& co_offset, size_t& co_size); + size_t& co_offset, size_t& co_size); bool addCodeObjData(amd_comgr_data_set_t& input, const std::vector& source, const std::string& name, const amd_comgr_data_kind_t type); bool extractBuildLog(amd_comgr_data_set_t dataSet, std::string& buildLog); diff --git a/projects/clr/hipamd/src/hiprtc/hiprtcInternal.cpp b/projects/clr/hipamd/src/hiprtc/hiprtcInternal.cpp index a92dd255c5..2ef2c9483d 100644 --- a/projects/clr/hipamd/src/hiprtc/hiprtcInternal.cpp +++ b/projects/clr/hipamd/src/hiprtc/hiprtcInternal.cpp @@ -485,10 +485,11 @@ amd_comgr_data_kind_t RTCLinkProgram::GetCOMGRDataKind(hiprtcJITInputType input_ data_kind = AMD_COMGR_DATA_KIND_BC; break; case HIPRTC_JIT_INPUT_LLVM_BUNDLED_BITCODE : - data_kind = AMD_COMGR_DATA_KIND_BC; + data_kind = HIPRTC_USE_RUNTIME_UNBUNDLER + ? AMD_COMGR_DATA_KIND_BC : AMD_COMGR_DATA_KIND_BC_BUNDLE; break; case HIPRTC_JIT_INPUT_LLVM_ARCHIVES_OF_BUNDLED_BITCODE : - data_kind = AMD_COMGR_DATA_KIND_FATBIN; + data_kind = AMD_COMGR_DATA_KIND_AR_BUNDLE; break; default : LogError("Cannot find the corresponding comgr data kind"); @@ -519,7 +520,7 @@ bool RTCLinkProgram::AddLinkerFile(std::string file_path, hiprtcJITInputType inp bc_file.close(); // If this is bundled bitcode then unbundle this. - if (input_type == HIPRTC_JIT_INPUT_LLVM_BUNDLED_BITCODE) { + if (HIPRTC_USE_RUNTIME_UNBUNDLER && input_type == HIPRTC_JIT_INPUT_LLVM_BUNDLED_BITCODE) { if (!findIsa()) { return false; } @@ -556,7 +557,7 @@ bool RTCLinkProgram::AddLinkerData(void* image_ptr, size_t image_size, std::stri char* image_char_buf = reinterpret_cast(image_ptr); std::vector llvm_bitcode; - if (input_type == HIPRTC_JIT_INPUT_LLVM_BUNDLED_BITCODE) { + if (HIPRTC_USE_RUNTIME_UNBUNDLER && input_type == HIPRTC_JIT_INPUT_LLVM_BUNDLED_BITCODE) { std::vector bundled_llvm_bitcode(image_char_buf, image_char_buf + image_size); if (!findIsa()) {