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
This commit is contained in:
Rahul Manocha
2024-11-01 22:04:07 +00:00
کامیت شده توسط Rahul Manocha
والد e2eeb20c00
کامیت a2d8199402
3فایلهای تغییر یافته به همراه32 افزوده شده و 4 حذف شده
+10
مشاهده پرونده
@@ -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()),