[HIP] add cooperative kernel launch APIs on NVCC (#1929)

Этот коммит содержится в:
Aryan Salmanpour
2020-03-17 04:31:11 -04:00
коммит произвёл GitHub
родитель 55e55e78bb
Коммит 015895a265
+26
Просмотреть файл
@@ -186,6 +186,7 @@ typedef struct cudaArray hipArray;
typedef struct cudaArray* hipArray_t;
typedef struct cudaArray* hipArray_const_t;
typedef struct cudaFuncAttributes hipFuncAttributes;
typedef struct cudaLaunchParams hipLaunchParams;
#define hipFunction_attribute CUfunction_attribute
#define hip_Memcpy2D CUDA_MEMCPY2D
#define hipMemcpy3DParms cudaMemcpy3DParms
@@ -1275,6 +1276,12 @@ inline static hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t att
case hipDeviceAttributeEccEnabled:
cdattr = cudaDevAttrEccEnabled;
break;
case hipDeviceAttributeCooperativeLaunch:
cdattr = cudaDevAttrCooperativeLaunch;
break;
case hipDeviceAttributeCooperativeMultiDeviceLaunch:
cdattr = cudaDevAttrCooperativeMultiDeviceLaunch;
break;
default:
return hipCUDAErrorTohipError(cudaErrorInvalidValue);
}
@@ -1683,6 +1690,17 @@ inline static hipError_t hipGetChannelDesc(hipChannelFormatDesc* desc, hipArray_
return hipCUDAErrorTohipError(cudaGetChannelDesc(desc,array));
}
inline static hipError_t hipLaunchCooperativeKernel(const void* f, dim3 gridDim, dim3 blockDim,
void** kernelParams, unsigned int sharedMemBytes,
hipStream_t stream) {
return hipCUDAErrorTohipError(
cudaLaunchCooperativeKernel(f, gridDim, blockDim, kernelParams, sharedMemBytes, stream));
}
inline static hipError_t hipLaunchCooperativeKernelMultiDevice(hipLaunchParams* launchParamsList,
int numDevices, unsigned int flags) {
return hipCUDAErrorTohipError(cudaLaunchCooperativeKernelMultiDevice(launchParamsList, numDevices, flags));
}
#ifdef __cplusplus
}
@@ -1746,6 +1764,14 @@ template <class T>
inline static hipChannelFormatDesc hipCreateChannelDesc() {
return cudaCreateChannelDesc<T>();
}
template <class T>
inline static hipError_t hipLaunchCooperativeKernel(T f, dim3 gridDim, dim3 blockDim,
void** kernelParams, unsigned int sharedMemBytes, hipStream_t stream) {
return hipCUDAErrorTohipError(
cudaLaunchCooperativeKernel(f, gridDim, blockDim, kernelParams, sharedMemBytes, stream));
}
#endif //__CUDACC__
#endif // HIP_INCLUDE_HIP_NVCC_DETAIL_HIP_RUNTIME_API_H