The OpenD Programming Language

1 /*
2 Boost Software License - Version 1.0 - August 17th, 2003
3 Permission is hereby granted, free of charge, to any person or organization
4 obtaining a copy of the software and accompanying documentation covered by
5 this license ( the "Software" ) to use, reproduce, display, distribute,
6 execute, and transmit the Software, and to prepare derivative works of the
7 Software, and to permit third-parties to whom the Software is furnished to
8 do so, all subject to the following:
9 The copyright notices in the Software and this entire statement, including
10 the above license grant, this restriction and the following disclaimer,
11 must be included in all copies of the Software, in whole or in part, and
12 all derivative works of the Software, unless such copies or derivative
13 works are solely in the form of machine-executable object code generated by
14 a source language processor.
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
18 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
19 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
20 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 DEALINGS IN THE SOFTWARE.
22 */
23 module derelict.cuda.driverapi;
24 
25 /**
26  * CUDA Driver API
27  * Translation of cuda.h
28  */
29 
30 // Current API version supported by DerelictCUDA is 10.0
31 enum CUDA_VERSION = 10000;
32 
33 
34 import derelict.util.loader;
35 
36 private
37 {
38   import derelict.util.system;
39 
40   static if(Derelict_OS_Windows)
41     enum libNames = "nvcuda.dll";
42   else static if (Derelict_OS_Mac)
43     enum libNames = "libcuda.dylib";
44   else static if (Derelict_OS_Linux)
45     enum libNames = "libcuda.so";
46   else
47     static assert(0, "Need to implement CUDA libNames for this operating system.");
48 }
49 
50 alias cuuint32_t = uint;
51 alias cuuint64_t = ulong;
52 
53 alias CUdeviceptr = size_t;
54 
55 alias CUdevice = int;
56 alias CUcontext = void*;
57 alias CUmodule = void*;
58 alias CUfunction = void*;
59 alias CUarray = void*;
60 alias CUmipmappedArray = void*;
61 alias CUtexref = void*;
62 alias CUsurfref = void*;
63 alias CUevent = void*;
64 alias CUstream = void*;
65 alias CUgraphicsResource = void*;
66 alias CUtexObject = ulong;
67 alias CUsurfObject = ulong;
68 alias CUexternalMemory = void*;
69 alias CUexternalSemaphore = void*;
70 alias CUgraph = void*;
71 alias CUgraphNode = void*;
72 alias CUgraphExec = void*;
73 
74 struct CUuuid
75 {
76     char[16] bytes;
77 }
78 
79 /**
80  * CUDA IPC handle size
81  */
82 enum CU_IPC_HANDLE_SIZE = 64;
83 
84 /**
85  * CUDA IPC event handle
86  */
87 struct CUipcEventHandle
88 {
89     char[CU_IPC_HANDLE_SIZE] reserved;
90 }
91 
92 /**
93  * CUDA IPC mem handle
94  */
95 struct CUipcMemHandle
96 {
97     char[CU_IPC_HANDLE_SIZE] reserved;
98 }
99 
100 /**
101  * CUDA Ipc Mem Flags
102  */
103 alias CUipcMem_flags = int;
104 enum : CUipcMem_flags
105 {
106     CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS = 0x1
107 }
108 
109 /**
110  * CUDA Mem Attach Flags
111  */
112 alias CUmemAttach_flags = int;
113 enum : CUmemAttach_flags
114 {
115     CU_MEM_ATTACH_GLOBAL = 0x1,
116     CU_MEM_ATTACH_HOST   = 0x2,
117     CU_MEM_ATTACH_SINGLE = 0x4
118 }
119 
120 /**
121  * Context creation flags
122  */
123 alias CUctx_flags = int;
124 enum : CUctx_flags
125 {
126     CU_CTX_SCHED_AUTO          = 0x00,
127     CU_CTX_SCHED_SPIN          = 0x01,
128     CU_CTX_SCHED_YIELD         = 0x02,
129     CU_CTX_SCHED_BLOCKING_SYNC = 0x04,
130     CU_CTX_BLOCKING_SYNC       = 0x04,
131 
132     CU_CTX_SCHED_MASK          = 0x07,
133     CU_CTX_MAP_HOST            = 0x08,
134     CU_CTX_LMEM_RESIZE_TO_MAX  = 0x10,
135     CU_CTX_FLAGS_MASK          = 0x1f
136 }
137 
138 /**
139  * Stream creation flags
140  */
141 alias CUstream_flags = int;
142 enum : CUstream_flags
143 {
144     CU_STREAM_DEFAULT      = 0x0,
145     CU_STREAM_NON_BLOCKING = 0x1
146 }
147 /**
148  * Flags for ::cuStreamWaitValue32 and ::cuStreamWaitValue64
149  */
150 alias CUstreamWaitValue_flags = int;
151 enum : CUstreamWaitValue_flags {
152   CU_STREAM_WAIT_VALUE_GEQ   = 0x0,   /**< Wait until (int32_t)(*addr - value) >= 0 (or int64_t for 64 bit
153                                            values). Note this is a cyclic comparison which ignores wraparound.
154                                            (Default behavior.) */
155   CU_STREAM_WAIT_VALUE_EQ    = 0x1,   /**< Wait until *addr == value. */
156   CU_STREAM_WAIT_VALUE_AND   = 0x2,   /**< Wait until (*addr & value) != 0. */
157   CU_STREAM_WAIT_VALUE_NOR   = 0x3,   /**< Wait until ~(*addr | value) != 0. Support for this operation can be
158                                            queried with ::cuDeviceGetAttribute() and
159                                            ::CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR.*/
160   CU_STREAM_WAIT_VALUE_FLUSH = 1<<30  /**< Follow the wait operation with a flush of outstanding remote writes. This
161                                            means that, if a remote write operation is guaranteed to have reached the
162                                            device before the wait can be satisfied, that write is guaranteed to be
163                                            visible to downstream device work. The device is permitted to reorder
164                                            remote writes internally. For example, this flag would be required if
165                                            two remote writes arrive in a defined order, the wait is satisfied by the
166                                            second write, and downstream work needs to observe the first write.
167                                            Support for this operation is restricted to selected platforms and can be
168                                            queried with ::CU_DEVICE_ATTRIBUTE_CAN_USE_WAIT_VALUE_FLUSH.*/
169 }
170 
171 
172 /**
173  * Flags for ::cuStreamWriteValue32
174  */
175 alias CUstreamWriteValue_flags = int;
176 enum : CUstreamWriteValue_flags {
177   CU_STREAM_WRITE_VALUE_DEFAULT           = 0x0, /**< Default behavior */
178   CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER = 0x1  /**< Permits the write to be reordered with writes which were issued
179                                                       before it, as a performance optimization. Normally,
180                                                       ::cuStreamWriteValue32 will provide a memory fence before the
181                                                       write, which has similar semantics to
182                                                       __threadfence_system() but is scoped to the stream
183                                                       rather than a CUDA thread. */
184 }
185 
186 /**
187  * Operations for ::cuStreamBatchMemOp
188  */
189 alias CUstreamBatchMemOpType = int;
190 enum : CUstreamBatchMemOpType {
191   CU_STREAM_MEM_OP_WAIT_VALUE_32  = 1,     /**< Represents a ::cuStreamWaitValue32 operation */
192   CU_STREAM_MEM_OP_WRITE_VALUE_32 = 2,     /**< Represents a ::cuStreamWriteValue32 operation */
193   CU_STREAM_MEM_OP_WAIT_VALUE_64  = 4,     /**< Represents a ::cuStreamWaitValue64 operation */
194   CU_STREAM_MEM_OP_WRITE_VALUE_64 = 5,     /**< Represents a ::cuStreamWriteValue64 operation */
195   CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES = 3 /**< This has the same effect as ::CU_STREAM_WAIT_VALUE_FLUSH, but as a
196                                                   standalone operation. */
197 }
198 
199 /**
200  * Per-operation parameters for ::cuStreamBatchMemOp
201  */
202 union CUstreamBatchMemOpParams {
203   CUstreamBatchMemOpType operation;
204   struct CUstreamMemOpWaitValueParams_st {
205     CUstreamBatchMemOpType operation;
206     CUdeviceptr address;
207     union {
208         cuuint32_t value;
209         cuuint64_t value64;
210     };
211     uint flags;
212     CUdeviceptr _alias; /**< For driver internal use. Initial value is unimportant. */
213   }
214   CUstreamMemOpWaitValueParams_st waitValue;
215   struct CUstreamMemOpWriteValueParams_st {
216     CUstreamBatchMemOpType operation;
217     CUdeviceptr address;
218     union {
219         cuuint32_t value;
220         cuuint64_t value64;
221     };
222     uint flags;
223     CUdeviceptr _alias; /**< For driver internal use. Initial value is unimportant. */
224   }
225   CUstreamMemOpWriteValueParams_st writeValue;
226   struct CUstreamMemOpFlushRemoteWritesParams_st {
227     CUstreamBatchMemOpType operation;
228     uint flags;
229   }
230   CUstreamMemOpFlushRemoteWritesParams_st flushRemoteWrites;
231   cuuint64_t[6] pad;
232 }
233 
234 
235 /**
236  * Occupancy calculator flag
237  */
238 alias CUoccupancy_flags = int;
239 enum : CUoccupancy_flags {
240   CU_OCCUPANCY_DEFAULT                  = 0x0, /**< Default behavior */
241   CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE = 0x1  /**< Assume global caching is enabled and cannot be automatically turned off */
242 }
243 
244 /**
245  * Event creation flags
246  */
247 alias CUevent_flags = int;
248 enum : CUevent_flags
249 {
250   CU_EVENT_DEFAULT        = 0x0,
251   CU_EVENT_BLOCKING_SYNC  = 0x1,
252   CU_EVENT_DISABLE_TIMING = 0x2,
253   CU_EVENT_INTERPROCESS   = 0x4
254 }
255 
256 /**
257  * Array formats
258  */
259 alias CUarray_format = int;
260 enum : CUarray_format
261 {
262   CU_AD_FORMAT_UNSIGNED_INT8  = 0x01,
263   CU_AD_FORMAT_UNSIGNED_INT16 = 0x02,
264   CU_AD_FORMAT_UNSIGNED_INT32 = 0x03,
265   CU_AD_FORMAT_SIGNED_INT8    = 0x08,
266   CU_AD_FORMAT_SIGNED_INT16   = 0x09,
267   CU_AD_FORMAT_SIGNED_INT32   = 0x0a,
268   CU_AD_FORMAT_HALF           = 0x10,
269   CU_AD_FORMAT_FLOAT          = 0x20
270 }
271 
272 /**
273  * Texture reference addressing modes
274  */
275 alias CUaddress_mode = int;
276 enum : CUaddress_mode
277 {
278   CU_TR_ADDRESS_MODE_WRAP   = 0,
279   CU_TR_ADDRESS_MODE_CLAMP  = 1,
280   CU_TR_ADDRESS_MODE_MIRROR = 2,
281   CU_TR_ADDRESS_MODE_BORDER = 3
282 }
283 
284 /**
285  * Texture reference filtering modes
286  */
287 alias CUfilter_mode = int;
288 enum : CUfilter_mode
289 {
290   CU_TR_FILTER_MODE_POINT  = 0,
291   CU_TR_FILTER_MODE_LINEAR = 1
292 }
293 
294 /**
295  * Device properties
296  */
297 alias CUdevice_attribute = int;
298 enum : CUdevice_attribute
299 {
300   CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 1,              /**< Maximum number of threads per block */
301   CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X = 2,                    /**< Maximum block dimension X */
302   CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y = 3,                    /**< Maximum block dimension Y */
303   CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z = 4,                    /**< Maximum block dimension Z */
304   CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X = 5,                     /**< Maximum grid dimension X */
305   CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y = 6,                     /**< Maximum grid dimension Y */
306   CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z = 7,                     /**< Maximum grid dimension Z */
307   CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK = 8,        /**< Maximum shared memory available per block in bytes */
308   CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK = 8,            /**< Deprecated, use CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK */
309   CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY = 9,              /**< Memory available on device for __constant__ variables in a CUDA C kernel in bytes */
310   CU_DEVICE_ATTRIBUTE_WARP_SIZE = 10,                         /**< Warp size in threads */
311   CU_DEVICE_ATTRIBUTE_MAX_PITCH = 11,                         /**< Maximum pitch in bytes allowed by memory copies */
312   CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK = 12,           /**< Maximum number of 32-bit registers available per block */
313   CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK = 12,               /**< Deprecated, use CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK */
314   CU_DEVICE_ATTRIBUTE_CLOCK_RATE = 13,                        /**< Typical clock frequency in kilohertz */
315   CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT = 14,                 /**< Alignment requirement for textures */
316   CU_DEVICE_ATTRIBUTE_GPU_OVERLAP = 15,                       /**< Device can possibly copy memory and execute a kernel concurrently. Deprecated. Use instead CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT. */
317   CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT = 16,              /**< Number of multiprocessors on device */
318   CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT = 17,               /**< Specifies whether there is a run time limit on kernels */
319   CU_DEVICE_ATTRIBUTE_INTEGRATED = 18,                        /**< Device is integrated with host memory */
320   CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY = 19,               /**< Device can map host memory into CUDA address space */
321   CU_DEVICE_ATTRIBUTE_COMPUTE_MODE = 20,                      /**< Compute mode (See ::CUcomputemode for details) */
322   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH = 21,           /**< Maximum 1D texture width */
323   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH = 22,           /**< Maximum 2D texture width */
324   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT = 23,          /**< Maximum 2D texture height */
325   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH = 24,           /**< Maximum 3D texture width */
326   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT = 25,          /**< Maximum 3D texture height */
327   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH = 26,           /**< Maximum 3D texture depth */
328   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH = 27,   /**< Maximum 2D layered texture width */
329   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT = 28,  /**< Maximum 2D layered texture height */
330   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS = 29,  /**< Maximum layers in a 2D layered texture */
331   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH = 27,     /**< Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH */
332   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT = 28,    /**< Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT */
333   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES = 29, /**< Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS */
334   CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT = 30,                 /**< Alignment requirement for surfaces */
335   CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS = 31,                /**< Device can possibly execute multiple kernels concurrently */
336   CU_DEVICE_ATTRIBUTE_ECC_ENABLED = 32,                       /**< Device has ECC support enabled */
337   CU_DEVICE_ATTRIBUTE_PCI_BUS_ID = 33,                        /**< PCI bus ID of the device */
338   CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID = 34,                     /**< PCI device ID of the device */
339   CU_DEVICE_ATTRIBUTE_TCC_DRIVER = 35,                        /**< Device is using TCC driver model */
340   CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE = 36,                 /**< Peak memory clock frequency in kilohertz */
341   CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH = 37,           /**< Global memory bus width in bits */
342   CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE = 38,                     /**< Size of L2 cache in bytes */
343   CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR = 39,    /**< Maximum resident threads per multiprocessor */
344   CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT = 40,                /**< Number of asynchronous engines */
345   CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING = 41,                /**< Device shares a unified address space with the host */
346   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH = 42,   /**< Maximum 1D layered texture width */
347   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS = 43,  /**< Maximum layers in a 1D layered texture */
348   CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER = 44,                  /**< Deprecated, do not use. */
349   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH = 45,    /**< Maximum 2D texture width if CUDA_ARRAY3D_TEXTURE_GATHER is set */
350   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT = 46,   /**< Maximum 2D texture height if CUDA_ARRAY3D_TEXTURE_GATHER is set */
351   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE = 47, /**< Alternate maximum 3D texture width */
352   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE = 48,/**< Alternate maximum 3D texture height */
353   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE = 49, /**< Alternate maximum 3D texture depth */
354   CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID = 50,                     /**< PCI domain ID of the device */
355   CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT = 51,           /**< Pitch alignment requirement for textures */
356   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH = 52,      /**< Maximum cubemap texture width/height */
357   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH = 53,  /**< Maximum cubemap layered texture width/height */
358   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS = 54, /**< Maximum layers in a cubemap layered texture */
359   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH = 55,           /**< Maximum 1D surface width */
360   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH = 56,           /**< Maximum 2D surface width */
361   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT = 57,          /**< Maximum 2D surface height */
362   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH = 58,           /**< Maximum 3D surface width */
363   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT = 59,          /**< Maximum 3D surface height */
364   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH = 60,           /**< Maximum 3D surface depth */
365   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH = 61,   /**< Maximum 1D layered surface width */
366   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS = 62,  /**< Maximum layers in a 1D layered surface */
367   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH = 63,   /**< Maximum 2D layered surface width */
368   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT = 64,  /**< Maximum 2D layered surface height */
369   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS = 65,  /**< Maximum layers in a 2D layered surface */
370   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH = 66,      /**< Maximum cubemap surface width */
371   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH = 67,  /**< Maximum cubemap layered surface width */
372   CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS = 68, /**< Maximum layers in a cubemap layered surface */
373   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH = 69,    /**< Maximum 1D linear texture width */
374   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH = 70,    /**< Maximum 2D linear texture width */
375   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT = 71,   /**< Maximum 2D linear texture height */
376   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH = 72,    /**< Maximum 2D linear texture pitch in bytes */
377   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH = 73, /**< Maximum mipmapped 2D texture width */
378   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT = 74,/**< Maximum mipmapped 2D texture height */
379   CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = 75,          /**< Major compute capability version number */
380   CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR = 76,          /**< Minor compute capability version number */
381   CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH = 77, /**< Maximum mipmapped 1D texture width */
382   CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED = 78,       /**< Device supports stream priorities */
383   CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED = 79,         /**< Device supports caching globals in L1 */
384   CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED = 80,          /**< Device supports caching locals in L1 */
385   CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR = 81,  /**< Maximum shared memory available per multiprocessor in bytes */
386   CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR = 82,  /**< Maximum number of 32-bit registers available per multiprocessor */
387   CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY = 83,                    /**< Device can allocate managed memory on this system */
388   CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD = 84,                    /**< Device is on a multi-GPU board */
389   CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID = 85,           /**< Unique id for a group of devices on the same multi-GPU board */
390   CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED = 86,       /**< Link between the device and the host supports native atomic operations (this is a placeholder attribute, and is not supported on any current hardware)*/
391   CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO = 87,  /**< Ratio of single precision performance (in floating-point operations per second) to double precision performance */
392   CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS = 88,            /**< Device supports coherently accessing pageable memory without calling cudaHostRegister on it */
393   CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS = 89,         /**< Device can coherently access managed memory concurrently with the CPU */
394   CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED = 90,      /**< Device supports compute preemption. */
395   CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM = 91, /**< Device can access host registered memory at the same virtual address as the CPU */
396   CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_MEM_OPS = 92,            /**< ::cuStreamBatchMemOp and related APIs are supported. */
397   CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS = 93,     /**< 64-bit operations are supported in ::cuStreamBatchMemOp and related APIs. */
398   CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR = 94,     /**< ::CU_STREAM_WAIT_VALUE_NOR is supported. */
399   CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH = 95,                /**< Device supports launching cooperative kernels via ::cuLaunchCooperativeKernel */
400   CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH = 96,   /**< Device can participate in cooperative kernels launched via ::cuLaunchCooperativeKernelMultiDevice */
401   CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN = 97, /**< Maximum optin shared memory per block */
402   CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES = 98,           /**< Both the ::CU_STREAM_WAIT_VALUE_FLUSH flag and the ::CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES MemOp are supported on the device. See \ref CUDA_MEMOP for additional details. */
403   CU_DEVICE_ATTRIBUTE_HOST_REGISTER_SUPPORTED = 99,           /**< Device supports host memory registration via ::cudaHostRegister. */
404   CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES = 100, /**< Device accesses pageable memory via the host's page tables. */
405   CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST = 101, /**< The host can directly access managed memory on the device without migration. */
406   CU_DEVICE_ATTRIBUTE_MAX
407 }
408 
409 /**
410  * Legacy device properties
411  */
412 struct CUdevprop
413 {
414   int maxThreadsPerBlock;
415   int[3] maxThreadsDim;
416   int[3] maxGridSize;
417   int sharedMemPerBlock;
418   int totalConstantMemory;
419   int SIMDWidth;
420   int memPitch;
421   int regsPerBlock;
422   int clockRate;
423   int textureAlign;
424 }
425 
426 /**
427  * Pointer information
428  */
429 alias CUpointer_attribute = int;
430 enum : CUpointer_attribute
431 {
432   CU_POINTER_ATTRIBUTE_CONTEXT = 1,
433   CU_POINTER_ATTRIBUTE_MEMORY_TYPE = 2,
434   CU_POINTER_ATTRIBUTE_DEVICE_POINTER = 3,
435   CU_POINTER_ATTRIBUTE_HOST_POINTER = 4,
436   CU_POINTER_ATTRIBUTE_P2P_TOKENS = 5,
437   CU_POINTER_ATTRIBUTE_SYNC_MEMOPS = 6,
438   CU_POINTER_ATTRIBUTE_BUFFER_ID = 7,
439   CU_POINTER_ATTRIBUTE_IS_MANAGED = 8,
440   CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL = 9  /**< A device ordinal of a device on which a pointer was allocated or registered */
441 }
442 
443 /**
444  * Function properties
445  */
446 alias CUfunction_attribute = int;
447 enum : CUfunction_attribute
448 {
449   /**
450    * The maximum number of threads per block, beyond which a launch of the
451    * function would fail. This number depends on both the function and the
452    * device on which the function is currently loaded.
453    */
454   CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 0,
455 
456   /**
457    * The size in bytes of statically-allocated shared memory required by
458    * this function. This does not include dynamically-allocated shared
459    * memory requested by the user at runtime.
460    */
461   CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES = 1,
462 
463   /**
464    * The size in bytes of user-allocated constant memory required by this
465    * function.
466    */
467   CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES = 2,
468 
469   /**
470    * The size in bytes of local memory used by each thread of this function.
471    */
472   CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES = 3,
473 
474   /**
475    * The number of registers used by each thread of this function.
476    */
477   CU_FUNC_ATTRIBUTE_NUM_REGS = 4,
478 
479   /**
480    * The PTX virtual architecture version for which the function was
481    * compiled. This value is the major PTX version * 10 + the minor PTX
482    * version, so a PTX version 1.3 function would return the value 13.
483    * Note that this may return the undefined value of 0 for cubins
484    * compiled prior to CUDA 3.0.
485    */
486   CU_FUNC_ATTRIBUTE_PTX_VERSION = 5,
487 
488   /**
489    * The binary architecture version for which the function was compiled.
490    * This value is the major binary version * 10 + the minor binary version,
491    * so a binary version 1.3 function would return the value 13. Note that
492    * this will return a value of 10 for legacy cubins that do not have a
493    * properly-encoded binary architecture version.
494    */
495   CU_FUNC_ATTRIBUTE_BINARY_VERSION = 6,
496 
497   /**
498    * The attribute to indicate whether the function has been compiled with
499    * user specified option "-Xptxas --dlcm=ca" set .
500    */
501   CU_FUNC_ATTRIBUTE_CACHE_MODE_CA = 7,
502 
503   /**
504    * The maximum size in bytes of dynamically-allocated shared memory that can be used by
505    * this function. If the user-specified dynamic shared memory size is larger than this
506    * value, the launch will fail.
507    */
508   CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES = 8,
509 
510   /**
511    * On devices where the L1 cache and shared memory use the same hardware resources,
512    * this sets the shared memory carveout preference, in percent of the total resources.
513    * This is only a hint, and the driver can choose a different ratio if required to execute the function.
514    */
515   CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = 9,
516 
517   CU_FUNC_ATTRIBUTE_MAX
518 }
519 
520 /**
521  * Function cache configurations
522  */
523 alias CUfunc_cache = int;
524 enum : CUfunc_cache
525 {
526   CU_FUNC_CACHE_PREFER_NONE    = 0x00,
527   CU_FUNC_CACHE_PREFER_SHARED  = 0x01,
528   CU_FUNC_CACHE_PREFER_L1      = 0x02,
529   CU_FUNC_CACHE_PREFER_EQUAL   = 0x03
530 }
531 
532 /**
533  * Shared memory configurations
534  */
535 alias CUsharedconfig = int;
536 enum : CUsharedconfig
537 {
538   CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE    = 0x00,
539   CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE  = 0x01,
540   CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE = 0x02
541 }
542 
543 /**
544  * Shared memory carveout configurations
545  */
546 alias CUshared_carveout = int;
547 enum : CUshared_carveout {
548   CU_SHAREDMEM_CARVEOUT_DEFAULT       = -1,  /** < no preference for shared memory or L1 (default) */
549   CU_SHAREDMEM_CARVEOUT_MAX_SHARED    = 100, /** < prefer maximum available shared memory, minimum L1 cache */
550   CU_SHAREDMEM_CARVEOUT_MAX_L1        = 0    /** < prefer maximum available L1 cache, minimum shared memory */
551 }
552 
553 /**
554  * Memory types
555  */
556 alias CUmemorytype = int;
557 enum : CUmemorytype
558 {
559   CU_MEMORYTYPE_HOST    = 0x01,
560   CU_MEMORYTYPE_DEVICE  = 0x02,
561   CU_MEMORYTYPE_ARRAY   = 0x03,
562   CU_MEMORYTYPE_UNIFIED = 0x04
563 }
564 
565 
566 /**
567  * Compute Modes
568  */
569 alias CUcomputemode = int;
570 enum : CUcomputemode
571 {
572   CU_COMPUTEMODE_DEFAULT           = 0,
573   CU_COMPUTEMODE_EXCLUSIVE         = 1,
574   CU_COMPUTEMODE_PROHIBITED        = 2,
575   CU_COMPUTEMODE_EXCLUSIVE_PROCESS = 3
576 }
577 
578 
579 /**
580  * Memory advise values
581  */
582 alias CUmem_advise = int;
583 enum : CUmem_advise {
584   CU_MEM_ADVISE_SET_READ_MOSTLY          = 1, /**< Data will mostly be read and only occassionally be written to */
585   CU_MEM_ADVISE_UNSET_READ_MOSTLY        = 2, /**< Undo the effect of ::CU_MEM_ADVISE_SET_READ_MOSTLY */
586   CU_MEM_ADVISE_SET_PREFERRED_LOCATION   = 3, /**< Set the preferred location for the data as the specified device */
587   CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION = 4, /**< Clear the preferred location for the data */
588   CU_MEM_ADVISE_SET_ACCESSED_BY          = 5, /**< Data will be accessed by the specified device, so prevent page faults as much as possible */
589   CU_MEM_ADVISE_UNSET_ACCESSED_BY        = 6  /**< Let the Unified Memory subsystem decide on the page faulting policy for the specified device */
590 }
591 
592 alias CUmem_range_attribute = int;
593 enum : CUmem_range_attribute {
594   CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY            = 1, /**< Whether the range will mostly be read and only occassionally be written to */
595   CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION     = 2, /**< The preferred location of the range */
596   CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY            = 3, /**< Memory range has ::CU_MEM_ADVISE_SET_ACCESSED_BY set for specified device */
597   CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION = 4  /**< The last location to which the range was prefetched */
598 }
599 
600 alias CUjit_option = int;
601 enum : CUjit_option
602 {
603     CU_JIT_MAX_REGISTERS = 0,
604     CU_JIT_THREADS_PER_BLOCK,
605     CU_JIT_WALL_TIME,
606     CU_JIT_INFO_LOG_BUFFER,
607     CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES,
608     CU_JIT_ERROR_LOG_BUFFER,
609     CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES,
610     CU_JIT_OPTIMIZATION_LEVEL,
611     CU_JIT_TARGET_FROM_CUCONTEXT,
612     CU_JIT_TARGET,
613     CU_JIT_FALLBACK_STRATEGY,
614     CU_JIT_GENERATE_DEBUG_INFO,
615     CU_JIT_LOG_VERBOSE,
616     CU_JIT_GENERATE_LINE_INFO,
617     CU_JIT_CACHE_MODE,
618     CU_JIT_NEW_SM3X_OPT,
619     CU_JIT_FAST_COMPILE,
620     CU_JIT_GLOBAL_SYMBOL_NAMES,
621     CU_JIT_GLOBAL_SYMBOL_ADDRESSES,
622     CU_JIT_GLOBAL_SYMBOL_COUNT,
623     CU_JIT_NUM_OPTIONS
624 }
625 
626 /**
627  * Online compilation targets
628  */
629 alias CUjit_target = int;
630 enum : CUjit_target
631 {
632   CU_TARGET_COMPUTE_20 = 20,       /**< Compute device class 2.0 */
633   CU_TARGET_COMPUTE_21 = 21,       /**< Compute device class 2.1 */
634   CU_TARGET_COMPUTE_30 = 30,       /**< Compute device class 3.0 */
635   CU_TARGET_COMPUTE_32 = 32,       /**< Compute device class 3.2 */
636   CU_TARGET_COMPUTE_35 = 35,       /**< Compute device class 3.5 */
637   CU_TARGET_COMPUTE_37 = 37,       /**< Compute device class 3.7 */
638   CU_TARGET_COMPUTE_50 = 50,       /**< Compute device class 5.0 */
639   CU_TARGET_COMPUTE_52 = 52,       /**< Compute device class 5.2 */
640   CU_TARGET_COMPUTE_53 = 53,       /**< Compute device class 5.3 */
641   CU_TARGET_COMPUTE_60 = 60,       /**< Compute device class 6.0.*/
642   CU_TARGET_COMPUTE_61 = 61,       /**< Compute device class 6.1.*/
643   CU_TARGET_COMPUTE_62 = 62,       /**< Compute device class 6.2.*/
644   CU_TARGET_COMPUTE_70 = 70,       /**< Compute device class 7.0.*/
645 
646   CU_TARGET_COMPUTE_75 = 75        /**< Compute device class 7.5.*/
647 }
648 
649 /**
650  * Cubin matching fallback strategies
651  */
652 alias CUjit_fallback = int;
653 enum : CUjit_fallback
654 {
655   CU_PREFER_PTX = 0,
656   CU_PREFER_BINARY
657 }
658 
659 
660 /**
661  * Caching modes for dlcm
662  */
663 alias CUjit_cacheMode = int;
664 enum : CUjit_cacheMode
665 {
666   CU_JIT_CACHE_OPTION_NONE = 0,
667   CU_JIT_CACHE_OPTION_CG,
668   CU_JIT_CACHE_OPTION_CA
669 }
670 
671 /**
672  * Device code formats
673  */
674 alias CUjitInputType = int;
675 enum : CUjitInputType
676 {
677   CU_JIT_INPUT_CUBIN = 0,
678   CU_JIT_INPUT_PTX,
679   CU_JIT_INPUT_FATBINARY,
680   CU_JIT_INPUT_OBJECT,
681   CU_JIT_INPUT_LIBRARY,
682   CU_JIT_NUM_INPUT_TYPES
683 }
684 
685 alias CUlinkState = void*;
686 
687 /**
688  * Flags to register a graphics resource
689  */
690 alias CUgraphicsRegisterFlags = int;
691 enum : CUgraphicsRegisterFlags
692 {
693   CU_GRAPHICS_REGISTER_FLAGS_NONE           = 0x00,
694   CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY      = 0x01,
695   CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD  = 0x02,
696   CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST   = 0x04,
697   CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER = 0x08
698 }
699 
700 /**
701  * Flags for mapping and unmapping interop resources
702  */
703 alias CUgraphicsMapResourceFlags = int;
704 enum : CUgraphicsMapResourceFlags
705 {
706   CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE          = 0x00,
707   CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY     = 0x01,
708   CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 0x02
709 }
710 
711 /**
712  * Array indices for cube faces
713  */
714 alias CUarray_cubemap_face = int;
715 enum : CUarray_cubemap_face
716 {
717   CU_CUBEMAP_FACE_POSITIVE_X  = 0x00,
718   CU_CUBEMAP_FACE_NEGATIVE_X  = 0x01,
719   CU_CUBEMAP_FACE_POSITIVE_Y  = 0x02,
720   CU_CUBEMAP_FACE_NEGATIVE_Y  = 0x03,
721   CU_CUBEMAP_FACE_POSITIVE_Z  = 0x04,
722   CU_CUBEMAP_FACE_NEGATIVE_Z  = 0x05
723 }
724 
725 /**
726  * Limits
727  */
728 alias CUlimit = int;
729 enum : CUlimit
730 {
731   CU_LIMIT_STACK_SIZE                       = 0x00,
732   CU_LIMIT_PRINTF_FIFO_SIZE                 = 0x01,
733   CU_LIMIT_MALLOC_HEAP_SIZE                 = 0x02,
734   CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH           = 0x03,
735   CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT = 0x04,
736   CU_LIMIT_MAX_L2_FETCH_GRANULARITY         = 0x05, /**< A value between 0 and 128 that indicates the maximum fetch granularity of L2 (in Bytes). This is a hint */
737   CU_LIMIT_MAX
738 }
739 
740 /**
741  * Resource types
742  */
743 alias CUresourcetype = int;
744 enum : CUresourcetype
745 {
746   CU_RESOURCE_TYPE_ARRAY           = 0x00,
747   CU_RESOURCE_TYPE_MIPMAPPED_ARRAY = 0x01,
748   CU_RESOURCE_TYPE_LINEAR          = 0x02,
749   CU_RESOURCE_TYPE_PITCH2D         = 0x03
750 }
751 
752 
753 //
754 // New for CUDA >= 10.0
755 //
756 alias CUhostFn = void function(void *userData);
757 
758 
759 /**
760  * GPU kernel node parameters
761  */
762 struct CUDA_KERNEL_NODE_PARAMS {
763   CUfunction func;             /**< Kernel to launch */
764   uint gridDimX;       /**< Width of grid in blocks */
765   uint gridDimY;       /**< Height of grid in blocks */
766   uint gridDimZ;       /**< Depth of grid in blocks */
767   uint blockDimX;      /**< X dimension of each thread block */
768   uint blockDimY;      /**< Y dimension of each thread block */
769   uint blockDimZ;      /**< Z dimension of each thread block */
770   uint sharedMemBytes; /**< Dynamic shared-memory size per thread block in bytes */
771   void **kernelParams;         /**< Array of pointers to kernel parameters */
772   void **extra;                /**< Extra options */
773 }
774 
775 /**
776  * Memset node parameters
777  */
778 struct CUDA_MEMSET_NODE_PARAMS {
779   CUdeviceptr dst;                        /**< Destination device pointer */
780   size_t pitch;                           /**< Pitch of destination device pointer. Unused if height is 1 */
781   uint value;                     /**< Value to be set */
782   uint elementSize;               /**< Size of each element in bytes. Must be 1, 2, or 4. */
783   size_t width;                           /**< Width in bytes, of the row */
784   size_t height;                          /**< Number of rows */
785 }
786 
787 /**
788  * Host node parameters
789  */
790 struct CUDA_HOST_NODE_PARAMS {
791   CUhostFn fn;    /**< The function to call when the node executes */
792   void* userData; /**< Argument to pass to the function */
793 }
794 
795 /**
796  * Graph node types
797  */
798 alias CUgraphNodeType = int;
799 enum : CUgraphNodeType {
800   CU_GRAPH_NODE_TYPE_KERNEL = 0, /**< GPU kernel node */
801   CU_GRAPH_NODE_TYPE_MEMCPY = 1, /**< Memcpy node */
802   CU_GRAPH_NODE_TYPE_MEMSET = 2, /**< Memset node */
803   CU_GRAPH_NODE_TYPE_HOST   = 3, /**< Host (executable) node */
804   CU_GRAPH_NODE_TYPE_GRAPH  = 4, /**< Node which executes an embedded graph */
805   CU_GRAPH_NODE_TYPE_EMPTY  = 5, /**< Empty (no-op) node */
806   CU_GRAPH_NODE_TYPE_COUNT
807 }
808 
809 /**
810  * Possible stream capture statuses returned by ::cuStreamIsCapturing
811  */
812 alias CUstreamCaptureStatus = int;
813 enum : CUstreamCaptureStatus {
814   CU_STREAM_CAPTURE_STATUS_NONE        = 0, /**< Stream is not capturing */
815   CU_STREAM_CAPTURE_STATUS_ACTIVE      = 1, /**< Stream is actively capturing */
816   CU_STREAM_CAPTURE_STATUS_INVALIDATED = 2  /**< Stream is part of a capture sequence that
817                                                  has been invalidated, but not terminated */
818 }
819 
820 
821 alias CUresult = int;
822 enum : CUresult
823 {
824   /**
825      * The API call returned with no errors. In the case of query calls, this
826      * also means that the operation being queried is complete (see
827      * ::cuEventQuery() and ::cuStreamQuery()).
828      */
829     CUDA_SUCCESS                              = 0,
830 
831     /**
832      * This indicates that one or more of the parameters passed to the API call
833      * is not within an acceptable range of values.
834      */
835     CUDA_ERROR_INVALID_VALUE                  = 1,
836 
837     /**
838      * The API call failed because it was unable to allocate enough memory to
839      * perform the requested operation.
840      */
841     CUDA_ERROR_OUT_OF_MEMORY                  = 2,
842 
843     /**
844      * This indicates that the CUDA driver has not been initialized with
845      * ::cuInit() or that initialization has failed.
846      */
847     CUDA_ERROR_NOT_INITIALIZED                = 3,
848 
849     /**
850      * This indicates that the CUDA driver is in the process of shutting down.
851      */
852     CUDA_ERROR_DEINITIALIZED                  = 4,
853 
854     /**
855      * This indicates profiler is not initialized for this run. This can
856      * happen when the application is running with external profiling tools
857      * like visual profiler.
858      */
859     CUDA_ERROR_PROFILER_DISABLED              = 5,
860 
861     /**
862      * \deprecated
863      * This error return is deprecated as of CUDA 5.0. It is no longer an error
864      * to attempt to enable/disable the profiling via ::cuProfilerStart or
865      * ::cuProfilerStop without initialization.
866      */
867     CUDA_ERROR_PROFILER_NOT_INITIALIZED       = 6,
868 
869     /**
870      * \deprecated
871      * This error return is deprecated as of CUDA 5.0. It is no longer an error
872      * to call cuProfilerStart() when profiling is already enabled.
873      */
874     CUDA_ERROR_PROFILER_ALREADY_STARTED       = 7,
875 
876     /**
877      * \deprecated
878      * This error return is deprecated as of CUDA 5.0. It is no longer an error
879      * to call cuProfilerStop() when profiling is already disabled.
880      */
881     CUDA_ERROR_PROFILER_ALREADY_STOPPED       = 8,
882 
883     /**
884      * This indicates that no CUDA-capable devices were detected by the installed
885      * CUDA driver.
886      */
887     CUDA_ERROR_NO_DEVICE                      = 100,
888 
889     /**
890      * This indicates that the device ordinal supplied by the user does not
891      * correspond to a valid CUDA device.
892      */
893     CUDA_ERROR_INVALID_DEVICE                 = 101,
894 
895 
896     /**
897      * This indicates that the device kernel image is invalid. This can also
898      * indicate an invalid CUDA module.
899      */
900     CUDA_ERROR_INVALID_IMAGE                  = 200,
901 
902     /**
903      * This most frequently indicates that there is no context bound to the
904      * current thread. This can also be returned if the context passed to an
905      * API call is not a valid handle (such as a context that has had
906      * ::cuCtxDestroy() invoked on it). This can also be returned if a user
907      * mixes different API versions (i.e. 3010 context with 3020 API calls).
908      * See ::cuCtxGetApiVersion() for more details.
909      */
910     CUDA_ERROR_INVALID_CONTEXT                = 201,
911 
912     /**
913      * This indicated that the context being supplied as a parameter to the
914      * API call was already the active context.
915      * \deprecated
916      * This error return is deprecated as of CUDA 3.2. It is no longer an
917      * error to attempt to push the active context via ::cuCtxPushCurrent().
918      */
919     CUDA_ERROR_CONTEXT_ALREADY_CURRENT        = 202,
920 
921     /**
922      * This indicates that a map or register operation has failed.
923      */
924     CUDA_ERROR_MAP_FAILED                     = 205,
925 
926     /**
927      * This indicates that an unmap or unregister operation has failed.
928      */
929     CUDA_ERROR_UNMAP_FAILED                   = 206,
930 
931     /**
932      * This indicates that the specified array is currently mapped and thus
933      * cannot be destroyed.
934      */
935     CUDA_ERROR_ARRAY_IS_MAPPED                = 207,
936 
937     /**
938      * This indicates that the resource is already mapped.
939      */
940     CUDA_ERROR_ALREADY_MAPPED                 = 208,
941 
942     /**
943      * This indicates that there is no kernel image available that is suitable
944      * for the device. This can occur when a user specifies code generation
945      * options for a particular CUDA source file that do not include the
946      * corresponding device configuration.
947      */
948     CUDA_ERROR_NO_BINARY_FOR_GPU              = 209,
949 
950     /**
951      * This indicates that a resource has already been acquired.
952      */
953     CUDA_ERROR_ALREADY_ACQUIRED               = 210,
954 
955     /**
956      * This indicates that a resource is not mapped.
957      */
958     CUDA_ERROR_NOT_MAPPED                     = 211,
959 
960     /**
961      * This indicates that a mapped resource is not available for access as an
962      * array.
963      */
964     CUDA_ERROR_NOT_MAPPED_AS_ARRAY            = 212,
965 
966     /**
967      * This indicates that a mapped resource is not available for access as a
968      * pointer.
969      */
970     CUDA_ERROR_NOT_MAPPED_AS_POINTER          = 213,
971 
972     /**
973      * This indicates that an uncorrectable ECC error was detected during
974      * execution.
975      */
976     CUDA_ERROR_ECC_UNCORRECTABLE              = 214,
977 
978     /**
979      * This indicates that the ::CUlimit passed to the API call is not
980      * supported by the active device.
981      */
982     CUDA_ERROR_UNSUPPORTED_LIMIT              = 215,
983 
984     /**
985      * This indicates that the ::CUcontext passed to the API call can
986      * only be bound to a single CPU thread at a time but is already
987      * bound to a CPU thread.
988      */
989     CUDA_ERROR_CONTEXT_ALREADY_IN_USE         = 216,
990 
991     /**
992      * This indicates that peer access is not supported across the given
993      * devices.
994      */
995     CUDA_ERROR_PEER_ACCESS_UNSUPPORTED        = 217,
996 
997     /**
998      * This indicates that a PTX JIT compilation failed.
999      */
1000     CUDA_ERROR_INVALID_PTX                    = 218,
1001 
1002     /**
1003      * This indicates an error with OpenGL or DirectX context.
1004      */
1005     CUDA_ERROR_INVALID_GRAPHICS_CONTEXT       = 219,
1006 
1007     /**
1008     * This indicates that an uncorrectable NVLink error was detected during the
1009     * execution.
1010     */
1011     CUDA_ERROR_NVLINK_UNCORRECTABLE           = 220,
1012 
1013     /**
1014     * This indicates that the PTX JIT compiler library was not found.
1015     */
1016     CUDA_ERROR_JIT_COMPILER_NOT_FOUND         = 221,
1017 
1018     /**
1019      * This indicates that the device kernel source is invalid.
1020      */
1021     CUDA_ERROR_INVALID_SOURCE                 = 300,
1022 
1023     /**
1024      * This indicates that the file specified was not found.
1025      */
1026     CUDA_ERROR_FILE_NOT_FOUND                 = 301,
1027 
1028     /**
1029      * This indicates that a link to a shared object failed to resolve.
1030      */
1031     CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302,
1032 
1033     /**
1034      * This indicates that initialization of a shared object failed.
1035      */
1036     CUDA_ERROR_SHARED_OBJECT_INIT_FAILED      = 303,
1037 
1038     /**
1039      * This indicates that an OS call failed.
1040      */
1041     CUDA_ERROR_OPERATING_SYSTEM               = 304,
1042 
1043     /**
1044      * This indicates that a resource handle passed to the API call was not
1045      * valid. Resource handles are opaque types like ::CUstream and ::CUevent.
1046      */
1047     CUDA_ERROR_INVALID_HANDLE                 = 400,
1048 
1049     /**
1050      * This indicates that a resource required by the API call is not in a
1051      * valid state to perform the requested operation.
1052      */
1053     CUDA_ERROR_ILLEGAL_STATE                  = 401,
1054 
1055     /**
1056      * This indicates that a named symbol was not found. Examples of symbols
1057      * are global/constant variable names, texture names, and surface names.
1058      */
1059     CUDA_ERROR_NOT_FOUND                      = 500,
1060 
1061     /**
1062      * This indicates that asynchronous operations issued previously have not
1063      * completed yet. This result is not actually an error, but must be indicated
1064      * differently than ::CUDA_SUCCESS (which indicates completion). Calls that
1065      * may return this value include ::cuEventQuery() and ::cuStreamQuery().
1066      */
1067     CUDA_ERROR_NOT_READY                      = 600,
1068 
1069     /**
1070      * While executing a kernel, the device encountered a
1071      * load or store instruction on an invalid memory address.
1072      * This leaves the process in an inconsistent state and any further CUDA work
1073      * will return the same error. To continue using CUDA, the process must be terminated
1074      * and relaunched.
1075      */
1076     CUDA_ERROR_ILLEGAL_ADDRESS                = 700,
1077 
1078     /**
1079      * This indicates that a launch did not occur because it did not have
1080      * appropriate resources. This error usually indicates that the user has
1081      * attempted to pass too many arguments to the device kernel, or the
1082      * kernel launch specifies too many threads for the kernel's register
1083      * count. Passing arguments of the wrong size (i.e. a 64-bit pointer
1084      * when a 32-bit int is expected) is equivalent to passing too many
1085      * arguments and can also result in this error.
1086      */
1087     CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES        = 701,
1088 
1089     /**
1090      * This indicates that the device kernel took too long to execute. This can
1091      * only occur if timeouts are enabled - see the device attribute
1092      * ::CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT for more information.
1093      * This leaves the process in an inconsistent state and any further CUDA work
1094      * will return the same error. To continue using CUDA, the process must be terminated
1095      * and relaunched.
1096      */
1097     CUDA_ERROR_LAUNCH_TIMEOUT                 = 702,
1098 
1099     /**
1100      * This error indicates a kernel launch that uses an incompatible texturing
1101      * mode.
1102      */
1103     CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING  = 703,
1104 
1105     /**
1106      * This error indicates that a call to ::cuCtxEnablePeerAccess() is
1107      * trying to re-enable peer access to a context which has already
1108      * had peer access to it enabled.
1109      */
1110     CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED    = 704,
1111 
1112     /**
1113      * This error indicates that ::cuCtxDisablePeerAccess() is
1114      * trying to disable peer access which has not been enabled yet
1115      * via ::cuCtxEnablePeerAccess().
1116      */
1117     CUDA_ERROR_PEER_ACCESS_NOT_ENABLED        = 705,
1118 
1119     /**
1120      * This error indicates that the primary context for the specified device
1121      * has already been initialized.
1122      */
1123     CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE         = 708,
1124 
1125     /**
1126      * This error indicates that the context current to the calling thread
1127      * has been destroyed using ::cuCtxDestroy, or is a primary context which
1128      * has not yet been initialized.
1129      */
1130     CUDA_ERROR_CONTEXT_IS_DESTROYED           = 709,
1131 
1132     /**
1133      * A device-side assert triggered during kernel execution. The context
1134      * cannot be used anymore, and must be destroyed. All existing device
1135      * memory allocations from this context are invalid and must be
1136      * reconstructed if the program is to continue using CUDA.
1137      */
1138     CUDA_ERROR_ASSERT                         = 710,
1139 
1140     /**
1141      * This error indicates that the hardware resources required to enable
1142      * peer access have been exhausted for one or more of the devices
1143      * passed to ::cuCtxEnablePeerAccess().
1144      */
1145     CUDA_ERROR_TOO_MANY_PEERS                 = 711,
1146 
1147     /**
1148      * This error indicates that the memory range passed to ::cuMemHostRegister()
1149      * has already been registered.
1150      */
1151     CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED = 712,
1152 
1153     /**
1154      * This error indicates that the pointer passed to ::cuMemHostUnregister()
1155      * does not correspond to any currently registered memory region.
1156      */
1157     CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED     = 713,
1158 
1159     /**
1160      * While executing a kernel, the device encountered a stack error.
1161      * This can be due to stack corruption or exceeding the stack size limit.
1162      * This leaves the process in an inconsistent state and any further CUDA work
1163      * will return the same error. To continue using CUDA, the process must be terminated
1164      * and relaunched.
1165      */
1166     CUDA_ERROR_HARDWARE_STACK_ERROR           = 714,
1167 
1168     /**
1169      * While executing a kernel, the device encountered an illegal instruction.
1170      * This leaves the process in an inconsistent state and any further CUDA work
1171      * will return the same error. To continue using CUDA, the process must be terminated
1172      * and relaunched.
1173      */
1174     CUDA_ERROR_ILLEGAL_INSTRUCTION            = 715,
1175 
1176     /**
1177      * While executing a kernel, the device encountered a load or store instruction
1178      * on a memory address which is not aligned.
1179      * This leaves the process in an inconsistent state and any further CUDA work
1180      * will return the same error. To continue using CUDA, the process must be terminated
1181      * and relaunched.
1182      */
1183     CUDA_ERROR_MISALIGNED_ADDRESS             = 716,
1184 
1185     /**
1186      * While executing a kernel, the device encountered an instruction
1187      * which can only operate on memory locations in certain address spaces
1188      * (global, shared, or local), but was supplied a memory address not
1189      * belonging to an allowed address space.
1190      * This leaves the process in an inconsistent state and any further CUDA work
1191      * will return the same error. To continue using CUDA, the process must be terminated
1192      * and relaunched.
1193      */
1194     CUDA_ERROR_INVALID_ADDRESS_SPACE          = 717,
1195 
1196     /**
1197      * While executing a kernel, the device program counter wrapped its address space.
1198      * This leaves the process in an inconsistent state and any further CUDA work
1199      * will return the same error. To continue using CUDA, the process must be terminated
1200      * and relaunched.
1201      */
1202     CUDA_ERROR_INVALID_PC                     = 718,
1203 
1204     /**
1205      * An exception occurred on the device while executing a kernel. Common
1206      * causes include dereferencing an invalid device pointer and accessing
1207      * out of bounds shared memory.
1208      * This leaves the process in an inconsistent state and any further CUDA work
1209      * will return the same error. To continue using CUDA, the process must be terminated
1210      * and relaunched.
1211      */
1212     CUDA_ERROR_LAUNCH_FAILED                  = 719,
1213 
1214     /**
1215      * This error indicates that the number of blocks launched per grid for a kernel that was
1216      * launched via either ::cuLaunchCooperativeKernel or ::cuLaunchCooperativeKernelMultiDevice
1217      * exceeds the maximum number of blocks as allowed by ::cuOccupancyMaxActiveBlocksPerMultiprocessor
1218      * or ::cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags times the number of multiprocessors
1219      * as specified by the device attribute ::CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT.
1220      */
1221     CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE   = 720,
1222 
1223     /**
1224      * This error indicates that the attempted operation is not permitted.
1225      */
1226     CUDA_ERROR_NOT_PERMITTED                  = 800,
1227 
1228     /**
1229      * This error indicates that the attempted operation is not supported
1230      * on the current system or device.
1231      */
1232     CUDA_ERROR_NOT_SUPPORTED                  = 801,
1233 
1234     /**
1235      * This error indicates that the system is not yet ready to start any CUDA
1236      * work.  To continue using CUDA, verify the system configuration is in a
1237      * valid state and all required driver daemons are actively running.
1238      */
1239     CUDA_ERROR_SYSTEM_NOT_READY               = 802,
1240 
1241     /**
1242      * This error indicates that the operation is not permitted when
1243      * the stream is capturing.
1244      */
1245     CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED     = 900,
1246 
1247     /**
1248      * This error indicates that the current capture sequence on the stream
1249      * has been invalidated due to a previous error.
1250      */
1251     CUDA_ERROR_STREAM_CAPTURE_INVALIDATED     = 901,
1252 
1253     /**
1254      * This error indicates that the operation would have resulted in a merge
1255      * of two independent capture sequences.
1256      */
1257     CUDA_ERROR_STREAM_CAPTURE_MERGE           = 902,
1258 
1259     /**
1260      * This error indicates that the capture was not initiated in this stream.
1261      */
1262     CUDA_ERROR_STREAM_CAPTURE_UNMATCHED       = 903,
1263 
1264     /**
1265      * This error indicates that the capture sequence contains a fork that was
1266      * not joined to the primary stream.
1267      */
1268     CUDA_ERROR_STREAM_CAPTURE_UNJOINED        = 904,
1269 
1270     /**
1271      * This error indicates that a dependency would have been created which
1272      * crosses the capture sequence boundary. Only implicit in-stream ordering
1273      * dependencies are allowed to cross the boundary.
1274      */
1275     CUDA_ERROR_STREAM_CAPTURE_ISOLATION       = 905,
1276 
1277     /**
1278      * This error indicates a disallowed implicit dependency on a current capture
1279      * sequence from cudaStreamLegacy.
1280      */
1281     CUDA_ERROR_STREAM_CAPTURE_IMPLICIT        = 906,
1282 
1283     /**
1284      * This error indicates that the operation is not permitted on an event which
1285      * was last recorded in a capturing stream.
1286      */
1287     CUDA_ERROR_CAPTURED_EVENT                 = 907,
1288 
1289     /**
1290      * This indicates that an unknown internal error has occurred.
1291      */
1292     CUDA_ERROR_UNKNOWN                        = 999
1293 }
1294 
1295 
1296 /**
1297  * P2P Attributes
1298  */
1299 alias CUdevice_P2PAttribute = int;
1300 enum : CUdevice_P2PAttribute {
1301   CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK                     = 0x01,  /**< A relative value indicating the performance of the link between two devices */
1302   CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED                     = 0x02,  /**< P2P Access is enable */
1303   CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED              = 0x03,  /**< Atomic operation over the link supported */
1304   CU_DEVICE_P2P_ATTRIBUTE_ARRAY_ACCESS_ACCESS_SUPPORTED        = 0x04,  /**< \deprecated use CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED instead */
1305   CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED          = 0x04   /**< Accessing CUDA arrays over the link supported */
1306 }
1307 
1308 extern(System) nothrow
1309 {
1310     alias CUstreamCallback = void function(CUstream hStream, CUresult status, void *userData);
1311     alias CUoccupancyB2DSize = size_t function(int blockSize);
1312 }
1313 
1314 enum CU_MEMHOSTALLOC_PORTABLE        = 0x01;
1315 enum CU_MEMHOSTALLOC_DEVICEMAP       = 0x02;
1316 enum CU_MEMHOSTALLOC_WRITECOMBINED   = 0x04;
1317 enum CU_MEMHOSTREGISTER_PORTABLE     = 0x01;
1318 enum CU_MEMHOSTREGISTER_DEVICEMAP    = 0x02;
1319 enum CU_MEMHOSTREGISTER_IOMEMORY     = 0x04;
1320 
1321 struct CUDA_MEMCPY2D
1322 {
1323     size_t srcXInBytes;
1324     size_t srcY;
1325 
1326     CUmemorytype srcMemoryType;
1327     const void *srcHost;
1328     CUdeviceptr srcDevice;
1329     CUarray srcArray;
1330     size_t srcPitch
1331     ;
1332     size_t dstXInBytes;
1333     size_t dstY;
1334     CUmemorytype dstMemoryType;
1335     void *dstHost;
1336     CUdeviceptr dstDevice;
1337     CUarray dstArray;
1338     size_t dstPitch;
1339 
1340     size_t WidthInBytes;
1341     size_t Height;
1342 }
1343 
1344 struct CUDA_MEMCPY3D
1345 {
1346     size_t srcXInBytes;
1347     size_t srcY;
1348     size_t srcZ;
1349     size_t srcLOD;
1350     CUmemorytype srcMemoryType;
1351     const void *srcHost;
1352     CUdeviceptr srcDevice;
1353     CUarray srcArray;
1354     void *reserved0;
1355     size_t srcPitch;
1356     size_t srcHeight;
1357     size_t dstXInBytes;
1358     size_t dstY;
1359     size_t dstZ;
1360     size_t dstLOD;
1361     CUmemorytype dstMemoryType;
1362     void *dstHost;
1363     CUdeviceptr dstDevice;
1364     CUarray dstArray;
1365     void *reserved1;
1366     size_t dstPitch;
1367     size_t dstHeight;
1368     size_t WidthInBytes;
1369     size_t Height;
1370     size_t Depth;
1371 }
1372 
1373 struct CUDA_MEMCPY3D_PEER
1374 {
1375     size_t srcXInBytes;
1376     size_t srcY;
1377     size_t srcZ;
1378     size_t srcLOD;
1379     CUmemorytype srcMemoryType;
1380     const void *srcHost;
1381     CUdeviceptr srcDevice;
1382     CUarray srcArray;
1383     CUcontext srcContext;
1384     size_t srcPitch;
1385     size_t srcHeight;
1386     size_t dstXInBytes;
1387     size_t dstY;
1388     size_t dstZ;
1389     size_t dstLOD;
1390     CUmemorytype dstMemoryType;
1391     void *dstHost;
1392     CUdeviceptr dstDevice;
1393     CUarray dstArray;
1394     CUcontext dstContext;
1395     size_t dstPitch;
1396     size_t dstHeight;
1397     size_t WidthInBytes;
1398     size_t Height;
1399     size_t Depth;
1400 }
1401 
1402 struct CUDA_ARRAY_DESCRIPTOR
1403 {
1404     size_t Width;
1405     size_t Height;
1406     CUarray_format Format;
1407     uint NumChannels;
1408 }
1409 
1410 struct CUDA_ARRAY3D_DESCRIPTOR
1411 {
1412     size_t Width;
1413     size_t Height;
1414     size_t Depth;
1415 
1416     CUarray_format Format;
1417     uint NumChannels;
1418     uint Flags;
1419 }
1420 
1421 struct CUDA_RESOURCE_DESC
1422 {
1423     CUresourcetype resType;
1424 
1425     union res_st {
1426         struct array_st
1427         {
1428             CUarray hArray;
1429         }
1430         array_st array;
1431 
1432         struct mipmap_st
1433         {
1434             CUmipmappedArray hMipmappedArray;
1435         }
1436         mipmap_st mipmap;
1437 
1438         struct linear_st
1439         {
1440             CUdeviceptr devPtr;
1441             CUarray_format format;
1442             uint numChannels;
1443             size_t sizeInBytes;
1444         }
1445         linear_st linear;
1446 
1447         struct pitch2D_st
1448         {
1449             CUdeviceptr devPtr;
1450             CUarray_format format;
1451             uint numChannels;
1452             size_t width;
1453             size_t height;
1454             size_t pitchInBytes;
1455         }
1456         pitch2D_st pitch2D;
1457 
1458         struct reserved_st
1459         {
1460             int[32] reserved;
1461         }
1462         reserved_st reserved;
1463     }
1464 
1465     res_st res;
1466     uint flags;
1467 }
1468 
1469 struct CUDA_TEXTURE_DESC
1470 {
1471     CUaddress_mode[3] addressMode;
1472     CUfilter_mode filterMode;
1473     uint flags;
1474     uint maxAnisotropy;
1475     CUfilter_mode mipmapFilterMode;
1476     float mipmapLevelBias;
1477     float minMipmapLevelClamp;
1478     float maxMipmapLevelClamp;
1479     int[16] reserved;
1480 }
1481 
1482 alias CUresourceViewFormat = int;
1483 enum : CUresourceViewFormat
1484 {
1485     CU_RES_VIEW_FORMAT_NONE          = 0x00,
1486     CU_RES_VIEW_FORMAT_UINT_1X8      = 0x01,
1487     CU_RES_VIEW_FORMAT_UINT_2X8      = 0x02,
1488     CU_RES_VIEW_FORMAT_UINT_4X8      = 0x03,
1489     CU_RES_VIEW_FORMAT_SINT_1X8      = 0x04,
1490     CU_RES_VIEW_FORMAT_SINT_2X8      = 0x05,
1491     CU_RES_VIEW_FORMAT_SINT_4X8      = 0x06,
1492     CU_RES_VIEW_FORMAT_UINT_1X16     = 0x07,
1493     CU_RES_VIEW_FORMAT_UINT_2X16     = 0x08,
1494     CU_RES_VIEW_FORMAT_UINT_4X16     = 0x09,
1495     CU_RES_VIEW_FORMAT_SINT_1X16     = 0x0a,
1496     CU_RES_VIEW_FORMAT_SINT_2X16     = 0x0b,
1497     CU_RES_VIEW_FORMAT_SINT_4X16     = 0x0c,
1498     CU_RES_VIEW_FORMAT_UINT_1X32     = 0x0d,
1499     CU_RES_VIEW_FORMAT_UINT_2X32     = 0x0e,
1500     CU_RES_VIEW_FORMAT_UINT_4X32     = 0x0f,
1501     CU_RES_VIEW_FORMAT_SINT_1X32     = 0x10,
1502     CU_RES_VIEW_FORMAT_SINT_2X32     = 0x11,
1503     CU_RES_VIEW_FORMAT_SINT_4X32     = 0x12,
1504     CU_RES_VIEW_FORMAT_FLOAT_1X16    = 0x13,
1505     CU_RES_VIEW_FORMAT_FLOAT_2X16    = 0x14,
1506     CU_RES_VIEW_FORMAT_FLOAT_4X16    = 0x15,
1507     CU_RES_VIEW_FORMAT_FLOAT_1X32    = 0x16,
1508     CU_RES_VIEW_FORMAT_FLOAT_2X32    = 0x17,
1509     CU_RES_VIEW_FORMAT_FLOAT_4X32    = 0x18,
1510     CU_RES_VIEW_FORMAT_UNSIGNED_BC1  = 0x19,
1511     CU_RES_VIEW_FORMAT_UNSIGNED_BC2  = 0x1a,
1512     CU_RES_VIEW_FORMAT_UNSIGNED_BC3  = 0x1b,
1513     CU_RES_VIEW_FORMAT_UNSIGNED_BC4  = 0x1c,
1514     CU_RES_VIEW_FORMAT_SIGNED_BC4    = 0x1d,
1515     CU_RES_VIEW_FORMAT_UNSIGNED_BC5  = 0x1e,
1516     CU_RES_VIEW_FORMAT_SIGNED_BC5    = 0x1f,
1517     CU_RES_VIEW_FORMAT_UNSIGNED_BC6H = 0x20,
1518     CU_RES_VIEW_FORMAT_SIGNED_BC6H   = 0x21,
1519     CU_RES_VIEW_FORMAT_UNSIGNED_BC7  = 0x22
1520 }
1521 
1522 struct CUDA_RESOURCE_VIEW_DESC {
1523   CUresourceViewFormat format;
1524   size_t width;
1525   size_t height;
1526   size_t depth;
1527   uint firstMipmapLevel;
1528   uint lastMipmapLevel;
1529   uint firstLayer;
1530   uint lastLayer;
1531   uint[16] reserved;
1532 }
1533 
1534 
1535 struct CUDA_POINTER_ATTRIBUTE_P2P_TOKENS {
1536   ulong p2pToken;
1537   uint vaSpaceToken;
1538 }
1539 
1540 //
1541 // New since CUDA >= 9.0
1542 //
1543 
1544 /**
1545  * Kernel launch parameters
1546  */
1547 struct CUDA_LAUNCH_PARAMS {
1548   CUfunction _function;
1549   uint gridDimX;       /**< Width of grid in blocks */
1550   uint gridDimY;       /**< Height of grid in blocks */
1551   uint gridDimZ;       /**< Depth of grid in blocks */
1552   uint blockDimX;      /**< X dimension of each thread block */
1553   uint blockDimY;      /**< Y dimension of each thread block */
1554   uint blockDimZ;      /**< Z dimension of each thread block */
1555   uint sharedMemBytes; /**< Dynamic shared-memory size per thread block in bytes */
1556   CUstream hStream;            /**< Stream identifier */
1557   void **kernelParams;         /**< Array of pointers to kernel parameters */
1558 }
1559 
1560 //
1561 // New since CUDA >= 10.0
1562 //
1563 
1564 
1565 /**
1566  * External memory handle types
1567  */
1568 alias CUexternalMemoryHandleType = int;
1569 enum : CUexternalMemoryHandleType {
1570     /**
1571      * Handle is an opaque file descriptor
1572      */
1573     CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD        = 1,
1574     /**
1575      * Handle is an opaque shared NT handle
1576      */
1577     CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32     = 2,
1578     /**
1579      * Handle is an opaque, globally shared handle
1580      */
1581     CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3,
1582     /**
1583      * Handle is a D3D12 heap object
1584      */
1585     CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP       = 4,
1586     /**
1587      * Handle is a D3D12 committed resource
1588      */
1589     CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE   = 5
1590 }
1591 
1592 /**
1593  * Indicates that the external memory object is a dedicated resource
1594  */
1595 enum CUDA_EXTERNAL_MEMORY_DEDICATED   =  0x1;
1596 
1597 /**
1598  * External memory handle descriptor
1599  */
1600 struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC {
1601   /**
1602    * Type of the handle
1603    */
1604   CUexternalMemoryHandleType type;
1605   union handle_st {
1606     /**
1607      * File descriptor referencing the memory object. Valid
1608      * when type is
1609      * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD
1610      */
1611     int fd;
1612     /**
1613      * Win32 handle referencing the semaphore object. Valid when
1614      * type is one of the following:
1615      * - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32
1616      * - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT
1617      * - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP
1618      * - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE
1619      * Exactly one of 'handle' and 'name' must be non-NULL. If
1620      * type is
1621      * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT
1622      * then 'name' must be NULL.
1623      */
1624     struct win32_st {
1625       /**
1626        * Valid NT handle. Must be NULL if 'name' is non-NULL
1627        */
1628       void *handle;
1629       /**
1630        * Name of a valid memory object.
1631        * Must be NULL if 'handle' is non-NULL.
1632        */
1633       const void *name;
1634     }
1635     win32_st win32;
1636   }
1637   handle_st handle;
1638   /**
1639    * Size of the memory allocation
1640    */
1641   ulong size;
1642   /**
1643    * Flags must either be zero or ::CUDA_EXTERNAL_MEMORY_DEDICATED
1644    */
1645   uint flags;
1646   uint[16] reserved;
1647 }
1648 
1649 /**
1650  * External memory buffer descriptor
1651  */
1652 struct CUDA_EXTERNAL_MEMORY_BUFFER_DESC {
1653   /**
1654    * Offset into the memory object where the buffer's base is
1655    */
1656   ulong offset;
1657   /**
1658    * Size of the buffer
1659    */
1660   ulong size;
1661   /**
1662    * Flags reserved for future use. Must be zero.
1663    */
1664   uint flags;
1665   uint[16] reserved;
1666 }
1667 
1668 /**
1669  * External memory mipmap descriptor
1670  */
1671 struct CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC {
1672   /**
1673    * Offset into the memory object where the base level of the
1674    * mipmap chain is.
1675    */
1676   ulong offset;
1677   /**
1678    * Format, dimension and type of base level of the mipmap chain
1679    */
1680   CUDA_ARRAY3D_DESCRIPTOR arrayDesc;
1681   /**
1682    * Total number of levels in the mipmap chain
1683    */
1684   uint numLevels;
1685   uint[16] reserved;
1686 }
1687 
1688 /**
1689  * External semaphore handle types
1690  */
1691 alias CUexternalSemaphoreHandleType = int;
1692 enum : CUexternalSemaphoreHandleType {
1693   /**
1694    * Handle is an opaque file descriptor
1695    */
1696   CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD        = 1,
1697   /**
1698    * Handle is an opaque shared NT handle
1699    */
1700   CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32     = 2,
1701   /**
1702    * Handle is an opaque, globally shared handle
1703    */
1704   CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3,
1705   /**
1706    * Handle is a shared NT handle referencing a D3D12 fence object
1707    */
1708   CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE     = 4
1709 }
1710 
1711 /**
1712  * External semaphore handle descriptor
1713  */
1714 struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC {
1715   /**
1716    * Type of the handle
1717    */
1718   CUexternalSemaphoreHandleType type;
1719   union handle_st {
1720     /**
1721      * File descriptor referencing the semaphore object. Valid
1722      * when type is
1723      * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD
1724      */
1725     int fd;
1726     /**
1727      * Win32 handle referencing the semaphore object. Valid when
1728      * type is one of the following:
1729      * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32
1730      * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT
1731      * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE
1732      * Exactly one of 'handle' and 'name' must be non-NULL. If
1733      * type is
1734      * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT
1735      * then 'name' must be NULL.
1736      */
1737     struct win32_st {
1738       /**
1739        * Valid NT handle. Must be NULL if 'name' is non-NULL
1740        */
1741       void *handle;
1742       /**
1743        * Name of a valid synchronization primitive.
1744        * Must be NULL if 'handle' is non-NULL.
1745        */
1746       const void *name;
1747     }
1748     win32_st win32;
1749   }
1750   handle_st handle;
1751   /**
1752    * Flags reserved for the future. Must be zero.
1753    */
1754   uint flags;
1755   uint[16] reserved;
1756 }
1757 
1758 /**
1759  * External semaphore signal parameters
1760  */
1761 struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS {
1762   struct params_st {
1763     /**
1764      * Parameters for fence objects
1765      */
1766     struct fence_st {
1767       /**
1768        * Value of fence to be signaled
1769        */
1770       ulong value;
1771     }
1772     fence_st fence;
1773     uint[16] reserved;
1774   }
1775   params_st params;
1776   /**
1777    * Flags reserved for the future. Must be zero.
1778    */
1779   uint flags;
1780   uint[16] reserved;
1781 }
1782 
1783 /**
1784  * External semaphore wait parameters
1785  */
1786 struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS {
1787   struct params_st {
1788     /**
1789      * Parameters for fence objects
1790      */
1791     struct fence_st {
1792       /**
1793        * Value of fence to be waited on
1794        */
1795       ulong value;
1796     }
1797     fence_st fence;
1798     uint[16] reserved;
1799   }
1800   params_st params;
1801   /**
1802    * Flags reserved for the future. Must be zero.
1803    */
1804   uint flags;
1805   uint[16] reserved;
1806 }
1807 
1808 enum CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_PRE_LAUNCH_SYNC  =  0x01;
1809 enum CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_POST_LAUNCH_SYNC =  0x02;
1810 enum CUDA_ARRAY3D_LAYERED       =  0x01;
1811 enum CUDA_ARRAY3D_2DARRAY       =  0x01;
1812 enum CUDA_ARRAY3D_SURFACE_LDST  =  0x02;
1813 enum CUDA_ARRAY3D_CUBEMAP       =  0x04;
1814 enum CUDA_ARRAY3D_TEXTURE_GATHER = 0x08;
1815 enum CUDA_ARRAY3D_DEPTH_TEXTURE = 0x10;
1816 enum CUDA_ARRAY3D_COLOR_ATTACHMENT = 0x20;
1817 enum CU_TRSA_OVERRIDE_FORMAT = 0x01;
1818 enum CU_TRSF_READ_AS_INTEGER        =  0x01;
1819 enum CU_TRSF_NORMALIZED_COORDINATES =  0x02;
1820 enum CU_TRSF_SRGB  = 0x10;
1821 enum CU_LAUNCH_PARAM_END            = (cast(void*)0x00);
1822 enum CU_LAUNCH_PARAM_BUFFER_POINTER = (cast(void*)0x01);
1823 enum CU_LAUNCH_PARAM_BUFFER_SIZE    = (cast(void*)0x02);
1824 enum CU_PARAM_TR_DEFAULT = -1;
1825 
1826 enum CU_DEVICE_CPU              =  (cast(CUdevice)-1);
1827 
1828 /**
1829  * Device that represents an invalid device
1830  */
1831 enum CU_DEVICE_INVALID          =  (cast(CUdevice)-2);
1832 
1833 
1834 extern(System) @nogc nothrow
1835 {
1836 
1837   alias da_cuGetErrorString = CUresult function(CUresult error, const char **pStr);
1838   alias da_cuGetErrorName = CUresult function(CUresult error, const char **pStr);
1839   alias da_cuInit = CUresult function(uint Flags);
1840   alias da_cuDriverGetVersion = CUresult function(int *driverVersion);
1841   alias da_cuDeviceGet = CUresult function(CUdevice *device, int ordinal);
1842   alias da_cuDeviceGetCount = CUresult function(int *count);
1843   alias da_cuDeviceGetName = CUresult function(char *name, int len, CUdevice dev);
1844   alias da_cuDeviceGetUuid = CUresult function(CUuuid *uuid, CUdevice dev);
1845   //alias da_cuDeviceGetLuid = CUresult function(char *luid, uint *deviceNodeMask, CUdevice dev);
1846   alias da_cuDeviceTotalMem = CUresult function(size_t *bytes, CUdevice dev);
1847   alias da_cuDeviceGetAttribute = CUresult function(int *pi, CUdevice_attribute attrib, CUdevice dev);
1848   alias da_cuDeviceGetProperties = CUresult function(CUdevprop *prop, CUdevice dev);
1849   alias da_cuDeviceComputeCapability = CUresult function(int *major, int *minor, CUdevice dev);
1850   alias da_cuDevicePrimaryCtxRetain = CUresult function(CUcontext *pctx, CUdevice dev);
1851   alias da_cuDevicePrimaryCtxRelease = CUresult function(CUdevice dev);
1852   alias da_cuDevicePrimaryCtxSetFlags = CUresult function(CUdevice dev, uint flags);
1853   alias da_cuDevicePrimaryCtxGetState = CUresult function(CUdevice dev, uint *flags, int *active);
1854   alias da_cuDevicePrimaryCtxReset = CUresult function(CUdevice dev);
1855   alias da_cuCtxCreate = CUresult function(CUcontext *pctx, uint flags, CUdevice dev);
1856   alias da_cuCtxDestroy = CUresult function(CUcontext ctx);
1857   alias da_cuCtxPushCurrent = CUresult function(CUcontext ctx);
1858   alias da_cuCtxPopCurrent = CUresult function(CUcontext *pctx);
1859   alias da_cuCtxSetCurrent = CUresult function(CUcontext ctx);
1860   alias da_cuCtxGetCurrent = CUresult function(CUcontext *pctx);
1861   alias da_cuCtxGetDevice = CUresult function(CUdevice *device);
1862   alias da_cuCtxGetFlags = CUresult function(uint *flags);
1863   alias da_cuCtxSynchronize = CUresult function();
1864   alias da_cuCtxSetLimit = CUresult function(CUlimit limit, size_t value);
1865   alias da_cuCtxGetLimit = CUresult function(size_t *pvalue, CUlimit limit);
1866   alias da_cuCtxGetCacheConfig = CUresult function(CUfunc_cache *pconfig);
1867   alias da_cuCtxSetCacheConfig = CUresult function(CUfunc_cache config);
1868   alias da_cuCtxGetSharedMemConfig = CUresult function(CUsharedconfig *pConfig);
1869   alias da_cuCtxSetSharedMemConfig = CUresult function(CUsharedconfig config);
1870   alias da_cuCtxGetApiVersion = CUresult function(CUcontext ctx, uint *pVersion);
1871   alias da_cuCtxGetStreamPriorityRange = CUresult function(int *leastPriority, int *greatestPriority);
1872   alias da_cuCtxAttach = CUresult function(CUcontext *pctx, uint flags);
1873   alias da_cuCtxDetach = CUresult function(CUcontext ctx);
1874   alias da_cuModuleLoad = CUresult function(CUmodule *pModule, const char *fname);
1875   alias da_cuModuleLoadData = CUresult function(CUmodule *pModule, const void *image);
1876   alias da_cuModuleLoadDataEx = CUresult function(CUmodule *pModule, const void *image, uint numOptions, CUjit_option *options, void **optionValues);
1877   alias da_cuModuleLoadFatBinary = CUresult function(CUmodule *pModule, const void *fatCubin);
1878   alias da_cuModuleUnload = CUresult function(CUmodule hmod);
1879   alias da_cuModuleGetFunction = CUresult function(CUfunction *hfunc, CUmodule hmod, const char *name);
1880   alias da_cuModuleGetGlobal = CUresult function(CUdeviceptr *dptr, size_t *bytes, CUmodule hmod, const char *name);
1881   alias da_cuModuleGetTexRef = CUresult function(CUtexref *pTexRef, CUmodule hmod, const char *name);
1882   alias da_cuModuleGetSurfRef = CUresult function(CUsurfref *pSurfRef, CUmodule hmod, const char *name);
1883   alias da_cuLinkCreate = CUresult function(uint numOptions, CUjit_option *options, void **optionValues, CUlinkState *stateOut);
1884   alias da_cuLinkAddData = CUresult function(CUlinkState state, CUjitInputType type, void *data, size_t size, const char *name, uint numOptions, CUjit_option *options, void **optionValues);
1885   alias da_cuLinkAddFile = CUresult function(CUlinkState state, CUjitInputType type, const char *path, uint numOptions, CUjit_option *options, void **optionValues);
1886   alias da_cuLinkComplete = CUresult function(CUlinkState state, void **cubinOut, size_t *sizeOut);
1887   alias da_cuLinkDestroy = CUresult function(CUlinkState state);
1888   alias da_cuMemGetInfo = CUresult function(size_t *free, size_t *total);
1889   alias da_cuMemAlloc = CUresult function(CUdeviceptr *dptr, size_t bytesize);
1890   alias da_cuMemAllocPitch = CUresult function(CUdeviceptr *dptr, size_t *pPitch, size_t WidthInBytes, size_t Height, uint ElementSizeBytes);
1891   alias da_cuMemFree = CUresult function(CUdeviceptr dptr);
1892   alias da_cuMemGetAddressRange = CUresult function(CUdeviceptr *pbase, size_t *psize, CUdeviceptr dptr);
1893   alias da_cuMemAllocHost = CUresult function(void **pp, size_t bytesize);
1894   alias da_cuMemFreeHost = CUresult function(void *p);
1895   alias da_cuMemHostAlloc = CUresult function(void **pp, size_t bytesize, uint Flags);
1896   alias da_cuMemHostGetDevicePointer = CUresult function(CUdeviceptr *pdptr, void *p, uint Flags);
1897   alias da_cuMemHostGetFlags = CUresult function(uint *pFlags, void *p);
1898   alias da_cuMemAllocManaged = CUresult function(CUdeviceptr *dptr, size_t bytesize, uint flags);
1899   alias da_cuDeviceGetByPCIBusId = CUresult function(CUdevice *dev, const char *pciBusId);
1900   alias da_cuDeviceGetPCIBusId = CUresult function(char *pciBusId, int len, CUdevice dev);
1901   alias da_cuIpcGetEventHandle = CUresult function(CUipcEventHandle *pHandle, CUevent event);
1902   alias da_cuIpcOpenEventHandle = CUresult function(CUevent *phEvent, CUipcEventHandle handle);
1903   alias da_cuIpcGetMemHandle = CUresult function(CUipcMemHandle *pHandle, CUdeviceptr dptr);
1904   alias da_cuIpcOpenMemHandle = CUresult function(CUdeviceptr *pdptr, CUipcMemHandle handle, uint Flags);
1905   alias da_cuIpcCloseMemHandle = CUresult function(CUdeviceptr dptr);
1906   alias da_cuMemHostRegister = CUresult function(void *p, size_t bytesize, uint Flags);
1907   alias da_cuMemHostUnregister = CUresult function(void *p);
1908   alias da_cuMemcpy = CUresult function(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount);
1909   alias da_cuMemcpyPeer = CUresult function(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount);
1910   alias da_cuMemcpyHtoD = CUresult function(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount);
1911   alias da_cuMemcpyDtoH = CUresult function(void *dstHost, CUdeviceptr srcDevice, size_t ByteCount);
1912   alias da_cuMemcpyDtoD = CUresult function(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount);
1913   alias da_cuMemcpyDtoA = CUresult function(CUarray dstArray, size_t dstOffset, CUdeviceptr srcDevice, size_t ByteCount);
1914   alias da_cuMemcpyAtoD = CUresult function(CUdeviceptr dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount);
1915   alias da_cuMemcpyHtoA = CUresult function(CUarray dstArray, size_t dstOffset, const void *srcHost, size_t ByteCount);
1916   alias da_cuMemcpyAtoH = CUresult function(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount);
1917   alias da_cuMemcpyAtoA = CUresult function(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount);
1918   alias da_cuMemcpy2D = CUresult function(const CUDA_MEMCPY2D *pCopy);
1919   alias da_cuMemcpy2DUnaligned = CUresult function(const CUDA_MEMCPY2D *pCopy);
1920   alias da_cuMemcpy3D = CUresult function(const CUDA_MEMCPY3D *pCopy);
1921   alias da_cuMemcpy3DPeer = CUresult function(const CUDA_MEMCPY3D_PEER *pCopy);
1922   alias da_cuMemcpyAsync = CUresult function(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount, CUstream hStream);
1923   alias da_cuMemcpyPeerAsync = CUresult function(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream);
1924   alias da_cuMemcpyHtoDAsync = CUresult function(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount, CUstream hStream);
1925   alias da_cuMemcpyDtoHAsync = CUresult function(void *dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream);
1926   alias da_cuMemcpyDtoDAsync = CUresult function(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream);
1927   alias da_cuMemcpyHtoAAsync = CUresult function(CUarray dstArray, size_t dstOffset, const void *srcHost, size_t ByteCount, CUstream hStream);
1928   alias da_cuMemcpyAtoHAsync = CUresult function(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream);
1929   alias da_cuMemcpy2DAsync = CUresult function(const CUDA_MEMCPY2D *pCopy, CUstream hStream);
1930   alias da_cuMemcpy3DAsync = CUresult function(const CUDA_MEMCPY3D *pCopy, CUstream hStream);
1931   alias da_cuMemcpy3DPeerAsync = CUresult function(const CUDA_MEMCPY3D_PEER *pCopy, CUstream hStream);
1932   alias da_cuMemsetD8 = CUresult function(CUdeviceptr dstDevice, dchar uc, size_t N);
1933   alias da_cuMemsetD16 = CUresult function(CUdeviceptr dstDevice, ushort us, size_t N);
1934   alias da_cuMemsetD32 = CUresult function(CUdeviceptr dstDevice, uint ui, size_t N);
1935   alias da_cuMemsetD2D8 = CUresult function(CUdeviceptr dstDevice, size_t dstPitch, dchar uc, size_t Width, size_t Height);
1936   alias da_cuMemsetD2D16 = CUresult function(CUdeviceptr dstDevice, size_t dstPitch, ushort us, size_t Width, size_t Height);
1937   alias da_cuMemsetD2D32 = CUresult function(CUdeviceptr dstDevice, size_t dstPitch, uint ui, size_t Width, size_t Height);
1938   alias da_cuMemsetD8Async = CUresult function(CUdeviceptr dstDevice, dchar uc, size_t N, CUstream hStream);
1939   alias da_cuMemsetD16Async = CUresult function(CUdeviceptr dstDevice, ushort us, size_t N, CUstream hStream);
1940   alias da_cuMemsetD32Async = CUresult function(CUdeviceptr dstDevice, uint ui, size_t N, CUstream hStream);
1941   alias da_cuMemsetD2D8Async = CUresult function(CUdeviceptr dstDevice, size_t dstPitch, dchar uc, size_t Width, size_t Height, CUstream hStream);
1942   alias da_cuMemsetD2D16Async = CUresult function(CUdeviceptr dstDevice, size_t dstPitch, ushort us, size_t Width, size_t Height, CUstream hStream);
1943   alias da_cuMemsetD2D32Async = CUresult function(CUdeviceptr dstDevice, size_t dstPitch, uint ui, size_t Width, size_t Height, CUstream hStream);
1944   alias da_cuArrayCreate = CUresult function(CUarray *pHandle, const CUDA_ARRAY_DESCRIPTOR *pAllocateArray);
1945   alias da_cuArrayGetDescriptor = CUresult function(CUDA_ARRAY_DESCRIPTOR *pArrayDescriptor, CUarray hArray);
1946   alias da_cuArrayDestroy = CUresult function(CUarray hArray);
1947   alias da_cuArray3DCreate = CUresult function(CUarray *pHandle, const CUDA_ARRAY3D_DESCRIPTOR *pAllocateArray);
1948   alias da_cuArray3DGetDescriptor = CUresult function(CUDA_ARRAY3D_DESCRIPTOR *pArrayDescriptor, CUarray hArray);
1949   alias da_cuMipmappedArrayCreate = CUresult function(CUmipmappedArray *pHandle, const CUDA_ARRAY3D_DESCRIPTOR *pMipmappedArrayDesc, uint numMipmapLevels);
1950   alias da_cuMipmappedArrayGetLevel = CUresult function(CUarray *pLevelArray, CUmipmappedArray hMipmappedArray, uint level);
1951   alias da_cuMipmappedArrayDestroy = CUresult function(CUmipmappedArray hMipmappedArray);
1952   alias da_cuPointerGetAttribute = CUresult function(void *data, CUpointer_attribute attribute, CUdeviceptr ptr);
1953   alias da_cuMemPrefetchAsync = CUresult function(CUdeviceptr devPtr, size_t count, CUdevice dstDevice, CUstream hStream);
1954   alias da_cuMemAdvise = CUresult function(CUdeviceptr devPtr, size_t count, CUmem_advise advice, CUdevice device);
1955   alias da_cuMemRangeGetAttribute = CUresult function(void *data, size_t dataSize, CUmem_range_attribute attribute, CUdeviceptr devPtr, size_t count);
1956   alias da_cuMemRangeGetAttributes = CUresult function(void **data, size_t *dataSizes, CUmem_range_attribute *attributes, size_t numAttributes, CUdeviceptr devPtr, size_t count);
1957   alias da_cuPointerSetAttribute = CUresult function(const void *value, CUpointer_attribute attribute, CUdeviceptr ptr);
1958   alias da_cuPointerGetAttributes = CUresult function(uint numAttributes, CUpointer_attribute *attributes, void **data, CUdeviceptr ptr);
1959   alias da_cuStreamCreate = CUresult function(CUstream *phStream, uint Flags);
1960   alias da_cuStreamCreateWithPriority = CUresult function(CUstream *phStream, uint flags, int priority);
1961   alias da_cuStreamGetPriority = CUresult function(CUstream hStream, int *priority);
1962   alias da_cuStreamGetFlags = CUresult function(CUstream hStream, uint *flags);
1963   alias da_cuStreamGetCtx = CUresult function(CUstream hStream, CUcontext *pctx);
1964   alias da_cuStreamWaitEvent = CUresult function(CUstream hStream, CUevent hEvent, uint Flags);
1965   alias da_cuStreamAddCallback = CUresult function(CUstream hStream, CUstreamCallback callback, void *userData, uint flags);
1966   alias da_cuStreamBeginCapture = CUresult function(CUstream hStream);
1967   alias da_cuStreamEndCapture = CUresult function(CUstream hStream, CUgraph *phGraph);
1968   alias da_cuStreamIsCapturing = CUresult function(CUstream hStream, CUstreamCaptureStatus *captureStatus);
1969   alias da_cuStreamAttachMemAsync = CUresult function(CUstream hStream, CUdeviceptr dptr, size_t length, uint flags);
1970   alias da_cuStreamQuery = CUresult function(CUstream hStream);
1971   alias da_cuStreamSynchronize = CUresult function(CUstream hStream);
1972   alias da_cuStreamDestroy = CUresult function(CUstream hStream);
1973   alias da_cuEventCreate = CUresult function(CUevent *phEvent, uint Flags);
1974   alias da_cuEventRecord = CUresult function(CUevent hEvent, CUstream hStream);
1975   alias da_cuEventQuery = CUresult function(CUevent hEvent);
1976   alias da_cuEventSynchronize = CUresult function(CUevent hEvent);
1977   alias da_cuEventDestroy = CUresult function(CUevent hEvent);
1978   alias da_cuEventElapsedTime = CUresult function(float *pMilliseconds, CUevent hStart, CUevent hEnd);
1979   alias da_cuImportExternalMemory = CUresult function(CUexternalMemory *extMem_out, const CUDA_EXTERNAL_MEMORY_HANDLE_DESC *memHandleDesc);
1980   alias da_cuExternalMemoryGetMappedBuffer = CUresult function(CUdeviceptr *devPtr, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_BUFFER_DESC *bufferDesc);
1981   alias da_cuExternalMemoryGetMappedMipmappedArray = CUresult function(CUmipmappedArray *mipmap, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC *mipmapDesc);
1982   alias da_cuDestroyExternalMemory = CUresult function(CUexternalMemory extMem);
1983   alias da_cuImportExternalSemaphore = CUresult function(CUexternalSemaphore *extSem_out, const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC *semHandleDesc);
1984   alias da_cuSignalExternalSemaphoresAsync = CUresult function(const CUexternalSemaphore *extSemArray, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS *paramsArray, uint numExtSems, CUstream stream);
1985   alias da_cuWaitExternalSemaphoresAsync = CUresult function(const CUexternalSemaphore *extSemArray, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS *paramsArray, uint numExtSems, CUstream stream);
1986   alias da_cuDestroyExternalSemaphore = CUresult function(CUexternalSemaphore extSem);
1987   alias da_cuStreamWaitValue32 = CUresult function(CUstream stream, CUdeviceptr addr, cuuint32_t value, uint flags);
1988   alias da_cuStreamWaitValue64 = CUresult function(CUstream stream, CUdeviceptr addr, cuuint64_t value, uint flags);
1989   alias da_cuStreamWriteValue32 = CUresult function(CUstream stream, CUdeviceptr addr, cuuint32_t value, uint flags);
1990   alias da_cuStreamWriteValue64 = CUresult function(CUstream stream, CUdeviceptr addr, cuuint64_t value, uint flags);
1991   alias da_cuStreamBatchMemOp = CUresult function(CUstream stream, uint count, CUstreamBatchMemOpParams *paramArray, uint flags);
1992   alias da_cuFuncGetAttribute = CUresult function(int *pi, CUfunction_attribute attrib, CUfunction hfunc);
1993   alias da_cuFuncSetAttribute = CUresult function(CUfunction hfunc, CUfunction_attribute attrib, int value);
1994   alias da_cuFuncSetCacheConfig = CUresult function(CUfunction hfunc, CUfunc_cache config);
1995   alias da_cuFuncSetSharedMemConfig = CUresult function(CUfunction hfunc, CUsharedconfig config);
1996   alias da_cuLaunchKernel = CUresult function(CUfunction f,uint gridDimX,uint gridDimY,uint gridDimZ,uint blockDimX,uint blockDimY,uint blockDimZ,uint sharedMemBytes,CUstream hStream,void **kernelParams,void **extra);
1997   alias da_cuLaunchCooperativeKernel = CUresult function(CUfunction f,uint gridDimX,uint gridDimY,uint gridDimZ,uint blockDimX,uint blockDimY,uint blockDimZ,uint sharedMemBytes,CUstream hStream,void **kernelParams);
1998   alias da_cuLaunchCooperativeKernelMultiDevice = CUresult function(CUDA_LAUNCH_PARAMS *launchParamsList, uint numDevices, uint flags);
1999   alias da_cuLaunchHostFunc = CUresult function(CUstream hStream, CUhostFn fn, void *userData);
2000   alias da_cuFuncSetBlockShape = CUresult function(CUfunction hfunc, int x, int y, int z);
2001   alias da_cuFuncSetSharedSize = CUresult function(CUfunction hfunc, uint bytes);
2002   alias da_cuParamSetSize = CUresult function(CUfunction hfunc, uint numbytes);
2003   alias da_cuParamSeti = CUresult function(CUfunction hfunc, int offset, uint value);
2004   alias da_cuParamSetf = CUresult function(CUfunction hfunc, int offset, float value);
2005   alias da_cuParamSetv = CUresult function(CUfunction hfunc, int offset, void *ptr, uint numbytes);
2006   alias da_cuLaunch = CUresult function(CUfunction f);
2007   alias da_cuLaunchGrid = CUresult function(CUfunction f, int grid_width, int grid_height);
2008   alias da_cuLaunchGridAsync = CUresult function(CUfunction f, int grid_width, int grid_height, CUstream hStream);
2009   alias da_cuParamSetTexRef = CUresult function(CUfunction hfunc, int texunit, CUtexref hTexRef);
2010   alias da_cuGraphCreate = CUresult function(CUgraph *phGraph, uint flags);
2011   alias da_cuGraphAddKernelNode = CUresult function(CUgraphNode *phGraphNode, CUgraph hGraph, CUgraphNode *dependencies, size_t numDependencies, const CUDA_KERNEL_NODE_PARAMS *nodeParams);
2012   alias da_cuGraphKernelNodeGetParams = CUresult function(CUgraphNode hNode, CUDA_KERNEL_NODE_PARAMS *nodeParams);
2013   alias da_cuGraphKernelNodeSetParams = CUresult function(CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS *nodeParams);
2014   alias da_cuGraphAddMemcpyNode = CUresult function(CUgraphNode *phGraphNode, CUgraph hGraph, CUgraphNode *dependencies, size_t numDependencies, const CUDA_MEMCPY3D *copyParams, CUcontext ctx);
2015   alias da_cuGraphMemcpyNodeGetParams = CUresult function(CUgraphNode hNode, CUDA_MEMCPY3D *nodeParams);
2016   alias da_cuGraphMemcpyNodeSetParams = CUresult function(CUgraphNode hNode, const CUDA_MEMCPY3D *nodeParams);
2017   alias da_cuGraphAddMemsetNode = CUresult function(CUgraphNode *phGraphNode, CUgraph hGraph, CUgraphNode *dependencies, size_t numDependencies, const CUDA_MEMSET_NODE_PARAMS *memsetParams, CUcontext ctx);
2018   alias da_cuGraphMemsetNodeGetParams = CUresult function(CUgraphNode hNode, CUDA_MEMSET_NODE_PARAMS *nodeParams);
2019   alias da_cuGraphMemsetNodeSetParams = CUresult function(CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS *nodeParams);
2020   alias da_cuGraphAddHostNode = CUresult function(CUgraphNode *phGraphNode, CUgraph hGraph, CUgraphNode *dependencies, size_t numDependencies, const CUDA_HOST_NODE_PARAMS *nodeParams);
2021   alias da_cuGraphHostNodeGetParams = CUresult function(CUgraphNode hNode, CUDA_HOST_NODE_PARAMS *nodeParams);
2022   alias da_cuGraphHostNodeSetParams = CUresult function(CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS *nodeParams);
2023   alias da_cuGraphAddChildGraphNode = CUresult function(CUgraphNode *phGraphNode, CUgraph hGraph, CUgraphNode *dependencies, size_t numDependencies, CUgraph childGraph);
2024   alias da_cuGraphChildGraphNodeGetGraph = CUresult function(CUgraphNode hNode, CUgraph *phGraph);
2025   alias da_cuGraphAddEmptyNode = CUresult function(CUgraphNode *phGraphNode, CUgraph hGraph, CUgraphNode *dependencies, size_t numDependencies);
2026   alias da_cuGraphClone = CUresult function(CUgraph *phGraphClone, CUgraph originalGraph);
2027   alias da_cuGraphNodeFindInClone = CUresult function(CUgraphNode *phNode, CUgraphNode hOriginalNode, CUgraph hClonedGraph);
2028   alias da_cuGraphNodeGetType = CUresult function(CUgraphNode hNode, CUgraphNodeType *type);
2029   alias da_cuGraphGetNodes = CUresult function(CUgraph hGraph, CUgraphNode *nodes, size_t *numNodes);
2030   alias da_cuGraphGetRootNodes = CUresult function(CUgraph hGraph, CUgraphNode *rootNodes, size_t *numRootNodes);
2031   alias da_cuGraphGetEdges = CUresult function(CUgraph hGraph, CUgraphNode *from, CUgraphNode *to, size_t *numEdges);
2032   alias da_cuGraphNodeGetDependencies = CUresult function(CUgraphNode hNode, CUgraphNode *dependencies, size_t *numDependencies);
2033   alias da_cuGraphNodeGetDependentNodes = CUresult function(CUgraphNode hNode, CUgraphNode *dependentNodes, size_t *numDependentNodes);
2034   alias da_cuGraphAddDependencies = CUresult function(CUgraph hGraph, CUgraphNode *from, CUgraphNode *to, size_t numDependencies);
2035   alias da_cuGraphRemoveDependencies = CUresult function(CUgraph hGraph, CUgraphNode *from, CUgraphNode *to, size_t numDependencies);
2036   alias da_cuGraphDestroyNode = CUresult function(CUgraphNode hNode);
2037   alias da_cuGraphInstantiate = CUresult function(CUgraphExec *phGraphExec, CUgraph hGraph, CUgraphNode *phErrorNode, char *logBuffer, size_t bufferSize);
2038   alias da_cuGraphLaunch = CUresult function(CUgraphExec hGraphExec, CUstream hStream);
2039   alias da_cuGraphExecDestroy = CUresult function(CUgraphExec hGraphExec);
2040   alias da_cuGraphDestroy = CUresult function(CUgraph hGraph);
2041   alias da_cuOccupancyMaxActiveBlocksPerMultiprocessor = CUresult function(int *numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize);
2042   alias da_cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags = CUresult function(int *numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize, uint flags);
2043   alias da_cuOccupancyMaxPotentialBlockSize = CUresult function(int *minGridSize, int *blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit);
2044   alias da_cuOccupancyMaxPotentialBlockSizeWithFlags = CUresult function(int *minGridSize, int *blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit, uint flags);
2045   alias da_cuTexRefSetArray = CUresult function(CUtexref hTexRef, CUarray hArray, uint Flags);
2046   alias da_cuTexRefSetMipmappedArray = CUresult function(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, uint Flags);
2047   alias da_cuTexRefSetAddress = CUresult function(size_t *ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, size_t bytes);
2048   alias da_cuTexRefSetAddress2D = CUresult function(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR *desc, CUdeviceptr dptr, size_t Pitch);
2049   alias da_cuTexRefSetFormat = CUresult function(CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents);
2050   alias da_cuTexRefSetAddressMode = CUresult function(CUtexref hTexRef, int dim, CUaddress_mode am);
2051   alias da_cuTexRefSetFilterMode = CUresult function(CUtexref hTexRef, CUfilter_mode fm);
2052   alias da_cuTexRefSetMipmapFilterMode = CUresult function(CUtexref hTexRef, CUfilter_mode fm);
2053   alias da_cuTexRefSetMipmapLevelBias = CUresult function(CUtexref hTexRef, float bias);
2054   alias da_cuTexRefSetMipmapLevelClamp = CUresult function(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp);
2055   alias da_cuTexRefSetMaxAnisotropy = CUresult function(CUtexref hTexRef, uint maxAniso);
2056   alias da_cuTexRefSetBorderColor = CUresult function(CUtexref hTexRef, float *pBorderColor);
2057   alias da_cuTexRefSetFlags = CUresult function(CUtexref hTexRef, uint Flags);
2058   alias da_cuTexRefGetAddress = CUresult function(CUdeviceptr *pdptr, CUtexref hTexRef);
2059   alias da_cuTexRefGetArray = CUresult function(CUarray *phArray, CUtexref hTexRef);
2060   alias da_cuTexRefGetMipmappedArray = CUresult function(CUmipmappedArray *phMipmappedArray, CUtexref hTexRef);
2061   alias da_cuTexRefGetAddressMode = CUresult function(CUaddress_mode *pam, CUtexref hTexRef, int dim);
2062   alias da_cuTexRefGetFilterMode = CUresult function(CUfilter_mode *pfm, CUtexref hTexRef);
2063   alias da_cuTexRefGetFormat = CUresult function(CUarray_format *pFormat, int *pNumChannels, CUtexref hTexRef);
2064   alias da_cuTexRefGetMipmapFilterMode = CUresult function(CUfilter_mode *pfm, CUtexref hTexRef);
2065   alias da_cuTexRefGetMipmapLevelBias = CUresult function(float *pbias, CUtexref hTexRef);
2066   alias da_cuTexRefGetMipmapLevelClamp = CUresult function(float *pminMipmapLevelClamp, float *pmaxMipmapLevelClamp, CUtexref hTexRef);
2067   alias da_cuTexRefGetMaxAnisotropy = CUresult function(int *pmaxAniso, CUtexref hTexRef);
2068   alias da_cuTexRefGetBorderColor = CUresult function(float *pBorderColor, CUtexref hTexRef);
2069   alias da_cuTexRefGetFlags = CUresult function(uint *pFlags, CUtexref hTexRef);
2070   alias da_cuTexRefCreate = CUresult function(CUtexref *pTexRef);
2071   alias da_cuTexRefDestroy = CUresult function(CUtexref hTexRef);
2072   alias da_cuSurfRefSetArray = CUresult function(CUsurfref hSurfRef, CUarray hArray, uint Flags);
2073   alias da_cuSurfRefGetArray = CUresult function(CUarray *phArray, CUsurfref hSurfRef);
2074   alias da_cuTexObjectCreate = CUresult function(CUtexObject *pTexObject, const CUDA_RESOURCE_DESC *pResDesc, const CUDA_TEXTURE_DESC *pTexDesc, const CUDA_RESOURCE_VIEW_DESC *pResViewDesc);
2075   alias da_cuTexObjectDestroy = CUresult function(CUtexObject texObject);
2076   alias da_cuTexObjectGetResourceDesc = CUresult function(CUDA_RESOURCE_DESC *pResDesc, CUtexObject texObject);
2077   alias da_cuTexObjectGetTextureDesc = CUresult function(CUDA_TEXTURE_DESC *pTexDesc, CUtexObject texObject);
2078   alias da_cuTexObjectGetResourceViewDesc = CUresult function(CUDA_RESOURCE_VIEW_DESC *pResViewDesc, CUtexObject texObject);
2079   alias da_cuSurfObjectCreate = CUresult function(CUsurfObject *pSurfObject, const CUDA_RESOURCE_DESC *pResDesc);
2080   alias da_cuSurfObjectDestroy = CUresult function(CUsurfObject surfObject);
2081   alias da_cuSurfObjectGetResourceDesc = CUresult function(CUDA_RESOURCE_DESC *pResDesc, CUsurfObject surfObject);
2082   alias da_cuDeviceCanAccessPeer = CUresult function(int *canAccessPeer, CUdevice dev, CUdevice peerDev);
2083   alias da_cuCtxEnablePeerAccess = CUresult function(CUcontext peerContext, uint Flags);
2084   alias da_cuCtxDisablePeerAccess = CUresult function(CUcontext peerContext);
2085   alias da_cuDeviceGetP2PAttribute = CUresult function(int* value, CUdevice_P2PAttribute attrib, CUdevice srcDevice, CUdevice dstDevice);
2086   alias da_cuGraphicsUnregisterResource = CUresult function(CUgraphicsResource resource);
2087   alias da_cuGraphicsSubResourceGetMappedArray = CUresult function(CUarray *pArray, CUgraphicsResource resource, uint arrayIndex, uint mipLevel);
2088   alias da_cuGraphicsResourceGetMappedMipmappedArray = CUresult function(CUmipmappedArray *pMipmappedArray, CUgraphicsResource resource);
2089   alias da_cuGraphicsResourceGetMappedPointer = CUresult function(CUdeviceptr *pDevPtr, size_t *pSize, CUgraphicsResource resource);
2090   alias da_cuGraphicsResourceSetMapFlags = CUresult function(CUgraphicsResource resource, uint flags);
2091   alias da_cuGraphicsMapResources = CUresult function(uint count, CUgraphicsResource *resources, CUstream hStream);
2092   alias da_cuGraphicsUnmapResources = CUresult function(uint count, CUgraphicsResource *resources, CUstream hStream);
2093   alias da_cuGetExportTable = CUresult function(const void **ppExportTable, const CUuuid *pExportTableId);
2094   alias da_cuTexRefSetAddress2D_v2 = CUresult function(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR *desc, CUdeviceptr dptr, size_t Pitch);
2095 
2096 
2097 
2098 }
2099 
2100 __gshared
2101 {
2102   da_cuGetErrorString cuGetErrorString;
2103   da_cuGetErrorName cuGetErrorName;
2104   da_cuInit cuInit;
2105   da_cuDriverGetVersion cuDriverGetVersion;
2106   da_cuDeviceGet cuDeviceGet;
2107   da_cuDeviceGetCount cuDeviceGetCount;
2108   da_cuDeviceGetName cuDeviceGetName;
2109   da_cuDeviceGetUuid cuDeviceGetUuid;
2110   //da_cuDeviceGetLuid cuDeviceGetLuid;
2111   da_cuDeviceTotalMem cuDeviceTotalMem;
2112   da_cuDeviceGetAttribute cuDeviceGetAttribute;
2113   da_cuDeviceGetProperties cuDeviceGetProperties;
2114   da_cuDeviceComputeCapability cuDeviceComputeCapability;
2115   da_cuDevicePrimaryCtxRetain cuDevicePrimaryCtxRetain;
2116   da_cuDevicePrimaryCtxRelease cuDevicePrimaryCtxRelease;
2117   da_cuDevicePrimaryCtxSetFlags cuDevicePrimaryCtxSetFlags;
2118   da_cuDevicePrimaryCtxGetState cuDevicePrimaryCtxGetState;
2119   da_cuDevicePrimaryCtxReset cuDevicePrimaryCtxReset;
2120   da_cuCtxCreate cuCtxCreate;
2121   da_cuCtxDestroy cuCtxDestroy;
2122   da_cuCtxPushCurrent cuCtxPushCurrent;
2123   da_cuCtxPopCurrent cuCtxPopCurrent;
2124   da_cuCtxSetCurrent cuCtxSetCurrent;
2125   da_cuCtxGetCurrent cuCtxGetCurrent;
2126   da_cuCtxGetDevice cuCtxGetDevice;
2127   da_cuCtxGetFlags cuCtxGetFlags;
2128   da_cuCtxSynchronize cuCtxSynchronize;
2129   da_cuCtxSetLimit cuCtxSetLimit;
2130   da_cuCtxGetLimit cuCtxGetLimit;
2131   da_cuCtxGetCacheConfig cuCtxGetCacheConfig;
2132   da_cuCtxSetCacheConfig cuCtxSetCacheConfig;
2133   da_cuCtxGetSharedMemConfig cuCtxGetSharedMemConfig;
2134   da_cuCtxSetSharedMemConfig cuCtxSetSharedMemConfig;
2135   da_cuCtxGetApiVersion cuCtxGetApiVersion;
2136   da_cuCtxGetStreamPriorityRange cuCtxGetStreamPriorityRange;
2137   da_cuCtxAttach cuCtxAttach;
2138   da_cuCtxDetach cuCtxDetach;
2139   da_cuModuleLoad cuModuleLoad;
2140   da_cuModuleLoadData cuModuleLoadData;
2141   da_cuModuleLoadDataEx cuModuleLoadDataEx;
2142   da_cuModuleLoadFatBinary cuModuleLoadFatBinary;
2143   da_cuModuleUnload cuModuleUnload;
2144   da_cuModuleGetFunction cuModuleGetFunction;
2145   da_cuModuleGetGlobal cuModuleGetGlobal;
2146   da_cuModuleGetTexRef cuModuleGetTexRef;
2147   da_cuModuleGetSurfRef cuModuleGetSurfRef;
2148   da_cuLinkCreate cuLinkCreate;
2149   da_cuLinkAddData cuLinkAddData;
2150   da_cuLinkAddFile cuLinkAddFile;
2151   da_cuLinkComplete cuLinkComplete;
2152   da_cuLinkDestroy cuLinkDestroy;
2153   da_cuMemGetInfo cuMemGetInfo;
2154   da_cuMemAlloc cuMemAlloc;
2155   da_cuMemAllocPitch cuMemAllocPitch;
2156   da_cuMemFree cuMemFree;
2157   da_cuMemGetAddressRange cuMemGetAddressRange;
2158   da_cuMemAllocHost cuMemAllocHost;
2159   da_cuMemFreeHost cuMemFreeHost;
2160   da_cuMemHostAlloc cuMemHostAlloc;
2161   da_cuMemHostGetDevicePointer cuMemHostGetDevicePointer;
2162   da_cuMemHostGetFlags cuMemHostGetFlags;
2163   da_cuMemAllocManaged cuMemAllocManaged;
2164   da_cuDeviceGetByPCIBusId cuDeviceGetByPCIBusId;
2165   da_cuDeviceGetPCIBusId cuDeviceGetPCIBusId;
2166   da_cuIpcGetEventHandle cuIpcGetEventHandle;
2167   da_cuIpcOpenEventHandle cuIpcOpenEventHandle;
2168   da_cuIpcGetMemHandle cuIpcGetMemHandle;
2169   da_cuIpcOpenMemHandle cuIpcOpenMemHandle;
2170   da_cuIpcCloseMemHandle cuIpcCloseMemHandle;
2171   da_cuMemHostRegister cuMemHostRegister;
2172   da_cuMemHostUnregister cuMemHostUnregister;
2173   da_cuMemcpy cuMemcpy;
2174   da_cuMemcpyPeer cuMemcpyPeer;
2175   da_cuMemcpyHtoD cuMemcpyHtoD;
2176   da_cuMemcpyDtoH cuMemcpyDtoH;
2177   da_cuMemcpyDtoD cuMemcpyDtoD;
2178   da_cuMemcpyDtoA cuMemcpyDtoA;
2179   da_cuMemcpyAtoD cuMemcpyAtoD;
2180   da_cuMemcpyHtoA cuMemcpyHtoA;
2181   da_cuMemcpyAtoH cuMemcpyAtoH;
2182   da_cuMemcpyAtoA cuMemcpyAtoA;
2183   da_cuMemcpy2D cuMemcpy2D;
2184   da_cuMemcpy2DUnaligned cuMemcpy2DUnaligned;
2185   da_cuMemcpy3D cuMemcpy3D;
2186   da_cuMemcpy3DPeer cuMemcpy3DPeer;
2187   da_cuMemcpyAsync cuMemcpyAsync;
2188   da_cuMemcpyPeerAsync cuMemcpyPeerAsync;
2189   da_cuMemcpyHtoDAsync cuMemcpyHtoDAsync;
2190   da_cuMemcpyDtoHAsync cuMemcpyDtoHAsync;
2191   da_cuMemcpyDtoDAsync cuMemcpyDtoDAsync;
2192   da_cuMemcpyHtoAAsync cuMemcpyHtoAAsync;
2193   da_cuMemcpyAtoHAsync cuMemcpyAtoHAsync;
2194   da_cuMemcpy2DAsync cuMemcpy2DAsync;
2195   da_cuMemcpy3DAsync cuMemcpy3DAsync;
2196   da_cuMemcpy3DPeerAsync cuMemcpy3DPeerAsync;
2197   da_cuMemsetD8 cuMemsetD8;
2198   da_cuMemsetD16 cuMemsetD16;
2199   da_cuMemsetD32 cuMemsetD32;
2200   da_cuMemsetD2D8 cuMemsetD2D8;
2201   da_cuMemsetD2D16 cuMemsetD2D16;
2202   da_cuMemsetD2D32 cuMemsetD2D32;
2203   da_cuMemsetD8Async cuMemsetD8Async;
2204   da_cuMemsetD16Async cuMemsetD16Async;
2205   da_cuMemsetD32Async cuMemsetD32Async;
2206   da_cuMemsetD2D8Async cuMemsetD2D8Async;
2207   da_cuMemsetD2D16Async cuMemsetD2D16Async;
2208   da_cuMemsetD2D32Async cuMemsetD2D32Async;
2209   da_cuArrayCreate cuArrayCreate;
2210   da_cuArrayGetDescriptor cuArrayGetDescriptor;
2211   da_cuArrayDestroy cuArrayDestroy;
2212   da_cuArray3DCreate cuArray3DCreate;
2213   da_cuArray3DGetDescriptor cuArray3DGetDescriptor;
2214   da_cuMipmappedArrayCreate cuMipmappedArrayCreate;
2215   da_cuMipmappedArrayGetLevel cuMipmappedArrayGetLevel;
2216   da_cuMipmappedArrayDestroy cuMipmappedArrayDestroy;
2217   da_cuPointerGetAttribute cuPointerGetAttribute;
2218   da_cuMemPrefetchAsync cuMemPrefetchAsync;
2219   da_cuMemAdvise cuMemAdvise;
2220   da_cuMemRangeGetAttribute cuMemRangeGetAttribute;
2221   da_cuMemRangeGetAttributes cuMemRangeGetAttributes;
2222   da_cuPointerSetAttribute cuPointerSetAttribute;
2223   da_cuPointerGetAttributes cuPointerGetAttributes;
2224   da_cuStreamCreate cuStreamCreate;
2225   da_cuStreamCreateWithPriority cuStreamCreateWithPriority;
2226   da_cuStreamGetPriority cuStreamGetPriority;
2227   da_cuStreamGetFlags cuStreamGetFlags;
2228   da_cuStreamGetCtx cuStreamGetCtx;
2229   da_cuStreamWaitEvent cuStreamWaitEvent;
2230   da_cuStreamAddCallback cuStreamAddCallback;
2231   da_cuStreamBeginCapture cuStreamBeginCapture;
2232   da_cuStreamEndCapture cuStreamEndCapture;
2233   da_cuStreamIsCapturing cuStreamIsCapturing;
2234   da_cuStreamAttachMemAsync cuStreamAttachMemAsync;
2235   da_cuStreamQuery cuStreamQuery;
2236   da_cuStreamSynchronize cuStreamSynchronize;
2237   da_cuStreamDestroy cuStreamDestroy;
2238   da_cuEventCreate cuEventCreate;
2239   da_cuEventRecord cuEventRecord;
2240   da_cuEventQuery cuEventQuery;
2241   da_cuEventSynchronize cuEventSynchronize;
2242   da_cuEventDestroy cuEventDestroy;
2243   da_cuEventElapsedTime cuEventElapsedTime;
2244   da_cuImportExternalMemory cuImportExternalMemory;
2245   da_cuExternalMemoryGetMappedBuffer cuExternalMemoryGetMappedBuffer;
2246   da_cuExternalMemoryGetMappedMipmappedArray cuExternalMemoryGetMappedMipmappedArray;
2247   da_cuDestroyExternalMemory cuDestroyExternalMemory;
2248   da_cuImportExternalSemaphore cuImportExternalSemaphore;
2249   da_cuSignalExternalSemaphoresAsync cuSignalExternalSemaphoresAsync;
2250   da_cuWaitExternalSemaphoresAsync cuWaitExternalSemaphoresAsync;
2251   da_cuDestroyExternalSemaphore cuDestroyExternalSemaphore;
2252   da_cuStreamWaitValue32 cuStreamWaitValue32;
2253   da_cuStreamWaitValue64 cuStreamWaitValue64;
2254   da_cuStreamWriteValue32 cuStreamWriteValue32;
2255   da_cuStreamWriteValue64 cuStreamWriteValue64;
2256   da_cuStreamBatchMemOp cuStreamBatchMemOp;
2257   da_cuFuncGetAttribute cuFuncGetAttribute;
2258   da_cuFuncSetAttribute cuFuncSetAttribute;
2259   da_cuFuncSetCacheConfig cuFuncSetCacheConfig;
2260   da_cuFuncSetSharedMemConfig cuFuncSetSharedMemConfig;
2261   da_cuLaunchKernel cuLaunchKernel;
2262   da_cuLaunchCooperativeKernel cuLaunchCooperativeKernel;
2263   da_cuLaunchCooperativeKernelMultiDevice cuLaunchCooperativeKernelMultiDevice;
2264   da_cuLaunchHostFunc cuLaunchHostFunc;
2265   da_cuFuncSetBlockShape cuFuncSetBlockShape;
2266   da_cuFuncSetSharedSize cuFuncSetSharedSize;
2267   da_cuParamSetSize cuParamSetSize;
2268   da_cuParamSeti cuParamSeti;
2269   da_cuParamSetf cuParamSetf;
2270   da_cuParamSetv cuParamSetv;
2271   da_cuLaunch cuLaunch;
2272   da_cuLaunchGrid cuLaunchGrid;
2273   da_cuLaunchGridAsync cuLaunchGridAsync;
2274   da_cuParamSetTexRef cuParamSetTexRef;
2275   da_cuGraphCreate cuGraphCreate;
2276   da_cuGraphAddKernelNode cuGraphAddKernelNode;
2277   da_cuGraphKernelNodeGetParams cuGraphKernelNodeGetParams;
2278   da_cuGraphKernelNodeSetParams cuGraphKernelNodeSetParams;
2279   da_cuGraphAddMemcpyNode cuGraphAddMemcpyNode;
2280   da_cuGraphMemcpyNodeGetParams cuGraphMemcpyNodeGetParams;
2281   da_cuGraphMemcpyNodeSetParams cuGraphMemcpyNodeSetParams;
2282   da_cuGraphAddMemsetNode cuGraphAddMemsetNode;
2283   da_cuGraphMemsetNodeGetParams cuGraphMemsetNodeGetParams;
2284   da_cuGraphMemsetNodeSetParams cuGraphMemsetNodeSetParams;
2285   da_cuGraphAddHostNode cuGraphAddHostNode;
2286   da_cuGraphHostNodeGetParams cuGraphHostNodeGetParams;
2287   da_cuGraphHostNodeSetParams cuGraphHostNodeSetParams;
2288   da_cuGraphAddChildGraphNode cuGraphAddChildGraphNode;
2289   da_cuGraphChildGraphNodeGetGraph cuGraphChildGraphNodeGetGraph;
2290   da_cuGraphAddEmptyNode cuGraphAddEmptyNode;
2291   da_cuGraphClone cuGraphClone;
2292   da_cuGraphNodeFindInClone cuGraphNodeFindInClone;
2293   da_cuGraphNodeGetType cuGraphNodeGetType;
2294   da_cuGraphGetNodes cuGraphGetNodes;
2295   da_cuGraphGetRootNodes cuGraphGetRootNodes;
2296   da_cuGraphGetEdges cuGraphGetEdges;
2297   da_cuGraphNodeGetDependencies cuGraphNodeGetDependencies;
2298   da_cuGraphNodeGetDependentNodes cuGraphNodeGetDependentNodes;
2299   da_cuGraphAddDependencies cuGraphAddDependencies;
2300   da_cuGraphRemoveDependencies cuGraphRemoveDependencies;
2301   da_cuGraphDestroyNode cuGraphDestroyNode;
2302   da_cuGraphInstantiate cuGraphInstantiate;
2303   da_cuGraphLaunch cuGraphLaunch;
2304   da_cuGraphExecDestroy cuGraphExecDestroy;
2305   da_cuGraphDestroy cuGraphDestroy;
2306   da_cuOccupancyMaxActiveBlocksPerMultiprocessor cuOccupancyMaxActiveBlocksPerMultiprocessor;
2307   da_cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags;
2308   da_cuOccupancyMaxPotentialBlockSize cuOccupancyMaxPotentialBlockSize;
2309   da_cuOccupancyMaxPotentialBlockSizeWithFlags cuOccupancyMaxPotentialBlockSizeWithFlags;
2310   da_cuTexRefSetArray cuTexRefSetArray;
2311   da_cuTexRefSetMipmappedArray cuTexRefSetMipmappedArray;
2312   da_cuTexRefSetAddress cuTexRefSetAddress;
2313   da_cuTexRefSetAddress2D cuTexRefSetAddress2D;
2314   da_cuTexRefSetFormat cuTexRefSetFormat;
2315   da_cuTexRefSetAddressMode cuTexRefSetAddressMode;
2316   da_cuTexRefSetFilterMode cuTexRefSetFilterMode;
2317   da_cuTexRefSetMipmapFilterMode cuTexRefSetMipmapFilterMode;
2318   da_cuTexRefSetMipmapLevelBias cuTexRefSetMipmapLevelBias;
2319   da_cuTexRefSetMipmapLevelClamp cuTexRefSetMipmapLevelClamp;
2320   da_cuTexRefSetMaxAnisotropy cuTexRefSetMaxAnisotropy;
2321   da_cuTexRefSetBorderColor cuTexRefSetBorderColor;
2322   da_cuTexRefSetFlags cuTexRefSetFlags;
2323   da_cuTexRefGetAddress cuTexRefGetAddress;
2324   da_cuTexRefGetArray cuTexRefGetArray;
2325   da_cuTexRefGetMipmappedArray cuTexRefGetMipmappedArray;
2326   da_cuTexRefGetAddressMode cuTexRefGetAddressMode;
2327   da_cuTexRefGetFilterMode cuTexRefGetFilterMode;
2328   da_cuTexRefGetFormat cuTexRefGetFormat;
2329   da_cuTexRefGetMipmapFilterMode cuTexRefGetMipmapFilterMode;
2330   da_cuTexRefGetMipmapLevelBias cuTexRefGetMipmapLevelBias;
2331   da_cuTexRefGetMipmapLevelClamp cuTexRefGetMipmapLevelClamp;
2332   da_cuTexRefGetMaxAnisotropy cuTexRefGetMaxAnisotropy;
2333   da_cuTexRefGetBorderColor cuTexRefGetBorderColor;
2334   da_cuTexRefGetFlags cuTexRefGetFlags;
2335   da_cuTexRefCreate cuTexRefCreate;
2336   da_cuTexRefDestroy cuTexRefDestroy;
2337   da_cuSurfRefSetArray cuSurfRefSetArray;
2338   da_cuSurfRefGetArray cuSurfRefGetArray;
2339   da_cuTexObjectCreate cuTexObjectCreate;
2340   da_cuTexObjectDestroy cuTexObjectDestroy;
2341   da_cuTexObjectGetResourceDesc cuTexObjectGetResourceDesc;
2342   da_cuTexObjectGetTextureDesc cuTexObjectGetTextureDesc;
2343   da_cuTexObjectGetResourceViewDesc cuTexObjectGetResourceViewDesc;
2344   da_cuSurfObjectCreate cuSurfObjectCreate;
2345   da_cuSurfObjectDestroy cuSurfObjectDestroy;
2346   da_cuSurfObjectGetResourceDesc cuSurfObjectGetResourceDesc;
2347   da_cuDeviceCanAccessPeer cuDeviceCanAccessPeer;
2348   da_cuCtxEnablePeerAccess cuCtxEnablePeerAccess;
2349   da_cuCtxDisablePeerAccess cuCtxDisablePeerAccess;
2350   da_cuDeviceGetP2PAttribute cuDeviceGetP2PAttribute;
2351   da_cuGraphicsUnregisterResource cuGraphicsUnregisterResource;
2352   da_cuGraphicsSubResourceGetMappedArray cuGraphicsSubResourceGetMappedArray;
2353   da_cuGraphicsResourceGetMappedMipmappedArray cuGraphicsResourceGetMappedMipmappedArray;
2354   da_cuGraphicsResourceGetMappedPointer cuGraphicsResourceGetMappedPointer;
2355   da_cuGraphicsResourceSetMapFlags cuGraphicsResourceSetMapFlags;
2356   da_cuGraphicsMapResources cuGraphicsMapResources;
2357   da_cuGraphicsUnmapResources cuGraphicsUnmapResources;
2358   da_cuGetExportTable cuGetExportTable;
2359   da_cuTexRefSetAddress2D_v2 cuTexRefSetAddress2D_v2;
2360 
2361 }
2362 
2363 
2364 // Driver API loader
2365 class DerelictCUDADriverLoader : SharedLibLoader
2366 {
2367   protected
2368   {
2369     override void loadSymbols()
2370     {
2371       // Note: new versions of API are to be loaded (_v2 or _v3 suffices)
2372       // DerelictCUDA only represents the newest API and load the latest version of functions
2373       // Previous versions of APIs, if necessary, can be done with previous versions of DerelictCUDA.
2374       bindFunc(cast(void**)&cuGetErrorString, "cuGetErrorString");
2375       bindFunc(cast(void**)&cuGetErrorName, "cuGetErrorName");
2376       bindFunc(cast(void**)&cuInit, "cuInit");
2377       bindFunc(cast(void**)&cuDriverGetVersion, "cuDriverGetVersion");
2378       bindFunc(cast(void**)&cuDeviceGet, "cuDeviceGet");
2379       bindFunc(cast(void**)&cuDeviceGetCount, "cuDeviceGetCount");
2380       bindFunc(cast(void**)&cuDeviceGetName, "cuDeviceGetName");
2381       bindFunc(cast(void**)&cuDeviceGetUuid, "cuDeviceGetUuid");
2382       //bindFunc(cast(void**)&cuDeviceGetLuid, "cuDeviceGetLuid");
2383       bindFunc(cast(void**)&cuDeviceTotalMem, "cuDeviceTotalMem");
2384       bindFunc(cast(void**)&cuDeviceGetAttribute, "cuDeviceGetAttribute");
2385       bindFunc(cast(void**)&cuDeviceGetProperties, "cuDeviceGetProperties");
2386       bindFunc(cast(void**)&cuDeviceComputeCapability, "cuDeviceComputeCapability");
2387       bindFunc(cast(void**)&cuDevicePrimaryCtxRetain, "cuDevicePrimaryCtxRetain");
2388       bindFunc(cast(void**)&cuDevicePrimaryCtxRelease, "cuDevicePrimaryCtxRelease");
2389       bindFunc(cast(void**)&cuDevicePrimaryCtxSetFlags, "cuDevicePrimaryCtxSetFlags");
2390       bindFunc(cast(void**)&cuDevicePrimaryCtxGetState, "cuDevicePrimaryCtxGetState");
2391       bindFunc(cast(void**)&cuDevicePrimaryCtxReset, "cuDevicePrimaryCtxReset");
2392       bindFunc(cast(void**)&cuCtxCreate, "cuCtxCreate");
2393       bindFunc(cast(void**)&cuCtxDestroy, "cuCtxDestroy");
2394       bindFunc(cast(void**)&cuCtxPushCurrent, "cuCtxPushCurrent");
2395       bindFunc(cast(void**)&cuCtxPopCurrent, "cuCtxPopCurrent");
2396       bindFunc(cast(void**)&cuCtxSetCurrent, "cuCtxSetCurrent");
2397       bindFunc(cast(void**)&cuCtxGetCurrent, "cuCtxGetCurrent");
2398       bindFunc(cast(void**)&cuCtxGetDevice, "cuCtxGetDevice");
2399       bindFunc(cast(void**)&cuCtxGetFlags, "cuCtxGetFlags");
2400       bindFunc(cast(void**)&cuCtxSynchronize, "cuCtxSynchronize");
2401       bindFunc(cast(void**)&cuCtxSetLimit, "cuCtxSetLimit");
2402       bindFunc(cast(void**)&cuCtxGetLimit, "cuCtxGetLimit");
2403       bindFunc(cast(void**)&cuCtxGetCacheConfig, "cuCtxGetCacheConfig");
2404       bindFunc(cast(void**)&cuCtxSetCacheConfig, "cuCtxSetCacheConfig");
2405       bindFunc(cast(void**)&cuCtxGetSharedMemConfig, "cuCtxGetSharedMemConfig");
2406       bindFunc(cast(void**)&cuCtxSetSharedMemConfig, "cuCtxSetSharedMemConfig");
2407       bindFunc(cast(void**)&cuCtxGetApiVersion, "cuCtxGetApiVersion");
2408       bindFunc(cast(void**)&cuCtxGetStreamPriorityRange, "cuCtxGetStreamPriorityRange");
2409       bindFunc(cast(void**)&cuCtxAttach, "cuCtxAttach");
2410       bindFunc(cast(void**)&cuCtxDetach, "cuCtxDetach");
2411       bindFunc(cast(void**)&cuModuleLoad, "cuModuleLoad");
2412       bindFunc(cast(void**)&cuModuleLoadData, "cuModuleLoadData");
2413       bindFunc(cast(void**)&cuModuleLoadDataEx, "cuModuleLoadDataEx");
2414       bindFunc(cast(void**)&cuModuleLoadFatBinary, "cuModuleLoadFatBinary");
2415       bindFunc(cast(void**)&cuModuleUnload, "cuModuleUnload");
2416       bindFunc(cast(void**)&cuModuleGetFunction, "cuModuleGetFunction");
2417       bindFunc(cast(void**)&cuModuleGetGlobal, "cuModuleGetGlobal");
2418       bindFunc(cast(void**)&cuModuleGetTexRef, "cuModuleGetTexRef");
2419       bindFunc(cast(void**)&cuModuleGetSurfRef, "cuModuleGetSurfRef");
2420       bindFunc(cast(void**)&cuLinkCreate, "cuLinkCreate");
2421       bindFunc(cast(void**)&cuLinkAddData, "cuLinkAddData");
2422       bindFunc(cast(void**)&cuLinkAddFile, "cuLinkAddFile");
2423       bindFunc(cast(void**)&cuLinkComplete, "cuLinkComplete");
2424       bindFunc(cast(void**)&cuLinkDestroy, "cuLinkDestroy");
2425       bindFunc(cast(void**)&cuMemGetInfo, "cuMemGetInfo");
2426       bindFunc(cast(void**)&cuMemAlloc, "cuMemAlloc");
2427       bindFunc(cast(void**)&cuMemAllocPitch, "cuMemAllocPitch");
2428       bindFunc(cast(void**)&cuMemFree, "cuMemFree");
2429       bindFunc(cast(void**)&cuMemGetAddressRange, "cuMemGetAddressRange");
2430       bindFunc(cast(void**)&cuMemAllocHost, "cuMemAllocHost");
2431       bindFunc(cast(void**)&cuMemFreeHost, "cuMemFreeHost");
2432       bindFunc(cast(void**)&cuMemHostAlloc, "cuMemHostAlloc");
2433       bindFunc(cast(void**)&cuMemHostGetDevicePointer, "cuMemHostGetDevicePointer");
2434       bindFunc(cast(void**)&cuMemHostGetFlags, "cuMemHostGetFlags");
2435       bindFunc(cast(void**)&cuMemAllocManaged, "cuMemAllocManaged");
2436       bindFunc(cast(void**)&cuDeviceGetByPCIBusId, "cuDeviceGetByPCIBusId");
2437       bindFunc(cast(void**)&cuDeviceGetPCIBusId, "cuDeviceGetPCIBusId");
2438       bindFunc(cast(void**)&cuIpcGetEventHandle, "cuIpcGetEventHandle");
2439       bindFunc(cast(void**)&cuIpcOpenEventHandle, "cuIpcOpenEventHandle");
2440       bindFunc(cast(void**)&cuIpcGetMemHandle, "cuIpcGetMemHandle");
2441       bindFunc(cast(void**)&cuIpcOpenMemHandle, "cuIpcOpenMemHandle");
2442       bindFunc(cast(void**)&cuIpcCloseMemHandle, "cuIpcCloseMemHandle");
2443       bindFunc(cast(void**)&cuMemHostRegister, "cuMemHostRegister");
2444       bindFunc(cast(void**)&cuMemHostUnregister, "cuMemHostUnregister");
2445       bindFunc(cast(void**)&cuMemcpy, "cuMemcpy");
2446       bindFunc(cast(void**)&cuMemcpyPeer, "cuMemcpyPeer");
2447       bindFunc(cast(void**)&cuMemcpyHtoD, "cuMemcpyHtoD");
2448       bindFunc(cast(void**)&cuMemcpyDtoH, "cuMemcpyDtoH");
2449       bindFunc(cast(void**)&cuMemcpyDtoD, "cuMemcpyDtoD");
2450       bindFunc(cast(void**)&cuMemcpyDtoA, "cuMemcpyDtoA");
2451       bindFunc(cast(void**)&cuMemcpyAtoD, "cuMemcpyAtoD");
2452       bindFunc(cast(void**)&cuMemcpyHtoA, "cuMemcpyHtoA");
2453       bindFunc(cast(void**)&cuMemcpyAtoH, "cuMemcpyAtoH");
2454       bindFunc(cast(void**)&cuMemcpyAtoA, "cuMemcpyAtoA");
2455       bindFunc(cast(void**)&cuMemcpy2D, "cuMemcpy2D");
2456       bindFunc(cast(void**)&cuMemcpy2DUnaligned, "cuMemcpy2DUnaligned");
2457       bindFunc(cast(void**)&cuMemcpy3D, "cuMemcpy3D");
2458       bindFunc(cast(void**)&cuMemcpy3DPeer, "cuMemcpy3DPeer");
2459       bindFunc(cast(void**)&cuMemcpyAsync, "cuMemcpyAsync");
2460       bindFunc(cast(void**)&cuMemcpyPeerAsync, "cuMemcpyPeerAsync");
2461       bindFunc(cast(void**)&cuMemcpyHtoDAsync, "cuMemcpyHtoDAsync");
2462       bindFunc(cast(void**)&cuMemcpyDtoHAsync, "cuMemcpyDtoHAsync");
2463       bindFunc(cast(void**)&cuMemcpyDtoDAsync, "cuMemcpyDtoDAsync");
2464       bindFunc(cast(void**)&cuMemcpyHtoAAsync, "cuMemcpyHtoAAsync");
2465       bindFunc(cast(void**)&cuMemcpyAtoHAsync, "cuMemcpyAtoHAsync");
2466       bindFunc(cast(void**)&cuMemcpy2DAsync, "cuMemcpy2DAsync");
2467       bindFunc(cast(void**)&cuMemcpy3DAsync, "cuMemcpy3DAsync");
2468       bindFunc(cast(void**)&cuMemcpy3DPeerAsync, "cuMemcpy3DPeerAsync");
2469       bindFunc(cast(void**)&cuMemsetD8, "cuMemsetD8");
2470       bindFunc(cast(void**)&cuMemsetD16, "cuMemsetD16");
2471       bindFunc(cast(void**)&cuMemsetD32, "cuMemsetD32");
2472       bindFunc(cast(void**)&cuMemsetD2D8, "cuMemsetD2D8");
2473       bindFunc(cast(void**)&cuMemsetD2D16, "cuMemsetD2D16");
2474       bindFunc(cast(void**)&cuMemsetD2D32, "cuMemsetD2D32");
2475       bindFunc(cast(void**)&cuMemsetD8Async, "cuMemsetD8Async");
2476       bindFunc(cast(void**)&cuMemsetD16Async, "cuMemsetD16Async");
2477       bindFunc(cast(void**)&cuMemsetD32Async, "cuMemsetD32Async");
2478       bindFunc(cast(void**)&cuMemsetD2D8Async, "cuMemsetD2D8Async");
2479       bindFunc(cast(void**)&cuMemsetD2D16Async, "cuMemsetD2D16Async");
2480       bindFunc(cast(void**)&cuMemsetD2D32Async, "cuMemsetD2D32Async");
2481       bindFunc(cast(void**)&cuArrayCreate, "cuArrayCreate");
2482       bindFunc(cast(void**)&cuArrayGetDescriptor, "cuArrayGetDescriptor");
2483       bindFunc(cast(void**)&cuArrayDestroy, "cuArrayDestroy");
2484       bindFunc(cast(void**)&cuArray3DCreate, "cuArray3DCreate");
2485       bindFunc(cast(void**)&cuArray3DGetDescriptor, "cuArray3DGetDescriptor");
2486       bindFunc(cast(void**)&cuMipmappedArrayCreate, "cuMipmappedArrayCreate");
2487       bindFunc(cast(void**)&cuMipmappedArrayGetLevel, "cuMipmappedArrayGetLevel");
2488       bindFunc(cast(void**)&cuMipmappedArrayDestroy, "cuMipmappedArrayDestroy");
2489       bindFunc(cast(void**)&cuPointerGetAttribute, "cuPointerGetAttribute");
2490       bindFunc(cast(void**)&cuMemPrefetchAsync, "cuMemPrefetchAsync");
2491       bindFunc(cast(void**)&cuMemAdvise, "cuMemAdvise");
2492       bindFunc(cast(void**)&cuMemRangeGetAttribute, "cuMemRangeGetAttribute");
2493       bindFunc(cast(void**)&cuMemRangeGetAttributes, "cuMemRangeGetAttributes");
2494       bindFunc(cast(void**)&cuPointerSetAttribute, "cuPointerSetAttribute");
2495       bindFunc(cast(void**)&cuPointerGetAttributes, "cuPointerGetAttributes");
2496       bindFunc(cast(void**)&cuStreamCreate, "cuStreamCreate");
2497       bindFunc(cast(void**)&cuStreamCreateWithPriority, "cuStreamCreateWithPriority");
2498       bindFunc(cast(void**)&cuStreamGetPriority, "cuStreamGetPriority");
2499       bindFunc(cast(void**)&cuStreamGetFlags, "cuStreamGetFlags");
2500       bindFunc(cast(void**)&cuStreamGetCtx, "cuStreamGetCtx");
2501       bindFunc(cast(void**)&cuStreamWaitEvent, "cuStreamWaitEvent");
2502       bindFunc(cast(void**)&cuStreamAddCallback, "cuStreamAddCallback");
2503       bindFunc(cast(void**)&cuStreamBeginCapture, "cuStreamBeginCapture");
2504       bindFunc(cast(void**)&cuStreamEndCapture, "cuStreamEndCapture");
2505       bindFunc(cast(void**)&cuStreamIsCapturing, "cuStreamIsCapturing");
2506       bindFunc(cast(void**)&cuStreamAttachMemAsync, "cuStreamAttachMemAsync");
2507       bindFunc(cast(void**)&cuStreamQuery, "cuStreamQuery");
2508       bindFunc(cast(void**)&cuStreamSynchronize, "cuStreamSynchronize");
2509       bindFunc(cast(void**)&cuStreamDestroy, "cuStreamDestroy");
2510       bindFunc(cast(void**)&cuEventCreate, "cuEventCreate");
2511       bindFunc(cast(void**)&cuEventRecord, "cuEventRecord");
2512       bindFunc(cast(void**)&cuEventQuery, "cuEventQuery");
2513       bindFunc(cast(void**)&cuEventSynchronize, "cuEventSynchronize");
2514       bindFunc(cast(void**)&cuEventDestroy, "cuEventDestroy");
2515       bindFunc(cast(void**)&cuEventElapsedTime, "cuEventElapsedTime");
2516       bindFunc(cast(void**)&cuImportExternalMemory, "cuImportExternalMemory");
2517       bindFunc(cast(void**)&cuExternalMemoryGetMappedBuffer, "cuExternalMemoryGetMappedBuffer");
2518       bindFunc(cast(void**)&cuExternalMemoryGetMappedMipmappedArray, "cuExternalMemoryGetMappedMipmappedArray");
2519       bindFunc(cast(void**)&cuDestroyExternalMemory, "cuDestroyExternalMemory");
2520       bindFunc(cast(void**)&cuImportExternalSemaphore, "cuImportExternalSemaphore");
2521       bindFunc(cast(void**)&cuSignalExternalSemaphoresAsync, "cuSignalExternalSemaphoresAsync");
2522       bindFunc(cast(void**)&cuWaitExternalSemaphoresAsync, "cuWaitExternalSemaphoresAsync");
2523       bindFunc(cast(void**)&cuDestroyExternalSemaphore, "cuDestroyExternalSemaphore");
2524       bindFunc(cast(void**)&cuStreamWaitValue32, "cuStreamWaitValue32");
2525       bindFunc(cast(void**)&cuStreamWaitValue64, "cuStreamWaitValue64");
2526       bindFunc(cast(void**)&cuStreamWriteValue32, "cuStreamWriteValue32");
2527       bindFunc(cast(void**)&cuStreamWriteValue64, "cuStreamWriteValue64");
2528       bindFunc(cast(void**)&cuStreamBatchMemOp, "cuStreamBatchMemOp");
2529       bindFunc(cast(void**)&cuFuncGetAttribute, "cuFuncGetAttribute");
2530       bindFunc(cast(void**)&cuFuncSetAttribute, "cuFuncSetAttribute");
2531       bindFunc(cast(void**)&cuFuncSetCacheConfig, "cuFuncSetCacheConfig");
2532       bindFunc(cast(void**)&cuFuncSetSharedMemConfig, "cuFuncSetSharedMemConfig");
2533       bindFunc(cast(void**)&cuLaunchKernel, "cuLaunchKernel");
2534       bindFunc(cast(void**)&cuLaunchCooperativeKernel, "cuLaunchCooperativeKernel");
2535       bindFunc(cast(void**)&cuLaunchCooperativeKernelMultiDevice, "cuLaunchCooperativeKernelMultiDevice");
2536       bindFunc(cast(void**)&cuLaunchHostFunc, "cuLaunchHostFunc");
2537       bindFunc(cast(void**)&cuFuncSetBlockShape, "cuFuncSetBlockShape");
2538       bindFunc(cast(void**)&cuFuncSetSharedSize, "cuFuncSetSharedSize");
2539       bindFunc(cast(void**)&cuParamSetSize, "cuParamSetSize");
2540       bindFunc(cast(void**)&cuParamSeti, "cuParamSeti");
2541       bindFunc(cast(void**)&cuParamSetf, "cuParamSetf");
2542       bindFunc(cast(void**)&cuParamSetv, "cuParamSetv");
2543       bindFunc(cast(void**)&cuLaunch, "cuLaunch");
2544       bindFunc(cast(void**)&cuLaunchGrid, "cuLaunchGrid");
2545       bindFunc(cast(void**)&cuLaunchGridAsync, "cuLaunchGridAsync");
2546       bindFunc(cast(void**)&cuParamSetTexRef, "cuParamSetTexRef");
2547       bindFunc(cast(void**)&cuGraphCreate, "cuGraphCreate");
2548       bindFunc(cast(void**)&cuGraphAddKernelNode, "cuGraphAddKernelNode");
2549       bindFunc(cast(void**)&cuGraphKernelNodeGetParams, "cuGraphKernelNodeGetParams");
2550       bindFunc(cast(void**)&cuGraphKernelNodeSetParams, "cuGraphKernelNodeSetParams");
2551       bindFunc(cast(void**)&cuGraphAddMemcpyNode, "cuGraphAddMemcpyNode");
2552       bindFunc(cast(void**)&cuGraphMemcpyNodeGetParams, "cuGraphMemcpyNodeGetParams");
2553       bindFunc(cast(void**)&cuGraphMemcpyNodeSetParams, "cuGraphMemcpyNodeSetParams");
2554       bindFunc(cast(void**)&cuGraphAddMemsetNode, "cuGraphAddMemsetNode");
2555       bindFunc(cast(void**)&cuGraphMemsetNodeGetParams, "cuGraphMemsetNodeGetParams");
2556       bindFunc(cast(void**)&cuGraphMemsetNodeSetParams, "cuGraphMemsetNodeSetParams");
2557       bindFunc(cast(void**)&cuGraphAddHostNode, "cuGraphAddHostNode");
2558       bindFunc(cast(void**)&cuGraphHostNodeGetParams, "cuGraphHostNodeGetParams");
2559       bindFunc(cast(void**)&cuGraphHostNodeSetParams, "cuGraphHostNodeSetParams");
2560       bindFunc(cast(void**)&cuGraphAddChildGraphNode, "cuGraphAddChildGraphNode");
2561       bindFunc(cast(void**)&cuGraphChildGraphNodeGetGraph, "cuGraphChildGraphNodeGetGraph");
2562       bindFunc(cast(void**)&cuGraphAddEmptyNode, "cuGraphAddEmptyNode");
2563       bindFunc(cast(void**)&cuGraphClone, "cuGraphClone");
2564       bindFunc(cast(void**)&cuGraphNodeFindInClone, "cuGraphNodeFindInClone");
2565       bindFunc(cast(void**)&cuGraphNodeGetType, "cuGraphNodeGetType");
2566       bindFunc(cast(void**)&cuGraphGetNodes, "cuGraphGetNodes");
2567       bindFunc(cast(void**)&cuGraphGetRootNodes, "cuGraphGetRootNodes");
2568       bindFunc(cast(void**)&cuGraphGetEdges, "cuGraphGetEdges");
2569       bindFunc(cast(void**)&cuGraphNodeGetDependencies, "cuGraphNodeGetDependencies");
2570       bindFunc(cast(void**)&cuGraphNodeGetDependentNodes, "cuGraphNodeGetDependentNodes");
2571       bindFunc(cast(void**)&cuGraphAddDependencies, "cuGraphAddDependencies");
2572       bindFunc(cast(void**)&cuGraphRemoveDependencies, "cuGraphRemoveDependencies");
2573       bindFunc(cast(void**)&cuGraphDestroyNode, "cuGraphDestroyNode");
2574       bindFunc(cast(void**)&cuGraphInstantiate, "cuGraphInstantiate");
2575       bindFunc(cast(void**)&cuGraphLaunch, "cuGraphLaunch");
2576       bindFunc(cast(void**)&cuGraphExecDestroy, "cuGraphExecDestroy");
2577       bindFunc(cast(void**)&cuGraphDestroy, "cuGraphDestroy");
2578       bindFunc(cast(void**)&cuOccupancyMaxActiveBlocksPerMultiprocessor, "cuOccupancyMaxActiveBlocksPerMultiprocessor");
2579       bindFunc(cast(void**)&cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags, "cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags");
2580       bindFunc(cast(void**)&cuOccupancyMaxPotentialBlockSize, "cuOccupancyMaxPotentialBlockSize");
2581       bindFunc(cast(void**)&cuOccupancyMaxPotentialBlockSizeWithFlags, "cuOccupancyMaxPotentialBlockSizeWithFlags");
2582       bindFunc(cast(void**)&cuTexRefSetArray, "cuTexRefSetArray");
2583       bindFunc(cast(void**)&cuTexRefSetMipmappedArray, "cuTexRefSetMipmappedArray");
2584       bindFunc(cast(void**)&cuTexRefSetAddress, "cuTexRefSetAddress");
2585       bindFunc(cast(void**)&cuTexRefSetAddress2D, "cuTexRefSetAddress2D");
2586       bindFunc(cast(void**)&cuTexRefSetFormat, "cuTexRefSetFormat");
2587       bindFunc(cast(void**)&cuTexRefSetAddressMode, "cuTexRefSetAddressMode");
2588       bindFunc(cast(void**)&cuTexRefSetFilterMode, "cuTexRefSetFilterMode");
2589       bindFunc(cast(void**)&cuTexRefSetMipmapFilterMode, "cuTexRefSetMipmapFilterMode");
2590       bindFunc(cast(void**)&cuTexRefSetMipmapLevelBias, "cuTexRefSetMipmapLevelBias");
2591       bindFunc(cast(void**)&cuTexRefSetMipmapLevelClamp, "cuTexRefSetMipmapLevelClamp");
2592       bindFunc(cast(void**)&cuTexRefSetMaxAnisotropy, "cuTexRefSetMaxAnisotropy");
2593       bindFunc(cast(void**)&cuTexRefSetBorderColor, "cuTexRefSetBorderColor");
2594       bindFunc(cast(void**)&cuTexRefSetFlags, "cuTexRefSetFlags");
2595       bindFunc(cast(void**)&cuTexRefGetAddress, "cuTexRefGetAddress");
2596       bindFunc(cast(void**)&cuTexRefGetArray, "cuTexRefGetArray");
2597       bindFunc(cast(void**)&cuTexRefGetMipmappedArray, "cuTexRefGetMipmappedArray");
2598       bindFunc(cast(void**)&cuTexRefGetAddressMode, "cuTexRefGetAddressMode");
2599       bindFunc(cast(void**)&cuTexRefGetFilterMode, "cuTexRefGetFilterMode");
2600       bindFunc(cast(void**)&cuTexRefGetFormat, "cuTexRefGetFormat");
2601       bindFunc(cast(void**)&cuTexRefGetMipmapFilterMode, "cuTexRefGetMipmapFilterMode");
2602       bindFunc(cast(void**)&cuTexRefGetMipmapLevelBias, "cuTexRefGetMipmapLevelBias");
2603       bindFunc(cast(void**)&cuTexRefGetMipmapLevelClamp, "cuTexRefGetMipmapLevelClamp");
2604       bindFunc(cast(void**)&cuTexRefGetMaxAnisotropy, "cuTexRefGetMaxAnisotropy");
2605       bindFunc(cast(void**)&cuTexRefGetBorderColor, "cuTexRefGetBorderColor");
2606       bindFunc(cast(void**)&cuTexRefGetFlags, "cuTexRefGetFlags");
2607       bindFunc(cast(void**)&cuTexRefCreate, "cuTexRefCreate");
2608       bindFunc(cast(void**)&cuTexRefDestroy, "cuTexRefDestroy");
2609       bindFunc(cast(void**)&cuSurfRefSetArray, "cuSurfRefSetArray");
2610       bindFunc(cast(void**)&cuSurfRefGetArray, "cuSurfRefGetArray");
2611       bindFunc(cast(void**)&cuTexObjectCreate, "cuTexObjectCreate");
2612       bindFunc(cast(void**)&cuTexObjectDestroy, "cuTexObjectDestroy");
2613       bindFunc(cast(void**)&cuTexObjectGetResourceDesc, "cuTexObjectGetResourceDesc");
2614       bindFunc(cast(void**)&cuTexObjectGetTextureDesc, "cuTexObjectGetTextureDesc");
2615       bindFunc(cast(void**)&cuTexObjectGetResourceViewDesc, "cuTexObjectGetResourceViewDesc");
2616       bindFunc(cast(void**)&cuSurfObjectCreate, "cuSurfObjectCreate");
2617       bindFunc(cast(void**)&cuSurfObjectDestroy, "cuSurfObjectDestroy");
2618       bindFunc(cast(void**)&cuSurfObjectGetResourceDesc, "cuSurfObjectGetResourceDesc");
2619       bindFunc(cast(void**)&cuDeviceCanAccessPeer, "cuDeviceCanAccessPeer");
2620       bindFunc(cast(void**)&cuCtxEnablePeerAccess, "cuCtxEnablePeerAccess");
2621       bindFunc(cast(void**)&cuCtxDisablePeerAccess, "cuCtxDisablePeerAccess");
2622       bindFunc(cast(void**)&cuDeviceGetP2PAttribute, "cuDeviceGetP2PAttribute");
2623       bindFunc(cast(void**)&cuGraphicsUnregisterResource, "cuGraphicsUnregisterResource");
2624       bindFunc(cast(void**)&cuGraphicsSubResourceGetMappedArray, "cuGraphicsSubResourceGetMappedArray");
2625       bindFunc(cast(void**)&cuGraphicsResourceGetMappedMipmappedArray, "cuGraphicsResourceGetMappedMipmappedArray");
2626       bindFunc(cast(void**)&cuGraphicsResourceGetMappedPointer, "cuGraphicsResourceGetMappedPointer");
2627       bindFunc(cast(void**)&cuGraphicsResourceSetMapFlags, "cuGraphicsResourceSetMapFlags");
2628       bindFunc(cast(void**)&cuGraphicsMapResources, "cuGraphicsMapResources");
2629       bindFunc(cast(void**)&cuGraphicsUnmapResources, "cuGraphicsUnmapResources");
2630       bindFunc(cast(void**)&cuGetExportTable, "cuGetExportTable");
2631       bindFunc(cast(void**)&cuTexRefSetAddress2D_v2, "cuTexRefSetAddress2D_v2");
2632     }
2633   }
2634 
2635   public
2636   {
2637     this()
2638     {
2639       super(libNames);
2640     }
2641   }
2642 }
2643 
2644 
2645 __gshared DerelictCUDADriverLoader DerelictCUDADriver;
2646 
2647 shared static this()
2648 {
2649   DerelictCUDADriver = new DerelictCUDADriverLoader();
2650 }