SWDEV-245381: Updated guarantee error messages to print based on BUILD_TYPE

Change-Id: Ifafbc075d6b9860da040c72859127c4e638a786f


[ROCm/hip commit: 387d0aa829]
Esse commit está contido em:
agodavar
2021-01-05 05:08:50 -05:00
commit de Anusha Godavarthy Surya
commit add7f87881
6 arquivos alterados com 24 adições e 25 exclusões
+16 -16
Ver Arquivo
@@ -24,19 +24,19 @@ DeviceVar::DeviceVar(std::string name, hipModule_t hmod) : shadowVptr(nullptr),
device::Program* dev_program = program->getDeviceProgram(*hip::getCurrentDevice()->devices()[0]);
if (dev_program == nullptr) {
DevLogPrintfError("Cannot get Device Program for module: 0x%x \n", hmod);
guarantee(false && "Cannot get Device Program");
guarantee(false, "Cannot get Device Program");
}
if(!dev_program->createGlobalVarObj(&amd_mem_obj_, &device_ptr_, &size_, name.c_str())) {
DevLogPrintfError("Cannot create Global Var obj for symbol: %s \n", name.c_str());
guarantee(false && "Cannot create GlobalVar Obj");
guarantee(false, "Cannot create GlobalVar Obj");
}
// Handle size 0 symbols
if (size_ != 0) {
if (amd_mem_obj_ == nullptr || device_ptr_ == nullptr) {
DevLogPrintfError("Cannot get memory for creating device Var: %s", name.c_str());
guarantee(false && "Cannot get memory for creating device var");
guarantee(false, "Cannot get memory for creating device var");
}
amd::MemObjMap::AddMemObj(device_ptr_, amd_mem_obj_);
}
@@ -66,13 +66,13 @@ DeviceFunc::DeviceFunc(std::string name, hipModule_t hmod) : dflock_("function l
const amd::Symbol *symbol = program->findSymbol(name.c_str());
if (symbol == nullptr) {
DevLogPrintfError("Cannot find Symbol with name: %s \n", name.c_str());
guarantee(false && "Cannot find Symbol");
guarantee(false, "Cannot find Symbol");
}
kernel_ = new amd::Kernel(*program, *symbol, name);
if (kernel_ == nullptr) {
DevLogPrintfError("Cannot create kernel with name: %s \n", name.c_str());
guarantee(false && "Cannot Create kernel");
guarantee(false, "Cannot Create kernel");
}
}
@@ -97,7 +97,7 @@ Function::~Function() {
}
hipError_t Function::getDynFunc(hipFunction_t* hfunc, hipModule_t hmod) {
guarantee((dFunc_.size() == g_devices.size()) && "dFunc Size mismatch");
guarantee((dFunc_.size() == g_devices.size()), "dFunc Size mismatch");
if (dFunc_[ihipGetDevice()] == nullptr) {
dFunc_[ihipGetDevice()] = new DeviceFunc(name_, hmod);
}
@@ -107,7 +107,7 @@ 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");
guarantee(modules_ != nullptr, "Module not initialized");
hipModule_t hmod = nullptr;
IHIP_RETURN_ONFAIL((*modules_)->BuildProgram(deviceId));
@@ -122,7 +122,7 @@ hipError_t Function::getStatFunc(hipFunction_t* hfunc, int deviceId) {
}
hipError_t Function::getStatFuncAttr(hipFuncAttributes* func_attr, int deviceId) {
guarantee((modules_ != nullptr) && "Module not initialized");
guarantee((modules_ != nullptr), "Module not initialized");
hipModule_t hmod = nullptr;
IHIP_RETURN_ONFAIL((*modules_)->BuildProgram(deviceId));
@@ -168,11 +168,11 @@ Var::~Var() {
}
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())
&& "Invalid DeviceId, greater than no of code objects");
guarantee((dVar_.size() == g_devices.size())
&& "Device Var not initialized to size");
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");
if (dVar_[deviceId] == nullptr) {
dVar_[deviceId] = new DeviceVar(name_, hmod);
@@ -183,9 +183,9 @@ hipError_t Var::getDeviceVar(DeviceVar** dvar, int deviceId, hipModule_t hmod) {
}
hipError_t Var::getStatDeviceVar(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((deviceId >= 0) , "Invalid DeviceId, less than zero");
guarantee((static_cast<size_t>(deviceId) < g_devices.size()),
"Invalid DeviceId, greater than no of code objects");
hipModule_t hmod = nullptr;
IHIP_RETURN_ONFAIL((*modules_)->BuildProgram(deviceId));