From d54665b0a09eac01a64afad661362be4700f0863 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/hip commit: 8e9e9416fd42364ea33d94cc74f8e9c467757300]
---
projects/hip/api/hip/hip_memory.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/projects/hip/api/hip/hip_memory.cpp b/projects/hip/api/hip/hip_memory.cpp
index d2cb3b7d8c..d4380eee0b 100644
--- a/projects/hip/api/hip/hip_memory.cpp
+++ b/projects/hip/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) {