From 76c8b3157b8e9eab6516815d9edf09c16001a403 Mon Sep 17 00:00:00 2001 From: Rakesh Roy Date: Thu, 3 Aug 2023 19:55:31 +0530 Subject: [PATCH] SWDEV-415265 - Fix segfault when library isn't built with current GPU arch - Return error code instead of segfault during kernel launch when library isn't built with current gpu arch - Fix string print bug Change-Id: I91aaa50150fee220317cd2eb4e075d825cc448b2 --- hipamd/src/hip_fatbin.cpp | 2 +- hipamd/src/hip_global.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hipamd/src/hip_fatbin.cpp b/hipamd/src/hip_fatbin.cpp index af7542c4c8..bcc45f5184 100644 --- a/hipamd/src/hip_fatbin.cpp +++ b/hipamd/src/hip_fatbin.cpp @@ -196,7 +196,7 @@ hipError_t FatBinaryInfo::ExtractFatBinaryUsingCOMGR(const std::vectorsecond.first == 0) { - LogPrintfError("Cannot find CO in the bundle for ISA: %s \n", device_name); + LogPrintfError("Cannot find CO in the bundle for ISA: %s \n", device_name.c_str()); hip_status = hipErrorNoBinaryForGpu; ListAllDeviceWithNoCOFromBundle(unique_isa_names); break; diff --git a/hipamd/src/hip_global.cpp b/hipamd/src/hip_global.cpp index 1042e1cdfa..b11097a278 100644 --- a/hipamd/src/hip_global.cpp +++ b/hipamd/src/hip_global.cpp @@ -128,6 +128,10 @@ hipError_t Function::getDynFunc(hipFunction_t* hfunc, hipModule_t hmod) { hipError_t Function::getStatFunc(hipFunction_t* hfunc, int deviceId) { guarantee(modules_ != nullptr, "Module not initialized"); + if (dFunc_.size() != g_devices.size()) { + return hipErrorSharedObjectInitFailed; + } + hipModule_t hmod = nullptr; IHIP_RETURN_ONFAIL((*modules_)->BuildProgram(deviceId)); IHIP_RETURN_ONFAIL((*modules_)->GetModule(deviceId, &hmod));