Changed module api to work with nvcc and hipcc path
- Added cuda and cudart linking for nvcc path in hipcc - Added hipMemcpyHtoD and hipMemcpyDtoH for nvcc path - Changed hipDeviceptr to hipDeviceptr_t - Fixed hipMemcpy*to* API signatues Change-Id: I6ef076b507f92502efda475c83dcdcdd462afc37
This commit is contained in:
+1
-1
@@ -151,7 +151,7 @@ if ($HIP_PLATFORM eq "hcc") {
|
||||
$HIPCC="$CUDA_PATH/bin/nvcc";
|
||||
$HIPCXXFLAGS .= " -I$CUDA_PATH/include";
|
||||
|
||||
$HIPLDFLAGS = "";
|
||||
$HIPLDFLAGS = "-lcuda -lcudart";
|
||||
} else {
|
||||
printf ("error: unknown HIP_PLATFORM = '$HIP_PLATFORM'");
|
||||
exit (-1);
|
||||
|
||||
@@ -56,7 +56,7 @@ typedef struct ihipModule_t *hipModule_t;
|
||||
|
||||
typedef struct ihipFunction_t *hipFunction_t;
|
||||
|
||||
typedef void* hipDeviceptr;
|
||||
typedef void* hipDeviceptr_t;
|
||||
|
||||
typedef struct ihipEvent_t *hipEvent_t;
|
||||
|
||||
@@ -844,13 +844,13 @@ hipError_t hipHostFree(void* ptr);
|
||||
*/
|
||||
hipError_t hipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind);
|
||||
|
||||
hipError_t hipMemcpyHtoD(hipDeviceptr dst, hipDeviceptr src, size_t sizeBytes);
|
||||
hipError_t hipMemcpyHtoD(hipDeviceptr_t dst, void* src, size_t sizeBytes);
|
||||
|
||||
hipError_t hipMemcpyDtoH(hipDeviceptr dst, hipDeviceptr src, size_t sizeBytes);
|
||||
hipError_t hipMemcpyDtoH(void* dst, hipDeviceptr_t src, size_t sizeBytes);
|
||||
|
||||
hipError_t hipMemcpyDtoD(hipDeviceptr dst, hipDeviceptr src, size_t sizeBytes);
|
||||
hipError_t hipMemcpyDtoD(hipDeviceptr_t dst, hipDeviceptr_t src, size_t sizeBytes);
|
||||
|
||||
hipError_t hipMemcpyHtoH(hipDeviceptr dst, hipDeviceptr src, size_t sizeBytes);
|
||||
hipError_t hipMemcpyHtoH(void* dst, void* src, size_t sizeBytes);
|
||||
|
||||
|
||||
/**
|
||||
@@ -1148,7 +1148,7 @@ hipError_t hipModuleUnload(hipModule_t module);
|
||||
|
||||
hipError_t hipModuleGetFunction(hipFunction_t *function, hipModule_t module, const char *kname);
|
||||
|
||||
hipError_t hipModuleGetGlobal(hipDeviceptr *dptr, size_t *bytes, hipModule_t hmod, const char *name);
|
||||
hipError_t hipModuleGetGlobal(hipDeviceptr_t *dptr, size_t *bytes, hipModule_t hmod, const char *name);
|
||||
|
||||
hipError_t hipModuleLoadData(hipModule_t *module, const void *image);
|
||||
|
||||
|
||||
@@ -58,15 +58,19 @@ hipMemcpyHostToHost
|
||||
#define hipHostRegisterPortable cudaHostRegisterPortable
|
||||
#define hipHostRegisterMapped cudaHostRegisterMapped
|
||||
|
||||
#define HIP_LAUNCH_PARAM_BUFFER_POINTER CU_LAUNCH_PARAM_BUFFER_POINTER
|
||||
#define HIP_LAUNCH_PARAM_BUFFER_SIZE CU_LAUNCH_PARAM_BUFFER_SIZE
|
||||
#define HIP_LAUNCH_PARAM_END CU_LAUNCH_PARAM_END
|
||||
|
||||
typedef cudaEvent_t hipEvent_t;
|
||||
typedef cudaStream_t hipStream_t;
|
||||
typedef CUcontext hipCtx_t;
|
||||
typedef CUsharedconfig hipSharedMemConfig;
|
||||
typedef CUfunc_cache hipFuncCache;
|
||||
typedef CUdevice hipDevice_t;
|
||||
typedef CUModule hipModule_t;
|
||||
typedef CUFunction hipFunction_t;
|
||||
typedef CUdeviceptr hipDeviceptr;
|
||||
typedef CUmodule hipModule_t;
|
||||
typedef CUfunction hipFunction_t;
|
||||
typedef CUdeviceptr hipDeviceptr_t;
|
||||
|
||||
//typedef cudaChannelFormatDesc hipChannelFormatDesc;
|
||||
#define hipChannelFormatDesc cudaChannelFormatDesc
|
||||
@@ -202,6 +206,19 @@ inline static hipError_t hipHostFree(void* ptr) {
|
||||
inline static hipError_t hipSetDevice(int device) {
|
||||
return hipCUDAErrorTohipError(cudaSetDevice(device));
|
||||
}
|
||||
|
||||
inline static hipError_t hipMemcpyHtoD(hipDeviceptr_t dst,
|
||||
void* src, size_t size)
|
||||
{
|
||||
return hipCUResultTohipError(cuMemcpyHtoD(dst, src, size));
|
||||
}
|
||||
|
||||
inline static hipError_t hipMemcpyDtoH(void* dst,
|
||||
hipDeviceptr_t src, size_t size)
|
||||
{
|
||||
return hipCUResultTohipError(cuMemcpyDtoH(dst, src, size));
|
||||
}
|
||||
|
||||
inline static hipError_t hipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind copyKind) {
|
||||
return hipCUDAErrorTohipError(cudaMemcpy(dst, src, sizeBytes, hipMemcpyKindToCudaMemcpyKind(copyKind)));
|
||||
}
|
||||
@@ -464,7 +481,6 @@ inline static hipError_t hipDriverGetVersion(int *driverVersion)
|
||||
return hipCUDAErrorTohipError(err);
|
||||
}
|
||||
|
||||
|
||||
inline static hipError_t hipDeviceCanAccessPeer ( int* canAccessPeer, int device, int peerDevice )
|
||||
{
|
||||
return hipCUDAErrorTohipError(cudaDeviceCanAccessPeer(canAccessPeer, device, peerDevice));
|
||||
@@ -585,6 +601,16 @@ inline static hipError_t hipCtxGetFlags ( unsigned int* flags )
|
||||
return hipCUResultTohipError(cuCtxGetFlags ( flags ));
|
||||
}
|
||||
|
||||
inline static hipError_t hipCtxDetach(hipCtx_t ctx)
|
||||
{
|
||||
return hipCUResultTohipError(cuCtxDetach(ctx));
|
||||
}
|
||||
|
||||
inline static hipError_t hipDeviceGet(hipDevice_t *device, int ordinal)
|
||||
{
|
||||
return hipCUResultTohipError(cuDeviceGet(device, ordinal));
|
||||
}
|
||||
|
||||
inline static hipError_t hipModuleLoad(hipModule_t *module, const char* fname)
|
||||
{
|
||||
return hipCUResultTohipError(cuModuleLoad(module, fname));
|
||||
@@ -601,7 +627,7 @@ inline static hipError_t hipModuleGetFunction(hipFunction_t *function,
|
||||
return hipCUResultTohipError(cuModuleGetFunction(function, module, kname));
|
||||
}
|
||||
|
||||
inline static hipError_t hipModuleGetGlobal(hipDeviceptr *dptr, size_t *bytes,
|
||||
inline static hipError_t hipModuleGetGlobal(hipDeviceptr_t *dptr, size_t *bytes,
|
||||
hipModule_t hmod, const char* name)
|
||||
{
|
||||
return hipCUResultTohipError(cuModuleGetGlobal(dptr, bytes, hmod, name));
|
||||
@@ -621,7 +647,7 @@ inline static hipError_t hipModuleLaunchKernel(hipFunction_t f,
|
||||
return hipCUResultTohipError(cuLaunchKernel(f,
|
||||
gridDimX, gridDimY, gridDimZ,
|
||||
blockDimX, blockDimY, blockDimZ,
|
||||
shreadMemBytes, stream, kernelParams, extra);
|
||||
sharedMemBytes, stream, kernelParams, extra));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -449,7 +449,7 @@ hipError_t hipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind
|
||||
return ihipLogStatus(e);
|
||||
}
|
||||
|
||||
hipError_t hipMemcpyHtoD(hipDeviceptr dst, hipDeviceptr src, size_t sizeBytes)
|
||||
hipError_t hipMemcpyHtoD(hipDeviceptr_t dst, void* src, size_t sizeBytes)
|
||||
{
|
||||
HIP_INIT_API(dst, src, sizeBytes);
|
||||
|
||||
@@ -471,7 +471,7 @@ hipError_t hipMemcpyHtoD(hipDeviceptr dst, hipDeviceptr src, size_t sizeBytes)
|
||||
}
|
||||
|
||||
|
||||
hipError_t hipMemcpyDtoH(hipDeviceptr dst, hipDeviceptr src, size_t sizeBytes)
|
||||
hipError_t hipMemcpyDtoH(void* dst, hipDeviceptr_t src, size_t sizeBytes)
|
||||
{
|
||||
HIP_INIT_API(dst, src, sizeBytes);
|
||||
|
||||
@@ -492,7 +492,7 @@ hipError_t hipMemcpyDtoH(hipDeviceptr dst, hipDeviceptr src, size_t sizeBytes)
|
||||
return ihipLogStatus(e);
|
||||
}
|
||||
|
||||
hipError_t hipMemcpyDtoD(hipDeviceptr dst, hipDeviceptr src, size_t sizeBytes)
|
||||
hipError_t hipMemcpyDtoD(hipDeviceptr_t dst, hipDeviceptr_t src, size_t sizeBytes)
|
||||
{
|
||||
HIP_INIT_API(dst, src, sizeBytes);
|
||||
|
||||
@@ -513,7 +513,7 @@ hipError_t hipMemcpyDtoD(hipDeviceptr dst, hipDeviceptr src, size_t sizeBytes)
|
||||
return ihipLogStatus(e);
|
||||
}
|
||||
|
||||
hipError_t hipMemcpyHtoH(hipDeviceptr dst, hipDeviceptr src, size_t sizeBytes)
|
||||
hipError_t hipMemcpyHtoH(void* dst, void* src, size_t sizeBytes)
|
||||
{
|
||||
HIP_INIT_API(dst, src, sizeBytes);
|
||||
|
||||
|
||||
@@ -280,7 +280,7 @@ Kernel argument preparation.
|
||||
}
|
||||
|
||||
|
||||
hipError_t hipModuleGetGlobal(hipDeviceptr *dptr, size_t *bytes,
|
||||
hipError_t hipModuleGetGlobal(hipDeviceptr_t *dptr, size_t *bytes,
|
||||
hipModule_t hmod, const char* name){
|
||||
HIP_INIT_API(name);
|
||||
hipError_t ret = hipSuccess;
|
||||
|
||||
مرجع در شماره جدید
Block a user