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 6.5 31 enum CUDA_VERSION = 6050; 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 CUdeviceptr = size_t; 51 52 alias CUdevice = int; 53 alias CUcontext = void*; 54 alias CUmodule = void*; 55 alias CUfunction = void*; 56 alias CUarray = void*; 57 alias CUmipmappedArray = void*; 58 alias CUtexref = void*; 59 alias CUsurfref = void*; 60 alias CUevent = void*; 61 alias CUstream = void*; 62 alias CUgraphicsResource = void*; 63 alias CUtexObject = ulong; 64 alias CUsurfObject = ulong; 65 66 struct CUuuid 67 { 68 char[16] bytes; 69 } 70 71 enum CU_IPC_HANDLE_SIZE = 64; 72 73 struct CUipcEventHandle 74 { 75 char[CU_IPC_HANDLE_SIZE] reserved; 76 } 77 78 struct CUipcMemHandle 79 { 80 char[CU_IPC_HANDLE_SIZE] reserved; 81 } 82 83 alias CUipcMem_flags = int; 84 enum : CUipcMem_flags 85 { 86 CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS = 0x1 87 } 88 89 alias CUmemAttach_flags = int; 90 enum : CUmemAttach_flags 91 { 92 CU_MEM_ATTACH_GLOBAL = 0x1, 93 CU_MEM_ATTACH_HOST = 0x2, 94 CU_MEM_ATTACH_SINGLE = 0x4 95 } 96 97 alias CUctx_flags = int; 98 enum : CUctx_flags 99 { 100 CU_CTX_SCHED_AUTO = 0x00, 101 CU_CTX_SCHED_SPIN = 0x01, 102 CU_CTX_SCHED_YIELD = 0x02, 103 CU_CTX_SCHED_BLOCKING_SYNC = 0x04, 104 CU_CTX_BLOCKING_SYNC = 0x04, 105 CU_CTX_SCHED_MASK = 0x07, 106 CU_CTX_MAP_HOST = 0x08, 107 CU_CTX_LMEM_RESIZE_TO_MAX = 0x10, 108 CU_CTX_FLAGS_MASK = 0x1f 109 } 110 111 alias CUstream_flags = int; 112 enum : CUstream_flags 113 { 114 CU_STREAM_DEFAULT = 0x0, 115 CU_STREAM_NON_BLOCKING = 0x1 116 } 117 118 alias CUevent_flags = int; 119 enum : CUevent_flags 120 { 121 CU_EVENT_DEFAULT = 0x0, 122 CU_EVENT_BLOCKING_SYNC = 0x1, 123 CU_EVENT_DISABLE_TIMING = 0x2, 124 CU_EVENT_INTERPROCESS = 0x4 125 } 126 127 alias CUarray_format = int; 128 enum : CUarray_format 129 { 130 CU_AD_FORMAT_UNSIGNED_INT8 = 0x01, 131 CU_AD_FORMAT_UNSIGNED_INT16 = 0x02, 132 CU_AD_FORMAT_UNSIGNED_INT32 = 0x03, 133 CU_AD_FORMAT_SIGNED_INT8 = 0x08, 134 CU_AD_FORMAT_SIGNED_INT16 = 0x09, 135 CU_AD_FORMAT_SIGNED_INT32 = 0x0a, 136 CU_AD_FORMAT_HALF = 0x10, 137 CU_AD_FORMAT_FLOAT = 0x20 138 } 139 140 alias CUaddress_mode = int; 141 enum : CUaddress_mode 142 { 143 CU_TR_ADDRESS_MODE_WRAP = 0, 144 CU_TR_ADDRESS_MODE_CLAMP = 1, 145 CU_TR_ADDRESS_MODE_MIRROR = 2, 146 CU_TR_ADDRESS_MODE_BORDER = 3 147 } 148 149 alias CUfilter_mode = int; 150 enum : CUfilter_mode 151 { 152 CU_TR_FILTER_MODE_POINT = 0, 153 CU_TR_FILTER_MODE_LINEAR = 1 154 } 155 156 alias CUdevice_attribute = int; 157 enum : CUdevice_attribute 158 { 159 CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 1, 160 CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X = 2, 161 CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y = 3, 162 CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z = 4, 163 CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X = 5, 164 CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y = 6, 165 CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z = 7, 166 CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK = 8, 167 CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK = 8, 168 CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY = 9, 169 CU_DEVICE_ATTRIBUTE_WARP_SIZE = 10, 170 CU_DEVICE_ATTRIBUTE_MAX_PITCH = 11, 171 CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK = 12, 172 CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK = 12, 173 CU_DEVICE_ATTRIBUTE_CLOCK_RATE = 13, 174 CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT = 14, 175 CU_DEVICE_ATTRIBUTE_GPU_OVERLAP = 15, 176 CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT = 16, 177 CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT = 17, 178 CU_DEVICE_ATTRIBUTE_INTEGRATED = 18, 179 CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY = 19, 180 CU_DEVICE_ATTRIBUTE_COMPUTE_MODE = 20, 181 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH = 21, 182 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH = 22, 183 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT = 23, 184 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH = 24, 185 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT = 25, 186 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH = 26, 187 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH = 27, 188 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT = 28, 189 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS = 29, 190 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH = 27, 191 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT = 28, 192 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES = 29, 193 CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT = 30, 194 CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS = 31, 195 CU_DEVICE_ATTRIBUTE_ECC_ENABLED = 32, 196 CU_DEVICE_ATTRIBUTE_PCI_BUS_ID = 33, 197 CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID = 34, 198 CU_DEVICE_ATTRIBUTE_TCC_DRIVER = 35, 199 CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE = 36, 200 CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH = 37, 201 CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE = 38, 202 CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR = 39, 203 CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT = 40, 204 CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING = 41, 205 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH = 42, 206 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS = 43, 207 CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER = 44, 208 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH = 45, 209 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT = 46, 210 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE = 47, 211 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE = 48, 212 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE = 49, 213 CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID = 50, 214 CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT = 51, 215 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH = 52, 216 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH = 53, 217 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS = 54, 218 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH = 55, 219 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH = 56, 220 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT = 57, 221 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH = 58, 222 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT = 59, 223 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH = 60, 224 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH = 61, 225 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS = 62, 226 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH = 63, 227 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT = 64, 228 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS = 65, 229 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH = 66, 230 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH = 67, 231 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS = 68, 232 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH = 69, 233 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH = 70, 234 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT = 71, 235 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH = 72, 236 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH = 73, 237 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT = 74, 238 CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = 75, 239 CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR = 76, 240 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH = 77, 241 CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED = 78, 242 CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED = 79, 243 CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED = 80, 244 CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR = 81, 245 CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR = 82, 246 CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY = 83, 247 CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD = 84, 248 CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID = 85, 249 CU_DEVICE_ATTRIBUTE_MAX 250 } 251 252 struct CUdevprop 253 { 254 int maxThreadsPerBlock; 255 int[3] maxThreadsDim; 256 int[3] maxGridSize; 257 int sharedMemPerBlock; 258 int totalConstantMemory; 259 int SIMDWidth; 260 int memPitch; 261 int regsPerBlock; 262 int clockRate; 263 int textureAlign; 264 } 265 266 alias CUpointer_attribute = int; 267 enum : CUpointer_attribute 268 { 269 CU_POINTER_ATTRIBUTE_CONTEXT = 1, 270 CU_POINTER_ATTRIBUTE_MEMORY_TYPE = 2, 271 CU_POINTER_ATTRIBUTE_DEVICE_POINTER = 3, 272 CU_POINTER_ATTRIBUTE_HOST_POINTER = 4, 273 CU_POINTER_ATTRIBUTE_P2P_TOKENS = 5, 274 CU_POINTER_ATTRIBUTE_SYNC_MEMOPS = 6, 275 CU_POINTER_ATTRIBUTE_BUFFER_ID = 7, 276 CU_POINTER_ATTRIBUTE_IS_MANAGED = 8 277 } 278 279 alias CUfunction_attribute = int; 280 enum : CUfunction_attribute 281 { 282 CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 0, 283 CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES = 1, 284 CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES = 2, 285 CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES = 3, 286 CU_FUNC_ATTRIBUTE_NUM_REGS = 4, 287 CU_FUNC_ATTRIBUTE_PTX_VERSION = 5, 288 CU_FUNC_ATTRIBUTE_BINARY_VERSION = 6, 289 CU_FUNC_ATTRIBUTE_CACHE_MODE_CA = 7, 290 291 CU_FUNC_ATTRIBUTE_MAX 292 } 293 294 alias CUfunc_cache = int; 295 enum : CUfunc_cache 296 { 297 CU_FUNC_CACHE_PREFER_NONE = 0x00, 298 CU_FUNC_CACHE_PREFER_SHARED = 0x01, 299 CU_FUNC_CACHE_PREFER_L1 = 0x02, 300 CU_FUNC_CACHE_PREFER_EQUAL = 0x03 301 } 302 303 alias CUsharedconfig = int; 304 enum : CUsharedconfig 305 { 306 CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE = 0x00, 307 CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE = 0x01, 308 CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE = 0x02 309 } 310 311 alias CUmemorytype = int; 312 enum : CUmemorytype 313 { 314 CU_MEMORYTYPE_HOST = 0x01, 315 CU_MEMORYTYPE_DEVICE = 0x02, 316 CU_MEMORYTYPE_ARRAY = 0x03, 317 CU_MEMORYTYPE_UNIFIED = 0x04 318 } 319 320 321 alias CUcomputemode = int; 322 enum : CUcomputemode 323 { 324 CU_COMPUTEMODE_DEFAULT = 0, 325 CU_COMPUTEMODE_EXCLUSIVE = 1, 326 CU_COMPUTEMODE_PROHIBITED = 2, 327 CU_COMPUTEMODE_EXCLUSIVE_PROCESS = 3 328 } 329 330 331 alias CUjit_option = int; 332 enum : CUjit_option 333 { 334 CU_JIT_MAX_REGISTERS = 0, 335 CU_JIT_THREADS_PER_BLOCK, 336 CU_JIT_WALL_TIME, 337 CU_JIT_INFO_LOG_BUFFER, 338 CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES, 339 CU_JIT_ERROR_LOG_BUFFER, 340 CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES, 341 CU_JIT_OPTIMIZATION_LEVEL, 342 CU_JIT_TARGET_FROM_CUCONTEXT, 343 CU_JIT_TARGET, 344 CU_JIT_FALLBACK_STRATEGY, 345 CU_JIT_GENERATE_DEBUG_INFO, 346 CU_JIT_LOG_VERBOSE, 347 CU_JIT_GENERATE_LINE_INFO, 348 CU_JIT_CACHE_MODE, 349 CU_JIT_NUM_OPTIONS 350 } 351 352 alias CUjit_target = int; 353 enum : CUjit_target 354 { 355 CU_TARGET_COMPUTE_10 = 10, 356 CU_TARGET_COMPUTE_11 = 11, 357 CU_TARGET_COMPUTE_12 = 12, 358 CU_TARGET_COMPUTE_13 = 13, 359 CU_TARGET_COMPUTE_20 = 20, 360 CU_TARGET_COMPUTE_21 = 21, 361 CU_TARGET_COMPUTE_30 = 30, 362 CU_TARGET_COMPUTE_32 = 32, 363 CU_TARGET_COMPUTE_35 = 35, 364 CU_TARGET_COMPUTE_37 = 37, 365 CU_TARGET_COMPUTE_50 = 50 366 } 367 368 alias CUjit_fallback = int; 369 enum : CUjit_fallback 370 { 371 CU_PREFER_PTX = 0, 372 CU_PREFER_BINARY 373 } 374 375 376 alias CUjit_cacheMode = int; 377 enum : CUjit_cacheMode 378 { 379 CU_JIT_CACHE_OPTION_NONE = 0, 380 CU_JIT_CACHE_OPTION_CG, 381 CU_JIT_CACHE_OPTION_CA 382 } 383 384 alias CUjitInputType = int; 385 enum : CUjitInputType 386 { 387 CU_JIT_INPUT_CUBIN = 0, 388 CU_JIT_INPUT_PTX, 389 CU_JIT_INPUT_FATBINARY, 390 CU_JIT_INPUT_OBJECT, 391 CU_JIT_INPUT_LIBRARY, 392 CU_JIT_NUM_INPUT_TYPES 393 } 394 395 alias CUlinkState = void*; 396 397 alias CUgraphicsRegisterFlags = int; 398 enum : CUgraphicsRegisterFlags 399 { 400 CU_GRAPHICS_REGISTER_FLAGS_NONE = 0x00, 401 CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY = 0x01, 402 CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD = 0x02, 403 CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST = 0x04, 404 CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER = 0x08 405 } 406 407 alias CUgraphicsMapResourceFlags = int; 408 enum : CUgraphicsMapResourceFlags 409 { 410 CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE = 0x00, 411 CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY = 0x01, 412 CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 0x02 413 } 414 415 alias CUarray_cubemap_face = int; 416 enum : CUarray_cubemap_face 417 { 418 CU_CUBEMAP_FACE_POSITIVE_X = 0x00, 419 CU_CUBEMAP_FACE_NEGATIVE_X = 0x01, 420 CU_CUBEMAP_FACE_POSITIVE_Y = 0x02, 421 CU_CUBEMAP_FACE_NEGATIVE_Y = 0x03, 422 CU_CUBEMAP_FACE_POSITIVE_Z = 0x04, 423 CU_CUBEMAP_FACE_NEGATIVE_Z = 0x05 424 } 425 426 alias CUlimit = int; 427 enum : CUlimit 428 { 429 CU_LIMIT_STACK_SIZE = 0x00, 430 CU_LIMIT_PRINTF_FIFO_SIZE = 0x01, 431 CU_LIMIT_MALLOC_HEAP_SIZE = 0x02, 432 CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH = 0x03, 433 CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT = 0x04, 434 CU_LIMIT_MAX 435 } 436 437 alias CUresourcetype = int; 438 enum : CUresourcetype 439 { 440 CU_RESOURCE_TYPE_ARRAY = 0x00, 441 CU_RESOURCE_TYPE_MIPMAPPED_ARRAY = 0x01, 442 CU_RESOURCE_TYPE_LINEAR = 0x02, 443 CU_RESOURCE_TYPE_PITCH2D = 0x03 444 } 445 446 alias CUresult = int; 447 enum : CUresult 448 { 449 CUDA_SUCCESS = 0, 450 CUDA_ERROR_INVALID_VALUE = 1, 451 CUDA_ERROR_OUT_OF_MEMORY = 2, 452 CUDA_ERROR_NOT_INITIALIZED = 3, 453 CUDA_ERROR_DEINITIALIZED = 4, 454 CUDA_ERROR_PROFILER_DISABLED = 5, 455 CUDA_ERROR_PROFILER_NOT_INITIALIZED = 6, 456 CUDA_ERROR_PROFILER_ALREADY_STARTED = 7, 457 CUDA_ERROR_PROFILER_ALREADY_STOPPED = 8, 458 CUDA_ERROR_NO_DEVICE = 100, 459 CUDA_ERROR_INVALID_DEVICE = 101, 460 CUDA_ERROR_INVALID_IMAGE = 200, 461 CUDA_ERROR_INVALID_CONTEXT = 201, 462 CUDA_ERROR_CONTEXT_ALREADY_CURRENT = 202, 463 CUDA_ERROR_MAP_FAILED = 205, 464 CUDA_ERROR_UNMAP_FAILED = 206, 465 CUDA_ERROR_ARRAY_IS_MAPPED = 207, 466 CUDA_ERROR_ALREADY_MAPPED = 208, 467 CUDA_ERROR_NO_BINARY_FOR_GPU = 209, 468 CUDA_ERROR_ALREADY_ACQUIRED = 210, 469 CUDA_ERROR_NOT_MAPPED = 211, 470 CUDA_ERROR_NOT_MAPPED_AS_ARRAY = 212, 471 CUDA_ERROR_NOT_MAPPED_AS_POINTER = 213, 472 CUDA_ERROR_ECC_UNCORRECTABLE = 214, 473 CUDA_ERROR_UNSUPPORTED_LIMIT = 215, 474 CUDA_ERROR_CONTEXT_ALREADY_IN_USE = 216, 475 CUDA_ERROR_PEER_ACCESS_UNSUPPORTED = 217, 476 CUDA_ERROR_INVALID_PTX = 218, 477 CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = 219, 478 CUDA_ERROR_INVALID_SOURCE = 300, 479 CUDA_ERROR_FILE_NOT_FOUND = 301, 480 CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302, 481 CUDA_ERROR_SHARED_OBJECT_INIT_FAILED = 303, 482 CUDA_ERROR_OPERATING_SYSTEM = 304, 483 CUDA_ERROR_INVALID_HANDLE = 400, 484 CUDA_ERROR_NOT_FOUND = 500, 485 CUDA_ERROR_NOT_READY = 600, 486 CUDA_ERROR_ILLEGAL_ADDRESS = 700, 487 CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES = 701, 488 CUDA_ERROR_LAUNCH_TIMEOUT = 702, 489 CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING = 703, 490 CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED = 704, 491 CUDA_ERROR_PEER_ACCESS_NOT_ENABLED = 705, 492 CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE = 708, 493 CUDA_ERROR_CONTEXT_IS_DESTROYED = 709, 494 CUDA_ERROR_ASSERT = 710, 495 CUDA_ERROR_TOO_MANY_PEERS = 711, 496 CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED = 712, 497 CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED = 713, 498 CUDA_ERROR_HARDWARE_STACK_ERROR = 714, 499 CUDA_ERROR_ILLEGAL_INSTRUCTION = 715, 500 CUDA_ERROR_MISALIGNED_ADDRESS = 716, 501 CUDA_ERROR_INVALID_ADDRESS_SPACE = 717, 502 CUDA_ERROR_INVALID_PC = 718, 503 CUDA_ERROR_LAUNCH_FAILED = 719, 504 CUDA_ERROR_NOT_PERMITTED = 800, 505 CUDA_ERROR_NOT_SUPPORTED = 801, 506 CUDA_ERROR_UNKNOWN = 999 507 } 508 509 extern(System) nothrow 510 { 511 alias CUstreamCallback = void function(CUstream hStream, CUresult status, void *userData); 512 alias CUoccupancyB2DSize = size_t function(int blockSize); 513 } 514 515 enum CU_MEMHOSTALLOC_PORTABLE = 0x01; 516 enum CU_MEMHOSTALLOC_DEVICEMAP = 0x02; 517 enum CU_MEMHOSTALLOC_WRITECOMBINED = 0x04; 518 enum CU_MEMHOSTREGISTER_PORTABLE = 0x01; 519 enum CU_MEMHOSTREGISTER_DEVICEMAP = 0x02; 520 521 struct CUDA_MEMCPY2D 522 { 523 size_t srcXInBytes; 524 size_t srcY; 525 CUmemorytype srcMemoryType; 526 const void *srcHost; 527 CUdeviceptr srcDevice; 528 CUarray srcArray; 529 size_t srcPitch; 530 size_t dstXInBytes; 531 size_t dstY; 532 CUmemorytype dstMemoryType; 533 void *dstHost; 534 CUdeviceptr dstDevice; 535 CUarray dstArray; 536 size_t dstPitch; 537 size_t WidthInBytes; 538 size_t Height; 539 } 540 541 struct CUDA_MEMCPY3D 542 { 543 size_t srcXInBytes; 544 size_t srcY; 545 size_t srcZ; 546 size_t srcLOD; 547 CUmemorytype srcMemoryType; 548 const void *srcHost; 549 CUdeviceptr srcDevice; 550 CUarray srcArray; 551 void *reserved0; 552 size_t srcPitch; 553 size_t srcHeight; 554 size_t dstXInBytes; 555 size_t dstY; 556 size_t dstZ; 557 size_t dstLOD; 558 CUmemorytype dstMemoryType; 559 void *dstHost; 560 CUdeviceptr dstDevice; 561 CUarray dstArray; 562 void *reserved1; 563 size_t dstPitch; 564 size_t dstHeight; 565 size_t WidthInBytes; 566 size_t Height; 567 size_t Depth; 568 } 569 570 struct CUDA_MEMCPY3D_PEER 571 { 572 size_t srcXInBytes; 573 size_t srcY; 574 size_t srcZ; 575 size_t srcLOD; 576 CUmemorytype srcMemoryType; 577 const void *srcHost; 578 CUdeviceptr srcDevice; 579 CUarray srcArray; 580 CUcontext srcContext; 581 size_t srcPitch; 582 size_t srcHeight; 583 size_t dstXInBytes; 584 size_t dstY; 585 size_t dstZ; 586 size_t dstLOD; 587 CUmemorytype dstMemoryType; 588 void *dstHost; 589 CUdeviceptr dstDevice; 590 CUarray dstArray; 591 CUcontext dstContext; 592 size_t dstPitch; 593 size_t dstHeight; 594 size_t WidthInBytes; 595 size_t Height; 596 size_t Depth; 597 } 598 599 struct CUDA_ARRAY_DESCRIPTOR 600 { 601 size_t Width; 602 size_t Height; 603 CUarray_format Format; 604 uint NumChannels; 605 } 606 607 struct CUDA_ARRAY3D_DESCRIPTOR 608 { 609 size_t Width; 610 size_t Height; 611 size_t Depth; 612 613 CUarray_format Format; 614 uint NumChannels; 615 uint Flags; 616 } 617 618 struct CUDA_RESOURCE_DESC 619 { 620 CUresourcetype resType; 621 622 union res_st { 623 struct array_st 624 { 625 CUarray hArray; 626 } 627 array_st array; 628 629 struct mipmap_st 630 { 631 CUmipmappedArray hMipmappedArray; 632 } 633 mipmap_st mipmap; 634 635 struct linear_st 636 { 637 CUdeviceptr devPtr; 638 CUarray_format format; 639 uint numChannels; 640 size_t sizeInBytes; 641 } 642 linear_st linear; 643 644 struct pitch2D_st 645 { 646 CUdeviceptr devPtr; 647 CUarray_format format; 648 uint numChannels; 649 size_t width; 650 size_t height; 651 size_t pitchInBytes; 652 } 653 pitch2D_st pitch2D; 654 655 struct reserved_st 656 { 657 int[32] reserved; 658 } 659 reserved_st reserved; 660 } 661 662 res_st res; 663 uint flags; 664 } 665 666 struct CUDA_TEXTURE_DESC 667 { 668 CUaddress_mode[3] addressMode; 669 CUfilter_mode filterMode; 670 uint flags; 671 uint maxAnisotropy; 672 CUfilter_mode mipmapFilterMode; 673 float mipmapLevelBias; 674 float minMipmapLevelClamp; 675 float maxMipmapLevelClamp; 676 int[16] reserved; 677 } 678 679 alias CUresourceViewFormat = int; 680 enum : CUresourceViewFormat 681 { 682 CU_RES_VIEW_FORMAT_NONE = 0x00, 683 CU_RES_VIEW_FORMAT_UINT_1X8 = 0x01, 684 CU_RES_VIEW_FORMAT_UINT_2X8 = 0x02, 685 CU_RES_VIEW_FORMAT_UINT_4X8 = 0x03, 686 CU_RES_VIEW_FORMAT_SINT_1X8 = 0x04, 687 CU_RES_VIEW_FORMAT_SINT_2X8 = 0x05, 688 CU_RES_VIEW_FORMAT_SINT_4X8 = 0x06, 689 CU_RES_VIEW_FORMAT_UINT_1X16 = 0x07, 690 CU_RES_VIEW_FORMAT_UINT_2X16 = 0x08, 691 CU_RES_VIEW_FORMAT_UINT_4X16 = 0x09, 692 CU_RES_VIEW_FORMAT_SINT_1X16 = 0x0a, 693 CU_RES_VIEW_FORMAT_SINT_2X16 = 0x0b, 694 CU_RES_VIEW_FORMAT_SINT_4X16 = 0x0c, 695 CU_RES_VIEW_FORMAT_UINT_1X32 = 0x0d, 696 CU_RES_VIEW_FORMAT_UINT_2X32 = 0x0e, 697 CU_RES_VIEW_FORMAT_UINT_4X32 = 0x0f, 698 CU_RES_VIEW_FORMAT_SINT_1X32 = 0x10, 699 CU_RES_VIEW_FORMAT_SINT_2X32 = 0x11, 700 CU_RES_VIEW_FORMAT_SINT_4X32 = 0x12, 701 CU_RES_VIEW_FORMAT_FLOAT_1X16 = 0x13, 702 CU_RES_VIEW_FORMAT_FLOAT_2X16 = 0x14, 703 CU_RES_VIEW_FORMAT_FLOAT_4X16 = 0x15, 704 CU_RES_VIEW_FORMAT_FLOAT_1X32 = 0x16, 705 CU_RES_VIEW_FORMAT_FLOAT_2X32 = 0x17, 706 CU_RES_VIEW_FORMAT_FLOAT_4X32 = 0x18, 707 CU_RES_VIEW_FORMAT_UNSIGNED_BC1 = 0x19, 708 CU_RES_VIEW_FORMAT_UNSIGNED_BC2 = 0x1a, 709 CU_RES_VIEW_FORMAT_UNSIGNED_BC3 = 0x1b, 710 CU_RES_VIEW_FORMAT_UNSIGNED_BC4 = 0x1c, 711 CU_RES_VIEW_FORMAT_SIGNED_BC4 = 0x1d, 712 CU_RES_VIEW_FORMAT_UNSIGNED_BC5 = 0x1e, 713 CU_RES_VIEW_FORMAT_SIGNED_BC5 = 0x1f, 714 CU_RES_VIEW_FORMAT_UNSIGNED_BC6H = 0x20, 715 CU_RES_VIEW_FORMAT_SIGNED_BC6H = 0x21, 716 CU_RES_VIEW_FORMAT_UNSIGNED_BC7 = 0x22 717 } 718 719 struct CUDA_RESOURCE_VIEW_DESC 720 { 721 CUresourceViewFormat format; 722 size_t width; 723 size_t height; 724 size_t depth; 725 uint firstMipmapLevel; 726 uint lastMipmapLevel; 727 uint firstLayer; 728 uint lastLayer; 729 uint[16] reserved; 730 } 731 732 733 struct CUDA_POINTER_ATTRIBUTE_P2P_TOKENS 734 { 735 ulong p2pToken; 736 uint vaSpaceToken; 737 } 738 739 enum CUDA_ARRAY3D_LAYERED = 0x01; 740 enum CUDA_ARRAY3D_SURFACE_LDST = 0x02; 741 enum CUDA_ARRAY3D_CUBEMAP = 0x04; 742 enum CUDA_ARRAY3D_TEXTURE_GATHER = 0x08; 743 enum CUDA_ARRAY3D_DEPTH_TEXTURE = 0x10; 744 enum CU_TRSA_OVERRIDE_FORMAT = 0x01; 745 enum CU_TRSF_READ_AS_INTEGER = 0x01; 746 enum CU_TRSF_NORMALIZED_COORDINATES = 0x02; 747 enum CU_TRSF_SRGB = 0x10; 748 enum CU_LAUNCH_PARAM_END = (cast(void*)0x00); 749 enum CU_LAUNCH_PARAM_BUFFER_POINTER = (cast(void*)0x01); 750 enum CU_LAUNCH_PARAM_BUFFER_SIZE = (cast(void*)0x02); 751 enum CU_PARAM_TR_DEFAULT = -1; 752 753 754 extern(System) @nogc nothrow 755 { 756 alias da_cuGetErrorString = CUresult function(CUresult error, const(char) **pStr); 757 alias da_cuGetErrorName = CUresult function(CUresult error, const(char) **pStr); 758 alias da_cuInit = CUresult function(uint Flags); 759 alias da_cuDriverGetVersion = CUresult function(int *driverVersion); 760 alias da_cuDeviceGet = CUresult function(CUdevice *device, int ordinal); 761 alias da_cuDeviceGetCount = CUresult function(int *count); 762 alias da_cuDeviceGetName = CUresult function(char *name, int len, CUdevice dev); 763 alias da_cuDeviceTotalMem = CUresult function(size_t *bytes, CUdevice dev); 764 alias da_cuDeviceGetAttribute = CUresult function(int *pi, CUdevice_attribute attrib, CUdevice dev); 765 alias da_cuCtxCreate = CUresult function(CUcontext *pctx, uint flags, CUdevice dev); 766 alias da_cuCtxDestroy = CUresult function(CUcontext ctx); 767 alias da_cuCtxPushCurrent = CUresult function(CUcontext ctx); 768 alias da_cuCtxPopCurrent = CUresult function(CUcontext *pctx); 769 alias da_cuCtxSetCurrent = CUresult function(CUcontext ctx); 770 alias da_cuCtxGetCurrent = CUresult function(CUcontext *pctx); 771 alias da_cuCtxGetDevice = CUresult function(CUdevice *device); 772 alias da_cuCtxSynchronize = CUresult function(); 773 alias da_cuCtxSetLimit = CUresult function(CUlimit limit, size_t value); 774 alias da_cuCtxGetLimit = CUresult function(size_t *pvalue, CUlimit limit); 775 alias da_cuCtxGetCacheConfig = CUresult function(CUfunc_cache *pconfig); 776 alias da_cuCtxSetCacheConfig = CUresult function(CUfunc_cache config); 777 alias da_cuCtxGetSharedMemConfig = CUresult function(CUsharedconfig *pConfig); 778 alias da_cuCtxSetSharedMemConfig = CUresult function(CUsharedconfig config); 779 alias da_cuCtxGetApiVersion = CUresult function(CUcontext ctx, uint *version_); 780 alias da_cuCtxGetStreamPriorityRange = CUresult function(int *leastPriority, int *greatestPriority); 781 alias da_cuCtxDetach = CUresult function(CUcontext ctx); 782 alias da_cuModuleLoad = CUresult function(CUmodule *module_, const(char) *fname); 783 alias da_cuModuleLoadData = CUresult function(CUmodule *module_, const(void)* image); 784 alias da_cuModuleLoadDataEx = CUresult function(CUmodule *module_, const(void)* image, uint numOptions, CUjit_option *options, void **optionValues); 785 alias da_cuModuleLoadFatBinary = CUresult function(CUmodule *module_, const(void)* fatCubin); 786 alias da_cuModuleUnload = CUresult function(CUmodule hmod); 787 alias da_cuModuleGetFunction = CUresult function(CUfunction *hfunc, CUmodule hmod, const(char) *name); 788 alias da_cuModuleGetGlobal = CUresult function(CUdeviceptr *dptr, size_t *bytes, CUmodule hmod, const(char) *name); 789 alias da_cuModuleGetTexRef = CUresult function(CUtexref *pTexRef, CUmodule hmod, const(char) *name); 790 alias da_cuModuleGetSurfRef = CUresult function(CUsurfref *pSurfRef, CUmodule hmod, const(char) *name); 791 alias da_cuLinkCreate = CUresult function(uint numOptions, CUjit_option *options, void **optionValues, CUlinkState *stateOut); 792 alias da_cuLinkAddData = CUresult function(CUlinkState state, CUjitInputType type, void *data, size_t size, const(char) *name, uint numOptions, CUjit_option *options, void **optionValues); 793 alias da_cuLinkAddFile = CUresult function(CUlinkState state, CUjitInputType type, const(char) *path, uint numOptions, CUjit_option *options, void **optionValues); 794 alias da_cuLinkComplete = CUresult function(CUlinkState state, void **cubinOut, size_t *sizeOut); 795 alias da_cuLinkDestroy = CUresult function(CUlinkState state); 796 alias da_cuMemGetInfo = CUresult function(size_t *free, size_t *total); 797 alias da_cuMemAlloc = CUresult function(CUdeviceptr *dptr, size_t bytesize); 798 alias da_cuMemAllocPitch = CUresult function(CUdeviceptr *dptr, size_t *pPitch, size_t WidthInBytes, size_t Height, uint ElementSizeBytes); 799 alias da_cuMemFree = CUresult function(CUdeviceptr dptr); 800 alias da_cuMemGetAddressRange = CUresult function(CUdeviceptr *pbase, size_t *psize, CUdeviceptr dptr); 801 alias da_cuMemAllocHost = CUresult function(void **pp, size_t bytesize); 802 alias da_cuMemFreeHost = CUresult function(void *p); 803 alias da_cuMemHostAlloc = CUresult function(void **pp, size_t bytesize, uint Flags); 804 alias da_cuMemHostGetDevicePointer = CUresult function(CUdeviceptr *pdptr, void *p, uint Flags); 805 alias da_cuMemHostGetFlags = CUresult function(uint *pFlags, void *p); 806 alias da_cuMemAllocManaged = CUresult function(CUdeviceptr *dptr, size_t bytesize, uint flags); 807 alias da_cuDeviceGetByPCIBusId = CUresult function(CUdevice *dev, const(char) *pciBusId); 808 alias da_cuDeviceGetPCIBusId = CUresult function(char *pciBusId, int len, CUdevice dev); 809 alias da_cuIpcGetEventHandle = CUresult function(CUipcEventHandle *pHandle, CUevent event); 810 alias da_cuIpcOpenEventHandle = CUresult function(CUevent *phEvent, CUipcEventHandle handle); 811 alias da_cuIpcGetMemHandle = CUresult function(CUipcMemHandle *pHandle, CUdeviceptr dptr); 812 alias da_cuIpcOpenMemHandle = CUresult function(CUdeviceptr *pdptr, CUipcMemHandle handle, uint Flags); 813 alias da_cuIpcCloseMemHandle = CUresult function(CUdeviceptr dptr); 814 alias da_cuMemHostRegister = CUresult function(void *p, size_t bytesize, uint Flags); 815 alias da_cuMemHostUnregister = CUresult function(void *p); 816 alias da_cuMemcpy = CUresult function(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount); 817 alias da_cuMemcpyPeer = CUresult function(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount); 818 alias da_cuMemcpyHtoD = CUresult function(CUdeviceptr dstDevice, const(void)* srcHost, size_t ByteCount); 819 alias da_cuMemcpyDtoH = CUresult function(void *dstHost, CUdeviceptr srcDevice, size_t ByteCount); 820 alias da_cuMemcpyDtoD = CUresult function(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount); 821 alias da_cuMemcpyDtoA = CUresult function(CUarray dstArray, size_t dstOffset, CUdeviceptr srcDevice, size_t ByteCount); 822 alias da_cuMemcpyAtoD = CUresult function(CUdeviceptr dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount); 823 alias da_cuMemcpyHtoA = CUresult function(CUarray dstArray, size_t dstOffset, const(void)* srcHost, size_t ByteCount); 824 alias da_cuMemcpyAtoH = CUresult function(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount); 825 alias da_cuMemcpyAtoA = CUresult function(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount); 826 alias da_cuMemcpy2D = CUresult function(const CUDA_MEMCPY2D *pCopy); 827 alias da_cuMemcpy2DUnaligned = CUresult function(const CUDA_MEMCPY2D *pCopy); 828 alias da_cuMemcpy3D = CUresult function(const CUDA_MEMCPY3D *pCopy); 829 alias da_cuMemcpy3DPeer = CUresult function(const CUDA_MEMCPY3D_PEER *pCopy); 830 alias da_cuMemcpyAsync = CUresult function(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount, CUstream hStream); 831 alias da_cuMemcpyPeerAsync = CUresult function(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream); 832 alias da_cuMemcpyHtoDAsync = CUresult function(CUdeviceptr dstDevice, const(void)* srcHost, size_t ByteCount, CUstream hStream); 833 alias da_cuMemcpyDtoHAsync = CUresult function(void *dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream); 834 alias da_cuMemcpyDtoDAsync = CUresult function(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream); 835 alias da_cuMemcpyHtoAAsync = CUresult function(CUarray dstArray, size_t dstOffset, const(void)* srcHost, size_t ByteCount, CUstream hStream); 836 alias da_cuMemcpyAtoHAsync = CUresult function(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream); 837 alias da_cuMemcpy2DAsync = CUresult function(const CUDA_MEMCPY2D *pCopy, CUstream hStream); 838 alias da_cuMemcpy3DAsync = CUresult function(const CUDA_MEMCPY3D *pCopy, CUstream hStream); 839 alias da_cuMemcpy3DPeerAsync = CUresult function(const CUDA_MEMCPY3D_PEER *pCopy, CUstream hStream); 840 alias da_cuMemsetD8 = CUresult function(CUdeviceptr dstDevice, ubyte uc, size_t N); 841 alias da_cuMemsetD16 = CUresult function(CUdeviceptr dstDevice, ushort us, size_t N); 842 alias da_cuMemsetD32 = CUresult function(CUdeviceptr dstDevice, uint ui, size_t N); 843 alias da_cuMemsetD2D8 = CUresult function(CUdeviceptr dstDevice, size_t dstPitch, ubyte uc, size_t Width, size_t Height); 844 alias da_cuMemsetD2D16 = CUresult function(CUdeviceptr dstDevice, size_t dstPitch, ushort us, size_t Width, size_t Height); 845 alias da_cuMemsetD2D32 = CUresult function(CUdeviceptr dstDevice, size_t dstPitch, uint ui, size_t Width, size_t Height); 846 alias da_cuMemsetD8Async = CUresult function(CUdeviceptr dstDevice, ubyte uc, size_t N, CUstream hStream); 847 alias da_cuMemsetD16Async = CUresult function(CUdeviceptr dstDevice, ushort us, size_t N, CUstream hStream); 848 alias da_cuMemsetD32Async = CUresult function(CUdeviceptr dstDevice, uint ui, size_t N, CUstream hStream); 849 alias da_cuMemsetD2D8Async = CUresult function(CUdeviceptr dstDevice, size_t dstPitch, ubyte uc, size_t Width, size_t Height, CUstream hStream); 850 alias da_cuMemsetD2D16Async = CUresult function(CUdeviceptr dstDevice, size_t dstPitch, ushort us, size_t Width, size_t Height, CUstream hStream); 851 alias da_cuMemsetD2D32Async = CUresult function(CUdeviceptr dstDevice, size_t dstPitch, uint ui, size_t Width, size_t Height, CUstream hStream); 852 alias da_cuArrayCreate = CUresult function(CUarray *pHandle, const CUDA_ARRAY_DESCRIPTOR *pAllocateArray); 853 alias da_cuArrayGetDescriptor = CUresult function(CUDA_ARRAY_DESCRIPTOR *pArrayDescriptor, CUarray hArray); 854 alias da_cuArrayDestroy = CUresult function(CUarray hArray); 855 alias da_cuArray3DCreate = CUresult function(CUarray *pHandle, const CUDA_ARRAY3D_DESCRIPTOR *pAllocateArray); 856 alias da_cuArray3DGetDescriptor = CUresult function(CUDA_ARRAY3D_DESCRIPTOR *pArrayDescriptor, CUarray hArray); 857 alias da_cuMipmappedArrayCreate = CUresult function(CUmipmappedArray *pHandle, const CUDA_ARRAY3D_DESCRIPTOR *pMipmappedArrayDesc, uint numMipmapLevels); 858 alias da_cuMipmappedArrayGetLevel = CUresult function(CUarray *pLevelArray, CUmipmappedArray hMipmappedArray, uint level); 859 alias da_cuMipmappedArrayDestroy = CUresult function(CUmipmappedArray hMipmappedArray); 860 alias da_cuPointerGetAttribute = CUresult function(void *data, CUpointer_attribute attribute, CUdeviceptr ptr); 861 alias da_cuPointerSetAttribute = CUresult function(const(void)* value, CUpointer_attribute attribute, CUdeviceptr ptr); 862 alias da_cuStreamCreate = CUresult function(CUstream *phStream, uint Flags); 863 alias da_cuStreamCreateWithPriority = CUresult function(CUstream *phStream, uint flags, int priority); 864 alias da_cuStreamGetPriority = CUresult function(CUstream hStream, int *priority); 865 alias da_cuStreamGetFlags = CUresult function(CUstream hStream, uint *flags); 866 alias da_cuStreamWaitEvent = CUresult function(CUstream hStream, CUevent hEvent, uint Flags); 867 alias da_cuStreamAddCallback = CUresult function(CUstream hStream, CUstreamCallback callback, void *userData, uint flags); 868 alias da_cuStreamAttachMemAsync = CUresult function(CUstream hStream, CUdeviceptr dptr, size_t length, uint flags); 869 alias da_cuStreamQuery = CUresult function(CUstream hStream); 870 alias da_cuStreamSynchronize = CUresult function(CUstream hStream); 871 alias da_cuStreamDestroy = CUresult function(CUstream hStream); 872 alias da_cuEventCreate = CUresult function(CUevent *phEvent, uint Flags); 873 alias da_cuEventRecord = CUresult function(CUevent hEvent, CUstream hStream); 874 alias da_cuEventQuery = CUresult function(CUevent hEvent); 875 alias da_cuEventSynchronize = CUresult function(CUevent hEvent); 876 alias da_cuEventDestroy = CUresult function(CUevent hEvent); 877 alias da_cuEventElapsedTime = CUresult function(float *pMilliseconds, CUevent hStart, CUevent hEnd); 878 alias da_cuFuncGetAttribute = CUresult function(int *pi, CUfunction_attribute attrib, CUfunction hfunc); 879 alias da_cuFuncSetCacheConfig = CUresult function(CUfunction hfunc, CUfunc_cache config); 880 alias da_cuFuncSetSharedMemConfig = CUresult function(CUfunction hfunc, CUsharedconfig config); 881 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); 882 alias da_cuOccupancyMaxActiveBlocksPerMultiprocessor = CUresult function(int *numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize); 883 alias da_cuOccupancyMaxPotentialBlockSize = CUresult function(int *minGridSize, int *blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit); 884 alias da_cuTexRefSetArray = CUresult function(CUtexref hTexRef, CUarray hArray, uint Flags); 885 alias da_cuTexRefSetMipmappedArray = CUresult function(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, uint Flags); 886 alias da_cuTexRefSetAddress = CUresult function(size_t *ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, size_t bytes); 887 alias da_cuTexRefSetAddress2D = CUresult function(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR *desc, CUdeviceptr dptr, size_t Pitch); 888 alias da_cuTexRefSetFormat = CUresult function(CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents); 889 alias da_cuTexRefSetAddressMode = CUresult function(CUtexref hTexRef, int dim, CUaddress_mode am); 890 alias da_cuTexRefSetFilterMode = CUresult function(CUtexref hTexRef, CUfilter_mode fm); 891 alias da_cuTexRefSetMipmapFilterMode = CUresult function(CUtexref hTexRef, CUfilter_mode fm); 892 alias da_cuTexRefSetMipmapLevelBias = CUresult function(CUtexref hTexRef, float bias); 893 alias da_cuTexRefSetMipmapLevelClamp = CUresult function(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp); 894 alias da_cuTexRefSetMaxAnisotropy = CUresult function(CUtexref hTexRef, uint maxAniso); 895 alias da_cuTexRefSetFlags = CUresult function(CUtexref hTexRef, uint Flags); 896 alias da_cuTexRefGetAddress = CUresult function(CUdeviceptr *pdptr, CUtexref hTexRef); 897 alias da_cuTexRefGetArray = CUresult function(CUarray *phArray, CUtexref hTexRef); 898 alias da_cuTexRefGetMipmappedArray = CUresult function(CUmipmappedArray *phMipmappedArray, CUtexref hTexRef); 899 alias da_cuTexRefGetAddressMode = CUresult function(CUaddress_mode *pam, CUtexref hTexRef, int dim); 900 alias da_cuTexRefGetFilterMode = CUresult function(CUfilter_mode *pfm, CUtexref hTexRef); 901 alias da_cuTexRefGetFormat = CUresult function(CUarray_format *pFormat, int *pNumChannels, CUtexref hTexRef); 902 alias da_cuTexRefGetMipmapFilterMode = CUresult function(CUfilter_mode *pfm, CUtexref hTexRef); 903 alias da_cuTexRefGetMipmapLevelBias = CUresult function(float *pbias, CUtexref hTexRef); 904 alias da_cuTexRefGetMipmapLevelClamp = CUresult function(float *pminMipmapLevelClamp, float *pmaxMipmapLevelClamp, CUtexref hTexRef); 905 alias da_cuTexRefGetMaxAnisotropy = CUresult function(int *pmaxAniso, CUtexref hTexRef); 906 alias da_cuTexRefGetFlags = CUresult function(uint *pFlags, CUtexref hTexRef); 907 alias da_cuSurfRefSetArray = CUresult function(CUsurfref hSurfRef, CUarray hArray, uint Flags); 908 alias da_cuSurfRefGetArray = CUresult function(CUarray *phArray, CUsurfref hSurfRef); 909 alias da_cuTexObjectCreate = CUresult function(CUtexObject *pTexObject, const CUDA_RESOURCE_DESC *pResDesc, const CUDA_TEXTURE_DESC *pTexDesc, const CUDA_RESOURCE_VIEW_DESC *pResViewDesc); 910 alias da_cuTexObjectDestroy = CUresult function(CUtexObject texObject); 911 alias da_cuTexObjectGetResourceDesc = CUresult function(CUDA_RESOURCE_DESC *pResDesc, CUtexObject texObject); 912 alias da_cuTexObjectGetTextureDesc = CUresult function(CUDA_TEXTURE_DESC *pTexDesc, CUtexObject texObject); 913 alias da_cuTexObjectGetResourceViewDesc = CUresult function(CUDA_RESOURCE_VIEW_DESC *pResViewDesc, CUtexObject texObject); 914 alias da_cuSurfObjectCreate = CUresult function(CUsurfObject *pSurfObject, const CUDA_RESOURCE_DESC *pResDesc); 915 alias da_cuSurfObjectDestroy = CUresult function(CUsurfObject surfObject); 916 alias da_cuSurfObjectGetResourceDesc = CUresult function(CUDA_RESOURCE_DESC *pResDesc, CUsurfObject surfObject); 917 alias da_cuDeviceCanAccessPeer = CUresult function(int *canAccessPeer, CUdevice dev, CUdevice peerDev); 918 alias da_cuCtxEnablePeerAccess = CUresult function(CUcontext peerContext, uint Flags); 919 alias da_cuCtxDisablePeerAccess = CUresult function(CUcontext peerContext); 920 alias da_cuGraphicsUnregisterResource = CUresult function(CUgraphicsResource resource); 921 alias da_cuGraphicsSubResourceGetMappedArray = CUresult function(CUarray *pArray, CUgraphicsResource resource, uint arrayIndex, uint mipLevel); 922 alias da_cuGraphicsResourceGetMappedMipmappedArray = CUresult function(CUmipmappedArray *pMipmappedArray, CUgraphicsResource resource); 923 alias da_cuGraphicsResourceGetMappedPointer = CUresult function(CUdeviceptr *pDevPtr, size_t *pSize, CUgraphicsResource resource); 924 alias da_cuGraphicsResourceSetMapFlags = CUresult function(CUgraphicsResource resource, uint flags); 925 alias da_cuGraphicsMapResources = CUresult function(uint count, CUgraphicsResource *resources, CUstream hStream); 926 alias da_cuGraphicsUnmapResources = CUresult function(uint count, CUgraphicsResource *resources, CUstream hStream); 927 alias da_cuGetExportTable = CUresult function(const(void)* *ppExportTable, const CUuuid *pExportTableId); 928 } 929 930 __gshared 931 { 932 da_cuGetErrorString cuGetErrorString; 933 da_cuGetErrorName cuGetErrorName; 934 da_cuInit cuInit; 935 da_cuDriverGetVersion cuDriverGetVersion; 936 da_cuDeviceGet cuDeviceGet; 937 da_cuDeviceGetCount cuDeviceGetCount; 938 da_cuDeviceGetName cuDeviceGetName; 939 da_cuDeviceTotalMem cuDeviceTotalMem; 940 da_cuDeviceGetAttribute cuDeviceGetAttribute; 941 da_cuCtxCreate cuCtxCreate; 942 da_cuCtxDestroy cuCtxDestroy; 943 da_cuCtxPushCurrent cuCtxPushCurrent; 944 da_cuCtxPopCurrent cuCtxPopCurrent; 945 da_cuCtxSetCurrent cuCtxSetCurrent; 946 da_cuCtxGetCurrent cuCtxGetCurrent; 947 da_cuCtxGetDevice cuCtxGetDevice; 948 da_cuCtxSynchronize cuCtxSynchronize; 949 da_cuCtxSetLimit cuCtxSetLimit; 950 da_cuCtxGetLimit cuCtxGetLimit; 951 da_cuCtxGetCacheConfig cuCtxGetCacheConfig; 952 da_cuCtxSetCacheConfig cuCtxSetCacheConfig; 953 da_cuCtxGetSharedMemConfig cuCtxGetSharedMemConfig; 954 da_cuCtxSetSharedMemConfig cuCtxSetSharedMemConfig; 955 da_cuCtxGetApiVersion cuCtxGetApiVersion; 956 da_cuCtxGetStreamPriorityRange cuCtxGetStreamPriorityRange; 957 da_cuCtxDetach cuCtxDetach; 958 da_cuModuleLoad cuModuleLoad; 959 da_cuModuleLoadData cuModuleLoadData; 960 da_cuModuleLoadDataEx cuModuleLoadDataEx; 961 da_cuModuleLoadFatBinary cuModuleLoadFatBinary; 962 da_cuModuleUnload cuModuleUnload; 963 da_cuModuleGetFunction cuModuleGetFunction; 964 da_cuModuleGetGlobal cuModuleGetGlobal; 965 da_cuModuleGetTexRef cuModuleGetTexRef; 966 da_cuModuleGetSurfRef cuModuleGetSurfRef; 967 da_cuLinkCreate cuLinkCreate; 968 da_cuLinkAddData cuLinkAddData; 969 da_cuLinkAddFile cuLinkAddFile; 970 da_cuLinkComplete cuLinkComplete; 971 da_cuLinkDestroy cuLinkDestroy; 972 da_cuMemGetInfo cuMemGetInfo; 973 da_cuMemAlloc cuMemAlloc; 974 da_cuMemAllocPitch cuMemAllocPitch; 975 da_cuMemFree cuMemFree; 976 da_cuMemGetAddressRange cuMemGetAddressRange; 977 da_cuMemAllocHost cuMemAllocHost; 978 da_cuMemFreeHost cuMemFreeHost; 979 da_cuMemHostAlloc cuMemHostAlloc; 980 da_cuMemHostGetDevicePointer cuMemHostGetDevicePointer; 981 da_cuMemHostGetFlags cuMemHostGetFlags; 982 da_cuMemAllocManaged cuMemAllocManaged; 983 da_cuDeviceGetByPCIBusId cuDeviceGetByPCIBusId; 984 da_cuDeviceGetPCIBusId cuDeviceGetPCIBusId; 985 da_cuIpcGetEventHandle cuIpcGetEventHandle; 986 da_cuIpcOpenEventHandle cuIpcOpenEventHandle; 987 da_cuIpcGetMemHandle cuIpcGetMemHandle; 988 da_cuIpcOpenMemHandle cuIpcOpenMemHandle; 989 da_cuIpcCloseMemHandle cuIpcCloseMemHandle; 990 da_cuMemHostRegister cuMemHostRegister; 991 da_cuMemHostUnregister cuMemHostUnregister; 992 da_cuMemcpy cuMemcpy; 993 da_cuMemcpyPeer cuMemcpyPeer; 994 da_cuMemcpyHtoD cuMemcpyHtoD; 995 da_cuMemcpyDtoH cuMemcpyDtoH; 996 da_cuMemcpyDtoD cuMemcpyDtoD; 997 da_cuMemcpyDtoA cuMemcpyDtoA; 998 da_cuMemcpyAtoD cuMemcpyAtoD; 999 da_cuMemcpyHtoA cuMemcpyHtoA; 1000 da_cuMemcpyAtoH cuMemcpyAtoH; 1001 da_cuMemcpyAtoA cuMemcpyAtoA; 1002 da_cuMemcpy2D cuMemcpy2D; 1003 da_cuMemcpy2DUnaligned cuMemcpy2DUnaligned; 1004 da_cuMemcpy3D cuMemcpy3D; 1005 da_cuMemcpy3DPeer cuMemcpy3DPeer; 1006 da_cuMemcpyAsync cuMemcpyAsync; 1007 da_cuMemcpyPeerAsync cuMemcpyPeerAsync; 1008 da_cuMemcpyHtoDAsync cuMemcpyHtoDAsync; 1009 da_cuMemcpyDtoHAsync cuMemcpyDtoHAsync; 1010 da_cuMemcpyDtoDAsync cuMemcpyDtoDAsync; 1011 da_cuMemcpyHtoAAsync cuMemcpyHtoAAsync; 1012 da_cuMemcpyAtoHAsync cuMemcpyAtoHAsync; 1013 da_cuMemcpy2DAsync cuMemcpy2DAsync; 1014 da_cuMemcpy3DAsync cuMemcpy3DAsync; 1015 da_cuMemcpy3DPeerAsync cuMemcpy3DPeerAsync; 1016 da_cuMemsetD8 cuMemsetD8; 1017 da_cuMemsetD16 cuMemsetD16; 1018 da_cuMemsetD32 cuMemsetD32; 1019 da_cuMemsetD2D8 cuMemsetD2D8; 1020 da_cuMemsetD2D16 cuMemsetD2D16; 1021 da_cuMemsetD2D32 cuMemsetD2D32; 1022 da_cuMemsetD8Async cuMemsetD8Async; 1023 da_cuMemsetD16Async cuMemsetD16Async; 1024 da_cuMemsetD32Async cuMemsetD32Async; 1025 da_cuMemsetD2D8Async cuMemsetD2D8Async; 1026 da_cuMemsetD2D16Async cuMemsetD2D16Async; 1027 da_cuMemsetD2D32Async cuMemsetD2D32Async; 1028 da_cuArrayCreate cuArrayCreate; 1029 da_cuArrayGetDescriptor cuArrayGetDescriptor; 1030 da_cuArrayDestroy cuArrayDestroy; 1031 da_cuArray3DCreate cuArray3DCreate; 1032 da_cuArray3DGetDescriptor cuArray3DGetDescriptor; 1033 da_cuMipmappedArrayCreate cuMipmappedArrayCreate; 1034 da_cuMipmappedArrayGetLevel cuMipmappedArrayGetLevel; 1035 da_cuMipmappedArrayDestroy cuMipmappedArrayDestroy; 1036 da_cuPointerGetAttribute cuPointerGetAttribute; 1037 da_cuPointerSetAttribute cuPointerSetAttribute; 1038 da_cuStreamCreate cuStreamCreate; 1039 da_cuStreamCreateWithPriority cuStreamCreateWithPriority; 1040 da_cuStreamGetPriority cuStreamGetPriority; 1041 da_cuStreamGetFlags cuStreamGetFlags; 1042 da_cuStreamWaitEvent cuStreamWaitEvent; 1043 da_cuStreamAddCallback cuStreamAddCallback; 1044 da_cuStreamAttachMemAsync cuStreamAttachMemAsync; 1045 da_cuStreamQuery cuStreamQuery; 1046 da_cuStreamSynchronize cuStreamSynchronize; 1047 da_cuStreamDestroy cuStreamDestroy; 1048 da_cuEventCreate cuEventCreate; 1049 da_cuEventRecord cuEventRecord; 1050 da_cuEventQuery cuEventQuery; 1051 da_cuEventSynchronize cuEventSynchronize; 1052 da_cuEventDestroy cuEventDestroy; 1053 da_cuEventElapsedTime cuEventElapsedTime; 1054 da_cuFuncGetAttribute cuFuncGetAttribute; 1055 da_cuFuncSetCacheConfig cuFuncSetCacheConfig; 1056 da_cuFuncSetSharedMemConfig cuFuncSetSharedMemConfig; 1057 da_cuLaunchKernel cuLaunchKernel; 1058 da_cuOccupancyMaxActiveBlocksPerMultiprocessor cuOccupancyMaxActiveBlocksPerMultiprocessor; 1059 da_cuOccupancyMaxPotentialBlockSize cuOccupancyMaxPotentialBlockSize; 1060 da_cuTexRefSetArray cuTexRefSetArray; 1061 da_cuTexRefSetMipmappedArray cuTexRefSetMipmappedArray; 1062 da_cuTexRefSetAddress cuTexRefSetAddress; 1063 da_cuTexRefSetAddress2D cuTexRefSetAddress2D; 1064 da_cuTexRefSetFormat cuTexRefSetFormat; 1065 da_cuTexRefSetAddressMode cuTexRefSetAddressMode; 1066 da_cuTexRefSetFilterMode cuTexRefSetFilterMode; 1067 da_cuTexRefSetMipmapFilterMode cuTexRefSetMipmapFilterMode; 1068 da_cuTexRefSetMipmapLevelBias cuTexRefSetMipmapLevelBias; 1069 da_cuTexRefSetMipmapLevelClamp cuTexRefSetMipmapLevelClamp; 1070 da_cuTexRefSetMaxAnisotropy cuTexRefSetMaxAnisotropy; 1071 da_cuTexRefSetFlags cuTexRefSetFlags; 1072 da_cuTexRefGetAddress cuTexRefGetAddress; 1073 da_cuTexRefGetArray cuTexRefGetArray; 1074 da_cuTexRefGetMipmappedArray cuTexRefGetMipmappedArray; 1075 da_cuTexRefGetAddressMode cuTexRefGetAddressMode; 1076 da_cuTexRefGetFilterMode cuTexRefGetFilterMode; 1077 da_cuTexRefGetFormat cuTexRefGetFormat; 1078 da_cuTexRefGetMipmapFilterMode cuTexRefGetMipmapFilterMode; 1079 da_cuTexRefGetMipmapLevelBias cuTexRefGetMipmapLevelBias; 1080 da_cuTexRefGetMipmapLevelClamp cuTexRefGetMipmapLevelClamp; 1081 da_cuTexRefGetMaxAnisotropy cuTexRefGetMaxAnisotropy; 1082 da_cuTexRefGetFlags cuTexRefGetFlags; 1083 da_cuSurfRefSetArray cuSurfRefSetArray; 1084 da_cuSurfRefGetArray cuSurfRefGetArray; 1085 da_cuTexObjectCreate cuTexObjectCreate; 1086 da_cuTexObjectDestroy cuTexObjectDestroy; 1087 da_cuTexObjectGetResourceDesc cuTexObjectGetResourceDesc; 1088 da_cuTexObjectGetTextureDesc cuTexObjectGetTextureDesc; 1089 da_cuTexObjectGetResourceViewDesc cuTexObjectGetResourceViewDesc; 1090 da_cuSurfObjectCreate cuSurfObjectCreate; 1091 da_cuSurfObjectDestroy cuSurfObjectDestroy; 1092 da_cuSurfObjectGetResourceDesc cuSurfObjectGetResourceDesc; 1093 da_cuDeviceCanAccessPeer cuDeviceCanAccessPeer; 1094 da_cuCtxEnablePeerAccess cuCtxEnablePeerAccess; 1095 da_cuCtxDisablePeerAccess cuCtxDisablePeerAccess; 1096 da_cuGraphicsUnregisterResource cuGraphicsUnregisterResource; 1097 da_cuGraphicsSubResourceGetMappedArray cuGraphicsSubResourceGetMappedArray; 1098 da_cuGraphicsResourceGetMappedMipmappedArray cuGraphicsResourceGetMappedMipmappedArray; 1099 da_cuGraphicsResourceGetMappedPointer cuGraphicsResourceGetMappedPointer; 1100 da_cuGraphicsResourceSetMapFlags cuGraphicsResourceSetMapFlags; 1101 da_cuGraphicsMapResources cuGraphicsMapResources; 1102 da_cuGraphicsUnmapResources cuGraphicsUnmapResources; 1103 da_cuGetExportTable cuGetExportTable; 1104 } 1105 1106 1107 // Driver API loader 1108 class DerelictCUDADriverLoader : SharedLibLoader 1109 { 1110 protected 1111 { 1112 override void loadSymbols() 1113 { 1114 // Note: new versions of API are to be loaded (_v2 or _v3 suffices) 1115 // DerelictCUDA only represents the newest API and load the latest version of functions 1116 // Previous versions of APIs, if necessary, can be done with previous versions of DerelictCUDA. 1117 1118 bindFunc(cast(void**)&cuGetErrorString, "cuGetErrorString"); 1119 bindFunc(cast(void**)&cuGetErrorName, "cuGetErrorName"); 1120 bindFunc(cast(void**)&cuInit, "cuInit"); 1121 bindFunc(cast(void**)&cuDriverGetVersion, "cuDriverGetVersion"); 1122 bindFunc(cast(void**)&cuDeviceGet, "cuDeviceGet"); 1123 bindFunc(cast(void**)&cuDeviceGetCount, "cuDeviceGetCount"); 1124 bindFunc(cast(void**)&cuDeviceGetName, "cuDeviceGetName"); 1125 bindFunc(cast(void**)&cuDeviceTotalMem, "cuDeviceTotalMem_v2"); 1126 bindFunc(cast(void**)&cuDeviceGetAttribute, "cuDeviceGetAttribute"); 1127 bindFunc(cast(void**)&cuCtxCreate, "cuCtxCreate_v2"); 1128 bindFunc(cast(void**)&cuCtxDestroy, "cuCtxDestroy_v2"); 1129 bindFunc(cast(void**)&cuCtxPushCurrent, "cuCtxPushCurrent_v2"); 1130 bindFunc(cast(void**)&cuCtxPopCurrent, "cuCtxPopCurrent_v2"); 1131 bindFunc(cast(void**)&cuCtxSetCurrent, "cuCtxSetCurrent"); 1132 bindFunc(cast(void**)&cuCtxGetCurrent, "cuCtxGetCurrent"); 1133 bindFunc(cast(void**)&cuCtxGetDevice, "cuCtxGetDevice"); 1134 bindFunc(cast(void**)&cuCtxSynchronize, "cuCtxSynchronize"); 1135 bindFunc(cast(void**)&cuCtxSetLimit, "cuCtxSetLimit"); 1136 bindFunc(cast(void**)&cuCtxGetLimit, "cuCtxGetLimit"); 1137 bindFunc(cast(void**)&cuCtxGetCacheConfig, "cuCtxGetCacheConfig"); 1138 bindFunc(cast(void**)&cuCtxSetCacheConfig, "cuCtxSetCacheConfig"); 1139 bindFunc(cast(void**)&cuCtxGetSharedMemConfig, "cuCtxGetSharedMemConfig"); 1140 bindFunc(cast(void**)&cuCtxSetSharedMemConfig, "cuCtxSetSharedMemConfig"); 1141 bindFunc(cast(void**)&cuCtxGetApiVersion, "cuCtxGetApiVersion"); 1142 bindFunc(cast(void**)&cuCtxGetStreamPriorityRange, "cuCtxGetStreamPriorityRange"); 1143 bindFunc(cast(void**)&cuCtxDetach, "cuCtxDetach"); 1144 bindFunc(cast(void**)&cuModuleLoad, "cuModuleLoad"); 1145 bindFunc(cast(void**)&cuModuleLoadData, "cuModuleLoadData"); 1146 bindFunc(cast(void**)&cuModuleLoadDataEx, "cuModuleLoadDataEx"); 1147 bindFunc(cast(void**)&cuModuleLoadFatBinary, "cuModuleLoadFatBinary"); 1148 bindFunc(cast(void**)&cuModuleUnload, "cuModuleUnload"); 1149 bindFunc(cast(void**)&cuModuleGetFunction, "cuModuleGetFunction"); 1150 bindFunc(cast(void**)&cuModuleGetGlobal, "cuModuleGetGlobal_v2"); 1151 bindFunc(cast(void**)&cuModuleGetTexRef, "cuModuleGetTexRef"); 1152 bindFunc(cast(void**)&cuModuleGetSurfRef, "cuModuleGetSurfRef"); 1153 bindFunc(cast(void**)&cuLinkCreate, "cuLinkCreate_v2"); 1154 bindFunc(cast(void**)&cuLinkAddData, "cuLinkAddData_v2"); 1155 bindFunc(cast(void**)&cuLinkAddFile, "cuLinkAddFile_v2"); 1156 bindFunc(cast(void**)&cuLinkComplete, "cuLinkComplete"); 1157 bindFunc(cast(void**)&cuLinkDestroy, "cuLinkDestroy"); 1158 bindFunc(cast(void**)&cuMemGetInfo, "cuMemGetInfo_v2"); 1159 bindFunc(cast(void**)&cuMemAlloc, "cuMemAlloc_v2"); 1160 bindFunc(cast(void**)&cuMemAllocPitch, "cuMemAllocPitch_v2"); 1161 bindFunc(cast(void**)&cuMemFree, "cuMemFree_v2"); 1162 bindFunc(cast(void**)&cuMemGetAddressRange, "cuMemGetAddressRange_v2"); 1163 bindFunc(cast(void**)&cuMemAllocHost, "cuMemAllocHost_v2"); 1164 bindFunc(cast(void**)&cuMemFreeHost, "cuMemFreeHost"); 1165 bindFunc(cast(void**)&cuMemHostAlloc, "cuMemHostAlloc"); 1166 bindFunc(cast(void**)&cuMemHostGetDevicePointer, "cuMemHostGetDevicePointer_v2"); 1167 bindFunc(cast(void**)&cuMemHostGetFlags, "cuMemHostGetFlags"); 1168 bindFunc(cast(void**)&cuMemAllocManaged, "cuMemAllocManaged"); 1169 bindFunc(cast(void**)&cuDeviceGetByPCIBusId, "cuDeviceGetByPCIBusId"); 1170 bindFunc(cast(void**)&cuDeviceGetPCIBusId, "cuDeviceGetPCIBusId"); 1171 bindFunc(cast(void**)&cuIpcGetEventHandle, "cuIpcGetEventHandle"); 1172 bindFunc(cast(void**)&cuIpcOpenEventHandle, "cuIpcOpenEventHandle"); 1173 bindFunc(cast(void**)&cuIpcGetMemHandle, "cuIpcGetMemHandle"); 1174 bindFunc(cast(void**)&cuIpcOpenMemHandle, "cuIpcOpenMemHandle"); 1175 bindFunc(cast(void**)&cuIpcCloseMemHandle, "cuIpcCloseMemHandle"); 1176 bindFunc(cast(void**)&cuMemHostRegister, "cuMemHostRegister_v2"); 1177 bindFunc(cast(void**)&cuMemHostUnregister, "cuMemHostUnregister"); 1178 bindFunc(cast(void**)&cuMemcpy, "cuMemcpy"); 1179 bindFunc(cast(void**)&cuMemcpyPeer, "cuMemcpyPeer"); 1180 bindFunc(cast(void**)&cuMemcpyHtoD, "cuMemcpyHtoD_v2"); 1181 bindFunc(cast(void**)&cuMemcpyDtoH, "cuMemcpyDtoH_v2"); 1182 bindFunc(cast(void**)&cuMemcpyDtoD, "cuMemcpyDtoD_v2"); 1183 bindFunc(cast(void**)&cuMemcpyDtoA, "cuMemcpyDtoA_v2"); 1184 bindFunc(cast(void**)&cuMemcpyAtoD, "cuMemcpyAtoD_v2"); 1185 bindFunc(cast(void**)&cuMemcpyHtoA, "cuMemcpyHtoA_v2"); 1186 bindFunc(cast(void**)&cuMemcpyAtoH, "cuMemcpyAtoH_v2"); 1187 bindFunc(cast(void**)&cuMemcpyAtoA, "cuMemcpyAtoA_v2"); 1188 bindFunc(cast(void**)&cuMemcpy2D, "cuMemcpy2D_v2"); 1189 bindFunc(cast(void**)&cuMemcpy2DUnaligned, "cuMemcpy2DUnaligned_v2"); 1190 bindFunc(cast(void**)&cuMemcpy3D, "cuMemcpy3D_v2"); 1191 bindFunc(cast(void**)&cuMemcpy3DPeer, "cuMemcpy3DPeer"); 1192 bindFunc(cast(void**)&cuMemcpyAsync, "cuMemcpyAsync"); 1193 bindFunc(cast(void**)&cuMemcpyPeerAsync, "cuMemcpyPeerAsync"); 1194 bindFunc(cast(void**)&cuMemcpyHtoDAsync, "cuMemcpyHtoDAsync_v2"); 1195 bindFunc(cast(void**)&cuMemcpyDtoHAsync, "cuMemcpyDtoHAsync_v2"); 1196 bindFunc(cast(void**)&cuMemcpyDtoDAsync, "cuMemcpyDtoDAsync_v2"); 1197 bindFunc(cast(void**)&cuMemcpyHtoAAsync, "cuMemcpyHtoAAsync_v2"); 1198 bindFunc(cast(void**)&cuMemcpyAtoHAsync, "cuMemcpyAtoHAsync_v2"); 1199 bindFunc(cast(void**)&cuMemcpy2DAsync, "cuMemcpy2DAsync_v2"); 1200 bindFunc(cast(void**)&cuMemcpy3DAsync, "cuMemcpy3DAsync_v2"); 1201 bindFunc(cast(void**)&cuMemcpy3DPeerAsync, "cuMemcpy3DPeerAsync"); 1202 bindFunc(cast(void**)&cuMemsetD8, "cuMemsetD8_v2"); 1203 bindFunc(cast(void**)&cuMemsetD16, "cuMemsetD16_v2"); 1204 bindFunc(cast(void**)&cuMemsetD32, "cuMemsetD32_v2"); 1205 bindFunc(cast(void**)&cuMemsetD2D8, "cuMemsetD2D8_v2"); 1206 bindFunc(cast(void**)&cuMemsetD2D16, "cuMemsetD2D16_v2"); 1207 bindFunc(cast(void**)&cuMemsetD2D32, "cuMemsetD2D32_v2"); 1208 bindFunc(cast(void**)&cuMemsetD8Async, "cuMemsetD8Async"); 1209 bindFunc(cast(void**)&cuMemsetD16Async, "cuMemsetD16Async"); 1210 bindFunc(cast(void**)&cuMemsetD32Async, "cuMemsetD32Async"); 1211 bindFunc(cast(void**)&cuMemsetD2D8Async, "cuMemsetD2D8Async"); 1212 bindFunc(cast(void**)&cuMemsetD2D16Async, "cuMemsetD2D16Async"); 1213 bindFunc(cast(void**)&cuMemsetD2D32Async, "cuMemsetD2D32Async"); 1214 bindFunc(cast(void**)&cuArrayCreate, "cuArrayCreate_v2"); 1215 bindFunc(cast(void**)&cuArrayGetDescriptor, "cuArrayGetDescriptor_v2"); 1216 bindFunc(cast(void**)&cuArrayDestroy, "cuArrayDestroy"); 1217 bindFunc(cast(void**)&cuArray3DCreate, "cuArray3DCreate_v2"); 1218 bindFunc(cast(void**)&cuArray3DGetDescriptor, "cuArray3DGetDescriptor_v2"); 1219 bindFunc(cast(void**)&cuMipmappedArrayCreate, "cuMipmappedArrayCreate"); 1220 bindFunc(cast(void**)&cuMipmappedArrayGetLevel, "cuMipmappedArrayGetLevel"); 1221 bindFunc(cast(void**)&cuMipmappedArrayDestroy, "cuMipmappedArrayDestroy"); 1222 bindFunc(cast(void**)&cuPointerGetAttribute, "cuPointerGetAttribute"); 1223 bindFunc(cast(void**)&cuPointerSetAttribute, "cuPointerSetAttribute"); 1224 bindFunc(cast(void**)&cuStreamCreate, "cuStreamCreate"); 1225 bindFunc(cast(void**)&cuStreamCreateWithPriority, "cuStreamCreateWithPriority"); 1226 bindFunc(cast(void**)&cuStreamGetPriority, "cuStreamGetPriority"); 1227 bindFunc(cast(void**)&cuStreamGetFlags, "cuStreamGetFlags"); 1228 bindFunc(cast(void**)&cuStreamWaitEvent, "cuStreamWaitEvent"); 1229 bindFunc(cast(void**)&cuStreamAddCallback, "cuStreamAddCallback"); 1230 bindFunc(cast(void**)&cuStreamAttachMemAsync, "cuStreamAttachMemAsync"); 1231 bindFunc(cast(void**)&cuStreamQuery, "cuStreamQuery"); 1232 bindFunc(cast(void**)&cuStreamSynchronize, "cuStreamSynchronize"); 1233 bindFunc(cast(void**)&cuStreamDestroy, "cuStreamDestroy_v2"); 1234 bindFunc(cast(void**)&cuEventCreate, "cuEventCreate"); 1235 bindFunc(cast(void**)&cuEventRecord, "cuEventRecord"); 1236 bindFunc(cast(void**)&cuEventQuery, "cuEventQuery"); 1237 bindFunc(cast(void**)&cuEventSynchronize, "cuEventSynchronize"); 1238 bindFunc(cast(void**)&cuEventDestroy, "cuEventDestroy_v2"); 1239 bindFunc(cast(void**)&cuEventElapsedTime, "cuEventElapsedTime"); 1240 bindFunc(cast(void**)&cuFuncGetAttribute, "cuFuncGetAttribute"); 1241 bindFunc(cast(void**)&cuFuncSetCacheConfig, "cuFuncSetCacheConfig"); 1242 bindFunc(cast(void**)&cuFuncSetSharedMemConfig, "cuFuncSetSharedMemConfig"); 1243 bindFunc(cast(void**)&cuLaunchKernel, "cuLaunchKernel"); 1244 bindFunc(cast(void**)&cuOccupancyMaxActiveBlocksPerMultiprocessor, "cuOccupancyMaxActiveBlocksPerMultiprocessor"); 1245 bindFunc(cast(void**)&cuOccupancyMaxPotentialBlockSize, "cuOccupancyMaxPotentialBlockSize"); 1246 bindFunc(cast(void**)&cuTexRefSetArray, "cuTexRefSetArray"); 1247 bindFunc(cast(void**)&cuTexRefSetMipmappedArray, "cuTexRefSetMipmappedArray"); 1248 bindFunc(cast(void**)&cuTexRefSetAddress, "cuTexRefSetAddress_v2"); 1249 bindFunc(cast(void**)&cuTexRefSetAddress2D, "cuTexRefSetAddress2D_v3"); 1250 bindFunc(cast(void**)&cuTexRefSetFormat, "cuTexRefSetFormat"); 1251 bindFunc(cast(void**)&cuTexRefSetAddressMode, "cuTexRefSetAddressMode"); 1252 bindFunc(cast(void**)&cuTexRefSetFilterMode, "cuTexRefSetFilterMode"); 1253 bindFunc(cast(void**)&cuTexRefSetMipmapFilterMode, "cuTexRefSetMipmapFilterMode"); 1254 bindFunc(cast(void**)&cuTexRefSetMipmapLevelBias, "cuTexRefSetMipmapLevelBias"); 1255 bindFunc(cast(void**)&cuTexRefSetMipmapLevelClamp, "cuTexRefSetMipmapLevelClamp"); 1256 bindFunc(cast(void**)&cuTexRefSetMaxAnisotropy, "cuTexRefSetMaxAnisotropy"); 1257 bindFunc(cast(void**)&cuTexRefSetFlags, "cuTexRefSetFlags"); 1258 bindFunc(cast(void**)&cuTexRefGetAddress, "cuTexRefGetAddress_v2"); 1259 bindFunc(cast(void**)&cuTexRefGetArray, "cuTexRefGetArray"); 1260 bindFunc(cast(void**)&cuTexRefGetMipmappedArray, "cuTexRefGetMipmappedArray"); 1261 bindFunc(cast(void**)&cuTexRefGetAddressMode, "cuTexRefGetAddressMode"); 1262 bindFunc(cast(void**)&cuTexRefGetFilterMode, "cuTexRefGetFilterMode"); 1263 bindFunc(cast(void**)&cuTexRefGetFormat, "cuTexRefGetFormat"); 1264 bindFunc(cast(void**)&cuTexRefGetMipmapFilterMode, "cuTexRefGetMipmapFilterMode"); 1265 bindFunc(cast(void**)&cuTexRefGetMipmapLevelBias, "cuTexRefGetMipmapLevelBias"); 1266 bindFunc(cast(void**)&cuTexRefGetMipmapLevelClamp, "cuTexRefGetMipmapLevelClamp"); 1267 bindFunc(cast(void**)&cuTexRefGetMaxAnisotropy, "cuTexRefGetMaxAnisotropy"); 1268 bindFunc(cast(void**)&cuTexRefGetFlags, "cuTexRefGetFlags"); 1269 bindFunc(cast(void**)&cuSurfRefSetArray, "cuSurfRefSetArray"); 1270 bindFunc(cast(void**)&cuSurfRefGetArray, "cuSurfRefGetArray"); 1271 bindFunc(cast(void**)&cuTexObjectCreate, "cuTexObjectCreate"); 1272 bindFunc(cast(void**)&cuTexObjectDestroy, "cuTexObjectDestroy"); 1273 bindFunc(cast(void**)&cuTexObjectGetResourceDesc, "cuTexObjectGetResourceDesc"); 1274 bindFunc(cast(void**)&cuTexObjectGetTextureDesc, "cuTexObjectGetTextureDesc"); 1275 bindFunc(cast(void**)&cuTexObjectGetResourceViewDesc, "cuTexObjectGetResourceViewDesc"); 1276 bindFunc(cast(void**)&cuSurfObjectCreate, "cuSurfObjectCreate"); 1277 bindFunc(cast(void**)&cuSurfObjectDestroy, "cuSurfObjectDestroy"); 1278 bindFunc(cast(void**)&cuSurfObjectGetResourceDesc, "cuSurfObjectGetResourceDesc"); 1279 bindFunc(cast(void**)&cuDeviceCanAccessPeer, "cuDeviceCanAccessPeer"); 1280 bindFunc(cast(void**)&cuCtxEnablePeerAccess, "cuCtxEnablePeerAccess"); 1281 bindFunc(cast(void**)&cuCtxDisablePeerAccess, "cuCtxDisablePeerAccess"); 1282 bindFunc(cast(void**)&cuGraphicsUnregisterResource, "cuGraphicsUnregisterResource"); 1283 bindFunc(cast(void**)&cuGraphicsSubResourceGetMappedArray, "cuGraphicsSubResourceGetMappedArray"); 1284 bindFunc(cast(void**)&cuGraphicsResourceGetMappedMipmappedArray, "cuGraphicsResourceGetMappedMipmappedArray"); 1285 bindFunc(cast(void**)&cuGraphicsResourceGetMappedPointer, "cuGraphicsResourceGetMappedPointer_v2"); 1286 bindFunc(cast(void**)&cuGraphicsResourceSetMapFlags, "cuGraphicsResourceSetMapFlags_v2"); 1287 bindFunc(cast(void**)&cuGraphicsMapResources, "cuGraphicsMapResources"); 1288 bindFunc(cast(void**)&cuGraphicsUnmapResources, "cuGraphicsUnmapResources"); 1289 bindFunc(cast(void**)&cuGetExportTable, "cuGetExportTable"); 1290 } 1291 } 1292 1293 public 1294 { 1295 this() 1296 { 1297 super(libNames); 1298 } 1299 } 1300 } 1301 1302 1303 __gshared DerelictCUDADriverLoader DerelictCUDADriver; 1304 1305 shared static this() 1306 { 1307 DerelictCUDADriver = new DerelictCUDADriverLoader(); 1308 }