From 00680db55742e33e7bb870d00917db45520c7f40 Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 5 Apr 2019 14:51:37 -0400
Subject: [PATCH] P4 to Git Change 1766349 by
michliao@hliao-dev-00-hip.rocm-workspace on 2019/04/05 14:24:45
SWDEV-144570 - Fix pointer attribute query.
- For memory not registered with runtime, return
`hipErrorInvalidValue`. That's the behavior expected to check whether
a host buffer is pinned.
- Return `hipErrorInvalidDevice` in case a registered memory object
cannot find its matching device.
RB: http://ocltc.amd.com/reviews/r/17094/
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#51 edit
[ROCm/clr commit: f69591029013e7dcea01f0b4853e0c2da10106e1]
---
projects/clr/hipamd/api/hip/hip_memory.cpp | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/projects/clr/hipamd/api/hip/hip_memory.cpp b/projects/clr/hipamd/api/hip/hip_memory.cpp
index 75f45414f0..9dfa4d4ddd 100644
--- a/projects/clr/hipamd/api/hip/hip_memory.cpp
+++ b/projects/clr/hipamd/api/hip/hip_memory.cpp
@@ -1459,18 +1459,12 @@ hipError_t hipPointerGetAttributes(hipPointerAttribute_t* attributes, const void
for (auto& ctx : g_devices) {
if (*ctx == memObjCtx) {
attributes->device = device;
- break;
+ HIP_RETURN(hipSuccess);
}
++device;
}
- } else {
- attributes->memoryType = hipMemoryTypeHost;
- attributes->hostPointer = (void*)ptr;
- attributes->devicePointer = 0;
- attributes->device = -1;
- attributes->isManaged = 0;
- attributes->allocationFlags = 0;
+ HIP_RETURN(hipErrorInvalidDevice);
}
- HIP_RETURN(hipSuccess);
+ HIP_RETURN(hipErrorInvalidValue);
}