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

Change-Id: Ifafbc075d6b9860da040c72859127c4e638a786f
Этот коммит содержится в:
agodavar
2021-01-05 05:08:50 -05:00
коммит произвёл Anusha Godavarthy Surya
родитель 7822bf7e42
Коммит 387d0aa829
6 изменённых файлов: 24 добавлений и 25 удалений
+1 -2
Просмотреть файл
@@ -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;
}
}
+1 -1
Просмотреть файл
@@ -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");
}
}
+3 -3
Просмотреть файл
@@ -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<hip::Device*>& 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;
}
+2 -2
Просмотреть файл
@@ -46,8 +46,8 @@ public:
// Device Id bounds check
inline void DeviceIdCheck(const int device_id) const {
guarantee(device_id >= 0);
guarantee(static_cast<size_t>(device_id) < fatbin_dev_info_.size());
guarantee(device_id >= 0, "Invalid DeviceId less than 0");
guarantee(static_cast<size_t>(device_id) < fatbin_dev_info_.size(), "Invalid DeviceId, greater than no of fatbin device info!");
}
// Getter Methods
+16 -16
Просмотреть файл
@@ -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));
+1 -1
Просмотреть файл
@@ -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");
}
}
}