1 | #pragma once |
2 | |
3 | #if defined(TI_WITH_CUDA_TOOLKIT) |
4 | |
5 | #include <cuda.h> |
6 | #include <cusparse.h> |
7 | |
8 | #else |
9 | |
10 | using CUexternalMemory = void *; |
11 | using CUexternalSemaphore = void *; |
12 | using CUsurfObject = uint64_t; |
13 | using CUstream = void *; |
14 | using CUdeviceptr = void *; |
15 | using CUmipmappedArray = void *; |
16 | using CUarray = void *; |
17 | |
18 | // copied from <cuda.h> |
19 | |
20 | /** |
21 | * Resource types |
22 | */ |
23 | typedef enum CUresourcetype_enum { |
24 | CU_RESOURCE_TYPE_ARRAY = 0x00, /**< Array resource */ |
25 | CU_RESOURCE_TYPE_MIPMAPPED_ARRAY = 0x01, /**< Mipmapped array resource */ |
26 | CU_RESOURCE_TYPE_LINEAR = 0x02, /**< Linear resource */ |
27 | CU_RESOURCE_TYPE_PITCH2D = 0x03 /**< Pitch 2D resource */ |
28 | } CUresourcetype; |
29 | |
30 | /** |
31 | * Array formats |
32 | */ |
33 | typedef enum CUarray_format_enum { |
34 | CU_AD_FORMAT_UNSIGNED_INT8 = 0x01, /**< Unsigned 8-bit integers */ |
35 | CU_AD_FORMAT_UNSIGNED_INT16 = 0x02, /**< Unsigned 16-bit integers */ |
36 | CU_AD_FORMAT_UNSIGNED_INT32 = 0x03, /**< Unsigned 32-bit integers */ |
37 | CU_AD_FORMAT_SIGNED_INT8 = 0x08, /**< Signed 8-bit integers */ |
38 | CU_AD_FORMAT_SIGNED_INT16 = 0x09, /**< Signed 16-bit integers */ |
39 | CU_AD_FORMAT_SIGNED_INT32 = 0x0a, /**< Signed 32-bit integers */ |
40 | CU_AD_FORMAT_HALF = 0x10, /**< 16-bit floating point */ |
41 | CU_AD_FORMAT_FLOAT = 0x20 /**< 32-bit floating point */ |
42 | } CUarray_format; |
43 | |
44 | typedef enum CUfunction_attribute_enum { |
45 | CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 0, |
46 | CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES = 1, |
47 | CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES = 2, |
48 | CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES = 3, |
49 | CU_FUNC_ATTRIBUTE_NUM_REGS = 4, |
50 | CU_FUNC_ATTRIBUTE_PTX_VERSION = 5, |
51 | CU_FUNC_ATTRIBUTE_BINARY_VERSION = 6, |
52 | CU_FUNC_ATTRIBUTE_CACHE_MODE_CA = 7, |
53 | CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES = 8, |
54 | CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = 9, |
55 | CU_FUNC_ATTRIBUTE_MAX |
56 | } CUfunction_attribute; |
57 | |
58 | /** |
59 | * 3D array descriptor |
60 | */ |
61 | typedef struct CUDA_ARRAY3D_DESCRIPTOR_st { |
62 | size_t Width; /**< Width of 3D array */ |
63 | size_t Height; /**< Height of 3D array */ |
64 | size_t Depth; /**< Depth of 3D array */ |
65 | |
66 | CUarray_format Format; /**< Array format */ |
67 | unsigned int NumChannels; /**< Channels per array element */ |
68 | unsigned int Flags; /**< Flags */ |
69 | } CUDA_ARRAY3D_DESCRIPTOR; |
70 | |
71 | /** |
72 | * CUDA Resource descriptor |
73 | */ |
74 | typedef struct CUDA_RESOURCE_DESC_st { |
75 | CUresourcetype resType; /**< Resource type */ |
76 | |
77 | union { |
78 | struct { |
79 | CUarray hArray; /**< CUDA array */ |
80 | } array; |
81 | struct { |
82 | CUmipmappedArray hMipmappedArray; /**< CUDA mipmapped array */ |
83 | } mipmap; |
84 | struct { |
85 | CUdeviceptr devPtr; /**< Device pointer */ |
86 | CUarray_format format; /**< Array format */ |
87 | unsigned int numChannels; /**< Channels per array element */ |
88 | size_t sizeInBytes; /**< Size in bytes */ |
89 | } linear; |
90 | struct { |
91 | CUdeviceptr devPtr; /**< Device pointer */ |
92 | CUarray_format format; /**< Array format */ |
93 | unsigned int numChannels; /**< Channels per array element */ |
94 | size_t width; /**< Width of the array in elements */ |
95 | size_t height; /**< Height of the array in elements */ |
96 | size_t pitchInBytes; /**< Pitch between two rows in bytes */ |
97 | } pitch2D; |
98 | struct { |
99 | int reserved[32]; |
100 | } reserved; |
101 | } res; |
102 | |
103 | unsigned int flags; /**< Flags (must be zero) */ |
104 | } CUDA_RESOURCE_DESC; |
105 | |
106 | typedef enum CUexternalMemoryHandleType_enum { |
107 | /** |
108 | * Handle is an opaque file descriptor |
109 | */ |
110 | CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD = 1, |
111 | /** |
112 | * Handle is an opaque shared NT handle |
113 | */ |
114 | CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32 = 2, |
115 | /** |
116 | * Handle is an opaque, globally shared handle |
117 | */ |
118 | CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3, |
119 | /** |
120 | * Handle is a D3D12 heap object |
121 | */ |
122 | CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP = 4, |
123 | /** |
124 | * Handle is a D3D12 committed resource |
125 | */ |
126 | CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE = 5, |
127 | /** |
128 | * Handle is a shared NT handle to a D3D11 resource |
129 | */ |
130 | CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE = 6, |
131 | /** |
132 | * Handle is a globally shared handle to a D3D11 resource |
133 | */ |
134 | CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT = 7, |
135 | /** |
136 | * Handle is an NvSciBuf object |
137 | */ |
138 | CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF = 8 |
139 | } CUexternalMemoryHandleType; |
140 | |
141 | typedef struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st { |
142 | /** |
143 | * Type of the handle |
144 | */ |
145 | CUexternalMemoryHandleType type; |
146 | union { |
147 | /** |
148 | * File descriptor referencing the memory object. Valid |
149 | * when type is |
150 | * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD |
151 | */ |
152 | int fd; |
153 | /** |
154 | * Win32 handle referencing the semaphore object. Valid when |
155 | * type is one of the following: |
156 | * - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32 |
157 | * - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT |
158 | * - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP |
159 | * - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE |
160 | * - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE |
161 | * - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT |
162 | * Exactly one of 'handle' and 'name' must be non-NULL. If |
163 | * type is one of the following: |
164 | * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT |
165 | * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT |
166 | * then 'name' must be NULL. |
167 | */ |
168 | struct { |
169 | /** |
170 | * Valid NT handle. Must be NULL if 'name' is non-NULL |
171 | */ |
172 | void *handle; |
173 | /** |
174 | * Name of a valid memory object. |
175 | * Must be NULL if 'handle' is non-NULL. |
176 | */ |
177 | const void *name; |
178 | } win32; |
179 | /** |
180 | * A handle representing an NvSciBuf Object. Valid when type |
181 | * is ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF |
182 | */ |
183 | const void *nvSciBufObject; |
184 | } handle; |
185 | /** |
186 | * Size of the memory allocation |
187 | */ |
188 | unsigned long long size; |
189 | /** |
190 | * Flags must either be zero or ::CUDA_EXTERNAL_MEMORY_DEDICATED |
191 | */ |
192 | unsigned int flags; |
193 | unsigned int reserved[16]; |
194 | } CUDA_EXTERNAL_MEMORY_HANDLE_DESC; |
195 | |
196 | typedef struct CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st { |
197 | /** |
198 | * Offset into the memory object where the buffer's base is |
199 | */ |
200 | unsigned long long offset; |
201 | /** |
202 | * Size of the buffer |
203 | */ |
204 | unsigned long long size; |
205 | /** |
206 | * Flags reserved for future use. Must be zero. |
207 | */ |
208 | unsigned int flags; |
209 | unsigned int reserved[16]; |
210 | } CUDA_EXTERNAL_MEMORY_BUFFER_DESC; |
211 | |
212 | /** |
213 | * External memory mipmap descriptor |
214 | */ |
215 | typedef struct CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st { |
216 | /** |
217 | * Offset into the memory object where the base level of the |
218 | * mipmap chain is. |
219 | */ |
220 | unsigned long long offset; |
221 | /** |
222 | * Format, dimension and type of base level of the mipmap chain |
223 | */ |
224 | CUDA_ARRAY3D_DESCRIPTOR arrayDesc; |
225 | /** |
226 | * Total number of levels in the mipmap chain |
227 | */ |
228 | unsigned int numLevels; |
229 | unsigned int reserved[16]; |
230 | } CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC; |
231 | |
232 | /** |
233 | * External semaphore handle types |
234 | */ |
235 | typedef enum CUexternalSemaphoreHandleType_enum { |
236 | /** |
237 | * Handle is an opaque file descriptor |
238 | */ |
239 | CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD = 1, |
240 | /** |
241 | * Handle is an opaque shared NT handle |
242 | */ |
243 | CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32 = 2, |
244 | /** |
245 | * Handle is an opaque, globally shared handle |
246 | */ |
247 | CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3, |
248 | /** |
249 | * Handle is a shared NT handle referencing a D3D12 fence object |
250 | */ |
251 | CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE = 4, |
252 | /** |
253 | * Handle is a shared NT handle referencing a D3D11 fence object |
254 | */ |
255 | CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE = 5, |
256 | /** |
257 | * Opaque handle to NvSciSync Object |
258 | */ |
259 | CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC = 6, |
260 | /** |
261 | * Handle is a shared NT handle referencing a D3D11 keyed mutex object |
262 | */ |
263 | CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX = 7, |
264 | /** |
265 | * Handle is a globally shared handle referencing a D3D11 keyed mutex object |
266 | */ |
267 | CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT = 8 |
268 | } CUexternalSemaphoreHandleType; |
269 | |
270 | /** |
271 | * External semaphore handle descriptor |
272 | */ |
273 | typedef struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st { |
274 | /** |
275 | * Type of the handle |
276 | */ |
277 | CUexternalSemaphoreHandleType type; |
278 | union { |
279 | /** |
280 | * File descriptor referencing the semaphore object. Valid |
281 | * when type is |
282 | * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD |
283 | */ |
284 | int fd; |
285 | /** |
286 | * Win32 handle referencing the semaphore object. Valid when |
287 | * type is one of the following: |
288 | * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32 |
289 | * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT |
290 | * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE |
291 | * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE |
292 | * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX |
293 | * Exactly one of 'handle' and 'name' must be non-NULL. If |
294 | * type is one of the following: |
295 | * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT |
296 | * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT |
297 | * then 'name' must be NULL. |
298 | */ |
299 | struct { |
300 | /** |
301 | * Valid NT handle. Must be NULL if 'name' is non-NULL |
302 | */ |
303 | void *handle; |
304 | /** |
305 | * Name of a valid synchronization primitive. |
306 | * Must be NULL if 'handle' is non-NULL. |
307 | */ |
308 | const void *name; |
309 | } win32; |
310 | /** |
311 | * Valid NvSciSyncObj. Must be non NULL |
312 | */ |
313 | const void *nvSciSyncObj; |
314 | } handle; |
315 | /** |
316 | * Flags reserved for the future. Must be zero. |
317 | */ |
318 | unsigned int flags; |
319 | unsigned int reserved[16]; |
320 | } CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC; |
321 | |
322 | /** |
323 | * External semaphore signal parameters |
324 | */ |
325 | typedef struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st { |
326 | struct { |
327 | /** |
328 | * Parameters for fence objects |
329 | */ |
330 | struct { |
331 | /** |
332 | * Value of fence to be signaled |
333 | */ |
334 | unsigned long long value; |
335 | } fence; |
336 | union { |
337 | /** |
338 | * Pointer to NvSciSyncFence. Valid if ::CUexternalSemaphoreHandleType |
339 | * is of type ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC. |
340 | */ |
341 | void *fence; |
342 | unsigned long long reserved; |
343 | } nvSciSync; |
344 | /** |
345 | * Parameters for keyed mutex objects |
346 | */ |
347 | struct { |
348 | /** |
349 | * Value of key to release the mutex with |
350 | */ |
351 | unsigned long long key; |
352 | } keyedMutex; |
353 | unsigned int reserved[12]; |
354 | } params; |
355 | /** |
356 | * Only when ::CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS is used to |
357 | * signal a ::CUexternalSemaphore of type |
358 | * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is |
359 | * ::CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC which indicates |
360 | * that while signaling the ::CUexternalSemaphore, no memory synchronization |
361 | * operations should be performed for any external memory object imported |
362 | * as ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. |
363 | * For all other types of ::CUexternalSemaphore, flags must be zero. |
364 | */ |
365 | unsigned int flags; |
366 | unsigned int reserved[16]; |
367 | } CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS; |
368 | |
369 | /** |
370 | * External semaphore wait parameters |
371 | */ |
372 | typedef struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st { |
373 | struct { |
374 | /** |
375 | * Parameters for fence objects |
376 | */ |
377 | struct { |
378 | /** |
379 | * Value of fence to be waited on |
380 | */ |
381 | unsigned long long value; |
382 | } fence; |
383 | /** |
384 | * Pointer to NvSciSyncFence. Valid if CUexternalSemaphoreHandleType |
385 | * is of type CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC. |
386 | */ |
387 | union { |
388 | void *fence; |
389 | unsigned long long reserved; |
390 | } nvSciSync; |
391 | /** |
392 | * Parameters for keyed mutex objects |
393 | */ |
394 | struct { |
395 | /** |
396 | * Value of key to acquire the mutex with |
397 | */ |
398 | unsigned long long key; |
399 | /** |
400 | * Timeout in milliseconds to wait to acquire the mutex |
401 | */ |
402 | unsigned int timeoutMs; |
403 | } keyedMutex; |
404 | unsigned int reserved[10]; |
405 | } params; |
406 | /** |
407 | * Only when ::CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS is used to wait on |
408 | * a ::CUexternalSemaphore of type |
409 | * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is |
410 | * ::CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC which indicates that |
411 | * while waiting for the ::CUexternalSemaphore, no memory synchronization |
412 | * operations should be performed for any external memory object imported as |
413 | * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. For all other types of |
414 | * ::CUexternalSemaphore, flags must be zero. |
415 | */ |
416 | unsigned int flags; |
417 | unsigned int reserved[16]; |
418 | } CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS; |
419 | |
420 | /** |
421 | * Indicates that the external memory object is a dedicated resource |
422 | */ |
423 | #define CUDA_EXTERNAL_MEMORY_DEDICATED 0x1 |
424 | |
425 | /** |
426 | * This flag must be set in order to bind a surface reference |
427 | * to the CUDA array |
428 | */ |
429 | #define CUDA_ARRAY3D_SURFACE_LDST 0x02 |
430 | |
431 | /** |
432 | * This flag indicates that the CUDA array may be bound as a color target |
433 | * in an external graphics API |
434 | */ |
435 | #define CUDA_ARRAY3D_COLOR_ATTACHMENT 0x20 |
436 | |
437 | // copy from cusparse.h |
438 | struct cusparseContext; |
439 | typedef struct cusparseContext *cusparseHandle_t; |
440 | |
441 | struct cusparseMatDescr; |
442 | typedef struct cusparseMatDescr *cusparseMatDescr_t; |
443 | |
444 | struct cusparseSpVecDescr; |
445 | struct cusparseDnVecDescr; |
446 | struct cusparseSpMatDescr; |
447 | typedef struct cusparseSpVecDescr *cusparseSpVecDescr_t; |
448 | typedef struct cusparseDnVecDescr *cusparseDnVecDescr_t; |
449 | typedef struct cusparseSpMatDescr *cusparseSpMatDescr_t; |
450 | |
451 | struct cusparseSpGEMMDescr; |
452 | typedef struct cusparseSpGEMMDescr *cusparseSpGEMMDescr_t; |
453 | |
454 | typedef enum { |
455 | CUSPARSE_INDEX_16U = 1, ///< 16-bit unsigned integer for matrix/vector |
456 | ///< indices |
457 | CUSPARSE_INDEX_32I = 2, ///< 32-bit signed integer for matrix/vector indices |
458 | CUSPARSE_INDEX_64I = 3 ///< 64-bit signed integer for matrix/vector indices |
459 | } cusparseIndexType_t; |
460 | |
461 | typedef enum { |
462 | CUSPARSE_INDEX_BASE_ZERO = 0, |
463 | CUSPARSE_INDEX_BASE_ONE = 1 |
464 | } cusparseIndexBase_t; |
465 | |
466 | typedef enum cudaDataType_t { |
467 | CUDA_R_16F = 2, /* real as a half */ |
468 | CUDA_C_16F = 6, /* complex as a pair of half numbers */ |
469 | CUDA_R_16BF = 14, /* real as a nv_bfloat16 */ |
470 | CUDA_C_16BF = 15, /* complex as a pair of nv_bfloat16 numbers */ |
471 | CUDA_R_32F = 0, /* real as a float */ |
472 | CUDA_C_32F = 4, /* complex as a pair of float numbers */ |
473 | CUDA_R_64F = 1, /* real as a double */ |
474 | CUDA_C_64F = 5, /* complex as a pair of double numbers */ |
475 | CUDA_R_4I = 16, /* real as a signed 4-bit int */ |
476 | CUDA_C_4I = 17, /* complex as a pair of signed 4-bit int numbers */ |
477 | CUDA_R_4U = 18, /* real as a unsigned 4-bit int */ |
478 | CUDA_C_4U = 19, /* complex as a pair of unsigned 4-bit int numbers */ |
479 | CUDA_R_8I = 3, /* real as a signed 8-bit int */ |
480 | CUDA_C_8I = 7, /* complex as a pair of signed 8-bit int numbers */ |
481 | CUDA_R_8U = 8, /* real as a unsigned 8-bit int */ |
482 | CUDA_C_8U = 9, /* complex as a pair of unsigned 8-bit int numbers */ |
483 | CUDA_R_16I = 20, /* real as a signed 16-bit int */ |
484 | CUDA_C_16I = 21, /* complex as a pair of signed 16-bit int numbers */ |
485 | CUDA_R_16U = 22, /* real as a unsigned 16-bit int */ |
486 | CUDA_C_16U = 23, /* complex as a pair of unsigned 16-bit int numbers */ |
487 | CUDA_R_32I = 10, /* real as a signed 32-bit int */ |
488 | CUDA_C_32I = 11, /* complex as a pair of signed 32-bit int numbers */ |
489 | CUDA_R_32U = 12, /* real as a unsigned 32-bit int */ |
490 | CUDA_C_32U = 13, /* complex as a pair of unsigned 32-bit int numbers */ |
491 | CUDA_R_64I = 24, /* real as a signed 64-bit int */ |
492 | CUDA_C_64I = 25, /* complex as a pair of signed 64-bit int numbers */ |
493 | CUDA_R_64U = 26, /* real as a unsigned 64-bit int */ |
494 | CUDA_C_64U = 27 /* complex as a pair of unsigned 64-bit int numbers */ |
495 | } cudaDataType; |
496 | |
497 | typedef enum { |
498 | CUSPARSE_OPERATION_NON_TRANSPOSE = 0, |
499 | CUSPARSE_OPERATION_TRANSPOSE = 1, |
500 | CUSPARSE_OPERATION_CONJUGATE_TRANSPOSE = 2 |
501 | } cusparseOperation_t; |
502 | |
503 | typedef enum { |
504 | CUSPARSE_SPMV_ALG_DEFAULT = 0, |
505 | CUSPARSE_SPMV_COO_ALG1 = 1, |
506 | CUSPARSE_SPMV_CSR_ALG1 = 2, |
507 | CUSPARSE_SPMV_CSR_ALG2 = 3, |
508 | CUSPARSE_SPMV_COO_ALG2 = 4 |
509 | } cusparseSpMVAlg_t; |
510 | |
511 | typedef enum { |
512 | CUSPARSE_SPGEMM_DEFAULT = 0, |
513 | CUSPARSE_SPGEMM_CSR_ALG_DETERMINITIC = 1, |
514 | CUSPARSE_SPGEMM_CSR_ALG_NONDETERMINITIC = 2 |
515 | } cusparseSpGEMMAlg_t; |
516 | |
517 | typedef enum { |
518 | CUSPARSE_POINTER_MODE_HOST = 0, |
519 | CUSPARSE_POINTER_MODE_DEVICE = 1 |
520 | } cusparsePointerMode_t; |
521 | |
522 | typedef enum { |
523 | CUSPARSE_ACTION_SYMBOLIC = 0, |
524 | CUSPARSE_ACTION_NUMERIC = 1 |
525 | } cusparseAction_t; |
526 | |
527 | typedef enum { |
528 | CUSPARSE_CSR2CSC_ALG1 = 1, // faster than V2 (in general), deterministc |
529 | CUSPARSE_CSR2CSC_ALG2 = 2 // low memory requirement, non-deterministc |
530 | } cusparseCsr2CscAlg_t; |
531 | |
532 | typedef enum { |
533 | CUSPARSE_MATRIX_TYPE_GENERAL = 0, |
534 | CUSPARSE_MATRIX_TYPE_SYMMETRIC = 1, |
535 | CUSPARSE_MATRIX_TYPE_HERMITIAN = 2, |
536 | CUSPARSE_MATRIX_TYPE_TRIANGULAR = 3 |
537 | } cusparseMatrixType_t; |
538 | |
539 | typedef enum { |
540 | CUSPARSE_FILL_MODE_LOWER = 0, |
541 | CUSPARSE_FILL_MODE_UPPER = 1 |
542 | } cusparseFillMode_t; |
543 | |
544 | typedef enum { |
545 | CUSPARSE_DIAG_TYPE_NON_UNIT = 0, |
546 | CUSPARSE_DIAG_TYPE_UNIT = 1 |
547 | } cusparseDiagType_t; |
548 | |
549 | // copy from cusolver.h |
550 | typedef enum libraryPropertyType_t { |
551 | MAJOR_VERSION, |
552 | MINOR_VERSION, |
553 | PATCH_LEVEL |
554 | } libraryPropertyType; |
555 | |
556 | struct cusolverSpContext; |
557 | typedef struct cusolverSpContext *cusolverSpHandle_t; |
558 | |
559 | // copy from cusolverSp_LOWLEVEL_PREVIEW.h |
560 | struct csrcholInfoHost; |
561 | typedef struct csrcholInfoHost *csrcholInfoHost_t; |
562 | struct csrcholInfo; |
563 | typedef struct csrcholInfo *csrcholInfo_t; |
564 | struct csrluInfoHost; |
565 | typedef struct csrluInfoHost *csrluInfoHost_t; |
566 | #endif |
567 | |