From adf865621c35919e8168c4efebc8df2c280ae6a1 Mon Sep 17 00:00:00 2001 From: foreman Date: Tue, 6 Aug 2019 17:19:28 -0400 Subject: [PATCH] P4 to Git Change 1979123 by cpaquot@cpaquot-ocl-lc-lnx on 2019/08/06 17:15:10 SWDEV-198556 - [HIP] Gnarly bug due to macros: HIP_RETURN(ret) duplicates ret twice first by setting the last error then via LogDebugInfo. So if HIP_RETURN has a function as a parameter, the function would get called twice. So ihipMalloc and ihipMemcpy were being called twice (and perhaps more functions). Also logging the pointer returned by ihipMalloc so we can track memory in logs more easily. Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_internal.hpp#33 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#65 edit --- api/hip/hip_internal.hpp | 2 +- api/hip/hip_memory.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/hip/hip_internal.hpp b/api/hip/hip_internal.hpp index 5d32f1049f..86221b197e 100644 --- a/api/hip/hip_internal.hpp +++ b/api/hip/hip_internal.hpp @@ -159,7 +159,7 @@ extern amd::Memory* getMemoryObject(const void* ptr, size_t& offset); #define HIP_RETURN(ret) \ hip::g_lastError = ret; \ - LogPrintfInfo("[%zx] %s: Returned %s", std::this_thread::get_id(), __func__, hipGetErrorName(ret)); \ + LogPrintfInfo("[%zx] %s: Returned %s", std::this_thread::get_id(), __func__, hipGetErrorName(hip::g_lastError)); \ return hip::g_lastError; \ inline std::ostream& operator<<(std::ostream& os, const dim3& s) { diff --git a/api/hip/hip_memory.cpp b/api/hip/hip_memory.cpp index 46d84b8520..807874dc34 100644 --- a/api/hip/hip_memory.cpp +++ b/api/hip/hip_memory.cpp @@ -73,7 +73,7 @@ hipError_t ihipMalloc(void** ptr, size_t sizeBytes, unsigned int flags) if (*ptr == nullptr) { return hipErrorOutOfMemory; } - + LogPrintfInfo("ihipMalloc ptr=0x%zx", *ptr); return hipSuccess; }