-
Notifications
You must be signed in to change notification settings - Fork 2
/
gpu_arch.h
84 lines (77 loc) · 2.33 KB
/
gpu_arch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef __HEADER_GPU_ARCH_H__
#define __HEADER_GPU_ARCH_H__
#if defined(__NVCC__)
#include <cuda.h>
#include <cuda_runtime.h>
#define WARP_GPU_SIZE 32
//
// for data type renaming
//
typedef cudaStream_t gpuStream_t;
typedef struct cudaDeviceProp gpuDeviceProp;
typedef cudaError_t gpuError_t;
//
// for status/error/constants
//
#define gpuSuccess cudaSuccess
#define gpuErrorInvalidValue cudaErrorInvalidValue
//
// for function renaming
//
#define gpuSetDevice cudaSetDevice
#define gpuGetDevice cudaGetDevice
#define gpuGetDeviceProperties cudaGetDeviceProperties
#define gpuDriverGetVersion cudaDriverGetVersion
#define gpuRuntimeGetVersion cudaRuntimeGetVersion
#define gpuPointerAttributes cudaPointerAttributes
#define gpuPointerGetAttributes cudaPointerGetAttributes
#define gpuMalloc cudaMalloc
#define gpuFree cudaFree
#define gpuStreamCreate cudaStreamCreate
#define gpuStreamDestroy cudaStreamDestroy
#define gpuMemcpy cudaMemcpy
#define gpuMemcpyDeviceToDevice cudaMemcpyDeviceToDevice
#define gpuMemcpyHostToDevice cudaMemcpyHostToDevice
#define gpuMemcpyDeviceToHost cudaMemcpyDeviceToHost
#define gpuDeviceSynchronize cudaDeviceSynchronize
#endif
#if defined(__HIPCC__)
#include <hip/hip_runtime.h>
#undef WARP_GPU_SIZE
#if defined(__GFX7__) || defined(__GFX8__) || defined(__GFX9__)
#define WARP_GPU_SIZE 64
#else
#define WARP_GPU_SIZE 32
#endif
//
// for data type renaming
//
typedef hipStream_t gpuStream_t;
typedef hipDeviceProp_t gpuDeviceProp;
typedef hipError_t gpuError_t;
//
// for status/error/constants
//
#define gpuSuccess hipSuccess
#define gpuErrorInvalidValue hipErrorInvalidValue
//
// for function renaming
//
#define gpuSetDevice hipSetDevice
#define gpuGetDevice hipGetDevice
#define gpuGetDeviceProperties hipGetDeviceProperties
#define gpuDriverGetVersion hipDriverGetVersion
#define gpuRuntimeGetVersion hipRuntimeGetVersion
#define gpuPointerAttributes hipPointerAttribute_t
#define gpuPointerGetAttributes hipPointerGetAttributes
#define gpuMalloc hipMalloc
#define gpuFree hipFree
#define gpuStreamCreate hipStreamCreate
#define gpuStreamDestroy hipStreamDestroy
#define gpuMemcpy hipMemcpy
#define gpuMemcpyDeviceToDevice hipMemcpyDeviceToDevice
#define gpuMemcpyHostToDevice hipMemcpyHostToDevice
#define gpuMemcpyDeviceToHost hipMemcpyDeviceToHost
#define gpuDeviceSynchronize hipDeviceSynchronize
#endif
#endif