diff --git a/rocclr/hip_code_object.cpp b/rocclr/hip_code_object.cpp index 7496e532d6..a8118409f5 100755 --- a/rocclr/hip_code_object.cpp +++ b/rocclr/hip_code_object.cpp @@ -19,7 +19,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - #include "hip_code_object.hpp" #include "amd_hsa_elf.hpp" @@ -480,7 +479,7 @@ hipError_t CodeObject::extractCodeObjectFromFatBinary(const void* data, } } - guarantee(false && "hipErrorNoBinaryForGpu: Unable to find code object for all current devices!"); + guarantee(false, "hipErrorNoBinaryForGpu: Unable to find code object for all current devices!"); return hipErrorNoBinaryForGpu; } } diff --git a/rocclr/hip_code_object.hpp b/rocclr/hip_code_object.hpp index 8bcc5d5fea..9c53369b0d 100755 --- a/rocclr/hip_code_object.hpp +++ b/rocclr/hip_code_object.hpp @@ -95,7 +95,7 @@ public: // Device ID Check to check if module is launched in the same device it was loaded. inline void CheckDeviceIdMatch() { if (device_id_ != ihipGetDevice()) { - guarantee(false && "Device mismatch from where this module is loaded"); + guarantee(false, "Device mismatch from where this module is loaded"); } } diff --git a/rocclr/hip_fatbin.cpp b/rocclr/hip_fatbin.cpp index ed73904307..0a4e4fa9d3 100755 --- a/rocclr/hip_fatbin.cpp +++ b/rocclr/hip_fatbin.cpp @@ -31,11 +31,11 @@ FatBinaryInfo::~FatBinaryInfo() { if (fdesc_ > 0) { if (!amd::Os::CloseFileHandle(fdesc_)) { - guarantee(false && "Cannot close file"); + guarantee(false, "Cannot close file"); } if (fsize_ && !amd::Os::MemoryUnmapFile(image_, fsize_)) { - guarantee(false && "Cannot unmap file"); + guarantee(false, "Cannot unmap file"); } } @@ -85,7 +85,7 @@ hipError_t FatBinaryInfo::ExtractFatBinary(const std::vector& devi } if (hip_error == hipErrorNoBinaryForGpu) { - guarantee(false && "hipErrorNoBinaryForGpu: Couldn't find binary for current devices!"); + guarantee(false, "hipErrorNoBinaryForGpu: Couldn't find binary for current devices!"); return hip_error; } diff --git a/rocclr/hip_fatbin.hpp b/rocclr/hip_fatbin.hpp index ba2ad4010e..421fe78b94 100755 --- a/rocclr/hip_fatbin.hpp +++ b/rocclr/hip_fatbin.hpp @@ -46,8 +46,8 @@ public: // Device Id bounds check inline void DeviceIdCheck(const int device_id) const { - guarantee(device_id >= 0); - guarantee(static_cast(device_id) < fatbin_dev_info_.size()); + guarantee(device_id >= 0, "Invalid DeviceId less than 0"); + guarantee(static_cast(device_id) < fatbin_dev_info_.size(), "Invalid DeviceId, greater than no of fatbin device info!"); } // Getter Methods diff --git a/rocclr/hip_global.cpp b/rocclr/hip_global.cpp index 7919a824f2..9297f9ad14 100755 --- a/rocclr/hip_global.cpp +++ b/rocclr/hip_global.cpp @@ -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(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(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(deviceId) < g_devices.size()) - && "Invalid DeviceId, greater than no of code objects"); + guarantee((deviceId >= 0) , "Invalid DeviceId, less than zero"); + guarantee((static_cast(deviceId) < g_devices.size()), + "Invalid DeviceId, greater than no of code objects"); hipModule_t hmod = nullptr; IHIP_RETURN_ONFAIL((*modules_)->BuildProgram(deviceId)); diff --git a/rocclr/hip_platform.cpp b/rocclr/hip_platform.cpp index fc359515ae..868804bc31 100755 --- a/rocclr/hip_platform.cpp +++ b/rocclr/hip_platform.cpp @@ -105,7 +105,7 @@ extern "C" void __hipRegisterFunction( hipError_t hip_error = hipSuccess; for (size_t dev_idx = 0; dev_idx < g_devices.size(); ++dev_idx) { hip_error = PlatformState::instance().getStatFunc(&hfunc, hostFunction, dev_idx); - guarantee((hip_error == hipSuccess) && "Cannot Retrieve Static function"); + guarantee((hip_error == hipSuccess), "Cannot Retrieve Static function"); } } }