Merge branch 'master' into blender2.8
[blender.git] / extern / cuew / include / cuew.h
1 /*
2  * Copyright 2011-2014 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License
15  */
16
17 #ifndef __CUEW_H__
18 #define __CUEW_H__
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 #include <stdlib.h>
25
26 /* Defines. */
27 #define CUEW_VERSION_MAJOR 2
28 #define CUEW_VERSION_MINOR 0
29
30 #define CUDA_VERSION 9010
31 #define CU_IPC_HANDLE_SIZE 64
32 #define CU_STREAM_LEGACY ((CUstream)0x1)
33 #define CU_STREAM_PER_THREAD ((CUstream)0x2)
34 #define CU_MEMHOSTALLOC_PORTABLE 0x01
35 #define CU_MEMHOSTALLOC_DEVICEMAP 0x02
36 #define CU_MEMHOSTALLOC_WRITECOMBINED 0x04
37 #define CU_MEMHOSTREGISTER_PORTABLE 0x01
38 #define CU_MEMHOSTREGISTER_DEVICEMAP 0x02
39 #define CU_MEMHOSTREGISTER_IOMEMORY 0x04
40 #define CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_PRE_LAUNCH_SYNC 0x01
41 #define CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_POST_LAUNCH_SYNC 0x02
42 #define CUDA_ARRAY3D_LAYERED 0x01
43 #define CUDA_ARRAY3D_2DARRAY 0x01
44 #define CUDA_ARRAY3D_SURFACE_LDST 0x02
45 #define CUDA_ARRAY3D_CUBEMAP 0x04
46 #define CUDA_ARRAY3D_TEXTURE_GATHER 0x08
47 #define CUDA_ARRAY3D_DEPTH_TEXTURE 0x10
48 #define CU_TRSA_OVERRIDE_FORMAT 0x01
49 #define CU_TRSF_READ_AS_INTEGER 0x01
50 #define CU_TRSF_NORMALIZED_COORDINATES 0x02
51 #define CU_TRSF_SRGB 0x10
52 #define CU_LAUNCH_PARAM_END ((void*)0x00)
53 #define CU_LAUNCH_PARAM_BUFFER_POINTER ((void*)0x01)
54 #define CU_LAUNCH_PARAM_BUFFER_SIZE ((void*)0x02)
55 #define CU_PARAM_TR_DEFAULT -1
56 #define CU_DEVICE_CPU ((CUdevice)-1)
57 #define CU_DEVICE_INVALID ((CUdevice)-2)
58
59 /* Functions which changed 3.1 -> 3.2 for 64 bit stuff,
60  * the cuda library has both the old ones for compatibility and new
61  * ones with _v2 postfix,
62  */
63 #define cuDeviceTotalMem cuDeviceTotalMem_v2
64 #define cuCtxCreate cuCtxCreate_v2
65 #define cuModuleGetGlobal cuModuleGetGlobal_v2
66 #define cuMemGetInfo cuMemGetInfo_v2
67 #define cuMemAlloc cuMemAlloc_v2
68 #define cuMemAllocPitch cuMemAllocPitch_v2
69 #define cuMemFree cuMemFree_v2
70 #define cuMemGetAddressRange cuMemGetAddressRange_v2
71 #define cuMemAllocHost cuMemAllocHost_v2
72 #define cuMemHostGetDevicePointer cuMemHostGetDevicePointer_v2
73 #define cuMemcpyHtoD cuMemcpyHtoD_v2
74 #define cuMemcpyDtoH cuMemcpyDtoH_v2
75 #define cuMemcpyDtoD cuMemcpyDtoD_v2
76 #define cuMemcpyDtoA cuMemcpyDtoA_v2
77 #define cuMemcpyAtoD cuMemcpyAtoD_v2
78 #define cuMemcpyHtoA cuMemcpyHtoA_v2
79 #define cuMemcpyAtoH cuMemcpyAtoH_v2
80 #define cuMemcpyAtoA cuMemcpyAtoA_v2
81 #define cuMemcpyHtoAAsync cuMemcpyHtoAAsync_v2
82 #define cuMemcpyAtoHAsync cuMemcpyAtoHAsync_v2
83 #define cuMemcpy2D cuMemcpy2D_v2
84 #define cuMemcpy2DUnaligned cuMemcpy2DUnaligned_v2
85 #define cuMemcpy3D cuMemcpy3D_v2
86 #define cuMemcpyHtoDAsync cuMemcpyHtoDAsync_v2
87 #define cuMemcpyDtoHAsync cuMemcpyDtoHAsync_v2
88 #define cuMemcpyDtoDAsync cuMemcpyDtoDAsync_v2
89 #define cuMemcpy2DAsync cuMemcpy2DAsync_v2
90 #define cuMemcpy3DAsync cuMemcpy3DAsync_v2
91 #define cuMemsetD8 cuMemsetD8_v2
92 #define cuMemsetD16 cuMemsetD16_v2
93 #define cuMemsetD32 cuMemsetD32_v2
94 #define cuMemsetD2D8 cuMemsetD2D8_v2
95 #define cuMemsetD2D16 cuMemsetD2D16_v2
96 #define cuMemsetD2D32 cuMemsetD2D32_v2
97 #define cuArrayCreate cuArrayCreate_v2
98 #define cuArrayGetDescriptor cuArrayGetDescriptor_v2
99 #define cuArray3DCreate cuArray3DCreate_v2
100 #define cuArray3DGetDescriptor cuArray3DGetDescriptor_v2
101 #define cuTexRefSetAddress cuTexRefSetAddress_v2
102 #define cuTexRefGetAddress cuTexRefGetAddress_v2
103 #define cuGraphicsResourceGetMappedPointer cuGraphicsResourceGetMappedPointer_v2
104 #define cuCtxDestroy cuCtxDestroy_v2
105 #define cuCtxPopCurrent cuCtxPopCurrent_v2
106 #define cuCtxPushCurrent cuCtxPushCurrent_v2
107 #define cuStreamDestroy cuStreamDestroy_v2
108 #define cuEventDestroy cuEventDestroy_v2
109 #define cuLinkCreate cuLinkCreate_v2
110 #define cuLinkAddData cuLinkAddData_v2
111 #define cuLinkAddFile cuLinkAddFile_v2
112 #define cuMemHostRegister cuMemHostRegister_v2
113 #define cuGraphicsResourceSetMapFlags cuGraphicsResourceSetMapFlags_v2
114 #define cuTexRefSetAddress2D cuTexRefSetAddress2D_v2
115 #define cuGLCtxCreate cuGLCtxCreate_v2
116 #define cuGLMapBufferObject cuGLMapBufferObject_v2
117 #define cuGLMapBufferObjectAsync cuGLMapBufferObjectAsync_v2
118 #define cuGLGetDevices cuGLGetDevices_v2
119
120 /* Types. */
121 #ifdef _MSC_VER
122 typedef unsigned __int32 cuuint32_t;
123 typedef unsigned __int64 cuuint64_t;
124 #else
125 #include <stdint.h>
126 typedef uint32_t cuuint32_t;
127 typedef uint64_t cuuint64_t;
128 #endif
129
130 #if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) || defined (__aarch64__)
131 typedef unsigned long long CUdeviceptr;
132 #else
133 typedef unsigned int CUdeviceptr;
134 #endif
135
136
137 #ifdef _WIN32
138 #  define CUDAAPI __stdcall
139 #  define CUDA_CB __stdcall
140 #else
141 #  define CUDAAPI
142 #  define CUDA_CB
143 #endif
144
145 typedef int CUdevice;
146 typedef struct CUctx_st* CUcontext;
147 typedef struct CUmod_st* CUmodule;
148 typedef struct CUfunc_st* CUfunction;
149 typedef struct CUarray_st* CUarray;
150 typedef struct CUmipmappedArray_st* CUmipmappedArray;
151 typedef struct CUtexref_st* CUtexref;
152 typedef struct CUsurfref_st* CUsurfref;
153 typedef struct CUevent_st* CUevent;
154 typedef struct CUstream_st* CUstream;
155 typedef struct CUgraphicsResource_st* CUgraphicsResource;
156 typedef unsigned long long CUtexObject;
157 typedef unsigned long long CUsurfObject;
158
159 typedef struct CUuuid_st {
160   char bytes[16];
161 } CUuuid;
162
163 typedef struct CUipcEventHandle_st {
164   char reserved[CU_IPC_HANDLE_SIZE];
165 } CUipcEventHandle;
166
167 typedef struct CUipcMemHandle_st {
168   char reserved[CU_IPC_HANDLE_SIZE];
169 } CUipcMemHandle;
170
171 typedef enum CUipcMem_flags_enum {
172   CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS = 0x1,
173 } CUipcMem_flags;
174
175 typedef enum CUmemAttach_flags_enum {
176   CU_MEM_ATTACH_GLOBAL = 0x1,
177   CU_MEM_ATTACH_HOST = 0x2,
178   CU_MEM_ATTACH_SINGLE = 0x4,
179 } CUmemAttach_flags;
180
181 typedef enum CUctx_flags_enum {
182   CU_CTX_SCHED_AUTO = 0x00,
183   CU_CTX_SCHED_SPIN = 0x01,
184   CU_CTX_SCHED_YIELD = 0x02,
185   CU_CTX_SCHED_BLOCKING_SYNC = 0x04,
186   CU_CTX_BLOCKING_SYNC = 0x04,
187   CU_CTX_SCHED_MASK = 0x07,
188   CU_CTX_MAP_HOST = 0x08,
189   CU_CTX_LMEM_RESIZE_TO_MAX = 0x10,
190   CU_CTX_FLAGS_MASK = 0x1f,
191 } CUctx_flags;
192
193 typedef enum CUstream_flags_enum {
194   CU_STREAM_DEFAULT = 0x0,
195   CU_STREAM_NON_BLOCKING = 0x1,
196 } CUstream_flags;
197
198 typedef enum CUevent_flags_enum {
199   CU_EVENT_DEFAULT = 0x0,
200   CU_EVENT_BLOCKING_SYNC = 0x1,
201   CU_EVENT_DISABLE_TIMING = 0x2,
202   CU_EVENT_INTERPROCESS = 0x4,
203 } CUevent_flags;
204
205 typedef enum CUstreamWaitValue_flags_enum {
206   CU_STREAM_WAIT_VALUE_GEQ = 0x0,
207   CU_STREAM_WAIT_VALUE_EQ = 0x1,
208   CU_STREAM_WAIT_VALUE_AND = 0x2,
209   CU_STREAM_WAIT_VALUE_NOR = 0x3,
210   CU_STREAM_WAIT_VALUE_FLUSH = (1 << 30),
211 } CUstreamWaitValue_flags;
212
213 typedef enum CUstreamWriteValue_flags_enum {
214   CU_STREAM_WRITE_VALUE_DEFAULT = 0x0,
215   CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER = 0x1,
216 } CUstreamWriteValue_flags;
217
218 typedef enum CUstreamBatchMemOpType_enum {
219   CU_STREAM_MEM_OP_WAIT_VALUE_32 = 1,
220   CU_STREAM_MEM_OP_WRITE_VALUE_32 = 2,
221   CU_STREAM_MEM_OP_WAIT_VALUE_64 = 4,
222   CU_STREAM_MEM_OP_WRITE_VALUE_64 = 5,
223   CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES = 3,
224 } CUstreamBatchMemOpType;
225
226 typedef union CUstreamBatchMemOpParams_union {
227   CUstreamBatchMemOpType operation;
228   struct CUstreamMemOpWaitValueParams_st {
229     CUstreamBatchMemOpType operation;
230     CUdeviceptr address;
231     union {
232       cuuint32_t value;
233       cuuint64_t value64;
234     };
235     unsigned int flags;
236     CUdeviceptr alias;
237   } waitValue;
238   struct CUstreamMemOpWriteValueParams_st {
239     CUstreamBatchMemOpType operation;
240     CUdeviceptr address;
241     union {
242       cuuint32_t value;
243       cuuint64_t value64;
244     };
245     unsigned int flags;
246     CUdeviceptr alias;
247   } writeValue;
248   struct CUstreamMemOpFlushRemoteWritesParams_st {
249     CUstreamBatchMemOpType operation;
250     unsigned int flags;
251   } flushRemoteWrites;
252   cuuint64_t pad[6];
253 } CUstreamBatchMemOpParams;
254
255 typedef enum CUoccupancy_flags_enum {
256   CU_OCCUPANCY_DEFAULT = 0x0,
257   CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE = 0x1,
258 } CUoccupancy_flags;
259
260 typedef enum CUarray_format_enum {
261   CU_AD_FORMAT_UNSIGNED_INT8 = 0x01,
262   CU_AD_FORMAT_UNSIGNED_INT16 = 0x02,
263   CU_AD_FORMAT_UNSIGNED_INT32 = 0x03,
264   CU_AD_FORMAT_SIGNED_INT8 = 0x08,
265   CU_AD_FORMAT_SIGNED_INT16 = 0x09,
266   CU_AD_FORMAT_SIGNED_INT32 = 0x0a,
267   CU_AD_FORMAT_HALF = 0x10,
268   CU_AD_FORMAT_FLOAT = 0x20,
269 } CUarray_format;
270
271 typedef enum CUaddress_mode_enum {
272   CU_TR_ADDRESS_MODE_WRAP = 0,
273   CU_TR_ADDRESS_MODE_CLAMP = 1,
274   CU_TR_ADDRESS_MODE_MIRROR = 2,
275   CU_TR_ADDRESS_MODE_BORDER = 3,
276 } CUaddress_mode;
277
278 typedef enum CUfilter_mode_enum {
279   CU_TR_FILTER_MODE_POINT = 0,
280   CU_TR_FILTER_MODE_LINEAR = 1,
281 } CUfilter_mode;
282
283 typedef enum CUdevice_attribute_enum {
284   CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 1,
285   CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X = 2,
286   CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y = 3,
287   CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z = 4,
288   CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X = 5,
289   CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y = 6,
290   CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z = 7,
291   CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK = 8,
292   CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK = 8,
293   CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY = 9,
294   CU_DEVICE_ATTRIBUTE_WARP_SIZE = 10,
295   CU_DEVICE_ATTRIBUTE_MAX_PITCH = 11,
296   CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK = 12,
297   CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK = 12,
298   CU_DEVICE_ATTRIBUTE_CLOCK_RATE = 13,
299   CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT = 14,
300   CU_DEVICE_ATTRIBUTE_GPU_OVERLAP = 15,
301   CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT = 16,
302   CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT = 17,
303   CU_DEVICE_ATTRIBUTE_INTEGRATED = 18,
304   CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY = 19,
305   CU_DEVICE_ATTRIBUTE_COMPUTE_MODE = 20,
306   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH = 21,
307   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH = 22,
308   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT = 23,
309   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH = 24,
310   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT = 25,
311   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH = 26,
312   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH = 27,
313   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT = 28,
314   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS = 29,
315   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH = 27,
316   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT = 28,
317   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES = 29,
318   CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT = 30,
319   CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS = 31,
320   CU_DEVICE_ATTRIBUTE_ECC_ENABLED = 32,
321   CU_DEVICE_ATTRIBUTE_PCI_BUS_ID = 33,
322   CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID = 34,
323   CU_DEVICE_ATTRIBUTE_TCC_DRIVER = 35,
324   CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE = 36,
325   CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH = 37,
326   CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE = 38,
327   CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR = 39,
328   CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT = 40,
329   CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING = 41,
330   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH = 42,
331   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS = 43,
332   CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER = 44,
333   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH = 45,
334   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT = 46,
335   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE = 47,
336   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE = 48,
337   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE = 49,
338   CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID = 50,
339   CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT = 51,
340   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH = 52,
341   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH = 53,
342   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS = 54,
343   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH = 55,
344   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH = 56,
345   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT = 57,
346   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH = 58,
347   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT = 59,
348   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH = 60,
349   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH = 61,
350   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS = 62,
351   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH = 63,
352   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT = 64,
353   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS = 65,
354   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH = 66,
355   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH = 67,
356   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS = 68,
357   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH = 69,
358   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH = 70,
359   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT = 71,
360   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH = 72,
361   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH = 73,
362   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT = 74,
363   CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = 75,
364   CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR = 76,
365   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH = 77,
366   CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED = 78,
367   CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED = 79,
368   CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED = 80,
369   CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR = 81,
370   CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR = 82,
371   CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY = 83,
372   CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD = 84,
373   CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID = 85,
374   CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED = 86,
375   CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO = 87,
376   CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS = 88,
377   CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS = 89,
378   CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED = 90,
379   CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM = 91,
380   CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_MEM_OPS = 92,
381   CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS = 93,
382   CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR = 94,
383   CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH = 95,
384   CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH = 96,
385   CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN = 97,
386   CU_DEVICE_ATTRIBUTE_MAX,
387 } CUdevice_attribute;
388
389 typedef struct CUdevprop_st {
390   int maxThreadsPerBlock;
391   int maxThreadsDim[3];
392   int maxGridSize[3];
393   int sharedMemPerBlock;
394   int totalConstantMemory;
395   int SIMDWidth;
396   int memPitch;
397   int regsPerBlock;
398   int clockRate;
399   int textureAlign;
400 } CUdevprop;
401
402 typedef enum CUpointer_attribute_enum {
403   CU_POINTER_ATTRIBUTE_CONTEXT = 1,
404   CU_POINTER_ATTRIBUTE_MEMORY_TYPE = 2,
405   CU_POINTER_ATTRIBUTE_DEVICE_POINTER = 3,
406   CU_POINTER_ATTRIBUTE_HOST_POINTER = 4,
407   CU_POINTER_ATTRIBUTE_P2P_TOKENS = 5,
408   CU_POINTER_ATTRIBUTE_SYNC_MEMOPS = 6,
409   CU_POINTER_ATTRIBUTE_BUFFER_ID = 7,
410   CU_POINTER_ATTRIBUTE_IS_MANAGED = 8,
411 } CUpointer_attribute;
412
413 typedef enum CUfunction_attribute_enum {
414   CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 0,
415   CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES = 1,
416   CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES = 2,
417   CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES = 3,
418   CU_FUNC_ATTRIBUTE_NUM_REGS = 4,
419   CU_FUNC_ATTRIBUTE_PTX_VERSION = 5,
420   CU_FUNC_ATTRIBUTE_BINARY_VERSION = 6,
421   CU_FUNC_ATTRIBUTE_CACHE_MODE_CA = 7,
422   CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES = 8,
423   CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = 9,
424   CU_FUNC_ATTRIBUTE_MAX,
425 } CUfunction_attribute;
426
427 typedef enum CUfunc_cache_enum {
428   CU_FUNC_CACHE_PREFER_NONE = 0x00,
429   CU_FUNC_CACHE_PREFER_SHARED = 0x01,
430   CU_FUNC_CACHE_PREFER_L1 = 0x02,
431   CU_FUNC_CACHE_PREFER_EQUAL = 0x03,
432 } CUfunc_cache;
433
434 typedef enum CUsharedconfig_enum {
435   CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE = 0x00,
436   CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE = 0x01,
437   CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE = 0x02,
438 } CUsharedconfig;
439
440 typedef enum CUshared_carveout_enum {
441   CU_SHAREDMEM_CARVEOUT_DEFAULT,
442   CU_SHAREDMEM_CARVEOUT_MAX_SHARED = 100,
443   CU_SHAREDMEM_CARVEOUT_MAX_L1 = 0,
444 } CUshared_carveout;
445
446 typedef enum CUmemorytype_enum {
447   CU_MEMORYTYPE_HOST = 0x01,
448   CU_MEMORYTYPE_DEVICE = 0x02,
449   CU_MEMORYTYPE_ARRAY = 0x03,
450   CU_MEMORYTYPE_UNIFIED = 0x04,
451 } CUmemorytype;
452
453 typedef enum CUcomputemode_enum {
454   CU_COMPUTEMODE_DEFAULT = 0,
455   CU_COMPUTEMODE_PROHIBITED = 2,
456   CU_COMPUTEMODE_EXCLUSIVE_PROCESS = 3,
457 } CUcomputemode;
458
459 typedef enum CUmem_advise_enum {
460   CU_MEM_ADVISE_SET_READ_MOSTLY = 1,
461   CU_MEM_ADVISE_UNSET_READ_MOSTLY = 2,
462   CU_MEM_ADVISE_SET_PREFERRED_LOCATION = 3,
463   CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION = 4,
464   CU_MEM_ADVISE_SET_ACCESSED_BY = 5,
465   CU_MEM_ADVISE_UNSET_ACCESSED_BY = 6,
466 } CUmem_advise;
467
468 typedef enum CUmem_range_attribute_enum {
469   CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY = 1,
470   CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION = 2,
471   CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY = 3,
472   CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION = 4,
473 } CUmem_range_attribute;
474
475 typedef enum CUjit_option_enum {
476   CU_JIT_MAX_REGISTERS = 0,
477   CU_JIT_THREADS_PER_BLOCK,
478   CU_JIT_WALL_TIME,
479   CU_JIT_INFO_LOG_BUFFER,
480   CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES,
481   CU_JIT_ERROR_LOG_BUFFER,
482   CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES,
483   CU_JIT_OPTIMIZATION_LEVEL,
484   CU_JIT_TARGET_FROM_CUCONTEXT,
485   CU_JIT_TARGET,
486   CU_JIT_FALLBACK_STRATEGY,
487   CU_JIT_GENERATE_DEBUG_INFO,
488   CU_JIT_LOG_VERBOSE,
489   CU_JIT_GENERATE_LINE_INFO,
490   CU_JIT_CACHE_MODE,
491   CU_JIT_NEW_SM3X_OPT,
492   CU_JIT_FAST_COMPILE,
493   CU_JIT_NUM_OPTIONS,
494 } CUjit_option;
495
496 typedef enum CUjit_target_enum {
497   CU_TARGET_COMPUTE_20 = 20,
498   CU_TARGET_COMPUTE_21 = 21,
499   CU_TARGET_COMPUTE_30 = 30,
500   CU_TARGET_COMPUTE_32 = 32,
501   CU_TARGET_COMPUTE_35 = 35,
502   CU_TARGET_COMPUTE_37 = 37,
503   CU_TARGET_COMPUTE_50 = 50,
504   CU_TARGET_COMPUTE_52 = 52,
505   CU_TARGET_COMPUTE_53 = 53,
506   CU_TARGET_COMPUTE_60 = 60,
507   CU_TARGET_COMPUTE_61 = 61,
508   CU_TARGET_COMPUTE_62 = 62,
509   CU_TARGET_COMPUTE_70 = 70,
510   CU_TARGET_COMPUTE_73 = 73,
511   CU_TARGET_COMPUTE_75 = 75,
512 } CUjit_target;
513
514 typedef enum CUjit_fallback_enum {
515   CU_PREFER_PTX = 0,
516   CU_PREFER_BINARY,
517 } CUjit_fallback;
518
519 typedef enum CUjit_cacheMode_enum {
520   CU_JIT_CACHE_OPTION_NONE = 0,
521   CU_JIT_CACHE_OPTION_CG,
522   CU_JIT_CACHE_OPTION_CA,
523 } CUjit_cacheMode;
524
525 typedef enum CUjitInputType_enum {
526   CU_JIT_INPUT_CUBIN = 0,
527   CU_JIT_INPUT_PTX,
528   CU_JIT_INPUT_FATBINARY,
529   CU_JIT_INPUT_OBJECT,
530   CU_JIT_INPUT_LIBRARY,
531   CU_JIT_NUM_INPUT_TYPES,
532 } CUjitInputType;
533
534 typedef struct CUlinkState_st* CUlinkState;
535
536 typedef enum CUgraphicsRegisterFlags_enum {
537   CU_GRAPHICS_REGISTER_FLAGS_NONE = 0x00,
538   CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY = 0x01,
539   CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD = 0x02,
540   CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST = 0x04,
541   CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER = 0x08,
542 } CUgraphicsRegisterFlags;
543
544 typedef enum CUgraphicsMapResourceFlags_enum {
545   CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE = 0x00,
546   CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY = 0x01,
547   CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 0x02,
548 } CUgraphicsMapResourceFlags;
549
550 typedef enum CUarray_cubemap_face_enum {
551   CU_CUBEMAP_FACE_POSITIVE_X = 0x00,
552   CU_CUBEMAP_FACE_NEGATIVE_X = 0x01,
553   CU_CUBEMAP_FACE_POSITIVE_Y = 0x02,
554   CU_CUBEMAP_FACE_NEGATIVE_Y = 0x03,
555   CU_CUBEMAP_FACE_POSITIVE_Z = 0x04,
556   CU_CUBEMAP_FACE_NEGATIVE_Z = 0x05,
557 } CUarray_cubemap_face;
558
559 typedef enum CUlimit_enum {
560   CU_LIMIT_STACK_SIZE = 0x00,
561   CU_LIMIT_PRINTF_FIFO_SIZE = 0x01,
562   CU_LIMIT_MALLOC_HEAP_SIZE = 0x02,
563   CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH = 0x03,
564   CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT = 0x04,
565   CU_LIMIT_MAX,
566 } CUlimit;
567
568 typedef enum CUresourcetype_enum {
569   CU_RESOURCE_TYPE_ARRAY = 0x00,
570   CU_RESOURCE_TYPE_MIPMAPPED_ARRAY = 0x01,
571   CU_RESOURCE_TYPE_LINEAR = 0x02,
572   CU_RESOURCE_TYPE_PITCH2D = 0x03,
573 } CUresourcetype;
574
575 typedef enum cudaError_enum {
576   CUDA_SUCCESS = 0,
577   CUDA_ERROR_INVALID_VALUE = 1,
578   CUDA_ERROR_OUT_OF_MEMORY = 2,
579   CUDA_ERROR_NOT_INITIALIZED = 3,
580   CUDA_ERROR_DEINITIALIZED = 4,
581   CUDA_ERROR_PROFILER_DISABLED = 5,
582   CUDA_ERROR_PROFILER_NOT_INITIALIZED = 6,
583   CUDA_ERROR_PROFILER_ALREADY_STARTED = 7,
584   CUDA_ERROR_PROFILER_ALREADY_STOPPED = 8,
585   CUDA_ERROR_NO_DEVICE = 100,
586   CUDA_ERROR_INVALID_DEVICE = 101,
587   CUDA_ERROR_INVALID_IMAGE = 200,
588   CUDA_ERROR_INVALID_CONTEXT = 201,
589   CUDA_ERROR_CONTEXT_ALREADY_CURRENT = 202,
590   CUDA_ERROR_MAP_FAILED = 205,
591   CUDA_ERROR_UNMAP_FAILED = 206,
592   CUDA_ERROR_ARRAY_IS_MAPPED = 207,
593   CUDA_ERROR_ALREADY_MAPPED = 208,
594   CUDA_ERROR_NO_BINARY_FOR_GPU = 209,
595   CUDA_ERROR_ALREADY_ACQUIRED = 210,
596   CUDA_ERROR_NOT_MAPPED = 211,
597   CUDA_ERROR_NOT_MAPPED_AS_ARRAY = 212,
598   CUDA_ERROR_NOT_MAPPED_AS_POINTER = 213,
599   CUDA_ERROR_ECC_UNCORRECTABLE = 214,
600   CUDA_ERROR_UNSUPPORTED_LIMIT = 215,
601   CUDA_ERROR_CONTEXT_ALREADY_IN_USE = 216,
602   CUDA_ERROR_PEER_ACCESS_UNSUPPORTED = 217,
603   CUDA_ERROR_INVALID_PTX = 218,
604   CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = 219,
605   CUDA_ERROR_NVLINK_UNCORRECTABLE = 220,
606   CUDA_ERROR_JIT_COMPILER_NOT_FOUND = 221,
607   CUDA_ERROR_INVALID_SOURCE = 300,
608   CUDA_ERROR_FILE_NOT_FOUND = 301,
609   CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302,
610   CUDA_ERROR_SHARED_OBJECT_INIT_FAILED = 303,
611   CUDA_ERROR_OPERATING_SYSTEM = 304,
612   CUDA_ERROR_INVALID_HANDLE = 400,
613   CUDA_ERROR_NOT_FOUND = 500,
614   CUDA_ERROR_NOT_READY = 600,
615   CUDA_ERROR_ILLEGAL_ADDRESS = 700,
616   CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES = 701,
617   CUDA_ERROR_LAUNCH_TIMEOUT = 702,
618   CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING = 703,
619   CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED = 704,
620   CUDA_ERROR_PEER_ACCESS_NOT_ENABLED = 705,
621   CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE = 708,
622   CUDA_ERROR_CONTEXT_IS_DESTROYED = 709,
623   CUDA_ERROR_ASSERT = 710,
624   CUDA_ERROR_TOO_MANY_PEERS = 711,
625   CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED = 712,
626   CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED = 713,
627   CUDA_ERROR_HARDWARE_STACK_ERROR = 714,
628   CUDA_ERROR_ILLEGAL_INSTRUCTION = 715,
629   CUDA_ERROR_MISALIGNED_ADDRESS = 716,
630   CUDA_ERROR_INVALID_ADDRESS_SPACE = 717,
631   CUDA_ERROR_INVALID_PC = 718,
632   CUDA_ERROR_LAUNCH_FAILED = 719,
633   CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE = 720,
634   CUDA_ERROR_NOT_PERMITTED = 800,
635   CUDA_ERROR_NOT_SUPPORTED = 801,
636   CUDA_ERROR_UNKNOWN = 999,
637 } CUresult;
638
639 typedef enum CUdevice_P2PAttribute_enum {
640   CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK = 0x01,
641   CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED = 0x02,
642   CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED = 0x03,
643 } CUdevice_P2PAttribute;
644
645 typedef void (CUDA_CB *CUstreamCallback)(CUstream hStream, CUresult status, void* userData);
646 typedef size_t (CUDA_CB *CUoccupancyB2DSize)(int blockSize);
647
648 typedef struct CUDA_MEMCPY2D_st {
649   size_t srcXInBytes;
650   size_t srcY;
651   CUmemorytype srcMemoryType;
652   const void* srcHost;
653   CUdeviceptr srcDevice;
654   CUarray srcArray;
655   size_t srcPitch;
656   size_t dstXInBytes;
657   size_t dstY;
658   CUmemorytype dstMemoryType;
659   void* dstHost;
660   CUdeviceptr dstDevice;
661   CUarray dstArray;
662   size_t dstPitch;
663   size_t WidthInBytes;
664   size_t Height;
665 } CUDA_MEMCPY2D;
666
667 typedef struct CUDA_MEMCPY3D_st {
668   size_t srcXInBytes;
669   size_t srcY;
670   size_t srcZ;
671   size_t srcLOD;
672   CUmemorytype srcMemoryType;
673   const void* srcHost;
674   CUdeviceptr srcDevice;
675   CUarray srcArray;
676   void* reserved0;
677   size_t srcPitch;
678   size_t srcHeight;
679   size_t dstXInBytes;
680   size_t dstY;
681   size_t dstZ;
682   size_t dstLOD;
683   CUmemorytype dstMemoryType;
684   void* dstHost;
685   CUdeviceptr dstDevice;
686   CUarray dstArray;
687   void* reserved1;
688   size_t dstPitch;
689   size_t dstHeight;
690   size_t WidthInBytes;
691   size_t Height;
692   size_t Depth;
693 } CUDA_MEMCPY3D;
694
695 typedef struct CUDA_MEMCPY3D_PEER_st {
696   size_t srcXInBytes;
697   size_t srcY;
698   size_t srcZ;
699   size_t srcLOD;
700   CUmemorytype srcMemoryType;
701   const void* srcHost;
702   CUdeviceptr srcDevice;
703   CUarray srcArray;
704   CUcontext srcContext;
705   size_t srcPitch;
706   size_t srcHeight;
707   size_t dstXInBytes;
708   size_t dstY;
709   size_t dstZ;
710   size_t dstLOD;
711   CUmemorytype dstMemoryType;
712   void* dstHost;
713   CUdeviceptr dstDevice;
714   CUarray dstArray;
715   CUcontext dstContext;
716   size_t dstPitch;
717   size_t dstHeight;
718   size_t WidthInBytes;
719   size_t Height;
720   size_t Depth;
721 } CUDA_MEMCPY3D_PEER;
722
723 typedef struct CUDA_ARRAY_DESCRIPTOR_st {
724   size_t Width;
725   size_t Height;
726   CUarray_format Format;
727   unsigned int NumChannels;
728 } CUDA_ARRAY_DESCRIPTOR;
729
730 typedef struct CUDA_ARRAY3D_DESCRIPTOR_st {
731   size_t Width;
732   size_t Height;
733   size_t Depth;
734   CUarray_format Format;
735   unsigned int NumChannels;
736   unsigned int Flags;
737 } CUDA_ARRAY3D_DESCRIPTOR;
738
739 typedef struct CUDA_RESOURCE_DESC_st {
740   CUresourcetype resType;
741   union {
742     struct {
743       CUarray hArray;
744     } array;
745     struct {
746       CUmipmappedArray hMipmappedArray;
747     } mipmap;
748     struct {
749       CUdeviceptr devPtr;
750       CUarray_format format;
751       unsigned int numChannels;
752       size_t sizeInBytes;
753     } linear;
754     struct {
755       CUdeviceptr devPtr;
756       CUarray_format format;
757       unsigned int numChannels;
758       size_t width;
759       size_t height;
760       size_t pitchInBytes;
761     } pitch2D;
762     struct {
763       int reserved[32];
764     } reserved;
765   } res;
766   unsigned int flags;
767 } CUDA_RESOURCE_DESC;
768
769 typedef struct CUDA_TEXTURE_DESC_st {
770   CUaddress_mode addressMode[3];
771   CUfilter_mode filterMode;
772   unsigned int flags;
773   unsigned int maxAnisotropy;
774   CUfilter_mode mipmapFilterMode;
775   float mipmapLevelBias;
776   float minMipmapLevelClamp;
777   float maxMipmapLevelClamp;
778   float borderColor[4];
779   int reserved[12];
780 } CUDA_TEXTURE_DESC;
781
782 typedef enum CUresourceViewFormat_enum {
783   CU_RES_VIEW_FORMAT_NONE = 0x00,
784   CU_RES_VIEW_FORMAT_UINT_1X8 = 0x01,
785   CU_RES_VIEW_FORMAT_UINT_2X8 = 0x02,
786   CU_RES_VIEW_FORMAT_UINT_4X8 = 0x03,
787   CU_RES_VIEW_FORMAT_SINT_1X8 = 0x04,
788   CU_RES_VIEW_FORMAT_SINT_2X8 = 0x05,
789   CU_RES_VIEW_FORMAT_SINT_4X8 = 0x06,
790   CU_RES_VIEW_FORMAT_UINT_1X16 = 0x07,
791   CU_RES_VIEW_FORMAT_UINT_2X16 = 0x08,
792   CU_RES_VIEW_FORMAT_UINT_4X16 = 0x09,
793   CU_RES_VIEW_FORMAT_SINT_1X16 = 0x0a,
794   CU_RES_VIEW_FORMAT_SINT_2X16 = 0x0b,
795   CU_RES_VIEW_FORMAT_SINT_4X16 = 0x0c,
796   CU_RES_VIEW_FORMAT_UINT_1X32 = 0x0d,
797   CU_RES_VIEW_FORMAT_UINT_2X32 = 0x0e,
798   CU_RES_VIEW_FORMAT_UINT_4X32 = 0x0f,
799   CU_RES_VIEW_FORMAT_SINT_1X32 = 0x10,
800   CU_RES_VIEW_FORMAT_SINT_2X32 = 0x11,
801   CU_RES_VIEW_FORMAT_SINT_4X32 = 0x12,
802   CU_RES_VIEW_FORMAT_FLOAT_1X16 = 0x13,
803   CU_RES_VIEW_FORMAT_FLOAT_2X16 = 0x14,
804   CU_RES_VIEW_FORMAT_FLOAT_4X16 = 0x15,
805   CU_RES_VIEW_FORMAT_FLOAT_1X32 = 0x16,
806   CU_RES_VIEW_FORMAT_FLOAT_2X32 = 0x17,
807   CU_RES_VIEW_FORMAT_FLOAT_4X32 = 0x18,
808   CU_RES_VIEW_FORMAT_UNSIGNED_BC1 = 0x19,
809   CU_RES_VIEW_FORMAT_UNSIGNED_BC2 = 0x1a,
810   CU_RES_VIEW_FORMAT_UNSIGNED_BC3 = 0x1b,
811   CU_RES_VIEW_FORMAT_UNSIGNED_BC4 = 0x1c,
812   CU_RES_VIEW_FORMAT_SIGNED_BC4 = 0x1d,
813   CU_RES_VIEW_FORMAT_UNSIGNED_BC5 = 0x1e,
814   CU_RES_VIEW_FORMAT_SIGNED_BC5 = 0x1f,
815   CU_RES_VIEW_FORMAT_UNSIGNED_BC6H = 0x20,
816   CU_RES_VIEW_FORMAT_SIGNED_BC6H = 0x21,
817   CU_RES_VIEW_FORMAT_UNSIGNED_BC7 = 0x22,
818 } CUresourceViewFormat;
819
820 typedef struct CUDA_RESOURCE_VIEW_DESC_st {
821   CUresourceViewFormat format;
822   size_t width;
823   size_t height;
824   size_t depth;
825   unsigned int firstMipmapLevel;
826   unsigned int lastMipmapLevel;
827   unsigned int firstLayer;
828   unsigned int lastLayer;
829   unsigned int reserved[16];
830 } CUDA_RESOURCE_VIEW_DESC;
831
832 typedef struct CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st {
833   unsigned long long p2pToken;
834   unsigned int vaSpaceToken;
835 } CUDA_POINTER_ATTRIBUTE_P2P_TOKENS;
836
837 typedef struct CUDA_LAUNCH_PARAMS_st {
838   CUfunction function;
839   unsigned int gridDimX;
840   unsigned int gridDimY;
841   unsigned int gridDimZ;
842   unsigned int blockDimX;
843   unsigned int blockDimY;
844   unsigned int blockDimZ;
845   unsigned int sharedMemBytes;
846   CUstream hStream;
847   void** kernelParams;
848 } CUDA_LAUNCH_PARAMS;
849 typedef unsigned int GLenum;
850 typedef unsigned int GLuint;
851 typedef int GLint;
852
853 typedef enum CUGLDeviceList_enum {
854   CU_GL_DEVICE_LIST_ALL = 0x01,
855   CU_GL_DEVICE_LIST_CURRENT_FRAME = 0x02,
856   CU_GL_DEVICE_LIST_NEXT_FRAME = 0x03,
857 } CUGLDeviceList;
858
859 typedef enum CUGLmap_flags_enum {
860   CU_GL_MAP_RESOURCE_FLAGS_NONE = 0x00,
861   CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY = 0x01,
862   CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 0x02,
863 } CUGLmap_flags;
864
865 typedef enum  {
866   NVRTC_SUCCESS = 0,
867   NVRTC_ERROR_OUT_OF_MEMORY = 1,
868   NVRTC_ERROR_PROGRAM_CREATION_FAILURE = 2,
869   NVRTC_ERROR_INVALID_INPUT = 3,
870   NVRTC_ERROR_INVALID_PROGRAM = 4,
871   NVRTC_ERROR_INVALID_OPTION = 5,
872   NVRTC_ERROR_COMPILATION = 6,
873   NVRTC_ERROR_BUILTIN_OPERATION_FAILURE = 7,
874   NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION = 8,
875   NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = 9,
876   NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID = 10,
877   NVRTC_ERROR_INTERNAL_ERROR = 11,
878 } nvrtcResult;
879
880 typedef struct _nvrtcProgram* nvrtcProgram;
881
882
883 /* Function types. */
884 typedef CUresult CUDAAPI tcuGetErrorString(CUresult error, const char** pStr);
885 typedef CUresult CUDAAPI tcuGetErrorName(CUresult error, const char** pStr);
886 typedef CUresult CUDAAPI tcuInit(unsigned int Flags);
887 typedef CUresult CUDAAPI tcuDriverGetVersion(int* driverVersion);
888 typedef CUresult CUDAAPI tcuDeviceGet(CUdevice* device, int ordinal);
889 typedef CUresult CUDAAPI tcuDeviceGetCount(int* count);
890 typedef CUresult CUDAAPI tcuDeviceGetName(char* name, int len, CUdevice dev);
891 typedef CUresult CUDAAPI tcuDeviceTotalMem_v2(size_t* bytes, CUdevice dev);
892 typedef CUresult CUDAAPI tcuDeviceGetAttribute(int* pi, CUdevice_attribute attrib, CUdevice dev);
893 typedef CUresult CUDAAPI tcuDeviceGetProperties(CUdevprop* prop, CUdevice dev);
894 typedef CUresult CUDAAPI tcuDeviceComputeCapability(int* major, int* minor, CUdevice dev);
895 typedef CUresult CUDAAPI tcuDevicePrimaryCtxRetain(CUcontext* pctx, CUdevice dev);
896 typedef CUresult CUDAAPI tcuDevicePrimaryCtxRelease(CUdevice dev);
897 typedef CUresult CUDAAPI tcuDevicePrimaryCtxSetFlags(CUdevice dev, unsigned int flags);
898 typedef CUresult CUDAAPI tcuDevicePrimaryCtxGetState(CUdevice dev, unsigned int* flags, int* active);
899 typedef CUresult CUDAAPI tcuDevicePrimaryCtxReset(CUdevice dev);
900 typedef CUresult CUDAAPI tcuCtxCreate_v2(CUcontext* pctx, unsigned int flags, CUdevice dev);
901 typedef CUresult CUDAAPI tcuCtxDestroy_v2(CUcontext ctx);
902 typedef CUresult CUDAAPI tcuCtxPushCurrent_v2(CUcontext ctx);
903 typedef CUresult CUDAAPI tcuCtxPopCurrent_v2(CUcontext* pctx);
904 typedef CUresult CUDAAPI tcuCtxSetCurrent(CUcontext ctx);
905 typedef CUresult CUDAAPI tcuCtxGetCurrent(CUcontext* pctx);
906 typedef CUresult CUDAAPI tcuCtxGetDevice(CUdevice* device);
907 typedef CUresult CUDAAPI tcuCtxGetFlags(unsigned int* flags);
908 typedef CUresult CUDAAPI tcuCtxSynchronize(void);
909 typedef CUresult CUDAAPI tcuCtxSetLimit(CUlimit limit, size_t value);
910 typedef CUresult CUDAAPI tcuCtxGetLimit(size_t* pvalue, CUlimit limit);
911 typedef CUresult CUDAAPI tcuCtxGetCacheConfig(CUfunc_cache* pconfig);
912 typedef CUresult CUDAAPI tcuCtxSetCacheConfig(CUfunc_cache config);
913 typedef CUresult CUDAAPI tcuCtxGetSharedMemConfig(CUsharedconfig* pConfig);
914 typedef CUresult CUDAAPI tcuCtxSetSharedMemConfig(CUsharedconfig config);
915 typedef CUresult CUDAAPI tcuCtxGetApiVersion(CUcontext ctx, unsigned int* version);
916 typedef CUresult CUDAAPI tcuCtxGetStreamPriorityRange(int* leastPriority, int* greatestPriority);
917 typedef CUresult CUDAAPI tcuCtxAttach(CUcontext* pctx, unsigned int flags);
918 typedef CUresult CUDAAPI tcuCtxDetach(CUcontext ctx);
919 typedef CUresult CUDAAPI tcuModuleLoad(CUmodule* module, const char* fname);
920 typedef CUresult CUDAAPI tcuModuleLoadData(CUmodule* module, const void* image);
921 typedef CUresult CUDAAPI tcuModuleLoadDataEx(CUmodule* module, const void* image, unsigned int numOptions, CUjit_option* options, void** optionValues);
922 typedef CUresult CUDAAPI tcuModuleLoadFatBinary(CUmodule* module, const void* fatCubin);
923 typedef CUresult CUDAAPI tcuModuleUnload(CUmodule hmod);
924 typedef CUresult CUDAAPI tcuModuleGetFunction(CUfunction* hfunc, CUmodule hmod, const char* name);
925 typedef CUresult CUDAAPI tcuModuleGetGlobal_v2(CUdeviceptr* dptr, size_t* bytes, CUmodule hmod, const char* name);
926 typedef CUresult CUDAAPI tcuModuleGetTexRef(CUtexref* pTexRef, CUmodule hmod, const char* name);
927 typedef CUresult CUDAAPI tcuModuleGetSurfRef(CUsurfref* pSurfRef, CUmodule hmod, const char* name);
928 typedef CUresult CUDAAPI tcuLinkCreate_v2(unsigned int numOptions, CUjit_option* options, void** optionValues, CUlinkState* stateOut);
929 typedef CUresult CUDAAPI tcuLinkAddData_v2(CUlinkState state, CUjitInputType type, void* data, size_t size, const char* name, unsigned int numOptions, CUjit_option* options, void** optionValues);
930 typedef CUresult CUDAAPI tcuLinkAddFile_v2(CUlinkState state, CUjitInputType type, const char* path, unsigned int numOptions, CUjit_option* options, void** optionValues);
931 typedef CUresult CUDAAPI tcuLinkComplete(CUlinkState state, void** cubinOut, size_t* sizeOut);
932 typedef CUresult CUDAAPI tcuLinkDestroy(CUlinkState state);
933 typedef CUresult CUDAAPI tcuMemGetInfo_v2(size_t* free, size_t* total);
934 typedef CUresult CUDAAPI tcuMemAlloc_v2(CUdeviceptr* dptr, size_t bytesize);
935 typedef CUresult CUDAAPI tcuMemAllocPitch_v2(CUdeviceptr* dptr, size_t* pPitch, size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes);
936 typedef CUresult CUDAAPI tcuMemFree_v2(CUdeviceptr dptr);
937 typedef CUresult CUDAAPI tcuMemGetAddressRange_v2(CUdeviceptr* pbase, size_t* psize, CUdeviceptr dptr);
938 typedef CUresult CUDAAPI tcuMemAllocHost_v2(void** pp, size_t bytesize);
939 typedef CUresult CUDAAPI tcuMemFreeHost(void* p);
940 typedef CUresult CUDAAPI tcuMemHostAlloc(void** pp, size_t bytesize, unsigned int Flags);
941 typedef CUresult CUDAAPI tcuMemHostGetDevicePointer_v2(CUdeviceptr* pdptr, void* p, unsigned int Flags);
942 typedef CUresult CUDAAPI tcuMemHostGetFlags(unsigned int* pFlags, void* p);
943 typedef CUresult CUDAAPI tcuMemAllocManaged(CUdeviceptr* dptr, size_t bytesize, unsigned int flags);
944 typedef CUresult CUDAAPI tcuDeviceGetByPCIBusId(CUdevice* dev, const char* pciBusId);
945 typedef CUresult CUDAAPI tcuDeviceGetPCIBusId(char* pciBusId, int len, CUdevice dev);
946 typedef CUresult CUDAAPI tcuIpcGetEventHandle(CUipcEventHandle* pHandle, CUevent event);
947 typedef CUresult CUDAAPI tcuIpcOpenEventHandle(CUevent* phEvent, CUipcEventHandle handle);
948 typedef CUresult CUDAAPI tcuIpcGetMemHandle(CUipcMemHandle* pHandle, CUdeviceptr dptr);
949 typedef CUresult CUDAAPI tcuIpcOpenMemHandle(CUdeviceptr* pdptr, CUipcMemHandle handle, unsigned int Flags);
950 typedef CUresult CUDAAPI tcuIpcCloseMemHandle(CUdeviceptr dptr);
951 typedef CUresult CUDAAPI tcuMemHostRegister_v2(void* p, size_t bytesize, unsigned int Flags);
952 typedef CUresult CUDAAPI tcuMemHostUnregister(void* p);
953 typedef CUresult CUDAAPI tcuMemcpy(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount);
954 typedef CUresult CUDAAPI tcuMemcpyPeer(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount);
955 typedef CUresult CUDAAPI tcuMemcpyHtoD_v2(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount);
956 typedef CUresult CUDAAPI tcuMemcpyDtoH_v2(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount);
957 typedef CUresult CUDAAPI tcuMemcpyDtoD_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount);
958 typedef CUresult CUDAAPI tcuMemcpyDtoA_v2(CUarray dstArray, size_t dstOffset, CUdeviceptr srcDevice, size_t ByteCount);
959 typedef CUresult CUDAAPI tcuMemcpyAtoD_v2(CUdeviceptr dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount);
960 typedef CUresult CUDAAPI tcuMemcpyHtoA_v2(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount);
961 typedef CUresult CUDAAPI tcuMemcpyAtoH_v2(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount);
962 typedef CUresult CUDAAPI tcuMemcpyAtoA_v2(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount);
963 typedef CUresult CUDAAPI tcuMemcpy2D_v2(const CUDA_MEMCPY2D* pCopy);
964 typedef CUresult CUDAAPI tcuMemcpy2DUnaligned_v2(const CUDA_MEMCPY2D* pCopy);
965 typedef CUresult CUDAAPI tcuMemcpy3D_v2(const CUDA_MEMCPY3D* pCopy);
966 typedef CUresult CUDAAPI tcuMemcpy3DPeer(const CUDA_MEMCPY3D_PEER* pCopy);
967 typedef CUresult CUDAAPI tcuMemcpyAsync(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount, CUstream hStream);
968 typedef CUresult CUDAAPI tcuMemcpyPeerAsync(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream);
969 typedef CUresult CUDAAPI tcuMemcpyHtoDAsync_v2(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount, CUstream hStream);
970 typedef CUresult CUDAAPI tcuMemcpyDtoHAsync_v2(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream);
971 typedef CUresult CUDAAPI tcuMemcpyDtoDAsync_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream);
972 typedef CUresult CUDAAPI tcuMemcpyHtoAAsync_v2(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount, CUstream hStream);
973 typedef CUresult CUDAAPI tcuMemcpyAtoHAsync_v2(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream);
974 typedef CUresult CUDAAPI tcuMemcpy2DAsync_v2(const CUDA_MEMCPY2D* pCopy, CUstream hStream);
975 typedef CUresult CUDAAPI tcuMemcpy3DAsync_v2(const CUDA_MEMCPY3D* pCopy, CUstream hStream);
976 typedef CUresult CUDAAPI tcuMemcpy3DPeerAsync(const CUDA_MEMCPY3D_PEER* pCopy, CUstream hStream);
977 typedef CUresult CUDAAPI tcuMemsetD8_v2(CUdeviceptr dstDevice, unsigned char uc, size_t N);
978 typedef CUresult CUDAAPI tcuMemsetD16_v2(CUdeviceptr dstDevice, unsigned short us, size_t N);
979 typedef CUresult CUDAAPI tcuMemsetD32_v2(CUdeviceptr dstDevice, unsigned int ui, size_t N);
980 typedef CUresult CUDAAPI tcuMemsetD2D8_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height);
981 typedef CUresult CUDAAPI tcuMemsetD2D16_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height);
982 typedef CUresult CUDAAPI tcuMemsetD2D32_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height);
983 typedef CUresult CUDAAPI tcuMemsetD8Async(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream);
984 typedef CUresult CUDAAPI tcuMemsetD16Async(CUdeviceptr dstDevice, unsigned short us, size_t N, CUstream hStream);
985 typedef CUresult CUDAAPI tcuMemsetD32Async(CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream);
986 typedef CUresult CUDAAPI tcuMemsetD2D8Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, CUstream hStream);
987 typedef CUresult CUDAAPI tcuMemsetD2D16Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, CUstream hStream);
988 typedef CUresult CUDAAPI tcuMemsetD2D32Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, CUstream hStream);
989 typedef CUresult CUDAAPI tcuArrayCreate_v2(CUarray* pHandle, const CUDA_ARRAY_DESCRIPTOR* pAllocateArray);
990 typedef CUresult CUDAAPI tcuArrayGetDescriptor_v2(CUDA_ARRAY_DESCRIPTOR* pArrayDescriptor, CUarray hArray);
991 typedef CUresult CUDAAPI tcuArrayDestroy(CUarray hArray);
992 typedef CUresult CUDAAPI tcuArray3DCreate_v2(CUarray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pAllocateArray);
993 typedef CUresult CUDAAPI tcuArray3DGetDescriptor_v2(CUDA_ARRAY3D_DESCRIPTOR* pArrayDescriptor, CUarray hArray);
994 typedef CUresult CUDAAPI tcuMipmappedArrayCreate(CUmipmappedArray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pMipmappedArrayDesc, unsigned int numMipmapLevels);
995 typedef CUresult CUDAAPI tcuMipmappedArrayGetLevel(CUarray* pLevelArray, CUmipmappedArray hMipmappedArray, unsigned int level);
996 typedef CUresult CUDAAPI tcuMipmappedArrayDestroy(CUmipmappedArray hMipmappedArray);
997 typedef CUresult CUDAAPI tcuPointerGetAttribute(void* data, CUpointer_attribute attribute, CUdeviceptr ptr);
998 typedef CUresult CUDAAPI tcuMemPrefetchAsync(CUdeviceptr devPtr, size_t count, CUdevice dstDevice, CUstream hStream);
999 typedef CUresult CUDAAPI tcuMemAdvise(CUdeviceptr devPtr, size_t count, CUmem_advise advice, CUdevice device);
1000 typedef CUresult CUDAAPI tcuMemRangeGetAttribute(void* data, size_t dataSize, CUmem_range_attribute attribute, CUdeviceptr devPtr, size_t count);
1001 typedef CUresult CUDAAPI tcuMemRangeGetAttributes(void** data, size_t* dataSizes, CUmem_range_attribute* attributes, size_t numAttributes, CUdeviceptr devPtr, size_t count);
1002 typedef CUresult CUDAAPI tcuPointerSetAttribute(const void* value, CUpointer_attribute attribute, CUdeviceptr ptr);
1003 typedef CUresult CUDAAPI tcuPointerGetAttributes(unsigned int numAttributes, CUpointer_attribute* attributes, void** data, CUdeviceptr ptr);
1004 typedef CUresult CUDAAPI tcuStreamCreate(CUstream* phStream, unsigned int Flags);
1005 typedef CUresult CUDAAPI tcuStreamCreateWithPriority(CUstream* phStream, unsigned int flags, int priority);
1006 typedef CUresult CUDAAPI tcuStreamGetPriority(CUstream hStream, int* priority);
1007 typedef CUresult CUDAAPI tcuStreamGetFlags(CUstream hStream, unsigned int* flags);
1008 typedef CUresult CUDAAPI tcuStreamWaitEvent(CUstream hStream, CUevent hEvent, unsigned int Flags);
1009 typedef CUresult CUDAAPI tcuStreamAddCallback(CUstream hStream, CUstreamCallback callback, void* userData, unsigned int flags);
1010 typedef CUresult CUDAAPI tcuStreamAttachMemAsync(CUstream hStream, CUdeviceptr dptr, size_t length, unsigned int flags);
1011 typedef CUresult CUDAAPI tcuStreamQuery(CUstream hStream);
1012 typedef CUresult CUDAAPI tcuStreamSynchronize(CUstream hStream);
1013 typedef CUresult CUDAAPI tcuStreamDestroy_v2(CUstream hStream);
1014 typedef CUresult CUDAAPI tcuEventCreate(CUevent* phEvent, unsigned int Flags);
1015 typedef CUresult CUDAAPI tcuEventRecord(CUevent hEvent, CUstream hStream);
1016 typedef CUresult CUDAAPI tcuEventQuery(CUevent hEvent);
1017 typedef CUresult CUDAAPI tcuEventSynchronize(CUevent hEvent);
1018 typedef CUresult CUDAAPI tcuEventDestroy_v2(CUevent hEvent);
1019 typedef CUresult CUDAAPI tcuEventElapsedTime(float* pMilliseconds, CUevent hStart, CUevent hEnd);
1020 typedef CUresult CUDAAPI tcuStreamWaitValue32(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags);
1021 typedef CUresult CUDAAPI tcuStreamWaitValue64(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags);
1022 typedef CUresult CUDAAPI tcuStreamWriteValue32(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags);
1023 typedef CUresult CUDAAPI tcuStreamWriteValue64(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags);
1024 typedef CUresult CUDAAPI tcuStreamBatchMemOp(CUstream stream, unsigned int count, CUstreamBatchMemOpParams* paramArray, unsigned int flags);
1025 typedef CUresult CUDAAPI tcuFuncGetAttribute(int* pi, CUfunction_attribute attrib, CUfunction hfunc);
1026 typedef CUresult CUDAAPI tcuFuncSetAttribute(CUfunction hfunc, CUfunction_attribute attrib, int value);
1027 typedef CUresult CUDAAPI tcuFuncSetCacheConfig(CUfunction hfunc, CUfunc_cache config);
1028 typedef CUresult CUDAAPI tcuFuncSetSharedMemConfig(CUfunction hfunc, CUsharedconfig config);
1029 typedef CUresult CUDAAPI tcuLaunchKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams, void** extra);
1030 typedef CUresult CUDAAPI tcuLaunchCooperativeKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams);
1031 typedef CUresult CUDAAPI tcuLaunchCooperativeKernelMultiDevice(CUDA_LAUNCH_PARAMS* launchParamsList, unsigned int numDevices, unsigned int flags);
1032 typedef CUresult CUDAAPI tcuFuncSetBlockShape(CUfunction hfunc, int x, int y, int z);
1033 typedef CUresult CUDAAPI tcuFuncSetSharedSize(CUfunction hfunc, unsigned int bytes);
1034 typedef CUresult CUDAAPI tcuParamSetSize(CUfunction hfunc, unsigned int numbytes);
1035 typedef CUresult CUDAAPI tcuParamSeti(CUfunction hfunc, int offset, unsigned int value);
1036 typedef CUresult CUDAAPI tcuParamSetf(CUfunction hfunc, int offset, float value);
1037 typedef CUresult CUDAAPI tcuParamSetv(CUfunction hfunc, int offset, void* ptr, unsigned int numbytes);
1038 typedef CUresult CUDAAPI tcuLaunch(CUfunction f);
1039 typedef CUresult CUDAAPI tcuLaunchGrid(CUfunction f, int grid_width, int grid_height);
1040 typedef CUresult CUDAAPI tcuLaunchGridAsync(CUfunction f, int grid_width, int grid_height, CUstream hStream);
1041 typedef CUresult CUDAAPI tcuParamSetTexRef(CUfunction hfunc, int texunit, CUtexref hTexRef);
1042 typedef CUresult CUDAAPI tcuOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize);
1043 typedef CUresult CUDAAPI tcuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize, unsigned int flags);
1044 typedef CUresult CUDAAPI tcuOccupancyMaxPotentialBlockSize(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit);
1045 typedef CUresult CUDAAPI tcuOccupancyMaxPotentialBlockSizeWithFlags(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit, unsigned int flags);
1046 typedef CUresult CUDAAPI tcuTexRefSetArray(CUtexref hTexRef, CUarray hArray, unsigned int Flags);
1047 typedef CUresult CUDAAPI tcuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, unsigned int Flags);
1048 typedef CUresult CUDAAPI tcuTexRefSetAddress_v2(size_t* ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, size_t bytes);
1049 typedef CUresult CUDAAPI tcuTexRefSetAddress2D_v3(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR* desc, CUdeviceptr dptr, size_t Pitch);
1050 typedef CUresult CUDAAPI tcuTexRefSetFormat(CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents);
1051 typedef CUresult CUDAAPI tcuTexRefSetAddressMode(CUtexref hTexRef, int dim, CUaddress_mode am);
1052 typedef CUresult CUDAAPI tcuTexRefSetFilterMode(CUtexref hTexRef, CUfilter_mode fm);
1053 typedef CUresult CUDAAPI tcuTexRefSetMipmapFilterMode(CUtexref hTexRef, CUfilter_mode fm);
1054 typedef CUresult CUDAAPI tcuTexRefSetMipmapLevelBias(CUtexref hTexRef, float bias);
1055 typedef CUresult CUDAAPI tcuTexRefSetMipmapLevelClamp(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp);
1056 typedef CUresult CUDAAPI tcuTexRefSetMaxAnisotropy(CUtexref hTexRef, unsigned int maxAniso);
1057 typedef CUresult CUDAAPI tcuTexRefSetBorderColor(CUtexref hTexRef, float* pBorderColor);
1058 typedef CUresult CUDAAPI tcuTexRefSetFlags(CUtexref hTexRef, unsigned int Flags);
1059 typedef CUresult CUDAAPI tcuTexRefGetAddress_v2(CUdeviceptr* pdptr, CUtexref hTexRef);
1060 typedef CUresult CUDAAPI tcuTexRefGetArray(CUarray* phArray, CUtexref hTexRef);
1061 typedef CUresult CUDAAPI tcuTexRefGetMipmappedArray(CUmipmappedArray* phMipmappedArray, CUtexref hTexRef);
1062 typedef CUresult CUDAAPI tcuTexRefGetAddressMode(CUaddress_mode* pam, CUtexref hTexRef, int dim);
1063 typedef CUresult CUDAAPI tcuTexRefGetFilterMode(CUfilter_mode* pfm, CUtexref hTexRef);
1064 typedef CUresult CUDAAPI tcuTexRefGetFormat(CUarray_format* pFormat, int* pNumChannels, CUtexref hTexRef);
1065 typedef CUresult CUDAAPI tcuTexRefGetMipmapFilterMode(CUfilter_mode* pfm, CUtexref hTexRef);
1066 typedef CUresult CUDAAPI tcuTexRefGetMipmapLevelBias(float* pbias, CUtexref hTexRef);
1067 typedef CUresult CUDAAPI tcuTexRefGetMipmapLevelClamp(float* pminMipmapLevelClamp, float* pmaxMipmapLevelClamp, CUtexref hTexRef);
1068 typedef CUresult CUDAAPI tcuTexRefGetMaxAnisotropy(int* pmaxAniso, CUtexref hTexRef);
1069 typedef CUresult CUDAAPI tcuTexRefGetBorderColor(float* pBorderColor, CUtexref hTexRef);
1070 typedef CUresult CUDAAPI tcuTexRefGetFlags(unsigned int* pFlags, CUtexref hTexRef);
1071 typedef CUresult CUDAAPI tcuTexRefCreate(CUtexref* pTexRef);
1072 typedef CUresult CUDAAPI tcuTexRefDestroy(CUtexref hTexRef);
1073 typedef CUresult CUDAAPI tcuSurfRefSetArray(CUsurfref hSurfRef, CUarray hArray, unsigned int Flags);
1074 typedef CUresult CUDAAPI tcuSurfRefGetArray(CUarray* phArray, CUsurfref hSurfRef);
1075 typedef CUresult CUDAAPI tcuTexObjectCreate(CUtexObject* pTexObject, const CUDA_RESOURCE_DESC* pResDesc, const CUDA_TEXTURE_DESC* pTexDesc, const CUDA_RESOURCE_VIEW_DESC* pResViewDesc);
1076 typedef CUresult CUDAAPI tcuTexObjectDestroy(CUtexObject texObject);
1077 typedef CUresult CUDAAPI tcuTexObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUtexObject texObject);
1078 typedef CUresult CUDAAPI tcuTexObjectGetTextureDesc(CUDA_TEXTURE_DESC* pTexDesc, CUtexObject texObject);
1079 typedef CUresult CUDAAPI tcuTexObjectGetResourceViewDesc(CUDA_RESOURCE_VIEW_DESC* pResViewDesc, CUtexObject texObject);
1080 typedef CUresult CUDAAPI tcuSurfObjectCreate(CUsurfObject* pSurfObject, const CUDA_RESOURCE_DESC* pResDesc);
1081 typedef CUresult CUDAAPI tcuSurfObjectDestroy(CUsurfObject surfObject);
1082 typedef CUresult CUDAAPI tcuSurfObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUsurfObject surfObject);
1083 typedef CUresult CUDAAPI tcuDeviceCanAccessPeer(int* canAccessPeer, CUdevice dev, CUdevice peerDev);
1084 typedef CUresult CUDAAPI tcuCtxEnablePeerAccess(CUcontext peerContext, unsigned int Flags);
1085 typedef CUresult CUDAAPI tcuCtxDisablePeerAccess(CUcontext peerContext);
1086 typedef CUresult CUDAAPI tcuDeviceGetP2PAttribute(int* value, CUdevice_P2PAttribute attrib, CUdevice srcDevice, CUdevice dstDevice);
1087 typedef CUresult CUDAAPI tcuGraphicsUnregisterResource(CUgraphicsResource resource);
1088 typedef CUresult CUDAAPI tcuGraphicsSubResourceGetMappedArray(CUarray* pArray, CUgraphicsResource resource, unsigned int arrayIndex, unsigned int mipLevel);
1089 typedef CUresult CUDAAPI tcuGraphicsResourceGetMappedMipmappedArray(CUmipmappedArray* pMipmappedArray, CUgraphicsResource resource);
1090 typedef CUresult CUDAAPI tcuGraphicsResourceGetMappedPointer_v2(CUdeviceptr* pDevPtr, size_t* pSize, CUgraphicsResource resource);
1091 typedef CUresult CUDAAPI tcuGraphicsResourceSetMapFlags_v2(CUgraphicsResource resource, unsigned int flags);
1092 typedef CUresult CUDAAPI tcuGraphicsMapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream);
1093 typedef CUresult CUDAAPI tcuGraphicsUnmapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream);
1094 typedef CUresult CUDAAPI tcuGetExportTable(const void** ppExportTable, const CUuuid* pExportTableId);
1095
1096 typedef CUresult CUDAAPI tcuGraphicsGLRegisterBuffer(CUgraphicsResource* pCudaResource, GLuint buffer, unsigned int Flags);
1097 typedef CUresult CUDAAPI tcuGraphicsGLRegisterImage(CUgraphicsResource* pCudaResource, GLuint image, GLenum target, unsigned int Flags);
1098 typedef CUresult CUDAAPI tcuGLGetDevices_v2(unsigned int* pCudaDeviceCount, CUdevice* pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList);
1099 typedef CUresult CUDAAPI tcuGLCtxCreate_v2(CUcontext* pCtx, unsigned int Flags, CUdevice device);
1100 typedef CUresult CUDAAPI tcuGLInit(void);
1101 typedef CUresult CUDAAPI tcuGLRegisterBufferObject(GLuint buffer);
1102 typedef CUresult CUDAAPI tcuGLMapBufferObject_v2(CUdeviceptr* dptr, size_t* size, GLuint buffer);
1103 typedef CUresult CUDAAPI tcuGLUnmapBufferObject(GLuint buffer);
1104 typedef CUresult CUDAAPI tcuGLUnregisterBufferObject(GLuint buffer);
1105 typedef CUresult CUDAAPI tcuGLSetBufferObjectMapFlags(GLuint buffer, unsigned int Flags);
1106 typedef CUresult CUDAAPI tcuGLMapBufferObjectAsync_v2(CUdeviceptr* dptr, size_t* size, GLuint buffer, CUstream hStream);
1107 typedef CUresult CUDAAPI tcuGLUnmapBufferObjectAsync(GLuint buffer, CUstream hStream);
1108
1109 typedef const char* CUDAAPI tnvrtcGetErrorString(nvrtcResult result);
1110 typedef nvrtcResult CUDAAPI tnvrtcVersion(int* major, int* minor);
1111 typedef nvrtcResult CUDAAPI tnvrtcCreateProgram(nvrtcProgram* prog, const char* src, const char* name, int numHeaders, const char** headers, const char** includeNames);
1112 typedef nvrtcResult CUDAAPI tnvrtcDestroyProgram(nvrtcProgram* prog);
1113 typedef nvrtcResult CUDAAPI tnvrtcCompileProgram(nvrtcProgram prog, int numOptions, const char** options);
1114 typedef nvrtcResult CUDAAPI tnvrtcGetPTXSize(nvrtcProgram prog, size_t* ptxSizeRet);
1115 typedef nvrtcResult CUDAAPI tnvrtcGetPTX(nvrtcProgram prog, char* ptx);
1116 typedef nvrtcResult CUDAAPI tnvrtcGetProgramLogSize(nvrtcProgram prog, size_t* logSizeRet);
1117 typedef nvrtcResult CUDAAPI tnvrtcGetProgramLog(nvrtcProgram prog, char* log);
1118 typedef nvrtcResult CUDAAPI tnvrtcAddNameExpression(nvrtcProgram prog, const char* name_expression);
1119 typedef nvrtcResult CUDAAPI tnvrtcGetLoweredName(nvrtcProgram prog, const char* name_expression, const char** lowered_name);
1120
1121
1122 /* Function declarations. */
1123 extern tcuGetErrorString *cuGetErrorString;
1124 extern tcuGetErrorName *cuGetErrorName;
1125 extern tcuInit *cuInit;
1126 extern tcuDriverGetVersion *cuDriverGetVersion;
1127 extern tcuDeviceGet *cuDeviceGet;
1128 extern tcuDeviceGetCount *cuDeviceGetCount;
1129 extern tcuDeviceGetName *cuDeviceGetName;
1130 extern tcuDeviceTotalMem_v2 *cuDeviceTotalMem_v2;
1131 extern tcuDeviceGetAttribute *cuDeviceGetAttribute;
1132 extern tcuDeviceGetProperties *cuDeviceGetProperties;
1133 extern tcuDeviceComputeCapability *cuDeviceComputeCapability;
1134 extern tcuDevicePrimaryCtxRetain *cuDevicePrimaryCtxRetain;
1135 extern tcuDevicePrimaryCtxRelease *cuDevicePrimaryCtxRelease;
1136 extern tcuDevicePrimaryCtxSetFlags *cuDevicePrimaryCtxSetFlags;
1137 extern tcuDevicePrimaryCtxGetState *cuDevicePrimaryCtxGetState;
1138 extern tcuDevicePrimaryCtxReset *cuDevicePrimaryCtxReset;
1139 extern tcuCtxCreate_v2 *cuCtxCreate_v2;
1140 extern tcuCtxDestroy_v2 *cuCtxDestroy_v2;
1141 extern tcuCtxPushCurrent_v2 *cuCtxPushCurrent_v2;
1142 extern tcuCtxPopCurrent_v2 *cuCtxPopCurrent_v2;
1143 extern tcuCtxSetCurrent *cuCtxSetCurrent;
1144 extern tcuCtxGetCurrent *cuCtxGetCurrent;
1145 extern tcuCtxGetDevice *cuCtxGetDevice;
1146 extern tcuCtxGetFlags *cuCtxGetFlags;
1147 extern tcuCtxSynchronize *cuCtxSynchronize;
1148 extern tcuCtxSetLimit *cuCtxSetLimit;
1149 extern tcuCtxGetLimit *cuCtxGetLimit;
1150 extern tcuCtxGetCacheConfig *cuCtxGetCacheConfig;
1151 extern tcuCtxSetCacheConfig *cuCtxSetCacheConfig;
1152 extern tcuCtxGetSharedMemConfig *cuCtxGetSharedMemConfig;
1153 extern tcuCtxSetSharedMemConfig *cuCtxSetSharedMemConfig;
1154 extern tcuCtxGetApiVersion *cuCtxGetApiVersion;
1155 extern tcuCtxGetStreamPriorityRange *cuCtxGetStreamPriorityRange;
1156 extern tcuCtxAttach *cuCtxAttach;
1157 extern tcuCtxDetach *cuCtxDetach;
1158 extern tcuModuleLoad *cuModuleLoad;
1159 extern tcuModuleLoadData *cuModuleLoadData;
1160 extern tcuModuleLoadDataEx *cuModuleLoadDataEx;
1161 extern tcuModuleLoadFatBinary *cuModuleLoadFatBinary;
1162 extern tcuModuleUnload *cuModuleUnload;
1163 extern tcuModuleGetFunction *cuModuleGetFunction;
1164 extern tcuModuleGetGlobal_v2 *cuModuleGetGlobal_v2;
1165 extern tcuModuleGetTexRef *cuModuleGetTexRef;
1166 extern tcuModuleGetSurfRef *cuModuleGetSurfRef;
1167 extern tcuLinkCreate_v2 *cuLinkCreate_v2;
1168 extern tcuLinkAddData_v2 *cuLinkAddData_v2;
1169 extern tcuLinkAddFile_v2 *cuLinkAddFile_v2;
1170 extern tcuLinkComplete *cuLinkComplete;
1171 extern tcuLinkDestroy *cuLinkDestroy;
1172 extern tcuMemGetInfo_v2 *cuMemGetInfo_v2;
1173 extern tcuMemAlloc_v2 *cuMemAlloc_v2;
1174 extern tcuMemAllocPitch_v2 *cuMemAllocPitch_v2;
1175 extern tcuMemFree_v2 *cuMemFree_v2;
1176 extern tcuMemGetAddressRange_v2 *cuMemGetAddressRange_v2;
1177 extern tcuMemAllocHost_v2 *cuMemAllocHost_v2;
1178 extern tcuMemFreeHost *cuMemFreeHost;
1179 extern tcuMemHostAlloc *cuMemHostAlloc;
1180 extern tcuMemHostGetDevicePointer_v2 *cuMemHostGetDevicePointer_v2;
1181 extern tcuMemHostGetFlags *cuMemHostGetFlags;
1182 extern tcuMemAllocManaged *cuMemAllocManaged;
1183 extern tcuDeviceGetByPCIBusId *cuDeviceGetByPCIBusId;
1184 extern tcuDeviceGetPCIBusId *cuDeviceGetPCIBusId;
1185 extern tcuIpcGetEventHandle *cuIpcGetEventHandle;
1186 extern tcuIpcOpenEventHandle *cuIpcOpenEventHandle;
1187 extern tcuIpcGetMemHandle *cuIpcGetMemHandle;
1188 extern tcuIpcOpenMemHandle *cuIpcOpenMemHandle;
1189 extern tcuIpcCloseMemHandle *cuIpcCloseMemHandle;
1190 extern tcuMemHostRegister_v2 *cuMemHostRegister_v2;
1191 extern tcuMemHostUnregister *cuMemHostUnregister;
1192 extern tcuMemcpy *cuMemcpy;
1193 extern tcuMemcpyPeer *cuMemcpyPeer;
1194 extern tcuMemcpyHtoD_v2 *cuMemcpyHtoD_v2;
1195 extern tcuMemcpyDtoH_v2 *cuMemcpyDtoH_v2;
1196 extern tcuMemcpyDtoD_v2 *cuMemcpyDtoD_v2;
1197 extern tcuMemcpyDtoA_v2 *cuMemcpyDtoA_v2;
1198 extern tcuMemcpyAtoD_v2 *cuMemcpyAtoD_v2;
1199 extern tcuMemcpyHtoA_v2 *cuMemcpyHtoA_v2;
1200 extern tcuMemcpyAtoH_v2 *cuMemcpyAtoH_v2;
1201 extern tcuMemcpyAtoA_v2 *cuMemcpyAtoA_v2;
1202 extern tcuMemcpy2D_v2 *cuMemcpy2D_v2;
1203 extern tcuMemcpy2DUnaligned_v2 *cuMemcpy2DUnaligned_v2;
1204 extern tcuMemcpy3D_v2 *cuMemcpy3D_v2;
1205 extern tcuMemcpy3DPeer *cuMemcpy3DPeer;
1206 extern tcuMemcpyAsync *cuMemcpyAsync;
1207 extern tcuMemcpyPeerAsync *cuMemcpyPeerAsync;
1208 extern tcuMemcpyHtoDAsync_v2 *cuMemcpyHtoDAsync_v2;
1209 extern tcuMemcpyDtoHAsync_v2 *cuMemcpyDtoHAsync_v2;
1210 extern tcuMemcpyDtoDAsync_v2 *cuMemcpyDtoDAsync_v2;
1211 extern tcuMemcpyHtoAAsync_v2 *cuMemcpyHtoAAsync_v2;
1212 extern tcuMemcpyAtoHAsync_v2 *cuMemcpyAtoHAsync_v2;
1213 extern tcuMemcpy2DAsync_v2 *cuMemcpy2DAsync_v2;
1214 extern tcuMemcpy3DAsync_v2 *cuMemcpy3DAsync_v2;
1215 extern tcuMemcpy3DPeerAsync *cuMemcpy3DPeerAsync;
1216 extern tcuMemsetD8_v2 *cuMemsetD8_v2;
1217 extern tcuMemsetD16_v2 *cuMemsetD16_v2;
1218 extern tcuMemsetD32_v2 *cuMemsetD32_v2;
1219 extern tcuMemsetD2D8_v2 *cuMemsetD2D8_v2;
1220 extern tcuMemsetD2D16_v2 *cuMemsetD2D16_v2;
1221 extern tcuMemsetD2D32_v2 *cuMemsetD2D32_v2;
1222 extern tcuMemsetD8Async *cuMemsetD8Async;
1223 extern tcuMemsetD16Async *cuMemsetD16Async;
1224 extern tcuMemsetD32Async *cuMemsetD32Async;
1225 extern tcuMemsetD2D8Async *cuMemsetD2D8Async;
1226 extern tcuMemsetD2D16Async *cuMemsetD2D16Async;
1227 extern tcuMemsetD2D32Async *cuMemsetD2D32Async;
1228 extern tcuArrayCreate_v2 *cuArrayCreate_v2;
1229 extern tcuArrayGetDescriptor_v2 *cuArrayGetDescriptor_v2;
1230 extern tcuArrayDestroy *cuArrayDestroy;
1231 extern tcuArray3DCreate_v2 *cuArray3DCreate_v2;
1232 extern tcuArray3DGetDescriptor_v2 *cuArray3DGetDescriptor_v2;
1233 extern tcuMipmappedArrayCreate *cuMipmappedArrayCreate;
1234 extern tcuMipmappedArrayGetLevel *cuMipmappedArrayGetLevel;
1235 extern tcuMipmappedArrayDestroy *cuMipmappedArrayDestroy;
1236 extern tcuPointerGetAttribute *cuPointerGetAttribute;
1237 extern tcuMemPrefetchAsync *cuMemPrefetchAsync;
1238 extern tcuMemAdvise *cuMemAdvise;
1239 extern tcuMemRangeGetAttribute *cuMemRangeGetAttribute;
1240 extern tcuMemRangeGetAttributes *cuMemRangeGetAttributes;
1241 extern tcuPointerSetAttribute *cuPointerSetAttribute;
1242 extern tcuPointerGetAttributes *cuPointerGetAttributes;
1243 extern tcuStreamCreate *cuStreamCreate;
1244 extern tcuStreamCreateWithPriority *cuStreamCreateWithPriority;
1245 extern tcuStreamGetPriority *cuStreamGetPriority;
1246 extern tcuStreamGetFlags *cuStreamGetFlags;
1247 extern tcuStreamWaitEvent *cuStreamWaitEvent;
1248 extern tcuStreamAddCallback *cuStreamAddCallback;
1249 extern tcuStreamAttachMemAsync *cuStreamAttachMemAsync;
1250 extern tcuStreamQuery *cuStreamQuery;
1251 extern tcuStreamSynchronize *cuStreamSynchronize;
1252 extern tcuStreamDestroy_v2 *cuStreamDestroy_v2;
1253 extern tcuEventCreate *cuEventCreate;
1254 extern tcuEventRecord *cuEventRecord;
1255 extern tcuEventQuery *cuEventQuery;
1256 extern tcuEventSynchronize *cuEventSynchronize;
1257 extern tcuEventDestroy_v2 *cuEventDestroy_v2;
1258 extern tcuEventElapsedTime *cuEventElapsedTime;
1259 extern tcuStreamWaitValue32 *cuStreamWaitValue32;
1260 extern tcuStreamWaitValue64 *cuStreamWaitValue64;
1261 extern tcuStreamWriteValue32 *cuStreamWriteValue32;
1262 extern tcuStreamWriteValue64 *cuStreamWriteValue64;
1263 extern tcuStreamBatchMemOp *cuStreamBatchMemOp;
1264 extern tcuFuncGetAttribute *cuFuncGetAttribute;
1265 extern tcuFuncSetAttribute *cuFuncSetAttribute;
1266 extern tcuFuncSetCacheConfig *cuFuncSetCacheConfig;
1267 extern tcuFuncSetSharedMemConfig *cuFuncSetSharedMemConfig;
1268 extern tcuLaunchKernel *cuLaunchKernel;
1269 extern tcuLaunchCooperativeKernel *cuLaunchCooperativeKernel;
1270 extern tcuLaunchCooperativeKernelMultiDevice *cuLaunchCooperativeKernelMultiDevice;
1271 extern tcuFuncSetBlockShape *cuFuncSetBlockShape;
1272 extern tcuFuncSetSharedSize *cuFuncSetSharedSize;
1273 extern tcuParamSetSize *cuParamSetSize;
1274 extern tcuParamSeti *cuParamSeti;
1275 extern tcuParamSetf *cuParamSetf;
1276 extern tcuParamSetv *cuParamSetv;
1277 extern tcuLaunch *cuLaunch;
1278 extern tcuLaunchGrid *cuLaunchGrid;
1279 extern tcuLaunchGridAsync *cuLaunchGridAsync;
1280 extern tcuParamSetTexRef *cuParamSetTexRef;
1281 extern tcuOccupancyMaxActiveBlocksPerMultiprocessor *cuOccupancyMaxActiveBlocksPerMultiprocessor;
1282 extern tcuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags *cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags;
1283 extern tcuOccupancyMaxPotentialBlockSize *cuOccupancyMaxPotentialBlockSize;
1284 extern tcuOccupancyMaxPotentialBlockSizeWithFlags *cuOccupancyMaxPotentialBlockSizeWithFlags;
1285 extern tcuTexRefSetArray *cuTexRefSetArray;
1286 extern tcuTexRefSetMipmappedArray *cuTexRefSetMipmappedArray;
1287 extern tcuTexRefSetAddress_v2 *cuTexRefSetAddress_v2;
1288 extern tcuTexRefSetAddress2D_v3 *cuTexRefSetAddress2D_v3;
1289 extern tcuTexRefSetFormat *cuTexRefSetFormat;
1290 extern tcuTexRefSetAddressMode *cuTexRefSetAddressMode;
1291 extern tcuTexRefSetFilterMode *cuTexRefSetFilterMode;
1292 extern tcuTexRefSetMipmapFilterMode *cuTexRefSetMipmapFilterMode;
1293 extern tcuTexRefSetMipmapLevelBias *cuTexRefSetMipmapLevelBias;
1294 extern tcuTexRefSetMipmapLevelClamp *cuTexRefSetMipmapLevelClamp;
1295 extern tcuTexRefSetMaxAnisotropy *cuTexRefSetMaxAnisotropy;
1296 extern tcuTexRefSetBorderColor *cuTexRefSetBorderColor;
1297 extern tcuTexRefSetFlags *cuTexRefSetFlags;
1298 extern tcuTexRefGetAddress_v2 *cuTexRefGetAddress_v2;
1299 extern tcuTexRefGetArray *cuTexRefGetArray;
1300 extern tcuTexRefGetMipmappedArray *cuTexRefGetMipmappedArray;
1301 extern tcuTexRefGetAddressMode *cuTexRefGetAddressMode;
1302 extern tcuTexRefGetFilterMode *cuTexRefGetFilterMode;
1303 extern tcuTexRefGetFormat *cuTexRefGetFormat;
1304 extern tcuTexRefGetMipmapFilterMode *cuTexRefGetMipmapFilterMode;
1305 extern tcuTexRefGetMipmapLevelBias *cuTexRefGetMipmapLevelBias;
1306 extern tcuTexRefGetMipmapLevelClamp *cuTexRefGetMipmapLevelClamp;
1307 extern tcuTexRefGetMaxAnisotropy *cuTexRefGetMaxAnisotropy;
1308 extern tcuTexRefGetBorderColor *cuTexRefGetBorderColor;
1309 extern tcuTexRefGetFlags *cuTexRefGetFlags;
1310 extern tcuTexRefCreate *cuTexRefCreate;
1311 extern tcuTexRefDestroy *cuTexRefDestroy;
1312 extern tcuSurfRefSetArray *cuSurfRefSetArray;
1313 extern tcuSurfRefGetArray *cuSurfRefGetArray;
1314 extern tcuTexObjectCreate *cuTexObjectCreate;
1315 extern tcuTexObjectDestroy *cuTexObjectDestroy;
1316 extern tcuTexObjectGetResourceDesc *cuTexObjectGetResourceDesc;
1317 extern tcuTexObjectGetTextureDesc *cuTexObjectGetTextureDesc;
1318 extern tcuTexObjectGetResourceViewDesc *cuTexObjectGetResourceViewDesc;
1319 extern tcuSurfObjectCreate *cuSurfObjectCreate;
1320 extern tcuSurfObjectDestroy *cuSurfObjectDestroy;
1321 extern tcuSurfObjectGetResourceDesc *cuSurfObjectGetResourceDesc;
1322 extern tcuDeviceCanAccessPeer *cuDeviceCanAccessPeer;
1323 extern tcuCtxEnablePeerAccess *cuCtxEnablePeerAccess;
1324 extern tcuCtxDisablePeerAccess *cuCtxDisablePeerAccess;
1325 extern tcuDeviceGetP2PAttribute *cuDeviceGetP2PAttribute;
1326 extern tcuGraphicsUnregisterResource *cuGraphicsUnregisterResource;
1327 extern tcuGraphicsSubResourceGetMappedArray *cuGraphicsSubResourceGetMappedArray;
1328 extern tcuGraphicsResourceGetMappedMipmappedArray *cuGraphicsResourceGetMappedMipmappedArray;
1329 extern tcuGraphicsResourceGetMappedPointer_v2 *cuGraphicsResourceGetMappedPointer_v2;
1330 extern tcuGraphicsResourceSetMapFlags_v2 *cuGraphicsResourceSetMapFlags_v2;
1331 extern tcuGraphicsMapResources *cuGraphicsMapResources;
1332 extern tcuGraphicsUnmapResources *cuGraphicsUnmapResources;
1333 extern tcuGetExportTable *cuGetExportTable;
1334
1335 extern tcuGraphicsGLRegisterBuffer *cuGraphicsGLRegisterBuffer;
1336 extern tcuGraphicsGLRegisterImage *cuGraphicsGLRegisterImage;
1337 extern tcuGLGetDevices_v2 *cuGLGetDevices_v2;
1338 extern tcuGLCtxCreate_v2 *cuGLCtxCreate_v2;
1339 extern tcuGLInit *cuGLInit;
1340 extern tcuGLRegisterBufferObject *cuGLRegisterBufferObject;
1341 extern tcuGLMapBufferObject_v2 *cuGLMapBufferObject_v2;
1342 extern tcuGLUnmapBufferObject *cuGLUnmapBufferObject;
1343 extern tcuGLUnregisterBufferObject *cuGLUnregisterBufferObject;
1344 extern tcuGLSetBufferObjectMapFlags *cuGLSetBufferObjectMapFlags;
1345 extern tcuGLMapBufferObjectAsync_v2 *cuGLMapBufferObjectAsync_v2;
1346 extern tcuGLUnmapBufferObjectAsync *cuGLUnmapBufferObjectAsync;
1347
1348 extern tnvrtcGetErrorString *nvrtcGetErrorString;
1349 extern tnvrtcVersion *nvrtcVersion;
1350 extern tnvrtcCreateProgram *nvrtcCreateProgram;
1351 extern tnvrtcDestroyProgram *nvrtcDestroyProgram;
1352 extern tnvrtcCompileProgram *nvrtcCompileProgram;
1353 extern tnvrtcGetPTXSize *nvrtcGetPTXSize;
1354 extern tnvrtcGetPTX *nvrtcGetPTX;
1355 extern tnvrtcGetProgramLogSize *nvrtcGetProgramLogSize;
1356 extern tnvrtcGetProgramLog *nvrtcGetProgramLog;
1357 extern tnvrtcAddNameExpression *nvrtcAddNameExpression;
1358 extern tnvrtcGetLoweredName *nvrtcGetLoweredName;
1359
1360
1361 enum {
1362   CUEW_SUCCESS = 0,
1363   CUEW_ERROR_OPEN_FAILED = -1,
1364   CUEW_ERROR_ATEXIT_FAILED = -2,
1365 };
1366
1367 enum {
1368         CUEW_INIT_CUDA = 1,
1369         CUEW_INIT_NVRTC = 2
1370 };
1371
1372 int cuewInit(cuuint32_t flags);
1373 const char *cuewErrorString(CUresult result);
1374 const char *cuewCompilerPath(void);
1375 int cuewCompilerVersion(void);
1376 int cuewNvrtcVersion(void);
1377
1378 #ifdef __cplusplus
1379 }
1380 #endif
1381
1382 #endif  /* __CUEW_H__ */