-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpipellm-cuda.h
158 lines (151 loc) · 5.37 KB
/
pipellm-cuda.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#pragma once
#define HOOK_C_API extern "C"
#define HOOK_DECL_EXPORT __attribute__((visibility("default")))
/**
* CUDA error types
*/
enum cudaError {
cudaSuccess = 0,
cudaErrorInvalidValue = 1,
cudaErrorMemoryAllocation = 2,
cudaErrorInitializationError = 3,
cudaErrorCudartUnloading = 4,
cudaErrorProfilerDisabled = 5,
cudaErrorProfilerNotInitialized = 6,
cudaErrorProfilerAlreadyStarted = 7,
cudaErrorProfilerAlreadyStopped = 8,
cudaErrorInvalidConfiguration = 9,
cudaErrorInvalidPitchValue = 12,
cudaErrorInvalidSymbol = 13,
cudaErrorInvalidHostPointer = 16,
cudaErrorInvalidDevicePointer = 17,
cudaErrorInvalidTexture = 18,
cudaErrorInvalidTextureBinding = 19,
cudaErrorInvalidChannelDescriptor = 20,
cudaErrorInvalidMemcpyDirection = 21,
cudaErrorAddressOfConstant = 22,
cudaErrorTextureFetchFailed = 23,
cudaErrorTextureNotBound = 24,
cudaErrorSynchronizationError = 25,
cudaErrorInvalidFilterSetting = 26,
cudaErrorInvalidNormSetting = 27,
cudaErrorMixedDeviceExecution = 28,
cudaErrorNotYetImplemented = 31,
cudaErrorMemoryValueTooLarge = 32,
cudaErrorStubLibrary = 34,
cudaErrorInsufficientDriver = 35,
cudaErrorCallRequiresNewerDriver = 36,
cudaErrorInvalidSurface = 37,
cudaErrorDuplicateVariableName = 43,
cudaErrorDuplicateTextureName = 44,
cudaErrorDuplicateSurfaceName = 45,
cudaErrorDevicesUnavailable = 46,
cudaErrorIncompatibleDriverContext = 49,
cudaErrorMissingConfiguration = 52,
cudaErrorPriorLaunchFailure = 53,
cudaErrorLaunchMaxDepthExceeded = 65,
cudaErrorLaunchFileScopedTex = 66,
cudaErrorLaunchFileScopedSurf = 67,
cudaErrorSyncDepthExceeded = 68,
cudaErrorLaunchPendingCountExceeded = 69,
cudaErrorInvalidDeviceFunction = 98,
cudaErrorNoDevice = 100,
cudaErrorInvalidDevice = 101,
cudaErrorDeviceNotLicensed = 102,
cudaErrorSoftwareValidityNotEstablished = 103,
cudaErrorStartupFailure = 127,
cudaErrorInvalidKernelImage = 200,
cudaErrorDeviceUninitialized = 201,
cudaErrorMapBufferObjectFailed = 205,
cudaErrorUnmapBufferObjectFailed = 206,
cudaErrorArrayIsMapped = 207,
cudaErrorAlreadyMapped = 208,
cudaErrorNoKernelImageForDevice = 209,
cudaErrorAlreadyAcquired = 210,
cudaErrorNotMapped = 211,
cudaErrorNotMappedAsArray = 212,
cudaErrorNotMappedAsPointer = 213,
cudaErrorECCUncorrectable = 214,
cudaErrorUnsupportedLimit = 215,
cudaErrorDeviceAlreadyInUse = 216,
cudaErrorPeerAccessUnsupported = 217,
cudaErrorInvalidPtx = 218,
cudaErrorInvalidGraphicsContext = 219,
cudaErrorNvlinkUncorrectable = 220,
cudaErrorJitCompilerNotFound = 221,
cudaErrorUnsupportedPtxVersion = 222,
cudaErrorJitCompilationDisabled = 223,
cudaErrorUnsupportedExecAffinity = 224,
cudaErrorInvalidSource = 300,
cudaErrorFileNotFound = 301,
cudaErrorSharedObjectSymbolNotFound = 302,
cudaErrorSharedObjectInitFailed = 303,
cudaErrorOperatingSystem = 304,
cudaErrorInvalidResourceHandle = 400,
cudaErrorIllegalState = 401,
cudaErrorSymbolNotFound = 500,
cudaErrorNotReady = 600,
cudaErrorIllegalAddress = 700,
cudaErrorLaunchOutOfResources = 701,
cudaErrorLaunchTimeout = 702,
cudaErrorLaunchIncompatibleTexturing = 703,
cudaErrorPeerAccessAlreadyEnabled = 704,
cudaErrorPeerAccessNotEnabled = 705,
cudaErrorSetOnActiveProcess = 708,
cudaErrorContextIsDestroyed = 709,
cudaErrorAssert = 710,
cudaErrorTooManyPeers = 711,
cudaErrorHostMemoryAlreadyRegistered = 712,
cudaErrorHostMemoryNotRegistered = 713,
cudaErrorHardwareStackError = 714,
cudaErrorIllegalInstruction = 715,
cudaErrorMisalignedAddress = 716,
cudaErrorInvalidAddressSpace = 717,
cudaErrorInvalidPc = 718,
cudaErrorLaunchFailure = 719,
cudaErrorCooperativeLaunchTooLarge = 720,
cudaErrorNotPermitted = 800,
cudaErrorNotSupported = 801,
cudaErrorSystemNotReady = 802,
cudaErrorSystemDriverMismatch = 803,
cudaErrorCompatNotSupportedOnDevice = 804,
cudaErrorMpsConnectionFailed = 805,
cudaErrorMpsRpcFailure = 806,
cudaErrorMpsServerNotReady = 807,
cudaErrorMpsMaxClientsReached = 808,
cudaErrorMpsMaxConnectionsReached = 809,
cudaErrorStreamCaptureUnsupported = 900,
cudaErrorStreamCaptureInvalidated = 901,
cudaErrorStreamCaptureMerge = 902,
cudaErrorStreamCaptureUnmatched = 903,
cudaErrorStreamCaptureUnjoined = 904,
cudaErrorStreamCaptureIsolation = 905,
cudaErrorStreamCaptureImplicit = 906,
cudaErrorCapturedEvent = 907,
cudaErrorStreamCaptureWrongThread = 908,
cudaErrorTimeout = 909,
cudaErrorGraphExecUpdateFailure = 910,
cudaErrorExternalDevice = 911,
cudaErrorUnknown = 999,
cudaErrorApiFailureBase = 10000
};
typedef enum cudaError cudaError_t;
/**
* CUDA memory copy types
*/
enum cudaMemcpyKind {
cudaMemcpyHostToHost = 0, /**< Host -> Host */
cudaMemcpyHostToDevice = 1, /**< Host -> Device */
cudaMemcpyDeviceToHost = 2, /**< Device -> Host */
cudaMemcpyDeviceToDevice = 3, /**< Device -> Device */
cudaMemcpyDefault =
4 /**< Direction of the transfer is inferred from the pointer values. Requires unified virtual addressing */
};
/**
* CUDA stream
*/
typedef struct CUstream_st *cudaStream_t;
struct dim3 {
unsigned int x, y, z;
};
typedef struct dim3 dim3;