SWDEV-240800 - Adding initial support for hipDeviceGetP2PAttribute. Some attr support still pending.

Change-Id: I0611aed136270db497dfa374144f6f5e35352a8f
This commit is contained in:
kjayapra-amd
2020-07-17 17:29:32 -04:00
committed by Karthik Jayaprakash
parent f8e6b228a7
commit 4d42a969fd
6 changed files with 69 additions and 11 deletions
+20
View File
@@ -95,6 +95,13 @@ typedef struct ihipCtx_t* hipCtx_t;
// Note many APIs also use integer deviceIds as an alternative to the device pointer:
typedef int hipDevice_t;
typedef enum hipDeviceP2PAttr {
hipDevP2PAttrPerformanceRank = 0,
hipDevP2PAttrAccessSupported,
hipDevP2PAttrNativeAtomicSupported,
hipDevP2PAttrHipArrayAccessSupported
} hipDeviceP2PAttr;
typedef struct ihipStream_t* hipStream_t;
#define hipIpcMemLazyEnablePeerAccess 0
@@ -2799,6 +2806,19 @@ hipError_t hipDeviceComputeCapability(int* major, int* minor, hipDevice_t device
*/
hipError_t hipDeviceGetName(char* name, int len, hipDevice_t device);
/**
* @brief Returns a value for attr of link between two devices
* @param [out] value
* @param [in] attr
* @param [in] srcDevice
* @param [in] dstDevice
*
* @returns #hipSuccess, #hipErrorInavlidDevice
*/
hipError_t hipDeviceGetP2PAttribute(int* value, hipDeviceP2PAttr attr,
int srcDevice, int dstDevice);
/**
* @brief Returns a PCI Bus Id string for the device, overloaded to take int device ID.
* @param [out] pciBusId
+6
View File
@@ -179,6 +179,7 @@ typedef enum cudaSharedMemConfig hipSharedMemConfig;
typedef CUfunc_cache hipFuncCache;
typedef CUjit_option hipJitOption;
typedef CUdevice hipDevice_t;
typedef enum cudaDeviceP2PAttr hipDeviceP2PAttr;
typedef CUmodule hipModule_t;
typedef CUfunction hipFunction_t;
typedef CUdeviceptr hipDeviceptr_t;
@@ -1606,6 +1607,11 @@ inline static hipError_t hipDeviceGetName(char* name, int len, hipDevice_t devic
return hipCUResultTohipError(cuDeviceGetName(name, len, device));
}
inline static hipError_t hipDeviceGetP2PAttribute(int* value, hipDeviceP2PAttr attr,
int srcDevice, int dstDevice) {
return hipCUDAErrorTohipError(cudaDeviceGetP2PAttribute(value, attr, srcDevice, dstDevice));
}
inline static hipError_t hipDeviceGetPCIBusId(char* pciBusId, int len, hipDevice_t device) {
return hipCUDAErrorTohipError(cudaDeviceGetPCIBusId(pciBusId, len, device));
}