Modify header such that it's compatible with strict C compiler
[ROCm/clr commit: 8302138d57]
Цей коміт міститься в:
1 джерело
5ba2f6ea57
коміт
ef8c6a67fc
1 file changed
+31
-25
@@ -31,6 +31,13 @@ THE SOFTWARE.
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define __dparm(x) \
|
||||||
|
= x
|
||||||
|
#else
|
||||||
|
#define __dparm(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
//TODO -move to include/hip_runtime_api.h as a common implementation.
|
//TODO -move to include/hip_runtime_api.h as a common implementation.
|
||||||
/**
|
/**
|
||||||
* Memory copy types
|
* Memory copy types
|
||||||
@@ -102,8 +109,8 @@ typedef cudaEvent_t hipEvent_t;
|
|||||||
typedef cudaStream_t hipStream_t;
|
typedef cudaStream_t hipStream_t;
|
||||||
typedef cudaIpcEventHandle_t hipIpcEventHandle_t;
|
typedef cudaIpcEventHandle_t hipIpcEventHandle_t;
|
||||||
typedef cudaIpcMemHandle_t hipIpcMemHandle_t;
|
typedef cudaIpcMemHandle_t hipIpcMemHandle_t;
|
||||||
typedef cudaLimit hipLimit_t;
|
typedef enum cudaLimit hipLimit_t;
|
||||||
typedef cudaFuncCache hipFuncCache_t;
|
typedef enum cudaFuncCache hipFuncCache_t;
|
||||||
typedef CUcontext hipCtx_t;
|
typedef CUcontext hipCtx_t;
|
||||||
typedef CUsharedconfig hipSharedMemConfig;
|
typedef CUsharedconfig hipSharedMemConfig;
|
||||||
typedef CUfunc_cache hipFuncCache;
|
typedef CUfunc_cache hipFuncCache;
|
||||||
@@ -112,10 +119,10 @@ typedef CUdevice hipDevice_t;
|
|||||||
typedef CUmodule hipModule_t;
|
typedef CUmodule hipModule_t;
|
||||||
typedef CUfunction hipFunction_t;
|
typedef CUfunction hipFunction_t;
|
||||||
typedef CUdeviceptr hipDeviceptr_t;
|
typedef CUdeviceptr hipDeviceptr_t;
|
||||||
typedef cudaChannelFormatKind hipChannelFormatKind;
|
typedef enum cudaChannelFormatKind hipChannelFormatKind;
|
||||||
typedef cudaChannelFormatDesc hipChannelFormatDesc;
|
typedef struct cudaChannelFormatDesc hipChannelFormatDesc;
|
||||||
typedef cudaTextureReadMode hipTextureReadMode;
|
typedef enum cudaTextureReadMode hipTextureReadMode;
|
||||||
typedef cudaArray hipArray;
|
typedef struct cudaArray hipArray;
|
||||||
|
|
||||||
// Flags that can be used with hipStreamCreateWithFlags
|
// Flags that can be used with hipStreamCreateWithFlags
|
||||||
#define hipStreamDefault cudaStreamDefault
|
#define hipStreamDefault cudaStreamDefault
|
||||||
@@ -187,7 +194,7 @@ switch(hError) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static cudaMemcpyKind hipMemcpyKindToCudaMemcpyKind(hipMemcpyKind kind) {
|
inline static enum cudaMemcpyKind hipMemcpyKindToCudaMemcpyKind(hipMemcpyKind kind) {
|
||||||
switch(kind) {
|
switch(kind) {
|
||||||
case hipMemcpyHostToHost:
|
case hipMemcpyHostToHost:
|
||||||
return cudaMemcpyHostToHost;
|
return cudaMemcpyHostToHost;
|
||||||
@@ -250,7 +257,7 @@ inline static hipError_t hipHostMalloc(void** ptr, size_t size, unsigned int fla
|
|||||||
return hipCUDAErrorTohipError(cudaHostAlloc(ptr, size, flags));
|
return hipCUDAErrorTohipError(cudaHostAlloc(ptr, size, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static hipError_t hipMallocArray(hipArray** array, const hipChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) {
|
inline static hipError_t hipMallocArray(hipArray** array, const struct hipChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) {
|
||||||
return hipCUDAErrorTohipError(cudaMallocArray(array, desc, width, height, flags));
|
return hipCUDAErrorTohipError(cudaMallocArray(array, desc, width, height, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,8 +296,8 @@ inline static hipError_t hipSetDevice(int device) {
|
|||||||
|
|
||||||
inline static hipError_t hipChooseDevice( int* device, const hipDeviceProp_t* prop )
|
inline static hipError_t hipChooseDevice( int* device, const hipDeviceProp_t* prop )
|
||||||
{
|
{
|
||||||
cudaDeviceProp cdprop;
|
struct cudaDeviceProp cdprop;
|
||||||
memset(&cdprop,0x0,sizeof(cudaDeviceProp));
|
memset(&cdprop,0x0,sizeof(struct cudaDeviceProp));
|
||||||
cdprop.major= prop->major;
|
cdprop.major= prop->major;
|
||||||
cdprop.minor = prop->minor;
|
cdprop.minor = prop->minor;
|
||||||
cdprop.totalGlobalMem = prop->totalGlobalMem ;
|
cdprop.totalGlobalMem = prop->totalGlobalMem ;
|
||||||
@@ -351,25 +358,24 @@ inline static hipError_t hipMemcpy(void* dst, const void* src, size_t sizeBytes,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline static hipError_t hipMemcpyAsync(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind copyKind, hipStream_t stream=0) {
|
inline static hipError_t hipMemcpyAsync(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind copyKind, hipStream_t stream __dparm(0)) {
|
||||||
return hipCUDAErrorTohipError(cudaMemcpyAsync(dst, src, sizeBytes, hipMemcpyKindToCudaMemcpyKind(copyKind), stream));
|
return hipCUDAErrorTohipError(cudaMemcpyAsync(dst, src, sizeBytes, hipMemcpyKindToCudaMemcpyKind(copyKind), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline static hipError_t hipMemcpyToSymbol(const void* symbol, const void* src, size_t sizeBytes, size_t offset __dparm(0), hipMemcpyKind copyType __dparm(hipMemcpyHostToDevice)) {
|
||||||
inline static hipError_t hipMemcpyToSymbol(const void* symbol, const void* src, size_t sizeBytes, size_t offset = 0, hipMemcpyKind copyType = hipMemcpyHostToDevice) {
|
|
||||||
return hipCUDAErrorTohipError(cudaMemcpyToSymbol(symbol, src, sizeBytes, offset, hipMemcpyKindToCudaMemcpyKind(copyType)));
|
return hipCUDAErrorTohipError(cudaMemcpyToSymbol(symbol, src, sizeBytes, offset, hipMemcpyKindToCudaMemcpyKind(copyType)));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static hipError_t hipMemcpyToSymbolAsync(const void* symbol, const void* src, size_t sizeBytes, size_t offset, hipMemcpyKind copyType, hipStream_t stream = 0) {
|
inline static hipError_t hipMemcpyToSymbolAsync(const void* symbol, const void* src, size_t sizeBytes, size_t offset, hipMemcpyKind copyType, hipStream_t stream __dparm(0)) {
|
||||||
return hipCUDAErrorTohipError(cudaMemcpyToSymbolAsync(symbol, src, sizeBytes, offset, hipMemcpyKindToCudaMemcpyKind(copyType), stream));
|
return hipCUDAErrorTohipError(cudaMemcpyToSymbolAsync(symbol, src, sizeBytes, offset, hipMemcpyKindToCudaMemcpyKind(copyType), stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static hipError_t hipMemcpyFromSymbol(void *dst, const void* symbolName, size_t sizeBytes, size_t offset = 0, hipMemcpyKind kind = hipMemcpyDeviceToHost)
|
inline static hipError_t hipMemcpyFromSymbol(void *dst, const void* symbolName, size_t sizeBytes, size_t offset __dparm(0), hipMemcpyKind kind __dparm(hipMemcpyDeviceToHost))
|
||||||
{
|
{
|
||||||
return hipCUDAErrorTohipError(cudaMemcpyFromSymbol(dst, symbolName, sizeBytes, offset, hipMemcpyKindToCudaMemcpyKind(kind)));
|
return hipCUDAErrorTohipError(cudaMemcpyFromSymbol(dst, symbolName, sizeBytes, offset, hipMemcpyKindToCudaMemcpyKind(kind)));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static hipError_t hipMemcpyFromSymbolAsync(void *dst, const void* symbolName, size_t sizeBytes, size_t offset, hipMemcpyKind kind, hipStream_t stream = 0)
|
inline static hipError_t hipMemcpyFromSymbolAsync(void *dst, const void* symbolName, size_t sizeBytes, size_t offset, hipMemcpyKind kind, hipStream_t stream __dparm(0))
|
||||||
{
|
{
|
||||||
return hipCUDAErrorTohipError(cudaMemcpyFromSymbolAsync(dst, symbolName, sizeBytes, offset, hipMemcpyKindToCudaMemcpyKind(kind), stream));
|
return hipCUDAErrorTohipError(cudaMemcpyFromSymbolAsync(dst, symbolName, sizeBytes, offset, hipMemcpyKindToCudaMemcpyKind(kind), stream));
|
||||||
}
|
}
|
||||||
@@ -438,7 +444,7 @@ inline static hipError_t hipMemset(void* devPtr,int value, size_t count) {
|
|||||||
return hipCUDAErrorTohipError(cudaMemset(devPtr, value, count));
|
return hipCUDAErrorTohipError(cudaMemset(devPtr, value, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static hipError_t hipMemsetAsync(void* devPtr,int value, size_t count, hipStream_t stream = 0) {
|
inline static hipError_t hipMemsetAsync(void* devPtr,int value, size_t count, hipStream_t stream __dparm(0)) {
|
||||||
return hipCUDAErrorTohipError(cudaMemsetAsync(devPtr, value, count, stream));
|
return hipCUDAErrorTohipError(cudaMemsetAsync(devPtr, value, count, stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,7 +455,7 @@ inline static hipError_t hipMemsetD8(hipDeviceptr_t dest, unsigned char value,
|
|||||||
|
|
||||||
inline static hipError_t hipGetDeviceProperties(hipDeviceProp_t *p_prop, int device)
|
inline static hipError_t hipGetDeviceProperties(hipDeviceProp_t *p_prop, int device)
|
||||||
{
|
{
|
||||||
cudaDeviceProp cdprop;
|
struct cudaDeviceProp cdprop;
|
||||||
cudaError_t cerror;
|
cudaError_t cerror;
|
||||||
cerror = cudaGetDeviceProperties(&cdprop,device);
|
cerror = cudaGetDeviceProperties(&cdprop,device);
|
||||||
strncpy(p_prop->name,cdprop.name, 256);
|
strncpy(p_prop->name,cdprop.name, 256);
|
||||||
@@ -510,7 +516,7 @@ inline static hipError_t hipGetDeviceProperties(hipDeviceProp_t *p_prop, int dev
|
|||||||
|
|
||||||
inline static hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device)
|
inline static hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device)
|
||||||
{
|
{
|
||||||
cudaDeviceAttr cdattr;
|
enum cudaDeviceAttr cdattr;
|
||||||
cudaError_t cerror;
|
cudaError_t cerror;
|
||||||
|
|
||||||
switch (attr) {
|
switch (attr) {
|
||||||
@@ -586,7 +592,7 @@ inline static hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline static hipError_t hipPointerGetAttributes(hipPointerAttribute_t *attributes, void* ptr){
|
inline static hipError_t hipPointerGetAttributes(hipPointerAttribute_t *attributes, void* ptr){
|
||||||
cudaPointerAttributes cPA;
|
struct cudaPointerAttributes cPA;
|
||||||
hipError_t err = hipCUDAErrorTohipError(cudaPointerGetAttributes(&cPA, ptr));
|
hipError_t err = hipCUDAErrorTohipError(cudaPointerGetAttributes(&cPA, ptr));
|
||||||
if(err == hipSuccess){
|
if(err == hipSuccess){
|
||||||
switch (cPA.memoryType){
|
switch (cPA.memoryType){
|
||||||
@@ -617,7 +623,7 @@ inline static hipError_t hipEventCreate( hipEvent_t* event)
|
|||||||
return hipCUDAErrorTohipError(cudaEventCreate(event));
|
return hipCUDAErrorTohipError(cudaEventCreate(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static hipError_t hipEventRecord( hipEvent_t event, hipStream_t stream = NULL)
|
inline static hipError_t hipEventRecord( hipEvent_t event, hipStream_t stream __dparm(NULL))
|
||||||
{
|
{
|
||||||
return hipCUDAErrorTohipError(cudaEventRecord(event,stream));
|
return hipCUDAErrorTohipError(cudaEventRecord(event,stream));
|
||||||
}
|
}
|
||||||
@@ -750,18 +756,18 @@ inline static hipError_t hipMemcpyPeer ( void* dst, int dstDevice, const void*
|
|||||||
return hipCUDAErrorTohipError(cudaMemcpyPeer(dst, dstDevice, src, srcDevice, count));
|
return hipCUDAErrorTohipError(cudaMemcpyPeer(dst, dstDevice, src, srcDevice, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static hipError_t hipMemcpyPeerAsync ( void* dst, int dstDevice, const void* src, int srcDevice, size_t count, hipStream_t stream=0 )
|
inline static hipError_t hipMemcpyPeerAsync ( void* dst, int dstDevice, const void* src, int srcDevice, size_t count, hipStream_t stream __dparm(0))
|
||||||
{
|
{
|
||||||
return hipCUDAErrorTohipError(cudaMemcpyPeerAsync(dst, dstDevice, src, srcDevice, count, stream));
|
return hipCUDAErrorTohipError(cudaMemcpyPeerAsync(dst, dstDevice, src, srcDevice, count, stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Profile APIs:
|
// Profile APIs:
|
||||||
inline hipError_t hipProfilerStart()
|
inline static hipError_t hipProfilerStart()
|
||||||
{
|
{
|
||||||
return hipCUDAErrorTohipError(cudaProfilerStart());
|
return hipCUDAErrorTohipError(cudaProfilerStart());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline hipError_t hipProfilerStop()
|
inline static hipError_t hipProfilerStop()
|
||||||
{
|
{
|
||||||
return hipCUDAErrorTohipError(cudaProfilerStop());
|
return hipCUDAErrorTohipError(cudaProfilerStop());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Заблокувати користувача