diff --git a/hipamd/src/hip_fatbin.cpp b/hipamd/src/hip_fatbin.cpp index 56bca305da..af7542c4c8 100644 --- a/hipamd/src/hip_fatbin.cpp +++ b/hipamd/src/hip_fatbin.cpp @@ -52,6 +52,16 @@ FatBinaryInfo::~FatBinaryInfo() { uri_ = std::string(); } +void ListAllDeviceWithNoCOFromBundle(const std::unordered_map> unique_isa_names) { + LogError("Missing CO for these ISAs - "); + for (const auto& unique_isa : unique_isa_names) { + if (unique_isa.second.first == 0) { + LogPrintfError(" %s", unique_isa.first.c_str()); + } + } +} + hipError_t FatBinaryInfo::ExtractFatBinaryUsingCOMGR(const std::vector& devices) { amd_comgr_data_t data_object; amd_comgr_status_t comgr_status = AMD_COMGR_STATUS_SUCCESS; @@ -184,6 +194,13 @@ hipError_t FatBinaryInfo::ExtractFatBinaryUsingCOMGR(const std::vectordevices()[0]->isa().isaName(); auto dev_it = unique_isa_names.find(device_name); + // If the size is 0, then COMGR API could not find the CO for this GPU device/ISA + if (dev_it->second.first == 0) { + LogPrintfError("Cannot find CO in the bundle for ISA: %s \n", device_name); + hip_status = hipErrorNoBinaryForGpu; + ListAllDeviceWithNoCOFromBundle(unique_isa_names); + break; + } guarantee(unique_isa_names.cend() != dev_it, "Cannot find the device name in the unique device name"); fatbin_dev_info_[devices[dev_idx]->deviceId()] @@ -194,6 +211,11 @@ hipError_t FatBinaryInfo::ExtractFatBinaryUsingCOMGR(const std::vectorasContext()); } + if ((comgr_status = amd_comgr_release_data(data_object)) != AMD_COMGR_STATUS_SUCCESS) { + LogPrintfError("Releasing COMGR data failed with status %d ", comgr_status); + return hipErrorInvalidValue; + } + } while(0); if (query_list_array) {