diff --git a/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp b/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp index 7cad8119ef..ea525c8289 100644 --- a/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp +++ b/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp @@ -386,6 +386,18 @@ OCLFEToModule( return module; } +/// Update elf e_rawfile buffer. +static acl_error +updateElfRawFile(aclBinary *bin) +{ + if (bin == NULL + || bin->bin == NULL) { + return ACL_INVALID_ARG; + } + bifbase *elfBin = reinterpret_cast(bin->bin); + return elfBin->updateRawFile() ? ACL_SUCCESS : ACL_ELF_ERROR; +} + aclModule* ACL_API_ENTRY SPIRVToModule( aclLoaderData *ald, @@ -449,7 +461,11 @@ SPIRVToModule( outstream.flush(); auto errCode = cl->clAPI.insSec(cl, bin, &array[0], array.size(), aclLLVMIR); if (error != nullptr) (*error) = errCode; + if (errCode != ACL_SUCCESS) + return reinterpret_cast(llMod); + errCode = updateElfRawFile(bin); + if (error != nullptr) (*error) = errCode; return reinterpret_cast(llMod); #endif // LEGACY_COMPLIB } diff --git a/rocclr/compiler/lib/include/v0_8/acl.h b/rocclr/compiler/lib/include/v0_8/acl.h index b70bd14fb7..ba2669196c 100644 --- a/rocclr/compiler/lib/include/v0_8/acl.h +++ b/rocclr/compiler/lib/include/v0_8/acl.h @@ -98,9 +98,6 @@ acl_error ACL_API_ENTRY aclWriteToMem(aclBinary *bin, void **mem, size_t *size) ACL_API_0_8; -acl_error ACL_API_ENTRY - aclUpdateRawFile(aclBinary *bin); - aclBinary* ACL_API_ENTRY aclCreateFromBinary(const aclBinary *binary, aclBIFVersion version) ACL_API_0_8; diff --git a/rocclr/runtime/device/gpu/gpuprogram.cpp b/rocclr/runtime/device/gpu/gpuprogram.cpp index cc6fcb1178..3b915235b4 100644 --- a/rocclr/runtime/device/gpu/gpuprogram.cpp +++ b/rocclr/runtime/device/gpu/gpuprogram.cpp @@ -1821,9 +1821,6 @@ HSAILProgram::linkImpl( buildLog_ += "Error while linking: Could not load SPIR-V" ; return false; } - // Need to update elf raw file since it will be used by - // aclCreateFromBinary. - aclUpdateRawFile(binaryElf_); } else { buildLog_ +="Error while linking : \ Invalid binary (Missing LLVMIR section)" ;