SWDEV-494409 - Fix destructor path for Static and Dynamic CO

1) For Dynamic CO variables, free the device pointer in
   DynCO destructor instead of DeviceVar destructor.
2) For Static CO Remove Fatbinary,
   only call hipFree for valid device Vars instead of all devices.

Change-Id: I84291f5371b2c05d1d0bcdb4f9c6bd122e7c9b21


[ROCm/clr commit: a2d8199402]
This commit is contained in:
Rahul Manocha
2024-11-01 22:04:07 +00:00
zatwierdzone przez Rahul Manocha
rodzic ca8ca0bc35
commit ee20409853
3 zmienionych plików z 32 dodań i 4 usunięć
@@ -229,6 +229,16 @@ Var::~Var() {
modules_ = nullptr;
}
hipError_t Var::getDeviceVarPtr(DeviceVar** dvar, int deviceId) {
guarantee((deviceId >= 0), "Invalid DeviceId, less than zero");
guarantee((static_cast<size_t>(deviceId) < g_devices.size()),
"Invalid DeviceId, greater than no of code objects");
guarantee((dVar_.size() == g_devices.size()),
"Device Var not initialized to size");
*dvar = dVar_[deviceId];
return hipSuccess;
}
hipError_t Var::getDeviceVar(DeviceVar** dvar, int deviceId, hipModule_t hmod) {
guarantee((deviceId >= 0), "Invalid DeviceId, less than zero");
guarantee((static_cast<size_t>(deviceId) < g_devices.size()),