From 9eab4cd8263cc026fde4d355a20db843679e4b36 Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 4 Apr 2019 17:50:08 -0400
Subject: [PATCH] P4 to Git Change 1766076 by
michliao@hliao-dev-00-hip.rocm-workspace on 2019/04/04 17:35:28
SWDEV-144570 - Fix pointer attribute query.
- Device should be numbered from zero.
RB: http://ocltc.amd.com/reviews/r/17090/
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#49 edit
[ROCm/hip commit: 41c75b2f8df96ba4831c563bddc84225fe2ec363]
---
projects/hip/api/hip/hip_memory.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/projects/hip/api/hip/hip_memory.cpp b/projects/hip/api/hip/hip_memory.cpp
index ae052d6288..2c8c30b588 100644
--- a/projects/hip/api/hip/hip_memory.cpp
+++ b/projects/hip/api/hip/hip_memory.cpp
@@ -1452,14 +1452,14 @@ hipError_t hipPointerGetAttributes(hipPointerAttribute_t* attributes, const void
attributes->devicePointer = memObj->getSvmPtr();
attributes->isManaged = 0;
attributes->allocationFlags = memObj->getMemFlags() >> 16;
-
+
amd::Context &memObjCtx = memObj->getContext();
for (auto& ctx : g_devices) {
- ++device;
if (*ctx == memObjCtx) {
attributes->device = device;
break;
}
+ ++device;
}
} else {
attributes->memoryType = hipMemoryTypeHost;