From 46737b278aa1bd2addb20895df2632577486f73d Mon Sep 17 00:00:00 2001 From: Tao Sang Date: Thu, 22 Jul 2021 09:41:20 -0400 Subject: [PATCH] SWDEV-294596 - Make hipModuleGetGlobal match cuda Make hipModuleGetGlobal match cuModuleGetGlobal behavour. That is, if one of the first two parameters is nullptr, ignore it. Change-Id: I3fe6dbc35a7b14aa9119df297b7885df83d28048 [ROCm/clr commit: b58355b0657f31630eeace5d83f9d6330cd9aa26] --- projects/clr/hipamd/src/hip_module.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/clr/hipamd/src/hip_module.cpp b/projects/clr/hipamd/src/hip_module.cpp index 0316819821..0be7846bbf 100755 --- a/projects/clr/hipamd/src/hip_module.cpp +++ b/projects/clr/hipamd/src/hip_module.cpp @@ -100,10 +100,13 @@ hipError_t hipModuleGetGlobal(hipDeviceptr_t* dptr, size_t* bytes, hipModule_t h { HIP_INIT_API(hipModuleGetGlobal, dptr, bytes, hmod, name); - if(dptr == nullptr || bytes == nullptr || name == nullptr) { + if (dptr == nullptr || bytes == nullptr) { + // If either is nullptr, ignore it + return hipSuccess; + } + if (name == nullptr) { return hipErrorInvalidValue; } - /* Get address and size for the global symbol */ if (hipSuccess != PlatformState::instance().getDynGlobalVar(name, hmod, dptr, bytes)) { LogPrintfError("Cannot find global Var: %s for module: 0x%x at device: %d \n", name, hmod,