SWDEV-518317 - Remove Redundant Error Message in removeFatBinary (#164)

This commit is contained in:
Xie, Pengda
2025-04-15 09:00:39 -07:00
committed by GitHub
parent f6c804edc0
commit e92ea151b2
+27 -41
View File
@@ -1336,50 +1336,40 @@ FatBinaryInfo** StatCO::addFatBinary(const void* data, bool initialized, bool& s
hipError_t StatCO::removeFatBinary(FatBinaryInfo** module) { hipError_t StatCO::removeFatBinary(FatBinaryInfo** module) {
amd::ScopedLock lock(sclock_); amd::ScopedLock lock(sclock_);
if (!module_to_hostVars_.empty()) { auto hostVarsIter = module_to_hostVars_.find(module);
auto hostVarsIter = module_to_hostVars_.find(module); if (hostVarsIter != module_to_hostVars_.end()) {
if (hostVarsIter != module_to_hostVars_.end()) { for (auto& hostVar : hostVarsIter->second) {
for (auto& hostVar : hostVarsIter->second) { auto varIter = vars_.find(hostVar);
auto varIter = vars_.find(hostVar); if (varIter == vars_.end()) {
if (varIter == vars_.end()) { LogPrintfError(
LogPrintfError( "removeFatBinary: Unable to find module 0x%x hostVar 0x%x",
"removeFatBinary: Unable to find module 0x%x hostVar 0x%x", module, hostVar);
module, hostVar); } else {
} else { delete varIter->second;
delete varIter->second; vars_.erase(varIter);
vars_.erase(varIter);
}
} }
module_to_hostVars_.erase(hostVarsIter);
} else {
LogPrintfError(
"removeFatBinary: Unable to find module 0x%x hostVars", module);
} }
module_to_hostVars_.erase(hostVarsIter);
} }
if (!managedVars_.empty()) { auto managedVarsIter = managedVars_.find(module);
auto managedVarsIter = managedVars_.find(module); if (managedVarsIter != managedVars_.end()) {
if (managedVarsIter != managedVars_.end()) { for (auto& managedVar : managedVarsIter->second) {
for (auto& managedVar : managedVarsIter->second) { hipError_t err;
hipError_t err; for (auto dev : g_devices) {
for (auto dev : g_devices) { DeviceVar* dvar = nullptr;
DeviceVar* dvar = nullptr; IHIP_RETURN_ONFAIL(managedVar->getDeviceVarPtr(&dvar, dev->deviceId()));
IHIP_RETURN_ONFAIL(managedVar->getDeviceVarPtr(&dvar, dev->deviceId())); if (dvar != nullptr) {
if (dvar != nullptr) { // free also deletes the device ptr
// free also deletes the device ptr err = ihipFree(dvar->device_ptr());
err = ihipFree(dvar->device_ptr()); assert(err == hipSuccess);
assert(err == hipSuccess);
}
} }
err = ihipFree(*(static_cast<void**>(managedVar->getManagedVarPtr())));
assert(err == hipSuccess);
delete managedVar;
} }
managedVars_.erase(managedVarsIter); err = ihipFree(*(static_cast<void**>(managedVar->getManagedVarPtr())));
} else { assert(err == hipSuccess);
LogPrintfError("removeFatBinary: Unable to find module 0x%x managedVars", delete managedVar;
module);
} }
managedVars_.erase(managedVarsIter);
} }
auto hostFuncsIter = module_to_hostFunctions_.find(module); auto hostFuncsIter = module_to_hostFunctions_.find(module);
@@ -1395,8 +1385,6 @@ hipError_t StatCO::removeFatBinary(FatBinaryInfo** module) {
} }
} }
module_to_hostFunctions_.erase(hostFuncsIter); module_to_hostFunctions_.erase(hostFuncsIter);
} else {
LogPrintfError("removeFatBinary: Unable to find module 0x%x hostFuncs", module);
} }
auto hostModuleIter = module_to_hostModule_.find(module); auto hostModuleIter = module_to_hostModule_.find(module);
@@ -1411,8 +1399,6 @@ hipError_t StatCO::removeFatBinary(FatBinaryInfo** module) {
module, hostModule); module, hostModule);
} }
module_to_hostModule_.erase(hostModuleIter); module_to_hostModule_.erase(hostModuleIter);
} else {
LogPrintfError("removeFatBinary: Unable to find module 0x%x hostModule", module);
} }
return hipSuccess; return hipSuccess;