SWDEV-271274 - Changing DevLogPrintf to LogPrintf for cases where error condition is being returned

Change-Id: I153d071f7859e9412ea0c69f53c53d190453d73d


[ROCm/hip commit: 23f33d5f20]
This commit is contained in:
cjatin
2021-02-17 23:54:39 +05:30
committed by Jatin Chaudhary
orang tua d5110c4be8
melakukan 201d7951de
9 mengubah file dengan 67 tambahan dan 65 penghapusan
+4 -4
Melihat File
@@ -533,7 +533,7 @@ hipError_t DynCO::getDeviceVar(DeviceVar** dvar, std::string var_name) {
auto it = vars_.find(var_name);
if (it == vars_.end()) {
DevLogPrintfError("Cannot find the Var: %s ", var_name.c_str());
LogPrintfError("Cannot find the Var: %s ", var_name.c_str());
return hipErrorNotFound;
}
@@ -552,7 +552,7 @@ hipError_t DynCO::getDynFunc(hipFunction_t* hfunc, std::string func_name) {
auto it = functions_.find(func_name);
if (it == functions_.end()) {
DevLogPrintfError("Cannot find the function: %s ", func_name.c_str());
LogPrintfError("Cannot find the function: %s ", func_name.c_str());
return hipErrorNotFound;
}
@@ -572,7 +572,7 @@ hipError_t DynCO::populateDynGlobalVars() {
(*hip::getCurrentDevice()->devices()[0]);
if (!dev_program->getGlobalVarFromCodeObj(&var_names)) {
DevLogPrintfError("Could not get Global vars from Code Obj for Module: 0x%x \n", module());
LogPrintfError("Could not get Global vars from Code Obj for Module: 0x%x \n", module());
return hipErrorSharedObjectSymbolNotFound;
}
@@ -593,7 +593,7 @@ hipError_t DynCO::populateDynGlobalFuncs() {
// Get all the global func names from COMGR
if (!dev_program->getGlobalFuncFromCodeObj(&func_names)) {
DevLogPrintfError("Could not get Global Funcs from Code Obj for Module: 0x%x \n", module());
LogPrintfError("Could not get Global Funcs from Code Obj for Module: 0x%x \n", module());
return hipErrorSharedObjectSymbolNotFound;
}
+5 -5
Melihat File
@@ -23,19 +23,19 @@ DeviceVar::DeviceVar(std::string name, hipModule_t hmod) : shadowVptr(nullptr),
amd::Program* program = as_amd(reinterpret_cast<cl_program>(hmod));
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);
LogPrintfError("Cannot get Device Program for module: 0x%x \n", hmod);
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());
LogPrintfError("Cannot create Global Var obj for symbol: %s \n", name.c_str());
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());
LogPrintfError("Cannot get memory for creating device Var: %s", name.c_str());
guarantee(false, "Cannot get memory for creating device var");
}
amd::MemObjMap::AddMemObj(device_ptr_, amd_mem_obj_);
@@ -65,13 +65,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());
LogPrintfError("Cannot find Symbol with name: %s \n", name.c_str());
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());
LogPrintfError("Cannot create kernel with name: %s \n", name.c_str());
guarantee(false, "Cannot Create kernel");
}
}
+1 -1
Melihat File
@@ -42,7 +42,7 @@ const char* hipKernelNameRefByPtr(const void* hostFunction, hipStream_t stream)
}
int deviceId = hipGetStreamDeviceId(stream);
if (deviceId == -1) {
DevLogPrintfError("Wrong Device Id: %d \n", deviceId);
LogPrintfError("Wrong Device Id: %d \n", deviceId);
return NULL;
}
hipFunction_t func = nullptr;
+22 -22
Melihat File
@@ -287,9 +287,10 @@ hipError_t hipHostMalloc(void** ptr, size_t sizeBytes, unsigned int flags) {
// can't have both Coherent and NonCoherent flags set at the same time
if ((flags & coherentFlags) == coherentFlags) {
DevLogPrintfError("Cannot have both coherent and non-coherent flags "
"at the same time, flags: %u coherent flags: %u \n",
flags, coherentFlags);
LogPrintfError(
"Cannot have both coherent and non-coherent flags "
"at the same time, flags: %u coherent flags: %u \n",
flags, coherentFlags);
HIP_RETURN(hipErrorInvalidValue);
}
@@ -490,20 +491,20 @@ amd::Image* ihipImageCreate(const cl_channel_order channelOrder,
amd::Memory* buffer) {
const amd::Image::Format imageFormat({channelOrder, channelType});
if (!imageFormat.isValid()) {
DevLogPrintfError("Invalid Image format for channel Order:%u Type:%u \n",
channelOrder, channelType);
LogPrintfError("Invalid Image format for channel Order:%u Type:%u \n", channelOrder,
channelType);
return nullptr;
}
amd::Context& context = *hip::getCurrentDevice()->asContext();
if (!imageFormat.isSupported(context, imageType)) {
DevLogPrintfError("Image type: %u not supported \n", imageType);
LogPrintfError("Image type: %u not supported \n", imageType);
return nullptr;
}
const std::vector<amd::Device*>& devices = context.devices();
if (!devices[0]->info().imageSupport_) {
DevLogPrintfError("Device: 0x%x does not support image \n", devices[0]);
LogPrintfError("Device: 0x%x does not support image \n", devices[0]);
return nullptr;
}
@@ -587,7 +588,7 @@ amd::Image* ihipImageCreate(const cl_channel_order channelOrder,
}
if (!image->create(nullptr)) {
DevLogPrintfError("Cannot create image: 0x%x \n", image);
LogPrintfError("Cannot create image: 0x%x \n", image);
delete image;
return nullptr;
}
@@ -735,8 +736,7 @@ hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags)
constexpr bool forceAlloc = true;
if (!mem->create(hostPtr, sysMemAlloc, skipAlloc, forceAlloc)) {
mem->release();
DevLogPrintfError("Cannot create memory for size: %u with flags: %d \n",
sizeBytes, flags);
LogPrintfError("Cannot create memory for size: %u with flags: %d \n", sizeBytes, flags);
HIP_RETURN(hipErrorOutOfMemory);
}
@@ -784,7 +784,7 @@ hipError_t hipHostUnregister(void* hostPtr) {
}
}
DevLogPrintfError("Cannot unregister host_ptr: 0x%x \n", hostPtr);
LogPrintfError("Cannot unregister host_ptr: 0x%x \n", hostPtr);
HIP_RETURN(hipErrorInvalidValue);
}
@@ -807,7 +807,7 @@ hipError_t hipMemcpyToSymbol(const void* symbol, const void* src, size_t sizeByt
/* Size Check to make sure offset is correct */
if ((offset + sizeBytes) > sym_size) {
DevLogPrintfError("Trying to access out of bounds, offset: %u sizeBytes: %u sym_size: %u \n",
LogPrintfError("Trying to access out of bounds, offset: %u sizeBytes: %u sym_size: %u \n",
offset, sizeBytes, sym_size);
HIP_RETURN(hipErrorInvalidDevicePointer);
}
@@ -829,8 +829,8 @@ hipError_t hipMemcpyFromSymbol(void* dst, const void* symbol, size_t sizeBytes,
/* Size Check to make sure offset is correct */
if ((offset + sizeBytes) > sym_size) {
DevLogPrintfError("Trying to access out of bounds, offset: %u sizeBytes: %u sym_size: %u \n",
offset, sizeBytes, sym_size);
LogPrintfError("Trying to access out of bounds, offset: %u sizeBytes: %u sym_size: %u \n",
offset, sizeBytes, sym_size);
HIP_RETURN(hipErrorInvalidDevicePointer);
}
@@ -851,8 +851,8 @@ hipError_t hipMemcpyToSymbolAsync(const void* symbol, const void* src, size_t si
/* Size Check to make sure offset is correct */
if ((offset + sizeBytes) > sym_size) {
DevLogPrintfError("Trying to access out of bounds, offset: %u sizeBytes: %u sym_size: %u \n",
offset, sizeBytes, sym_size);
LogPrintfError("Trying to access out of bounds, offset: %u sizeBytes: %u sym_size: %u \n",
offset, sizeBytes, sym_size);
HIP_RETURN(hipErrorInvalidDevicePointer);
}
@@ -873,8 +873,8 @@ hipError_t hipMemcpyFromSymbolAsync(void* dst, const void* symbol, size_t sizeBy
/* Size Check to make sure offset is correct */
if ((offset + sizeBytes) > sym_size) {
DevLogPrintfError("Trying to access out of bounds, offset: %u sizeBytes: %u sym_size: %u \n",
offset, sizeBytes, sym_size);
LogPrintfError("Trying to access out of bounds, offset: %u sizeBytes: %u sym_size: %u \n",
offset, sizeBytes, sym_size);
HIP_RETURN(hipErrorInvalidDevicePointer);
}
@@ -2019,7 +2019,7 @@ hipError_t hipIpcGetMemHandle(hipIpcMemHandle_t* handle, void* dev_ptr) {
ihandle = reinterpret_cast<ihipIpcMemHandle_t *>(handle);
if(!device->IpcCreate(dev_ptr, &(ihandle->psize), &(ihandle->ipc_handle))) {
DevLogPrintfError("IPC memory creation failed for memory: 0x%x", dev_ptr);
LogPrintfError("IPC memory creation failed for memory: 0x%x", dev_ptr);
HIP_RETURN(hipErrorInvalidDevicePointer);
}
@@ -2046,7 +2046,7 @@ hipError_t hipIpcOpenMemHandle(void** dev_ptr, hipIpcMemHandle_t handle, unsigne
}
if(!device->IpcAttach(&(ihandle->ipc_handle), ihandle->psize, flags, dev_ptr)) {
DevLogPrintfError("cannot attach ipc_handle: with ipc_size: %u flags: %u", ihandle->psize, flags);
LogPrintfError("cannot attach ipc_handle: with ipc_size: %u flags: %u", ihandle->psize, flags);
HIP_RETURN(hipErrorInvalidDevicePointer);
}
@@ -2143,11 +2143,11 @@ hipError_t hipPointerGetAttributes(hipPointerAttribute_t* attributes, const void
}
++device;
}
DevLogPrintfError("Cannot find memory object context, memObjCtx: 0x%x \n", memObjCtx);
LogPrintfError("Cannot find memory object context, memObjCtx: 0x%x \n", memObjCtx);
HIP_RETURN(hipErrorInvalidDevice);
}
DevLogPrintfError("Cannot get amd_mem_obj for ptr: 0x%x \n", ptr);
LogPrintfError("Cannot get amd_mem_obj for ptr: 0x%x \n", ptr);
HIP_RETURN(hipErrorInvalidValue);
}
+6 -8
Melihat File
@@ -89,8 +89,7 @@ hipError_t hipModuleGetFunction(hipFunction_t *hfunc, hipModule_t hmod, const ch
}
if (hipSuccess != PlatformState::instance().getDynFunc(hfunc, hmod, name)) {
DevLogPrintfError("Cannot find the function: %s for module: 0x%x \n",
name, hmod);
LogPrintfError("Cannot find the function: %s for module: 0x%x \n", name, hmod);
HIP_RETURN(hipErrorNotFound);
}
@@ -107,8 +106,8 @@ hipError_t hipModuleGetGlobal(hipDeviceptr_t* dptr, size_t* bytes, hipModule_t h
/* Get address and size for the global symbol */
if (hipSuccess != PlatformState::instance().getDynGlobalVar(name, hmod, dptr, bytes)) {
DevLogPrintfError("Cannot find global Var: %s for module: 0x%x at device: %d \n",
name, hmod, ihipGetDevice());
LogPrintfError("Cannot find global Var: %s for module: 0x%x at device: %d \n", name, hmod,
ihipGetDevice());
HIP_RETURN(hipErrorNotFound);
}
@@ -225,11 +224,11 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX,
HIP_RETURN_ONFAIL(PlatformState::instance().initStatManagedVarDevicePtr(ihipGetDevice()));
if (f == nullptr) {
DevLogPrintfError("%s", "Function passed is null");
LogPrintfError("%s", "Function passed is null");
return hipErrorInvalidImage;
}
if ((kernelParams != nullptr) && (extra != nullptr)) {
DevLogPrintfError(
LogPrintfError(
"%s", "Both, kernelParams and extra Params are provided, only one should be provided");
return hipErrorInvalidValue;
}
@@ -603,8 +602,7 @@ hipError_t hipModuleGetTexRef(textureReference** texRef, hipModule_t hmod, const
/* Get address and size for the global symbol */
if (hipSuccess != PlatformState::instance().getDynTexRef(name, hmod, texRef)) {
DevLogPrintfError("Cannot get texRef for name: %s at module:0x%x \n",
name, hmod);
LogPrintfError("Cannot get texRef for name: %s at module:0x%x \n", name, hmod);
HIP_RETURN(hipErrorNotFound);
}
+1 -1
Melihat File
@@ -159,7 +159,7 @@ hipError_t hipDeviceGetP2PAttribute(int* value, hipDeviceP2PAttr attr,
break;
}
default : {
DevLogPrintfError("Invalid attribute attr: %d ", attr);
LogPrintfError("Invalid attribute attr: %d ", attr);
HIP_RETURN(hipErrorInvalidValue);
break;
}
+14 -14
Melihat File
@@ -77,8 +77,8 @@ extern "C" hip::FatBinaryInfo** __hipRegisterFatBinary(const void* data)
{
const __CudaFatBinaryWrapper* fbwrapper = reinterpret_cast<const __CudaFatBinaryWrapper*>(data);
if (fbwrapper->magic != __hipFatMAGIC2 || fbwrapper->version != 1) {
DevLogPrintfError("Cannot Register fat binary. FatMagic: %u version: %u ",
fbwrapper->magic, fbwrapper->version);
LogPrintfError("Cannot Register fat binary. FatMagic: %u version: %u ", fbwrapper->magic,
fbwrapper->version);
return nullptr;
}
return PlatformState::instance().addFatBinary(fbwrapper->binary);
@@ -244,13 +244,13 @@ extern "C" hipError_t hipLaunchByPtr(const void *hostFunction)
hip::Stream* stream = reinterpret_cast<hip::Stream*>(exec.hStream_);
int deviceId = (stream != nullptr)? stream->DeviceId() : ihipGetDevice();
if (deviceId == -1) {
DevLogPrintfError("Wrong DeviceId: %d \n", deviceId);
LogPrintfError("Wrong DeviceId: %d \n", deviceId);
HIP_RETURN(hipErrorNoDevice);
}
hipFunction_t func = nullptr;
hipError_t hip_error = PlatformState::instance().getStatFunc(&func, hostFunction, deviceId);
if ((hip_error != hipSuccess) || (func == nullptr)) {
DevLogPrintfError("Could not retrieve hostFunction: 0x%x \n", hostFunction);
LogPrintfError("Could not retrieve hostFunction: 0x%x \n", hostFunction);
HIP_RETURN(hipErrorInvalidDeviceFunction);
}
@@ -300,12 +300,12 @@ hipError_t ihipCreateGlobalVarObj(const char* name, hipModule_t hmod, amd::Memor
dev_program = program->getDeviceProgram(*hip::getCurrentDevice()->devices()[0]);
if (dev_program == nullptr) {
DevLogPrintfError("Cannot get Device Function for module: 0x%x \n", hmod);
LogPrintfError("Cannot get Device Function for module: 0x%x \n", hmod);
HIP_RETURN(hipErrorInvalidDeviceFunction);
}
/* Find the global Symbols */
if (!dev_program->createGlobalVarObj(amd_mem_obj, dptr, bytes, name)) {
DevLogPrintfError("Cannot create Global Var obj for symbol: %s \n", name);
LogPrintfError("Cannot create Global Var obj for symbol: %s \n", name);
HIP_RETURN(hipErrorInvalidSymbol);
}
@@ -578,13 +578,13 @@ void hipLaunchKernelGGLImpl(
hip::Stream* s = reinterpret_cast<hip::Stream*>(stream);
int deviceId = (s != nullptr)? s->DeviceId() : ihipGetDevice();
if (deviceId == -1) {
DevLogPrintfError("Wrong Device Id: %d \n", deviceId);
LogPrintfError("Wrong Device Id: %d \n", deviceId);
}
hipFunction_t func = nullptr;
hipError_t hip_error = PlatformState::instance().getStatFunc(&func, reinterpret_cast<void*>(function_address), deviceId);
if ((hip_error != hipSuccess) || (func == nullptr)) {
DevLogPrintfError("Cannot find the static function: 0x%x", function_address);
LogPrintfError("Cannot find the static function: 0x%x", function_address);
}
hipModuleLaunchKernel(func,
@@ -624,7 +624,7 @@ hipError_t ihipLaunchKernel(const void* hostFunction,
hip::Stream* s = reinterpret_cast<hip::Stream*>(stream);
int deviceId = (s != nullptr)? s->DeviceId() : ihipGetDevice();
if (deviceId == -1) {
DevLogPrintfError("Wrong Device Id: %d \n", deviceId);
LogPrintfError("Wrong Device Id: %d \n", deviceId);
HIP_RETURN(hipErrorNoDevice);
}
@@ -779,7 +779,7 @@ hipError_t PlatformState::getDynFunc(hipFunction_t* hfunc, hipModule_t hmod,
auto it = dynCO_map_.find(hmod);
if (it == dynCO_map_.end()) {
DevLogPrintfError("Cannot find the module: 0x%x", hmod);
LogPrintfError("Cannot find the module: 0x%x", hmod);
return hipErrorNotFound;
}
if (0 == strlen(func_name)) {
@@ -799,7 +799,7 @@ hipError_t PlatformState::getDynGlobalVar(const char* hostVar, hipModule_t hmod,
auto it = dynCO_map_.find(hmod);
if (it == dynCO_map_.end()) {
DevLogPrintfError("Cannot find the module: 0x%x", hmod);
LogPrintfError("Cannot find the module: 0x%x", hmod);
return hipErrorNotFound;
}
@@ -824,13 +824,13 @@ hipError_t PlatformState::getDynTexGlobalVar(textureReference* texRef, hipDevice
auto tex_it = texRef_map_.find(texRef);
if (tex_it == texRef_map_.end()) {
DevLogPrintfError("Cannot find the texRef Entry: 0x%x", texRef);
LogPrintfError("Cannot find the texRef Entry: 0x%x", texRef);
return hipErrorNotFound;
}
auto it = dynCO_map_.find(tex_it->second.first);
if (it == dynCO_map_.end()) {
DevLogPrintfError("Cannot find the module: 0x%x", tex_it->second.first);
LogPrintfError("Cannot find the module: 0x%x", tex_it->second.first);
return hipErrorNotFound;
}
@@ -847,7 +847,7 @@ hipError_t PlatformState::getDynTexRef(const char* hostVar, hipModule_t hmod, te
auto it = dynCO_map_.find(hmod);
if (it == dynCO_map_.end()) {
DevLogPrintfError("Cannot find the module: 0x%x", hmod);
LogPrintfError("Cannot find the module: 0x%x", hmod);
return hipErrorNotFound;
}
+3 -3
Melihat File
@@ -82,7 +82,7 @@ char* demangle(const char* loweredName) {
int status = 0;
char* demangledName = DEMANGLE(loweredName, nullptr, nullptr, &status);
if (status != 0) {
DevLogPrintfError("Cannot demangle loweredName: %s \n", loweredName);
LogPrintfError("Cannot demangle loweredName: %s \n", loweredName);
return nullptr;
}
#elif defined(_WIN32)
@@ -92,7 +92,7 @@ char* demangle(const char* loweredName) {
UNDECORATED_SIZE/ sizeof(*demangledName), UNDNAME_COMPLETE))
{
free(demangledName);
DevLogPrintfError("Cannot undecorate loweredName: %s demangledName: %s \n",
LogPrintfError("Cannot undecorate loweredName: %s demangledName: %s \n",
loweredName, demangledName);
return nullptr;
}
@@ -198,7 +198,7 @@ const char* hiprtcGetErrorString(hiprtcResult x) {
case HIPRTC_ERROR_INTERNAL_ERROR:
return "HIPRTC_ERROR_INTERNAL_ERROR";
default:
DevLogPrintfError("Invalid HIPRTC error code: %d \n", x);
LogPrintfError("Invalid HIPRTC error code: %d \n", x);
return nullptr;
};
+11 -7
Melihat File
@@ -392,7 +392,7 @@ inline bool ihipGetTextureAlignmentOffset(size_t* offset,
// If the device memory pointer was returned from hipMalloc(),
// the offset is guaranteed to be 0 and NULL may be passed as the offset parameter.
if ((alignedOffset != 0) && (offset == nullptr)) {
DevLogPrintfError("Texture object not aligned with offset %u \n", alignedOffset);
LogPrintfError("Texture object not aligned with offset %u \n", alignedOffset);
return false;
}
@@ -734,8 +734,10 @@ hipError_t hipTexRefGetAddressMode(hipTextureAddressMode* pam,
// Currently, the only valid value for dim are 0 and 1.
if ((dim != 0) && (dim != 1)) {
DevLogPrintfError("Currently only 2 dimensions (0,1) are valid,"
"dim : %d \n", dim);
LogPrintfError(
"Currently only 2 dimensions (0,1) are valid,"
"dim : %d \n",
dim);
HIP_RETURN(hipErrorInvalidValue);
}
@@ -754,8 +756,10 @@ hipError_t hipTexRefSetAddressMode(textureReference* texRef,
}
if ((dim < 0) || (dim > 2)) {
DevLogPrintfError("Currently only 3 dimensions (0,1,2) are valid,"
"dim : %d \n", dim);
LogPrintfError(
"Currently only 3 dimensions (0,1,2) are valid,"
"dim : %d \n",
dim);
HIP_RETURN(hipErrorInvalidValue);
}
@@ -849,8 +853,8 @@ hipError_t hipTexRefGetAddress(hipDeviceptr_t* dptr,
// TODO use ihipGetTextureObjectResourceDesc() to not pollute the API trace.
hipError_t error = hipGetTextureObjectResourceDesc(&resDesc, texRef->textureObject);
if (error != hipSuccess) {
DevLogPrintfError("hipGetTextureObjectResourceDesc failed with error code: %s \n",
hipGetErrorName(error));
LogPrintfError("hipGetTextureObjectResourceDesc failed with error code: %s \n",
hipGetErrorName(error));
HIP_RETURN(error);
}