From 934eca953a6faf48a3a73e19d670a4f3fe06d994 Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 2 Aug 2018 18:52:37 -0400
Subject: [PATCH] P4 to Git Change 1589062 by cpaquot@cpaquot-ocl-lc-lnx on
2018/08/02 18:34:20
SWDEV-145570 - [HIP] Fix a segfault exposed by rocBlas.
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#39 edit
[ROCm/clr commit: 08a308dd59b8b7129d1059b3af8b9079018ae9a8]
---
projects/clr/hipamd/api/hip/hip_memory.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/projects/clr/hipamd/api/hip/hip_memory.cpp b/projects/clr/hipamd/api/hip/hip_memory.cpp
index d2cb3b7d8c..d4380eee0b 100644
--- a/projects/clr/hipamd/api/hip/hip_memory.cpp
+++ b/projects/clr/hipamd/api/hip/hip_memory.cpp
@@ -1299,7 +1299,6 @@ hipError_t hipPointerGetAttributes(hipPointerAttribute_t* attributes, const void
size_t offset = 0;
amd::Memory* memObj = getMemoryObject(ptr, offset);
- amd::Context &memObjCtx = memObj->getContext();
int device = 0;
if (memObj != nullptr) {
@@ -1308,6 +1307,8 @@ hipError_t hipPointerGetAttributes(hipPointerAttribute_t* attributes, const void
attributes->devicePointer = memObj->getSvmPtr();
attributes->isManaged = 0;
attributes->allocationFlags = memObj->getMemFlags();
+
+ amd::Context &memObjCtx = memObj->getContext();
for (auto& ctx : g_devices) {
++device;
if (*ctx == memObjCtx) {