From a40e2ba298bbd1714921f5ca2f4c0dca023fb447 Mon Sep 17 00:00:00 2001 From: Julia Jiang Date: Mon, 12 Feb 2024 15:23:27 -0500 Subject: [PATCH] SWDEV-444830 - hipPointerGetAttributes implements CUDA < 11.0 behavior Change-Id: Ifd06d8a4dac8d6672484592d5de2323d55b26d37 --- include/hip/hip_runtime_api.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/include/hip/hip_runtime_api.h b/include/hip/hip_runtime_api.h index c3c76f4c7e..32ff70b84c 100644 --- a/include/hip/hip_runtime_api.h +++ b/include/hip/hip_runtime_api.h @@ -2881,20 +2881,22 @@ hipError_t hipPointerSetAttribute(const void* value, hipPointer_attribute attrib /** - * @brief Return attributes for the specified pointer + * @brief Returns attributes for the specified pointer * * @param [out] attributes attributes for the specified pointer * @param [in] ptr pointer to get attributes for * - * @note: To get pointer's memory type, the parameter attributes has 'type' as member variable. - * The 'type' indicates input pointer is allocated on device or host. That means the input pointer - * must be returned or passed through an HIP API such as hipHostMalloc, hipMallocManaged, - * hipHostRegister, etc. Otherwise, the pointer can't be handled by this API and attributes - * returned hipErrorInvalidValue, due to the hipMemoryType enums values, unrecognized memory type - * is currently not supported due to HIP functionality backward compatibility. + * The output parameter 'attributes' has a member named 'type' that describes what memory the + * pointer is associated with, such as device memory, host memory, managed memory, and others. + * Otherwise, the API cannot handle the pointer and returns #hipErrorInvalidValue. + * + * @note The unrecognized memory type is unsupported to keep the HIP functionality backward + * compatibility due to #hipMemoryType enum values. * * @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue * + * @note The current behavior of this HIP API corresponds to the CUDA API before version 11.0. + * * @see hipPointerGetAttribute */ hipError_t hipPointerGetAttributes(hipPointerAttribute_t* attributes, const void* ptr);