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: f695910290]
This commit is contained in:
foreman
2019-04-05 14:51:37 -04:00
parent a0f0714729
commit 00680db557
+3 -9
View File
@@ -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);
}