From 0f67004f12d17c941b30695076d2e935f5cb8809 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 --- api/hip/hip_memory.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/api/hip/hip_memory.cpp b/api/hip/hip_memory.cpp index 75f45414f0..9dfa4d4ddd 100644 --- a/api/hip/hip_memory.cpp +++ b/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); }