SWDEV-406233 - Add notes on hipMemoryType and PointerGetAttributes API for unsupported cuda enum
Change-Id: I1175c12a55c7cd306a5aed3f1a400ae7525f4cb5
Этот коммит содержится в:
коммит произвёл
Julia Jiang
родитель
d8ce5a0271
Коммит
fffa5eab08
@@ -461,11 +461,12 @@ In this case, memory type translation for hipPointerGetAttributes needs to be ha
|
||||
|
||||
So in any HIP applications which use HIP APIs involving memory types, developers should use #ifdef in order to assign the correct enum values depending on Nvidia or AMD platform.
|
||||
|
||||
As an example, please see the code from the link,
|
||||
github.com/ROCm-Developer-Tools/HIP/blob/develop/tests/catch/unit/memory/hipMemcpyParam2D.cc#L77-L96.
|
||||
As an example, please see the code from the [link](github.com/ROCm-Developer-Tools/HIP/blob/develop/tests/catch/unit/memory/hipMemcpyParam2D.cc).
|
||||
|
||||
With the #ifdef condition, HIP APIs work as expected on both AMD and NVIDIA platforms.
|
||||
|
||||
Note, cudaMemoryType enum value cudaMemoryTypeUnregstered is not supported currently in hipMemoryType, due to HIP functionality backward compatibility.
|
||||
|
||||
## threadfence_system
|
||||
Threadfence_system makes all device memory writes, all writes to mapped host memory, and all writes to peer memory visible to CPU and other GPU devices.
|
||||
Some implementations can provide this behavior by flushing the GPU L2 cache.
|
||||
|
||||
@@ -30,7 +30,6 @@ THE SOFTWARE.
|
||||
#ifndef HIP_INCLUDE_HIP_HIP_RUNTIME_API_H
|
||||
#define HIP_INCLUDE_HIP_HIP_RUNTIME_API_H
|
||||
|
||||
|
||||
#include <string.h> // for getDeviceProp
|
||||
#include <hip/hip_version.h>
|
||||
#include <hip/hip_common.h>
|
||||
@@ -164,6 +163,13 @@ typedef struct hipDeviceProp_t {
|
||||
/**
|
||||
* hipMemoryType (for pointer attributes)
|
||||
*
|
||||
* @note hipMemoryType enum values are different from cudaMemoryType enum values.
|
||||
* In this case, memory type translation for hipPointerGetAttributes needs to be handled properly
|
||||
* on nvidia platform to get the correct memory type in CUDA. Developers should use #ifdef in order
|
||||
* to assign the correct enum values depending on Nvidia or AMD platform.
|
||||
*
|
||||
* @note cudaMemoryTypeUnregistered is currently not supported due to HIP functionality backward
|
||||
* compatibility.
|
||||
*/
|
||||
typedef enum hipMemoryType {
|
||||
hipMemoryTypeHost = 0, ///< Memory is physically located on host
|
||||
@@ -2616,8 +2622,12 @@ hipError_t hipPointerSetAttribute(const void* value, hipPointer_attribute attrib
|
||||
* @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.
|
||||
* @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.
|
||||
*
|
||||
* @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue
|
||||
*
|
||||
|
||||
Ссылка в новой задаче
Block a user