From 46030bb2d2a30641023dd9a6d53266e32e9a5f9f Mon Sep 17 00:00:00 2001 From: Ben Sander Date: Tue, 16 May 2017 21:59:14 -0500 Subject: [PATCH] Return precise address for hipHostGetDevicePointer. --- src/hip_memory.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hip_memory.cpp b/src/hip_memory.cpp index 5501fec734..fc2ada134e 100644 --- a/src/hip_memory.cpp +++ b/src/hip_memory.cpp @@ -202,7 +202,8 @@ hipError_t hipHostGetDevicePointer(void **devicePointer, void *hostPointer, unsi hc::AmPointerInfo amPointerInfo(NULL, NULL, 0, acc, 0, 0); am_status_t status = hc::am_memtracker_getinfo(&amPointerInfo, hostPointer); if (status == AM_SUCCESS) { - *devicePointer = amPointerInfo._devicePointer; + *devicePointer = static_cast(amPointerInfo._devicePointer) + (static_cast(hostPointer) - static_cast(amPointerInfo._hostPointer)) ; + tprintf(DB_MEM, " host_ptr=%p returned device_pointer=%p\n", hostPointer, *devicePointer); } else { e = hipErrorMemoryAllocation; }