singe_cuda_sys/driver_sys_13030.rs
1/* automatically generated by rust-bindgen 0.72.1 */
2
3/// CUDA API version number.
4pub const CUDA_VERSION: u32 = 13030;
5/// CUDA IPC handle size.
6pub const CU_IPC_HANDLE_SIZE: u32 = 64;
7pub const CU_COMPUTE_ACCELERATED_TARGET_BASE: u32 = 65536;
8pub const CU_COMPUTE_FAMILY_TARGET_BASE: u32 = 131072;
9/// Conditional node handle flags Default value is applied when graph is launched.
10pub const CU_GRAPH_COND_ASSIGN_DEFAULT: u32 = 1;
11/// This port activates when the kernel has finished executing.
12pub const CU_GRAPH_KERNEL_NODE_PORT_DEFAULT: u32 = 0;
13/// This port activates when all blocks of the kernel have performed [cudaTriggerProgrammaticLaunchCompletion()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__EXECUTION.html#group__CUDART__EXECUTION_1ge194af462d927583bed3acf60d450218) or have terminated. It must be used with edge type CU_GRAPH_DEPENDENCY_TYPE_PROGRAMMATIC. See also CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT.
14pub const CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC: u32 = 1;
15/// This port activates when all blocks of the kernel have begun execution. See also CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT.
16pub const CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER: u32 = 2;
17/// If set, host memory is portable between CUDA contexts. Flag for [`cuMemHostAlloc`].
18pub const CU_MEMHOSTALLOC_PORTABLE: u32 = 1;
19/// If set, host memory is mapped into CUDA address space and [`cuMemHostGetDevicePointer_v2`] may be called on the host pointer. Flag for [`cuMemHostAlloc`].
20pub const CU_MEMHOSTALLOC_DEVICEMAP: u32 = 2;
21/// If set, host memory is allocated as write-combined - fast to write, faster to DMA, slow to read except via SSE4 streaming
22/// load instruction (MOVNTDQA). Flag for [`cuMemHostAlloc`].
23pub const CU_MEMHOSTALLOC_WRITECOMBINED: u32 = 4;
24/// If set, host memory is portable between CUDA contexts. Flag for [`cuMemHostRegister_v2`].
25pub const CU_MEMHOSTREGISTER_PORTABLE: u32 = 1;
26/// If set, host memory is mapped into CUDA address space and [`cuMemHostGetDevicePointer_v2`] may be called on the host pointer. Flag for [`cuMemHostRegister_v2`].
27pub const CU_MEMHOSTREGISTER_DEVICEMAP: u32 = 2;
28/// If set, the passed memory pointer is treated as pointing to some memory-mapped I/O space, e.g. belonging to a third-party
29/// PCIe device. On Windows the flag is a no-op. On Linux that memory is marked as non cache-coherent for the GPU and is expected
30/// to be physically contiguous. It may return CUDA_ERROR_NOT_PERMITTED if run as an unprivileged user, CUDA_ERROR_NOT_SUPPORTED on older Linux kernel versions. On all other platforms, it is not supported and CUDA_ERROR_NOT_SUPPORTED is returned. Flag for [`cuMemHostRegister_v2`].
31pub const CU_MEMHOSTREGISTER_IOMEMORY: u32 = 4;
32/// If set, the passed memory pointer is treated as pointing to memory that is considered read-only by the device. On platforms
33/// without CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES, this flag is required in order to register memory mapped to the CPU as read-only. Support for the use of this flag can be
34/// queried from the device attribute CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED. Using this flag with a current context associated with a device that does not have this attribute set will cause [`cuMemHostRegister_v2`] to error with CUDA_ERROR_NOT_SUPPORTED.
35pub const CU_MEMHOSTREGISTER_READ_ONLY: u32 = 8;
36/// Indicates that the layered sparse CUDA array or CUDA mipmapped array has a single mip tail region for all layers.
37pub const CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL: u32 = 1;
38/// Size of tensor map descriptor.
39pub const CU_TENSOR_MAP_NUM_QWORDS: u32 = 16;
40/// Indicates that the external memory object is a dedicated resource.
41pub const CUDA_EXTERNAL_MEMORY_DEDICATED: u32 = 1;
42/// When the flags parameter of CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS contains this flag, it indicates that signaling an external semaphore
43/// object should skip performing appropriate memory synchronization operations over all the external memory objects that are
44/// imported as CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF, which otherwise are performed by default to ensure data coherency with other importers of the same NvSciBuf memory objects.
45pub const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC: u32 = 1;
46/// When the flags parameter of CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS contains this flag, it indicates that waiting on an external semaphore object
47/// should skip performing appropriate memory synchronization operations over all the external memory objects that are imported
48/// as CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF, which otherwise are performed by default to ensure data coherency with other importers of the same NvSciBuf memory objects.
49pub const CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC: u32 = 2;
50/// When flags of [`cuDeviceGetNvSciSyncAttributes`] is set to this, it indicates that application needs signaler specific NvSciSyncAttr to be filled by [`cuDeviceGetNvSciSyncAttributes`].
51pub const CUDA_NVSCISYNC_ATTR_SIGNAL: u32 = 1;
52/// When flags of [`cuDeviceGetNvSciSyncAttributes`] is set to this, it indicates that application needs waiter specific NvSciSyncAttr to be filled by [`cuDeviceGetNvSciSyncAttributes`].
53pub const CUDA_NVSCISYNC_ATTR_WAIT: u32 = 2;
54/// This flag if set indicates that the memory will be used as a tile pool.
55pub const CU_MEM_CREATE_USAGE_TILE_POOL: u32 = 1;
56/// This flag, if set, indicates that the memory will be used as a buffer for hardware accelerated decompression.
57pub const CU_MEM_CREATE_USAGE_HW_DECOMPRESS: u32 = 2;
58/// This flag, if set, indicates that the memory will be used as a buffer for hardware accelerated decompression.
59pub const CU_MEM_POOL_CREATE_USAGE_HW_DECOMPRESS: u32 = 2;
60/// If set, each kernel launched as part of [`cuLaunchCooperativeKernelMultiDevice`] only waits for prior work in the stream corresponding to that GPU to complete before the kernel begins execution.
61#[deprecated]
62pub const CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_PRE_LAUNCH_SYNC: u32 = 1;
63/// If set, any subsequent work pushed in a stream that participated in a call to [`cuLaunchCooperativeKernelMultiDevice`] will only wait for the kernel launched on the GPU corresponding to that stream to complete before it begins execution.
64#[deprecated]
65pub const CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_POST_LAUNCH_SYNC: u32 = 2;
66/// If set, the CUDA array is a collection of layers, where each layer is either a 1D or a 2D array and the Depth member of CUDA_ARRAY3D_DESCRIPTOR
67/// specifies the number of layers, not the depth of a 3D array.
68pub const CUDA_ARRAY3D_LAYERED: u32 = 1;
69/// use [`CUDA_ARRAY3D_LAYERED`].
70#[deprecated]
71pub const CUDA_ARRAY3D_2DARRAY: u32 = 1;
72/// This flag must be set in order to bind a surface reference to the CUDA array.
73pub const CUDA_ARRAY3D_SURFACE_LDST: u32 = 2;
74/// If set, the CUDA array is a collection of six 2D arrays, representing faces of a cube. The width of such a CUDA array must
75/// be equal to its height, and Depth must be six. If [`CUDA_ARRAY3D_LAYERED`] flag is also set, then the CUDA array is a collection of cubemaps and Depth must be a multiple of six.
76pub const CUDA_ARRAY3D_CUBEMAP: u32 = 4;
77/// This flag must be set in order to perform texture gather operations on a CUDA array.
78pub const CUDA_ARRAY3D_TEXTURE_GATHER: u32 = 8;
79/// This flag if set indicates that the CUDA array is a DEPTH_TEXTURE.
80pub const CUDA_ARRAY3D_DEPTH_TEXTURE: u32 = 16;
81/// This flag indicates that the CUDA array may be bound as a color target in an external graphics API.
82pub const CUDA_ARRAY3D_COLOR_ATTACHMENT: u32 = 32;
83/// This flag if set indicates that the CUDA array or CUDA mipmapped array is a sparse CUDA array or CUDA mipmapped array respectively.
84pub const CUDA_ARRAY3D_SPARSE: u32 = 64;
85/// This flag if set indicates that the CUDA array or CUDA mipmapped array will allow deferred memory mapping.
86pub const CUDA_ARRAY3D_DEFERRED_MAPPING: u32 = 128;
87/// This flag indicates that the CUDA array will be used for hardware accelerated video encode/decode operations.
88pub const CUDA_ARRAY3D_VIDEO_ENCODE_DECODE: u32 = 256;
89/// Override the texref format with a format inferred from the array. Flag for [`cuTexRefSetArray`].
90#[deprecated]
91pub const CU_TRSA_OVERRIDE_FORMAT: u32 = 1;
92/// Read the texture as integers rather than promoting the values to floats in the range \[0,1\]. Flag for [`cuTexRefSetFlags`] and [`cuTexObjectCreate`].
93#[deprecated]
94pub const CU_TRSF_READ_AS_INTEGER: u32 = 1;
95/// Use normalized texture coordinates in the range 0,1) instead of [0,dim). Flag for [cuTexRefSetFlags() and [`cuTexObjectCreate`].
96#[deprecated]
97pub const CU_TRSF_NORMALIZED_COORDINATES: u32 = 2;
98/// Perform sRGB->linear conversion during texture read. Flag for [`cuTexRefSetFlags`] and [`cuTexObjectCreate`].
99#[deprecated]
100pub const CU_TRSF_SRGB: u32 = 16;
101/// Disable any trilinear filtering optimizations. Flag for [`cuTexRefSetFlags`] and [`cuTexObjectCreate`].
102#[deprecated]
103pub const CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION: u32 = 32;
104/// Enable seamless cube map filtering. Flag for [`cuTexObjectCreate`].
105pub const CU_TRSF_SEAMLESS_CUBEMAP: u32 = 64;
106/// Launch with the required block dimension.
107pub const CU_LAUNCH_KERNEL_REQUIRED_BLOCK_DIM: u32 = 1;
108/// C++ compile time constant for CU_LAUNCH_PARAM_END.
109pub const CU_LAUNCH_PARAM_END_AS_INT: u32 = 0;
110/// C++ compile time constant for CU_LAUNCH_PARAM_BUFFER_POINTER.
111pub const CU_LAUNCH_PARAM_BUFFER_POINTER_AS_INT: u32 = 1;
112/// C++ compile time constant for CU_LAUNCH_PARAM_BUFFER_SIZE.
113pub const CU_LAUNCH_PARAM_BUFFER_SIZE_AS_INT: u32 = 2;
114/// For texture references loaded into the module, use default texunit from texture reference.
115pub const CU_PARAM_TR_DEFAULT: i32 = -1;
116pub type size_t = ::core::ffi::c_ulong;
117pub type cuuint32_t = u32;
118pub type cuuint64_t = u64;
119/// CUDA device pointer CUdeviceptr is defined as an unsigned integer type whose size matches the size of a pointer on the target
120/// platform.
121pub type CUdeviceptr_v2 = ::core::ffi::c_ulonglong;
122/// CUDA device pointer.
123pub type CUdeviceptr = CUdeviceptr_v2;
124/// CUDA device.
125pub type CUdevice_v1 = ::core::ffi::c_int;
126/// CUDA device.
127pub type CUdevice = CUdevice_v1;
128#[repr(C)]
129#[derive(Debug, Copy, Clone)]
130pub struct CUctx_st {
131 _unused: [u8; 0],
132}
133/// A regular context handle.
134pub type CUcontext = *mut CUctx_st;
135#[repr(C)]
136#[derive(Debug, Copy, Clone)]
137pub struct CUmod_st {
138 _unused: [u8; 0],
139}
140/// CUDA module.
141pub type CUmodule = *mut CUmod_st;
142#[repr(C)]
143#[derive(Debug, Copy, Clone)]
144pub struct CUfunc_st {
145 _unused: [u8; 0],
146}
147/// CUDA function.
148pub type CUfunction = *mut CUfunc_st;
149#[repr(C)]
150#[derive(Debug, Copy, Clone)]
151pub struct CUlib_st {
152 _unused: [u8; 0],
153}
154/// CUDA library.
155pub type CUlibrary = *mut CUlib_st;
156#[repr(C)]
157#[derive(Debug, Copy, Clone)]
158pub struct CUkern_st {
159 _unused: [u8; 0],
160}
161/// CUDA kernel.
162pub type CUkernel = *mut CUkern_st;
163#[repr(C)]
164#[derive(Debug, Copy, Clone)]
165pub struct CUarray_st {
166 _unused: [u8; 0],
167}
168/// CUDA array.
169pub type CUarray = *mut CUarray_st;
170#[repr(C)]
171#[derive(Debug, Copy, Clone)]
172pub struct CUmipmappedArray_st {
173 _unused: [u8; 0],
174}
175/// CUDA mipmapped array.
176pub type CUmipmappedArray = *mut CUmipmappedArray_st;
177#[repr(C)]
178#[derive(Debug, Copy, Clone)]
179pub struct CUtexref_st {
180 _unused: [u8; 0],
181}
182/// CUDA texture reference.
183pub type CUtexref = *mut CUtexref_st;
184#[repr(C)]
185#[derive(Debug, Copy, Clone)]
186pub struct CUsurfref_st {
187 _unused: [u8; 0],
188}
189/// CUDA surface reference.
190pub type CUsurfref = *mut CUsurfref_st;
191#[repr(C)]
192#[derive(Debug, Copy, Clone)]
193pub struct CUevent_st {
194 _unused: [u8; 0],
195}
196/// CUDA event.
197pub type CUevent = *mut CUevent_st;
198#[repr(C)]
199#[derive(Debug, Copy, Clone)]
200pub struct CUstream_st {
201 _unused: [u8; 0],
202}
203/// CUDA stream.
204pub type CUstream = *mut CUstream_st;
205#[repr(C)]
206#[derive(Debug, Copy, Clone)]
207pub struct CUgraphicsResource_st {
208 _unused: [u8; 0],
209}
210/// CUDA graphics interop resource.
211pub type CUgraphicsResource = *mut CUgraphicsResource_st;
212/// An opaque value that represents a CUDA texture object.
213pub type CUtexObject_v1 = ::core::ffi::c_ulonglong;
214/// An opaque value that represents a CUDA texture object.
215pub type CUtexObject = CUtexObject_v1;
216/// An opaque value that represents a CUDA surface object.
217pub type CUsurfObject_v1 = ::core::ffi::c_ulonglong;
218/// An opaque value that represents a CUDA surface object.
219pub type CUsurfObject = CUsurfObject_v1;
220#[repr(C)]
221#[derive(Debug, Copy, Clone)]
222pub struct CUextMemory_st {
223 _unused: [u8; 0],
224}
225/// CUDA external memory.
226pub type CUexternalMemory = *mut CUextMemory_st;
227#[repr(C)]
228#[derive(Debug, Copy, Clone)]
229pub struct CUextSemaphore_st {
230 _unused: [u8; 0],
231}
232/// CUDA external semaphore.
233pub type CUexternalSemaphore = *mut CUextSemaphore_st;
234#[repr(C)]
235#[derive(Debug, Copy, Clone)]
236pub struct CUgraph_st {
237 _unused: [u8; 0],
238}
239/// CUDA graph.
240pub type CUgraph = *mut CUgraph_st;
241#[repr(C)]
242#[derive(Debug, Copy, Clone)]
243pub struct CUgraphNode_st {
244 _unused: [u8; 0],
245}
246/// CUDA graph node.
247pub type CUgraphNode = *mut CUgraphNode_st;
248#[repr(C)]
249#[derive(Debug, Copy, Clone)]
250pub struct CUgraphExec_st {
251 _unused: [u8; 0],
252}
253/// CUDA executable graph.
254pub type CUgraphExec = *mut CUgraphExec_st;
255#[repr(C)]
256#[derive(Debug, Copy, Clone)]
257pub struct CUmemPoolHandle_st {
258 _unused: [u8; 0],
259}
260/// CUDA memory pool.
261pub type CUmemoryPool = *mut CUmemPoolHandle_st;
262#[repr(C)]
263#[derive(Debug, Copy, Clone)]
264pub struct CUuserObject_st {
265 _unused: [u8; 0],
266}
267/// CUDA user object for graphs.
268pub type CUuserObject = *mut CUuserObject_st;
269/// CUDA graph conditional handle.
270pub type CUgraphConditionalHandle = cuuint64_t;
271#[repr(C)]
272#[derive(Debug, Copy, Clone)]
273pub struct CUgraphDeviceUpdatableNode_st {
274 _unused: [u8; 0],
275}
276/// CUDA graph device node handle.
277pub type CUgraphDeviceNode = *mut CUgraphDeviceUpdatableNode_st;
278#[repr(C)]
279#[derive(Debug, Copy, Clone)]
280pub struct CUasyncCallbackEntry_st {
281 _unused: [u8; 0],
282}
283/// CUDA async notification callback handle.
284pub type CUasyncCallbackHandle = *mut CUasyncCallbackEntry_st;
285#[repr(C)]
286#[derive(Debug, Copy, Clone)]
287pub struct CUgreenCtx_st {
288 _unused: [u8; 0],
289}
290/// A green context handle. This handle can be used safely from only one CPU thread at a time. Created via [`cuGreenCtxCreate`].
291pub type CUgreenCtx = *mut CUgreenCtx_st;
292#[repr(C)]
293#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
294pub struct CUuuid_st {
295 pub bytes: [::core::ffi::c_char; 16usize],
296}
297pub type CUuuid = CUuuid_st;
298#[repr(C)]
299#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
300pub struct CUmemFabricHandle_st {
301 pub data: [::core::ffi::c_uchar; 64usize],
302}
303impl Default for CUmemFabricHandle_st {
304 fn default() -> Self {
305 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
306 unsafe {
307 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
308 s.assume_init()
309 }
310 }
311}
312/// Fabric handle - An opaque handle representing a memory allocation that can be exported to processes in same or different nodes.
313/// For IPC between processes on different nodes they must be connected via the NVSwitch fabric.
314pub type CUmemFabricHandle_v1 = CUmemFabricHandle_st;
315pub type CUmemFabricHandle = CUmemFabricHandle_v1;
316#[repr(C)]
317#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
318pub struct CUipcEventHandle_st {
319 pub reserved: [::core::ffi::c_char; 64usize],
320}
321impl Default for CUipcEventHandle_st {
322 fn default() -> Self {
323 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
324 unsafe {
325 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
326 s.assume_init()
327 }
328 }
329}
330/// CUDA IPC event handle.
331pub type CUipcEventHandle_v1 = CUipcEventHandle_st;
332pub type CUipcEventHandle = CUipcEventHandle_v1;
333#[repr(C)]
334#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
335pub struct CUipcMemHandle_st {
336 pub reserved: [::core::ffi::c_char; 64usize],
337}
338impl Default for CUipcMemHandle_st {
339 fn default() -> Self {
340 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
341 unsafe {
342 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
343 s.assume_init()
344 }
345 }
346}
347/// CUDA IPC mem handle.
348pub type CUipcMemHandle_v1 = CUipcMemHandle_st;
349pub type CUipcMemHandle = CUipcMemHandle_v1;
350/// CUDA Ipc Mem Flags.
351#[repr(u32)]
352#[derive(
353 Debug,
354 Copy,
355 Clone,
356 Hash,
357 PartialOrd,
358 Ord,
359 PartialEq,
360 Eq,
361 TryFromPrimitive,
362 IntoPrimitive,
363)]
364pub enum CUipcMem_flags_enum {
365 /// Automatically enable peer access between remote devices as needed.
366 CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS = 1,
367}
368pub use self::CUipcMem_flags_enum as CUipcMem_flags;
369/// CUDA Mem Attach Flags.
370#[repr(u32)]
371#[derive(
372 Debug,
373 Copy,
374 Clone,
375 Hash,
376 PartialOrd,
377 Ord,
378 PartialEq,
379 Eq,
380 TryFromPrimitive,
381 IntoPrimitive,
382)]
383pub enum CUmemAttach_flags_enum {
384 /// Memory can be accessed by any stream on any device.
385 CU_MEM_ATTACH_GLOBAL = 1,
386 /// Memory cannot be accessed by any stream on any device.
387 CU_MEM_ATTACH_HOST = 2,
388 /// Memory can only be accessed by a single stream on the associated device.
389 CU_MEM_ATTACH_SINGLE = 4,
390}
391pub use self::CUmemAttach_flags_enum as CUmemAttach_flags;
392impl CUctx_flags_enum {
393 pub const CU_CTX_BLOCKING_SYNC: CUctx_flags_enum = CUctx_flags_enum::CU_CTX_SCHED_BLOCKING_SYNC;
394}
395/// Context creation flags.
396#[repr(u32)]
397#[derive(
398 Debug,
399 Copy,
400 Clone,
401 Hash,
402 PartialOrd,
403 Ord,
404 PartialEq,
405 Eq,
406 TryFromPrimitive,
407 IntoPrimitive,
408)]
409pub enum CUctx_flags_enum {
410 /// Automatic scheduling.
411 CU_CTX_SCHED_AUTO = 0,
412 /// Set spin as default scheduling.
413 CU_CTX_SCHED_SPIN = 1,
414 /// Set yield as default scheduling.
415 CU_CTX_SCHED_YIELD = 2,
416 /// Set blocking synchronization as default scheduling.
417 CU_CTX_SCHED_BLOCKING_SYNC = 4,
418 CU_CTX_SCHED_MASK = 7,
419 /// flag is enabled.
420 #[deprecated]
421 CU_CTX_MAP_HOST = 8,
422 /// Keep local memory allocation after launch.
423 CU_CTX_LMEM_RESIZE_TO_MAX = 16,
424 /// Trigger coredumps from exceptions in this context.
425 CU_CTX_COREDUMP_ENABLE = 32,
426 /// Enable user pipe to trigger coredumps in this context.
427 CU_CTX_USER_COREDUMP_ENABLE = 64,
428 /// Ensure synchronous memory operations on this context will synchronize.
429 CU_CTX_SYNC_MEMOPS = 128,
430 CU_CTX_FLAGS_MASK = 255,
431}
432pub use self::CUctx_flags_enum as CUctx_flags;
433/// Event sched flags.
434#[repr(u32)]
435#[derive(
436 Debug,
437 Copy,
438 Clone,
439 Hash,
440 PartialOrd,
441 Ord,
442 PartialEq,
443 Eq,
444 TryFromPrimitive,
445 IntoPrimitive,
446)]
447pub enum CUevent_sched_flags_enum {
448 /// Automatic scheduling.
449 CU_EVENT_SCHED_AUTO = 0,
450 /// Set spin as default scheduling.
451 CU_EVENT_SCHED_SPIN = 1,
452 /// Set yield as default scheduling.
453 CU_EVENT_SCHED_YIELD = 2,
454 /// Set blocking synchronization as default scheduling.
455 CU_EVENT_SCHED_BLOCKING_SYNC = 4,
456}
457pub use self::CUevent_sched_flags_enum as CUevent_sched_flags;
458#[repr(u32)]
459#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
460pub enum CUhostTaskSyncMode_enum {
461 CU_HOST_TASK_BLOCKING = 0,
462 CU_HOST_TASK_SPINWAIT = 1,
463}
464pub use self::CUhostTaskSyncMode_enum as CUhostTaskSyncMode;
465/// Stream creation flags.
466#[repr(u32)]
467#[derive(
468 Debug,
469 Copy,
470 Clone,
471 Hash,
472 PartialOrd,
473 Ord,
474 PartialEq,
475 Eq,
476 TryFromPrimitive,
477 IntoPrimitive,
478)]
479pub enum CUstream_flags_enum {
480 /// Default stream flag.
481 CU_STREAM_DEFAULT = 0,
482 /// Stream does not synchronize with stream 0 (the NULL stream).
483 CU_STREAM_NON_BLOCKING = 1,
484}
485pub use self::CUstream_flags_enum as CUstream_flags;
486/// Event creation flags.
487#[repr(u32)]
488#[derive(
489 Debug,
490 Copy,
491 Clone,
492 Hash,
493 PartialOrd,
494 Ord,
495 PartialEq,
496 Eq,
497 TryFromPrimitive,
498 IntoPrimitive,
499)]
500pub enum CUevent_flags_enum {
501 /// Default event flag.
502 CU_EVENT_DEFAULT = 0,
503 /// Event uses blocking synchronization.
504 CU_EVENT_BLOCKING_SYNC = 1,
505 /// Event will not record timing data.
506 CU_EVENT_DISABLE_TIMING = 2,
507 /// Event is suitable for interprocess use. [`CUevent_flags::CU_EVENT_DISABLE_TIMING`] must be set.
508 CU_EVENT_INTERPROCESS = 4,
509}
510pub use self::CUevent_flags_enum as CUevent_flags;
511/// Event record flags.
512#[repr(u32)]
513#[derive(
514 Debug,
515 Copy,
516 Clone,
517 Hash,
518 PartialOrd,
519 Ord,
520 PartialEq,
521 Eq,
522 TryFromPrimitive,
523 IntoPrimitive,
524)]
525pub enum CUevent_record_flags_enum {
526 /// Default event record flag.
527 CU_EVENT_RECORD_DEFAULT = 0,
528 /// When using stream capture, create an event record node instead of the default behavior. This flag is invalid when used outside
529 /// of capture.
530 CU_EVENT_RECORD_EXTERNAL = 1,
531}
532pub use self::CUevent_record_flags_enum as CUevent_record_flags;
533/// Event wait flags.
534#[repr(u32)]
535#[derive(
536 Debug,
537 Copy,
538 Clone,
539 Hash,
540 PartialOrd,
541 Ord,
542 PartialEq,
543 Eq,
544 TryFromPrimitive,
545 IntoPrimitive,
546)]
547pub enum CUevent_wait_flags_enum {
548 /// Default event wait flag.
549 CU_EVENT_WAIT_DEFAULT = 0,
550 /// When using stream capture, create an event wait node instead of the default behavior. This flag is invalid when used outside
551 /// of capture.
552 CU_EVENT_WAIT_EXTERNAL = 1,
553}
554pub use self::CUevent_wait_flags_enum as CUevent_wait_flags;
555/// CUDA-valid Atomic Operations.
556#[repr(u32)]
557#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
558pub enum CUatomicOperation_enum {
559 CU_ATOMIC_OPERATION_INTEGER_ADD = 0,
560 CU_ATOMIC_OPERATION_INTEGER_MIN = 1,
561 CU_ATOMIC_OPERATION_INTEGER_MAX = 2,
562 CU_ATOMIC_OPERATION_INTEGER_INCREMENT = 3,
563 CU_ATOMIC_OPERATION_INTEGER_DECREMENT = 4,
564 CU_ATOMIC_OPERATION_AND = 5,
565 CU_ATOMIC_OPERATION_OR = 6,
566 CU_ATOMIC_OPERATION_XOR = 7,
567 CU_ATOMIC_OPERATION_EXCHANGE = 8,
568 CU_ATOMIC_OPERATION_CAS = 9,
569 CU_ATOMIC_OPERATION_FLOAT_ADD = 10,
570 CU_ATOMIC_OPERATION_FLOAT_MIN = 11,
571 CU_ATOMIC_OPERATION_FLOAT_MAX = 12,
572 CU_ATOMIC_OPERATION_MAX = 13,
573}
574pub use self::CUatomicOperation_enum as CUatomicOperation;
575/// CUDA-valid Atomic Operation capabilities.
576#[repr(u32)]
577#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
578pub enum CUatomicOperationCapability_enum {
579 CU_ATOMIC_CAPABILITY_SIGNED = 1,
580 CU_ATOMIC_CAPABILITY_UNSIGNED = 2,
581 CU_ATOMIC_CAPABILITY_REDUCTION = 4,
582 CU_ATOMIC_CAPABILITY_SCALAR_32 = 8,
583 CU_ATOMIC_CAPABILITY_SCALAR_64 = 16,
584 CU_ATOMIC_CAPABILITY_SCALAR_128 = 32,
585 CU_ATOMIC_CAPABILITY_VECTOR_32x4 = 64,
586}
587pub use self::CUatomicOperationCapability_enum as CUatomicOperationCapability;
588/// Flags for [`cuStreamWaitValue32_v2`] and [`cuStreamWaitValue64_v2`].
589#[repr(u32)]
590#[derive(
591 Debug,
592 Copy,
593 Clone,
594 Hash,
595 PartialOrd,
596 Ord,
597 PartialEq,
598 Eq,
599 TryFromPrimitive,
600 IntoPrimitive,
601)]
602pub enum CUstreamWaitValue_flags_enum {
603 /// Wait until (int32_t)(\*addr - value) >= 0 (or int64_t for 64 bit values). Note this is a cyclic comparison which ignores wraparound.
604 /// (Default behavior.)
605 CU_STREAM_WAIT_VALUE_GEQ = 0,
606 /// Wait until \*addr == value.
607 CU_STREAM_WAIT_VALUE_EQ = 1,
608 /// Wait until (\*addr & value) != 0.
609 CU_STREAM_WAIT_VALUE_AND = 2,
610 /// Wait until ~(\*addr | value) != 0. Support for this operation can be queried with [`cuDeviceGetAttribute`] and CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR.
611 CU_STREAM_WAIT_VALUE_NOR = 3,
612 /// Follow the wait operation with a flush of outstanding remote writes. This means that, if a remote write operation is guaranteed
613 /// to have reached the device before the wait can be satisfied, that write is guaranteed to be visible to downstream device work.
614 /// The device is permitted to reorder remote writes internally. For example, this flag would be required if two remote writes
615 /// arrive in a defined order, the wait is satisfied by the second write, and downstream work needs to observe the first write.
616 /// Support for this operation is restricted to selected platforms and can be queried with CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES.
617 CU_STREAM_WAIT_VALUE_FLUSH = 1073741824,
618}
619pub use self::CUstreamWaitValue_flags_enum as CUstreamWaitValue_flags;
620/// Flags for [`cuStreamWriteValue32_v2`].
621#[repr(u32)]
622#[derive(
623 Debug,
624 Copy,
625 Clone,
626 Hash,
627 PartialOrd,
628 Ord,
629 PartialEq,
630 Eq,
631 TryFromPrimitive,
632 IntoPrimitive,
633)]
634pub enum CUstreamWriteValue_flags_enum {
635 /// Default behavior.
636 CU_STREAM_WRITE_VALUE_DEFAULT = 0,
637 /// Permits the write to be reordered with writes which were issued before it, as a performance optimization. Normally, [`cuStreamWriteValue32_v2`] will provide a memory fence before the write, which has similar semantics to __threadfence_system() but is scoped to the
638 /// stream rather than a CUDA thread. This flag is not supported in the v2 API.
639 CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER = 1,
640}
641pub use self::CUstreamWriteValue_flags_enum as CUstreamWriteValue_flags;
642/// Operations for [`cuStreamBatchMemOp_v2`].
643#[repr(u32)]
644#[derive(
645 Debug,
646 Copy,
647 Clone,
648 Hash,
649 PartialOrd,
650 Ord,
651 PartialEq,
652 Eq,
653 TryFromPrimitive,
654 IntoPrimitive,
655)]
656pub enum CUstreamBatchMemOpType_enum {
657 /// Represents a [`cuStreamWaitValue32_v2`] operation.
658 CU_STREAM_MEM_OP_WAIT_VALUE_32 = 1,
659 /// Represents a [`cuStreamWriteValue32_v2`] operation.
660 CU_STREAM_MEM_OP_WRITE_VALUE_32 = 2,
661 /// Represents a [`cuStreamWaitValue64_v2`] operation.
662 CU_STREAM_MEM_OP_WAIT_VALUE_64 = 4,
663 /// Represents a [`cuStreamWriteValue64_v2`] operation.
664 CU_STREAM_MEM_OP_WRITE_VALUE_64 = 5,
665 /// Insert a memory barrier of the specified type.
666 CU_STREAM_MEM_OP_BARRIER = 6,
667 /// Perform a atomic reduction. See CUstreamBatchMemOpParams::atomicReduction.
668 CU_STREAM_MEM_OP_ATOMIC_REDUCTION = 8,
669 /// This has the same effect as CU_STREAM_WAIT_VALUE_FLUSH, but as a standalone operation.
670 CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES = 3,
671}
672pub use self::CUstreamBatchMemOpType_enum as CUstreamBatchMemOpType;
673/// Flags for [CUstreamBatchMemOpParams::memoryBarrier](https://docs.nvidia.com/cuda/cuda-driver-api/unionCUstreamBatchMemOpParams__v1.html#unionCUstreamBatchMemOpParams__v1_16133c06182986968a5f5e381194566ef).
674#[repr(u32)]
675#[derive(
676 Debug,
677 Copy,
678 Clone,
679 Hash,
680 PartialOrd,
681 Ord,
682 PartialEq,
683 Eq,
684 TryFromPrimitive,
685 IntoPrimitive,
686)]
687pub enum CUstreamMemoryBarrier_flags_enum {
688 /// System-wide memory barrier.
689 CU_STREAM_MEMORY_BARRIER_TYPE_SYS = 0,
690 /// Limit memory barrier scope to the GPU.
691 CU_STREAM_MEMORY_BARRIER_TYPE_GPU = 1,
692}
693pub use self::CUstreamMemoryBarrier_flags_enum as CUstreamMemoryBarrier_flags;
694/// Atomic reduction operation types for CUstreamBatchMemOpParams::atomicReduction::reductionOp.
695#[repr(u32)]
696#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
697pub enum CUstreamAtomicReductionOpType_enum {
698 /// Performs an atomic OR: \*(address) = \*(address) | value.
699 CU_STREAM_ATOMIC_REDUCTION_OP_OR = 6,
700 /// Performs an atomic AND: \*(address) = \*(address) & value.
701 CU_STREAM_ATOMIC_REDUCTION_OP_AND = 5,
702 /// Performs an atomic ADD: \*(address) = \*(address) + value.
703 CU_STREAM_ATOMIC_REDUCTION_OP_ADD = 0,
704}
705pub use self::CUstreamAtomicReductionOpType_enum as CUstreamAtomicReductionOpType;
706/// Atomic reduction data types for CUstreamBatchMemOpParams::atomicReduction::dataType.
707#[repr(u32)]
708#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
709pub enum CUstreamAtomicReductionDataType_enum {
710 CU_STREAM_ATOMIC_REDUCTION_UNSIGNED_32 = 14,
711 CU_STREAM_ATOMIC_REDUCTION_UNSIGNED_64 = 22,
712}
713pub use self::CUstreamAtomicReductionDataType_enum as CUstreamAtomicReductionDataType;
714#[repr(C)]
715#[derive(Copy, Clone)]
716pub union CUstreamBatchMemOpParams_union {
717 pub operation: CUstreamBatchMemOpType,
718 pub waitValue: CUstreamBatchMemOpParams_union_CUstreamMemOpWaitValueParams_st,
719 pub writeValue: CUstreamBatchMemOpParams_union_CUstreamMemOpWriteValueParams_st,
720 pub flushRemoteWrites: CUstreamBatchMemOpParams_union_CUstreamMemOpFlushRemoteWritesParams_st,
721 pub memoryBarrier: CUstreamBatchMemOpParams_union_CUstreamMemOpMemoryBarrierParams_st,
722 pub atomicReduction: CUstreamBatchMemOpParams_union_CUstreamMemOpAtomicReductionParams_st,
723 pub pad: [cuuint64_t; 6usize],
724}
725#[repr(C)]
726#[derive(Copy, Clone)]
727pub struct CUstreamBatchMemOpParams_union_CUstreamMemOpWaitValueParams_st {
728 pub operation: CUstreamBatchMemOpType,
729 pub address: CUdeviceptr,
730 pub __bindgen_anon_1: CUstreamBatchMemOpParams_union_CUstreamMemOpWaitValueParams_st__bindgen_ty_1,
731 pub flags: ::core::ffi::c_uint,
732 pub alias: CUdeviceptr,
733}
734#[repr(C)]
735#[derive(Copy, Clone)]
736pub union CUstreamBatchMemOpParams_union_CUstreamMemOpWaitValueParams_st__bindgen_ty_1 {
737 pub value: cuuint32_t,
738 pub value64: cuuint64_t,
739}
740impl Default
741for CUstreamBatchMemOpParams_union_CUstreamMemOpWaitValueParams_st__bindgen_ty_1 {
742 fn default() -> Self {
743 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
744 unsafe {
745 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
746 s.assume_init()
747 }
748 }
749}
750impl Default for CUstreamBatchMemOpParams_union_CUstreamMemOpWaitValueParams_st {
751 fn default() -> Self {
752 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
753 unsafe {
754 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
755 s.assume_init()
756 }
757 }
758}
759#[repr(C)]
760#[derive(Copy, Clone)]
761pub struct CUstreamBatchMemOpParams_union_CUstreamMemOpWriteValueParams_st {
762 pub operation: CUstreamBatchMemOpType,
763 pub address: CUdeviceptr,
764 pub __bindgen_anon_1: CUstreamBatchMemOpParams_union_CUstreamMemOpWriteValueParams_st__bindgen_ty_1,
765 pub flags: ::core::ffi::c_uint,
766 pub alias: CUdeviceptr,
767}
768#[repr(C)]
769#[derive(Copy, Clone)]
770pub union CUstreamBatchMemOpParams_union_CUstreamMemOpWriteValueParams_st__bindgen_ty_1 {
771 pub value: cuuint32_t,
772 pub value64: cuuint64_t,
773}
774impl Default
775for CUstreamBatchMemOpParams_union_CUstreamMemOpWriteValueParams_st__bindgen_ty_1 {
776 fn default() -> Self {
777 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
778 unsafe {
779 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
780 s.assume_init()
781 }
782 }
783}
784impl Default for CUstreamBatchMemOpParams_union_CUstreamMemOpWriteValueParams_st {
785 fn default() -> Self {
786 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
787 unsafe {
788 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
789 s.assume_init()
790 }
791 }
792}
793#[repr(C)]
794#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
795pub struct CUstreamBatchMemOpParams_union_CUstreamMemOpFlushRemoteWritesParams_st {
796 pub operation: CUstreamBatchMemOpType,
797 pub flags: ::core::ffi::c_uint,
798}
799impl Default for CUstreamBatchMemOpParams_union_CUstreamMemOpFlushRemoteWritesParams_st {
800 fn default() -> Self {
801 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
802 unsafe {
803 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
804 s.assume_init()
805 }
806 }
807}
808#[repr(C)]
809#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
810pub struct CUstreamBatchMemOpParams_union_CUstreamMemOpMemoryBarrierParams_st {
811 pub operation: CUstreamBatchMemOpType,
812 pub flags: ::core::ffi::c_uint,
813}
814impl Default for CUstreamBatchMemOpParams_union_CUstreamMemOpMemoryBarrierParams_st {
815 fn default() -> Self {
816 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
817 unsafe {
818 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
819 s.assume_init()
820 }
821 }
822}
823#[repr(C)]
824#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
825pub struct CUstreamBatchMemOpParams_union_CUstreamMemOpAtomicReductionParams_st {
826 pub operation: CUstreamBatchMemOpType,
827 pub flags: ::core::ffi::c_uint,
828 pub reductionOp: CUstreamAtomicReductionOpType,
829 pub dataType: CUstreamAtomicReductionDataType,
830 pub address: CUdeviceptr,
831 pub value: cuuint64_t,
832 pub alias: CUdeviceptr,
833}
834impl Default for CUstreamBatchMemOpParams_union_CUstreamMemOpAtomicReductionParams_st {
835 fn default() -> Self {
836 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
837 unsafe {
838 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
839 s.assume_init()
840 }
841 }
842}
843impl Default for CUstreamBatchMemOpParams_union {
844 fn default() -> Self {
845 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
846 unsafe {
847 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
848 s.assume_init()
849 }
850 }
851}
852/// Per-operation parameters for [`cuStreamBatchMemOp_v2`].
853pub type CUstreamBatchMemOpParams_v1 = CUstreamBatchMemOpParams_union;
854pub type CUstreamBatchMemOpParams = CUstreamBatchMemOpParams_v1;
855#[repr(C)]
856#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
857pub struct CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st {
858 pub ctx: CUcontext,
859 pub count: ::core::ffi::c_uint,
860 pub paramArray: *mut CUstreamBatchMemOpParams,
861 pub flags: ::core::ffi::c_uint,
862}
863impl Default for CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st {
864 fn default() -> Self {
865 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
866 unsafe {
867 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
868 s.assume_init()
869 }
870 }
871}
872/// Batch memory operation node parameters
873///
874/// Used in the legacy [`cuGraphAddBatchMemOpNode`] api. New code should use [`cuGraphAddNode_v2`].
875pub type CUDA_BATCH_MEM_OP_NODE_PARAMS_v1 = CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st;
876pub type CUDA_BATCH_MEM_OP_NODE_PARAMS = CUDA_BATCH_MEM_OP_NODE_PARAMS_v1;
877#[repr(C)]
878#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
879pub struct CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st {
880 pub ctx: CUcontext,
881 pub count: ::core::ffi::c_uint,
882 pub paramArray: *mut CUstreamBatchMemOpParams,
883 pub flags: ::core::ffi::c_uint,
884}
885impl Default for CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st {
886 fn default() -> Self {
887 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
888 unsafe {
889 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
890 s.assume_init()
891 }
892 }
893}
894pub type CUDA_BATCH_MEM_OP_NODE_PARAMS_v2 = CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st;
895/// Occupancy calculator flag.
896#[repr(u32)]
897#[derive(
898 Debug,
899 Copy,
900 Clone,
901 Hash,
902 PartialOrd,
903 Ord,
904 PartialEq,
905 Eq,
906 TryFromPrimitive,
907 IntoPrimitive,
908)]
909pub enum CUoccupancy_flags_enum {
910 /// Default behavior.
911 CU_OCCUPANCY_DEFAULT = 0,
912 /// Assume global caching is enabled and cannot be automatically turned off.
913 CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE = 1,
914}
915pub use self::CUoccupancy_flags_enum as CUoccupancy_flags;
916/// Flags for [`cuStreamUpdateCaptureDependencies_v2`].
917#[repr(u32)]
918#[derive(
919 Debug,
920 Copy,
921 Clone,
922 Hash,
923 PartialOrd,
924 Ord,
925 PartialEq,
926 Eq,
927 TryFromPrimitive,
928 IntoPrimitive,
929)]
930pub enum CUstreamUpdateCaptureDependencies_flags_enum {
931 /// Add new nodes to the dependency set.
932 CU_STREAM_ADD_CAPTURE_DEPENDENCIES = 0,
933 /// Replace the dependency set with the new nodes.
934 CU_STREAM_SET_CAPTURE_DEPENDENCIES = 1,
935}
936pub use self::CUstreamUpdateCaptureDependencies_flags_enum as CUstreamUpdateCaptureDependencies_flags;
937/// Types of async notification that can be sent.
938#[repr(u32)]
939#[derive(
940 Debug,
941 Copy,
942 Clone,
943 Hash,
944 PartialOrd,
945 Ord,
946 PartialEq,
947 Eq,
948 TryFromPrimitive,
949 IntoPrimitive,
950)]
951pub enum CUasyncNotificationType_enum {
952 /// Sent when the process has exceeded its device memory budget.
953 CU_ASYNC_NOTIFICATION_TYPE_OVER_BUDGET = 1,
954}
955pub use self::CUasyncNotificationType_enum as CUasyncNotificationType;
956#[repr(C)]
957#[derive(Copy, Clone)]
958pub struct CUasyncNotificationInfo_st {
959 pub type_: CUasyncNotificationType,
960 pub info: CUasyncNotificationInfo_st__bindgen_ty_1,
961}
962#[repr(C)]
963#[derive(Copy, Clone)]
964pub union CUasyncNotificationInfo_st__bindgen_ty_1 {
965 pub overBudget: CUasyncNotificationInfo_st__bindgen_ty_1__bindgen_ty_1,
966}
967#[repr(C)]
968#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
969pub struct CUasyncNotificationInfo_st__bindgen_ty_1__bindgen_ty_1 {
970 pub bytesOverBudget: ::core::ffi::c_ulonglong,
971}
972impl Default for CUasyncNotificationInfo_st__bindgen_ty_1 {
973 fn default() -> Self {
974 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
975 unsafe {
976 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
977 s.assume_init()
978 }
979 }
980}
981impl Default for CUasyncNotificationInfo_st {
982 fn default() -> Self {
983 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
984 unsafe {
985 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
986 s.assume_init()
987 }
988 }
989}
990/// Information passed to the user via the async notification callback.
991pub type CUasyncNotificationInfo = CUasyncNotificationInfo_st;
992/// CUDA async notification callback.
993pub type CUasyncCallback = ::core::option::Option<
994 unsafe extern "C" fn(
995 info: *mut CUasyncNotificationInfo,
996 userData: *mut ::core::ffi::c_void,
997 callback: CUasyncCallbackHandle,
998 ),
999>;
1000/// Array formats.
1001#[repr(u32)]
1002#[derive(
1003 Debug,
1004 Copy,
1005 Clone,
1006 Hash,
1007 PartialOrd,
1008 Ord,
1009 PartialEq,
1010 Eq,
1011 TryFromPrimitive,
1012 IntoPrimitive,
1013)]
1014pub enum CUarray_format_enum {
1015 /// Unsigned 8-bit integers.
1016 CU_AD_FORMAT_UNSIGNED_INT8 = 1,
1017 /// Unsigned 16-bit integers.
1018 CU_AD_FORMAT_UNSIGNED_INT16 = 2,
1019 /// Unsigned 32-bit integers.
1020 CU_AD_FORMAT_UNSIGNED_INT32 = 3,
1021 /// Signed 8-bit integers.
1022 CU_AD_FORMAT_SIGNED_INT8 = 8,
1023 /// Signed 16-bit integers.
1024 CU_AD_FORMAT_SIGNED_INT16 = 9,
1025 /// Signed 32-bit integers.
1026 CU_AD_FORMAT_SIGNED_INT32 = 10,
1027 /// 16-bit floating point.
1028 CU_AD_FORMAT_HALF = 16,
1029 /// 32-bit floating point.
1030 CU_AD_FORMAT_FLOAT = 32,
1031 /// 8-bit YUV planar format, with 4:2:0 sampling.
1032 CU_AD_FORMAT_NV12 = 176,
1033 /// 1 channel unsigned 8-bit normalized integer.
1034 CU_AD_FORMAT_UNORM_INT8X1 = 192,
1035 /// 2 channel unsigned 8-bit normalized integer.
1036 CU_AD_FORMAT_UNORM_INT8X2 = 193,
1037 /// 4 channel unsigned 8-bit normalized integer.
1038 CU_AD_FORMAT_UNORM_INT8X4 = 194,
1039 /// 1 channel unsigned 16-bit normalized integer.
1040 CU_AD_FORMAT_UNORM_INT16X1 = 195,
1041 /// 2 channel unsigned 16-bit normalized integer.
1042 CU_AD_FORMAT_UNORM_INT16X2 = 196,
1043 /// 4 channel unsigned 16-bit normalized integer.
1044 CU_AD_FORMAT_UNORM_INT16X4 = 197,
1045 /// 1 channel signed 8-bit normalized integer.
1046 CU_AD_FORMAT_SNORM_INT8X1 = 198,
1047 /// 2 channel signed 8-bit normalized integer.
1048 CU_AD_FORMAT_SNORM_INT8X2 = 199,
1049 /// 4 channel signed 8-bit normalized integer.
1050 CU_AD_FORMAT_SNORM_INT8X4 = 200,
1051 /// 1 channel signed 16-bit normalized integer.
1052 CU_AD_FORMAT_SNORM_INT16X1 = 201,
1053 /// 2 channel signed 16-bit normalized integer.
1054 CU_AD_FORMAT_SNORM_INT16X2 = 202,
1055 /// 4 channel signed 16-bit normalized integer.
1056 CU_AD_FORMAT_SNORM_INT16X4 = 203,
1057 /// 4 channel unsigned normalized block-compressed (BC1 compression) format.
1058 CU_AD_FORMAT_BC1_UNORM = 145,
1059 /// 4 channel unsigned normalized block-compressed (BC1 compression) format with sRGB encoding.
1060 CU_AD_FORMAT_BC1_UNORM_SRGB = 146,
1061 /// 4 channel unsigned normalized block-compressed (BC2 compression) format.
1062 CU_AD_FORMAT_BC2_UNORM = 147,
1063 /// 4 channel unsigned normalized block-compressed (BC2 compression) format with sRGB encoding.
1064 CU_AD_FORMAT_BC2_UNORM_SRGB = 148,
1065 /// 4 channel unsigned normalized block-compressed (BC3 compression) format.
1066 CU_AD_FORMAT_BC3_UNORM = 149,
1067 /// 4 channel unsigned normalized block-compressed (BC3 compression) format with sRGB encoding.
1068 CU_AD_FORMAT_BC3_UNORM_SRGB = 150,
1069 /// 1 channel unsigned normalized block-compressed (BC4 compression) format.
1070 CU_AD_FORMAT_BC4_UNORM = 151,
1071 /// 1 channel signed normalized block-compressed (BC4 compression) format.
1072 CU_AD_FORMAT_BC4_SNORM = 152,
1073 /// 2 channel unsigned normalized block-compressed (BC5 compression) format.
1074 CU_AD_FORMAT_BC5_UNORM = 153,
1075 /// 2 channel signed normalized block-compressed (BC5 compression) format.
1076 CU_AD_FORMAT_BC5_SNORM = 154,
1077 /// 3 channel unsigned half-float block-compressed (BC6H compression) format.
1078 CU_AD_FORMAT_BC6H_UF16 = 155,
1079 /// 3 channel signed half-float block-compressed (BC6H compression) format.
1080 CU_AD_FORMAT_BC6H_SF16 = 156,
1081 /// 4 channel unsigned normalized block-compressed (BC7 compression) format.
1082 CU_AD_FORMAT_BC7_UNORM = 157,
1083 /// 4 channel unsigned normalized block-compressed (BC7 compression) format with sRGB encoding.
1084 CU_AD_FORMAT_BC7_UNORM_SRGB = 158,
1085 /// 10-bit YUV planar format, with 4:2:0 sampling.
1086 CU_AD_FORMAT_P010 = 159,
1087 /// 16-bit YUV planar format, with 4:2:0 sampling.
1088 CU_AD_FORMAT_P016 = 161,
1089 /// 8-bit YUV planar format, with 4:2:2 sampling.
1090 CU_AD_FORMAT_NV16 = 162,
1091 /// 10-bit YUV planar format, with 4:2:2 sampling.
1092 CU_AD_FORMAT_P210 = 163,
1093 /// 16-bit YUV planar format, with 4:2:2 sampling.
1094 CU_AD_FORMAT_P216 = 164,
1095 /// 2 channel, 8-bit YUV packed planar format, with 4:2:2 sampling.
1096 CU_AD_FORMAT_YUY2 = 165,
1097 /// 2 channel, 10-bit YUV packed planar format, with 4:2:2 sampling.
1098 CU_AD_FORMAT_Y210 = 166,
1099 /// 2 channel, 16-bit YUV packed planar format, with 4:2:2 sampling.
1100 CU_AD_FORMAT_Y216 = 167,
1101 /// 4 channel, 8-bit YUV packed planar format, with 4:4:4 sampling.
1102 CU_AD_FORMAT_AYUV = 168,
1103 /// 10-bit YUV packed planar format, with 4:4:4 sampling.
1104 CU_AD_FORMAT_Y410 = 169,
1105 /// 4 channel, 12-bit YUV packed planar format, with 4:4:4 sampling.
1106 CU_AD_FORMAT_Y416 = 177,
1107 /// 3 channel 8-bit YUV planar format, with 4:4:4 sampling.
1108 CU_AD_FORMAT_Y444_PLANAR8 = 178,
1109 /// 3 channel 10-bit YUV planar format, with 4:4:4 sampling.
1110 CU_AD_FORMAT_Y444_PLANAR10 = 179,
1111 /// 3 channel 8-bit YUV semi-planar format, with 4:4:4 sampling.
1112 CU_AD_FORMAT_YUV444_8bit_SemiPlanar = 180,
1113 /// 3 channel 16-bit YUV semi-planar format, with 4:4:4 sampling.
1114 CU_AD_FORMAT_YUV444_16bit_SemiPlanar = 181,
1115 /// 4 channel unorm R10G10B10A2 RGB format.
1116 CU_AD_FORMAT_UNORM_INT_101010_2 = 80,
1117 /// 4 channel unsigned 8-bit YUV packed format, with 4:2:2 sampling.
1118 CU_AD_FORMAT_UINT8_PACKED_422 = 81,
1119 /// 4 channel unsigned 8-bit YUV packed format, with 4:4:4 sampling.
1120 CU_AD_FORMAT_UINT8_PACKED_444 = 82,
1121 /// 3 channel unsigned 8-bit YUV semi-planar format, with 4:2:0 sampling.
1122 CU_AD_FORMAT_UINT8_SEMIPLANAR_420 = 83,
1123 /// 3 channel unsigned 16-bit YUV semi-planar format, with 4:2:0 sampling.
1124 CU_AD_FORMAT_UINT16_SEMIPLANAR_420 = 84,
1125 /// 3 channel unsigned 8-bit YUV semi-planar format, with 4:2:2 sampling.
1126 CU_AD_FORMAT_UINT8_SEMIPLANAR_422 = 85,
1127 /// 3 channel unsigned 16-bit YUV semi-planar format, with 4:2:2 sampling.
1128 CU_AD_FORMAT_UINT16_SEMIPLANAR_422 = 86,
1129 /// 3 channel unsigned 8-bit YUV semi-planar format, with 4:4:4 sampling.
1130 CU_AD_FORMAT_UINT8_SEMIPLANAR_444 = 87,
1131 /// 3 channel unsigned 16-bit YUV semi-planar format, with 4:4:4 sampling.
1132 CU_AD_FORMAT_UINT16_SEMIPLANAR_444 = 88,
1133 /// 3 channel unsigned 8-bit YUV planar format, with 4:2:0 sampling.
1134 CU_AD_FORMAT_UINT8_PLANAR_420 = 89,
1135 /// 3 channel unsigned 16-bit YUV planar format, with 4:2:0 sampling.
1136 CU_AD_FORMAT_UINT16_PLANAR_420 = 90,
1137 /// 3 channel unsigned 8-bit YUV planar format, with 4:2:2 sampling.
1138 CU_AD_FORMAT_UINT8_PLANAR_422 = 91,
1139 /// 3 channel unsigned 16-bit YUV planar format, with 4:2:2 sampling.
1140 CU_AD_FORMAT_UINT16_PLANAR_422 = 92,
1141 /// 3 channel unsigned 8-bit YUV planar format, with 4:4:4 sampling.
1142 CU_AD_FORMAT_UINT8_PLANAR_444 = 93,
1143 /// 3 channel unsigned 16-bit YUV planar format, with 4:4:4 sampling.
1144 CU_AD_FORMAT_UINT16_PLANAR_444 = 94,
1145 CU_AD_FORMAT_MAX = 2147483647,
1146}
1147pub use self::CUarray_format_enum as CUarray_format;
1148/// Texture reference addressing modes.
1149#[repr(u32)]
1150#[derive(
1151 Debug,
1152 Copy,
1153 Clone,
1154 Hash,
1155 PartialOrd,
1156 Ord,
1157 PartialEq,
1158 Eq,
1159 TryFromPrimitive,
1160 IntoPrimitive,
1161)]
1162pub enum CUaddress_mode_enum {
1163 /// Wrapping address mode.
1164 CU_TR_ADDRESS_MODE_WRAP = 0,
1165 /// Clamp to edge address mode.
1166 CU_TR_ADDRESS_MODE_CLAMP = 1,
1167 /// Mirror address mode.
1168 CU_TR_ADDRESS_MODE_MIRROR = 2,
1169 /// Border address mode.
1170 CU_TR_ADDRESS_MODE_BORDER = 3,
1171}
1172pub use self::CUaddress_mode_enum as CUaddress_mode;
1173/// Texture reference filtering modes.
1174#[repr(u32)]
1175#[derive(
1176 Debug,
1177 Copy,
1178 Clone,
1179 Hash,
1180 PartialOrd,
1181 Ord,
1182 PartialEq,
1183 Eq,
1184 TryFromPrimitive,
1185 IntoPrimitive,
1186)]
1187pub enum CUfilter_mode_enum {
1188 /// Point filter mode.
1189 CU_TR_FILTER_MODE_POINT = 0,
1190 /// Linear filter mode.
1191 CU_TR_FILTER_MODE_LINEAR = 1,
1192}
1193pub use self::CUfilter_mode_enum as CUfilter_mode;
1194impl CUdevice_attribute_enum {
1195 pub const CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK: CUdevice_attribute_enum = CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK;
1196}
1197impl CUdevice_attribute_enum {
1198 pub const CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK: CUdevice_attribute_enum = CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK;
1199}
1200impl CUdevice_attribute_enum {
1201 pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH;
1202}
1203impl CUdevice_attribute_enum {
1204 pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT: CUdevice_attribute_enum = CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT;
1205}
1206impl CUdevice_attribute_enum {
1207 pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES: CUdevice_attribute_enum = CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS;
1208}
1209impl CUdevice_attribute_enum {
1210 pub const CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED;
1211}
1212/// Device properties.
1213#[repr(u32)]
1214#[derive(
1215 Debug,
1216 Copy,
1217 Clone,
1218 Hash,
1219 PartialOrd,
1220 Ord,
1221 PartialEq,
1222 Eq,
1223 TryFromPrimitive,
1224 IntoPrimitive,
1225)]
1226pub enum CUdevice_attribute_enum {
1227 /// Maximum number of threads per block.
1228 CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 1,
1229 /// Maximum block dimension X.
1230 CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X = 2,
1231 /// Maximum block dimension Y.
1232 CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y = 3,
1233 /// Maximum block dimension Z.
1234 CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z = 4,
1235 /// Maximum grid dimension X.
1236 CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X = 5,
1237 /// Maximum grid dimension Y.
1238 CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y = 6,
1239 /// Maximum grid dimension Z.
1240 CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z = 7,
1241 /// Maximum shared memory available per block in bytes.
1242 CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK = 8,
1243 /// Memory available on device for __constant__ variables in a CUDA C kernel in bytes.
1244 CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY = 9,
1245 /// Warp size in threads.
1246 CU_DEVICE_ATTRIBUTE_WARP_SIZE = 10,
1247 /// Maximum pitch in bytes allowed by memory copies.
1248 CU_DEVICE_ATTRIBUTE_MAX_PITCH = 11,
1249 /// Maximum number of 32-bit registers available per block.
1250 CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK = 12,
1251 /// Typical clock frequency in kilohertz.
1252 CU_DEVICE_ATTRIBUTE_CLOCK_RATE = 13,
1253 /// Alignment requirement for textures.
1254 CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT = 14,
1255 /// Device can possibly copy memory and execute a kernel concurrently. Deprecated. Use instead [`CUdevice_attribute::CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT`].
1256 #[deprecated]
1257 CU_DEVICE_ATTRIBUTE_GPU_OVERLAP = 15,
1258 /// Number of multiprocessors on device.
1259 CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT = 16,
1260 /// Specifies whether there is a run time limit on kernels.
1261 CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT = 17,
1262 /// Device is integrated with host memory.
1263 CU_DEVICE_ATTRIBUTE_INTEGRATED = 18,
1264 /// Device can map host memory into CUDA address space.
1265 CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY = 19,
1266 /// Compute mode (See `CUcomputemode` for details).
1267 CU_DEVICE_ATTRIBUTE_COMPUTE_MODE = 20,
1268 /// Maximum 1D texture width.
1269 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH = 21,
1270 /// Maximum 2D texture width.
1271 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH = 22,
1272 /// Maximum 2D texture height.
1273 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT = 23,
1274 /// Maximum 3D texture width.
1275 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH = 24,
1276 /// Maximum 3D texture height.
1277 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT = 25,
1278 /// Maximum 3D texture depth.
1279 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH = 26,
1280 /// Maximum 2D layered texture width.
1281 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH = 27,
1282 /// Maximum 2D layered texture height.
1283 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT = 28,
1284 /// Maximum layers in a 2D layered texture.
1285 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS = 29,
1286 /// Alignment requirement for surfaces.
1287 CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT = 30,
1288 /// Device can possibly execute multiple kernels concurrently.
1289 CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS = 31,
1290 /// Device has ECC support enabled.
1291 CU_DEVICE_ATTRIBUTE_ECC_ENABLED = 32,
1292 /// PCI bus ID of the device.
1293 CU_DEVICE_ATTRIBUTE_PCI_BUS_ID = 33,
1294 /// PCI device ID of the device.
1295 CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID = 34,
1296 /// Device is using TCC driver model.
1297 CU_DEVICE_ATTRIBUTE_TCC_DRIVER = 35,
1298 /// Peak memory clock frequency in kilohertz.
1299 CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE = 36,
1300 /// Global memory bus width in bits.
1301 CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH = 37,
1302 /// Size of L2 cache in bytes.
1303 CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE = 38,
1304 /// Maximum resident threads per multiprocessor.
1305 CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR = 39,
1306 /// Number of asynchronous engines.
1307 CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT = 40,
1308 /// Device shares a unified address space with the host.
1309 CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING = 41,
1310 /// Maximum 1D layered texture width.
1311 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH = 42,
1312 /// Maximum layers in a 1D layered texture.
1313 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS = 43,
1314 /// do not use.
1315 #[deprecated]
1316 CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER = 44,
1317 /// Maximum 2D texture width if CUDA_ARRAY3D_TEXTURE_GATHER is set.
1318 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH = 45,
1319 /// Maximum 2D texture height if CUDA_ARRAY3D_TEXTURE_GATHER is set.
1320 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT = 46,
1321 /// Alternate maximum 3D texture width.
1322 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE = 47,
1323 /// Alternate maximum 3D texture height.
1324 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE = 48,
1325 /// Alternate maximum 3D texture depth.
1326 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE = 49,
1327 /// PCI domain ID of the device.
1328 CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID = 50,
1329 /// Pitch alignment requirement for textures.
1330 CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT = 51,
1331 /// Maximum cubemap texture width/height.
1332 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH = 52,
1333 /// Maximum cubemap layered texture width/height.
1334 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH = 53,
1335 /// Maximum layers in a cubemap layered texture.
1336 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS = 54,
1337 /// Maximum 1D surface width.
1338 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH = 55,
1339 /// Maximum 2D surface width.
1340 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH = 56,
1341 /// Maximum 2D surface height.
1342 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT = 57,
1343 /// Maximum 3D surface width.
1344 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH = 58,
1345 /// Maximum 3D surface height.
1346 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT = 59,
1347 /// Maximum 3D surface depth.
1348 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH = 60,
1349 /// Maximum 1D layered surface width.
1350 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH = 61,
1351 /// Maximum layers in a 1D layered surface.
1352 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS = 62,
1353 /// Maximum 2D layered surface width.
1354 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH = 63,
1355 /// Maximum 2D layered surface height.
1356 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT = 64,
1357 /// Maximum layers in a 2D layered surface.
1358 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS = 65,
1359 /// Maximum cubemap surface width.
1360 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH = 66,
1361 /// Maximum cubemap layered surface width.
1362 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH = 67,
1363 /// Maximum layers in a cubemap layered surface.
1364 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS = 68,
1365 /// do not use. Use [cudaDeviceGetTexture1DLinearMaxWidth()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g45f0345fd7a3697d0766596593920f61) or [`cuDeviceGetTexture1DLinearMaxWidth`] instead.
1366 #[deprecated]
1367 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH = 69,
1368 /// Maximum 2D linear texture width.
1369 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH = 70,
1370 /// Maximum 2D linear texture height.
1371 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT = 71,
1372 /// Maximum 2D linear texture pitch in bytes.
1373 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH = 72,
1374 /// Maximum mipmapped 2D texture width.
1375 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH = 73,
1376 /// Maximum mipmapped 2D texture height.
1377 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT = 74,
1378 /// Major compute capability version number.
1379 CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = 75,
1380 /// Minor compute capability version number.
1381 CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR = 76,
1382 /// Maximum mipmapped 1D texture width.
1383 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH = 77,
1384 /// Device supports stream priorities.
1385 CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED = 78,
1386 /// Device supports caching globals in L1.
1387 CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED = 79,
1388 /// Device supports caching locals in L1.
1389 CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED = 80,
1390 /// Maximum shared memory available per multiprocessor in bytes.
1391 CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR = 81,
1392 /// Maximum number of 32-bit registers available per multiprocessor.
1393 CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR = 82,
1394 /// Device can allocate managed memory on this system.
1395 CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY = 83,
1396 /// Device is on a multi-GPU board.
1397 CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD = 84,
1398 /// Unique id for a group of devices on the same multi-GPU board.
1399 CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID = 85,
1400 /// Link between the device and the host supports all native atomic operations.
1401 CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED = 86,
1402 /// Ratio of single precision performance (in floating-point operations per second) to double precision performance.
1403 CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO = 87,
1404 /// Device supports coherently accessing pageable memory without calling cudaHostRegister on it.
1405 CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS = 88,
1406 /// Device can coherently access managed memory concurrently with the CPU.
1407 CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS = 89,
1408 /// Device supports compute preemption.
1409 CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED = 90,
1410 /// Device can access host registered memory at the same virtual address as the CPU.
1411 CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM = 91,
1412 /// along with v1 MemOps API, [`cuStreamBatchMemOp_v2`] and related APIs are supported.
1413 #[deprecated]
1414 CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_MEM_OPS_V1 = 92,
1415 /// along with v1 MemOps API, 64-bit operations are supported in [`cuStreamBatchMemOp_v2`] and related APIs.
1416 #[deprecated]
1417 CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS_V1 = 93,
1418 /// along with v1 MemOps API, CU_STREAM_WAIT_VALUE_NOR is supported.
1419 #[deprecated]
1420 CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR_V1 = 94,
1421 /// Device supports launching cooperative kernels via [`cuLaunchCooperativeKernel`].
1422 CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH = 95,
1423 /// [`cuLaunchCooperativeKernelMultiDevice`] is deprecated.
1424 #[deprecated]
1425 CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH = 96,
1426 /// Maximum optin shared memory per block. That is shared memory that is available for dynamic allocation or static allocation
1427 /// (including architecture specific static shared memory) on this device but is not guaranteed to be portable.
1428 CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN = 97,
1429 /// The CU_STREAM_WAIT_VALUE_FLUSH flag and the CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES MemOp are supported on the device. See [Stream Memory Operations](https://docs.nvidia.com/cuda/cuda-driver-api/stream-memory-operations.html#group__CUDA__MEMOP) for additional details.
1430 CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES = 98,
1431 /// Device supports host memory registration via [cudaHostRegister](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1ge8d5c17670f16ac4fc8fcb4181cb490c).
1432 CU_DEVICE_ATTRIBUTE_HOST_REGISTER_SUPPORTED = 99,
1433 /// Device accesses pageable memory via the host's page tables.
1434 CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES = 100,
1435 /// The host can directly access managed memory on the device without migration.
1436 CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST = 101,
1437 /// Use [`CUdevice_attribute::CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED`].
1438 #[deprecated]
1439 CU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED = 102,
1440 /// Device supports exporting memory to a posix file descriptor with [`cuMemExportToShareableHandle`], if requested via [`cuMemCreate`].
1441 CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR_SUPPORTED = 103,
1442 /// Device supports exporting memory to a Win32 NT handle with [`cuMemExportToShareableHandle`], if requested via [`cuMemCreate`].
1443 CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_HANDLE_SUPPORTED = 104,
1444 /// Device supports exporting memory to a Win32 KMT handle with [`cuMemExportToShareableHandle`], if requested via [`cuMemCreate`].
1445 CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_KMT_HANDLE_SUPPORTED = 105,
1446 /// Maximum number of blocks per multiprocessor.
1447 CU_DEVICE_ATTRIBUTE_MAX_BLOCKS_PER_MULTIPROCESSOR = 106,
1448 /// Device supports compression of memory.
1449 CU_DEVICE_ATTRIBUTE_GENERIC_COMPRESSION_SUPPORTED = 107,
1450 /// Maximum L2 persisting lines capacity setting in bytes.
1451 CU_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE = 108,
1452 /// Maximum value of [CUaccessPolicyWindow::num_bytes](https://docs.nvidia.com/cuda/cuda-driver-api/structCUaccessPolicyWindow__v1.html#structCUaccessPolicyWindow__v1_179ee4c983788bc68605d42aee2701eec).
1453 CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE = 109,
1454 /// Device supports specifying the GPUDirect RDMA flag with [`cuMemCreate`].
1455 CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_CUDA_VMM_SUPPORTED = 110,
1456 /// Shared memory reserved by CUDA driver per block in bytes.
1457 CU_DEVICE_ATTRIBUTE_RESERVED_SHARED_MEMORY_PER_BLOCK = 111,
1458 /// Device supports sparse CUDA arrays and sparse CUDA mipmapped arrays.
1459 CU_DEVICE_ATTRIBUTE_SPARSE_CUDA_ARRAY_SUPPORTED = 112,
1460 /// Device supports using the [`cuMemHostRegister_v2`] flag CU_MEMHOSTERGISTER_READ_ONLY to register memory that must be mapped as read-only to the GPU.
1461 CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED = 113,
1462 /// External timeline semaphore interop is supported on the device.
1463 CU_DEVICE_ATTRIBUTE_TIMELINE_SEMAPHORE_INTEROP_SUPPORTED = 114,
1464 /// Device supports using the [`cuMemAllocAsync`] and cuMemPool family of APIs.
1465 CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED = 115,
1466 /// Device supports GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see <https://docs.nvidia.com/cuda/gpudirect-rdma> for more information).
1467 CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_SUPPORTED = 116,
1468 /// The returned attribute shall be interpreted as a bitmask, where the individual bits are described by the `CUflushGPUDirectRDMAWritesOptions` enum.
1469 CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS = 117,
1470 /// GPUDirect RDMA writes to the device do not need to be flushed for consumers within the scope indicated by the returned attribute.
1471 /// See `CUGPUDirectRDMAWritesOrdering` for the numerical values returned here.
1472 CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING = 118,
1473 /// Handle types supported with mempool based IPC.
1474 CU_DEVICE_ATTRIBUTE_MEMPOOL_SUPPORTED_HANDLE_TYPES = 119,
1475 /// Indicates device supports cluster launch.
1476 CU_DEVICE_ATTRIBUTE_CLUSTER_LAUNCH = 120,
1477 /// Device supports deferred mapping CUDA arrays and CUDA mipmapped arrays.
1478 CU_DEVICE_ATTRIBUTE_DEFERRED_MAPPING_CUDA_ARRAY_SUPPORTED = 121,
1479 /// 64-bit operations are supported in [`cuStreamBatchMemOp_v2`] and related MemOp APIs.
1480 CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS = 122,
1481 /// CU_STREAM_WAIT_VALUE_NOR is supported by MemOp APIs.
1482 CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR = 123,
1483 /// Device supports buffer sharing with dma_buf mechanism.
1484 CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED = 124,
1485 /// Device supports IPC Events.
1486 CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED = 125,
1487 /// Number of memory domains the device supports.
1488 CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT = 126,
1489 /// Device supports accessing memory using Tensor Map.
1490 CU_DEVICE_ATTRIBUTE_TENSOR_MAP_ACCESS_SUPPORTED = 127,
1491 /// Device supports exporting memory to a fabric handle with [`cuMemExportToShareableHandle`] or requested with [`cuMemCreate`].
1492 CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_FABRIC_SUPPORTED = 128,
1493 /// Device supports unified function pointers.
1494 CU_DEVICE_ATTRIBUTE_UNIFIED_FUNCTION_POINTERS = 129,
1495 /// NUMA configuration of a device: value is of type `CUdeviceNumaConfig` enum.
1496 CU_DEVICE_ATTRIBUTE_NUMA_CONFIG = 130,
1497 /// NUMA node ID of the GPU memory.
1498 CU_DEVICE_ATTRIBUTE_NUMA_ID = 131,
1499 /// Device supports switch multicast and reduction operations.
1500 CU_DEVICE_ATTRIBUTE_MULTICAST_SUPPORTED = 132,
1501 /// Indicates if contexts created on this device will be shared via MPS.
1502 CU_DEVICE_ATTRIBUTE_MPS_ENABLED = 133,
1503 /// NUMA ID of the host node closest to the device. Returns -1 when system does not support NUMA.
1504 CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID = 134,
1505 /// Device supports CIG with D3D12.
1506 CU_DEVICE_ATTRIBUTE_D3D12_CIG_SUPPORTED = 135,
1507 /// The returned valued shall be interpreted as a bitmask, where the individual bits are described by the `CUmemDecompressAlgorithm` enum.
1508 CU_DEVICE_ATTRIBUTE_MEM_DECOMPRESS_ALGORITHM_MASK = 136,
1509 /// The returned valued is the maximum length in bytes of a single decompress operation that is allowed.
1510 CU_DEVICE_ATTRIBUTE_MEM_DECOMPRESS_MAXIMUM_LENGTH = 137,
1511 /// Device supports CIG with Vulkan.
1512 CU_DEVICE_ATTRIBUTE_VULKAN_CIG_SUPPORTED = 138,
1513 /// The combined 16-bit PCI device ID and 16-bit PCI vendor ID.
1514 CU_DEVICE_ATTRIBUTE_GPU_PCI_DEVICE_ID = 139,
1515 /// The combined 16-bit PCI subsystem ID and 16-bit PCI subsystem vendor ID.
1516 CU_DEVICE_ATTRIBUTE_GPU_PCI_SUBSYSTEM_ID = 140,
1517 /// Device supports HOST_NUMA location with the virtual memory management APIs like [`cuMemCreate`], [`cuMemMap`] and related APIs.
1518 CU_DEVICE_ATTRIBUTE_HOST_NUMA_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED = 141,
1519 /// Device supports HOST_NUMA location with the [`cuMemAllocAsync`] and cuMemPool family of APIs.
1520 CU_DEVICE_ATTRIBUTE_HOST_NUMA_MEMORY_POOLS_SUPPORTED = 142,
1521 /// Device supports HOST_NUMA location IPC between nodes in a multi-node system.
1522 CU_DEVICE_ATTRIBUTE_HOST_NUMA_MULTINODE_IPC_SUPPORTED = 143,
1523 /// Device suports HOST location with the [`cuMemAllocAsync`] and cuMemPool family of APIs.
1524 CU_DEVICE_ATTRIBUTE_HOST_MEMORY_POOLS_SUPPORTED = 144,
1525 /// Device supports HOST location with the virtual memory management APIs like [`cuMemCreate`], [`cuMemMap`] and related APIs.
1526 CU_DEVICE_ATTRIBUTE_HOST_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED = 145,
1527 /// Device supports page-locked host memory buffer sharing with dma_buf mechanism.
1528 CU_DEVICE_ATTRIBUTE_HOST_ALLOC_DMA_BUF_SUPPORTED = 146,
1529 /// Link between the device and the host supports only some native atomic operations.
1530 CU_DEVICE_ATTRIBUTE_ONLY_PARTIAL_HOST_NATIVE_ATOMIC_SUPPORTED = 147,
1531 /// Device supports atomic reduction operations in stream batch memory operations.
1532 CU_DEVICE_ATTRIBUTE_ATOMIC_REDUCTION_SUPPORTED = 148,
1533 /// Device supports CIG streams with D3D12.
1534 CU_DEVICE_ATTRIBUTE_D3D12_CIG_STREAMS_SUPPORTED = 151,
1535 /// Device supports mmap() of dmabuf file descriptors for CUDA device memory allocations.
1536 CU_DEVICE_ATTRIBUTE_DMA_BUF_MMAP_SUPPORTED = 152,
1537 /// Device supports unicast logical endpoints.
1538 CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_UNICAST_SUPPORTED = 153,
1539 /// Device supports multicast logical endpoints.
1540 CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_MULTICAST_SUPPORTED = 154,
1541 /// Device supports counted operations via logical endpoints.
1542 CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_COUNTED_OPS_SUPPORTED = 155,
1543 /// Device supports unicast logical endpoint access on the owner device.
1544 CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_UNICAST_ACCESS_ON_OWNER_DEVICE_SUPPORTED = 156,
1545 CU_DEVICE_ATTRIBUTE_MAX = 157,
1546}
1547pub use self::CUdevice_attribute_enum as CUdevice_attribute;
1548#[repr(C)]
1549#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1550pub struct CUdevprop_st {
1551 pub maxThreadsPerBlock: ::core::ffi::c_int,
1552 pub maxThreadsDim: [::core::ffi::c_int; 3usize],
1553 pub maxGridSize: [::core::ffi::c_int; 3usize],
1554 pub sharedMemPerBlock: ::core::ffi::c_int,
1555 pub totalConstantMemory: ::core::ffi::c_int,
1556 pub SIMDWidth: ::core::ffi::c_int,
1557 pub memPitch: ::core::ffi::c_int,
1558 pub regsPerBlock: ::core::ffi::c_int,
1559 pub clockRate: ::core::ffi::c_int,
1560 pub textureAlign: ::core::ffi::c_int,
1561}
1562/// Legacy device properties.
1563pub type CUdevprop_v1 = CUdevprop_st;
1564pub type CUdevprop = CUdevprop_v1;
1565/// Pointer information.
1566#[repr(u32)]
1567#[derive(
1568 Debug,
1569 Copy,
1570 Clone,
1571 Hash,
1572 PartialOrd,
1573 Ord,
1574 PartialEq,
1575 Eq,
1576 TryFromPrimitive,
1577 IntoPrimitive,
1578)]
1579pub enum CUpointer_attribute_enum {
1580 /// The [`CUcontext`] on which a pointer was allocated or registered.
1581 CU_POINTER_ATTRIBUTE_CONTEXT = 1,
1582 /// The `CUmemorytype` describing the physical location of a pointer.
1583 CU_POINTER_ATTRIBUTE_MEMORY_TYPE = 2,
1584 /// The address at which a pointer's memory may be accessed on the device.
1585 CU_POINTER_ATTRIBUTE_DEVICE_POINTER = 3,
1586 /// The address at which a pointer's memory may be accessed on the host.
1587 CU_POINTER_ATTRIBUTE_HOST_POINTER = 4,
1588 /// A pair of tokens for use with the nv-p2p.h Linux kernel interface.
1589 CU_POINTER_ATTRIBUTE_P2P_TOKENS = 5,
1590 /// Synchronize every synchronous memory operation initiated on this region.
1591 CU_POINTER_ATTRIBUTE_SYNC_MEMOPS = 6,
1592 /// A process-wide unique ID for an allocated memory region.
1593 CU_POINTER_ATTRIBUTE_BUFFER_ID = 7,
1594 /// Indicates if the pointer points to managed memory.
1595 CU_POINTER_ATTRIBUTE_IS_MANAGED = 8,
1596 /// A device ordinal of a device on which a pointer was allocated or registered.
1597 CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL = 9,
1598 /// 1 if this pointer maps to an allocation that is suitable for [cudaIpcGetMemHandle](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g8a37f7dfafaca652391d0758b3667539), 0 otherwise.
1599 CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE = 10,
1600 /// Starting address for this requested pointer.
1601 CU_POINTER_ATTRIBUTE_RANGE_START_ADDR = 11,
1602 /// Size of the address range for this requested pointer.
1603 CU_POINTER_ATTRIBUTE_RANGE_SIZE = 12,
1604 /// 1 if this pointer is in a valid address range that is mapped to a backing allocation, 0 otherwise.
1605 CU_POINTER_ATTRIBUTE_MAPPED = 13,
1606 /// Bitmask of allowed `CUmemAllocationHandleType` for this allocation.
1607 CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES = 14,
1608 /// 1 if the memory this pointer is referencing can be used with the GPUDirect RDMA API.
1609 CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE = 15,
1610 /// Returns the access flags the device associated with the current context has on the corresponding memory referenced by the
1611 /// pointer given.
1612 CU_POINTER_ATTRIBUTE_ACCESS_FLAGS = 16,
1613 /// Returns the mempool handle for the allocation if it was allocated from a mempool. Otherwise returns NULL.
1614 CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE = 17,
1615 /// Size of the actual underlying mapping that the pointer belongs to.
1616 CU_POINTER_ATTRIBUTE_MAPPING_SIZE = 18,
1617 /// The start address of the mapping that the pointer belongs to.
1618 CU_POINTER_ATTRIBUTE_MAPPING_BASE_ADDR = 19,
1619 /// A process-wide unique id corresponding to the physical allocation the pointer belongs to.
1620 CU_POINTER_ATTRIBUTE_MEMORY_BLOCK_ID = 20,
1621 /// Returns in \*data a boolean that indicates whether the pointer points to memory that is capable to be used for hardware accelerated decompression.
1622 CU_POINTER_ATTRIBUTE_IS_HW_DECOMPRESS_CAPABLE = 21,
1623}
1624pub use self::CUpointer_attribute_enum as CUpointer_attribute;
1625/// Function properties.
1626#[repr(u32)]
1627#[derive(
1628 Debug,
1629 Copy,
1630 Clone,
1631 Hash,
1632 PartialOrd,
1633 Ord,
1634 PartialEq,
1635 Eq,
1636 TryFromPrimitive,
1637 IntoPrimitive,
1638)]
1639pub enum CUfunction_attribute_enum {
1640 /// The maximum number of threads per block, beyond which a launch of the function would fail. This number depends on both the
1641 /// function and the device on which the function is currently loaded.
1642 CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 0,
1643 /// The size in bytes of statically-allocated shared memory required by this function. This does not include dynamically-allocated
1644 /// shared memory requested by the user at runtime.
1645 CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES = 1,
1646 /// The size in bytes of user-allocated constant memory required by this function.
1647 CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES = 2,
1648 /// The size in bytes of local memory used by each thread of this function.
1649 CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES = 3,
1650 /// The number of registers used by each thread of this function.
1651 CU_FUNC_ATTRIBUTE_NUM_REGS = 4,
1652 /// The PTX virtual architecture version for which the function was compiled. This value is the major PTX version \* 10 + the minor
1653 /// PTX version, so a PTX version 1.3 function would return the value 13. Note that this may return the undefined value of 0 for
1654 /// cubins compiled prior to CUDA 3.0.
1655 CU_FUNC_ATTRIBUTE_PTX_VERSION = 5,
1656 /// The binary architecture version for which the function was compiled. This value is the major binary version \* 10 + the minor
1657 /// binary version, so a binary version 1.3 function would return the value 13. Note that this will return a value of 10 for legacy
1658 /// cubins that do not have a properly-encoded binary architecture version.
1659 CU_FUNC_ATTRIBUTE_BINARY_VERSION = 6,
1660 /// The attribute to indicate whether the function has been compiled with user specified option "-Xptxas --dlcm=ca" set .
1661 CU_FUNC_ATTRIBUTE_CACHE_MODE_CA = 7,
1662 /// The maximum size in bytes of dynamically-allocated shared memory that can be used by this function. If the user-specified
1663 /// dynamic shared memory size is larger than this value, the launch will fail. The default value of this attribute is CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK - CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES, except when CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES is greater than CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK, then the default value of this attribute is 0. The value can be increased to CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN - CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES. See [`cuFuncSetAttribute`], [`cuKernelSetAttribute`].
1664 CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES = 8,
1665 /// On devices where the L1 cache and shared memory use the same hardware resources, this sets the shared memory carveout preference,
1666 /// in percent of the total shared memory. Refer to CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR. This is only a hint, and the driver can choose a different ratio if required to execute the function. See [`cuFuncSetAttribute`], [`cuKernelSetAttribute`].
1667 CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = 9,
1668 /// If this attribute is set, the kernel must launch with a valid cluster size specified. See [`cuFuncSetAttribute`], [`cuKernelSetAttribute`].
1669 CU_FUNC_ATTRIBUTE_CLUSTER_SIZE_MUST_BE_SET = 10,
1670 /// The required cluster width in blocks. The values must either all be 0 or all be positive. The validity of the cluster dimensions
1671 /// is otherwise checked at launch time.If the value is set during compile time, it cannot be set at runtime. Setting it at runtime
1672 /// will return [`CUresult::CUDA_ERROR_NOT_PERMITTED`]. See [`cuFuncSetAttribute`], [`cuKernelSetAttribute`].
1673 CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH = 11,
1674 /// The required cluster height in blocks. The values must either all be 0 or all be positive. The validity of the cluster dimensions
1675 /// is otherwise checked at launch time.If the value is set during compile time, it cannot be set at runtime. Setting it at runtime
1676 /// should return [`CUresult::CUDA_ERROR_NOT_PERMITTED`]. See [`cuFuncSetAttribute`], [`cuKernelSetAttribute`].
1677 CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT = 12,
1678 /// The required cluster depth in blocks. The values must either all be 0 or all be positive. The validity of the cluster dimensions
1679 /// is otherwise checked at launch time.If the value is set during compile time, it cannot be set at runtime. Setting it at runtime
1680 /// should return [`CUresult::CUDA_ERROR_NOT_PERMITTED`]. See [`cuFuncSetAttribute`], [`cuKernelSetAttribute`].
1681 CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH = 13,
1682 /// Whether the function can be launched with non-portable cluster size. 1 is allowed, 0 is disallowed. A non-portable cluster
1683 /// size may only function on the specific SKUs the program is tested on. The launch might fail if the program is run on a different
1684 /// hardware platform.CUDA API provides cudaOccupancyMaxActiveClusters to assist with checking whether the desired size can be
1685 /// launched on the current device.Portable Cluster SizeA portable cluster size is guaranteed to be functional on all compute
1686 /// capabilities higher than the target compute capability. The portable cluster size for sm_90 is 8 blocks per cluster. This
1687 /// value may increase for future compute capabilities.The specific hardware unit may support higher cluster sizes that’s not
1688 /// guaranteed to be portable. See [`cuFuncSetAttribute`], [`cuKernelSetAttribute`].
1689 CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED = 14,
1690 /// The block scheduling policy of a function. The value type is CUclusterSchedulingPolicy / cudaClusterSchedulingPolicy. See
1691 /// [`cuFuncSetAttribute`], [`cuKernelSetAttribute`].
1692 CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = 15,
1693 /// Whether the function can be updated on device. 1 means device node update is supported, 0 is unsupported. See [`cuFuncGetAttribute`].
1694 CU_FUNC_ATTRIBUTE_DEVICE_NODE_UPDATE_SUPPORTED = 16,
1695 CU_FUNC_ATTRIBUTE_MAX = 17,
1696}
1697pub use self::CUfunction_attribute_enum as CUfunction_attribute;
1698/// Function cache configurations.
1699#[repr(u32)]
1700#[derive(
1701 Debug,
1702 Copy,
1703 Clone,
1704 Hash,
1705 PartialOrd,
1706 Ord,
1707 PartialEq,
1708 Eq,
1709 TryFromPrimitive,
1710 IntoPrimitive,
1711)]
1712pub enum CUfunc_cache_enum {
1713 /// no preference for shared memory or L1 (default).
1714 CU_FUNC_CACHE_PREFER_NONE = 0,
1715 /// prefer larger shared memory and smaller L1 cache.
1716 CU_FUNC_CACHE_PREFER_SHARED = 1,
1717 /// prefer larger L1 cache and smaller shared memory.
1718 CU_FUNC_CACHE_PREFER_L1 = 2,
1719 /// prefer equal sized L1 cache and shared memory.
1720 CU_FUNC_CACHE_PREFER_EQUAL = 3,
1721}
1722pub use self::CUfunc_cache_enum as CUfunc_cache;
1723/// Shared memory configurations.
1724#[deprecated]
1725#[repr(u32)]
1726#[derive(
1727 Debug,
1728 Copy,
1729 Clone,
1730 Hash,
1731 PartialOrd,
1732 Ord,
1733 PartialEq,
1734 Eq,
1735 TryFromPrimitive,
1736 IntoPrimitive,
1737)]
1738pub enum CUsharedconfig_enum {
1739 /// set default shared memory bank size.
1740 #[deprecated]
1741 CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE = 0,
1742 /// set shared memory bank width to four bytes.
1743 #[deprecated]
1744 CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE = 1,
1745 /// set shared memory bank width to eight bytes.
1746 #[deprecated]
1747 CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE = 2,
1748}
1749pub use self::CUsharedconfig_enum as CUsharedconfig;
1750/// Shared memory carveout configurations. These may be passed to [`cuFuncSetAttribute`] or [`cuKernelSetAttribute`].
1751#[repr(i32)]
1752#[derive(
1753 Debug,
1754 Copy,
1755 Clone,
1756 Hash,
1757 PartialOrd,
1758 Ord,
1759 PartialEq,
1760 Eq,
1761 TryFromPrimitive,
1762 IntoPrimitive,
1763)]
1764pub enum CUshared_carveout_enum {
1765 /// No preference for shared memory or L1 (default).
1766 CU_SHAREDMEM_CARVEOUT_DEFAULT = -1,
1767 /// Prefer maximum available shared memory, minimum L1 cache.
1768 CU_SHAREDMEM_CARVEOUT_MAX_SHARED = 100,
1769 /// Prefer maximum available L1 cache, minimum shared memory.
1770 CU_SHAREDMEM_CARVEOUT_MAX_L1 = 0,
1771}
1772pub use self::CUshared_carveout_enum as CUshared_carveout;
1773/// Memory types.
1774#[repr(u32)]
1775#[derive(
1776 Debug,
1777 Copy,
1778 Clone,
1779 Hash,
1780 PartialOrd,
1781 Ord,
1782 PartialEq,
1783 Eq,
1784 TryFromPrimitive,
1785 IntoPrimitive,
1786)]
1787pub enum CUmemorytype_enum {
1788 /// Host memory.
1789 CU_MEMORYTYPE_HOST = 1,
1790 /// Device memory.
1791 CU_MEMORYTYPE_DEVICE = 2,
1792 /// Array memory.
1793 CU_MEMORYTYPE_ARRAY = 3,
1794 /// Unified device or host memory.
1795 CU_MEMORYTYPE_UNIFIED = 4,
1796}
1797pub use self::CUmemorytype_enum as CUmemorytype;
1798/// Compute Modes.
1799#[repr(u32)]
1800#[derive(
1801 Debug,
1802 Copy,
1803 Clone,
1804 Hash,
1805 PartialOrd,
1806 Ord,
1807 PartialEq,
1808 Eq,
1809 TryFromPrimitive,
1810 IntoPrimitive,
1811)]
1812pub enum CUcomputemode_enum {
1813 /// Default compute mode (Multiple contexts allowed per device).
1814 CU_COMPUTEMODE_DEFAULT = 0,
1815 /// Compute-prohibited mode (No contexts can be created on this device at this time).
1816 CU_COMPUTEMODE_PROHIBITED = 2,
1817 /// Compute-exclusive-process mode (Only one context used by a single process can be present on this device at a time).
1818 CU_COMPUTEMODE_EXCLUSIVE_PROCESS = 3,
1819}
1820pub use self::CUcomputemode_enum as CUcomputemode;
1821/// Memory advise values.
1822#[repr(u32)]
1823#[derive(
1824 Debug,
1825 Copy,
1826 Clone,
1827 Hash,
1828 PartialOrd,
1829 Ord,
1830 PartialEq,
1831 Eq,
1832 TryFromPrimitive,
1833 IntoPrimitive,
1834)]
1835pub enum CUmem_advise_enum {
1836 /// Data will mostly be read and only occasionally be written to.
1837 CU_MEM_ADVISE_SET_READ_MOSTLY = 1,
1838 /// Undo the effect of CU_MEM_ADVISE_SET_READ_MOSTLY.
1839 CU_MEM_ADVISE_UNSET_READ_MOSTLY = 2,
1840 /// Set the preferred location for the data as the specified device.
1841 CU_MEM_ADVISE_SET_PREFERRED_LOCATION = 3,
1842 /// Clear the preferred location for the data.
1843 CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION = 4,
1844 /// Data will be accessed by the specified device, so prevent page faults as much as possible.
1845 CU_MEM_ADVISE_SET_ACCESSED_BY = 5,
1846 /// Let the Unified Memory subsystem decide on the page faulting policy for the specified device.
1847 CU_MEM_ADVISE_UNSET_ACCESSED_BY = 6,
1848}
1849pub use self::CUmem_advise_enum as CUmem_advise;
1850#[repr(u32)]
1851#[derive(
1852 Debug,
1853 Copy,
1854 Clone,
1855 Hash,
1856 PartialOrd,
1857 Ord,
1858 PartialEq,
1859 Eq,
1860 TryFromPrimitive,
1861 IntoPrimitive,
1862)]
1863pub enum CUmem_range_attribute_enum {
1864 CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY = 1,
1865 CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION = 2,
1866 CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY = 3,
1867 CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION = 4,
1868 CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE = 5,
1869 CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID = 6,
1870 CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE = 7,
1871 CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_ID = 8,
1872}
1873pub use self::CUmem_range_attribute_enum as CUmem_range_attribute;
1874/// Online compiler and linker options.
1875#[repr(u32)]
1876#[derive(
1877 Debug,
1878 Copy,
1879 Clone,
1880 Hash,
1881 PartialOrd,
1882 Ord,
1883 PartialEq,
1884 Eq,
1885 TryFromPrimitive,
1886 IntoPrimitive,
1887)]
1888pub enum CUjit_option_enum {
1889 /// Max number of registers that a thread may use.
1890 /// Option type: unsigned int
1891 /// Applies to: compiler only.
1892 CU_JIT_MAX_REGISTERS = 0,
1893 /// IN: Specifies minimum number of threads per block to target compilation for
1894 /// OUT: Returns the number of threads the compiler actually targeted. This restricts the resource utilization of the compiler
1895 /// (e.g. max registers) such that a block with the given number of threads should be able to launch based on register limitations.
1896 /// Note, this option does not currently take into account any other resource limitations, such as shared memory utilization.
1897 /// Cannot be combined with CU_JIT_TARGET.
1898 /// Option type: unsigned int
1899 /// Applies to: compiler only.
1900 CU_JIT_THREADS_PER_BLOCK = 1,
1901 /// Overwrites the option value with the total wall clock time, in milliseconds, spent in the compiler and linker
1902 /// Option type: float
1903 /// Applies to: compiler and linker.
1904 CU_JIT_WALL_TIME = 2,
1905 /// Pointer to a buffer in which to print any log messages that are informational in nature (the buffer size is specified via
1906 /// option CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES)
1907 /// Option type: char \*
1908 /// Applies to: compiler and linker.
1909 CU_JIT_INFO_LOG_BUFFER = 3,
1910 /// IN: Log buffer size in bytes. Log messages will be capped at this size (including null terminator)
1911 /// OUT: Amount of log buffer filled with messages
1912 /// Option type: unsigned int
1913 /// Applies to: compiler and linker.
1914 CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES = 4,
1915 /// Pointer to a buffer in which to print any log messages that reflect errors (the buffer size is specified via option CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES)
1916 /// Option type: char \*
1917 /// Applies to: compiler and linker.
1918 CU_JIT_ERROR_LOG_BUFFER = 5,
1919 /// IN: Log buffer size in bytes. Log messages will be capped at this size (including null terminator)
1920 /// OUT: Amount of log buffer filled with messages
1921 /// Option type: unsigned int
1922 /// Applies to: compiler and linker.
1923 CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES = 6,
1924 /// Level of optimizations to apply to generated code (0 - 4), with 4 being the default and highest level of optimizations.
1925 /// Option type: unsigned int
1926 /// Applies to: compiler only.
1927 CU_JIT_OPTIMIZATION_LEVEL = 7,
1928 /// No option value required. Determines the target based on the current attached context (default)
1929 /// Option type: No option value needed
1930 /// Applies to: compiler and linker.
1931 CU_JIT_TARGET_FROM_CUCONTEXT = 8,
1932 /// Target is chosen based on supplied `CUjit_target`. Cannot be combined with CU_JIT_THREADS_PER_BLOCK.
1933 /// Option type: unsigned int for enumerated type `CUjit_target`
1934 /// Applies to: compiler and linker.
1935 CU_JIT_TARGET = 9,
1936 /// Specifies choice of fallback strategy if matching cubin is not found. Choice is based on supplied `CUjit_fallback`. This option cannot be used with cuLink\* APIs as the linker requires exact matches.
1937 /// Option type: unsigned int for enumerated type `CUjit_fallback`
1938 /// Applies to: compiler only.
1939 CU_JIT_FALLBACK_STRATEGY = 10,
1940 /// Specifies whether to create debug information in output (-g) (0: false, default)
1941 /// Option type: int
1942 /// Applies to: compiler and linker.
1943 CU_JIT_GENERATE_DEBUG_INFO = 11,
1944 /// Generate verbose log messages (0: false, default)
1945 /// Option type: int
1946 /// Applies to: compiler and linker.
1947 CU_JIT_LOG_VERBOSE = 12,
1948 /// Generate line number information (-lineinfo) (0: false, default)
1949 /// Option type: int
1950 /// Applies to: compiler only.
1951 CU_JIT_GENERATE_LINE_INFO = 13,
1952 /// Specifies whether to enable caching explicitly (-dlcm)
1953 /// Choice is based on supplied CUjit_cacheMode_enum.
1954 /// Option type: unsigned int for enumerated type CUjit_cacheMode_enum
1955 /// Applies to: compiler only.
1956 CU_JIT_CACHE_MODE = 14,
1957 #[deprecated]
1958 CU_JIT_NEW_SM3X_OPT = 15,
1959 /// This jit option is used for internal purpose only.
1960 CU_JIT_FAST_COMPILE = 16,
1961 /// Array of device symbol names that will be relocated to the corresponding host addresses stored in CU_JIT_GLOBAL_SYMBOL_ADDRESSES.
1962 /// Must contain CU_JIT_GLOBAL_SYMBOL_COUNT entries.
1963 /// When loading a device module, driver will relocate all encountered unresolved symbols to the host addresses.
1964 /// It is only allowed to register symbols that correspond to unresolved global variables.
1965 /// It is illegal to register the same device symbol at multiple addresses.
1966 /// Option type: const char \*\*
1967 /// Applies to: dynamic linker only.
1968 CU_JIT_GLOBAL_SYMBOL_NAMES = 17,
1969 /// Array of host addresses that will be used to relocate corresponding device symbols stored in CU_JIT_GLOBAL_SYMBOL_NAMES.
1970 /// Must contain CU_JIT_GLOBAL_SYMBOL_COUNT entries.
1971 /// Option type: void \*\*
1972 /// Applies to: dynamic linker only.
1973 CU_JIT_GLOBAL_SYMBOL_ADDRESSES = 18,
1974 /// Number of entries in CU_JIT_GLOBAL_SYMBOL_NAMES and CU_JIT_GLOBAL_SYMBOL_ADDRESSES arrays.
1975 /// Option type: unsigned int
1976 /// Applies to: dynamic linker only.
1977 CU_JIT_GLOBAL_SYMBOL_COUNT = 19,
1978 /// Enable link-time optimization (-dlto) for device code (Disabled by default).
1979 /// This option is not supported on 32-bit platforms.
1980 /// Option type: int
1981 /// Applies to: compiler and linker
1982 ///
1983 /// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
1984 #[deprecated]
1985 CU_JIT_LTO = 20,
1986 /// Control single-precision denormals (-ftz) support (0: false, default). 1 : flushes denormal values to zero 0 : preserves denormal
1987 /// values Option type: int
1988 /// Applies to: link-time optimization specified with [`CUjit_option::CU_JIT_LTO`]
1989 ///
1990 /// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
1991 #[deprecated]
1992 CU_JIT_FTZ = 21,
1993 /// Control single-precision floating-point division and reciprocals (-prec-div) support (1: true, default). 1 : Enables the IEEE
1994 /// round-to-nearest mode 0 : Enables the fast approximation mode Option type: int
1995 /// Applies to: link-time optimization specified with [`CUjit_option::CU_JIT_LTO`]
1996 ///
1997 /// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
1998 #[deprecated]
1999 CU_JIT_PREC_DIV = 22,
2000 /// Control single-precision floating-point square root (-prec-sqrt) support (1: true, default). 1 : Enables the IEEE round-to-nearest
2001 /// mode 0 : Enables the fast approximation mode Option type: int
2002 /// Applies to: link-time optimization specified with [`CUjit_option::CU_JIT_LTO`]
2003 ///
2004 /// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
2005 #[deprecated]
2006 CU_JIT_PREC_SQRT = 23,
2007 /// Enable/Disable the contraction of floating-point multiplies and adds/subtracts into floating-point multiply-add (-fma) operations
2008 /// ```text
2009 /// (1: Enable, default; 0: Disable). Option type: int
2010 /// Applies to: link-time optimization specified with [`CUjit_option::CU_JIT_LTO`]
2011 ///
2012 /// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0
2013 /// ```
2014 #[deprecated]
2015 CU_JIT_FMA = 24,
2016 /// Array of kernel names that should be preserved at link time while others can be removed.
2017 /// Must contain CU_JIT_REFERENCED_KERNEL_COUNT entries.
2018 /// Note that kernel names can be mangled by the compiler in which case the mangled name needs to be specified.
2019 /// Wildcard "\*" can be used to represent zero or more characters instead of specifying the full or mangled name.
2020 /// It is important to note that the wildcard "\*" is also added implicitly. For example, specifying "foo" will match "foobaz",
2021 /// "barfoo", "barfoobaz" and thus preserve all kernels with those names. This can be avoided by providing a more specific name
2022 /// like "barfoobaz".
2023 /// Option type: const char \*\*
2024 /// Applies to: dynamic linker only
2025 ///
2026 /// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
2027 #[deprecated]
2028 CU_JIT_REFERENCED_KERNEL_NAMES = 25,
2029 /// Number of entries in CU_JIT_REFERENCED_KERNEL_NAMES array.
2030 /// Option type: unsigned int
2031 /// Applies to: dynamic linker only
2032 ///
2033 /// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
2034 #[deprecated]
2035 CU_JIT_REFERENCED_KERNEL_COUNT = 26,
2036 /// Array of variable names (__device__ and/or __constant__) that should be preserved at link time while others can be removed.
2037 /// Must contain CU_JIT_REFERENCED_VARIABLE_COUNT entries.
2038 /// Note that variable names can be mangled by the compiler in which case the mangled name needs to be specified.
2039 /// Wildcard "\*" can be used to represent zero or more characters instead of specifying the full or mangled name.
2040 /// It is important to note that the wildcard "\*" is also added implicitly. For example, specifying "foo" will match "foobaz",
2041 /// "barfoo", "barfoobaz" and thus preserve all variables with those names. This can be avoided by providing a more specific name
2042 /// like "barfoobaz".
2043 /// Option type: const char \*\*
2044 /// Applies to: link-time optimization specified with [`CUjit_option::CU_JIT_LTO`]
2045 ///
2046 /// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
2047 #[deprecated]
2048 CU_JIT_REFERENCED_VARIABLE_NAMES = 27,
2049 /// Number of entries in CU_JIT_REFERENCED_VARIABLE_NAMES array.
2050 /// Option type: unsigned int
2051 /// Applies to: link-time optimization specified with [`CUjit_option::CU_JIT_LTO`]
2052 ///
2053 /// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
2054 #[deprecated]
2055 CU_JIT_REFERENCED_VARIABLE_COUNT = 28,
2056 /// This option serves as a hint to enable the JIT compiler/linker to remove constant (__constant__) and device (__device__) variables
2057 /// unreferenced in device code (Disabled by default).
2058 /// Note that host references to constant and device variables using APIs like [`cuModuleGetGlobal_v2`] with this option specified may result in undefined behavior unless the variables are explicitly specified using CU_JIT_REFERENCED_VARIABLE_NAMES.
2059 /// Option type: int
2060 /// Applies to: link-time optimization specified with [`CUjit_option::CU_JIT_LTO`]
2061 ///
2062 /// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
2063 #[deprecated]
2064 CU_JIT_OPTIMIZE_UNUSED_DEVICE_VARIABLES = 29,
2065 /// Generate position independent code (0: false)
2066 /// Option type: int
2067 /// Applies to: compiler only.
2068 CU_JIT_POSITION_INDEPENDENT_CODE = 30,
2069 /// This option hints to the JIT compiler the minimum number of CTAs from the kernel’s grid to be mapped to a SM. This option
2070 /// is ignored when used together with CU_JIT_MAX_REGISTERS or CU_JIT_THREADS_PER_BLOCK. Optimizations based on this option need CU_JIT_MAX_THREADS_PER_BLOCK to be specified as well. For kernels already using PTX directive .minnctapersm, this option will be ignored by default. Use
2071 /// CU_JIT_OVERRIDE_DIRECTIVE_VALUES to let this option take precedence over the PTX directive. Option type: unsigned int
2072 /// Applies to: compiler only.
2073 CU_JIT_MIN_CTA_PER_SM = 31,
2074 /// Maximum number threads in a thread block, computed as the product of the maximum extent specifed for each dimension of the
2075 /// block. This limit is guaranteed not to be exeeded in any invocation of the kernel. Exceeding the maximum number of threads
2076 /// results in runtime error or kernel launch failure. For kernels already using PTX directive .maxntid, this option will be ignored
2077 /// by default. Use CU_JIT_OVERRIDE_DIRECTIVE_VALUES to let this option take precedence over the PTX directive. Option type: int
2078 /// Applies to: compiler only.
2079 CU_JIT_MAX_THREADS_PER_BLOCK = 32,
2080 /// This option lets the values specified using CU_JIT_MAX_REGISTERS, CU_JIT_THREADS_PER_BLOCK, CU_JIT_MAX_THREADS_PER_BLOCK and CU_JIT_MIN_CTA_PER_SM take precedence over any PTX directives. (0: Disable, default; 1: Enable) Option type: int
2081 /// Applies to: compiler only.
2082 CU_JIT_OVERRIDE_DIRECTIVE_VALUES = 33,
2083 /// This option specifies the maximum number of concurrent threads to use when running compiler optimizations. If the specified
2084 /// value is 1, the option will be ignored. If the specified value is 0, the number of threads will match the number of CPUs on
2085 /// the underlying machine. Otherwise, if the option is N, then up to N threads will be used. Option type: unsigned int
2086 /// Applies to: compiler only.
2087 CU_JIT_SPLIT_COMPILE = 34,
2088 /// This option specifies the maximum number of concurrent threads to use when compiling device code. If the specified value is
2089 /// ```text
2090 /// 1, the option will be ignored. If the specified value is 0, the number of threads will match the number of CPUs on the underlying
2091 /// machine. Otherwise, if the option is N, then up to N threads will be used. This option is ignored if the env var CUDA_BINARY_LOADER_THREAD_COUNT
2092 /// is set. Option type: unsigned int
2093 /// Applies to: compiler and linker
2094 /// ```
2095 CU_JIT_BINARY_LOADER_THREAD_COUNT = 35,
2096 CU_JIT_NUM_OPTIONS = 36,
2097}
2098pub use self::CUjit_option_enum as CUjit_option;
2099/// Online compilation targets.
2100#[repr(u32)]
2101#[derive(
2102 Debug,
2103 Copy,
2104 Clone,
2105 Hash,
2106 PartialOrd,
2107 Ord,
2108 PartialEq,
2109 Eq,
2110 TryFromPrimitive,
2111 IntoPrimitive,
2112)]
2113pub enum CUjit_target_enum {
2114 /// Compute device class 3.0.
2115 CU_TARGET_COMPUTE_30 = 30,
2116 /// Compute device class 3.2.
2117 CU_TARGET_COMPUTE_32 = 32,
2118 /// Compute device class 3.5.
2119 CU_TARGET_COMPUTE_35 = 35,
2120 /// Compute device class 3.7.
2121 CU_TARGET_COMPUTE_37 = 37,
2122 /// Compute device class 5.0.
2123 CU_TARGET_COMPUTE_50 = 50,
2124 /// Compute device class 5.2.
2125 CU_TARGET_COMPUTE_52 = 52,
2126 /// Compute device class 5.3.
2127 CU_TARGET_COMPUTE_53 = 53,
2128 /// Compute device class 6.0.
2129 CU_TARGET_COMPUTE_60 = 60,
2130 /// Compute device class 6.1.
2131 CU_TARGET_COMPUTE_61 = 61,
2132 /// Compute device class 6.2.
2133 CU_TARGET_COMPUTE_62 = 62,
2134 /// Compute device class 7.0.
2135 CU_TARGET_COMPUTE_70 = 70,
2136 /// Compute device class 7.2.
2137 CU_TARGET_COMPUTE_72 = 72,
2138 /// Compute device class 7.5.
2139 CU_TARGET_COMPUTE_75 = 75,
2140 /// Compute device class 8.0.
2141 CU_TARGET_COMPUTE_80 = 80,
2142 /// Compute device class 8.6.
2143 CU_TARGET_COMPUTE_86 = 86,
2144 /// Compute device class 8.7.
2145 CU_TARGET_COMPUTE_87 = 87,
2146 /// Compute device class 8.9.
2147 CU_TARGET_COMPUTE_89 = 89,
2148 /// Compute device class 9.0.
2149 CU_TARGET_COMPUTE_90 = 90,
2150 /// Compute device class 10.0.
2151 CU_TARGET_COMPUTE_100 = 100,
2152 /// Compute device class 11.0.
2153 CU_TARGET_COMPUTE_110 = 110,
2154 /// Compute device class 10.3.
2155 CU_TARGET_COMPUTE_103 = 103,
2156 /// Compute device class 12.0.
2157 CU_TARGET_COMPUTE_120 = 120,
2158 /// Compute device class 12.1. Compute device class 9.0. with accelerated features.
2159 CU_TARGET_COMPUTE_121 = 121,
2160 /// Compute device class 10.0. with accelerated features.
2161 CU_TARGET_COMPUTE_90A = 65626,
2162 /// Compute device class 11.0 with accelerated features.
2163 CU_TARGET_COMPUTE_100A = 65636,
2164 /// Compute device class 10.3. with accelerated features.
2165 CU_TARGET_COMPUTE_110A = 65646,
2166 /// Compute device class 12.0. with accelerated features.
2167 CU_TARGET_COMPUTE_103A = 65639,
2168 /// Compute device class 12.1. with accelerated features.
2169 CU_TARGET_COMPUTE_120A = 65656,
2170 /// Compute device class 10.x with family features.
2171 CU_TARGET_COMPUTE_121A = 65657,
2172 /// Compute device class 11.0 with family features.
2173 CU_TARGET_COMPUTE_100F = 131172,
2174 /// Compute device class 10.3. with family features.
2175 CU_TARGET_COMPUTE_110F = 131182,
2176 /// Compute device class 12.0. with family features.
2177 CU_TARGET_COMPUTE_103F = 131175,
2178 /// Compute device class 12.1. with family features.
2179 CU_TARGET_COMPUTE_120F = 131192,
2180 CU_TARGET_COMPUTE_121F = 131193,
2181}
2182pub use self::CUjit_target_enum as CUjit_target;
2183/// Cubin matching fallback strategies.
2184#[repr(u32)]
2185#[derive(
2186 Debug,
2187 Copy,
2188 Clone,
2189 Hash,
2190 PartialOrd,
2191 Ord,
2192 PartialEq,
2193 Eq,
2194 TryFromPrimitive,
2195 IntoPrimitive,
2196)]
2197pub enum CUjit_fallback_enum {
2198 /// Prefer to compile ptx if exact binary match not found.
2199 CU_PREFER_PTX = 0,
2200 /// Prefer to fall back to compatible binary code if exact match not found.
2201 CU_PREFER_BINARY = 1,
2202}
2203pub use self::CUjit_fallback_enum as CUjit_fallback;
2204/// Caching modes for dlcm.
2205#[repr(u32)]
2206#[derive(
2207 Debug,
2208 Copy,
2209 Clone,
2210 Hash,
2211 PartialOrd,
2212 Ord,
2213 PartialEq,
2214 Eq,
2215 TryFromPrimitive,
2216 IntoPrimitive,
2217)]
2218pub enum CUjit_cacheMode_enum {
2219 /// Compile with no -dlcm flag specified.
2220 CU_JIT_CACHE_OPTION_NONE = 0,
2221 /// Compile with L1 cache disabled.
2222 CU_JIT_CACHE_OPTION_CG = 1,
2223 /// Compile with L1 cache enabled.
2224 CU_JIT_CACHE_OPTION_CA = 2,
2225}
2226pub use self::CUjit_cacheMode_enum as CUjit_cacheMode;
2227/// Device code formats.
2228#[repr(u32)]
2229#[derive(
2230 Debug,
2231 Copy,
2232 Clone,
2233 Hash,
2234 PartialOrd,
2235 Ord,
2236 PartialEq,
2237 Eq,
2238 TryFromPrimitive,
2239 IntoPrimitive,
2240)]
2241pub enum CUjitInputType_enum {
2242 /// Compiled device-class-specific device code
2243 /// Applicable options: none.
2244 CU_JIT_INPUT_CUBIN = 0,
2245 /// PTX source code
2246 /// Applicable options: PTX compiler options.
2247 CU_JIT_INPUT_PTX = 1,
2248 /// Bundle of multiple cubins and/or PTX of some device code
2249 /// Applicable options: PTX compiler options, CU_JIT_FALLBACK_STRATEGY.
2250 CU_JIT_INPUT_FATBINARY = 2,
2251 /// Host object with embedded device code
2252 /// Applicable options: PTX compiler options, CU_JIT_FALLBACK_STRATEGY.
2253 CU_JIT_INPUT_OBJECT = 3,
2254 /// Archive of host objects with embedded device code
2255 /// Applicable options: PTX compiler options, CU_JIT_FALLBACK_STRATEGY.
2256 CU_JIT_INPUT_LIBRARY = 4,
2257 /// High-level intermediate code for link-time optimization
2258 /// Applicable options: NVVM compiler options, PTX compiler options
2259 ///
2260 /// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
2261 #[deprecated]
2262 CU_JIT_INPUT_NVVM = 5,
2263 CU_JIT_NUM_INPUT_TYPES = 6,
2264}
2265pub use self::CUjitInputType_enum as CUjitInputType;
2266#[repr(C)]
2267#[derive(Debug, Copy, Clone)]
2268pub struct CUlinkState_st {
2269 _unused: [u8; 0],
2270}
2271pub type CUlinkState = *mut CUlinkState_st;
2272/// Flags to register a graphics resource.
2273#[repr(u32)]
2274#[derive(
2275 Debug,
2276 Copy,
2277 Clone,
2278 Hash,
2279 PartialOrd,
2280 Ord,
2281 PartialEq,
2282 Eq,
2283 TryFromPrimitive,
2284 IntoPrimitive,
2285)]
2286pub enum CUgraphicsRegisterFlags_enum {
2287 CU_GRAPHICS_REGISTER_FLAGS_NONE = 0,
2288 CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY = 1,
2289 CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD = 2,
2290 CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST = 4,
2291 CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER = 8,
2292}
2293pub use self::CUgraphicsRegisterFlags_enum as CUgraphicsRegisterFlags;
2294/// Flags for mapping and unmapping interop resources.
2295#[repr(u32)]
2296#[derive(
2297 Debug,
2298 Copy,
2299 Clone,
2300 Hash,
2301 PartialOrd,
2302 Ord,
2303 PartialEq,
2304 Eq,
2305 TryFromPrimitive,
2306 IntoPrimitive,
2307)]
2308pub enum CUgraphicsMapResourceFlags_enum {
2309 CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE = 0,
2310 CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY = 1,
2311 CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 2,
2312}
2313pub use self::CUgraphicsMapResourceFlags_enum as CUgraphicsMapResourceFlags;
2314/// Array indices for cube faces.
2315#[repr(u32)]
2316#[derive(
2317 Debug,
2318 Copy,
2319 Clone,
2320 Hash,
2321 PartialOrd,
2322 Ord,
2323 PartialEq,
2324 Eq,
2325 TryFromPrimitive,
2326 IntoPrimitive,
2327)]
2328pub enum CUarray_cubemap_face_enum {
2329 /// Positive X face of cubemap.
2330 CU_CUBEMAP_FACE_POSITIVE_X = 0,
2331 /// Negative X face of cubemap.
2332 CU_CUBEMAP_FACE_NEGATIVE_X = 1,
2333 /// Positive Y face of cubemap.
2334 CU_CUBEMAP_FACE_POSITIVE_Y = 2,
2335 /// Negative Y face of cubemap.
2336 CU_CUBEMAP_FACE_NEGATIVE_Y = 3,
2337 /// Positive Z face of cubemap.
2338 CU_CUBEMAP_FACE_POSITIVE_Z = 4,
2339 /// Negative Z face of cubemap.
2340 CU_CUBEMAP_FACE_NEGATIVE_Z = 5,
2341}
2342pub use self::CUarray_cubemap_face_enum as CUarray_cubemap_face;
2343/// Limits.
2344#[repr(u32)]
2345#[derive(
2346 Debug,
2347 Copy,
2348 Clone,
2349 Hash,
2350 PartialOrd,
2351 Ord,
2352 PartialEq,
2353 Eq,
2354 TryFromPrimitive,
2355 IntoPrimitive,
2356)]
2357pub enum CUlimit_enum {
2358 /// GPU thread stack size.
2359 CU_LIMIT_STACK_SIZE = 0,
2360 /// GPU printf FIFO size.
2361 CU_LIMIT_PRINTF_FIFO_SIZE = 1,
2362 /// GPU malloc heap size.
2363 CU_LIMIT_MALLOC_HEAP_SIZE = 2,
2364 /// GPU device runtime launch synchronize depth.
2365 CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH = 3,
2366 /// GPU device runtime pending launch count.
2367 CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT = 4,
2368 /// A value between 0 and 128 that indicates the maximum fetch granularity of L2 (in Bytes). This is a hint.
2369 CU_LIMIT_MAX_L2_FETCH_GRANULARITY = 5,
2370 /// A size in bytes for L2 persisting lines cache size.
2371 CU_LIMIT_PERSISTING_L2_CACHE_SIZE = 6,
2372 /// A maximum size in bytes of shared memory available to CUDA kernels on a CIG context. Can only be queried, cannot be set.
2373 CU_LIMIT_SHMEM_SIZE = 7,
2374 /// A non-zero value indicates this CUDA context is a CIG-enabled context. Can only be queried, cannot be set.
2375 CU_LIMIT_CIG_ENABLED = 8,
2376 /// When set to zero, CUDA will fail to launch a kernel on a CIG context, instead of using the fallback path, if the kernel uses
2377 /// more shared memory than available.
2378 CU_LIMIT_CIG_SHMEM_FALLBACK_ENABLED = 9,
2379 CU_LIMIT_MAX = 10,
2380}
2381pub use self::CUlimit_enum as CUlimit;
2382/// Resource types.
2383#[repr(u32)]
2384#[derive(
2385 Debug,
2386 Copy,
2387 Clone,
2388 Hash,
2389 PartialOrd,
2390 Ord,
2391 PartialEq,
2392 Eq,
2393 TryFromPrimitive,
2394 IntoPrimitive,
2395)]
2396pub enum CUresourcetype_enum {
2397 /// Array resource.
2398 CU_RESOURCE_TYPE_ARRAY = 0,
2399 /// Mipmapped array resource.
2400 CU_RESOURCE_TYPE_MIPMAPPED_ARRAY = 1,
2401 /// Linear resource.
2402 CU_RESOURCE_TYPE_LINEAR = 2,
2403 /// Pitch 2D resource.
2404 CU_RESOURCE_TYPE_PITCH2D = 3,
2405}
2406pub use self::CUresourcetype_enum as CUresourcetype;
2407/// CUDA host function.
2408pub type CUhostFn = ::core::option::Option<
2409 unsafe extern "C" fn(userData: *mut ::core::ffi::c_void),
2410>;
2411/// Specifies performance hint with [`CUaccessPolicyWindow`] for hitProp and missProp members.
2412#[repr(u32)]
2413#[derive(
2414 Debug,
2415 Copy,
2416 Clone,
2417 Hash,
2418 PartialOrd,
2419 Ord,
2420 PartialEq,
2421 Eq,
2422 TryFromPrimitive,
2423 IntoPrimitive,
2424)]
2425pub enum CUaccessProperty_enum {
2426 /// Normal cache persistence.
2427 CU_ACCESS_PROPERTY_NORMAL = 0,
2428 /// Streaming access is less likely to persit from cache.
2429 CU_ACCESS_PROPERTY_STREAMING = 1,
2430 /// Persisting access is more likely to persist in cache.
2431 CU_ACCESS_PROPERTY_PERSISTING = 2,
2432}
2433pub use self::CUaccessProperty_enum as CUaccessProperty;
2434#[repr(C)]
2435#[derive(Debug, Copy, Clone, PartialOrd, PartialEq)]
2436pub struct CUaccessPolicyWindow_st {
2437 pub base_ptr: *mut ::core::ffi::c_void,
2438 pub num_bytes: size_t,
2439 pub hitRatio: f32,
2440 pub hitProp: CUaccessProperty,
2441 pub missProp: CUaccessProperty,
2442}
2443impl Default for CUaccessPolicyWindow_st {
2444 fn default() -> Self {
2445 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
2446 unsafe {
2447 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2448 s.assume_init()
2449 }
2450 }
2451}
2452/// Specifies an access policy for a window, a contiguous extent of memory beginning at base_ptr and ending at base_ptr + num_bytes.
2453/// num_bytes is limited by [`CUdevice_attribute::CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE`]. Partition into many segments and assign segments
2454/// such that: sum of "hit segments" / window == approx. ratio. sum of "miss segments" / window == approx 1-ratio. Segments and
2455/// ratio specifications are fitted to the capabilities of the architecture. Accesses in a hit segment apply the hitProp access
2456/// policy. Accesses in a miss segment apply the missProp access policy.
2457pub type CUaccessPolicyWindow_v1 = CUaccessPolicyWindow_st;
2458/// Access policy window.
2459pub type CUaccessPolicyWindow = CUaccessPolicyWindow_v1;
2460#[repr(C)]
2461#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2462pub struct CUDA_KERNEL_NODE_PARAMS_st {
2463 pub func: CUfunction,
2464 pub gridDimX: ::core::ffi::c_uint,
2465 pub gridDimY: ::core::ffi::c_uint,
2466 pub gridDimZ: ::core::ffi::c_uint,
2467 pub blockDimX: ::core::ffi::c_uint,
2468 pub blockDimY: ::core::ffi::c_uint,
2469 pub blockDimZ: ::core::ffi::c_uint,
2470 pub sharedMemBytes: ::core::ffi::c_uint,
2471 pub kernelParams: *mut *mut ::core::ffi::c_void,
2472 pub extra: *mut *mut ::core::ffi::c_void,
2473}
2474impl Default for CUDA_KERNEL_NODE_PARAMS_st {
2475 fn default() -> Self {
2476 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
2477 unsafe {
2478 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2479 s.assume_init()
2480 }
2481 }
2482}
2483/// GPU kernel node parameters.
2484pub type CUDA_KERNEL_NODE_PARAMS_v1 = CUDA_KERNEL_NODE_PARAMS_st;
2485#[repr(C)]
2486#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2487pub struct CUDA_KERNEL_NODE_PARAMS_v2_st {
2488 pub func: CUfunction,
2489 pub gridDimX: ::core::ffi::c_uint,
2490 pub gridDimY: ::core::ffi::c_uint,
2491 pub gridDimZ: ::core::ffi::c_uint,
2492 pub blockDimX: ::core::ffi::c_uint,
2493 pub blockDimY: ::core::ffi::c_uint,
2494 pub blockDimZ: ::core::ffi::c_uint,
2495 pub sharedMemBytes: ::core::ffi::c_uint,
2496 pub kernelParams: *mut *mut ::core::ffi::c_void,
2497 pub extra: *mut *mut ::core::ffi::c_void,
2498 pub kern: CUkernel,
2499 pub ctx: CUcontext,
2500}
2501impl Default for CUDA_KERNEL_NODE_PARAMS_v2_st {
2502 fn default() -> Self {
2503 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
2504 unsafe {
2505 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2506 s.assume_init()
2507 }
2508 }
2509}
2510/// GPU kernel node parameters.
2511pub type CUDA_KERNEL_NODE_PARAMS_v2 = CUDA_KERNEL_NODE_PARAMS_v2_st;
2512pub type CUDA_KERNEL_NODE_PARAMS = CUDA_KERNEL_NODE_PARAMS_v2;
2513#[repr(C)]
2514#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2515pub struct CUDA_KERNEL_NODE_PARAMS_v3_st {
2516 pub func: CUfunction,
2517 pub gridDimX: ::core::ffi::c_uint,
2518 pub gridDimY: ::core::ffi::c_uint,
2519 pub gridDimZ: ::core::ffi::c_uint,
2520 pub blockDimX: ::core::ffi::c_uint,
2521 pub blockDimY: ::core::ffi::c_uint,
2522 pub blockDimZ: ::core::ffi::c_uint,
2523 pub sharedMemBytes: ::core::ffi::c_uint,
2524 pub kernelParams: *mut *mut ::core::ffi::c_void,
2525 pub extra: *mut *mut ::core::ffi::c_void,
2526 pub kern: CUkernel,
2527 pub ctx: CUcontext,
2528}
2529impl Default for CUDA_KERNEL_NODE_PARAMS_v3_st {
2530 fn default() -> Self {
2531 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
2532 unsafe {
2533 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2534 s.assume_init()
2535 }
2536 }
2537}
2538/// GPU kernel node parameters.
2539pub type CUDA_KERNEL_NODE_PARAMS_v3 = CUDA_KERNEL_NODE_PARAMS_v3_st;
2540#[repr(C)]
2541#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2542pub struct CUDA_MEMSET_NODE_PARAMS_st {
2543 pub dst: CUdeviceptr,
2544 pub pitch: size_t,
2545 pub value: ::core::ffi::c_uint,
2546 pub elementSize: ::core::ffi::c_uint,
2547 pub width: size_t,
2548 pub height: size_t,
2549}
2550/// Memset node parameters.
2551pub type CUDA_MEMSET_NODE_PARAMS_v1 = CUDA_MEMSET_NODE_PARAMS_st;
2552pub type CUDA_MEMSET_NODE_PARAMS = CUDA_MEMSET_NODE_PARAMS_v1;
2553#[repr(C)]
2554#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2555pub struct CUDA_MEMSET_NODE_PARAMS_v2_st {
2556 pub dst: CUdeviceptr,
2557 pub pitch: size_t,
2558 pub value: ::core::ffi::c_uint,
2559 pub elementSize: ::core::ffi::c_uint,
2560 pub width: size_t,
2561 pub height: size_t,
2562 pub ctx: CUcontext,
2563}
2564impl Default for CUDA_MEMSET_NODE_PARAMS_v2_st {
2565 fn default() -> Self {
2566 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
2567 unsafe {
2568 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2569 s.assume_init()
2570 }
2571 }
2572}
2573/// Memset node parameters.
2574pub type CUDA_MEMSET_NODE_PARAMS_v2 = CUDA_MEMSET_NODE_PARAMS_v2_st;
2575#[repr(C)]
2576#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2577pub struct CUDA_HOST_NODE_PARAMS_st {
2578 pub fn_: CUhostFn,
2579 pub userData: *mut ::core::ffi::c_void,
2580}
2581impl Default for CUDA_HOST_NODE_PARAMS_st {
2582 fn default() -> Self {
2583 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
2584 unsafe {
2585 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2586 s.assume_init()
2587 }
2588 }
2589}
2590/// Host node parameters.
2591pub type CUDA_HOST_NODE_PARAMS_v1 = CUDA_HOST_NODE_PARAMS_st;
2592pub type CUDA_HOST_NODE_PARAMS = CUDA_HOST_NODE_PARAMS_v1;
2593#[repr(C)]
2594#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2595pub struct CUDA_HOST_NODE_PARAMS_v2_st {
2596 pub fn_: CUhostFn,
2597 pub userData: *mut ::core::ffi::c_void,
2598 pub syncMode: ::core::ffi::c_uint,
2599}
2600impl Default for CUDA_HOST_NODE_PARAMS_v2_st {
2601 fn default() -> Self {
2602 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
2603 unsafe {
2604 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2605 s.assume_init()
2606 }
2607 }
2608}
2609/// Host node parameters.
2610pub type CUDA_HOST_NODE_PARAMS_v2 = CUDA_HOST_NODE_PARAMS_v2_st;
2611/// Conditional node types.
2612#[repr(u32)]
2613#[derive(
2614 Debug,
2615 Copy,
2616 Clone,
2617 Hash,
2618 PartialOrd,
2619 Ord,
2620 PartialEq,
2621 Eq,
2622 TryFromPrimitive,
2623 IntoPrimitive,
2624)]
2625pub enum CUgraphConditionalNodeType_enum {
2626 /// Conditional 'if/else' Node. Body\[0\] executed if condition is non-zero. If size == 2, an optional ELSE graph is created and this is executed if the condition is zero.
2627 CU_GRAPH_COND_TYPE_IF = 0,
2628 /// Conditional 'while' Node. Body executed repeatedly while condition value is non-zero.
2629 CU_GRAPH_COND_TYPE_WHILE = 1,
2630 /// Conditional 'switch' Node. Body\[n\] is executed once, where 'n' is the value of the condition. If the condition does not match
2631 /// a body index, no body is launched.
2632 CU_GRAPH_COND_TYPE_SWITCH = 2,
2633}
2634pub use self::CUgraphConditionalNodeType_enum as CUgraphConditionalNodeType;
2635/// Conditional node parameters.
2636#[repr(C)]
2637#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2638pub struct CUDA_CONDITIONAL_NODE_PARAMS {
2639 /// Conditional node handle. Handles must be created in advance of creating the node using [`cuGraphConditionalHandleCreate`].
2640 pub handle: CUgraphConditionalHandle,
2641 pub type_: CUgraphConditionalNodeType,
2642 /// Size of graph output array. Allowed values are 1 for [`CUgraphConditionalNodeType::CU_GRAPH_COND_TYPE_WHILE`], 1 or 2 for [`CUgraphConditionalNodeType::CU_GRAPH_COND_TYPE_IF`], or any value
2643 /// greater than zero for [`CUgraphConditionalNodeType::CU_GRAPH_COND_TYPE_SWITCH`].
2644 pub size: ::core::ffi::c_uint,
2645 /// CUDA-owned array populated with conditional node child graphs during creation of the node. Valid for the lifetime of the
2646 /// conditional node. The contents of the graph(s) are subject to the following constraints:
2647 ///
2648 /// * Allowed node types are kernel nodes, empty nodes, child graphs, memsets, memcopies, and conditionals. This applies recursively
2649 /// to child graphs and conditional bodies.
2650 /// * All kernels, including kernels in nested conditionals or child graphs at any level, must belong to the same CUDA context.
2651 ///
2652 /// These graphs may be populated using graph node creation APIs or [`cuStreamBeginCaptureToGraph`].
2653 ///
2654 /// [`CUgraphConditionalNodeType::CU_GRAPH_COND_TYPE_IF`]: phGraph_out\[0\] is executed when the condition is non-zero. If size == 2, phGraph_out\[1\] will be executed when the condition is zero. [`CUgraphConditionalNodeType::CU_GRAPH_COND_TYPE_WHILE`]: phGraph_out\[0\] is executed as
2655 /// long as the condition is non-zero. [`CUgraphConditionalNodeType::CU_GRAPH_COND_TYPE_SWITCH`]: phGraph_out\[n\] is executed when the condition is equal to n.
2656 /// If the condition >= size, no body graph is executed.
2657 pub phGraph_out: *mut CUgraph,
2658 /// Context on which to run the node. Must match context used to create the handle and all body nodes.
2659 pub ctx: CUcontext,
2660}
2661impl Default for CUDA_CONDITIONAL_NODE_PARAMS {
2662 fn default() -> Self {
2663 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
2664 unsafe {
2665 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2666 s.assume_init()
2667 }
2668 }
2669}
2670/// Graph node types.
2671#[repr(u32)]
2672#[derive(
2673 Debug,
2674 Copy,
2675 Clone,
2676 Hash,
2677 PartialOrd,
2678 Ord,
2679 PartialEq,
2680 Eq,
2681 TryFromPrimitive,
2682 IntoPrimitive,
2683)]
2684pub enum CUgraphNodeType_enum {
2685 /// GPU kernel node.
2686 CU_GRAPH_NODE_TYPE_KERNEL = 0,
2687 /// Memcpy node.
2688 CU_GRAPH_NODE_TYPE_MEMCPY = 1,
2689 /// Memset node.
2690 CU_GRAPH_NODE_TYPE_MEMSET = 2,
2691 /// Host (executable) node.
2692 CU_GRAPH_NODE_TYPE_HOST = 3,
2693 /// Node which executes an embedded graph.
2694 CU_GRAPH_NODE_TYPE_GRAPH = 4,
2695 /// Empty (no-op) node.
2696 CU_GRAPH_NODE_TYPE_EMPTY = 5,
2697 /// External event wait node.
2698 CU_GRAPH_NODE_TYPE_WAIT_EVENT = 6,
2699 /// External event record node.
2700 CU_GRAPH_NODE_TYPE_EVENT_RECORD = 7,
2701 /// External semaphore signal node.
2702 CU_GRAPH_NODE_TYPE_EXT_SEMAS_SIGNAL = 8,
2703 /// External semaphore wait node.
2704 CU_GRAPH_NODE_TYPE_EXT_SEMAS_WAIT = 9,
2705 /// Memory Allocation Node.
2706 CU_GRAPH_NODE_TYPE_MEM_ALLOC = 10,
2707 /// Memory Free Node.
2708 CU_GRAPH_NODE_TYPE_MEM_FREE = 11,
2709 /// Batch MemOp Node See [`cuStreamBatchMemOp_v2`] and `CUstreamBatchMemOpType` for what these nodes can do.
2710 CU_GRAPH_NODE_TYPE_BATCH_MEM_OP = 12,
2711 /// Conditional NodeMay be used to implement a conditional execution path or loop inside of a graph. The graph(s) contained within
2712 /// the body of the conditional node can be selectively executed or iterated upon based on the value of a conditional variable.Handles
2713 /// must be created in advance of creating the node using [`cuGraphConditionalHandleCreate`].The following restrictions apply to graphs which contain conditional nodes: The graph cannot be used in a child node. Only
2714 /// one instantiation of the graph may exist at any point in time. The graph cannot be cloned.To set the control value, supply
2715 /// a default value when creating the handle and/or call [cudaGraphSetConditional](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__GRAPH.html#group__CUDART__GRAPH_1gde392fa316b963233219ab3caac9f1b3) from device code.
2716 CU_GRAPH_NODE_TYPE_CONDITIONAL = 13,
2717 /// Reserved.
2718 CU_GRAPH_NODE_TYPE_RESERVED_16 = 16,
2719}
2720pub use self::CUgraphNodeType_enum as CUgraphNodeType;
2721/// Type annotations that can be applied to graph edges as part of [`CUgraphEdgeData`].
2722#[repr(u32)]
2723#[derive(
2724 Debug,
2725 Copy,
2726 Clone,
2727 Hash,
2728 PartialOrd,
2729 Ord,
2730 PartialEq,
2731 Eq,
2732 TryFromPrimitive,
2733 IntoPrimitive,
2734)]
2735pub enum CUgraphDependencyType_enum {
2736 /// This is an ordinary dependency.
2737 CU_GRAPH_DEPENDENCY_TYPE_DEFAULT = 0,
2738 /// This dependency type allows the downstream node to use <cudaGridDependencySynchronize()>. It may only be used between kernel nodes, and must be used with either the [`CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC`] or [`CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER`] outgoing port.
2739 CU_GRAPH_DEPENDENCY_TYPE_PROGRAMMATIC = 1,
2740}
2741pub use self::CUgraphDependencyType_enum as CUgraphDependencyType;
2742#[repr(C)]
2743#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2744pub struct CUgraphEdgeData_st {
2745 pub from_port: ::core::ffi::c_uchar,
2746 pub to_port: ::core::ffi::c_uchar,
2747 pub type_: ::core::ffi::c_uchar,
2748 pub reserved: [::core::ffi::c_uchar; 5usize],
2749}
2750/// Optional annotation for edges in a CUDA graph. Note, all edges implicitly have annotations and default to a zero-initialized
2751/// value if not specified. A zero-initialized struct indicates a standard full serialization of two nodes with memory visibility.
2752pub type CUgraphEdgeData = CUgraphEdgeData_st;
2753/// Graph instantiation results.
2754#[repr(u32)]
2755#[derive(
2756 Debug,
2757 Copy,
2758 Clone,
2759 Hash,
2760 PartialOrd,
2761 Ord,
2762 PartialEq,
2763 Eq,
2764 TryFromPrimitive,
2765 IntoPrimitive,
2766)]
2767pub enum CUgraphInstantiateResult_enum {
2768 /// Instantiation succeeded.
2769 CUDA_GRAPH_INSTANTIATE_SUCCESS = 0,
2770 /// Instantiation failed for an unexpected reason which is described in the return value of the function.
2771 CUDA_GRAPH_INSTANTIATE_ERROR = 1,
2772 /// Instantiation failed due to invalid structure, such as cycles.
2773 CUDA_GRAPH_INSTANTIATE_INVALID_STRUCTURE = 2,
2774 /// Instantiation for device launch failed because the graph contained an unsupported operation.
2775 CUDA_GRAPH_INSTANTIATE_NODE_OPERATION_NOT_SUPPORTED = 3,
2776 /// Instantiation for device launch failed due to the nodes belonging to different contexts.
2777 CUDA_GRAPH_INSTANTIATE_MULTIPLE_CTXS_NOT_SUPPORTED = 4,
2778 /// One or more conditional handles are not associated with conditional nodes.
2779 CUDA_GRAPH_INSTANTIATE_CONDITIONAL_HANDLE_UNUSED = 5,
2780}
2781pub use self::CUgraphInstantiateResult_enum as CUgraphInstantiateResult;
2782#[repr(C)]
2783#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2784pub struct CUDA_GRAPH_INSTANTIATE_PARAMS_st {
2785 pub flags: cuuint64_t,
2786 pub hUploadStream: CUstream,
2787 pub hErrNode_out: CUgraphNode,
2788 pub result_out: CUgraphInstantiateResult,
2789}
2790impl Default for CUDA_GRAPH_INSTANTIATE_PARAMS_st {
2791 fn default() -> Self {
2792 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
2793 unsafe {
2794 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2795 s.assume_init()
2796 }
2797 }
2798}
2799/// Graph instantiation parameters.
2800pub type CUDA_GRAPH_INSTANTIATE_PARAMS = CUDA_GRAPH_INSTANTIATE_PARAMS_st;
2801#[repr(u32)]
2802#[derive(
2803 Debug,
2804 Copy,
2805 Clone,
2806 Hash,
2807 PartialOrd,
2808 Ord,
2809 PartialEq,
2810 Eq,
2811 TryFromPrimitive,
2812 IntoPrimitive,
2813)]
2814pub enum CUsynchronizationPolicy_enum {
2815 CU_SYNC_POLICY_AUTO = 1,
2816 CU_SYNC_POLICY_SPIN = 2,
2817 CU_SYNC_POLICY_YIELD = 3,
2818 CU_SYNC_POLICY_BLOCKING_SYNC = 4,
2819}
2820pub use self::CUsynchronizationPolicy_enum as CUsynchronizationPolicy;
2821/// Cluster scheduling policies. These may be passed to [`cuFuncSetAttribute`] or [`cuKernelSetAttribute`].
2822#[repr(u32)]
2823#[derive(
2824 Debug,
2825 Copy,
2826 Clone,
2827 Hash,
2828 PartialOrd,
2829 Ord,
2830 PartialEq,
2831 Eq,
2832 TryFromPrimitive,
2833 IntoPrimitive,
2834)]
2835pub enum CUclusterSchedulingPolicy_enum {
2836 /// the default policy.
2837 CU_CLUSTER_SCHEDULING_POLICY_DEFAULT = 0,
2838 /// spread the blocks within a cluster to the SMs.
2839 CU_CLUSTER_SCHEDULING_POLICY_SPREAD = 1,
2840 /// allow the hardware to load-balance the blocks in a cluster to the SMs.
2841 CU_CLUSTER_SCHEDULING_POLICY_LOAD_BALANCING = 2,
2842}
2843pub use self::CUclusterSchedulingPolicy_enum as CUclusterSchedulingPolicy;
2844/// Memory Synchronization Domain
2845///
2846/// A kernel can be launched in a specified memory synchronization domain that affects all memory operations issued by that kernel.
2847/// A memory barrier issued in one domain will only order memory operations in that domain, thus eliminating latency increase
2848/// from memory barriers ordering unrelated traffic.
2849///
2850/// By default, kernels are launched in domain 0. Kernel launched with CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE will have a different domain ID. User may also alter the domain ID with [`CUlaunchMemSyncDomainMap`] for a specific stream / graph node / kernel launch. See CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN, [`cuStreamSetAttribute`], [`cuLaunchKernelEx`], [`cuGraphKernelNodeSetAttribute`].
2851///
2852/// Memory operations done in kernels launched in different domains are considered system-scope distanced. In other words, a GPU
2853/// scoped memory synchronization is not sufficient for memory order to be observed by kernels in another memory synchronization
2854/// domain even if they are on the same GPU.
2855#[repr(u32)]
2856#[derive(
2857 Debug,
2858 Copy,
2859 Clone,
2860 Hash,
2861 PartialOrd,
2862 Ord,
2863 PartialEq,
2864 Eq,
2865 TryFromPrimitive,
2866 IntoPrimitive,
2867)]
2868pub enum CUlaunchMemSyncDomain_enum {
2869 /// Launch kernels in the default domain.
2870 CU_LAUNCH_MEM_SYNC_DOMAIN_DEFAULT = 0,
2871 /// Launch kernels in the remote domain.
2872 CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE = 1,
2873}
2874pub use self::CUlaunchMemSyncDomain_enum as CUlaunchMemSyncDomain;
2875#[repr(C)]
2876#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2877pub struct CUlaunchMemSyncDomainMap_st {
2878 pub default_: ::core::ffi::c_uchar,
2879 pub remote: ::core::ffi::c_uchar,
2880}
2881/// Memory Synchronization Domain map
2882///
2883/// See [cudaLaunchMemSyncDomain](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html#group__CUDART__TYPES_1gafb98f7ea7b0397ed6503780f3e672d5).
2884///
2885/// By default, kernels are launched in domain 0. Kernel launched with [`CUlaunchMemSyncDomain_enum::CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE`] will have a different domain ID. User may also alter the domain ID with [`CUlaunchMemSyncDomainMap`] for a specific stream / graph node / kernel launch. See [`CUlaunchAttributeID_enum::CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP`].
2886///
2887/// Domain ID range is available through [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT`].
2888pub type CUlaunchMemSyncDomainMap = CUlaunchMemSyncDomainMap_st;
2889/// Enum for defining applicability of portable cluster size, used with [`cuLaunchKernelEx`].
2890#[repr(u32)]
2891#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2892pub enum CUlaunchAttributePortableClusterMode_enum {
2893 /// The default to use for allowing non-portable cluster size on launch - uses current function attribute for CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED.
2894 CU_LAUNCH_PORTABLE_CLUSTER_MODE_DEFAULT = 0,
2895 /// Specifies that the cluster size requested must be a portable size.
2896 CU_LAUNCH_PORTABLE_CLUSTER_MODE_REQUIRE_PORTABLE = 1,
2897 /// Specifies that the cluster size requested may be a non-portable size.
2898 CU_LAUNCH_PORTABLE_CLUSTER_MODE_ALLOW_NON_PORTABLE = 2,
2899}
2900pub use self::CUlaunchAttributePortableClusterMode_enum as CUlaunchAttributePortableClusterMode;
2901/// Shared memory related attributes for use with [`cuLaunchKernelEx`].
2902#[repr(u32)]
2903#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2904pub enum CUsharedMemoryMode_enum {
2905 /// The default to use for shared memory on launch - uses current function attribute for CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES.
2906 CU_SHARED_MEMORY_MODE_DEFAULT = 0,
2907 /// Specifies that the dynamic shared size bytes requested must be a portable size within the bounds of CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK.
2908 CU_SHARED_MEMORY_MODE_REQUIRE_PORTABLE = 1,
2909 /// Specifies that the dynamic shared size bytes requested may be a non-portable size but still within the bounds of CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN.
2910 CU_SHARED_MEMORY_MODE_ALLOW_NON_PORTABLE = 2,
2911}
2912pub use self::CUsharedMemoryMode_enum as CUsharedMemoryMode;
2913/// Launch attributes enum; used as id field of [`CUlaunchAttribute`].
2914#[repr(u32)]
2915#[derive(
2916 Debug,
2917 Copy,
2918 Clone,
2919 Hash,
2920 PartialOrd,
2921 Ord,
2922 PartialEq,
2923 Eq,
2924 TryFromPrimitive,
2925 IntoPrimitive,
2926)]
2927pub enum CUlaunchAttributeID_enum {
2928 /// Ignored entry, for convenient composition.
2929 CU_LAUNCH_ATTRIBUTE_IGNORE = 0,
2930 /// Valid for streams, graph nodes, launches. See [CUlaunchAttributeValue::accessPolicyWindow](https://docs.nvidia.com/cuda/cuda-driver-api/unionCUlaunchAttributeValue.html#unionCUlaunchAttributeValue_1154aa6110d2610fb68ec60bc9337073b).
2931 CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW = 1,
2932 /// Valid for graph nodes, launches. See [CUlaunchAttributeValue::cooperative](https://docs.nvidia.com/cuda/cuda-driver-api/unionCUlaunchAttributeValue.html#unionCUlaunchAttributeValue_13015f3dc785dce3a2c250b852457082a).
2933 CU_LAUNCH_ATTRIBUTE_COOPERATIVE = 2,
2934 /// Valid for streams. See [CUlaunchAttributeValue::syncPolicy](https://docs.nvidia.com/cuda/cuda-driver-api/unionCUlaunchAttributeValue.html#unionCUlaunchAttributeValue_1bfc7b2566d09fbd679636513d5c07cd8).
2935 CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY = 3,
2936 /// Valid for graph nodes, launches. See [CUlaunchAttributeValue::clusterDim](https://docs.nvidia.com/cuda/cuda-driver-api/unionCUlaunchAttributeValue.html#unionCUlaunchAttributeValue_171f9182ab9f932025a038def93ce1a94).
2937 CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION = 4,
2938 /// Valid for graph nodes, launches. See [CUlaunchAttributeValue::clusterSchedulingPolicyPreference](https://docs.nvidia.com/cuda/cuda-driver-api/unionCUlaunchAttributeValue.html#unionCUlaunchAttributeValue_1714fd4571d6ef99a53a20d378eebb2ba).
2939 CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = 5,
2940 /// Valid for launches. Setting [CUlaunchAttributeValue::programmaticStreamSerializationAllowed](https://docs.nvidia.com/cuda/cuda-driver-api/unionCUlaunchAttributeValue.html#unionCUlaunchAttributeValue_121590ca9c3de21690d12d9c7f73917ab) to non-0 signals that the kernel will use programmatic means to resolve its stream dependency, so that the CUDA runtime should
2941 /// opportunistically allow the grid's execution to overlap with the previous kernel in the stream, if that kernel requests the
2942 /// overlap. The dependent launches can choose to wait on the dependency using the programmatic sync ([cudaGridDependencySynchronize()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__EXECUTION.html#group__CUDART__EXECUTION_1g9057f99234a8311c4c5d426cd501d99d) or equivalent PTX instructions).
2943 CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION = 6,
2944 /// Valid for launches. Set [CUlaunchAttributeValue::programmaticEvent](https://docs.nvidia.com/cuda/cuda-driver-api/unionCUlaunchAttributeValue.html#unionCUlaunchAttributeValue_149992756050c46d440486034949a2c0c) to record the event. Event recorded through this launch attribute is guaranteed to only trigger after all block in the associated
2945 /// kernel trigger the event. A block can trigger the event through PTX launchdep.release or CUDA builtin function [cudaTriggerProgrammaticLaunchCompletion()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__EXECUTION.html#group__CUDART__EXECUTION_1ge194af462d927583bed3acf60d450218). A trigger can also be inserted at the beginning of each block's execution if triggerAtBlockStart is set to non-0. The dependent
2946 /// launches can choose to wait on the dependency using the programmatic sync ([cudaGridDependencySynchronize()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__EXECUTION.html#group__CUDART__EXECUTION_1g9057f99234a8311c4c5d426cd501d99d) or equivalent PTX instructions). Note that dependents (including the CPU thread calling [`cuEventSynchronize`]) are not guaranteed to observe the release precisely when it is released. For example, [`cuEventSynchronize`] may only observe the event trigger long after the associated kernel has completed. This recording type is primarily meant
2947 /// for establishing programmatic dependency between device tasks. Note also this type of dependency allows, but does not guarantee,
2948 /// concurrent execution of tasks.
2949 /// The event supplied must not be an interprocess or interop event. The event must disable timing (i.e. must be created with
2950 /// the CU_EVENT_DISABLE_TIMING flag set).
2951 CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT = 7,
2952 /// Valid for streams, graph nodes, launches. See [CUlaunchAttributeValue::priority](https://docs.nvidia.com/cuda/cuda-driver-api/unionCUlaunchAttributeValue.html#unionCUlaunchAttributeValue_18b3a370124a50866fcdb1c9cb5580e96).
2953 CU_LAUNCH_ATTRIBUTE_PRIORITY = 8,
2954 /// Valid for streams, graph nodes, launches. See [CUlaunchAttributeValue::memSyncDomainMap](https://docs.nvidia.com/cuda/cuda-driver-api/unionCUlaunchAttributeValue.html#unionCUlaunchAttributeValue_134552cdc66a0a5373d8515108d9c63d6).
2955 CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = 9,
2956 /// Valid for streams, graph nodes, launches. See [CUlaunchAttributeValue::memSyncDomain](https://docs.nvidia.com/cuda/cuda-driver-api/unionCUlaunchAttributeValue.html#unionCUlaunchAttributeValue_168b8301d88ce5c6e69fc5f08734e55a8).
2957 CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN = 10,
2958 /// Valid for graph nodes, launches. Set [CUlaunchAttributeValue::preferredClusterDim](https://docs.nvidia.com/cuda/cuda-driver-api/unionCUlaunchAttributeValue.html#unionCUlaunchAttributeValue_12e4405d769d2302fd8d0f9b7764f3cb3) to allow the kernel launch to specify a preferred substitute cluster dimension. Blocks may be grouped according to either
2959 /// the dimensions specified with this attribute (grouped into a "preferred substitute cluster"), or the one specified with CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION attribute (grouped into a "regular cluster"). The cluster dimensions of a "preferred substitute cluster" shall be an integer
2960 /// multiple greater than zero of the regular cluster dimensions. The device will attempt - on a best-effort basis - to group
2961 /// thread blocks into preferred clusters over grouping them into regular clusters. When it deems necessary (primarily when the
2962 /// device temporarily runs out of physical resources to launch the larger preferred clusters), the device may switch to launch
2963 /// the regular clusters instead to attempt to utilize as much of the physical device resources as possible.
2964 /// Each type of cluster will have its enumeration / coordinate setup as if the grid consists solely of its type of cluster. For
2965 /// example, if the preferred substitute cluster dimensions double the regular cluster dimensions, there might be simultaneously
2966 /// a regular cluster indexed at (1,0,0), and a preferred cluster indexed at (1,0,0). In this example, the preferred substitute
2967 /// cluster (1,0,0) replaces regular clusters (2,0,0) and (3,0,0) and groups their blocks.
2968 /// This attribute will only take effect when a regular cluster dimension has been specified. The preferred substitute cluster
2969 /// dimension must be an integer multiple greater than zero of the regular cluster dimension and must divide the grid. It must
2970 /// also be no more than `maxBlocksPerCluster`, if it is set in the kernel's `__launch_bounds__`. Otherwise it must be less than
2971 /// the maximum value the driver can support. Otherwise, setting this attribute to a value physically unable to fit on any particular
2972 /// device is permitted.
2973 CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION = 11,
2974 /// Valid for launches. Set [CUlaunchAttributeValue::launchCompletionEvent](https://docs.nvidia.com/cuda/cuda-driver-api/unionCUlaunchAttributeValue.html#unionCUlaunchAttributeValue_1af92a022a05eba8d91f8c6b39c8d3db2) to record the event.
2975 /// Nominally, the event is triggered once all blocks of the kernel have begun execution. Currently this is a best effort. If
2976 /// a kernel B has a launch completion dependency on a kernel A, B may wait until A is complete. Alternatively, blocks of B may
2977 /// begin before all blocks of A have begun, for example if B can claim execution resources unavailable to A (e.g. they run on
2978 /// different GPUs) or if B is a higher priority than A. Exercise caution if such an ordering inversion could lead to deadlock.
2979 /// A launch completion event is nominally similar to a programmatic event with triggerAtBlockStart set except that it is not visible to <cudaGridDependencySynchronize()> and can be used with compute capability less than 9.0.
2980 /// The event supplied must not be an interprocess or interop event. The event must disable timing (i.e. must be created with
2981 /// the CU_EVENT_DISABLE_TIMING flag set).
2982 CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT = 12,
2983 /// Valid for graph nodes, launches. This attribute is graphs-only, and passing it to a launch in a non-capturing stream will
2984 /// result in an error.
2985 /// CUlaunchAttributeValue::deviceUpdatableKernelNode::deviceUpdatable can only be set to 0 or 1. Setting the field to 1 indicates
2986 /// that the corresponding kernel node should be device-updatable. On success, a handle will be returned via CUlaunchAttributeValue::deviceUpdatableKernelNode::devNode
2987 /// which can be passed to the various device-side update functions to update the node's kernel parameters from within another
2988 /// kernel. For more information on the types of device updates that can be made, as well as the relevant limitations thereof,
2989 /// see [cudaGraphKernelNodeUpdatesApply](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__GRAPH.html#group__CUDART__GRAPH_1g2d558cf37c9616365c67447e61ac0d6a).
2990 /// Nodes which are device-updatable have additional restrictions compared to regular kernel nodes. Firstly, device-updatable
2991 /// nodes cannot be removed from their graph via [`cuGraphDestroyNode`]. Additionally, once opted-in to this functionality, a node cannot opt out, and any attempt to set the deviceUpdatable attribute
2992 /// to 0 will result in an error. Device-updatable kernel nodes also cannot have their attributes copied to/from another kernel
2993 /// node via [`cuGraphKernelNodeCopyAttributes`]. Graphs containing one or more device-updatable nodes also do not allow multiple instantiation, and neither the graph nor
2994 /// its instantiated version can be passed to [`cuGraphExecUpdate_v2`].
2995 /// If a graph contains device-updatable nodes and updates those nodes from the device from within the graph, the graph must be
2996 /// uploaded with [`cuGraphUpload`] before it is launched. For such a graph, if host-side executable graph updates are made to the device-updatable nodes, the
2997 /// graph must be uploaded before it is launched again.
2998 CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE = 13,
2999 /// Valid for launches. On devices where the L1 cache and shared memory use the same hardware resources, setting [CUlaunchAttributeValue::sharedMemCarveout](https://docs.nvidia.com/cuda/cuda-driver-api/unionCUlaunchAttributeValue.html#unionCUlaunchAttributeValue_1b4890866538ded7d27e648d399caaff2) to a percentage between 0-100 signals the CUDA driver to set the shared memory carveout preference, in percent of the total
3000 /// shared memory for that kernel launch. This attribute takes precedence over CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT. This is only a hint, and the CUDA driver can choose a different configuration if required for the launch.
3001 CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = 14,
3002 /// Valid for streams, graph nodes, launches. This attribute is a hint to the CUDA runtime that the launch should attempt to make
3003 /// the kernel maximize its NVLINK utilization.
3004 /// When possible to honor this hint, CUDA will assume each block in the grid launch will carry out an even amount of NVLINK traffic,
3005 /// and make a best-effort attempt to adjust the kernel launch based on that assumption.
3006 /// This attribute is a hint only. CUDA makes no functional or performance guarantee. Its applicability can be affected by many
3007 /// different factors, including driver version (i.e. CUDA doesn't guarantee the performance characteristics will be maintained
3008 /// between driver versions or a driver update could alter or regress previously observed perf characteristics.) It also doesn't
3009 /// guarantee a successful result, i.e. applying the attribute may not improve the performance of either the targeted kernel or
3010 /// the encapsulating application.
3011 /// Valid values for CUlaunchAttributeValue::nvlinkUtilCentricScheduling are 0 (disabled) and 1 (enabled).
3012 CU_LAUNCH_ATTRIBUTE_NVLINK_UTIL_CENTRIC_SCHEDULING = 16,
3013 /// Valid for graph nodes, launches. This controls whether the kernel launch is allowed to use a non-portable cluster size. Valid
3014 /// values for [CUlaunchAttributeValue::portableClusterSizeMode](https://docs.nvidia.com/cuda/cuda-driver-api/unionCUlaunchAttributeValue.html#unionCUlaunchAttributeValue_1b59ceb6906a7de4ce07de5f2269d18b3) are described in `CUlaunchAttributePortableClusterMode`. Any other value will return CUDA_ERROR_INVALID_VALUE.
3015 CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE = 17,
3016 /// Valid for graph nodes, launches. This indicates if the kernel is allowed to use a non-portable dynamic shared memory mode.
3017 CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE = 18,
3018}
3019pub use self::CUlaunchAttributeID_enum as CUlaunchAttributeID;
3020#[repr(C)]
3021#[derive(Copy, Clone)]
3022pub union CUlaunchAttributeValue_union {
3023 pub pad: [::core::ffi::c_char; 64usize],
3024 pub accessPolicyWindow: CUaccessPolicyWindow,
3025 pub cooperative: ::core::ffi::c_int,
3026 pub syncPolicy: CUsynchronizationPolicy,
3027 pub clusterDim: CUlaunchAttributeValue_union__bindgen_ty_1,
3028 pub clusterSchedulingPolicyPreference: CUclusterSchedulingPolicy,
3029 pub programmaticStreamSerializationAllowed: ::core::ffi::c_int,
3030 pub programmaticEvent: CUlaunchAttributeValue_union__bindgen_ty_2,
3031 pub launchCompletionEvent: CUlaunchAttributeValue_union__bindgen_ty_3,
3032 pub priority: ::core::ffi::c_int,
3033 pub memSyncDomainMap: CUlaunchMemSyncDomainMap,
3034 pub memSyncDomain: CUlaunchMemSyncDomain,
3035 pub preferredClusterDim: CUlaunchAttributeValue_union__bindgen_ty_4,
3036 pub deviceUpdatableKernelNode: CUlaunchAttributeValue_union__bindgen_ty_5,
3037 pub sharedMemCarveout: ::core::ffi::c_uint,
3038 pub nvlinkUtilCentricScheduling: ::core::ffi::c_uint,
3039 pub portableClusterSizeMode: CUlaunchAttributePortableClusterMode,
3040 pub sharedMemoryMode: CUsharedMemoryMode,
3041}
3042#[repr(C)]
3043#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3044pub struct CUlaunchAttributeValue_union__bindgen_ty_1 {
3045 pub x: ::core::ffi::c_uint,
3046 pub y: ::core::ffi::c_uint,
3047 pub z: ::core::ffi::c_uint,
3048}
3049#[repr(C)]
3050#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3051pub struct CUlaunchAttributeValue_union__bindgen_ty_2 {
3052 pub event: CUevent,
3053 pub flags: ::core::ffi::c_int,
3054 pub triggerAtBlockStart: ::core::ffi::c_int,
3055}
3056impl Default for CUlaunchAttributeValue_union__bindgen_ty_2 {
3057 fn default() -> Self {
3058 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3059 unsafe {
3060 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3061 s.assume_init()
3062 }
3063 }
3064}
3065#[repr(C)]
3066#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3067pub struct CUlaunchAttributeValue_union__bindgen_ty_3 {
3068 pub event: CUevent,
3069 pub flags: ::core::ffi::c_int,
3070}
3071impl Default for CUlaunchAttributeValue_union__bindgen_ty_3 {
3072 fn default() -> Self {
3073 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3074 unsafe {
3075 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3076 s.assume_init()
3077 }
3078 }
3079}
3080#[repr(C)]
3081#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3082pub struct CUlaunchAttributeValue_union__bindgen_ty_4 {
3083 pub x: ::core::ffi::c_uint,
3084 pub y: ::core::ffi::c_uint,
3085 pub z: ::core::ffi::c_uint,
3086}
3087#[repr(C)]
3088#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3089pub struct CUlaunchAttributeValue_union__bindgen_ty_5 {
3090 pub deviceUpdatable: ::core::ffi::c_int,
3091 pub devNode: CUgraphDeviceNode,
3092}
3093impl Default for CUlaunchAttributeValue_union__bindgen_ty_5 {
3094 fn default() -> Self {
3095 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3096 unsafe {
3097 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3098 s.assume_init()
3099 }
3100 }
3101}
3102impl Default for CUlaunchAttributeValue_union {
3103 fn default() -> Self {
3104 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3105 unsafe {
3106 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3107 s.assume_init()
3108 }
3109 }
3110}
3111/// Launch attributes union; used as value field of [`CUlaunchAttribute`].
3112pub type CUlaunchAttributeValue = CUlaunchAttributeValue_union;
3113#[repr(C)]
3114#[derive(Copy, Clone)]
3115pub struct CUlaunchAttribute_st {
3116 pub id: CUlaunchAttributeID,
3117 pub pad: [::core::ffi::c_char; 4usize],
3118 pub value: CUlaunchAttributeValue,
3119}
3120impl Default for CUlaunchAttribute_st {
3121 fn default() -> Self {
3122 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3123 unsafe {
3124 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3125 s.assume_init()
3126 }
3127 }
3128}
3129/// Launch attribute.
3130pub type CUlaunchAttribute = CUlaunchAttribute_st;
3131#[repr(C)]
3132#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3133pub struct CUlaunchConfig_st {
3134 pub gridDimX: ::core::ffi::c_uint,
3135 pub gridDimY: ::core::ffi::c_uint,
3136 pub gridDimZ: ::core::ffi::c_uint,
3137 pub blockDimX: ::core::ffi::c_uint,
3138 pub blockDimY: ::core::ffi::c_uint,
3139 pub blockDimZ: ::core::ffi::c_uint,
3140 pub sharedMemBytes: ::core::ffi::c_uint,
3141 pub hStream: CUstream,
3142 pub attrs: *mut CUlaunchAttribute,
3143 pub numAttrs: ::core::ffi::c_uint,
3144}
3145impl Default for CUlaunchConfig_st {
3146 fn default() -> Self {
3147 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3148 unsafe {
3149 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3150 s.assume_init()
3151 }
3152 }
3153}
3154/// CUDA extensible launch configuration.
3155pub type CUlaunchConfig = CUlaunchConfig_st;
3156pub use self::CUlaunchAttributeID as CUkernelNodeAttrID;
3157pub type CUkernelNodeAttrValue_v1 = CUlaunchAttributeValue;
3158pub type CUkernelNodeAttrValue = CUkernelNodeAttrValue_v1;
3159/// Possible stream capture statuses returned by [`cuStreamIsCapturing`].
3160#[repr(u32)]
3161#[derive(
3162 Debug,
3163 Copy,
3164 Clone,
3165 Hash,
3166 PartialOrd,
3167 Ord,
3168 PartialEq,
3169 Eq,
3170 TryFromPrimitive,
3171 IntoPrimitive,
3172)]
3173pub enum CUstreamCaptureStatus_enum {
3174 /// Stream is not capturing.
3175 CU_STREAM_CAPTURE_STATUS_NONE = 0,
3176 /// Stream is actively capturing.
3177 CU_STREAM_CAPTURE_STATUS_ACTIVE = 1,
3178 /// Stream is part of a capture sequence that has been invalidated, but not terminated.
3179 CU_STREAM_CAPTURE_STATUS_INVALIDATED = 2,
3180}
3181pub use self::CUstreamCaptureStatus_enum as CUstreamCaptureStatus;
3182/// Possible modes for stream capture thread interactions. For more details see [`cuStreamBeginCapture_v2`] and [`cuThreadExchangeStreamCaptureMode`].
3183#[repr(u32)]
3184#[derive(
3185 Debug,
3186 Copy,
3187 Clone,
3188 Hash,
3189 PartialOrd,
3190 Ord,
3191 PartialEq,
3192 Eq,
3193 TryFromPrimitive,
3194 IntoPrimitive,
3195)]
3196pub enum CUstreamCaptureMode_enum {
3197 CU_STREAM_CAPTURE_MODE_GLOBAL = 0,
3198 CU_STREAM_CAPTURE_MODE_THREAD_LOCAL = 1,
3199 CU_STREAM_CAPTURE_MODE_RELAXED = 2,
3200}
3201pub use self::CUlaunchAttributeID as CUstreamAttrID;
3202pub use self::CUstreamCaptureMode_enum as CUstreamCaptureMode;
3203pub type CUstreamAttrValue_v1 = CUlaunchAttributeValue;
3204pub type CUstreamAttrValue = CUstreamAttrValue_v1;
3205/// Flags to specify search options. For more details see [`cuGetProcAddress_v2`].
3206#[repr(u32)]
3207#[derive(
3208 Debug,
3209 Copy,
3210 Clone,
3211 Hash,
3212 PartialOrd,
3213 Ord,
3214 PartialEq,
3215 Eq,
3216 TryFromPrimitive,
3217 IntoPrimitive,
3218)]
3219pub enum CUdriverProcAddress_flags_enum {
3220 /// Default search mode for driver symbols.
3221 CU_GET_PROC_ADDRESS_DEFAULT = 0,
3222 /// Search for legacy versions of driver symbols.
3223 CU_GET_PROC_ADDRESS_LEGACY_STREAM = 1,
3224 /// Search for per-thread versions of driver symbols.
3225 CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM = 2,
3226}
3227pub use self::CUdriverProcAddress_flags_enum as CUdriverProcAddress_flags;
3228/// Flags to indicate search status. For more details see [`cuGetProcAddress_v2`].
3229#[repr(u32)]
3230#[derive(
3231 Debug,
3232 Copy,
3233 Clone,
3234 Hash,
3235 PartialOrd,
3236 Ord,
3237 PartialEq,
3238 Eq,
3239 TryFromPrimitive,
3240 IntoPrimitive,
3241)]
3242pub enum CUdriverProcAddressQueryResult_enum {
3243 /// Symbol was succesfully found.
3244 CU_GET_PROC_ADDRESS_SUCCESS = 0,
3245 /// Symbol was not found in search.
3246 CU_GET_PROC_ADDRESS_SYMBOL_NOT_FOUND = 1,
3247 /// Symbol was found but version supplied was not sufficient.
3248 CU_GET_PROC_ADDRESS_VERSION_NOT_SUFFICIENT = 2,
3249}
3250pub use self::CUdriverProcAddressQueryResult_enum as CUdriverProcAddressQueryResult;
3251/// Execution Affinity Types.
3252#[repr(u32)]
3253#[derive(
3254 Debug,
3255 Copy,
3256 Clone,
3257 Hash,
3258 PartialOrd,
3259 Ord,
3260 PartialEq,
3261 Eq,
3262 TryFromPrimitive,
3263 IntoPrimitive,
3264)]
3265pub enum CUexecAffinityType_enum {
3266 /// Create a context with limited SMs.
3267 CU_EXEC_AFFINITY_TYPE_SM_COUNT = 0,
3268 CU_EXEC_AFFINITY_TYPE_MAX = 1,
3269}
3270pub use self::CUexecAffinityType_enum as CUexecAffinityType;
3271#[repr(C)]
3272#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3273pub struct CUexecAffinitySmCount_st {
3274 pub val: ::core::ffi::c_uint,
3275}
3276/// Value for [`CUexecAffinityType_enum::CU_EXEC_AFFINITY_TYPE_SM_COUNT`].
3277pub type CUexecAffinitySmCount_v1 = CUexecAffinitySmCount_st;
3278pub type CUexecAffinitySmCount = CUexecAffinitySmCount_v1;
3279#[repr(C)]
3280#[derive(Copy, Clone)]
3281pub struct CUexecAffinityParam_st {
3282 pub type_: CUexecAffinityType,
3283 pub param: CUexecAffinityParam_st__bindgen_ty_1,
3284}
3285#[repr(C)]
3286#[derive(Copy, Clone)]
3287pub union CUexecAffinityParam_st__bindgen_ty_1 {
3288 pub smCount: CUexecAffinitySmCount,
3289}
3290impl Default for CUexecAffinityParam_st__bindgen_ty_1 {
3291 fn default() -> Self {
3292 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3293 unsafe {
3294 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3295 s.assume_init()
3296 }
3297 }
3298}
3299impl Default for CUexecAffinityParam_st {
3300 fn default() -> Self {
3301 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3302 unsafe {
3303 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3304 s.assume_init()
3305 }
3306 }
3307}
3308/// Execution Affinity Parameters.
3309pub type CUexecAffinityParam_v1 = CUexecAffinityParam_st;
3310/// Execution Affinity Parameters.
3311pub type CUexecAffinityParam = CUexecAffinityParam_v1;
3312#[repr(u32)]
3313#[derive(
3314 Debug,
3315 Copy,
3316 Clone,
3317 Hash,
3318 PartialOrd,
3319 Ord,
3320 PartialEq,
3321 Eq,
3322 TryFromPrimitive,
3323 IntoPrimitive,
3324)]
3325pub enum CUcigDataType_enum {
3326 CIG_DATA_TYPE_D3D12_COMMAND_QUEUE = 1,
3327 CIG_DATA_TYPE_NV_BLOB = 2,
3328}
3329pub use self::CUcigDataType_enum as CUcigDataType;
3330#[repr(C)]
3331#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3332pub struct CUctxCigParam_st {
3333 pub sharedDataType: CUcigDataType,
3334 pub sharedData: *mut ::core::ffi::c_void,
3335}
3336impl Default for CUctxCigParam_st {
3337 fn default() -> Self {
3338 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3339 unsafe {
3340 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3341 s.assume_init()
3342 }
3343 }
3344}
3345/// CIG Context Create Params.
3346pub type CUctxCigParam = CUctxCigParam_st;
3347#[repr(C)]
3348#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3349pub struct CUctxCreateParams_st {
3350 pub execAffinityParams: *mut CUexecAffinityParam,
3351 pub numExecAffinityParams: ::core::ffi::c_int,
3352 pub cigParams: *mut CUctxCigParam,
3353}
3354impl Default for CUctxCreateParams_st {
3355 fn default() -> Self {
3356 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3357 unsafe {
3358 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3359 s.assume_init()
3360 }
3361 }
3362}
3363/// Params for creating CUDA context. Both execAffinityParams and cigParams cannot be non-NULL at the same time. If both are NULL,
3364/// the context will be created as a regular CUDA context.
3365pub type CUctxCreateParams = CUctxCreateParams_st;
3366#[repr(u32)]
3367#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3368pub enum CUstreamCigDataType_enum {
3369 STREAM_CIG_DATA_TYPE_D3D12_COMMAND_LIST = 1,
3370}
3371pub use self::CUstreamCigDataType_enum as CUstreamCigDataType;
3372#[repr(C)]
3373#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3374pub struct CUstreamCigParam_st {
3375 pub streamSharedDataType: CUstreamCigDataType,
3376 pub streamSharedData: *mut ::core::ffi::c_void,
3377}
3378impl Default for CUstreamCigParam_st {
3379 fn default() -> Self {
3380 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3381 unsafe {
3382 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3383 s.assume_init()
3384 }
3385 }
3386}
3387pub type CUstreamCigParam = CUstreamCigParam_st;
3388#[repr(C)]
3389#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3390pub struct CUstreamCigCaptureParams_st {
3391 pub streamCigParams: *mut CUstreamCigParam,
3392}
3393impl Default for CUstreamCigCaptureParams_st {
3394 fn default() -> Self {
3395 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3396 unsafe {
3397 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3398 s.assume_init()
3399 }
3400 }
3401}
3402pub type CUstreamCigCaptureParams = CUstreamCigCaptureParams_st;
3403/// Library options to be specified with [`cuLibraryLoadData`] or [`cuLibraryLoadFromFile`].
3404#[repr(u32)]
3405#[derive(
3406 Debug,
3407 Copy,
3408 Clone,
3409 Hash,
3410 PartialOrd,
3411 Ord,
3412 PartialEq,
3413 Eq,
3414 TryFromPrimitive,
3415 IntoPrimitive,
3416)]
3417pub enum CUlibraryOption_enum {
3418 CU_LIBRARY_HOST_UNIVERSAL_FUNCTION_AND_DATA_TABLE = 0,
3419 /// Specifes that the argument code passed to [`cuLibraryLoadData`] will be preserved. Specifying this option will let the driver know that code can be accessed at any point until [`cuLibraryUnload`]. The default behavior is for the driver to allocate and maintain its own copy of code. Note that this is only a memory usage optimization hint and the driver can choose to ignore it if required. Specifying this
3420 /// option with [`cuLibraryLoadFromFile`] is invalid and will return CUDA_ERROR_INVALID_VALUE.
3421 CU_LIBRARY_BINARY_IS_PRESERVED = 1,
3422 CU_LIBRARY_NUM_OPTIONS = 2,
3423}
3424pub use self::CUlibraryOption_enum as CUlibraryOption;
3425#[repr(C)]
3426#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3427pub struct CUlibraryHostUniversalFunctionAndDataTable_st {
3428 pub functionTable: *mut ::core::ffi::c_void,
3429 pub functionWindowSize: size_t,
3430 pub dataTable: *mut ::core::ffi::c_void,
3431 pub dataWindowSize: size_t,
3432}
3433impl Default for CUlibraryHostUniversalFunctionAndDataTable_st {
3434 fn default() -> Self {
3435 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3436 unsafe {
3437 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3438 s.assume_init()
3439 }
3440 }
3441}
3442pub type CUlibraryHostUniversalFunctionAndDataTable = CUlibraryHostUniversalFunctionAndDataTable_st;
3443/// Error codes.
3444#[repr(u32)]
3445#[derive(
3446 Debug,
3447 Copy,
3448 Clone,
3449 Hash,
3450 PartialOrd,
3451 Ord,
3452 PartialEq,
3453 Eq,
3454 TryFromPrimitive,
3455 IntoPrimitive,
3456)]
3457pub enum cudaError_enum {
3458 /// The API call returned with no errors. In the case of query calls, this also means that the operation being queried is complete
3459 /// (see [`cuEventQuery`] and [`cuStreamQuery`]).
3460 CUDA_SUCCESS = 0,
3461 /// This indicates that one or more of the parameters passed to the API call is not within an acceptable range of values.
3462 CUDA_ERROR_INVALID_VALUE = 1,
3463 /// The API call failed because it was unable to allocate enough memory or other resources to perform the requested operation.
3464 CUDA_ERROR_OUT_OF_MEMORY = 2,
3465 /// This indicates that the CUDA driver has not been initialized with [`cuInit`] has not been called, any function from the driver API will return [`CUresult::CUDA_ERROR_NOT_INITIALIZED`].") or that initialization has failed.
3466 CUDA_ERROR_NOT_INITIALIZED = 3,
3467 /// This indicates that the CUDA driver is in the process of shutting down.
3468 CUDA_ERROR_DEINITIALIZED = 4,
3469 /// This indicates profiler is not initialized for this run. This can happen when the application is running with external profiling
3470 /// tools like visual profiler.
3471 CUDA_ERROR_PROFILER_DISABLED = 5,
3472 #[deprecated]
3473 CUDA_ERROR_PROFILER_NOT_INITIALIZED = 6,
3474 #[deprecated]
3475 CUDA_ERROR_PROFILER_ALREADY_STARTED = 7,
3476 #[deprecated]
3477 CUDA_ERROR_PROFILER_ALREADY_STOPPED = 8,
3478 /// This indicates that the CUDA driver that the application has loaded is a stub library. Applications that run with the stub
3479 /// rather than a real driver loaded will result in CUDA API returning this error.
3480 CUDA_ERROR_STUB_LIBRARY = 34,
3481 /// This indicates that the API call requires a newer CUDA driver than the one currently installed. Users should install an updated
3482 /// NVIDIA CUDA driver to allow the API call to succeed.
3483 CUDA_ERROR_CALL_REQUIRES_NEWER_DRIVER = 36,
3484 /// This indicates that requested CUDA device is unavailable at the current time. Devices are often unavailable due to use of
3485 /// CU_COMPUTEMODE_EXCLUSIVE_PROCESS or CU_COMPUTEMODE_PROHIBITED.
3486 CUDA_ERROR_DEVICE_UNAVAILABLE = 46,
3487 /// This indicates that no CUDA-capable devices were detected by the installed CUDA driver.
3488 CUDA_ERROR_NO_DEVICE = 100,
3489 /// This indicates that the device ordinal supplied by the user does not correspond to a valid CUDA device or that the action
3490 /// requested is invalid for the specified device.
3491 CUDA_ERROR_INVALID_DEVICE = 101,
3492 /// This error indicates that the Grid license is not applied.
3493 CUDA_ERROR_DEVICE_NOT_LICENSED = 102,
3494 /// This indicates that the device kernel image is invalid. This can also indicate an invalid CUDA module.
3495 CUDA_ERROR_INVALID_IMAGE = 200,
3496 /// This most frequently indicates that there is no context bound to the current thread. This can also be returned if the context
3497 /// passed to an API call is not a valid handle (such as a context that has had [`cuCtxDestroy_v2`] invoked on it). This can also be returned if a user mixes different API versions (i.e. 3010 context with 3020 API calls).
3498 /// See [`cuCtxGetApiVersion`] for more details. This can also be returned if the green context passed to an API call was not converted to a [`CUcontext`] using [`cuCtxFromGreenCtx`] API.
3499 CUDA_ERROR_INVALID_CONTEXT = 201,
3500 /// This indicated that the context being supplied as a parameter to the API call was already the active context.
3501 #[deprecated]
3502 CUDA_ERROR_CONTEXT_ALREADY_CURRENT = 202,
3503 /// This indicates that a map or register operation has failed.
3504 CUDA_ERROR_MAP_FAILED = 205,
3505 /// This indicates that an unmap or unregister operation has failed.
3506 CUDA_ERROR_UNMAP_FAILED = 206,
3507 /// This indicates that the specified array is currently mapped and thus cannot be destroyed.
3508 CUDA_ERROR_ARRAY_IS_MAPPED = 207,
3509 /// This indicates that the resource is already mapped.
3510 CUDA_ERROR_ALREADY_MAPPED = 208,
3511 /// This indicates that there is no kernel image available that is suitable for the device. This can occur when a user specifies
3512 /// code generation options for a particular CUDA source file that do not include the corresponding device configuration.
3513 CUDA_ERROR_NO_BINARY_FOR_GPU = 209,
3514 /// This indicates that a resource has already been acquired.
3515 CUDA_ERROR_ALREADY_ACQUIRED = 210,
3516 /// This indicates that a resource is not mapped.
3517 CUDA_ERROR_NOT_MAPPED = 211,
3518 /// This indicates that a mapped resource is not available for access as an array.
3519 CUDA_ERROR_NOT_MAPPED_AS_ARRAY = 212,
3520 /// This indicates that a mapped resource is not available for access as a pointer.
3521 CUDA_ERROR_NOT_MAPPED_AS_POINTER = 213,
3522 /// This indicates that an uncorrectable ECC error was detected during execution.
3523 CUDA_ERROR_ECC_UNCORRECTABLE = 214,
3524 /// This indicates that the `CUlimit` passed to the API call is not supported by the active device.
3525 CUDA_ERROR_UNSUPPORTED_LIMIT = 215,
3526 /// This indicates that the [`CUcontext`] passed to the API call can only be bound to a single CPU thread at a time but is already bound to a CPU thread.
3527 CUDA_ERROR_CONTEXT_ALREADY_IN_USE = 216,
3528 /// This indicates that peer access is not supported across the given devices.
3529 CUDA_ERROR_PEER_ACCESS_UNSUPPORTED = 217,
3530 /// This indicates that a PTX JIT compilation failed.
3531 CUDA_ERROR_INVALID_PTX = 218,
3532 /// This indicates an error with OpenGL or DirectX context.
3533 CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = 219,
3534 /// This indicates that an uncorrectable NVLink error was detected during the execution.
3535 CUDA_ERROR_NVLINK_UNCORRECTABLE = 220,
3536 /// This indicates that the PTX JIT compiler library was not found.
3537 CUDA_ERROR_JIT_COMPILER_NOT_FOUND = 221,
3538 /// This indicates that the provided PTX was compiled with an unsupported toolchain.
3539 CUDA_ERROR_UNSUPPORTED_PTX_VERSION = 222,
3540 /// This indicates that the PTX JIT compilation was disabled.
3541 CUDA_ERROR_JIT_COMPILATION_DISABLED = 223,
3542 /// This indicates that the `CUexecAffinityType` passed to the API call is not supported by the active device.
3543 CUDA_ERROR_UNSUPPORTED_EXEC_AFFINITY = 224,
3544 /// This indicates that the code to be compiled by the PTX JIT contains unsupported call to cudaDeviceSynchronize.
3545 CUDA_ERROR_UNSUPPORTED_DEVSIDE_SYNC = 225,
3546 /// This indicates that an exception occurred on the device that is now contained by the GPU's error containment capability. Common
3547 /// causes are - a. Certain types of invalid accesses of peer GPU memory over nvlink b. Certain classes of hardware errors This
3548 /// leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA,
3549 /// the process must be terminated and relaunched.
3550 CUDA_ERROR_CONTAINED = 226,
3551 /// This indicates that the device kernel source is invalid. This includes compilation/linker errors encountered in device code
3552 /// or user error.
3553 CUDA_ERROR_INVALID_SOURCE = 300,
3554 /// This indicates that the file specified was not found.
3555 CUDA_ERROR_FILE_NOT_FOUND = 301,
3556 /// This indicates that a link to a shared object failed to resolve.
3557 CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302,
3558 /// This indicates that initialization of a shared object failed.
3559 CUDA_ERROR_SHARED_OBJECT_INIT_FAILED = 303,
3560 /// This indicates that an OS call failed.
3561 CUDA_ERROR_OPERATING_SYSTEM = 304,
3562 /// This indicates that a resource handle passed to the API call was not valid. Resource handles are opaque types like [`CUstream`] and [`CUevent`].
3563 CUDA_ERROR_INVALID_HANDLE = 400,
3564 /// This indicates that a resource required by the API call is not in a valid state to perform the requested operation.
3565 CUDA_ERROR_ILLEGAL_STATE = 401,
3566 /// This indicates an attempt was made to introspect an object in a way that would discard semantically important information.
3567 /// This is either due to the object using funtionality newer than the API version used to introspect it or omission of optional
3568 /// return arguments.
3569 CUDA_ERROR_LOSSY_QUERY = 402,
3570 /// This indicates that a named symbol was not found. Examples of symbols are global/constant variable names, driver function
3571 /// names, texture names, and surface names.
3572 CUDA_ERROR_NOT_FOUND = 500,
3573 /// This indicates that asynchronous operations issued previously have not completed yet. This result is not actually an error,
3574 /// but must be indicated differently than CUDA_SUCCESS (which indicates completion). Calls that may return this value include [`cuEventQuery`] and [`cuStreamQuery`].
3575 CUDA_ERROR_NOT_READY = 600,
3576 /// While executing a kernel, the device encountered a load or store instruction on an invalid memory address. This leaves the
3577 /// process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process
3578 /// must be terminated and relaunched.
3579 CUDA_ERROR_ILLEGAL_ADDRESS = 700,
3580 /// This indicates that a launch did not occur because it did not have appropriate resources. This error usually indicates that
3581 /// the user has attempted to pass too many arguments to the device kernel, or the kernel launch specifies too many threads for
3582 /// the kernel's register count. Passing arguments of the wrong size (i.e. a 64-bit pointer when a 32-bit int is expected) is
3583 /// equivalent to passing too many arguments and can also result in this error.
3584 CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES = 701,
3585 /// This indicates that the device kernel took too long to execute. This can only occur if timeouts are enabled - see the device
3586 /// attribute CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT for more information. This leaves the process in an inconsistent state and any further CUDA work will return the same error.
3587 /// To continue using CUDA, the process must be terminated and relaunched.
3588 CUDA_ERROR_LAUNCH_TIMEOUT = 702,
3589 /// This error indicates a kernel launch that uses an incompatible texturing mode.
3590 CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING = 703,
3591 /// This error indicates that a call to [`cuCtxEnablePeerAccess`] is trying to re-enable peer access to a context which has already had peer access to it enabled.
3592 CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED = 704,
3593 /// This error indicates that [`cuCtxDisablePeerAccess`] is trying to disable peer access which has not been enabled yet via [`cuCtxEnablePeerAccess`].
3594 CUDA_ERROR_PEER_ACCESS_NOT_ENABLED = 705,
3595 /// This error indicates that the primary context for the specified device has already been initialized.
3596 CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE = 708,
3597 /// This error indicates that the context current to the calling thread has been destroyed using [`cuCtxDestroy_v2`], or is a primary context which has not yet been initialized.
3598 CUDA_ERROR_CONTEXT_IS_DESTROYED = 709,
3599 /// A device-side assert triggered during kernel execution. The context cannot be used anymore, and must be destroyed. All existing
3600 /// device memory allocations from this context are invalid and must be reconstructed if the program is to continue using CUDA.
3601 CUDA_ERROR_ASSERT = 710,
3602 /// This error indicates that the hardware resources required to enable peer access have been exhausted for one or more of the
3603 /// devices passed to [`cuCtxEnablePeerAccess`].
3604 CUDA_ERROR_TOO_MANY_PEERS = 711,
3605 /// This error indicates that the memory range passed to [`cuMemHostRegister_v2`] has already been registered.
3606 CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED = 712,
3607 /// This error indicates that the pointer passed to [`cuMemHostUnregister`] does not correspond to any currently registered memory region.
3608 CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED = 713,
3609 /// While executing a kernel, the device encountered a stack error. This can be due to stack corruption or exceeding the stack
3610 /// size limit. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue
3611 /// using CUDA, the process must be terminated and relaunched.
3612 CUDA_ERROR_HARDWARE_STACK_ERROR = 714,
3613 /// While executing a kernel, the device encountered an illegal instruction. This leaves the process in an inconsistent state
3614 /// and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
3615 CUDA_ERROR_ILLEGAL_INSTRUCTION = 715,
3616 /// While executing a kernel, the device encountered a load or store instruction on a memory address which is not aligned. This
3617 /// leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA,
3618 /// the process must be terminated and relaunched.
3619 CUDA_ERROR_MISALIGNED_ADDRESS = 716,
3620 /// While executing a kernel, the device encountered an instruction which can only operate on memory locations in certain address
3621 /// spaces (global, shared, or local), but was supplied a memory address not belonging to an allowed address space. This leaves
3622 /// the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process
3623 /// must be terminated and relaunched.
3624 CUDA_ERROR_INVALID_ADDRESS_SPACE = 717,
3625 /// While executing a kernel, the device program counter wrapped its address space. This leaves the process in an inconsistent
3626 /// state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
3627 CUDA_ERROR_INVALID_PC = 718,
3628 /// An exception occurred on the device while executing a kernel. Common causes include dereferencing an invalid device pointer
3629 /// and accessing out of bounds shared memory. Less common cases can be system specific - more information about these cases can
3630 /// be found in the system specific user guide. This leaves the process in an inconsistent state and any further CUDA work will
3631 /// return the same error. To continue using CUDA, the process must be terminated and relaunched.
3632 CUDA_ERROR_LAUNCH_FAILED = 719,
3633 /// This error indicates that the number of blocks launched per grid for a kernel that was launched via either [`cuLaunchCooperativeKernel`] or [`cuLaunchCooperativeKernelMultiDevice`] exceeds the maximum number of blocks as allowed by [`cuOccupancyMaxActiveBlocksPerMultiprocessor`] or [`cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags`] times the number of multiprocessors as specified by the device attribute CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT.
3634 #[deprecated]
3635 CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE = 720,
3636 /// An exception occurred on the device while exiting a kernel using tensor memory: the tensor memory was not completely deallocated.
3637 /// This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA,
3638 /// the process must be terminated and relaunched.
3639 CUDA_ERROR_TENSOR_MEMORY_LEAK = 721,
3640 /// This error indicates that the attempted operation is not permitted.
3641 CUDA_ERROR_NOT_PERMITTED = 800,
3642 /// This error indicates that the attempted operation is not supported on the current system or device.
3643 CUDA_ERROR_NOT_SUPPORTED = 801,
3644 /// This error indicates that the system is not yet ready to start any CUDA work. To continue using CUDA, verify the system configuration
3645 /// is in a valid state and all required driver daemons are actively running. More information about this error can be found in
3646 /// the system specific user guide.
3647 CUDA_ERROR_SYSTEM_NOT_READY = 802,
3648 /// This error indicates that there is a mismatch between the versions of the display driver and the CUDA driver. Refer to the
3649 /// compatibility documentation for supported versions.
3650 CUDA_ERROR_SYSTEM_DRIVER_MISMATCH = 803,
3651 /// This error indicates that the system was upgraded to run with forward compatibility but the visible hardware detected by CUDA
3652 /// does not support this configuration. Refer to the compatibility documentation for the supported hardware matrix or ensure
3653 /// that only supported hardware is visible during initialization via the CUDA_VISIBLE_DEVICES environment variable.
3654 CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE = 804,
3655 /// This error indicates that the MPS client failed to connect to the MPS control daemon or the MPS server.
3656 CUDA_ERROR_MPS_CONNECTION_FAILED = 805,
3657 /// This error indicates that the remote procedural call between the MPS server and the MPS client failed.
3658 CUDA_ERROR_MPS_RPC_FAILURE = 806,
3659 /// This error indicates that the MPS server is not ready to accept new MPS client requests. This error can be returned when the
3660 /// MPS server is in the process of recovering from a fatal failure.
3661 CUDA_ERROR_MPS_SERVER_NOT_READY = 807,
3662 /// This error indicates that the hardware resources required to create MPS client have been exhausted.
3663 CUDA_ERROR_MPS_MAX_CLIENTS_REACHED = 808,
3664 /// This error indicates the hardware resources required to support device connections have been exhausted.
3665 CUDA_ERROR_MPS_MAX_CONNECTIONS_REACHED = 809,
3666 /// This error indicates that the MPS client has been terminated by the server. To continue using CUDA, the process must be terminated
3667 /// and relaunched.
3668 CUDA_ERROR_MPS_CLIENT_TERMINATED = 810,
3669 /// This error indicates that the module is using CUDA Dynamic Parallelism, but the current configuration, like MPS, does not
3670 /// support it.
3671 CUDA_ERROR_CDP_NOT_SUPPORTED = 811,
3672 /// This error indicates that a module contains an unsupported interaction between different versions of CUDA Dynamic Parallelism.
3673 CUDA_ERROR_CDP_VERSION_MISMATCH = 812,
3674 /// This error indicates that the operation is not permitted when the stream is capturing.
3675 CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED = 900,
3676 /// This error indicates that the current capture sequence on the stream has been invalidated due to a previous error.
3677 CUDA_ERROR_STREAM_CAPTURE_INVALIDATED = 901,
3678 /// This error indicates that the operation would have resulted in a merge of two independent capture sequences.
3679 CUDA_ERROR_STREAM_CAPTURE_MERGE = 902,
3680 /// This error indicates that the capture was not initiated in this stream.
3681 CUDA_ERROR_STREAM_CAPTURE_UNMATCHED = 903,
3682 /// This error indicates that the capture sequence contains a fork that was not joined to the primary stream.
3683 CUDA_ERROR_STREAM_CAPTURE_UNJOINED = 904,
3684 /// This error indicates that a dependency would have been created which crosses the capture sequence boundary. Only implicit
3685 /// in-stream ordering dependencies are allowed to cross the boundary.
3686 CUDA_ERROR_STREAM_CAPTURE_ISOLATION = 905,
3687 /// This error indicates a disallowed implicit dependency on a current capture sequence from cudaStreamLegacy.
3688 CUDA_ERROR_STREAM_CAPTURE_IMPLICIT = 906,
3689 /// This error indicates that the operation is not permitted on an event which was last recorded in a capturing stream.
3690 CUDA_ERROR_CAPTURED_EVENT = 907,
3691 /// A stream capture sequence not initiated with the [`CUstreamCaptureMode::CU_STREAM_CAPTURE_MODE_RELAXED`] argument to [`cuStreamBeginCapture_v2`] was passed to [`cuStreamEndCapture`] in a different thread.
3692 CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD = 908,
3693 /// This error indicates that the timeout specified for the wait operation has lapsed.
3694 CUDA_ERROR_TIMEOUT = 909,
3695 /// This error indicates that the graph update was not performed because it included changes which violated constraints specific
3696 /// to instantiated graph update.
3697 CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE = 910,
3698 /// This indicates that an error has occurred in a device outside of GPU. It can be a synchronous error with respect to CUDA API or an
3699 /// asynchronous error from the external device. In case of asynchronous error, it means that if CUDA was waiting for an external
3700 /// device's signal before consuming shared data, the external device signaled an error indicating that the data is not valid
3701 /// for consumption. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To
3702 /// continue using CUDA, the process must be terminated and relaunched. In case of synchronous error, it means that one or more
3703 /// external devices have encountered an error and cannot complete the operation.
3704 CUDA_ERROR_EXTERNAL_DEVICE = 911,
3705 /// Indicates a kernel launch error due to cluster misconfiguration.
3706 CUDA_ERROR_INVALID_CLUSTER_SIZE = 912,
3707 /// Indiciates a function handle is not loaded when calling an API that requires a loaded function.
3708 CUDA_ERROR_FUNCTION_NOT_LOADED = 913,
3709 /// This error indicates one or more resources passed in are not valid resource types for the operation.
3710 CUDA_ERROR_INVALID_RESOURCE_TYPE = 914,
3711 /// This error indicates one or more resources are insufficient or non-applicable for the operation.
3712 CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION = 915,
3713 /// This error indicates that an error happened during the key rotation sequence.
3714 CUDA_ERROR_KEY_ROTATION = 916,
3715 /// This error indicates that the requested operation is not permitted because the stream is in a detached state. This can occur
3716 /// if the green context associated with the stream has been destroyed, limiting the stream's operational capabilities.
3717 CUDA_ERROR_STREAM_DETACHED = 917,
3718 /// This error indicates that a graph recapture failed and had to be terminated.
3719 CUDA_ERROR_GRAPH_RECAPTURE_FAILURE = 918,
3720 /// This indicates that an unknown internal error has occurred.
3721 CUDA_ERROR_UNKNOWN = 999,
3722}
3723pub use self::cudaError_enum as CUresult;
3724impl CUdevice_P2PAttribute_enum {
3725 pub const CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED: CUdevice_P2PAttribute_enum = CUdevice_P2PAttribute_enum::CU_DEVICE_P2P_ATTRIBUTE_ACCESS_ACCESS_SUPPORTED;
3726}
3727/// P2P Attributes.
3728#[repr(u32)]
3729#[derive(
3730 Debug,
3731 Copy,
3732 Clone,
3733 Hash,
3734 PartialOrd,
3735 Ord,
3736 PartialEq,
3737 Eq,
3738 TryFromPrimitive,
3739 IntoPrimitive,
3740)]
3741pub enum CUdevice_P2PAttribute_enum {
3742 /// A relative value indicating the performance of the link between two devices.
3743 CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK = 1,
3744 /// P2P Access is enable.
3745 CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED = 2,
3746 /// All CUDA-valid atomic operation over the link are supported.
3747 CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED = 3,
3748 /// use [`CUdevice_P2PAttribute::CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED`] instead.
3749 #[deprecated]
3750 CU_DEVICE_P2P_ATTRIBUTE_ACCESS_ACCESS_SUPPORTED = 4,
3751 /// Only some CUDA-valid atomic operations over the link are supported.
3752 CU_DEVICE_P2P_ATTRIBUTE_ONLY_PARTIAL_NATIVE_ATOMIC_SUPPORTED = 5,
3753}
3754pub use self::CUdevice_P2PAttribute_enum as CUdevice_P2PAttribute;
3755/// CUDA stream callback.
3756pub type CUstreamCallback = ::core::option::Option<
3757 unsafe extern "C" fn(
3758 hStream: CUstream,
3759 status: CUresult,
3760 userData: *mut ::core::ffi::c_void,
3761 ),
3762>;
3763/// Block size to per-block dynamic shared memory mapping for a certain kernel.
3764pub type CUoccupancyB2DSize = ::core::option::Option<
3765 unsafe extern "C" fn(blockSize: ::core::ffi::c_int) -> size_t,
3766>;
3767#[repr(C)]
3768#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3769pub struct CUDA_MEMCPY2D_st {
3770 pub srcXInBytes: size_t,
3771 pub srcY: size_t,
3772 pub srcMemoryType: CUmemorytype,
3773 pub srcHost: *const ::core::ffi::c_void,
3774 pub srcDevice: CUdeviceptr,
3775 pub srcArray: CUarray,
3776 pub srcPitch: size_t,
3777 pub dstXInBytes: size_t,
3778 pub dstY: size_t,
3779 pub dstMemoryType: CUmemorytype,
3780 pub dstHost: *mut ::core::ffi::c_void,
3781 pub dstDevice: CUdeviceptr,
3782 pub dstArray: CUarray,
3783 pub dstPitch: size_t,
3784 pub WidthInBytes: size_t,
3785 pub Height: size_t,
3786}
3787impl Default for CUDA_MEMCPY2D_st {
3788 fn default() -> Self {
3789 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3790 unsafe {
3791 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3792 s.assume_init()
3793 }
3794 }
3795}
3796/// 2D memory copy parameters.
3797pub type CUDA_MEMCPY2D_v2 = CUDA_MEMCPY2D_st;
3798pub type CUDA_MEMCPY2D = CUDA_MEMCPY2D_v2;
3799#[repr(C)]
3800#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3801pub struct CUDA_MEMCPY3D_st {
3802 pub srcXInBytes: size_t,
3803 pub srcY: size_t,
3804 pub srcZ: size_t,
3805 pub srcLOD: size_t,
3806 pub srcMemoryType: CUmemorytype,
3807 pub srcHost: *const ::core::ffi::c_void,
3808 pub srcDevice: CUdeviceptr,
3809 pub srcArray: CUarray,
3810 pub reserved0: *mut ::core::ffi::c_void,
3811 pub srcPitch: size_t,
3812 pub srcHeight: size_t,
3813 pub dstXInBytes: size_t,
3814 pub dstY: size_t,
3815 pub dstZ: size_t,
3816 pub dstLOD: size_t,
3817 pub dstMemoryType: CUmemorytype,
3818 pub dstHost: *mut ::core::ffi::c_void,
3819 pub dstDevice: CUdeviceptr,
3820 pub dstArray: CUarray,
3821 pub reserved1: *mut ::core::ffi::c_void,
3822 pub dstPitch: size_t,
3823 pub dstHeight: size_t,
3824 pub WidthInBytes: size_t,
3825 pub Height: size_t,
3826 pub Depth: size_t,
3827}
3828impl Default for CUDA_MEMCPY3D_st {
3829 fn default() -> Self {
3830 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3831 unsafe {
3832 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3833 s.assume_init()
3834 }
3835 }
3836}
3837/// 3D memory copy parameters.
3838pub type CUDA_MEMCPY3D_v2 = CUDA_MEMCPY3D_st;
3839pub type CUDA_MEMCPY3D = CUDA_MEMCPY3D_v2;
3840#[repr(C)]
3841#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3842pub struct CUDA_MEMCPY3D_PEER_st {
3843 pub srcXInBytes: size_t,
3844 pub srcY: size_t,
3845 pub srcZ: size_t,
3846 pub srcLOD: size_t,
3847 pub srcMemoryType: CUmemorytype,
3848 pub srcHost: *const ::core::ffi::c_void,
3849 pub srcDevice: CUdeviceptr,
3850 pub srcArray: CUarray,
3851 pub srcContext: CUcontext,
3852 pub srcPitch: size_t,
3853 pub srcHeight: size_t,
3854 pub dstXInBytes: size_t,
3855 pub dstY: size_t,
3856 pub dstZ: size_t,
3857 pub dstLOD: size_t,
3858 pub dstMemoryType: CUmemorytype,
3859 pub dstHost: *mut ::core::ffi::c_void,
3860 pub dstDevice: CUdeviceptr,
3861 pub dstArray: CUarray,
3862 pub dstContext: CUcontext,
3863 pub dstPitch: size_t,
3864 pub dstHeight: size_t,
3865 pub WidthInBytes: size_t,
3866 pub Height: size_t,
3867 pub Depth: size_t,
3868}
3869impl Default for CUDA_MEMCPY3D_PEER_st {
3870 fn default() -> Self {
3871 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3872 unsafe {
3873 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3874 s.assume_init()
3875 }
3876 }
3877}
3878/// 3D memory cross-context copy parameters.
3879pub type CUDA_MEMCPY3D_PEER_v1 = CUDA_MEMCPY3D_PEER_st;
3880pub type CUDA_MEMCPY3D_PEER = CUDA_MEMCPY3D_PEER_v1;
3881#[repr(C)]
3882#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3883pub struct CUDA_MEMCPY_NODE_PARAMS_st {
3884 pub flags: ::core::ffi::c_int,
3885 pub reserved: ::core::ffi::c_int,
3886 pub copyCtx: CUcontext,
3887 pub copyParams: CUDA_MEMCPY3D,
3888}
3889impl Default for CUDA_MEMCPY_NODE_PARAMS_st {
3890 fn default() -> Self {
3891 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3892 unsafe {
3893 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3894 s.assume_init()
3895 }
3896 }
3897}
3898/// Memcpy node parameters.
3899pub type CUDA_MEMCPY_NODE_PARAMS = CUDA_MEMCPY_NODE_PARAMS_st;
3900#[repr(C)]
3901#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3902pub struct CUDA_ARRAY_DESCRIPTOR_st {
3903 pub Width: size_t,
3904 pub Height: size_t,
3905 pub Format: CUarray_format,
3906 pub NumChannels: ::core::ffi::c_uint,
3907}
3908impl Default for CUDA_ARRAY_DESCRIPTOR_st {
3909 fn default() -> Self {
3910 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3911 unsafe {
3912 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3913 s.assume_init()
3914 }
3915 }
3916}
3917/// Array descriptor.
3918pub type CUDA_ARRAY_DESCRIPTOR_v2 = CUDA_ARRAY_DESCRIPTOR_st;
3919pub type CUDA_ARRAY_DESCRIPTOR = CUDA_ARRAY_DESCRIPTOR_v2;
3920#[repr(C)]
3921#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3922pub struct CUDA_ARRAY3D_DESCRIPTOR_st {
3923 pub Width: size_t,
3924 pub Height: size_t,
3925 pub Depth: size_t,
3926 pub Format: CUarray_format,
3927 pub NumChannels: ::core::ffi::c_uint,
3928 pub Flags: ::core::ffi::c_uint,
3929}
3930impl Default for CUDA_ARRAY3D_DESCRIPTOR_st {
3931 fn default() -> Self {
3932 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3933 unsafe {
3934 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3935 s.assume_init()
3936 }
3937 }
3938}
3939/// 3D array descriptor.
3940pub type CUDA_ARRAY3D_DESCRIPTOR_v2 = CUDA_ARRAY3D_DESCRIPTOR_st;
3941pub type CUDA_ARRAY3D_DESCRIPTOR = CUDA_ARRAY3D_DESCRIPTOR_v2;
3942#[repr(C)]
3943#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3944pub struct CUDA_ARRAY_SPARSE_PROPERTIES_st {
3945 pub tileExtent: CUDA_ARRAY_SPARSE_PROPERTIES_st__bindgen_ty_1,
3946 pub miptailFirstLevel: ::core::ffi::c_uint,
3947 pub miptailSize: ::core::ffi::c_ulonglong,
3948 pub flags: ::core::ffi::c_uint,
3949 pub reserved: [::core::ffi::c_uint; 4usize],
3950}
3951#[repr(C)]
3952#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3953pub struct CUDA_ARRAY_SPARSE_PROPERTIES_st__bindgen_ty_1 {
3954 pub width: ::core::ffi::c_uint,
3955 pub height: ::core::ffi::c_uint,
3956 pub depth: ::core::ffi::c_uint,
3957}
3958/// CUDA array sparse properties.
3959pub type CUDA_ARRAY_SPARSE_PROPERTIES_v1 = CUDA_ARRAY_SPARSE_PROPERTIES_st;
3960pub type CUDA_ARRAY_SPARSE_PROPERTIES = CUDA_ARRAY_SPARSE_PROPERTIES_v1;
3961#[repr(C)]
3962#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3963pub struct CUDA_ARRAY_MEMORY_REQUIREMENTS_st {
3964 pub size: size_t,
3965 pub alignment: size_t,
3966 pub reserved: [::core::ffi::c_uint; 4usize],
3967}
3968/// CUDA array memory requirements.
3969pub type CUDA_ARRAY_MEMORY_REQUIREMENTS_v1 = CUDA_ARRAY_MEMORY_REQUIREMENTS_st;
3970pub type CUDA_ARRAY_MEMORY_REQUIREMENTS = CUDA_ARRAY_MEMORY_REQUIREMENTS_v1;
3971#[repr(C)]
3972#[derive(Copy, Clone)]
3973pub struct CUDA_RESOURCE_DESC_st {
3974 pub resType: CUresourcetype,
3975 pub res: CUDA_RESOURCE_DESC_st__bindgen_ty_1,
3976 pub flags: ::core::ffi::c_uint,
3977}
3978#[repr(C)]
3979#[derive(Copy, Clone)]
3980pub union CUDA_RESOURCE_DESC_st__bindgen_ty_1 {
3981 pub array: CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_1,
3982 pub mipmap: CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_2,
3983 pub linear: CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_3,
3984 pub pitch2D: CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_4,
3985 pub reserved: CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_5,
3986}
3987#[repr(C)]
3988#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3989pub struct CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_1 {
3990 pub hArray: CUarray,
3991}
3992impl Default for CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_1 {
3993 fn default() -> Self {
3994 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3995 unsafe {
3996 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3997 s.assume_init()
3998 }
3999 }
4000}
4001#[repr(C)]
4002#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4003pub struct CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_2 {
4004 pub hMipmappedArray: CUmipmappedArray,
4005}
4006impl Default for CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_2 {
4007 fn default() -> Self {
4008 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4009 unsafe {
4010 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4011 s.assume_init()
4012 }
4013 }
4014}
4015#[repr(C)]
4016#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4017pub struct CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_3 {
4018 pub devPtr: CUdeviceptr,
4019 pub format: CUarray_format,
4020 pub numChannels: ::core::ffi::c_uint,
4021 pub sizeInBytes: size_t,
4022}
4023impl Default for CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_3 {
4024 fn default() -> Self {
4025 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4026 unsafe {
4027 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4028 s.assume_init()
4029 }
4030 }
4031}
4032#[repr(C)]
4033#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4034pub struct CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_4 {
4035 pub devPtr: CUdeviceptr,
4036 pub format: CUarray_format,
4037 pub numChannels: ::core::ffi::c_uint,
4038 pub width: size_t,
4039 pub height: size_t,
4040 pub pitchInBytes: size_t,
4041}
4042impl Default for CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_4 {
4043 fn default() -> Self {
4044 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4045 unsafe {
4046 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4047 s.assume_init()
4048 }
4049 }
4050}
4051#[repr(C)]
4052#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4053pub struct CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_5 {
4054 pub reserved: [::core::ffi::c_int; 32usize],
4055}
4056impl Default for CUDA_RESOURCE_DESC_st__bindgen_ty_1 {
4057 fn default() -> Self {
4058 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4059 unsafe {
4060 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4061 s.assume_init()
4062 }
4063 }
4064}
4065impl Default for CUDA_RESOURCE_DESC_st {
4066 fn default() -> Self {
4067 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4068 unsafe {
4069 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4070 s.assume_init()
4071 }
4072 }
4073}
4074/// CUDA Resource descriptor.
4075pub type CUDA_RESOURCE_DESC_v1 = CUDA_RESOURCE_DESC_st;
4076pub type CUDA_RESOURCE_DESC = CUDA_RESOURCE_DESC_v1;
4077#[repr(C)]
4078#[derive(Debug, Copy, Clone, PartialOrd, PartialEq)]
4079pub struct CUDA_TEXTURE_DESC_st {
4080 pub addressMode: [CUaddress_mode; 3usize],
4081 pub filterMode: CUfilter_mode,
4082 pub flags: ::core::ffi::c_uint,
4083 pub maxAnisotropy: ::core::ffi::c_uint,
4084 pub mipmapFilterMode: CUfilter_mode,
4085 pub mipmapLevelBias: f32,
4086 pub minMipmapLevelClamp: f32,
4087 pub maxMipmapLevelClamp: f32,
4088 pub borderColor: [f32; 4usize],
4089 pub reserved: [::core::ffi::c_int; 12usize],
4090}
4091impl Default for CUDA_TEXTURE_DESC_st {
4092 fn default() -> Self {
4093 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4094 unsafe {
4095 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4096 s.assume_init()
4097 }
4098 }
4099}
4100/// Texture descriptor.
4101pub type CUDA_TEXTURE_DESC_v1 = CUDA_TEXTURE_DESC_st;
4102pub type CUDA_TEXTURE_DESC = CUDA_TEXTURE_DESC_v1;
4103/// Resource view format.
4104#[repr(u32)]
4105#[derive(
4106 Debug,
4107 Copy,
4108 Clone,
4109 Hash,
4110 PartialOrd,
4111 Ord,
4112 PartialEq,
4113 Eq,
4114 TryFromPrimitive,
4115 IntoPrimitive,
4116)]
4117pub enum CUresourceViewFormat_enum {
4118 /// No resource view format (use underlying resource format).
4119 CU_RES_VIEW_FORMAT_NONE = 0,
4120 /// 1 channel unsigned 8-bit integers.
4121 CU_RES_VIEW_FORMAT_UINT_1X8 = 1,
4122 /// 2 channel unsigned 8-bit integers.
4123 CU_RES_VIEW_FORMAT_UINT_2X8 = 2,
4124 /// 4 channel unsigned 8-bit integers.
4125 CU_RES_VIEW_FORMAT_UINT_4X8 = 3,
4126 /// 1 channel signed 8-bit integers.
4127 CU_RES_VIEW_FORMAT_SINT_1X8 = 4,
4128 /// 2 channel signed 8-bit integers.
4129 CU_RES_VIEW_FORMAT_SINT_2X8 = 5,
4130 /// 4 channel signed 8-bit integers.
4131 CU_RES_VIEW_FORMAT_SINT_4X8 = 6,
4132 /// 1 channel unsigned 16-bit integers.
4133 CU_RES_VIEW_FORMAT_UINT_1X16 = 7,
4134 /// 2 channel unsigned 16-bit integers.
4135 CU_RES_VIEW_FORMAT_UINT_2X16 = 8,
4136 /// 4 channel unsigned 16-bit integers.
4137 CU_RES_VIEW_FORMAT_UINT_4X16 = 9,
4138 /// 1 channel signed 16-bit integers.
4139 CU_RES_VIEW_FORMAT_SINT_1X16 = 10,
4140 /// 2 channel signed 16-bit integers.
4141 CU_RES_VIEW_FORMAT_SINT_2X16 = 11,
4142 /// 4 channel signed 16-bit integers.
4143 CU_RES_VIEW_FORMAT_SINT_4X16 = 12,
4144 /// 1 channel unsigned 32-bit integers.
4145 CU_RES_VIEW_FORMAT_UINT_1X32 = 13,
4146 /// 2 channel unsigned 32-bit integers.
4147 CU_RES_VIEW_FORMAT_UINT_2X32 = 14,
4148 /// 4 channel unsigned 32-bit integers.
4149 CU_RES_VIEW_FORMAT_UINT_4X32 = 15,
4150 /// 1 channel signed 32-bit integers.
4151 CU_RES_VIEW_FORMAT_SINT_1X32 = 16,
4152 /// 2 channel signed 32-bit integers.
4153 CU_RES_VIEW_FORMAT_SINT_2X32 = 17,
4154 /// 4 channel signed 32-bit integers.
4155 CU_RES_VIEW_FORMAT_SINT_4X32 = 18,
4156 /// 1 channel 16-bit floating point.
4157 CU_RES_VIEW_FORMAT_FLOAT_1X16 = 19,
4158 /// 2 channel 16-bit floating point.
4159 CU_RES_VIEW_FORMAT_FLOAT_2X16 = 20,
4160 /// 4 channel 16-bit floating point.
4161 CU_RES_VIEW_FORMAT_FLOAT_4X16 = 21,
4162 /// 1 channel 32-bit floating point.
4163 CU_RES_VIEW_FORMAT_FLOAT_1X32 = 22,
4164 /// 2 channel 32-bit floating point.
4165 CU_RES_VIEW_FORMAT_FLOAT_2X32 = 23,
4166 /// 4 channel 32-bit floating point.
4167 CU_RES_VIEW_FORMAT_FLOAT_4X32 = 24,
4168 /// Block compressed 1.
4169 CU_RES_VIEW_FORMAT_UNSIGNED_BC1 = 25,
4170 /// Block compressed 2.
4171 CU_RES_VIEW_FORMAT_UNSIGNED_BC2 = 26,
4172 /// Block compressed 3.
4173 CU_RES_VIEW_FORMAT_UNSIGNED_BC3 = 27,
4174 /// Block compressed 4 unsigned.
4175 CU_RES_VIEW_FORMAT_UNSIGNED_BC4 = 28,
4176 /// Block compressed 4 signed.
4177 CU_RES_VIEW_FORMAT_SIGNED_BC4 = 29,
4178 /// Block compressed 5 unsigned.
4179 CU_RES_VIEW_FORMAT_UNSIGNED_BC5 = 30,
4180 /// Block compressed 5 signed.
4181 CU_RES_VIEW_FORMAT_SIGNED_BC5 = 31,
4182 /// Block compressed 6 unsigned half-float.
4183 CU_RES_VIEW_FORMAT_UNSIGNED_BC6H = 32,
4184 /// Block compressed 6 signed half-float.
4185 CU_RES_VIEW_FORMAT_SIGNED_BC6H = 33,
4186 /// Block compressed 7.
4187 CU_RES_VIEW_FORMAT_UNSIGNED_BC7 = 34,
4188}
4189pub use self::CUresourceViewFormat_enum as CUresourceViewFormat;
4190#[repr(C)]
4191#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4192pub struct CUDA_RESOURCE_VIEW_DESC_st {
4193 pub format: CUresourceViewFormat,
4194 pub width: size_t,
4195 pub height: size_t,
4196 pub depth: size_t,
4197 pub firstMipmapLevel: ::core::ffi::c_uint,
4198 pub lastMipmapLevel: ::core::ffi::c_uint,
4199 pub firstLayer: ::core::ffi::c_uint,
4200 pub lastLayer: ::core::ffi::c_uint,
4201 pub reserved: [::core::ffi::c_uint; 16usize],
4202}
4203impl Default for CUDA_RESOURCE_VIEW_DESC_st {
4204 fn default() -> Self {
4205 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4206 unsafe {
4207 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4208 s.assume_init()
4209 }
4210 }
4211}
4212/// Resource view descriptor.
4213pub type CUDA_RESOURCE_VIEW_DESC_v1 = CUDA_RESOURCE_VIEW_DESC_st;
4214pub type CUDA_RESOURCE_VIEW_DESC = CUDA_RESOURCE_VIEW_DESC_v1;
4215#[repr(C)]
4216#[repr(align(128))]
4217#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4218pub struct CUtensorMap_st {
4219 pub opaque: [cuuint64_t; 16usize],
4220}
4221impl Default for CUtensorMap_st {
4222 fn default() -> Self {
4223 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4224 unsafe {
4225 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4226 s.assume_init()
4227 }
4228 }
4229}
4230/// Tensor map descriptor. Requires compiler support for aligning to 128 bytes.
4231pub type CUtensorMap = CUtensorMap_st;
4232/// Tensor map data type.
4233#[repr(u32)]
4234#[derive(
4235 Debug,
4236 Copy,
4237 Clone,
4238 Hash,
4239 PartialOrd,
4240 Ord,
4241 PartialEq,
4242 Eq,
4243 TryFromPrimitive,
4244 IntoPrimitive,
4245)]
4246pub enum CUtensorMapDataType_enum {
4247 CU_TENSOR_MAP_DATA_TYPE_UINT8 = 0,
4248 CU_TENSOR_MAP_DATA_TYPE_UINT16 = 1,
4249 CU_TENSOR_MAP_DATA_TYPE_UINT32 = 2,
4250 CU_TENSOR_MAP_DATA_TYPE_INT32 = 3,
4251 CU_TENSOR_MAP_DATA_TYPE_UINT64 = 4,
4252 CU_TENSOR_MAP_DATA_TYPE_INT64 = 5,
4253 CU_TENSOR_MAP_DATA_TYPE_FLOAT16 = 6,
4254 CU_TENSOR_MAP_DATA_TYPE_FLOAT32 = 7,
4255 CU_TENSOR_MAP_DATA_TYPE_FLOAT64 = 8,
4256 CU_TENSOR_MAP_DATA_TYPE_BFLOAT16 = 9,
4257 CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ = 10,
4258 CU_TENSOR_MAP_DATA_TYPE_TFLOAT32 = 11,
4259 CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ = 12,
4260 CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B = 13,
4261 CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B = 14,
4262 CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B = 15,
4263}
4264pub use self::CUtensorMapDataType_enum as CUtensorMapDataType;
4265/// Tensor map interleave layout type.
4266#[repr(u32)]
4267#[derive(
4268 Debug,
4269 Copy,
4270 Clone,
4271 Hash,
4272 PartialOrd,
4273 Ord,
4274 PartialEq,
4275 Eq,
4276 TryFromPrimitive,
4277 IntoPrimitive,
4278)]
4279pub enum CUtensorMapInterleave_enum {
4280 CU_TENSOR_MAP_INTERLEAVE_NONE = 0,
4281 CU_TENSOR_MAP_INTERLEAVE_16B = 1,
4282 CU_TENSOR_MAP_INTERLEAVE_32B = 2,
4283}
4284pub use self::CUtensorMapInterleave_enum as CUtensorMapInterleave;
4285/// Tensor map swizzling mode of shared memory banks.
4286#[repr(u32)]
4287#[derive(
4288 Debug,
4289 Copy,
4290 Clone,
4291 Hash,
4292 PartialOrd,
4293 Ord,
4294 PartialEq,
4295 Eq,
4296 TryFromPrimitive,
4297 IntoPrimitive,
4298)]
4299pub enum CUtensorMapSwizzle_enum {
4300 CU_TENSOR_MAP_SWIZZLE_NONE = 0,
4301 CU_TENSOR_MAP_SWIZZLE_32B = 1,
4302 CU_TENSOR_MAP_SWIZZLE_64B = 2,
4303 CU_TENSOR_MAP_SWIZZLE_128B = 3,
4304 CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B = 4,
4305 CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B_FLIP_8B = 5,
4306 CU_TENSOR_MAP_SWIZZLE_128B_ATOM_64B = 6,
4307}
4308pub use self::CUtensorMapSwizzle_enum as CUtensorMapSwizzle;
4309/// Tensor map L2 promotion type.
4310#[repr(u32)]
4311#[derive(
4312 Debug,
4313 Copy,
4314 Clone,
4315 Hash,
4316 PartialOrd,
4317 Ord,
4318 PartialEq,
4319 Eq,
4320 TryFromPrimitive,
4321 IntoPrimitive,
4322)]
4323pub enum CUtensorMapL2promotion_enum {
4324 CU_TENSOR_MAP_L2_PROMOTION_NONE = 0,
4325 CU_TENSOR_MAP_L2_PROMOTION_L2_64B = 1,
4326 CU_TENSOR_MAP_L2_PROMOTION_L2_128B = 2,
4327 CU_TENSOR_MAP_L2_PROMOTION_L2_256B = 3,
4328}
4329pub use self::CUtensorMapL2promotion_enum as CUtensorMapL2promotion;
4330/// Tensor map out-of-bounds fill type.
4331#[repr(u32)]
4332#[derive(
4333 Debug,
4334 Copy,
4335 Clone,
4336 Hash,
4337 PartialOrd,
4338 Ord,
4339 PartialEq,
4340 Eq,
4341 TryFromPrimitive,
4342 IntoPrimitive,
4343)]
4344pub enum CUtensorMapFloatOOBfill_enum {
4345 CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE = 0,
4346 CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA = 1,
4347}
4348pub use self::CUtensorMapFloatOOBfill_enum as CUtensorMapFloatOOBfill;
4349/// Tensor map Im2Col wide mode.
4350#[repr(u32)]
4351#[derive(
4352 Debug,
4353 Copy,
4354 Clone,
4355 Hash,
4356 PartialOrd,
4357 Ord,
4358 PartialEq,
4359 Eq,
4360 TryFromPrimitive,
4361 IntoPrimitive,
4362)]
4363pub enum CUtensorMapIm2ColWideMode_enum {
4364 CU_TENSOR_MAP_IM2COL_WIDE_MODE_W = 0,
4365 CU_TENSOR_MAP_IM2COL_WIDE_MODE_W128 = 1,
4366}
4367pub use self::CUtensorMapIm2ColWideMode_enum as CUtensorMapIm2ColWideMode;
4368#[repr(C)]
4369#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4370pub struct CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st {
4371 pub p2pToken: ::core::ffi::c_ulonglong,
4372 pub vaSpaceToken: ::core::ffi::c_uint,
4373}
4374/// GPU Direct v3 tokens.
4375pub type CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1 = CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st;
4376pub type CUDA_POINTER_ATTRIBUTE_P2P_TOKENS = CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1;
4377/// Access flags that specify the level of access the current context's device has on the memory referenced.
4378#[repr(u32)]
4379#[derive(
4380 Debug,
4381 Copy,
4382 Clone,
4383 Hash,
4384 PartialOrd,
4385 Ord,
4386 PartialEq,
4387 Eq,
4388 TryFromPrimitive,
4389 IntoPrimitive,
4390)]
4391pub enum CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum {
4392 /// No access, meaning the device cannot access this memory at all, thus must be staged through accessible memory in order to
4393 /// complete certain operations.
4394 CU_POINTER_ATTRIBUTE_ACCESS_FLAG_NONE = 0,
4395 /// Read-only access, meaning writes to this memory are considered invalid accesses and thus return error in that case.
4396 CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READ = 1,
4397 /// Read-write access, the device has full read-write access to the memory.
4398 CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READWRITE = 3,
4399}
4400pub use self::CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum as CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS;
4401#[repr(C)]
4402#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4403pub struct CUDA_LAUNCH_PARAMS_st {
4404 pub function: CUfunction,
4405 pub gridDimX: ::core::ffi::c_uint,
4406 pub gridDimY: ::core::ffi::c_uint,
4407 pub gridDimZ: ::core::ffi::c_uint,
4408 pub blockDimX: ::core::ffi::c_uint,
4409 pub blockDimY: ::core::ffi::c_uint,
4410 pub blockDimZ: ::core::ffi::c_uint,
4411 pub sharedMemBytes: ::core::ffi::c_uint,
4412 pub hStream: CUstream,
4413 pub kernelParams: *mut *mut ::core::ffi::c_void,
4414}
4415impl Default for CUDA_LAUNCH_PARAMS_st {
4416 fn default() -> Self {
4417 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4418 unsafe {
4419 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4420 s.assume_init()
4421 }
4422 }
4423}
4424/// Kernel launch parameters.
4425pub type CUDA_LAUNCH_PARAMS_v1 = CUDA_LAUNCH_PARAMS_st;
4426pub type CUDA_LAUNCH_PARAMS = CUDA_LAUNCH_PARAMS_v1;
4427/// External memory handle types.
4428#[repr(u32)]
4429#[derive(
4430 Debug,
4431 Copy,
4432 Clone,
4433 Hash,
4434 PartialOrd,
4435 Ord,
4436 PartialEq,
4437 Eq,
4438 TryFromPrimitive,
4439 IntoPrimitive,
4440)]
4441pub enum CUexternalMemoryHandleType_enum {
4442 /// Handle is an opaque file descriptor.
4443 CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD = 1,
4444 /// Handle is an opaque shared NT handle.
4445 CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32 = 2,
4446 /// Handle is an opaque, globally shared handle.
4447 CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3,
4448 /// Handle is a D3D12 heap object.
4449 CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP = 4,
4450 /// Handle is a D3D12 committed resource.
4451 CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE = 5,
4452 /// Handle is a shared NT handle to a D3D11 resource.
4453 CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE = 6,
4454 /// Handle is a globally shared handle to a D3D11 resource.
4455 CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT = 7,
4456 /// Handle is an NvSciBuf object.
4457 CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF = 8,
4458 /// Handle is a dma_buf file descriptor.
4459 CU_EXTERNAL_MEMORY_HANDLE_TYPE_DMABUF_FD = 9,
4460}
4461pub use self::CUexternalMemoryHandleType_enum as CUexternalMemoryHandleType;
4462#[repr(C)]
4463#[derive(Copy, Clone)]
4464pub struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st {
4465 pub type_: CUexternalMemoryHandleType,
4466 pub handle: CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st__bindgen_ty_1,
4467 pub size: ::core::ffi::c_ulonglong,
4468 pub flags: ::core::ffi::c_uint,
4469 pub reserved: [::core::ffi::c_uint; 16usize],
4470}
4471#[repr(C)]
4472#[derive(Copy, Clone)]
4473pub union CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st__bindgen_ty_1 {
4474 pub fd: ::core::ffi::c_int,
4475 pub win32: CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st__bindgen_ty_1__bindgen_ty_1,
4476 pub nvSciBufObject: *const ::core::ffi::c_void,
4477}
4478#[repr(C)]
4479#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4480pub struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st__bindgen_ty_1__bindgen_ty_1 {
4481 pub handle: *mut ::core::ffi::c_void,
4482 pub name: *const ::core::ffi::c_void,
4483}
4484impl Default for CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st__bindgen_ty_1__bindgen_ty_1 {
4485 fn default() -> Self {
4486 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4487 unsafe {
4488 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4489 s.assume_init()
4490 }
4491 }
4492}
4493impl Default for CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st__bindgen_ty_1 {
4494 fn default() -> Self {
4495 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4496 unsafe {
4497 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4498 s.assume_init()
4499 }
4500 }
4501}
4502impl Default for CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st {
4503 fn default() -> Self {
4504 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4505 unsafe {
4506 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4507 s.assume_init()
4508 }
4509 }
4510}
4511/// External memory handle descriptor.
4512pub type CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1 = CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st;
4513pub type CUDA_EXTERNAL_MEMORY_HANDLE_DESC = CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1;
4514#[repr(C)]
4515#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4516pub struct CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st {
4517 pub offset: ::core::ffi::c_ulonglong,
4518 pub size: ::core::ffi::c_ulonglong,
4519 pub flags: ::core::ffi::c_uint,
4520 pub reserved: [::core::ffi::c_uint; 16usize],
4521}
4522/// External memory buffer descriptor.
4523pub type CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1 = CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st;
4524pub type CUDA_EXTERNAL_MEMORY_BUFFER_DESC = CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1;
4525#[repr(C)]
4526#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4527pub struct CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st {
4528 pub offset: ::core::ffi::c_ulonglong,
4529 pub arrayDesc: CUDA_ARRAY3D_DESCRIPTOR,
4530 pub numLevels: ::core::ffi::c_uint,
4531 pub reserved: [::core::ffi::c_uint; 16usize],
4532}
4533impl Default for CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st {
4534 fn default() -> Self {
4535 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4536 unsafe {
4537 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4538 s.assume_init()
4539 }
4540 }
4541}
4542/// External memory mipmap descriptor.
4543pub type CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1 = CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st;
4544pub type CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC = CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1;
4545/// External semaphore handle types.
4546#[repr(u32)]
4547#[derive(
4548 Debug,
4549 Copy,
4550 Clone,
4551 Hash,
4552 PartialOrd,
4553 Ord,
4554 PartialEq,
4555 Eq,
4556 TryFromPrimitive,
4557 IntoPrimitive,
4558)]
4559pub enum CUexternalSemaphoreHandleType_enum {
4560 /// Handle is an opaque file descriptor.
4561 CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD = 1,
4562 /// Handle is an opaque shared NT handle.
4563 CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32 = 2,
4564 /// Handle is an opaque, globally shared handle.
4565 CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3,
4566 /// Handle is a shared NT handle referencing a D3D12 fence object.
4567 CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE = 4,
4568 /// Handle is a shared NT handle referencing a D3D11 fence object.
4569 CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE = 5,
4570 /// Opaque handle to NvSciSync Object.
4571 CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC = 6,
4572 /// Handle is a shared NT handle referencing a D3D11 keyed mutex object.
4573 CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX = 7,
4574 /// Handle is a globally shared handle referencing a D3D11 keyed mutex object.
4575 CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT = 8,
4576 /// Handle is an opaque file descriptor referencing a timeline semaphore.
4577 CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD = 9,
4578 /// Handle is an opaque shared NT handle referencing a timeline semaphore.
4579 CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 = 10,
4580}
4581pub use self::CUexternalSemaphoreHandleType_enum as CUexternalSemaphoreHandleType;
4582#[repr(C)]
4583#[derive(Copy, Clone)]
4584pub struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st {
4585 pub type_: CUexternalSemaphoreHandleType,
4586 pub handle: CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st__bindgen_ty_1,
4587 pub flags: ::core::ffi::c_uint,
4588 pub reserved: [::core::ffi::c_uint; 16usize],
4589}
4590#[repr(C)]
4591#[derive(Copy, Clone)]
4592pub union CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st__bindgen_ty_1 {
4593 pub fd: ::core::ffi::c_int,
4594 pub win32: CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st__bindgen_ty_1__bindgen_ty_1,
4595 pub nvSciSyncObj: *const ::core::ffi::c_void,
4596}
4597#[repr(C)]
4598#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4599pub struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st__bindgen_ty_1__bindgen_ty_1 {
4600 pub handle: *mut ::core::ffi::c_void,
4601 pub name: *const ::core::ffi::c_void,
4602}
4603impl Default for CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st__bindgen_ty_1__bindgen_ty_1 {
4604 fn default() -> Self {
4605 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4606 unsafe {
4607 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4608 s.assume_init()
4609 }
4610 }
4611}
4612impl Default for CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st__bindgen_ty_1 {
4613 fn default() -> Self {
4614 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4615 unsafe {
4616 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4617 s.assume_init()
4618 }
4619 }
4620}
4621impl Default for CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st {
4622 fn default() -> Self {
4623 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4624 unsafe {
4625 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4626 s.assume_init()
4627 }
4628 }
4629}
4630/// External semaphore handle descriptor.
4631pub type CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1 = CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st;
4632pub type CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC = CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1;
4633#[repr(C)]
4634#[derive(Copy, Clone)]
4635pub struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st {
4636 pub params: CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1,
4637 pub flags: ::core::ffi::c_uint,
4638 pub reserved: [::core::ffi::c_uint; 16usize],
4639}
4640#[repr(C)]
4641#[derive(Copy, Clone)]
4642pub struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1 {
4643 pub fence: CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1__bindgen_ty_1,
4644 pub nvSciSync: CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1__bindgen_ty_2,
4645 pub keyedMutex: CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1__bindgen_ty_3,
4646 pub reserved: [::core::ffi::c_uint; 12usize],
4647}
4648#[repr(C)]
4649#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4650pub struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1__bindgen_ty_1 {
4651 pub value: ::core::ffi::c_ulonglong,
4652}
4653#[repr(C)]
4654#[derive(Copy, Clone)]
4655pub union CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1__bindgen_ty_2 {
4656 pub fence: *mut ::core::ffi::c_void,
4657 pub reserved: ::core::ffi::c_ulonglong,
4658}
4659impl Default for CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1__bindgen_ty_2 {
4660 fn default() -> Self {
4661 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4662 unsafe {
4663 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4664 s.assume_init()
4665 }
4666 }
4667}
4668#[repr(C)]
4669#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4670pub struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1__bindgen_ty_3 {
4671 pub key: ::core::ffi::c_ulonglong,
4672}
4673impl Default for CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1 {
4674 fn default() -> Self {
4675 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4676 unsafe {
4677 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4678 s.assume_init()
4679 }
4680 }
4681}
4682impl Default for CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st {
4683 fn default() -> Self {
4684 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4685 unsafe {
4686 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4687 s.assume_init()
4688 }
4689 }
4690}
4691/// External semaphore signal parameters.
4692pub type CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1 = CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st;
4693pub type CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS = CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1;
4694#[repr(C)]
4695#[derive(Copy, Clone)]
4696pub struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st {
4697 pub params: CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1,
4698 pub flags: ::core::ffi::c_uint,
4699 pub reserved: [::core::ffi::c_uint; 16usize],
4700}
4701#[repr(C)]
4702#[derive(Copy, Clone)]
4703pub struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1 {
4704 pub fence: CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1__bindgen_ty_1,
4705 pub nvSciSync: CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1__bindgen_ty_2,
4706 pub keyedMutex: CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1__bindgen_ty_3,
4707 pub reserved: [::core::ffi::c_uint; 10usize],
4708}
4709#[repr(C)]
4710#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4711pub struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1__bindgen_ty_1 {
4712 pub value: ::core::ffi::c_ulonglong,
4713}
4714#[repr(C)]
4715#[derive(Copy, Clone)]
4716pub union CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1__bindgen_ty_2 {
4717 pub fence: *mut ::core::ffi::c_void,
4718 pub reserved: ::core::ffi::c_ulonglong,
4719}
4720impl Default for CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1__bindgen_ty_2 {
4721 fn default() -> Self {
4722 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4723 unsafe {
4724 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4725 s.assume_init()
4726 }
4727 }
4728}
4729#[repr(C)]
4730#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4731pub struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1__bindgen_ty_3 {
4732 pub key: ::core::ffi::c_ulonglong,
4733 pub timeoutMs: ::core::ffi::c_uint,
4734}
4735impl Default for CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1 {
4736 fn default() -> Self {
4737 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4738 unsafe {
4739 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4740 s.assume_init()
4741 }
4742 }
4743}
4744impl Default for CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st {
4745 fn default() -> Self {
4746 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4747 unsafe {
4748 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4749 s.assume_init()
4750 }
4751 }
4752}
4753/// External semaphore wait parameters.
4754pub type CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1 = CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st;
4755pub type CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS = CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1;
4756#[repr(C)]
4757#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4758pub struct CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st {
4759 pub extSemArray: *mut CUexternalSemaphore,
4760 pub paramsArray: *const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS,
4761 pub numExtSems: ::core::ffi::c_uint,
4762}
4763impl Default for CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st {
4764 fn default() -> Self {
4765 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4766 unsafe {
4767 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4768 s.assume_init()
4769 }
4770 }
4771}
4772/// Semaphore signal node parameters.
4773pub type CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1 = CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st;
4774pub type CUDA_EXT_SEM_SIGNAL_NODE_PARAMS = CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1;
4775#[repr(C)]
4776#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4777pub struct CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st {
4778 pub extSemArray: *mut CUexternalSemaphore,
4779 pub paramsArray: *const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS,
4780 pub numExtSems: ::core::ffi::c_uint,
4781}
4782impl Default for CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st {
4783 fn default() -> Self {
4784 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4785 unsafe {
4786 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4787 s.assume_init()
4788 }
4789 }
4790}
4791/// Semaphore signal node parameters.
4792pub type CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2 = CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st;
4793#[repr(C)]
4794#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4795pub struct CUDA_EXT_SEM_WAIT_NODE_PARAMS_st {
4796 pub extSemArray: *mut CUexternalSemaphore,
4797 pub paramsArray: *const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS,
4798 pub numExtSems: ::core::ffi::c_uint,
4799}
4800impl Default for CUDA_EXT_SEM_WAIT_NODE_PARAMS_st {
4801 fn default() -> Self {
4802 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4803 unsafe {
4804 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4805 s.assume_init()
4806 }
4807 }
4808}
4809/// Semaphore wait node parameters.
4810pub type CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1 = CUDA_EXT_SEM_WAIT_NODE_PARAMS_st;
4811pub type CUDA_EXT_SEM_WAIT_NODE_PARAMS = CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1;
4812#[repr(C)]
4813#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
4814pub struct CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st {
4815 pub extSemArray: *mut CUexternalSemaphore,
4816 pub paramsArray: *const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS,
4817 pub numExtSems: ::core::ffi::c_uint,
4818}
4819impl Default for CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st {
4820 fn default() -> Self {
4821 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
4822 unsafe {
4823 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4824 s.assume_init()
4825 }
4826 }
4827}
4828/// Semaphore wait node parameters.
4829pub type CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2 = CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st;
4830pub type CUmemGenericAllocationHandle_v1 = ::core::ffi::c_ulonglong;
4831pub type CUmemGenericAllocationHandle = CUmemGenericAllocationHandle_v1;
4832/// Flags for specifying particular handle types.
4833#[repr(u32)]
4834#[derive(
4835 Debug,
4836 Copy,
4837 Clone,
4838 Hash,
4839 PartialOrd,
4840 Ord,
4841 PartialEq,
4842 Eq,
4843 TryFromPrimitive,
4844 IntoPrimitive,
4845)]
4846pub enum CUmemAllocationHandleType_enum {
4847 /// Does not allow any export mechanism. >.
4848 CU_MEM_HANDLE_TYPE_NONE = 0,
4849 /// Allows a file descriptor to be used for exporting. Permitted only on POSIX systems. (int).
4850 CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR = 1,
4851 /// Allows a Win32 NT handle to be used for exporting. (HANDLE).
4852 CU_MEM_HANDLE_TYPE_WIN32 = 2,
4853 /// Allows a Win32 KMT handle to be used for exporting. (D3DKMT_HANDLE).
4854 CU_MEM_HANDLE_TYPE_WIN32_KMT = 4,
4855 /// Allows a fabric handle to be used for exporting. (CUmemFabricHandle).
4856 CU_MEM_HANDLE_TYPE_FABRIC = 8,
4857 CU_MEM_HANDLE_TYPE_MAX = 2147483647,
4858}
4859pub use self::CUmemAllocationHandleType_enum as CUmemAllocationHandleType;
4860/// Specifies the memory protection flags for mapping.
4861#[repr(u32)]
4862#[derive(
4863 Debug,
4864 Copy,
4865 Clone,
4866 Hash,
4867 PartialOrd,
4868 Ord,
4869 PartialEq,
4870 Eq,
4871 TryFromPrimitive,
4872 IntoPrimitive,
4873)]
4874pub enum CUmemAccess_flags_enum {
4875 /// Default, make the address range not accessible.
4876 CU_MEM_ACCESS_FLAGS_PROT_NONE = 0,
4877 /// Make the address range read accessible.
4878 CU_MEM_ACCESS_FLAGS_PROT_READ = 1,
4879 /// Make the address range read-write accessible.
4880 CU_MEM_ACCESS_FLAGS_PROT_READWRITE = 3,
4881 CU_MEM_ACCESS_FLAGS_PROT_MAX = 2147483647,
4882}
4883pub use self::CUmemAccess_flags_enum as CUmemAccess_flags;
4884impl CUmemLocationType_enum {
4885 pub const CU_MEM_LOCATION_TYPE_NONE: CUmemLocationType_enum = CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_INVALID;
4886}
4887/// Specifies the type of location.
4888#[repr(u32)]
4889#[derive(
4890 Debug,
4891 Copy,
4892 Clone,
4893 Hash,
4894 PartialOrd,
4895 Ord,
4896 PartialEq,
4897 Eq,
4898 TryFromPrimitive,
4899 IntoPrimitive,
4900)]
4901pub enum CUmemLocationType_enum {
4902 CU_MEM_LOCATION_TYPE_INVALID = 0,
4903 /// Location is a device location, thus id is a device ordinal.
4904 CU_MEM_LOCATION_TYPE_DEVICE = 1,
4905 /// Location is host, id is ignored.
4906 CU_MEM_LOCATION_TYPE_HOST = 2,
4907 /// Location is a host NUMA node, thus id is a host NUMA node id.
4908 CU_MEM_LOCATION_TYPE_HOST_NUMA = 3,
4909 /// Location is a host NUMA node of the current thread, id is ignored.
4910 CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT = 4,
4911 /// Location is not visible but device is accessible, id is always CU_DEVICE_INVALID.
4912 CU_MEM_LOCATION_TYPE_INVISIBLE = 5,
4913 CU_MEM_LOCATION_TYPE_MAX = 2147483647,
4914}
4915pub use self::CUmemLocationType_enum as CUmemLocationType;
4916/// Defines the allocation types available.
4917#[repr(u32)]
4918#[derive(
4919 Debug,
4920 Copy,
4921 Clone,
4922 Hash,
4923 PartialOrd,
4924 Ord,
4925 PartialEq,
4926 Eq,
4927 TryFromPrimitive,
4928 IntoPrimitive,
4929)]
4930pub enum CUmemAllocationType_enum {
4931 CU_MEM_ALLOCATION_TYPE_INVALID = 0,
4932 /// This allocation type is 'pinned', i.e. cannot migrate from its current location while the application is actively using it.
4933 CU_MEM_ALLOCATION_TYPE_PINNED = 1,
4934 /// This allocation type is managed memory.
4935 CU_MEM_ALLOCATION_TYPE_MANAGED = 2,
4936 CU_MEM_ALLOCATION_TYPE_MAX = 2147483647,
4937}
4938pub use self::CUmemAllocationType_enum as CUmemAllocationType;
4939/// Flag for requesting different optimal and required granularities for an allocation.
4940#[repr(u32)]
4941#[derive(
4942 Debug,
4943 Copy,
4944 Clone,
4945 Hash,
4946 PartialOrd,
4947 Ord,
4948 PartialEq,
4949 Eq,
4950 TryFromPrimitive,
4951 IntoPrimitive,
4952)]
4953pub enum CUmemAllocationGranularity_flags_enum {
4954 /// Minimum required granularity for allocation.
4955 CU_MEM_ALLOC_GRANULARITY_MINIMUM = 0,
4956 /// Recommended granularity for allocation for best performance.
4957 CU_MEM_ALLOC_GRANULARITY_RECOMMENDED = 1,
4958}
4959pub use self::CUmemAllocationGranularity_flags_enum as CUmemAllocationGranularity_flags;
4960/// Specifies the handle type for address range.
4961#[repr(u32)]
4962#[derive(
4963 Debug,
4964 Copy,
4965 Clone,
4966 Hash,
4967 PartialOrd,
4968 Ord,
4969 PartialEq,
4970 Eq,
4971 TryFromPrimitive,
4972 IntoPrimitive,
4973)]
4974pub enum CUmemRangeHandleType_enum {
4975 CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD = 1,
4976 CU_MEM_RANGE_HANDLE_TYPE_MAX = 2147483647,
4977}
4978pub use self::CUmemRangeHandleType_enum as CUmemRangeHandleType;
4979/// Flag for requesting handle type for address range.
4980#[repr(u32)]
4981#[derive(
4982 Debug,
4983 Copy,
4984 Clone,
4985 Hash,
4986 PartialOrd,
4987 Ord,
4988 PartialEq,
4989 Eq,
4990 TryFromPrimitive,
4991 IntoPrimitive,
4992)]
4993pub enum CUmemRangeFlags_enum {
4994 /// Indicates that DMA_BUF handle should be mapped via PCIe BAR1.
4995 CU_MEM_RANGE_FLAG_DMA_BUF_MAPPING_TYPE_PCIE = 1,
4996}
4997pub use self::CUmemRangeFlags_enum as CUmemRangeFlags;
4998/// Sparse subresource types.
4999#[repr(u32)]
5000#[derive(
5001 Debug,
5002 Copy,
5003 Clone,
5004 Hash,
5005 PartialOrd,
5006 Ord,
5007 PartialEq,
5008 Eq,
5009 TryFromPrimitive,
5010 IntoPrimitive,
5011)]
5012pub enum CUarraySparseSubresourceType_enum {
5013 CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL = 0,
5014 CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL = 1,
5015}
5016pub use self::CUarraySparseSubresourceType_enum as CUarraySparseSubresourceType;
5017/// Memory operation types.
5018#[repr(u32)]
5019#[derive(
5020 Debug,
5021 Copy,
5022 Clone,
5023 Hash,
5024 PartialOrd,
5025 Ord,
5026 PartialEq,
5027 Eq,
5028 TryFromPrimitive,
5029 IntoPrimitive,
5030)]
5031pub enum CUmemOperationType_enum {
5032 CU_MEM_OPERATION_TYPE_MAP = 1,
5033 CU_MEM_OPERATION_TYPE_UNMAP = 2,
5034}
5035pub use self::CUmemOperationType_enum as CUmemOperationType;
5036/// Memory handle types.
5037#[repr(u32)]
5038#[derive(
5039 Debug,
5040 Copy,
5041 Clone,
5042 Hash,
5043 PartialOrd,
5044 Ord,
5045 PartialEq,
5046 Eq,
5047 TryFromPrimitive,
5048 IntoPrimitive,
5049)]
5050pub enum CUmemHandleType_enum {
5051 CU_MEM_HANDLE_TYPE_GENERIC = 0,
5052}
5053pub use self::CUmemHandleType_enum as CUmemHandleType;
5054#[repr(C)]
5055#[derive(Copy, Clone)]
5056pub struct CUarrayMapInfo_st {
5057 pub resourceType: CUresourcetype,
5058 pub resource: CUarrayMapInfo_st__bindgen_ty_1,
5059 pub subresourceType: CUarraySparseSubresourceType,
5060 pub subresource: CUarrayMapInfo_st__bindgen_ty_2,
5061 pub memOperationType: CUmemOperationType,
5062 pub memHandleType: CUmemHandleType,
5063 pub memHandle: CUarrayMapInfo_st__bindgen_ty_3,
5064 pub offset: ::core::ffi::c_ulonglong,
5065 pub deviceBitMask: ::core::ffi::c_uint,
5066 pub flags: ::core::ffi::c_uint,
5067 pub reserved: [::core::ffi::c_uint; 2usize],
5068}
5069#[repr(C)]
5070#[derive(Copy, Clone)]
5071pub union CUarrayMapInfo_st__bindgen_ty_1 {
5072 pub mipmap: CUmipmappedArray,
5073 pub array: CUarray,
5074}
5075impl Default for CUarrayMapInfo_st__bindgen_ty_1 {
5076 fn default() -> Self {
5077 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5078 unsafe {
5079 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5080 s.assume_init()
5081 }
5082 }
5083}
5084#[repr(C)]
5085#[derive(Copy, Clone)]
5086pub union CUarrayMapInfo_st__bindgen_ty_2 {
5087 pub sparseLevel: CUarrayMapInfo_st__bindgen_ty_2__bindgen_ty_1,
5088 pub miptail: CUarrayMapInfo_st__bindgen_ty_2__bindgen_ty_2,
5089}
5090#[repr(C)]
5091#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
5092pub struct CUarrayMapInfo_st__bindgen_ty_2__bindgen_ty_1 {
5093 pub level: ::core::ffi::c_uint,
5094 pub layer: ::core::ffi::c_uint,
5095 pub offsetX: ::core::ffi::c_uint,
5096 pub offsetY: ::core::ffi::c_uint,
5097 pub offsetZ: ::core::ffi::c_uint,
5098 pub extentWidth: ::core::ffi::c_uint,
5099 pub extentHeight: ::core::ffi::c_uint,
5100 pub extentDepth: ::core::ffi::c_uint,
5101}
5102#[repr(C)]
5103#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
5104pub struct CUarrayMapInfo_st__bindgen_ty_2__bindgen_ty_2 {
5105 pub layer: ::core::ffi::c_uint,
5106 pub offset: ::core::ffi::c_ulonglong,
5107 pub size: ::core::ffi::c_ulonglong,
5108}
5109impl Default for CUarrayMapInfo_st__bindgen_ty_2 {
5110 fn default() -> Self {
5111 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5112 unsafe {
5113 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5114 s.assume_init()
5115 }
5116 }
5117}
5118#[repr(C)]
5119#[derive(Copy, Clone)]
5120pub union CUarrayMapInfo_st__bindgen_ty_3 {
5121 pub memHandle: CUmemGenericAllocationHandle,
5122}
5123impl Default for CUarrayMapInfo_st__bindgen_ty_3 {
5124 fn default() -> Self {
5125 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5126 unsafe {
5127 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5128 s.assume_init()
5129 }
5130 }
5131}
5132impl Default for CUarrayMapInfo_st {
5133 fn default() -> Self {
5134 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5135 unsafe {
5136 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5137 s.assume_init()
5138 }
5139 }
5140}
5141/// Specifies the CUDA array or CUDA mipmapped array memory mapping information.
5142pub type CUarrayMapInfo_v1 = CUarrayMapInfo_st;
5143pub type CUarrayMapInfo = CUarrayMapInfo_v1;
5144#[repr(C)]
5145#[derive(Copy, Clone)]
5146pub struct CUmemLocation_st {
5147 pub type_: CUmemLocationType,
5148 pub __bindgen_anon_1: CUmemLocation_st__bindgen_ty_1,
5149}
5150#[repr(C)]
5151#[derive(Copy, Clone)]
5152pub union CUmemLocation_st__bindgen_ty_1 {
5153 pub id: ::core::ffi::c_int,
5154}
5155impl Default for CUmemLocation_st__bindgen_ty_1 {
5156 fn default() -> Self {
5157 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5158 unsafe {
5159 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5160 s.assume_init()
5161 }
5162 }
5163}
5164impl Default for CUmemLocation_st {
5165 fn default() -> Self {
5166 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5167 unsafe {
5168 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5169 s.assume_init()
5170 }
5171 }
5172}
5173/// Specifies a memory location.
5174pub type CUmemLocation_v1 = CUmemLocation_st;
5175pub type CUmemLocation = CUmemLocation_v1;
5176/// Specifies compression attribute for an allocation.
5177#[repr(u32)]
5178#[derive(
5179 Debug,
5180 Copy,
5181 Clone,
5182 Hash,
5183 PartialOrd,
5184 Ord,
5185 PartialEq,
5186 Eq,
5187 TryFromPrimitive,
5188 IntoPrimitive,
5189)]
5190pub enum CUmemAllocationCompType_enum {
5191 /// Allocating non-compressible memory.
5192 CU_MEM_ALLOCATION_COMP_NONE = 0,
5193 /// Allocating compressible memory.
5194 CU_MEM_ALLOCATION_COMP_GENERIC = 1,
5195}
5196pub use self::CUmemAllocationCompType_enum as CUmemAllocationCompType;
5197#[repr(C)]
5198#[derive(Copy, Clone)]
5199pub struct CUmemAllocationProp_st {
5200 pub type_: CUmemAllocationType,
5201 pub requestedHandleTypes: CUmemAllocationHandleType,
5202 pub location: CUmemLocation,
5203 pub win32HandleMetaData: *mut ::core::ffi::c_void,
5204 pub allocFlags: CUmemAllocationProp_st__bindgen_ty_1,
5205}
5206#[repr(C)]
5207#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
5208pub struct CUmemAllocationProp_st__bindgen_ty_1 {
5209 pub compressionType: ::core::ffi::c_uchar,
5210 pub gpuDirectRDMACapable: ::core::ffi::c_uchar,
5211 pub usage: ::core::ffi::c_ushort,
5212 pub reserved: [::core::ffi::c_uchar; 4usize],
5213}
5214impl Default for CUmemAllocationProp_st {
5215 fn default() -> Self {
5216 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5217 unsafe {
5218 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5219 s.assume_init()
5220 }
5221 }
5222}
5223/// Specifies the allocation properties for a allocation.
5224pub type CUmemAllocationProp_v1 = CUmemAllocationProp_st;
5225pub type CUmemAllocationProp = CUmemAllocationProp_v1;
5226/// Flags for querying different granularities for a multicast object.
5227#[repr(u32)]
5228#[derive(
5229 Debug,
5230 Copy,
5231 Clone,
5232 Hash,
5233 PartialOrd,
5234 Ord,
5235 PartialEq,
5236 Eq,
5237 TryFromPrimitive,
5238 IntoPrimitive,
5239)]
5240pub enum CUmulticastGranularity_flags_enum {
5241 /// Minimum required granularity.
5242 CU_MULTICAST_GRANULARITY_MINIMUM = 0,
5243 /// Recommended granularity for best performance.
5244 CU_MULTICAST_GRANULARITY_RECOMMENDED = 1,
5245}
5246pub use self::CUmulticastGranularity_flags_enum as CUmulticastGranularity_flags;
5247#[repr(C)]
5248#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
5249pub struct CUmulticastObjectProp_st {
5250 pub numDevices: ::core::ffi::c_uint,
5251 pub size: size_t,
5252 pub handleTypes: ::core::ffi::c_ulonglong,
5253 pub flags: ::core::ffi::c_ulonglong,
5254}
5255/// Specifies the properties for a multicast object.
5256pub type CUmulticastObjectProp_v1 = CUmulticastObjectProp_st;
5257pub type CUmulticastObjectProp = CUmulticastObjectProp_v1;
5258#[repr(C)]
5259#[derive(Copy, Clone)]
5260pub struct CUmemAccessDesc_st {
5261 pub location: CUmemLocation,
5262 pub flags: CUmemAccess_flags,
5263}
5264impl Default for CUmemAccessDesc_st {
5265 fn default() -> Self {
5266 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5267 unsafe {
5268 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5269 s.assume_init()
5270 }
5271 }
5272}
5273/// Memory access descriptor.
5274pub type CUmemAccessDesc_v1 = CUmemAccessDesc_st;
5275pub type CUmemAccessDesc = CUmemAccessDesc_v1;
5276/// CUDA Graph Update error types.
5277#[repr(u32)]
5278#[derive(
5279 Debug,
5280 Copy,
5281 Clone,
5282 Hash,
5283 PartialOrd,
5284 Ord,
5285 PartialEq,
5286 Eq,
5287 TryFromPrimitive,
5288 IntoPrimitive,
5289)]
5290pub enum CUgraphExecUpdateResult_enum {
5291 /// The update succeeded.
5292 CU_GRAPH_EXEC_UPDATE_SUCCESS = 0,
5293 /// The update failed for an unexpected reason which is described in the return value of the function.
5294 CU_GRAPH_EXEC_UPDATE_ERROR = 1,
5295 /// The update failed because the topology changed.
5296 CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED = 2,
5297 /// The update failed because a node type changed.
5298 CU_GRAPH_EXEC_UPDATE_ERROR_NODE_TYPE_CHANGED = 3,
5299 /// The update failed because the function of a kernel node changed (CUDA driver < 11.2).
5300 CU_GRAPH_EXEC_UPDATE_ERROR_FUNCTION_CHANGED = 4,
5301 /// The update failed because the parameters changed in a way that is not supported.
5302 CU_GRAPH_EXEC_UPDATE_ERROR_PARAMETERS_CHANGED = 5,
5303 /// The update failed because something about the node is not supported.
5304 CU_GRAPH_EXEC_UPDATE_ERROR_NOT_SUPPORTED = 6,
5305 /// The update failed because the function of a kernel node changed in an unsupported way.
5306 CU_GRAPH_EXEC_UPDATE_ERROR_UNSUPPORTED_FUNCTION_CHANGE = 7,
5307 /// The update failed because the node attributes changed in a way that is not supported.
5308 CU_GRAPH_EXEC_UPDATE_ERROR_ATTRIBUTES_CHANGED = 8,
5309}
5310pub use self::CUgraphExecUpdateResult_enum as CUgraphExecUpdateResult;
5311#[repr(C)]
5312#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
5313pub struct CUgraphExecUpdateResultInfo_st {
5314 pub result: CUgraphExecUpdateResult,
5315 pub errorNode: CUgraphNode,
5316 pub errorFromNode: CUgraphNode,
5317}
5318impl Default for CUgraphExecUpdateResultInfo_st {
5319 fn default() -> Self {
5320 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5321 unsafe {
5322 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5323 s.assume_init()
5324 }
5325 }
5326}
5327/// Result information returned by cuGraphExecUpdate.
5328pub type CUgraphExecUpdateResultInfo_v1 = CUgraphExecUpdateResultInfo_st;
5329pub type CUgraphExecUpdateResultInfo = CUgraphExecUpdateResultInfo_v1;
5330/// CUDA memory pool attributes.
5331#[repr(u32)]
5332#[derive(
5333 Debug,
5334 Copy,
5335 Clone,
5336 Hash,
5337 PartialOrd,
5338 Ord,
5339 PartialEq,
5340 Eq,
5341 TryFromPrimitive,
5342 IntoPrimitive,
5343)]
5344pub enum CUmemPool_attribute_enum {
5345 /// (value type = int) Allow cuMemAllocAsync to use memory asynchronously freed in another streams as long as a stream ordering
5346 /// dependency of the allocating stream on the free action exists. CUDA events and null stream interactions can create the required
5347 /// stream ordered dependencies. (default enabled).
5348 CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES = 1,
5349 /// (value type = int) Allow reuse of already completed frees when there is no dependency between the free and allocation. (default
5350 /// ```text
5351 /// enabled)
5352 /// ```
5353 CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC = 2,
5354 /// (value type = int) Allow cuMemAllocAsync to insert new stream dependencies in order to establish the stream ordering required
5355 /// to reuse a piece of memory released by cuMemFreeAsync (default enabled).
5356 CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES = 3,
5357 /// (value type = cuuint64_t) Amount of reserved memory in bytes to hold onto before trying to release memory back to the OS.
5358 /// When more than the release threshold bytes of memory are held by the memory pool, the allocator will try to release memory
5359 /// back to the OS on the next call to stream, event or context synchronize. (default 0).
5360 CU_MEMPOOL_ATTR_RELEASE_THRESHOLD = 4,
5361 /// (value type = cuuint64_t) Amount of backing memory currently allocated for the mempool.
5362 CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT = 5,
5363 /// (value type = cuuint64_t) High watermark of backing memory allocated for the mempool since the last time it was reset. High
5364 /// watermark can only be reset to zero.
5365 CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH = 6,
5366 /// (value type = cuuint64_t) Amount of memory from the pool that is currently in use by the application.
5367 CU_MEMPOOL_ATTR_USED_MEM_CURRENT = 7,
5368 /// (value type = cuuint64_t) High watermark of the amount of memory from the pool that was in use by the application since the
5369 /// last time it was reset. High watermark can only be reset to zero.
5370 CU_MEMPOOL_ATTR_USED_MEM_HIGH = 8,
5371 /// (value type = CUmemAllocationType) The allocation type of the mempool.
5372 CU_MEMPOOL_ATTR_ALLOCATION_TYPE = 9,
5373 /// (value type = CUmemAllocationHandleType) Available export handle types for the mempool. For imported pools this value is always
5374 /// [`CUmemAllocationHandleType::CU_MEM_HANDLE_TYPE_NONE`] as an imported pool cannot be re-exported.
5375 CU_MEMPOOL_ATTR_EXPORT_HANDLE_TYPES = 10,
5376 /// (value type = int) The location id for the mempool. If the location type for this pool is [`CUmemLocationType::CU_MEM_LOCATION_TYPE_INVISIBLE`] then
5377 /// ID will be CU_DEVICE_INVALID.
5378 CU_MEMPOOL_ATTR_LOCATION_ID = 11,
5379 /// (value type = CUmemLocationType) The location type for the mempool. For imported memory pools where the device is not directly
5380 /// visible to the importing process or pools imported via fabric handles across nodes this will be [`CUmemLocationType::CU_MEM_LOCATION_TYPE_INVISIBLE`].
5381 CU_MEMPOOL_ATTR_LOCATION_TYPE = 12,
5382 /// (value type = cuuint64_t) Maximum size of the pool in bytes, this value may be higher than what was initially passed to cuMemPoolCreate
5383 /// due to alignment requirements. A value of 0 indicates no maximum size. For [`CUmemAllocationType::CU_MEM_ALLOCATION_TYPE_MANAGED`] and IPC imported
5384 /// pools this value will be system dependent.
5385 CU_MEMPOOL_ATTR_MAX_POOL_SIZE = 13,
5386 /// (value type = int) Indicates whether the pool has hardware compresssion enabled.
5387 CU_MEMPOOL_ATTR_HW_DECOMPRESS_ENABLED = 14,
5388}
5389pub use self::CUmemPool_attribute_enum as CUmemPool_attribute;
5390#[repr(C)]
5391#[derive(Copy, Clone)]
5392pub struct CUmemPoolProps_st {
5393 pub allocType: CUmemAllocationType,
5394 pub handleTypes: CUmemAllocationHandleType,
5395 pub location: CUmemLocation,
5396 pub win32SecurityAttributes: *mut ::core::ffi::c_void,
5397 pub maxSize: size_t,
5398 pub usage: ::core::ffi::c_ushort,
5399 pub reserved: [::core::ffi::c_uchar; 54usize],
5400}
5401impl Default for CUmemPoolProps_st {
5402 fn default() -> Self {
5403 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5404 unsafe {
5405 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5406 s.assume_init()
5407 }
5408 }
5409}
5410/// Specifies the properties of allocations made from the pool.
5411pub type CUmemPoolProps_v1 = CUmemPoolProps_st;
5412pub type CUmemPoolProps = CUmemPoolProps_v1;
5413#[repr(C)]
5414#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
5415pub struct CUmemPoolPtrExportData_st {
5416 pub reserved: [::core::ffi::c_uchar; 64usize],
5417}
5418impl Default for CUmemPoolPtrExportData_st {
5419 fn default() -> Self {
5420 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5421 unsafe {
5422 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5423 s.assume_init()
5424 }
5425 }
5426}
5427/// Opaque data for exporting a pool allocation.
5428pub type CUmemPoolPtrExportData_v1 = CUmemPoolPtrExportData_st;
5429pub type CUmemPoolPtrExportData = CUmemPoolPtrExportData_v1;
5430/// Flags to specify for copies within a batch. For more details see [`cuMemcpyBatchAsync_v2`].
5431#[repr(u32)]
5432#[derive(
5433 Debug,
5434 Copy,
5435 Clone,
5436 Hash,
5437 PartialOrd,
5438 Ord,
5439 PartialEq,
5440 Eq,
5441 TryFromPrimitive,
5442 IntoPrimitive,
5443)]
5444pub enum CUmemcpyFlags_enum {
5445 CU_MEMCPY_FLAG_DEFAULT = 0,
5446 /// Hint to the driver to try and overlap the copy with compute work on the SMs.
5447 CU_MEMCPY_FLAG_PREFER_OVERLAP_WITH_COMPUTE = 1,
5448}
5449pub use self::CUmemcpyFlags_enum as CUmemcpyFlags;
5450/// These flags allow applications to convey the source access ordering CUDA must maintain. The destination will always be accessed
5451/// in stream order.
5452#[repr(u32)]
5453#[derive(
5454 Debug,
5455 Copy,
5456 Clone,
5457 Hash,
5458 PartialOrd,
5459 Ord,
5460 PartialEq,
5461 Eq,
5462 TryFromPrimitive,
5463 IntoPrimitive,
5464)]
5465pub enum CUmemcpySrcAccessOrder_enum {
5466 /// Default invalid.
5467 CU_MEMCPY_SRC_ACCESS_ORDER_INVALID = 0,
5468 /// Indicates that access to the source pointer must be in stream order.
5469 CU_MEMCPY_SRC_ACCESS_ORDER_STREAM = 1,
5470 /// Indicates that access to the source pointer can be out of stream order and all accesses must be complete before the API call
5471 /// returns. This flag is suited for ephemeral sources (ex., stack variables) when it's known that no prior operations in the
5472 /// stream can be accessing the memory and also that the lifetime of the memory is limited to the scope that the source variable
5473 /// was declared in. Specifying this flag allows the driver to optimize the copy and removes the need for the user to synchronize
5474 /// the stream after the API call.
5475 CU_MEMCPY_SRC_ACCESS_ORDER_DURING_API_CALL = 2,
5476 /// Indicates that access to the source pointer can be out of stream order and the accesses can happen even after the API call
5477 /// returns. This flag is suited for host pointers allocated outside CUDA (ex., via malloc) when it's known that no prior operations
5478 /// in the stream can be accessing the memory. Specifying this flag allows the driver to optimize the copy on certain platforms.
5479 CU_MEMCPY_SRC_ACCESS_ORDER_ANY = 3,
5480 CU_MEMCPY_SRC_ACCESS_ORDER_MAX = 2147483647,
5481}
5482pub use self::CUmemcpySrcAccessOrder_enum as CUmemcpySrcAccessOrder;
5483#[repr(C)]
5484#[derive(Copy, Clone)]
5485pub struct CUmemcpyAttributes_st {
5486 pub srcAccessOrder: CUmemcpySrcAccessOrder,
5487 pub srcLocHint: CUmemLocation,
5488 pub dstLocHint: CUmemLocation,
5489 pub flags: ::core::ffi::c_uint,
5490}
5491impl Default for CUmemcpyAttributes_st {
5492 fn default() -> Self {
5493 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5494 unsafe {
5495 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5496 s.assume_init()
5497 }
5498 }
5499}
5500/// Attributes specific to copies within a batch. For more details on usage see [`cuMemcpyBatchAsync_v2`].
5501pub type CUmemcpyAttributes_v1 = CUmemcpyAttributes_st;
5502pub type CUmemcpyAttributes = CUmemcpyAttributes_v1;
5503/// These flags allow applications to convey the operand type for individual copies specified in [`cuMemcpy3DBatchAsync_v2`].
5504#[repr(u32)]
5505#[derive(
5506 Debug,
5507 Copy,
5508 Clone,
5509 Hash,
5510 PartialOrd,
5511 Ord,
5512 PartialEq,
5513 Eq,
5514 TryFromPrimitive,
5515 IntoPrimitive,
5516)]
5517pub enum CUmemcpy3DOperandType_enum {
5518 /// Memcpy operand is a valid pointer.
5519 CU_MEMCPY_OPERAND_TYPE_POINTER = 1,
5520 /// Memcpy operand is a CUarray.
5521 CU_MEMCPY_OPERAND_TYPE_ARRAY = 2,
5522 CU_MEMCPY_OPERAND_TYPE_MAX = 2147483647,
5523}
5524pub use self::CUmemcpy3DOperandType_enum as CUmemcpy3DOperandType;
5525#[repr(C)]
5526#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
5527pub struct CUoffset3D_st {
5528 pub x: size_t,
5529 pub y: size_t,
5530 pub z: size_t,
5531}
5532/// Struct representing a 3D offset.
5533pub type CUoffset3D_v1 = CUoffset3D_st;
5534pub type CUoffset3D = CUoffset3D_v1;
5535#[repr(C)]
5536#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
5537pub struct CUextent3D_st {
5538 pub width: size_t,
5539 pub height: size_t,
5540 pub depth: size_t,
5541}
5542/// Struct representing width/height/depth of a CUarray in elements.
5543pub type CUextent3D_v1 = CUextent3D_st;
5544pub type CUextent3D = CUextent3D_v1;
5545#[repr(C)]
5546#[derive(Copy, Clone)]
5547pub struct CUmemcpy3DOperand_st {
5548 pub type_: CUmemcpy3DOperandType,
5549 pub op: CUmemcpy3DOperand_st__bindgen_ty_1,
5550}
5551#[repr(C)]
5552#[derive(Copy, Clone)]
5553pub union CUmemcpy3DOperand_st__bindgen_ty_1 {
5554 pub ptr: CUmemcpy3DOperand_st__bindgen_ty_1__bindgen_ty_1,
5555 pub array: CUmemcpy3DOperand_st__bindgen_ty_1__bindgen_ty_2,
5556}
5557#[repr(C)]
5558#[derive(Copy, Clone)]
5559pub struct CUmemcpy3DOperand_st__bindgen_ty_1__bindgen_ty_1 {
5560 pub ptr: CUdeviceptr,
5561 pub rowLength: size_t,
5562 pub layerHeight: size_t,
5563 pub locHint: CUmemLocation,
5564}
5565impl Default for CUmemcpy3DOperand_st__bindgen_ty_1__bindgen_ty_1 {
5566 fn default() -> Self {
5567 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5568 unsafe {
5569 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5570 s.assume_init()
5571 }
5572 }
5573}
5574#[repr(C)]
5575#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
5576pub struct CUmemcpy3DOperand_st__bindgen_ty_1__bindgen_ty_2 {
5577 pub array: CUarray,
5578 pub offset: CUoffset3D,
5579}
5580impl Default for CUmemcpy3DOperand_st__bindgen_ty_1__bindgen_ty_2 {
5581 fn default() -> Self {
5582 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5583 unsafe {
5584 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5585 s.assume_init()
5586 }
5587 }
5588}
5589impl Default for CUmemcpy3DOperand_st__bindgen_ty_1 {
5590 fn default() -> Self {
5591 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5592 unsafe {
5593 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5594 s.assume_init()
5595 }
5596 }
5597}
5598impl Default for CUmemcpy3DOperand_st {
5599 fn default() -> Self {
5600 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5601 unsafe {
5602 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5603 s.assume_init()
5604 }
5605 }
5606}
5607/// Struct representing an operand for copy with [`cuMemcpy3DBatchAsync_v2`].
5608pub type CUmemcpy3DOperand_v1 = CUmemcpy3DOperand_st;
5609pub type CUmemcpy3DOperand = CUmemcpy3DOperand_v1;
5610#[repr(C)]
5611#[derive(Copy, Clone)]
5612pub struct CUDA_MEMCPY3D_BATCH_OP_st {
5613 pub src: CUmemcpy3DOperand,
5614 pub dst: CUmemcpy3DOperand,
5615 pub extent: CUextent3D,
5616 pub srcAccessOrder: CUmemcpySrcAccessOrder,
5617 pub flags: ::core::ffi::c_uint,
5618}
5619impl Default for CUDA_MEMCPY3D_BATCH_OP_st {
5620 fn default() -> Self {
5621 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5622 unsafe {
5623 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5624 s.assume_init()
5625 }
5626 }
5627}
5628pub type CUDA_MEMCPY3D_BATCH_OP_v1 = CUDA_MEMCPY3D_BATCH_OP_st;
5629pub type CUDA_MEMCPY3D_BATCH_OP = CUDA_MEMCPY3D_BATCH_OP_v1;
5630#[repr(C)]
5631#[derive(Copy, Clone)]
5632pub struct CUDA_MEM_ALLOC_NODE_PARAMS_v1_st {
5633 pub poolProps: CUmemPoolProps,
5634 pub accessDescs: *const CUmemAccessDesc,
5635 pub accessDescCount: size_t,
5636 pub bytesize: size_t,
5637 pub dptr: CUdeviceptr,
5638}
5639impl Default for CUDA_MEM_ALLOC_NODE_PARAMS_v1_st {
5640 fn default() -> Self {
5641 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5642 unsafe {
5643 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5644 s.assume_init()
5645 }
5646 }
5647}
5648/// Memory allocation node parameters.
5649pub type CUDA_MEM_ALLOC_NODE_PARAMS_v1 = CUDA_MEM_ALLOC_NODE_PARAMS_v1_st;
5650pub type CUDA_MEM_ALLOC_NODE_PARAMS = CUDA_MEM_ALLOC_NODE_PARAMS_v1;
5651#[repr(C)]
5652#[derive(Copy, Clone)]
5653pub struct CUDA_MEM_ALLOC_NODE_PARAMS_v2_st {
5654 pub poolProps: CUmemPoolProps,
5655 pub accessDescs: *const CUmemAccessDesc,
5656 pub accessDescCount: size_t,
5657 pub bytesize: size_t,
5658 pub dptr: CUdeviceptr,
5659}
5660impl Default for CUDA_MEM_ALLOC_NODE_PARAMS_v2_st {
5661 fn default() -> Self {
5662 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5663 unsafe {
5664 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5665 s.assume_init()
5666 }
5667 }
5668}
5669/// Memory allocation node parameters.
5670pub type CUDA_MEM_ALLOC_NODE_PARAMS_v2 = CUDA_MEM_ALLOC_NODE_PARAMS_v2_st;
5671#[repr(C)]
5672#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
5673pub struct CUDA_MEM_FREE_NODE_PARAMS_st {
5674 pub dptr: CUdeviceptr,
5675}
5676/// Memory free node parameters.
5677pub type CUDA_MEM_FREE_NODE_PARAMS = CUDA_MEM_FREE_NODE_PARAMS_st;
5678#[repr(u32)]
5679#[derive(
5680 Debug,
5681 Copy,
5682 Clone,
5683 Hash,
5684 PartialOrd,
5685 Ord,
5686 PartialEq,
5687 Eq,
5688 TryFromPrimitive,
5689 IntoPrimitive,
5690)]
5691pub enum CUgraphMem_attribute_enum {
5692 CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT = 0,
5693 CU_GRAPH_MEM_ATTR_USED_MEM_HIGH = 1,
5694 CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT = 2,
5695 CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH = 3,
5696}
5697pub use self::CUgraphMem_attribute_enum as CUgraphMem_attribute;
5698/// Child graph node ownership.
5699#[repr(i32)]
5700#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
5701pub enum CUgraphChildGraphNodeOwnership_enum {
5702 /// Default behavior for a child graph node. Child graph is cloned into the parent and memory allocation/free nodes can't be present
5703 /// in the child graph.
5704 CU_GRAPH_CHILD_GRAPH_OWNERSHIP_CLONE = 0,
5705 /// The child graph is moved to the parent. The handle to the child graph is owned by the parent and will be destroyed when the
5706 /// ```text
5707 /// parent is destroyed.The following restrictions apply to child graphs after they have been moved: Cannot be independently instantiated
5708 /// or destroyed; Cannot be added as a child graph of a separate parent graph; Cannot be used as an argument to cuGraphExecUpdate;
5709 /// Cannot have additional memory allocation or free nodes added.
5710 /// ```
5711 CU_GRAPH_CHILD_GRAPH_OWNERSHIP_MOVE = 1,
5712 /// Invalid ownership flag. Set when params are queried to prevent accidentally reusing the driver-owned graph object.
5713 CU_GRAPH_CHILD_GRAPH_OWNERSHIP_INVALID = -1,
5714}
5715pub use self::CUgraphChildGraphNodeOwnership_enum as CUgraphChildGraphNodeOwnership;
5716#[repr(C)]
5717#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
5718pub struct CUDA_CHILD_GRAPH_NODE_PARAMS_st {
5719 pub graph: CUgraph,
5720 pub ownership: CUgraphChildGraphNodeOwnership,
5721}
5722impl Default for CUDA_CHILD_GRAPH_NODE_PARAMS_st {
5723 fn default() -> Self {
5724 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5725 unsafe {
5726 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5727 s.assume_init()
5728 }
5729 }
5730}
5731/// Child graph node parameters.
5732pub type CUDA_CHILD_GRAPH_NODE_PARAMS = CUDA_CHILD_GRAPH_NODE_PARAMS_st;
5733#[repr(C)]
5734#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
5735pub struct CUDA_EVENT_RECORD_NODE_PARAMS_st {
5736 pub event: CUevent,
5737}
5738impl Default for CUDA_EVENT_RECORD_NODE_PARAMS_st {
5739 fn default() -> Self {
5740 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5741 unsafe {
5742 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5743 s.assume_init()
5744 }
5745 }
5746}
5747/// Event record node parameters.
5748pub type CUDA_EVENT_RECORD_NODE_PARAMS = CUDA_EVENT_RECORD_NODE_PARAMS_st;
5749#[repr(C)]
5750#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
5751pub struct CUDA_EVENT_WAIT_NODE_PARAMS_st {
5752 pub event: CUevent,
5753}
5754impl Default for CUDA_EVENT_WAIT_NODE_PARAMS_st {
5755 fn default() -> Self {
5756 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5757 unsafe {
5758 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5759 s.assume_init()
5760 }
5761 }
5762}
5763/// Event wait node parameters.
5764pub type CUDA_EVENT_WAIT_NODE_PARAMS = CUDA_EVENT_WAIT_NODE_PARAMS_st;
5765#[repr(C)]
5766#[derive(Copy, Clone)]
5767pub struct CUgraphNodeParams_st {
5768 pub type_: CUgraphNodeType,
5769 pub reserved0: [::core::ffi::c_int; 3usize],
5770 pub __bindgen_anon_1: CUgraphNodeParams_st__bindgen_ty_1,
5771 pub reserved2: ::core::ffi::c_longlong,
5772}
5773#[repr(C)]
5774#[derive(Copy, Clone)]
5775pub union CUgraphNodeParams_st__bindgen_ty_1 {
5776 pub reserved1: [::core::ffi::c_longlong; 29usize],
5777 pub kernel: CUDA_KERNEL_NODE_PARAMS_v3,
5778 pub memcpy: CUDA_MEMCPY_NODE_PARAMS,
5779 pub memset: CUDA_MEMSET_NODE_PARAMS_v2,
5780 pub host: CUDA_HOST_NODE_PARAMS_v2,
5781 pub graph: CUDA_CHILD_GRAPH_NODE_PARAMS,
5782 pub eventWait: CUDA_EVENT_WAIT_NODE_PARAMS,
5783 pub eventRecord: CUDA_EVENT_RECORD_NODE_PARAMS,
5784 pub extSemSignal: CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2,
5785 pub extSemWait: CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2,
5786 pub alloc: CUDA_MEM_ALLOC_NODE_PARAMS_v2,
5787 pub free: CUDA_MEM_FREE_NODE_PARAMS,
5788 pub memOp: CUDA_BATCH_MEM_OP_NODE_PARAMS_v2,
5789 pub conditional: CUDA_CONDITIONAL_NODE_PARAMS,
5790 pub asBytes: [::core::ffi::c_char; 232usize],
5791}
5792impl Default for CUgraphNodeParams_st__bindgen_ty_1 {
5793 fn default() -> Self {
5794 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5795 unsafe {
5796 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5797 s.assume_init()
5798 }
5799 }
5800}
5801impl Default for CUgraphNodeParams_st {
5802 fn default() -> Self {
5803 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
5804 unsafe {
5805 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5806 s.assume_init()
5807 }
5808 }
5809}
5810/// Graph node parameters. See [`cuGraphAddNode_v2`].
5811pub type CUgraphNodeParams = CUgraphNodeParams_st;
5812/// Bitmasks for CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS.
5813#[repr(u32)]
5814#[derive(
5815 Debug,
5816 Copy,
5817 Clone,
5818 Hash,
5819 PartialOrd,
5820 Ord,
5821 PartialEq,
5822 Eq,
5823 TryFromPrimitive,
5824 IntoPrimitive,
5825)]
5826pub enum CUflushGPUDirectRDMAWritesOptions_enum {
5827 /// [`cuFlushGPUDirectRDMAWrites`] and its CUDA Runtime API counterpart are supported on the device.
5828 CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_HOST = 1,
5829 /// The CU_STREAM_WAIT_VALUE_FLUSH flag and the CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES MemOp are supported on the device.
5830 CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_MEMOPS = 2,
5831}
5832pub use self::CUflushGPUDirectRDMAWritesOptions_enum as CUflushGPUDirectRDMAWritesOptions;
5833/// Platform native ordering for GPUDirect RDMA writes.
5834#[repr(u32)]
5835#[derive(
5836 Debug,
5837 Copy,
5838 Clone,
5839 Hash,
5840 PartialOrd,
5841 Ord,
5842 PartialEq,
5843 Eq,
5844 TryFromPrimitive,
5845 IntoPrimitive,
5846)]
5847pub enum CUGPUDirectRDMAWritesOrdering_enum {
5848 /// The device does not natively support ordering of remote writes. [`cuFlushGPUDirectRDMAWrites`] can be leveraged if supported.
5849 CU_GPU_DIRECT_RDMA_WRITES_ORDERING_NONE = 0,
5850 /// Natively, the device can consistently consume remote writes, although other CUDA devices may not.
5851 CU_GPU_DIRECT_RDMA_WRITES_ORDERING_OWNER = 100,
5852 /// Any CUDA device in the system can consistently consume remote writes to this device.
5853 CU_GPU_DIRECT_RDMA_WRITES_ORDERING_ALL_DEVICES = 200,
5854}
5855pub use self::CUGPUDirectRDMAWritesOrdering_enum as CUGPUDirectRDMAWritesOrdering;
5856/// The scopes for [`cuFlushGPUDirectRDMAWrites`].
5857#[repr(u32)]
5858#[derive(
5859 Debug,
5860 Copy,
5861 Clone,
5862 Hash,
5863 PartialOrd,
5864 Ord,
5865 PartialEq,
5866 Eq,
5867 TryFromPrimitive,
5868 IntoPrimitive,
5869)]
5870pub enum CUflushGPUDirectRDMAWritesScope_enum {
5871 /// Blocks until remote writes are visible to the CUDA device context owning the data.
5872 CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_OWNER = 100,
5873 /// Blocks until remote writes are visible to all CUDA device contexts.
5874 CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_ALL_DEVICES = 200,
5875}
5876pub use self::CUflushGPUDirectRDMAWritesScope_enum as CUflushGPUDirectRDMAWritesScope;
5877/// The targets for [`cuFlushGPUDirectRDMAWrites`].
5878#[repr(u32)]
5879#[derive(
5880 Debug,
5881 Copy,
5882 Clone,
5883 Hash,
5884 PartialOrd,
5885 Ord,
5886 PartialEq,
5887 Eq,
5888 TryFromPrimitive,
5889 IntoPrimitive,
5890)]
5891pub enum CUflushGPUDirectRDMAWritesTarget_enum {
5892 /// Sets the target for [`cuFlushGPUDirectRDMAWrites`] to the currently active CUDA device context.
5893 CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TARGET_CURRENT_CTX = 0,
5894}
5895pub use self::CUflushGPUDirectRDMAWritesTarget_enum as CUflushGPUDirectRDMAWritesTarget;
5896/// The additional write options for [`cuGraphDebugDotPrint`].
5897#[repr(u32)]
5898#[derive(
5899 Debug,
5900 Copy,
5901 Clone,
5902 Hash,
5903 PartialOrd,
5904 Ord,
5905 PartialEq,
5906 Eq,
5907 TryFromPrimitive,
5908 IntoPrimitive,
5909)]
5910pub enum CUgraphDebugDot_flags_enum {
5911 /// Output all debug data as if every debug flag is enabled.
5912 CU_GRAPH_DEBUG_DOT_FLAGS_VERBOSE = 1,
5913 /// Use CUDA Runtime structures for output.
5914 CU_GRAPH_DEBUG_DOT_FLAGS_RUNTIME_TYPES = 2,
5915 /// Adds CUDA_KERNEL_NODE_PARAMS values to output.
5916 CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_PARAMS = 4,
5917 /// Adds CUDA_MEMCPY3D values to output.
5918 CU_GRAPH_DEBUG_DOT_FLAGS_MEMCPY_NODE_PARAMS = 8,
5919 /// Adds CUDA_MEMSET_NODE_PARAMS values to output.
5920 CU_GRAPH_DEBUG_DOT_FLAGS_MEMSET_NODE_PARAMS = 16,
5921 /// Adds CUDA_HOST_NODE_PARAMS values to output.
5922 CU_GRAPH_DEBUG_DOT_FLAGS_HOST_NODE_PARAMS = 32,
5923 /// Adds CUevent handle from record and wait nodes to output.
5924 CU_GRAPH_DEBUG_DOT_FLAGS_EVENT_NODE_PARAMS = 64,
5925 /// Adds CUDA_EXT_SEM_SIGNAL_NODE_PARAMS values to output.
5926 CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_SIGNAL_NODE_PARAMS = 128,
5927 /// Adds CUDA_EXT_SEM_WAIT_NODE_PARAMS values to output.
5928 CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_WAIT_NODE_PARAMS = 256,
5929 /// Adds CUkernelNodeAttrValue values to output.
5930 CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_ATTRIBUTES = 512,
5931 /// Adds node handles and every kernel function handle to output.
5932 CU_GRAPH_DEBUG_DOT_FLAGS_HANDLES = 1024,
5933 /// Adds memory alloc node parameters to output.
5934 CU_GRAPH_DEBUG_DOT_FLAGS_MEM_ALLOC_NODE_PARAMS = 2048,
5935 /// Adds memory free node parameters to output.
5936 CU_GRAPH_DEBUG_DOT_FLAGS_MEM_FREE_NODE_PARAMS = 4096,
5937 /// Adds batch mem op node parameters to output.
5938 CU_GRAPH_DEBUG_DOT_FLAGS_BATCH_MEM_OP_NODE_PARAMS = 8192,
5939 /// Adds edge numbering information.
5940 CU_GRAPH_DEBUG_DOT_FLAGS_EXTRA_TOPO_INFO = 16384,
5941 /// Adds conditional node parameters to output.
5942 CU_GRAPH_DEBUG_DOT_FLAGS_CONDITIONAL_NODE_PARAMS = 32768,
5943}
5944pub use self::CUgraphDebugDot_flags_enum as CUgraphDebugDot_flags;
5945/// Flags for user objects for graphs.
5946#[repr(u32)]
5947#[derive(
5948 Debug,
5949 Copy,
5950 Clone,
5951 Hash,
5952 PartialOrd,
5953 Ord,
5954 PartialEq,
5955 Eq,
5956 TryFromPrimitive,
5957 IntoPrimitive,
5958)]
5959pub enum CUuserObject_flags_enum {
5960 /// Indicates the destructor execution is not synchronized by any CUDA handle.
5961 CU_USER_OBJECT_NO_DESTRUCTOR_SYNC = 1,
5962}
5963pub use self::CUuserObject_flags_enum as CUuserObject_flags;
5964/// Flags for retaining user object references for graphs.
5965#[repr(u32)]
5966#[derive(
5967 Debug,
5968 Copy,
5969 Clone,
5970 Hash,
5971 PartialOrd,
5972 Ord,
5973 PartialEq,
5974 Eq,
5975 TryFromPrimitive,
5976 IntoPrimitive,
5977)]
5978pub enum CUuserObjectRetain_flags_enum {
5979 /// Transfer references from the caller rather than creating new references.
5980 CU_GRAPH_USER_OBJECT_MOVE = 1,
5981}
5982pub use self::CUuserObjectRetain_flags_enum as CUuserObjectRetain_flags;
5983/// Flags for instantiating a graph.
5984#[repr(u32)]
5985#[derive(
5986 Debug,
5987 Copy,
5988 Clone,
5989 Hash,
5990 PartialOrd,
5991 Ord,
5992 PartialEq,
5993 Eq,
5994 TryFromPrimitive,
5995 IntoPrimitive,
5996)]
5997pub enum CUgraphInstantiate_flags_enum {
5998 /// Automatically free memory allocated in a graph before relaunching.
5999 CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH = 1,
6000 /// Automatically upload the graph after instantiation. Only supported by [`cuGraphInstantiateWithParams`]. The upload will be performed using the stream provided in instantiateParams.
6001 CUDA_GRAPH_INSTANTIATE_FLAG_UPLOAD = 2,
6002 /// Instantiate the graph to be launchable from the device. This flag can only be used on platforms which support unified addressing.
6003 /// This flag cannot be used in conjunction with [`CUgraphInstantiate_flags::CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH`].
6004 CUDA_GRAPH_INSTANTIATE_FLAG_DEVICE_LAUNCH = 4,
6005 /// Run the graph using the per-node priority attributes rather than the priority of the stream it is launched into.
6006 CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY = 8,
6007}
6008pub use self::CUgraphInstantiate_flags_enum as CUgraphInstantiate_flags;
6009/// CUDA device NUMA configuration.
6010#[repr(u32)]
6011#[derive(
6012 Debug,
6013 Copy,
6014 Clone,
6015 Hash,
6016 PartialOrd,
6017 Ord,
6018 PartialEq,
6019 Eq,
6020 TryFromPrimitive,
6021 IntoPrimitive,
6022)]
6023pub enum CUdeviceNumaConfig_enum {
6024 /// The GPU is not a NUMA node.
6025 CU_DEVICE_NUMA_CONFIG_NONE = 0,
6026 /// The GPU is a NUMA node, [`CUdevice_attribute::CU_DEVICE_ATTRIBUTE_NUMA_ID`] contains its NUMA ID.
6027 CU_DEVICE_NUMA_CONFIG_NUMA_NODE = 1,
6028}
6029pub use self::CUdeviceNumaConfig_enum as CUdeviceNumaConfig;
6030/// CUDA Process States.
6031#[repr(u32)]
6032#[derive(
6033 Debug,
6034 Copy,
6035 Clone,
6036 Hash,
6037 PartialOrd,
6038 Ord,
6039 PartialEq,
6040 Eq,
6041 TryFromPrimitive,
6042 IntoPrimitive,
6043)]
6044pub enum CUprocessState_enum {
6045 /// Default process state.
6046 CU_PROCESS_STATE_RUNNING = 0,
6047 /// CUDA API locks are taken so further CUDA API calls will block.
6048 CU_PROCESS_STATE_LOCKED = 1,
6049 /// Application memory contents have been checkpointed and underlying allocations and device handles have been released.
6050 CU_PROCESS_STATE_CHECKPOINTED = 2,
6051 /// Application entered an uncorrectable error during the checkpoint/restore process.
6052 CU_PROCESS_STATE_FAILED = 3,
6053}
6054pub use self::CUprocessState_enum as CUprocessState;
6055#[repr(C)]
6056#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
6057pub struct CUcheckpointLockArgs_st {
6058 pub timeoutMs: ::core::ffi::c_uint,
6059 pub reserved0: ::core::ffi::c_uint,
6060 pub reserved1: [cuuint64_t; 7usize],
6061}
6062/// CUDA checkpoint optional lock arguments.
6063pub type CUcheckpointLockArgs = CUcheckpointLockArgs_st;
6064#[repr(C)]
6065#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
6066pub struct CUcheckpointCheckpointArgs_st {
6067 pub reserved: [cuuint64_t; 8usize],
6068}
6069/// CUDA checkpoint optional checkpoint arguments.
6070pub type CUcheckpointCheckpointArgs = CUcheckpointCheckpointArgs_st;
6071#[repr(C)]
6072#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
6073pub struct CUcheckpointGpuPair_st {
6074 pub oldUuid: CUuuid,
6075 pub newUuid: CUuuid,
6076}
6077/// CUDA checkpoint GPU UUID pairs for device remapping during restore.
6078pub type CUcheckpointGpuPair = CUcheckpointGpuPair_st;
6079#[repr(C)]
6080#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
6081pub struct CUcheckpointRestoreArgs_st {
6082 pub gpuPairs: *mut CUcheckpointGpuPair,
6083 pub gpuPairsCount: ::core::ffi::c_uint,
6084 pub reserved: [::core::ffi::c_char; 52usize],
6085}
6086impl Default for CUcheckpointRestoreArgs_st {
6087 fn default() -> Self {
6088 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
6089 unsafe {
6090 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
6091 s.assume_init()
6092 }
6093 }
6094}
6095/// CUDA checkpoint optional restore arguments.
6096pub type CUcheckpointRestoreArgs = CUcheckpointRestoreArgs_st;
6097#[repr(C)]
6098#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
6099pub struct CUcheckpointUnlockArgs_st {
6100 pub reserved: [cuuint64_t; 8usize],
6101}
6102/// CUDA checkpoint optional unlock arguments.
6103pub type CUcheckpointUnlockArgs = CUcheckpointUnlockArgs_st;
6104unsafe extern "C" {
6105 /// Gets the string description of an error code.
6106 ///
6107 /// Sets \*pStr to the address of a NULL-terminated string description of the error code error. If the error code is not recognized, [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] will be returned and \*pStr will be set to the NULL address.
6108 ///
6109 /// **See also:**
6110 ///
6111 /// `CUresult`, [cudaGetErrorString](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__ERROR.html#group__CUDART__ERROR_1g4bc9e35a618dfd0877c29c8ee45148f1).
6112 ///
6113 /// # Parameters
6114 ///
6115 /// - `error`: Error code to convert to string.
6116 /// - `pStr`: Address of the string pointer.
6117 pub fn cuGetErrorString(
6118 error: CUresult,
6119 pStr: *mut *const ::core::ffi::c_char,
6120 ) -> CUresult;
6121}
6122unsafe extern "C" {
6123 /// Gets the string representation of an error code enum name.
6124 ///
6125 /// Sets \*pStr to the address of a NULL-terminated string representation of the name of the enum error code error. If the error code is not recognized, [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] will be returned and \*pStr will be set to the NULL address.
6126 ///
6127 /// **See also:**
6128 ///
6129 /// `CUresult`, [cudaGetErrorName](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__ERROR.html#group__CUDART__ERROR_1gb3de7da2f23736878270026dcfc70075).
6130 ///
6131 /// # Parameters
6132 ///
6133 /// - `error`: Error code to convert to string.
6134 /// - `pStr`: Address of the string pointer.
6135 pub fn cuGetErrorName(
6136 error: CUresult,
6137 pStr: *mut *const ::core::ffi::c_char,
6138 ) -> CUresult;
6139}
6140unsafe extern "C" {
6141 /// Initialize the CUDA driver API Initializes the driver API and must be called before any other function from the driver API
6142 /// in the current process. Currently, the Flags parameter must be 0. If cuInit() has not been called, any function from the driver API will return [`CUresult::CUDA_ERROR_NOT_INITIALIZED`].
6143 ///
6144 /// Note: cuInit preloads various libraries needed for JIT compilation. To opt-out of this behavior, set the environment variable
6145 /// CUDA_FORCE_PRELOAD_LIBRARIES=0. CUDA will lazily load JIT libraries as needed. To disable JIT entirely, set the environment
6146 /// variable CUDA_DISABLE_JIT=1.
6147 ///
6148 /// Note:
6149 ///
6150 /// Note that this function may also return error codes from previous, asynchronous launches.
6151 ///
6152 /// # Parameters
6153 ///
6154 /// - `Flags`: Initialization flag for CUDA.
6155 pub fn cuInit(Flags: ::core::ffi::c_uint) -> CUresult;
6156}
6157unsafe extern "C" {
6158 /// Returns the latest CUDA version supported by driver.
6159 ///
6160 /// Returns in \*driverVersion the version of CUDA supported by the driver. The version is returned as (1000 \* major + 10 \* minor). For example, CUDA 9.2
6161 /// would be represented by 9020.
6162 ///
6163 /// This function automatically returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] if driverVersion is NULL.
6164 ///
6165 /// Note:
6166 ///
6167 /// Note that this function may also return error codes from previous, asynchronous launches.
6168 ///
6169 /// **See also:**
6170 ///
6171 /// [cudaDriverGetVersion](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART____VERSION.html#group__CUDART____VERSION_1g8a06ee14a0551606b7c780084d5564ab), [cudaRuntimeGetVersion](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART____VERSION.html#group__CUDART____VERSION_1g0e3952c7802fd730432180f1f4a6cdc6).
6172 ///
6173 /// # Parameters
6174 ///
6175 /// - `driverVersion`: Returns the CUDA driver version.
6176 pub fn cuDriverGetVersion(driverVersion: *mut ::core::ffi::c_int) -> CUresult;
6177}
6178unsafe extern "C" {
6179 /// Returns a handle to a compute device.
6180 ///
6181 /// Returns in \*device a device handle given an ordinal in the range **0, \[cuDeviceGetCount()-1\]**.
6182 ///
6183 /// Note:
6184 ///
6185 /// Note that this function may also return error codes from previous, asynchronous launches.
6186 ///
6187 /// **See also:**
6188 ///
6189 /// [`cuDeviceGetAttribute`], [`cuDeviceGetCount`], [`cuDeviceGetName`], [`cuDeviceGetUuid_v2`], [`cuDeviceGetLuid`], [`cuDeviceTotalMem_v2`], [`cuDeviceGetExecAffinitySupport`].
6190 ///
6191 /// # Parameters
6192 ///
6193 /// - `device`: Returned device handle.
6194 /// - `ordinal`: Device number to get handle for.
6195 pub fn cuDeviceGet(device: *mut CUdevice, ordinal: ::core::ffi::c_int) -> CUresult;
6196}
6197unsafe extern "C" {
6198 /// Returns the number of compute-capable devices.
6199 ///
6200 /// Returns in \*count the number of devices with compute capability greater than or equal to 2.0 that are available for execution. If there is
6201 /// no such device, [`cuDeviceGetCount`] returns 0.
6202 ///
6203 /// Note:
6204 ///
6205 /// Note that this function may also return error codes from previous, asynchronous launches.
6206 ///
6207 /// **See also:**
6208 ///
6209 /// [`cuDeviceGetAttribute`], [`cuDeviceGetName`], [`cuDeviceGetUuid_v2`], [`cuDeviceGetLuid`], [`cuDeviceGet`], [`cuDeviceTotalMem_v2`], [`cuDeviceGetExecAffinitySupport`], [cudaGetDeviceCount](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g18808e54893cfcaafefeab31a73cc55f).
6210 ///
6211 /// # Parameters
6212 ///
6213 /// - `count`: Returned number of compute-capable devices.
6214 pub fn cuDeviceGetCount(count: *mut ::core::ffi::c_int) -> CUresult;
6215}
6216unsafe extern "C" {
6217 /// Returns an identifier string for the device.
6218 ///
6219 /// Returns an ASCII string identifying the device dev in the NULL-terminated string pointed to by name. len specifies the maximum length of the string that may be returned. name is shortened to the specified len, if len is less than the device name
6220 ///
6221 /// Note:
6222 ///
6223 /// Note that this function may also return error codes from previous, asynchronous launches.
6224 ///
6225 /// **See also:**
6226 ///
6227 /// [`cuDeviceGetAttribute`], [`cuDeviceGetUuid_v2`], [`cuDeviceGetLuid`], [`cuDeviceGetCount`], [`cuDeviceGet`], [`cuDeviceTotalMem_v2`], [`cuDeviceGetExecAffinitySupport`], [cudaGetDeviceProperties](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g1bf9d625a931d657e08db2b4391170f0).
6228 ///
6229 /// # Parameters
6230 ///
6231 /// - `name`: Returned identifier string for the device.
6232 /// - `len`: Maximum length of string to store in name.
6233 /// - `dev`: Device to get identifier string for.
6234 pub fn cuDeviceGetName(
6235 name: *mut ::core::ffi::c_char,
6236 len: ::core::ffi::c_int,
6237 dev: CUdevice,
6238 ) -> CUresult;
6239}
6240unsafe extern "C" {
6241 /// Return an UUID for the device.
6242 ///
6243 /// Returns 16-octets identifying the device dev in the structure pointed by the uuid. If the device is in MIG mode, returns its MIG UUID which uniquely identifies the subscribed MIG compute instance.
6244 ///
6245 /// Note:
6246 ///
6247 /// Note that this function may also return error codes from previous, asynchronous launches.
6248 ///
6249 /// **See also:**
6250 ///
6251 /// [`cuDeviceGetAttribute`], [`cuDeviceGetCount`], [`cuDeviceGetName`], [`cuDeviceGetLuid`], [`cuDeviceGet`], [`cuDeviceTotalMem_v2`], [cudaGetDeviceProperties](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g1bf9d625a931d657e08db2b4391170f0).
6252 ///
6253 /// # Parameters
6254 ///
6255 /// - `uuid`: Returned UUID.
6256 /// - `dev`: Device to get identifier string for.
6257 pub fn cuDeviceGetUuid_v2(uuid: *mut CUuuid, dev: CUdevice) -> CUresult;
6258}
6259unsafe extern "C" {
6260 /// Return an LUID and device node mask for the device.
6261 ///
6262 /// Return identifying information (luid and deviceNodeMask) to allow matching device with graphics APIs.
6263 ///
6264 /// Note:
6265 ///
6266 /// Note that this function may also return error codes from previous, asynchronous launches.
6267 ///
6268 /// **See also:**
6269 ///
6270 /// [`cuDeviceGetAttribute`], [`cuDeviceGetCount`], [`cuDeviceGetName`], [`cuDeviceGet`], [`cuDeviceTotalMem_v2`], [`cuDeviceGetExecAffinitySupport`], [cudaGetDeviceProperties](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g1bf9d625a931d657e08db2b4391170f0).
6271 ///
6272 /// # Parameters
6273 ///
6274 /// - `luid`: Returned LUID.
6275 /// - `deviceNodeMask`: Returned device node mask.
6276 /// - `dev`: Device to get identifier string for.
6277 pub fn cuDeviceGetLuid(
6278 luid: *mut ::core::ffi::c_char,
6279 deviceNodeMask: *mut ::core::ffi::c_uint,
6280 dev: CUdevice,
6281 ) -> CUresult;
6282}
6283unsafe extern "C" {
6284 /// Returns the total amount of memory on the device.
6285 ///
6286 /// Returns in \*bytes the total amount of memory available on the device dev in bytes.
6287 ///
6288 /// Note:
6289 ///
6290 /// Note that this function may also return error codes from previous, asynchronous launches.
6291 ///
6292 /// **See also:**
6293 ///
6294 /// [`cuDeviceGetAttribute`], [`cuDeviceGetCount`], [`cuDeviceGetName`], [`cuDeviceGetUuid_v2`], [`cuDeviceGet`], [`cuDeviceGetExecAffinitySupport`], [cudaMemGetInfo](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g376b97f5ab20321ca46f7cfa9511b978).
6295 ///
6296 /// # Parameters
6297 ///
6298 /// - `bytes`: Returned memory available on device in bytes.
6299 /// - `dev`: Device handle.
6300 pub fn cuDeviceTotalMem_v2(bytes: *mut size_t, dev: CUdevice) -> CUresult;
6301}
6302unsafe extern "C" {
6303 /// Returns the maximum number of elements allocatable in a 1D linear texture for a given texture element size.
6304 ///
6305 /// Returns in maxWidthInElements the maximum number of texture elements allocatable in a 1D linear texture for given format and numChannels.
6306 ///
6307 /// Note:
6308 ///
6309 /// Note that this function may also return error codes from previous, asynchronous launches.
6310 ///
6311 /// **See also:**
6312 ///
6313 /// [`cuDeviceGetAttribute`], [`cuDeviceGetCount`], [`cuDeviceGetName`], [`cuDeviceGetUuid_v2`], [`cuDeviceGet`], [cudaMemGetInfo](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g376b97f5ab20321ca46f7cfa9511b978), [`cuDeviceTotalMem_v2`].
6314 ///
6315 /// # Parameters
6316 ///
6317 /// - `maxWidthInElements`: Returned maximum number of texture elements allocatable for given format and numChannels.
6318 /// - `format`: Texture format.
6319 /// - `numChannels`: Number of channels per texture element.
6320 /// - `dev`: Device handle.
6321 pub fn cuDeviceGetTexture1DLinearMaxWidth(
6322 maxWidthInElements: *mut size_t,
6323 format: CUarray_format,
6324 numChannels: ::core::ffi::c_uint,
6325 dev: CUdevice,
6326 ) -> CUresult;
6327}
6328unsafe extern "C" {
6329 /// Returns information about the device.
6330 ///
6331 /// Returns in \*pi the integer value of the attribute attrib on device dev.
6332 ///
6333 /// Note:
6334 ///
6335 /// Note that this function may also return error codes from previous, asynchronous launches.
6336 ///
6337 /// **See also:**
6338 ///
6339 /// [`cuDeviceGetCount`], [`cuDeviceGetName`], [`cuDeviceGetUuid_v2`], [`cuDeviceGet`], [`cuDeviceTotalMem_v2`], [`cuDeviceGetExecAffinitySupport`], [cudaDeviceGetAttribute](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1gb22e8256592b836df9a9cc36c9db7151), [cudaGetDeviceProperties](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g1bf9d625a931d657e08db2b4391170f0).
6340 ///
6341 /// # Parameters
6342 ///
6343 /// - `pi`: Returned device attribute value.
6344 /// - `attrib`: Device attribute to query.
6345 /// - `dev`: Device handle.
6346 pub fn cuDeviceGetAttribute(
6347 pi: *mut ::core::ffi::c_int,
6348 attrib: CUdevice_attribute,
6349 dev: CUdevice,
6350 ) -> CUresult;
6351}
6352unsafe extern "C" {
6353 /// Queries details about atomic operations supported between the device and host.
6354 ///
6355 /// Returns in \*capabilities the details about requested atomic \*operations over the link between dev and the host. The allocated size of \*operations and \*capabilities must be count.
6356 ///
6357 /// For each `CUatomicOperation` in \*operations, the corresponding result in \*capabilities will be a bitmask indicating which of `CUatomicOperationCapability` the link supports natively.
6358 ///
6359 /// Returns [`cudaError_enum::CUDA_ERROR_INVALID_DEVICE`] if dev is not valid.
6360 ///
6361 /// Returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] if \*capabilities or \*operations is NULL, if count is 0, or if any of \*operations is not valid.
6362 ///
6363 /// Note:
6364 ///
6365 /// Note that this function may also return error codes from previous, asynchronous launches.
6366 ///
6367 /// **See also:**
6368 ///
6369 /// [`cuDeviceGetAttribute`], [`cuDeviceGetP2PAtomicCapabilities`], cudaDeviceGeHostAtomicCapabilities.
6370 ///
6371 /// # Parameters
6372 ///
6373 /// - `capabilities`: Returned capability details of each requested operation.
6374 /// - `operations`: Requested operations.
6375 /// - `count`: Count of requested operations and size of capabilities.
6376 /// - `dev`: Device handle.
6377 pub fn cuDeviceGetHostAtomicCapabilities(
6378 capabilities: *mut ::core::ffi::c_uint,
6379 operations: *const CUatomicOperation,
6380 count: ::core::ffi::c_uint,
6381 dev: CUdevice,
6382 ) -> CUresult;
6383}
6384unsafe extern "C" {
6385 /// Return NvSciSync attributes that this device can support.
6386 ///
6387 /// Returns in nvSciSyncAttrList, the properties of NvSciSync that this CUDA device, dev can support. The returned nvSciSyncAttrList can be used to create an NvSciSync object that matches this device's capabilities.
6388 ///
6389 /// If NvSciSyncAttrKey_RequiredPerm field in nvSciSyncAttrList is already set this API will return [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`].
6390 ///
6391 /// The applications should set nvSciSyncAttrList to a valid NvSciSyncAttrList failing which this API will return [`cudaError_enum::CUDA_ERROR_INVALID_HANDLE`].
6392 ///
6393 /// The flags controls how applications intends to use the NvSciSync created from the nvSciSyncAttrList. The valid flags are:
6394 ///
6395 /// * [`CUDA_NVSCISYNC_ATTR_SIGNAL`], specifies that the applications intends to signal an NvSciSync on this CUDA device.
6396 /// * [`CUDA_NVSCISYNC_ATTR_WAIT`], specifies that the applications intends to wait on an NvSciSync on this CUDA device.
6397 ///
6398 /// At least one of these flags must be set, failing which the API returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`]. Both the flags are orthogonal to one another: a developer may set both these flags that allows to set both wait and signal
6399 /// specific attributes in the same nvSciSyncAttrList.
6400 ///
6401 /// Note that this API updates the input nvSciSyncAttrList with values equivalent to the following public attribute key-values: NvSciSyncAttrKey_RequiredPerm is set to
6402 ///
6403 /// * NvSciSyncAccessPerm_SignalOnly if [`CUDA_NVSCISYNC_ATTR_SIGNAL`] is set in flags.
6404 /// * NvSciSyncAccessPerm_WaitOnly if [`CUDA_NVSCISYNC_ATTR_WAIT`] is set in flags.
6405 /// * NvSciSyncAccessPerm_WaitSignal if both [`CUDA_NVSCISYNC_ATTR_WAIT`] and [`CUDA_NVSCISYNC_ATTR_SIGNAL`] are set in flags. NvSciSyncAttrKey_PrimitiveInfo is set to
6406 /// * NvSciSyncAttrValPrimitiveType_SysmemSemaphore on any valid device.
6407 /// * NvSciSyncAttrValPrimitiveType_Syncpoint if device is a Tegra device.
6408 /// * NvSciSyncAttrValPrimitiveType_SysmemSemaphorePayload64b if device is GA10X+. NvSciSyncAttrKey_GpuId is set to the same UUID that is returned for this device from [`cuDeviceGetUuid_v2`].
6409 ///
6410 /// [`cudaError_enum::CUDA_SUCCESS`], [`cudaError_enum::CUDA_ERROR_DEINITIALIZED`], [`cudaError_enum::CUDA_ERROR_NOT_INITIALIZED`], [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`], [`cudaError_enum::CUDA_ERROR_INVALID_HANDLE`], [`cudaError_enum::CUDA_ERROR_INVALID_DEVICE`], [`cudaError_enum::CUDA_ERROR_NOT_SUPPORTED`], [`cudaError_enum::CUDA_ERROR_OUT_OF_MEMORY`]
6411 ///
6412 /// **See also:**
6413 ///
6414 /// [`cuImportExternalSemaphore`], [`cuDestroyExternalSemaphore`], [`cuSignalExternalSemaphoresAsync`], [`cuWaitExternalSemaphoresAsync`].
6415 ///
6416 /// # Parameters
6417 ///
6418 /// - `nvSciSyncAttrList`: Return NvSciSync attributes supported.
6419 /// - `dev`: Valid CUDA Device to get NvSciSync attributes for.
6420 /// - `flags`: flags describing NvSciSync usage.
6421 pub fn cuDeviceGetNvSciSyncAttributes(
6422 nvSciSyncAttrList: *mut ::core::ffi::c_void,
6423 dev: CUdevice,
6424 flags: ::core::ffi::c_int,
6425 ) -> CUresult;
6426}
6427unsafe extern "C" {
6428 /// Sets the current memory pool of a device.
6429 ///
6430 /// The memory pool must be local to the specified device. [`cuMemAllocAsync`] allocates from the current mempool of the provided stream's device. By default, a device's current memory pool is its default
6431 /// memory pool.
6432 ///
6433 /// Note:
6434 ///
6435 /// Use [`cuMemAllocFromPoolAsync`] to specify asynchronous allocations from a device different than the one the stream runs on.
6436 ///
6437 /// **See also:**
6438 ///
6439 /// [`cuDeviceGetDefaultMemPool`], [`cuDeviceGetMemPool`], [`cuMemPoolCreate`], [`cuMemPoolDestroy`], [`cuMemAllocFromPoolAsync`].
6440 pub fn cuDeviceSetMemPool(dev: CUdevice, pool: CUmemoryPool) -> CUresult;
6441}
6442unsafe extern "C" {
6443 /// Gets the current mempool for a device.
6444 ///
6445 /// Returns the last pool provided to [`cuDeviceSetMemPool`] for this device or the device's default memory pool if [`cuDeviceSetMemPool`] has never been called. By default the current mempool is the default mempool for a device. Otherwise the returned pool must
6446 /// have been set with [`cuDeviceSetMemPool`].
6447 ///
6448 /// **See also:**
6449 ///
6450 /// [`cuDeviceGetDefaultMemPool`], [`cuMemPoolCreate`], [`cuDeviceSetMemPool`].
6451 pub fn cuDeviceGetMemPool(pool: *mut CUmemoryPool, dev: CUdevice) -> CUresult;
6452}
6453unsafe extern "C" {
6454 /// Returns the default mempool of a device.
6455 ///
6456 /// The default mempool of a device contains device memory from that device.
6457 ///
6458 /// Note:
6459 ///
6460 /// Note that this function may also return error codes from previous, asynchronous launches.
6461 ///
6462 /// **See also:**
6463 ///
6464 /// [`cuMemAllocAsync`], [`cuMemPoolTrimTo`], [`cuMemPoolGetAttribute`], [`cuMemPoolSetAttribute`], [`cuMemPoolSetAccess`], [`cuDeviceGetMemPool`], [`cuMemPoolCreate`].
6465 pub fn cuDeviceGetDefaultMemPool(
6466 pool_out: *mut CUmemoryPool,
6467 dev: CUdevice,
6468 ) -> CUresult;
6469}
6470unsafe extern "C" {
6471 /// Returns information about the execution affinity support of the device.
6472 ///
6473 /// Returns in \*pi whether execution affinity type type is supported by device dev. The supported types are:
6474 ///
6475 /// * [`CUexecAffinityType_enum::CU_EXEC_AFFINITY_TYPE_SM_COUNT`]: 1 if context with limited SMs is supported by the device, or 0 if not;
6476 ///
6477 /// Note:
6478 ///
6479 /// Note that this function may also return error codes from previous, asynchronous launches.
6480 ///
6481 /// **See also:**
6482 ///
6483 /// [`cuDeviceGetAttribute`], [`cuDeviceGetCount`], [`cuDeviceGetName`], [`cuDeviceGetUuid_v2`], [`cuDeviceGet`], [`cuDeviceTotalMem_v2`].
6484 ///
6485 /// # Parameters
6486 ///
6487 /// - `pi`: 1 if the execution affinity type type is supported by the device, or 0 if not.
6488 /// - `dev`: Device handle.
6489 pub fn cuDeviceGetExecAffinitySupport(
6490 pi: *mut ::core::ffi::c_int,
6491 type_: CUexecAffinityType,
6492 dev: CUdevice,
6493 ) -> CUresult;
6494}
6495unsafe extern "C" {
6496 /// Blocks until remote writes are visible to the specified scope.
6497 ///
6498 /// Blocks until GPUDirect RDMA writes to the target context via mappings created through APIs like nvidia_p2p_get_pages (see
6499 /// <https://docs.nvidia.com/cuda/gpudirect-rdma> for more information), are visible to the specified scope.
6500 ///
6501 /// If the scope equals or lies within the scope indicated by [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING`], the call will be a no-op and can be safely omitted for performance. This can be determined by comparing the numerical values
6502 /// between the two enums, with smaller scopes having smaller values.
6503 ///
6504 /// On platforms that support GPUDirect RDMA writes via more than one path in hardware (see [`CUmemRangeFlags_enum::CU_MEM_RANGE_FLAG_DMA_BUF_MAPPING_TYPE_PCIE`]), the user should consider those paths as belonging to separate ordering domains. Note that in such cases CUDA driver will
6505 /// report both RDMA writes ordering and RDMA write scope as ALL_DEVICES and a call to cuFlushGPUDirectRDMA will be a no-op, but
6506 /// when these multiple paths are used simultaneously, it is the user's responsibility to ensure ordering by using mechanisms
6507 /// outside the scope of CUDA.
6508 ///
6509 /// Users may query support for this API via CU_DEVICE_ATTRIBUTE_FLUSH_FLUSH_GPU_DIRECT_RDMA_OPTIONS.
6510 ///
6511 /// Note:
6512 ///
6513 /// Note that this function may also return error codes from previous, asynchronous launches.
6514 ///
6515 /// # Parameters
6516 ///
6517 /// - `target`: The target of the operation, see `CUflushGPUDirectRDMAWritesTarget`.
6518 /// - `scope`: The scope of the operation, see `CUflushGPUDirectRDMAWritesScope`.
6519 pub fn cuFlushGPUDirectRDMAWrites(
6520 target: CUflushGPUDirectRDMAWritesTarget,
6521 scope: CUflushGPUDirectRDMAWritesScope,
6522 ) -> CUresult;
6523}
6524unsafe extern "C" {
6525 /// Returns properties for a selected device.
6526 ///
6527 /// Returns in \*prop the properties of device dev. The CUdevprop structure is defined as:
6528 ///
6529 /// ```text
6530 /// typedef struct CUdevprop_st {
6531 /// int maxThreadsPerBlock;
6532 /// int maxThreadsDim\[3\];
6533 /// int maxGridSize\[3\];
6534 /// int sharedMemPerBlock;
6535 /// int totalConstantMemory;
6536 /// int SIMDWidth;
6537 /// int memPitch;
6538 /// int regsPerBlock;
6539 /// int clockRate;
6540 /// int textureAlign
6541 /// } CUdevprop;
6542 /// ```
6543 ///
6544 /// where:
6545 ///
6546 /// * maxThreadsPerBlock is the maximum number of threads per block;
6547 /// * maxThreadsDim\[3\] is the maximum sizes of each dimension of a block;
6548 /// * maxGridSize\[3\] is the maximum sizes of each dimension of a grid;
6549 /// * sharedMemPerBlock is the total amount of shared memory available per block in bytes;
6550 /// * totalConstantMemory is the total amount of constant memory available on the device in bytes;
6551 /// * SIMDWidth is the warp size;
6552 /// * memPitch is the maximum pitch allowed by the memory copy functions that involve memory regions allocated through [`cuMemAllocPitch_v2`];
6553 /// * regsPerBlock is the total number of registers available per block;
6554 /// * clockRate is the clock frequency in kilohertz;
6555 /// * textureAlign is the alignment requirement; texture base addresses that are aligned to textureAlign bytes do not need an offset
6556 /// applied to texture fetches.
6557 ///
6558 /// Note:
6559 ///
6560 /// Note that this function may also return error codes from previous, asynchronous launches.
6561 ///
6562 /// **See also:**
6563 ///
6564 /// [`cuDeviceGetAttribute`], [`cuDeviceGetCount`], [`cuDeviceGetName`], [`cuDeviceGetUuid_v2`], [`cuDeviceGet`], [`cuDeviceTotalMem_v2`].
6565 ///
6566 /// # Parameters
6567 ///
6568 /// - `prop`: Returned properties of device.
6569 /// - `dev`: Device to get properties for.
6570 #[deprecated]
6571 pub fn cuDeviceGetProperties(prop: *mut CUdevprop, dev: CUdevice) -> CUresult;
6572}
6573unsafe extern "C" {
6574 /// Returns the compute capability of the device.
6575 ///
6576 /// Returns in \*major and \*minor the major and minor revision numbers that define the compute capability of the device dev.
6577 ///
6578 /// Note:
6579 ///
6580 /// Note that this function may also return error codes from previous, asynchronous launches.
6581 ///
6582 /// **See also:**
6583 ///
6584 /// [`cuDeviceGetAttribute`], [`cuDeviceGetCount`], [`cuDeviceGetName`], [`cuDeviceGetUuid_v2`], [`cuDeviceGet`], [`cuDeviceTotalMem_v2`].
6585 ///
6586 /// # Parameters
6587 ///
6588 /// - `major`: Major revision number.
6589 /// - `minor`: Minor revision number.
6590 /// - `dev`: Device handle.
6591 #[deprecated]
6592 pub fn cuDeviceComputeCapability(
6593 major: *mut ::core::ffi::c_int,
6594 minor: *mut ::core::ffi::c_int,
6595 dev: CUdevice,
6596 ) -> CUresult;
6597}
6598unsafe extern "C" {
6599 /// Retain the primary context on the GPU.
6600 ///
6601 /// Retains the primary context on the device. Once the user successfully retains the primary context, the primary context will
6602 /// be active and available to the user until the user releases it with [`cuDevicePrimaryCtxRelease_v2`] or resets it with [`cuDevicePrimaryCtxReset_v2`]. Unlike [`cuCtxCreate_v4`] the newly retained context is not pushed onto the stack.
6603 ///
6604 /// Retaining the primary context for the first time will fail with [`cudaError_enum::CUDA_ERROR_UNKNOWN`] if the compute mode of the device is [`CUcomputemode_enum::CU_COMPUTEMODE_PROHIBITED`]. The function [`cuDeviceGetAttribute`] can be used with [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_COMPUTE_MODE`] to determine the compute mode of the device. The nvidia-smi tool can be used to set the compute mode for devices. Documentation
6605 /// for nvidia-smi can be obtained by passing a -h option to it.
6606 ///
6607 /// Please note that the primary context always supports pinned allocations. Other flags can be specified by [`cuDevicePrimaryCtxSetFlags_v2`].
6608 ///
6609 /// Note:
6610 ///
6611 /// Note that this function may also return error codes from previous, asynchronous launches.
6612 ///
6613 /// **See also:**
6614 ///
6615 /// [`cuDevicePrimaryCtxRelease_v2`], [`cuDevicePrimaryCtxSetFlags_v2`], [`cuCtxCreate_v4`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`], [`cuCtxSetCacheConfig`], [`cuCtxSetLimit`], [`cuCtxSynchronize`].
6616 ///
6617 /// # Parameters
6618 ///
6619 /// - `pctx`: Returned context handle of the new context.
6620 /// - `dev`: Device for which primary context is requested.
6621 pub fn cuDevicePrimaryCtxRetain(pctx: *mut CUcontext, dev: CUdevice) -> CUresult;
6622}
6623unsafe extern "C" {
6624 /// Release the primary context on the GPU.
6625 ///
6626 /// Releases the primary context interop on the device. A retained context should always be released once the user is done using
6627 /// it. The context is automatically reset once the last reference to it is released. This behavior is different when the primary
6628 /// context was retained by the CUDA runtime from CUDA 4.0 and earlier. In this case, the primary context remains always active.
6629 ///
6630 /// Releasing a primary context that has not been previously retained will fail with [`cudaError_enum::CUDA_ERROR_INVALID_CONTEXT`].
6631 ///
6632 /// Please note that unlike [`cuCtxDestroy_v2`] this method does not pop the context from stack in any circumstances.
6633 ///
6634 /// Note:
6635 ///
6636 /// Note that this function may also return error codes from previous, asynchronous launches.
6637 ///
6638 /// **See also:**
6639 ///
6640 /// [`cuDevicePrimaryCtxRetain`], [`cuCtxDestroy_v2`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`], [`cuCtxSetCacheConfig`], [`cuCtxSetLimit`], [`cuCtxSynchronize`].
6641 ///
6642 /// # Parameters
6643 ///
6644 /// - `dev`: Device which primary context is released.
6645 pub fn cuDevicePrimaryCtxRelease_v2(dev: CUdevice) -> CUresult;
6646}
6647unsafe extern "C" {
6648 /// Set flags for the primary context.
6649 ///
6650 /// Sets the flags for the primary context on the device overwriting previously set ones.
6651 ///
6652 /// The three LSBs of the flags parameter can be used to control how the OS thread, which owns the CUDA context at the time of an API call, interacts with
6653 /// the OS scheduler when waiting for results from the GPU. Only one of the scheduling flags can be set when creating a context.
6654 ///
6655 /// * [`CUctx_flags_enum::CU_CTX_SCHED_SPIN`]: Instruct CUDA to actively spin when waiting for results from the GPU. This can decrease latency when waiting for the GPU,
6656 /// but may lower the performance of CPU threads if they are performing work in parallel with the CUDA thread.
6657 ///
6658 /// * [`CUctx_flags_enum::CU_CTX_SCHED_YIELD`]: Instruct CUDA to yield its thread when waiting for results from the GPU. This can increase latency when waiting for the
6659 /// GPU, but can increase the performance of CPU threads performing work in parallel with the GPU.
6660 ///
6661 /// * [`CUctx_flags_enum::CU_CTX_SCHED_BLOCKING_SYNC`]: Instruct CUDA to block the CPU thread on a synchronization primitive when waiting for the GPU to finish work.
6662 ///
6663 /// * [CU_CTX_BLOCKING_SYNC](https://docs.nvidia.com/cuda/cuda-driver-api/types.html#group__CUDA__TYPES_1gg9f889e28a45a295b5c8ce13aa05f6cd4b5bf395cc60a8cbded4c329ae9430b91): Instruct CUDA to block the CPU thread on a synchronization primitive when waiting for the GPU to finish work.
6664 ///
6665 /// **Deprecated:** This flag was deprecated as of CUDA 4.0 and was replaced with [`CUctx_flags_enum::CU_CTX_SCHED_BLOCKING_SYNC`].
6666 ///
6667 /// * [`CUctx_flags_enum::CU_CTX_SCHED_AUTO`]: The default value if the flags parameter is zero, uses a heuristic based on the number of active CUDA contexts in the process C and the number of logical
6668 /// processors in the system P. If C > P, then CUDA will yield to other OS threads when waiting for the GPU ([`CUctx_flags_enum::CU_CTX_SCHED_YIELD`]), otherwise CUDA will not yield while waiting for results and actively spin on the processor ([`CUctx_flags_enum::CU_CTX_SCHED_SPIN`]). Additionally, on Tegra devices, [`CUctx_flags_enum::CU_CTX_SCHED_AUTO`] uses a heuristic based on the power profile of the platform and may choose [`CUctx_flags_enum::CU_CTX_SCHED_BLOCKING_SYNC`] for low-powered devices.
6669 ///
6670 /// * [`CUctx_flags_enum::CU_CTX_LMEM_RESIZE_TO_MAX`]: Instruct CUDA to not reduce local memory after resizing local memory for a kernel. This can prevent thrashing by local memory
6671 /// allocations when launching many kernels with high local memory usage at the cost of potentially increased memory usage.
6672 ///
6673 /// **Deprecated:** This flag is deprecated and the behavior enabled by this flag is now the default and cannot be disabled.
6674 ///
6675 /// * [`CUctx_flags_enum::CU_CTX_COREDUMP_ENABLE`]: If GPU coredumps have not been enabled globally with [`cuCoredumpSetAttributeGlobal`] or environment variables, this flag can be set during context creation to instruct CUDA to create a coredump if this context
6676 /// raises an exception during execution. These environment variables are described in the CUDA-GDB user guide under the "GPU
6677 /// core dump support" section. The initial settings will be taken from the global settings at the time of context creation. The
6678 /// other settings that control coredump output can be modified by calling [`cuCoredumpSetAttribute`] from the created context after it becomes current.
6679 ///
6680 /// * [`CUctx_flags_enum::CU_CTX_USER_COREDUMP_ENABLE`]: If user-triggered GPU coredumps have not been enabled globally with [`cuCoredumpSetAttributeGlobal`] or environment variables, this flag can be set during context creation to instruct CUDA to create a coredump if data is written
6681 /// to a certain pipe that is present in the OS space. These environment variables are described in the CUDA-GDB user guide under
6682 /// the "GPU core dump support" section. It is important to note that the pipe name \*must\* be set with [`cuCoredumpSetAttributeGlobal`] before creating the context if this flag is used. Setting this flag implies that [`CUctx_flags_enum::CU_CTX_COREDUMP_ENABLE`] is set. The initial settings will be taken from the global settings at the time of context creation. The other settings that
6683 /// control coredump output can be modified by calling [`cuCoredumpSetAttribute`] from the created context after it becomes current.
6684 ///
6685 /// * [`CUctx_flags_enum::CU_CTX_SYNC_MEMOPS`]: Ensures that synchronous memory operations initiated on this context will always synchronize. See further documentation
6686 /// in the section titled "API Synchronization behavior" to learn more about cases when synchronous memory operations can exhibit
6687 /// asynchronous behavior.
6688 ///
6689 /// Note:
6690 ///
6691 /// Note that this function may also return error codes from previous, asynchronous launches.
6692 ///
6693 /// **See also:**
6694 ///
6695 /// [`cuDevicePrimaryCtxRetain`], [`cuDevicePrimaryCtxGetState`], [`cuCtxCreate_v4`], [`cuCtxGetFlags`], [`cuCtxSetFlags`], [cudaSetDeviceFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g69e73c7dda3fc05306ae7c811a690fac).
6696 ///
6697 /// # Parameters
6698 ///
6699 /// - `dev`: Device for which the primary context flags are set.
6700 /// - `flags`: New flags for the device.
6701 pub fn cuDevicePrimaryCtxSetFlags_v2(
6702 dev: CUdevice,
6703 flags: ::core::ffi::c_uint,
6704 ) -> CUresult;
6705}
6706unsafe extern "C" {
6707 /// Get the state of the primary context.
6708 ///
6709 /// Returns in \*flags the flags for the primary context of dev, and in \*active whether it is active. See [`cuDevicePrimaryCtxSetFlags_v2`] for flag values.
6710 ///
6711 /// Note:
6712 ///
6713 /// Note that this function may also return error codes from previous, asynchronous launches.
6714 ///
6715 /// **See also:**
6716 ///
6717 /// [`cuDevicePrimaryCtxSetFlags_v2`], [`cuCtxGetFlags`], [`cuCtxSetFlags`], [cudaGetDeviceFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1gf830794caf068b71638c6182bba8f77a).
6718 ///
6719 /// # Parameters
6720 ///
6721 /// - `dev`: Device to get primary context flags for.
6722 /// - `flags`: Pointer to store flags.
6723 /// - `active`: Pointer to store context state; 0 = inactive, 1 = active.
6724 pub fn cuDevicePrimaryCtxGetState(
6725 dev: CUdevice,
6726 flags: *mut ::core::ffi::c_uint,
6727 active: *mut ::core::ffi::c_int,
6728 ) -> CUresult;
6729}
6730unsafe extern "C" {
6731 /// Destroy all allocations and reset all state on the primary context.
6732 ///
6733 /// Explicitly destroys and cleans up all resources associated with the current device in the current process.
6734 ///
6735 /// Note that it is responsibility of the calling function to ensure that no other module in the process is using the device any
6736 /// more. For that reason it is recommended to use [`cuDevicePrimaryCtxRelease_v2`] in most cases. However it is safe for other modules to call [`cuDevicePrimaryCtxRelease_v2`] even after resetting the device. Resetting the primary context does not release it, an application that has retained the
6737 /// primary context should explicitly release its usage.
6738 ///
6739 /// Note:
6740 ///
6741 /// Note that this function may also return error codes from previous, asynchronous launches.
6742 ///
6743 /// **See also:**
6744 ///
6745 /// [`cuDevicePrimaryCtxRetain`], [`cuDevicePrimaryCtxRelease_v2`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`], [`cuCtxSetCacheConfig`], [`cuCtxSetLimit`], [`cuCtxSynchronize`], [cudaDeviceReset](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1gef69dd5c6d0206c2b8d099abac61f217).
6746 ///
6747 /// # Parameters
6748 ///
6749 /// - `dev`: Device for which primary context is destroyed.
6750 pub fn cuDevicePrimaryCtxReset_v2(dev: CUdevice) -> CUresult;
6751}
6752unsafe extern "C" {
6753 /// Create a CUDA context.
6754 ///
6755 /// Creates a new CUDA context and associates it with the calling thread. The flags parameter is described below. The context is created with a usage count of 1 and the caller of [`cuCtxCreate_v4`] must call [`cuCtxDestroy_v2`] when done using the context. If a context is already current to the thread, it is supplanted by the newly created context
6756 /// and may be restored by a subsequent call to [`cuCtxPopCurrent_v2`].
6757 ///
6758 /// A regular CUDA context can be created by setting ctxCreateParams to NULL.
6759 ///
6760 /// A CUDA context can be created with execution affinity. The type and the amount of execution resource the context can use is
6761 /// limited by paramsArray and numExecAffinityParams in execAffinity. The paramsArray is an array of CUexecAffinityParam and the numExecAffinityParams describes the size of the paramsArray. If two CUexecAffinityParam in the array have the same type, the latter execution affinity parameter overrides the former execution affinity parameter.
6762 /// The supported execution affinity types are:
6763 ///
6764 /// * [`CUexecAffinityType_enum::CU_EXEC_AFFINITY_TYPE_SM_COUNT`] limits the portion of SMs that the context can use. The portion of SMs is specified as the number of SMs via CUexecAffinitySmCount. This limit will be internally rounded up to the next hardware-supported amount. Hence, it is imperative to query the actual
6765 /// execution affinity of the context via [`cuCtxGetExecAffinity`] after context creation. Currently, this attribute is only supported under Volta+ MPS.
6766 ///
6767 /// A CUDA context can be created in CIG(CUDA in Graphics) mode by setting cigParams. Data from graphics client is shared with CUDA via the sharedData in cigParams. Support for D3D12 graphics client can be determined using [`cuDeviceGetAttribute`] with [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_D3D12_CIG_SUPPORTED`]. sharedData is a ID3D12CommandQueue handle. Support for Vulkan graphics client can be determined using [`cuDeviceGetAttribute`] with [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_VULKAN_CIG_SUPPORTED`]. sharedData is a Nvidia specific data blob populated by calling vkGetExternalComputeQueueDataNV(). execAffinityParams and cigParams are mutually exclusive and cannot both be non-NULL. Setting both to non-NULL values will result in undefined behavior. If
6768 /// both execAffinityParams and cigParams are NULL, the context will be created as a regular CUDA context.
6769 ///
6770 /// The three LSBs of the flags parameter can be used to control how the OS thread, which owns the CUDA context at the time of an API call, interacts with
6771 /// the OS scheduler when waiting for results from the GPU. Only one of the scheduling flags can be set when creating a context.
6772 ///
6773 /// * [`CUctx_flags_enum::CU_CTX_SCHED_SPIN`]: Instruct CUDA to actively spin when waiting for results from the GPU. This can decrease latency when waiting for the GPU,
6774 /// but may lower the performance of CPU threads if they are performing work in parallel with the CUDA thread.
6775 ///
6776 /// * [`CUctx_flags_enum::CU_CTX_SCHED_YIELD`]: Instruct CUDA to yield its thread when waiting for results from the GPU. This can increase latency when waiting for the
6777 /// GPU, but can increase the performance of CPU threads performing work in parallel with the GPU.
6778 ///
6779 /// * [`CUctx_flags_enum::CU_CTX_SCHED_BLOCKING_SYNC`]: Instruct CUDA to block the CPU thread on a synchronization primitive when waiting for the GPU to finish work.
6780 ///
6781 /// * [CU_CTX_BLOCKING_SYNC](https://docs.nvidia.com/cuda/cuda-driver-api/types.html#group__CUDA__TYPES_1gg9f889e28a45a295b5c8ce13aa05f6cd4b5bf395cc60a8cbded4c329ae9430b91): Instruct CUDA to block the CPU thread on a synchronization primitive when waiting for the GPU to finish work.
6782 ///
6783 /// **Deprecated:** This flag was deprecated as of CUDA 4.0 and was replaced with [`CUctx_flags_enum::CU_CTX_SCHED_BLOCKING_SYNC`].
6784 ///
6785 /// * [`CUctx_flags_enum::CU_CTX_SCHED_AUTO`]: The default value if the flags parameter is zero, uses a heuristic based on the number of active CUDA contexts in the process C and the number of logical
6786 /// processors in the system P. If C > P, then CUDA will yield to other OS threads when waiting for the GPU ([`CUctx_flags_enum::CU_CTX_SCHED_YIELD`]), otherwise CUDA will not yield while waiting for results and actively spin on the processor ([`CUctx_flags_enum::CU_CTX_SCHED_SPIN`]). Additionally, on Tegra devices, [`CUctx_flags_enum::CU_CTX_SCHED_AUTO`] uses a heuristic based on the power profile of the platform and may choose [`CUctx_flags_enum::CU_CTX_SCHED_BLOCKING_SYNC`] for low-powered devices.
6787 ///
6788 /// * [`CUctx_flags_enum::CU_CTX_MAP_HOST`]: Instruct CUDA to support mapped pinned allocations. This flag must be set in order to allocate pinned host memory that is
6789 /// accessible to the GPU.
6790 ///
6791 /// * [`CUctx_flags_enum::CU_CTX_LMEM_RESIZE_TO_MAX`]: Instruct CUDA to not reduce local memory after resizing local memory for a kernel. This can prevent thrashing by local memory
6792 /// allocations when launching many kernels with high local memory usage at the cost of potentially increased memory usage.
6793 ///
6794 /// **Deprecated:** This flag is deprecated and the behavior enabled by this flag is now the default and cannot be disabled. Instead, the per-thread
6795 /// stack size can be controlled with [`cuCtxSetLimit`].
6796 ///
6797 /// * [`CUctx_flags_enum::CU_CTX_COREDUMP_ENABLE`]: If GPU coredumps have not been enabled globally with [`cuCoredumpSetAttributeGlobal`] or environment variables, this flag can be set during context creation to instruct CUDA to create a coredump if this context
6798 /// raises an exception during execution. These environment variables are described in the CUDA-GDB user guide under the "GPU
6799 /// core dump support" section. The initial attributes will be taken from the global attributes at the time of context creation.
6800 /// The other attributes that control coredump output can be modified by calling [`cuCoredumpSetAttribute`] from the created context after it becomes current. This flag is not supported when CUDA context is created in CIG(CUDA in
6801 /// Graphics) mode.
6802 ///
6803 /// * [`CUctx_flags_enum::CU_CTX_USER_COREDUMP_ENABLE`]: If user-triggered GPU coredumps have not been enabled globally with [`cuCoredumpSetAttributeGlobal`] or environment variables, this flag can be set during context creation to instruct CUDA to create a coredump if data is written
6804 /// to a certain pipe that is present in the OS space. These environment variables are described in the CUDA-GDB user guide under
6805 /// the "GPU core dump support" section. It is important to note that the pipe name `must` be set with [`cuCoredumpSetAttributeGlobal`] before creating the context if this flag is used. Setting this flag implies that [`CUctx_flags_enum::CU_CTX_COREDUMP_ENABLE`] is set. The initial attributes will be taken from the global attributes at the time of context creation. The other attributes
6806 /// that control coredump output can be modified by calling [`cuCoredumpSetAttribute`] from the created context after it becomes current. Setting this flag on any context creation is equivalent to setting the
6807 /// [`CUcoredumpSettings::CU_COREDUMP_ENABLE_USER_TRIGGER`] attribute to true globally. This flag is not supported when CUDA context is created in CIG(CUDA in Graphics) mode.
6808 ///
6809 /// * [`CUctx_flags_enum::CU_CTX_SYNC_MEMOPS`]: Ensures that synchronous memory operations initiated on this context will always synchronize. See further documentation
6810 /// in the section titled "API Synchronization behavior" to learn more about cases when synchronous memory operations can exhibit
6811 /// asynchronous behavior.
6812 ///
6813 /// Context creation will fail with [`cudaError_enum::CUDA_ERROR_UNKNOWN`] if the compute mode of the device is [`CUcomputemode_enum::CU_COMPUTEMODE_PROHIBITED`]. The function [`cuDeviceGetAttribute`] can be used with [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_COMPUTE_MODE`] to determine the compute mode of the device. The nvidia-smi tool can be used to set the compute mode for \* devices. Documentation
6814 /// for nvidia-smi can be obtained by passing a -h option to it.
6815 ///
6816 /// Context creation will fail with [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] if invalid parameter was passed by client to create the CUDA context.
6817 ///
6818 /// Context creation in CIG mode will fail with [`cudaError_enum::CUDA_ERROR_NOT_SUPPORTED`] if CIG is not supported by the device or the driver.
6819 ///
6820 /// Note:
6821 ///
6822 /// Note that this function may also return error codes from previous, asynchronous launches.
6823 ///
6824 /// **See also:**
6825 ///
6826 /// [`cuCtxDestroy_v2`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`], [`cuCtxSetCacheConfig`], [`cuCtxSetLimit`], [`cuCoredumpSetAttributeGlobal`], [`cuCoredumpSetAttribute`], [`cuCtxSynchronize`][`cuCtxGetExecAffinity`],.
6827 ///
6828 /// # Parameters
6829 ///
6830 /// - `pctx`: Returned context handle of the new context.
6831 /// - `ctxCreateParams`: Context creation parameters. Can be NULL to create a regular CUDA context. See [`CUctxCreateParams`] for details.
6832 /// - `flags`: Context creation flags.
6833 /// - `dev`: Device to create context on.
6834 pub fn cuCtxCreate_v4(
6835 pctx: *mut CUcontext,
6836 ctxCreateParams: *mut CUctxCreateParams,
6837 flags: ::core::ffi::c_uint,
6838 dev: CUdevice,
6839 ) -> CUresult;
6840}
6841unsafe extern "C" {
6842 /// Destroy a CUDA context.
6843 ///
6844 /// Destroys the CUDA context specified by ctx. The context ctx will be destroyed regardless of how many threads it is current to. It is the responsibility of the calling function to ensure
6845 /// that no API call issues using ctx while [`cuCtxDestroy_v2`] is executing.
6846 ///
6847 /// Destroys and cleans up all resources associated with the context. It is the caller's responsibility to ensure that the context
6848 /// or its resources are not accessed or passed in subsequent API calls and doing so will result in undefined behavior. These
6849 /// resources include CUDA types [`CUmodule`], [`CUfunction`], [`CUstream`], [`CUevent`], [`CUarray`], [`CUmipmappedArray`], [`CUtexObject`], [`CUsurfObject`], [`CUtexref`], [`CUsurfref`], [`CUgraphicsResource`], CUlinkState, [`CUexternalMemory`] and [`CUexternalSemaphore`]. These resources also include memory allocations by [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocManaged`] and [`cuMemAllocPitch_v2`].
6850 ///
6851 /// If ctx is current to the calling thread then ctx will also be popped from the current thread's context stack (as though [`cuCtxPopCurrent_v2`] were called). If ctx is current to other threads, then ctx will remain current to those threads, and attempting to access ctx from those threads will result in the error [`cudaError_enum::CUDA_ERROR_CONTEXT_IS_DESTROYED`].
6852 ///
6853 /// Note:
6854 ///
6855 /// [`cuCtxDestroy_v2`] will not destroy memory allocations by [`cuMemCreate`], [`cuMemAllocAsync`] and [`cuMemAllocFromPoolAsync`]. These memory allocations are not associated with any CUDA context and need to be destroyed explicitly.
6856 ///
6857 /// Note:
6858 ///
6859 /// Note that this function may also return error codes from previous, asynchronous launches.
6860 ///
6861 /// **See also:**
6862 ///
6863 /// [`cuCtxCreate_v4`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`], [`cuCtxSetCacheConfig`], [`cuCtxSetLimit`], [`cuCtxSynchronize`].
6864 ///
6865 /// # Parameters
6866 ///
6867 /// - `ctx`: Context to destroy.
6868 pub fn cuCtxDestroy_v2(ctx: CUcontext) -> CUresult;
6869}
6870unsafe extern "C" {
6871 /// Pushes a context on the current CPU thread.
6872 ///
6873 /// Pushes the given context ctx onto the CPU thread's stack of current contexts. The specified context becomes the CPU thread's current context, so all CUDA
6874 /// functions that operate on the current context are affected.
6875 ///
6876 /// The previous current context may be made current again by calling [`cuCtxDestroy_v2`] or [`cuCtxPopCurrent_v2`].
6877 ///
6878 /// Note:
6879 ///
6880 /// Note that this function may also return error codes from previous, asynchronous launches.
6881 ///
6882 /// **See also:**
6883 ///
6884 /// [`cuCtxCreate_v4`], [`cuCtxDestroy_v2`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPopCurrent_v2`], [`cuCtxSetCacheConfig`], [`cuCtxSetLimit`], [`cuCtxSynchronize`].
6885 ///
6886 /// # Parameters
6887 ///
6888 /// - `ctx`: Context to push.
6889 pub fn cuCtxPushCurrent_v2(ctx: CUcontext) -> CUresult;
6890}
6891unsafe extern "C" {
6892 /// Pops the current CUDA context from the current CPU thread.
6893 ///
6894 /// Pops the current CUDA context from the CPU thread and passes back the old context handle in \*pctx. That context may then be made current to a different CPU thread by calling [`cuCtxPushCurrent_v2`].
6895 ///
6896 /// If a context was current to the CPU thread before [`cuCtxCreate_v4`] or [`cuCtxPushCurrent_v2`] was called, this function makes that context current to the CPU thread again.
6897 ///
6898 /// Note:
6899 ///
6900 /// Note that this function may also return error codes from previous, asynchronous launches.
6901 ///
6902 /// **See also:**
6903 ///
6904 /// [`cuCtxCreate_v4`], [`cuCtxDestroy_v2`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPushCurrent_v2`], [`cuCtxSetCacheConfig`], [`cuCtxSetLimit`], [`cuCtxSynchronize`].
6905 ///
6906 /// # Parameters
6907 ///
6908 /// - `pctx`: Returned popped context handle.
6909 pub fn cuCtxPopCurrent_v2(pctx: *mut CUcontext) -> CUresult;
6910}
6911unsafe extern "C" {
6912 /// Binds the specified CUDA context to the calling CPU thread.
6913 ///
6914 /// Binds the specified CUDA context to the calling CPU thread. If ctx is NULL then the CUDA context previously bound to the calling CPU thread is unbound and [`cudaError_enum::CUDA_SUCCESS`] is returned.
6915 ///
6916 /// If there exists a CUDA context stack on the calling CPU thread, this will replace the top of that stack with ctx. If ctx is NULL then this will be equivalent to popping the top of the calling CPU thread's CUDA context stack (or a no-op if the
6917 /// calling CPU thread's CUDA context stack is empty).
6918 ///
6919 /// Note:
6920 ///
6921 /// Note that this function may also return error codes from previous, asynchronous launches.
6922 ///
6923 /// **See also:**
6924 ///
6925 /// [`cuCtxGetCurrent`], [`cuCtxCreate_v4`], [`cuCtxDestroy_v2`], [cudaSetDevice](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g159587909ffa0791bbe4b40187a4c6bb).
6926 ///
6927 /// # Parameters
6928 ///
6929 /// - `ctx`: Context to bind to the calling CPU thread.
6930 pub fn cuCtxSetCurrent(ctx: CUcontext) -> CUresult;
6931}
6932unsafe extern "C" {
6933 /// Returns the CUDA context bound to the calling CPU thread.
6934 ///
6935 /// Returns in \*pctx the CUDA context bound to the calling CPU thread. If no context is bound to the calling CPU thread then \*pctx is set to NULL and [`cudaError_enum::CUDA_SUCCESS`] is returned.
6936 ///
6937 /// Note:
6938 ///
6939 /// Note that this function may also return error codes from previous, asynchronous launches.
6940 ///
6941 /// **See also:**
6942 ///
6943 /// [`cuCtxSetCurrent`], [`cuCtxCreate_v4`], [`cuCtxDestroy_v2`], [cudaGetDevice](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g80861db2ce7c29b6e8055af8ae01bc78).
6944 ///
6945 /// # Parameters
6946 ///
6947 /// - `pctx`: Returned context handle.
6948 pub fn cuCtxGetCurrent(pctx: *mut CUcontext) -> CUresult;
6949}
6950unsafe extern "C" {
6951 /// Returns the device handle for the current context.
6952 ///
6953 /// Returns in \*device the handle of the current context's device.
6954 ///
6955 /// Note:
6956 ///
6957 /// Note that this function may also return error codes from previous, asynchronous launches.
6958 ///
6959 /// **See also:**
6960 ///
6961 /// [`cuCtxCreate_v4`], [`cuCtxDestroy_v2`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`], [`cuCtxSetCacheConfig`], [`cuCtxSetLimit`], [`cuCtxSynchronize`], [cudaGetDevice](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g80861db2ce7c29b6e8055af8ae01bc78).
6962 ///
6963 /// # Parameters
6964 ///
6965 /// - `device`: Returned device handle for the current context.
6966 pub fn cuCtxGetDevice(device: *mut CUdevice) -> CUresult;
6967}
6968unsafe extern "C" {
6969 /// Returns the device handle for the specified context.
6970 ///
6971 /// Returns in \*device the handle of the specified context's device. If the specified context is NULL, the API will return the current context's
6972 /// device.
6973 ///
6974 /// Note:
6975 ///
6976 /// Note that this function may also return error codes from previous, asynchronous launches.
6977 ///
6978 /// **See also:**
6979 ///
6980 /// [`cuCtxGetCurrent`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`].
6981 ///
6982 /// # Parameters
6983 ///
6984 /// - `device`: Returned device handle for the specified context.
6985 /// - `ctx`: Context for which to obtain the device.
6986 pub fn cuCtxGetDevice_v2(device: *mut CUdevice, ctx: CUcontext) -> CUresult;
6987}
6988unsafe extern "C" {
6989 /// Returns the flags for the current context.
6990 ///
6991 /// Returns in \*flags the flags of the current context. See [`cuCtxCreate_v4`] for flag values.
6992 ///
6993 /// Note:
6994 ///
6995 /// Note that this function may also return error codes from previous, asynchronous launches.
6996 ///
6997 /// **See also:**
6998 ///
6999 /// [`cuCtxCreate_v4`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetCurrent`], [`cuCtxGetDevice`], [`cuCtxGetLimit`], [`cuCtxGetSharedMemConfig`], [`cuCtxGetStreamPriorityRange`], [`cuCtxSetFlags`], [cudaGetDeviceFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1gf830794caf068b71638c6182bba8f77a).
7000 ///
7001 /// # Parameters
7002 ///
7003 /// - `flags`: Pointer to store flags of current context.
7004 pub fn cuCtxGetFlags(flags: *mut ::core::ffi::c_uint) -> CUresult;
7005}
7006unsafe extern "C" {
7007 /// Sets the flags for the current context.
7008 ///
7009 /// Sets the flags for the current context overwriting previously set ones. See [`cuDevicePrimaryCtxSetFlags_v2`] for flag values.
7010 ///
7011 /// Note:
7012 ///
7013 /// Note that this function may also return error codes from previous, asynchronous launches.
7014 ///
7015 /// **See also:**
7016 ///
7017 /// [`cuCtxCreate_v4`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetCurrent`], [`cuCtxGetDevice`], [`cuCtxGetLimit`], [`cuCtxGetSharedMemConfig`], [`cuCtxGetStreamPriorityRange`], [`cuCtxGetFlags`], [cudaGetDeviceFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1gf830794caf068b71638c6182bba8f77a), [`cuDevicePrimaryCtxSetFlags_v2`],.
7018 ///
7019 /// # Parameters
7020 ///
7021 /// - `flags`: Flags to set on the current context.
7022 pub fn cuCtxSetFlags(flags: ::core::ffi::c_uint) -> CUresult;
7023}
7024unsafe extern "C" {
7025 /// Returns the unique Id associated with the context supplied.
7026 ///
7027 /// Returns in ctxId the unique Id which is associated with a given context. The Id is unique for the life of the program for this instance of
7028 /// CUDA. If context is supplied as NULL and there is one current, the Id of the current context is returned.
7029 ///
7030 /// Note:
7031 ///
7032 /// Note that this function may also return error codes from previous, asynchronous launches.
7033 ///
7034 /// **See also:**
7035 ///
7036 /// [`cuCtxCreate_v4`], [`cuCtxDestroy_v2`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPushCurrent_v2`].
7037 ///
7038 /// # Parameters
7039 ///
7040 /// - `ctx`: Context for which to obtain the Id.
7041 /// - `ctxId`: Pointer to store the Id of the context.
7042 pub fn cuCtxGetId(ctx: CUcontext, ctxId: *mut ::core::ffi::c_ulonglong) -> CUresult;
7043}
7044unsafe extern "C" {
7045 /// Block for the current context's tasks to complete.
7046 ///
7047 /// Blocks until the current context has completed all preceding requested tasks. If the current context is the primary context,
7048 /// green contexts that have been created will also be synchronized. [`cuCtxSynchronize`] returns an error if one of the preceding tasks failed. If the context was created with the [`CUctx_flags_enum::CU_CTX_SCHED_BLOCKING_SYNC`] flag, the CPU thread will block until the GPU context has finished its work.
7049 ///
7050 /// Note:
7051 ///
7052 /// Note that this function may also return error codes from previous, asynchronous launches.
7053 ///
7054 /// **See also:**
7055 ///
7056 /// [`cuCtxCreate_v4`], [`cuCtxDestroy_v2`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`], [`cuCtxSetCacheConfig`], [`cuCtxSetLimit`], [cudaDeviceSynchronize](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g10e20b05a95f638a4071a655503df25d).
7057 pub fn cuCtxSynchronize() -> CUresult;
7058}
7059unsafe extern "C" {
7060 /// Block for the specified context's tasks to complete.
7061 ///
7062 /// Blocks until the specified context has completed all preceding requested tasks. If the specified context is the primary context,
7063 /// green contexts that have been created will also be synchronized. The API returns an error if one of the preceding tasks failed.
7064 ///
7065 /// If the context was created with the [`CUctx_flags_enum::CU_CTX_SCHED_BLOCKING_SYNC`] flag, the CPU thread will block until the GPU context has finished its work.
7066 ///
7067 /// If the specified context is NULL, the API will operate on the current context.
7068 ///
7069 /// Note:
7070 ///
7071 /// Note that this function may also return error codes from previous, asynchronous launches.
7072 ///
7073 /// **See also:**
7074 ///
7075 /// [`cuCtxGetCurrent`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`], [`cuGreenCtxCreate`], [`cuCtxFromGreenCtx`], [cudaDeviceSynchronize](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g10e20b05a95f638a4071a655503df25d).
7076 ///
7077 /// # Parameters
7078 ///
7079 /// - `ctx`: Context to synchronize.
7080 pub fn cuCtxSynchronize_v2(ctx: CUcontext) -> CUresult;
7081}
7082unsafe extern "C" {
7083 /// Set resource limits.
7084 ///
7085 /// Setting limit to value is a request by the application to update the current limit maintained by the context. The driver is free to modify the requested
7086 /// value to meet h/w requirements (this could be clamping to minimum or maximum values, rounding up to nearest element size,
7087 /// etc). The application can use [`cuCtxGetLimit`] to find out exactly what the limit has been set to.
7088 ///
7089 /// Setting each `CUlimit` has its own specific restrictions, so each is discussed here.
7090 ///
7091 /// * [`CUlimit_enum::CU_LIMIT_STACK_SIZE`] controls the stack size in bytes of each GPU thread. The driver automatically increases the per-thread stack size for each
7092 /// kernel launch as needed. This size isn't reset back to the original value after each launch. Setting this value will take
7093 /// effect immediately, and if necessary, the device will block until all preceding requested tasks are complete.
7094 ///
7095 /// * [`CUlimit_enum::CU_LIMIT_PRINTF_FIFO_SIZE`] controls the size in bytes of the FIFO used by the printf() device system call. Setting [`CUlimit_enum::CU_LIMIT_PRINTF_FIFO_SIZE`] must be performed before launching any kernel that uses the printf() device system call, otherwise [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] will be returned.
7096 ///
7097 /// * [`CUlimit_enum::CU_LIMIT_MALLOC_HEAP_SIZE`] controls the size in bytes of the heap used by the malloc() and free() device system calls. Setting [`CUlimit_enum::CU_LIMIT_MALLOC_HEAP_SIZE`] must be performed before launching any kernel that uses the malloc() or free() device system calls, otherwise [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] will be returned.
7098 ///
7099 /// * [`CUlimit_enum::CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH`] controls the maximum nesting depth of a grid at which a thread can safely call [cudaDeviceSynchronize()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g10e20b05a95f638a4071a655503df25d). Setting this limit must be performed before any launch of a kernel that uses the device runtime and calls [cudaDeviceSynchronize()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g10e20b05a95f638a4071a655503df25d) above the default sync depth, two levels of grids. Calls to [cudaDeviceSynchronize()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g10e20b05a95f638a4071a655503df25d) will fail with error code [cudaErrorSyncDepthExceeded](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038265dbf94c45903cd582cfc40f93a176a) if the limitation is violated. This limit can be set smaller than the default or up the maximum launch depth of 24. When
7100 /// setting this limit, keep in mind that additional levels of sync depth require the driver to reserve large amounts of device
7101 /// memory which can no longer be used for user allocations. If these reservations of device memory fail, [`cuCtxSetLimit`] will return [`cudaError_enum::CUDA_ERROR_OUT_OF_MEMORY`], and the limit can be reset to a lower value. This limit is only applicable to devices of compute capability < 9.0. Attempting
7102 /// to set this limit on devices of other compute capability versions will result in the error [`cudaError_enum::CUDA_ERROR_UNSUPPORTED_LIMIT`] being returned.
7103 ///
7104 /// * [`CUlimit_enum::CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT`] controls the maximum number of outstanding device runtime launches that can be made from the current context. A grid is outstanding
7105 /// from the point of launch up until the grid is known to have been completed. Device runtime launches which violate this limitation
7106 /// fail and return [cudaErrorLaunchPendingCountExceeded](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00382372902b9ffd65825d138e16125b1376) when [cudaGetLastError()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__ERROR.html#group__CUDART__ERROR_1g3529f94cb530a83a76613616782bd233) is called after launch. If more pending launches than the default (2048 launches) are needed for a module using the device
7107 /// runtime, this limit can be increased. Keep in mind that being able to sustain additional pending launches will require the
7108 /// driver to reserve larger amounts of device memory upfront which can no longer be used for allocations. If these reservations
7109 /// fail, [`cuCtxSetLimit`] will return [`cudaError_enum::CUDA_ERROR_OUT_OF_MEMORY`], and the limit can be reset to a lower value. This limit is only applicable to devices of compute capability 3.5 and higher.
7110 /// Attempting to set this limit on devices of compute capability less than 3.5 will result in the error [`cudaError_enum::CUDA_ERROR_UNSUPPORTED_LIMIT`] being returned.
7111 ///
7112 /// * [`CUlimit_enum::CU_LIMIT_MAX_L2_FETCH_GRANULARITY`] controls the L2 cache fetch granularity. Values can range from 0B to 128B. This is purely a performance hint and it can be
7113 /// ignored or clamped depending on the platform.
7114 ///
7115 /// * [`CUlimit_enum::CU_LIMIT_PERSISTING_L2_CACHE_SIZE`] controls size in bytes available for persisting L2 cache. This is purely a performance hint and it can be ignored or clamped
7116 /// depending on the platform.
7117 ///
7118 /// Note:
7119 ///
7120 /// Note that this function may also return error codes from previous, asynchronous launches.
7121 ///
7122 /// **See also:**
7123 ///
7124 /// [`cuCtxCreate_v4`], [`cuCtxDestroy_v2`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`], [`cuCtxSetCacheConfig`], [`cuCtxSynchronize`], [cudaDeviceSetLimit](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g05956f16eaa47ef3a4efee84563ccb7d).
7125 ///
7126 /// # Parameters
7127 ///
7128 /// - `limit`: Limit to set.
7129 /// - `value`: Size of limit.
7130 pub fn cuCtxSetLimit(limit: CUlimit, value: size_t) -> CUresult;
7131}
7132unsafe extern "C" {
7133 /// Returns resource limits.
7134 ///
7135 /// Returns in \*pvalue the current size of limit. The supported `CUlimit` values are:
7136 ///
7137 /// * [`CUlimit_enum::CU_LIMIT_STACK_SIZE`]: stack size in bytes of each GPU thread.
7138 /// * [`CUlimit_enum::CU_LIMIT_PRINTF_FIFO_SIZE`]: size in bytes of the FIFO used by the printf() device system call.
7139 /// * [`CUlimit_enum::CU_LIMIT_MALLOC_HEAP_SIZE`]: size in bytes of the heap used by the malloc() and free() device system calls.
7140 /// * [`CUlimit_enum::CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH`]: maximum grid depth at which a thread can issue the device runtime call [cudaDeviceSynchronize()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g10e20b05a95f638a4071a655503df25d) to wait on child grid launches to complete.
7141 /// * [`CUlimit_enum::CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT`]: maximum number of outstanding device runtime launches that can be made from this context.
7142 /// * [`CUlimit_enum::CU_LIMIT_MAX_L2_FETCH_GRANULARITY`]: L2 cache fetch granularity.
7143 /// * [`CUlimit_enum::CU_LIMIT_PERSISTING_L2_CACHE_SIZE`]: Persisting L2 cache size in bytes
7144 ///
7145 /// Note:
7146 ///
7147 /// Note that this function may also return error codes from previous, asynchronous launches.
7148 ///
7149 /// **See also:**
7150 ///
7151 /// [`cuCtxCreate_v4`], [`cuCtxDestroy_v2`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`], [`cuCtxSetCacheConfig`], [`cuCtxSetLimit`], [`cuCtxSynchronize`], [cudaDeviceGetLimit](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g720e159aeb125910c22aa20fe9611ec2).
7152 ///
7153 /// # Parameters
7154 ///
7155 /// - `pvalue`: Returned size of limit.
7156 /// - `limit`: Limit to query.
7157 pub fn cuCtxGetLimit(pvalue: *mut size_t, limit: CUlimit) -> CUresult;
7158}
7159unsafe extern "C" {
7160 /// Returns the preferred cache configuration for the current context.
7161 ///
7162 /// On devices where the L1 cache and shared memory use the same hardware resources, this function returns through pconfig the preferred cache configuration for the current context. This is only a preference. The driver will use the requested configuration
7163 /// if possible, but it is free to choose a different configuration if required to execute functions.
7164 ///
7165 /// This will return a pconfig of [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_NONE`] on devices where the size of the L1 cache and shared memory are fixed.
7166 ///
7167 /// The supported cache configurations are:
7168 ///
7169 /// * [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_NONE`]: no preference for shared memory or L1 (default)
7170 /// * [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_SHARED`]: prefer larger shared memory and smaller L1 cache
7171 /// * [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_L1`]: prefer larger L1 cache and smaller shared memory
7172 /// * [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_EQUAL`]: prefer equal sized L1 cache and shared memory
7173 ///
7174 /// Note:
7175 ///
7176 /// Note that this function may also return error codes from previous, asynchronous launches.
7177 ///
7178 /// **See also:**
7179 ///
7180 /// [`cuCtxCreate_v4`], [`cuCtxDestroy_v2`], [`cuCtxGetApiVersion`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`], [`cuCtxSetCacheConfig`], [`cuCtxSetLimit`], [`cuCtxSynchronize`], [`cuFuncSetCacheConfig`], [cudaDeviceGetCacheConfig](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1gd9bf5eae6d464de05aa3840df9f5deeb).
7181 ///
7182 /// # Parameters
7183 ///
7184 /// - `pconfig`: Returned cache configuration.
7185 pub fn cuCtxGetCacheConfig(pconfig: *mut CUfunc_cache) -> CUresult;
7186}
7187unsafe extern "C" {
7188 /// Sets the preferred cache configuration for the current context.
7189 ///
7190 /// On devices where the L1 cache and shared memory use the same hardware resources, this sets through config the preferred cache configuration for the current context. This is only a preference. The driver will use the requested configuration
7191 /// if possible, but it is free to choose a different configuration if required to execute the function. Any function preference
7192 /// set via [`cuFuncSetCacheConfig`] or [`cuKernelSetCacheConfig`] will be preferred over this context-wide setting. Setting the context-wide cache configuration to [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_NONE`] will cause subsequent kernel launches to prefer to not change the cache configuration unless required to launch the kernel.
7193 ///
7194 /// This setting does nothing on devices where the size of the L1 cache and shared memory are fixed.
7195 ///
7196 /// Launching a kernel with a different preference than the most recent preference setting may insert a device-side synchronization
7197 /// point.
7198 ///
7199 /// The supported cache configurations are:
7200 ///
7201 /// * [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_NONE`]: no preference for shared memory or L1 (default)
7202 /// * [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_SHARED`]: prefer larger shared memory and smaller L1 cache
7203 /// * [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_L1`]: prefer larger L1 cache and smaller shared memory
7204 /// * [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_EQUAL`]: prefer equal sized L1 cache and shared memory
7205 ///
7206 /// Note:
7207 ///
7208 /// Note that this function may also return error codes from previous, asynchronous launches.
7209 ///
7210 /// **See also:**
7211 ///
7212 /// [`cuCtxCreate_v4`], [`cuCtxDestroy_v2`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`], [`cuCtxSetLimit`], [`cuCtxSynchronize`], [`cuFuncSetCacheConfig`], [cudaDeviceSetCacheConfig](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g6c9cc78ca80490386cf593b4baa35a15), [`cuKernelSetCacheConfig`].
7213 ///
7214 /// # Parameters
7215 ///
7216 /// - `config`: Requested cache configuration.
7217 pub fn cuCtxSetCacheConfig(config: CUfunc_cache) -> CUresult;
7218}
7219unsafe extern "C" {
7220 /// Gets the context's API version.
7221 ///
7222 /// Returns a version number in version corresponding to the capabilities of the context (e.g. 3010 or 3020), which library developers can use to direct callers
7223 /// to a specific API version. If ctx is NULL, returns the API version used to create the currently bound context.
7224 ///
7225 /// Note that new API versions are only introduced when context capabilities are changed that break binary compatibility, so the
7226 /// API version and driver version may be different. For example, it is valid for the API version to be 3020 while the driver
7227 /// version is 4020.
7228 ///
7229 /// Note:
7230 ///
7231 /// Note that this function may also return error codes from previous, asynchronous launches.
7232 ///
7233 /// **See also:**
7234 ///
7235 /// [`cuCtxCreate_v4`], [`cuCtxDestroy_v2`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`], [`cuCtxSetCacheConfig`], [`cuCtxSetLimit`], [`cuCtxSynchronize`].
7236 ///
7237 /// # Parameters
7238 ///
7239 /// - `ctx`: Context to check.
7240 /// - `version`: Pointer to version.
7241 pub fn cuCtxGetApiVersion(
7242 ctx: CUcontext,
7243 version: *mut ::core::ffi::c_uint,
7244 ) -> CUresult;
7245}
7246unsafe extern "C" {
7247 /// Returns numerical values that correspond to the least and greatest stream priorities.
7248 ///
7249 /// Returns in \*leastPriority and \*greatestPriority the numerical values that correspond to the least and greatest stream priorities respectively. Stream priorities follow a
7250 /// convention where lower numbers imply greater priorities. The range of meaningful stream priorities is given by \[\*greatestPriority, \*leastPriority\]. If the user attempts to create a stream with a priority value that is outside the meaningful range as specified by this
7251 /// API, the priority is automatically clamped down or up to either \*leastPriority or \*greatestPriority respectively. See [`cuStreamCreateWithPriority`] for details on creating a priority stream. A NULL may be passed in for \*leastPriority or \*greatestPriority if the value is not desired.
7252 ///
7253 /// This function will return '0' in both \*leastPriority and \*greatestPriority if the current context's device does not support stream priorities (see [`cuDeviceGetAttribute`]).
7254 ///
7255 /// Note:
7256 ///
7257 /// Note that this function may also return error codes from previous, asynchronous launches.
7258 ///
7259 /// **See also:**
7260 ///
7261 /// [`cuStreamCreateWithPriority`], [`cuStreamGetPriority`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxSetLimit`], [`cuCtxSynchronize`], [cudaDeviceGetStreamPriorityRange](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1gfdb79818f7c0ee7bc585648c91770275).
7262 ///
7263 /// # Parameters
7264 ///
7265 /// - `leastPriority`: Pointer to an int in which the numerical value for least stream priority is returned.
7266 /// - `greatestPriority`: Pointer to an int in which the numerical value for greatest stream priority is returned.
7267 pub fn cuCtxGetStreamPriorityRange(
7268 leastPriority: *mut ::core::ffi::c_int,
7269 greatestPriority: *mut ::core::ffi::c_int,
7270 ) -> CUresult;
7271}
7272unsafe extern "C" {
7273 /// Resets all persisting lines in cache to normal status.
7274 ///
7275 /// [`cuCtxResetPersistingL2Cache`] Resets all persisting lines in cache to normal status. Takes effect on function return.
7276 ///
7277 /// Note:
7278 ///
7279 /// Note that this function may also return error codes from previous, asynchronous launches.
7280 ///
7281 /// **See also:**
7282 ///
7283 /// [`CUaccessPolicyWindow`].
7284 pub fn cuCtxResetPersistingL2Cache() -> CUresult;
7285}
7286unsafe extern "C" {
7287 /// Returns the execution affinity setting for the current context.
7288 ///
7289 /// Returns in \*pExecAffinity the current value of type. The supported `CUexecAffinityType` values are:
7290 ///
7291 /// * [`CUexecAffinityType_enum::CU_EXEC_AFFINITY_TYPE_SM_COUNT`]: number of SMs the context is limited to use.
7292 ///
7293 /// Note:
7294 ///
7295 /// Note that this function may also return error codes from previous, asynchronous launches.
7296 ///
7297 /// **See also:**
7298 ///
7299 /// [`CUexecAffinityParam`].
7300 ///
7301 /// # Parameters
7302 ///
7303 /// - `pExecAffinity`: Returned execution affinity.
7304 pub fn cuCtxGetExecAffinity(
7305 pExecAffinity: *mut CUexecAffinityParam,
7306 type_: CUexecAffinityType,
7307 ) -> CUresult;
7308}
7309unsafe extern "C" {
7310 /// Records an event.
7311 ///
7312 /// Captures in hEvent all the activities of the context hCtx at the time of this call. hEvent and hCtx must be from the same CUDA context, otherwise [`cudaError_enum::CUDA_ERROR_INVALID_HANDLE`] will be returned. Calls such as [`cuEventQuery`] or [`cuCtxWaitEvent`] will then examine or wait for completion of the work that was captured. Uses of hCtx after this call do not modify hEvent. If the context passed to hCtx is the primary context, hEvent will capture all the activities of the primary context and its green contexts. If the context passed to hCtx is a context converted from green context via [`cuCtxFromGreenCtx`], hEvent will capture only the activities of the green context.
7313 ///
7314 /// Note:
7315 ///
7316 /// The API will return [`cudaError_enum::CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED`] if the specified context hCtx has a stream in the capture mode. In such a case, the call will invalidate all the conflicting captures.
7317 ///
7318 /// **See also:**
7319 ///
7320 /// [`cuCtxWaitEvent`], [`cuGreenCtxRecordEvent`], [`cuGreenCtxWaitEvent`], [`cuEventRecord`].
7321 ///
7322 /// # Parameters
7323 ///
7324 /// - `hCtx`: Context to record event for.
7325 /// - `hEvent`: Event to record.
7326 pub fn cuCtxRecordEvent(hCtx: CUcontext, hEvent: CUevent) -> CUresult;
7327}
7328unsafe extern "C" {
7329 /// Make a context wait on an event.
7330 ///
7331 /// Makes all future work submitted to context hCtx wait for all work captured in hEvent. The synchronization will be performed on the device and will not block the calling CPU thread. See [`cuCtxRecordEvent`] for details on what is captured by an event. If the context passed to hCtx is the primary context, the primary context and its green contexts will wait for hEvent. If the context passed to hCtx is a context converted from green context via [`cuCtxFromGreenCtx`], the green context will wait for hEvent.
7332 ///
7333 /// Note:
7334 ///
7335 /// * hEvent may be from a different context or device than hCtx.
7336 /// * The API will return [`cudaError_enum::CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED`] and invalidate the capture if the specified event hEvent is part of an ongoing capture sequence or if the specified context hCtx has a stream in the capture mode.
7337 ///
7338 /// **See also:**
7339 ///
7340 /// [`cuCtxRecordEvent`], [`cuGreenCtxRecordEvent`], [`cuGreenCtxWaitEvent`], [`cuStreamWaitEvent`].
7341 ///
7342 /// # Parameters
7343 ///
7344 /// - `hCtx`: Context to wait.
7345 /// - `hEvent`: Event to wait on.
7346 pub fn cuCtxWaitEvent(hCtx: CUcontext, hEvent: CUevent) -> CUresult;
7347}
7348unsafe extern "C" {
7349 /// Increment a context's usage-count.
7350 ///
7351 /// Note that
7352 ///
7353 /// Increments the usage count of the context and passes back a context handle in \*pctx that must be passed to [`cuCtxDetach`] when the application is done with the context. [`cuCtxAttach`] fails if there is no context current to the thread.
7354 ///
7355 /// Currently, the flags parameter must be 0.
7356 ///
7357 /// Note:
7358 ///
7359 /// Note that this function may also return error codes from previous, asynchronous launches.
7360 ///
7361 /// **See also:**
7362 ///
7363 /// [`cuCtxCreate_v4`], [`cuCtxDestroy_v2`], [`cuCtxDetach`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`], [`cuCtxSetCacheConfig`], [`cuCtxSetLimit`], [`cuCtxSynchronize`].
7364 ///
7365 /// # Parameters
7366 ///
7367 /// - `pctx`: Returned context handle of the current context.
7368 /// - `flags`: Context attach flags (must be 0).
7369 #[deprecated]
7370 pub fn cuCtxAttach(pctx: *mut CUcontext, flags: ::core::ffi::c_uint) -> CUresult;
7371}
7372unsafe extern "C" {
7373 /// Decrement a context's usage-count.
7374 ///
7375 /// Note that
7376 ///
7377 /// Decrements the usage count of the context ctx, and destroys the context if the usage count goes to 0. The context must be a handle that was passed back by [`cuCtxCreate_v4`] or [`cuCtxAttach`], and must be current to the calling thread.
7378 ///
7379 /// Note:
7380 ///
7381 /// Note that this function may also return error codes from previous, asynchronous launches.
7382 ///
7383 /// **See also:**
7384 ///
7385 /// [`cuCtxCreate_v4`], [`cuCtxDestroy_v2`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`], [`cuCtxSetCacheConfig`], [`cuCtxSetLimit`], [`cuCtxSynchronize`].
7386 ///
7387 /// # Parameters
7388 ///
7389 /// - `ctx`: Context to destroy.
7390 #[deprecated]
7391 pub fn cuCtxDetach(ctx: CUcontext) -> CUresult;
7392}
7393unsafe extern "C" {
7394 /// Returns the current shared memory configuration for the current context.
7395 ///
7396 /// pConfig
7397 ///
7398 /// [`cuCtxSetSharedMemConfig`]
7399 ///
7400 /// [`cuCtxGetSharedMemConfig`]
7401 ///
7402 /// The returned bank configurations can be either:
7403 ///
7404 /// * [`CUsharedconfig_enum::CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE`]: shared memory bank width is four bytes.
7405 /// * [`CUsharedconfig_enum::CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE`]: shared memory bank width will eight bytes.
7406 ///
7407 /// Note:
7408 ///
7409 /// Note that this function may also return error codes from previous, asynchronous launches.
7410 ///
7411 /// **See also:**
7412 ///
7413 /// [`cuCtxCreate_v4`], [`cuCtxDestroy_v2`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`], [`cuCtxSetLimit`], [`cuCtxSynchronize`], [`cuCtxGetSharedMemConfig`], [`cuFuncSetCacheConfig`], [cudaDeviceGetSharedMemConfig](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE__DEPRECATED.html#group__CUDART__DEVICE__DEPRECATED_1g542246258996a39a3ce2bc311bbb2421).
7414 ///
7415 /// # Parameters
7416 ///
7417 /// - `pConfig`: returned shared memory configuration.
7418 #[deprecated]
7419 pub fn cuCtxGetSharedMemConfig(pConfig: *mut CUsharedconfig) -> CUresult;
7420}
7421unsafe extern "C" {
7422 /// Sets the shared memory configuration for the current context.
7423 ///
7424 /// Changed the shared memory configuration between launches may insert a device side synchronization point between those launches.
7425 ///
7426 /// Changing the shared memory bank size will not increase shared memory usage or affect occupancy of kernels, but may have major
7427 /// effects on performance. Larger bank sizes will allow for greater potential bandwidth to shared memory, but will change what
7428 /// kinds of accesses to shared memory will result in bank conflicts.
7429 ///
7430 /// This function will do nothing on devices with fixed shared memory bank size.
7431 ///
7432 /// The supported bank configurations are:
7433 ///
7434 /// * [`CUsharedconfig_enum::CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE`]: set bank width to the default initial setting (currently, four bytes).
7435 /// * [`CUsharedconfig_enum::CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE`]: set shared memory bank width to be natively four bytes.
7436 /// * [`CUsharedconfig_enum::CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE`]: set shared memory bank width to be natively eight bytes.
7437 ///
7438 /// Note:
7439 ///
7440 /// Note that this function may also return error codes from previous, asynchronous launches.
7441 ///
7442 /// **See also:**
7443 ///
7444 /// [`cuCtxCreate_v4`], [`cuCtxDestroy_v2`], [`cuCtxGetApiVersion`], [`cuCtxGetCacheConfig`], [`cuCtxGetDevice`], [`cuCtxGetFlags`], [`cuCtxGetLimit`], [`cuCtxPopCurrent_v2`], [`cuCtxPushCurrent_v2`], [`cuCtxSetLimit`], [`cuCtxSynchronize`], [`cuCtxGetSharedMemConfig`], [`cuFuncSetCacheConfig`], [cudaDeviceSetSharedMemConfig](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE__DEPRECATED.html#group__CUDART__DEVICE__DEPRECATED_1g76cb4f94c7af96c1247dfc7f105eabae).
7445 ///
7446 /// # Parameters
7447 ///
7448 /// - `config`: requested shared memory configuration.
7449 #[deprecated]
7450 pub fn cuCtxSetSharedMemConfig(config: CUsharedconfig) -> CUresult;
7451}
7452unsafe extern "C" {
7453 /// Loads a compute module.
7454 ///
7455 /// Takes a filename fname and loads the corresponding module module into the current context. The CUDA driver API does not attempt to lazily allocate the resources needed by a module; if the
7456 /// memory for functions and data (constant and global) needed by the module cannot be allocated, [`cuModuleLoad`] fails. The file should be a cubin file as output by **nvcc**, or a PTX file either as output by **nvcc** or handwritten, or a fatbin file as output by **nvcc** from toolchain 4.0 or later, or a Tile IR file.
7457 ///
7458 /// Note:
7459 ///
7460 /// Note that this function may also return error codes from previous, asynchronous launches.
7461 ///
7462 /// **See also:**
7463 ///
7464 /// [`cuModuleGetFunction`], [`cuModuleGetGlobal_v2`], [`cuModuleGetTexRef`], [`cuModuleLoadData`], [`cuModuleLoadDataEx`], [`cuModuleLoadFatBinary`], [`cuModuleUnload`].
7465 ///
7466 /// # Parameters
7467 ///
7468 /// - `module`: Returned module.
7469 /// - `fname`: Filename of module to load.
7470 pub fn cuModuleLoad(
7471 module: *mut CUmodule,
7472 fname: *const ::core::ffi::c_char,
7473 ) -> CUresult;
7474}
7475unsafe extern "C" {
7476 /// Load a module's data.
7477 ///
7478 /// Takes a pointer image and loads the corresponding module module into the current context. The image may be a cubin or fatbin as output by **nvcc**, or a NULL-terminated PTX, either as output by **nvcc** or hand-written, or Tile IR data.
7479 ///
7480 /// Note:
7481 ///
7482 /// Note that this function may also return error codes from previous, asynchronous launches.
7483 ///
7484 /// **See also:**
7485 ///
7486 /// [`cuModuleGetFunction`], [`cuModuleGetGlobal_v2`], [`cuModuleGetTexRef`], [`cuModuleLoad`], [`cuModuleLoadDataEx`], [`cuModuleLoadFatBinary`], [`cuModuleUnload`].
7487 ///
7488 /// # Parameters
7489 ///
7490 /// - `module`: Returned module.
7491 /// - `image`: Module data to load.
7492 pub fn cuModuleLoadData(
7493 module: *mut CUmodule,
7494 image: *const ::core::ffi::c_void,
7495 ) -> CUresult;
7496}
7497unsafe extern "C" {
7498 /// Load a module's data with options.
7499 ///
7500 /// Takes a pointer image and loads the corresponding module module into the current context. The image may be a cubin or fatbin as output by **nvcc**, or a NULL-terminated PTX, either as output by **nvcc** or hand-written, or Tile IR data.
7501 ///
7502 /// Note:
7503 ///
7504 /// Note that this function may also return error codes from previous, asynchronous launches.
7505 ///
7506 /// **See also:**
7507 ///
7508 /// [`cuModuleGetFunction`], [`cuModuleGetGlobal_v2`], [`cuModuleGetTexRef`], [`cuModuleLoad`], [`cuModuleLoadData`], [`cuModuleLoadFatBinary`], [`cuModuleUnload`].
7509 ///
7510 /// # Parameters
7511 ///
7512 /// - `module`: Returned module.
7513 /// - `image`: Module data to load.
7514 /// - `numOptions`: Number of options.
7515 /// - `options`: Options for JIT.
7516 /// - `optionValues`: Option values for JIT.
7517 pub fn cuModuleLoadDataEx(
7518 module: *mut CUmodule,
7519 image: *const ::core::ffi::c_void,
7520 numOptions: ::core::ffi::c_uint,
7521 options: *mut CUjit_option,
7522 optionValues: *mut *mut ::core::ffi::c_void,
7523 ) -> CUresult;
7524}
7525unsafe extern "C" {
7526 /// Load a module's data.
7527 ///
7528 /// Takes a pointer fatCubin and loads the corresponding module module into the current context. The pointer represents a fat binary object, which is a collection of different cubin and/or PTX
7529 /// files, all representing the same device code, but compiled and optimized for different architectures.
7530 ///
7531 /// Prior to CUDA 4.0, there was no documented API for constructing and using fat binary objects by programmers. Starting with
7532 /// CUDA 4.0, fat binary objects can be constructed by providing the -fatbin option to **nvcc**. More information can be found in the **nvcc** document.
7533 ///
7534 /// Note:
7535 ///
7536 /// Note that this function may also return error codes from previous, asynchronous launches.
7537 ///
7538 /// **See also:**
7539 ///
7540 /// [`cuModuleGetFunction`], [`cuModuleGetGlobal_v2`], [`cuModuleGetTexRef`], [`cuModuleLoad`], [`cuModuleLoadData`], [`cuModuleLoadDataEx`], [`cuModuleUnload`].
7541 ///
7542 /// # Parameters
7543 ///
7544 /// - `module`: Returned module.
7545 /// - `fatCubin`: Fat binary to load.
7546 pub fn cuModuleLoadFatBinary(
7547 module: *mut CUmodule,
7548 fatCubin: *const ::core::ffi::c_void,
7549 ) -> CUresult;
7550}
7551unsafe extern "C" {
7552 /// Unloads a module.
7553 ///
7554 /// Unloads a module hmod from the current context. Attempting to unload a module which was obtained from the Library Management API such as [`cuLibraryGetModule`] will return [`cudaError_enum::CUDA_ERROR_NOT_PERMITTED`].
7555 ///
7556 /// Note:
7557 ///
7558 /// * Note that this function may also return error codes from previous, asynchronous launches.
7559 /// * Use of the handle after this call is undefined behavior.
7560 ///
7561 /// **See also:**
7562 ///
7563 /// [`cuModuleGetFunction`], [`cuModuleGetGlobal_v2`], [`cuModuleGetTexRef`], [`cuModuleLoad`], [`cuModuleLoadData`], [`cuModuleLoadDataEx`], [`cuModuleLoadFatBinary`].
7564 ///
7565 /// # Parameters
7566 ///
7567 /// - `hmod`: Module to unload.
7568 pub fn cuModuleUnload(hmod: CUmodule) -> CUresult;
7569}
7570/// CUDA Lazy Loading status.
7571#[repr(u32)]
7572#[derive(
7573 Debug,
7574 Copy,
7575 Clone,
7576 Hash,
7577 PartialOrd,
7578 Ord,
7579 PartialEq,
7580 Eq,
7581 TryFromPrimitive,
7582 IntoPrimitive,
7583)]
7584pub enum CUmoduleLoadingMode_enum {
7585 /// Lazy Kernel Loading is not enabled.
7586 CU_MODULE_EAGER_LOADING = 1,
7587 /// Lazy Kernel Loading is enabled.
7588 CU_MODULE_LAZY_LOADING = 2,
7589}
7590pub use self::CUmoduleLoadingMode_enum as CUmoduleLoadingMode;
7591unsafe extern "C" {
7592 /// Query lazy loading mode.
7593 ///
7594 /// Returns lazy loading mode Module loading mode is controlled by CUDA_MODULE_LOADING env variable
7595 ///
7596 /// Note:
7597 ///
7598 /// Note that this function may also return error codes from previous, asynchronous launches.
7599 ///
7600 /// **See also:**
7601 ///
7602 /// [`cuModuleLoad`],.
7603 ///
7604 /// # Parameters
7605 ///
7606 /// - `mode`: Returns the lazy loading mode.
7607 pub fn cuModuleGetLoadingMode(mode: *mut CUmoduleLoadingMode) -> CUresult;
7608}
7609unsafe extern "C" {
7610 /// Returns a function handle.
7611 ///
7612 /// Returns in \*hfunc the handle of the function of name name located in module hmod. If no function of that name exists, [`cuModuleGetFunction`] returns [`cudaError_enum::CUDA_ERROR_NOT_FOUND`].
7613 ///
7614 /// Note:
7615 ///
7616 /// Note that this function may also return error codes from previous, asynchronous launches.
7617 ///
7618 /// **See also:**
7619 ///
7620 /// [`cuModuleGetGlobal_v2`], [`cuModuleGetTexRef`], [`cuModuleLoad`], [`cuModuleLoadData`], [`cuModuleLoadDataEx`], [`cuModuleLoadFatBinary`], [`cuModuleUnload`].
7621 ///
7622 /// # Parameters
7623 ///
7624 /// - `hfunc`: Returned function handle.
7625 /// - `hmod`: Module to retrieve function from.
7626 /// - `name`: Name of function to retrieve.
7627 pub fn cuModuleGetFunction(
7628 hfunc: *mut CUfunction,
7629 hmod: CUmodule,
7630 name: *const ::core::ffi::c_char,
7631 ) -> CUresult;
7632}
7633unsafe extern "C" {
7634 /// Returns the number of functions within a module.
7635 ///
7636 /// Returns in count the number of functions in mod.
7637 ///
7638 /// # Parameters
7639 ///
7640 /// - `count`: Number of functions found within the module.
7641 pub fn cuModuleGetFunctionCount(
7642 count: *mut ::core::ffi::c_uint,
7643 mod_: CUmodule,
7644 ) -> CUresult;
7645}
7646unsafe extern "C" {
7647 /// Returns the function handles within a module.
7648 ///
7649 /// Returns in functions a maximum number of numFunctions function handles within mod. When function loading mode is set to LAZY the function retrieved may be partially loaded. The loading state of a function
7650 /// can be queried using cuFunctionIsLoaded. CUDA APIs may load the function automatically when called with partially loaded function
7651 /// handle which may incur additional latency. Alternatively, cuFunctionLoad can be used to explicitly load a function. The returned
7652 /// function handles become invalid when the module is unloaded.
7653 ///
7654 /// **See also:**
7655 ///
7656 /// [`cuModuleGetFunction`], [`cuModuleGetFunctionCount`], [`cuFuncIsLoaded`], [`cuFuncLoad`].
7657 ///
7658 /// # Parameters
7659 ///
7660 /// - `functions`: Buffer where the function handles are returned to.
7661 /// - `numFunctions`: Maximum number of function handles may be returned to the buffer.
7662 pub fn cuModuleEnumerateFunctions(
7663 functions: *mut CUfunction,
7664 numFunctions: ::core::ffi::c_uint,
7665 mod_: CUmodule,
7666 ) -> CUresult;
7667}
7668unsafe extern "C" {
7669 /// Returns a global pointer from a module.
7670 ///
7671 /// Returns in \*dptr and \*bytes the base pointer and size of the global of name name located in module hmod. If no variable of that name exists, [`cuModuleGetGlobal_v2`] returns [`cudaError_enum::CUDA_ERROR_NOT_FOUND`]. One of the parameters dptr or bytes (not both) can be NULL in which case it is ignored.
7672 ///
7673 /// Note:
7674 ///
7675 /// Note that this function may also return error codes from previous, asynchronous launches.
7676 ///
7677 /// **See also:**
7678 ///
7679 /// [`cuModuleGetFunction`], [`cuModuleGetTexRef`], [`cuModuleLoad`], [`cuModuleLoadData`], [`cuModuleLoadDataEx`], [`cuModuleLoadFatBinary`], [`cuModuleUnload`], [cudaGetSymbolAddress](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g3a0f010e70a3343db18227cec9615177), [cudaGetSymbolSize](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g0561c8ffee270bff0bbb7deb81ad865c).
7680 ///
7681 /// # Parameters
7682 ///
7683 /// - `dptr`: Returned global device pointer.
7684 /// - `bytes`: Returned global size in bytes.
7685 /// - `hmod`: Module to retrieve global from.
7686 /// - `name`: Name of global to retrieve.
7687 pub fn cuModuleGetGlobal_v2(
7688 dptr: *mut CUdeviceptr,
7689 bytes: *mut size_t,
7690 hmod: CUmodule,
7691 name: *const ::core::ffi::c_char,
7692 ) -> CUresult;
7693}
7694unsafe extern "C" {
7695 /// Creates a pending JIT linker invocation.
7696 ///
7697 /// If the call is successful, the caller owns the returned CUlinkState, which should eventually be destroyed with [`cuLinkDestroy`]. The device code machine size (32 or 64 bit) will match the calling application.
7698 ///
7699 /// Both linker and compiler options may be specified. Compiler options will be applied to inputs to this linker action which
7700 /// must be compiled from PTX. The options [`CUjit_option_enum::CU_JIT_WALL_TIME`], [`CUjit_option_enum::CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES`], and [`CUjit_option_enum::CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES`] will accumulate data until the CUlinkState is destroyed.
7701 ///
7702 /// The data passed in via [`cuLinkAddData_v2`] and [`cuLinkAddFile_v2`] will be treated as relocatable (-rdc=true to nvcc) when linking the final cubin during [`cuLinkComplete`] and will have similar consequences as offline relocatable device code linking.
7703 ///
7704 /// optionValues must remain valid for the life of the CUlinkState if output options are used. No other references to inputs are maintained
7705 /// after this call returns.
7706 ///
7707 /// Note:
7708 ///
7709 /// For LTO-IR input, only LTO-IR compiled with toolkits prior to CUDA 12.0 will be accepted
7710 ///
7711 /// Note:
7712 ///
7713 /// Note that this function may also return error codes from previous, asynchronous launches.
7714 ///
7715 /// **See also:**
7716 ///
7717 /// [`cuLinkAddData_v2`], [`cuLinkAddFile_v2`], [`cuLinkComplete`], [`cuLinkDestroy`].
7718 ///
7719 /// # Parameters
7720 ///
7721 /// - `numOptions`: Size of options arrays.
7722 /// - `options`: Array of linker and compiler options.
7723 /// - `optionValues`: Array of option values, each cast to void \*.
7724 /// - `stateOut`: On success, this will contain a CUlinkState to specify and complete this action.
7725 pub fn cuLinkCreate_v2(
7726 numOptions: ::core::ffi::c_uint,
7727 options: *mut CUjit_option,
7728 optionValues: *mut *mut ::core::ffi::c_void,
7729 stateOut: *mut CUlinkState,
7730 ) -> CUresult;
7731}
7732unsafe extern "C" {
7733 /// Add an input to a pending linker invocation.
7734 ///
7735 /// Ownership of data is retained by the caller. No reference is retained to any inputs after this call returns.
7736 ///
7737 /// This method accepts only compiler options, which are used if the data must be compiled from PTX, and does not accept any of
7738 /// [`CUjit_option_enum::CU_JIT_WALL_TIME`], [`CUjit_option_enum::CU_JIT_INFO_LOG_BUFFER`], [`CUjit_option_enum::CU_JIT_ERROR_LOG_BUFFER`], [`CUjit_option_enum::CU_JIT_TARGET_FROM_CUCONTEXT`], or [`CUjit_option_enum::CU_JIT_TARGET`].
7739 ///
7740 /// Note:
7741 ///
7742 /// For LTO-IR input, only LTO-IR compiled with toolkits prior to CUDA 12.0 will be accepted
7743 ///
7744 /// **See also:**
7745 ///
7746 /// [`cuLinkCreate_v2`], [`cuLinkAddFile_v2`], [`cuLinkComplete`], [`cuLinkDestroy`].
7747 ///
7748 /// # Parameters
7749 ///
7750 /// - `state`: A pending linker action.
7751 /// - `data`: The input data. PTX must be NULL-terminated.
7752 /// - `size`: The length of the input data.
7753 /// - `name`: An optional name for this input in log messages.
7754 /// - `numOptions`: Size of options.
7755 /// - `options`: Options to be applied only for this input (overrides options from [`cuLinkCreate_v2`]).
7756 /// - `optionValues`: Array of option values, each cast to void \*.
7757 pub fn cuLinkAddData_v2(
7758 state: CUlinkState,
7759 type_: CUjitInputType,
7760 data: *mut ::core::ffi::c_void,
7761 size: size_t,
7762 name: *const ::core::ffi::c_char,
7763 numOptions: ::core::ffi::c_uint,
7764 options: *mut CUjit_option,
7765 optionValues: *mut *mut ::core::ffi::c_void,
7766 ) -> CUresult;
7767}
7768unsafe extern "C" {
7769 /// Add a file input to a pending linker invocation.
7770 ///
7771 /// No reference is retained to any inputs after this call returns.
7772 ///
7773 /// This method accepts only compiler options, which are used if the input must be compiled from PTX, and does not accept any
7774 /// of [`CUjit_option_enum::CU_JIT_WALL_TIME`], [`CUjit_option_enum::CU_JIT_INFO_LOG_BUFFER`], [`CUjit_option_enum::CU_JIT_ERROR_LOG_BUFFER`], [`CUjit_option_enum::CU_JIT_TARGET_FROM_CUCONTEXT`], or [`CUjit_option_enum::CU_JIT_TARGET`].
7775 ///
7776 /// This method is equivalent to invoking [`cuLinkAddData_v2`] on the contents of the file.
7777 ///
7778 /// Note:
7779 ///
7780 /// For LTO-IR input, only LTO-IR compiled with toolkits prior to CUDA 12.0 will be accepted
7781 ///
7782 /// **See also:**
7783 ///
7784 /// [`cuLinkCreate_v2`], [`cuLinkAddData_v2`], [`cuLinkComplete`], [`cuLinkDestroy`].
7785 ///
7786 /// # Parameters
7787 ///
7788 /// - `state`: A pending linker action.
7789 /// - `path`: Path to the input file.
7790 /// - `numOptions`: Size of options.
7791 /// - `options`: Options to be applied only for this input (overrides options from [`cuLinkCreate_v2`]).
7792 /// - `optionValues`: Array of option values, each cast to void \*.
7793 pub fn cuLinkAddFile_v2(
7794 state: CUlinkState,
7795 type_: CUjitInputType,
7796 path: *const ::core::ffi::c_char,
7797 numOptions: ::core::ffi::c_uint,
7798 options: *mut CUjit_option,
7799 optionValues: *mut *mut ::core::ffi::c_void,
7800 ) -> CUresult;
7801}
7802unsafe extern "C" {
7803 /// Complete a pending linker invocation.
7804 ///
7805 /// Completes the pending linker action and returns the cubin image for the linked device code, which can be used with [`cuModuleLoadData`]. The cubin is owned by state, so it should be loaded before state is destroyed via [`cuLinkDestroy`]. This call does not destroy state.
7806 ///
7807 /// **See also:**
7808 ///
7809 /// [`cuLinkCreate_v2`], [`cuLinkAddData_v2`], [`cuLinkAddFile_v2`], [`cuLinkDestroy`], [`cuModuleLoadData`].
7810 ///
7811 /// # Parameters
7812 ///
7813 /// - `state`: A pending linker invocation.
7814 /// - `cubinOut`: On success, this will point to the output image.
7815 /// - `sizeOut`: Optional parameter to receive the size of the generated image.
7816 pub fn cuLinkComplete(
7817 state: CUlinkState,
7818 cubinOut: *mut *mut ::core::ffi::c_void,
7819 sizeOut: *mut size_t,
7820 ) -> CUresult;
7821}
7822unsafe extern "C" {
7823 /// Destroys state for a JIT linker invocation.
7824 ///
7825 /// **See also:**
7826 ///
7827 /// [`cuLinkCreate_v2`].
7828 ///
7829 /// # Parameters
7830 ///
7831 /// - `state`: State object for the linker invocation.
7832 pub fn cuLinkDestroy(state: CUlinkState) -> CUresult;
7833}
7834unsafe extern "C" {
7835 /// Returns a handle to a texture reference.
7836 ///
7837 /// \*pTexRef
7838 ///
7839 /// name
7840 ///
7841 /// hmod
7842 ///
7843 /// [`cuModuleGetTexRef`]
7844 ///
7845 /// [`cudaError_enum::CUDA_ERROR_NOT_FOUND`]
7846 ///
7847 /// Note:
7848 ///
7849 /// Note that this function may also return error codes from previous, asynchronous launches.
7850 ///
7851 /// **See also:**
7852 ///
7853 /// [`cuModuleGetFunction`], [`cuModuleGetGlobal_v2`], [`cuModuleGetSurfRef`], [`cuModuleLoad`], [`cuModuleLoadData`], [`cuModuleLoadDataEx`], [`cuModuleLoadFatBinary`], [`cuModuleUnload`].
7854 ///
7855 /// # Parameters
7856 ///
7857 /// - `pTexRef`: Returned texture reference.
7858 /// - `hmod`: Module to retrieve texture reference from.
7859 /// - `name`: Name of texture reference to retrieve.
7860 #[deprecated]
7861 pub fn cuModuleGetTexRef(
7862 pTexRef: *mut CUtexref,
7863 hmod: CUmodule,
7864 name: *const ::core::ffi::c_char,
7865 ) -> CUresult;
7866}
7867unsafe extern "C" {
7868 /// Returns a handle to a surface reference.
7869 ///
7870 /// \*pSurfRef
7871 ///
7872 /// name
7873 ///
7874 /// hmod
7875 ///
7876 /// [`cuModuleGetSurfRef`]
7877 ///
7878 /// [`cudaError_enum::CUDA_ERROR_NOT_FOUND`]
7879 ///
7880 /// Note:
7881 ///
7882 /// Note that this function may also return error codes from previous, asynchronous launches.
7883 ///
7884 /// **See also:**
7885 ///
7886 /// [`cuModuleGetFunction`], [`cuModuleGetGlobal_v2`], [`cuModuleGetTexRef`], [`cuModuleLoad`], [`cuModuleLoadData`], [`cuModuleLoadDataEx`], [`cuModuleLoadFatBinary`], [`cuModuleUnload`].
7887 ///
7888 /// # Parameters
7889 ///
7890 /// - `pSurfRef`: Returned surface reference.
7891 /// - `hmod`: Module to retrieve surface reference from.
7892 /// - `name`: Name of surface reference to retrieve.
7893 #[deprecated]
7894 pub fn cuModuleGetSurfRef(
7895 pSurfRef: *mut CUsurfref,
7896 hmod: CUmodule,
7897 name: *const ::core::ffi::c_char,
7898 ) -> CUresult;
7899}
7900unsafe extern "C" {
7901 /// Load a library with specified code and options.
7902 ///
7903 /// Takes a pointer code and loads the corresponding library library based on the application defined library loading mode:
7904 ///
7905 /// * If module loading is set to EAGER, via the environment variables described in "Module loading", library is loaded eagerly into all contexts at the time of the call and future contexts at the time of creation until the library
7906 /// is unloaded with [`cuLibraryUnload`].
7907 /// * If the environment variables are set to LAZY, library is not immediately loaded onto all existent contexts and will only be loaded when a function is needed for that context,
7908 /// such as a kernel launch.
7909 ///
7910 /// These environment variables are described in the CUDA programming guide under the "CUDA environment variables" section.
7911 ///
7912 /// The code may be a cubin or fatbin as output by **nvcc**, or a NULL-terminated PTX, either as output by **nvcc** or hand-written, or Tile IR data. A fatbin should also contain relocatable code when doing separate compilation.
7913 ///
7914 /// Options are passed as an array via jitOptions and any corresponding parameters are passed in jitOptionsValues. The number of total JIT options is supplied via numJitOptions. Any outputs will be returned via jitOptionsValues.
7915 ///
7916 /// Library load options are passed as an array via libraryOptions and any corresponding parameters are passed in libraryOptionValues. The number of total library load options is supplied via numLibraryOptions.
7917 ///
7918 /// Note:
7919 ///
7920 /// If the library contains managed variables and no device in the system supports managed variables this call is expected to
7921 /// return [`cudaError_enum::CUDA_ERROR_NOT_SUPPORTED`]
7922 ///
7923 /// **See also:**
7924 ///
7925 /// [`cuLibraryLoadFromFile`], [`cuLibraryUnload`], [`cuModuleLoad`], [`cuModuleLoadData`], [`cuModuleLoadDataEx`].
7926 ///
7927 /// # Parameters
7928 ///
7929 /// - `library`: Returned library.
7930 /// - `code`: Code to load.
7931 /// - `jitOptions`: Options for JIT.
7932 /// - `jitOptionsValues`: Option values for JIT.
7933 /// - `numJitOptions`: Number of options.
7934 /// - `libraryOptions`: Options for loading.
7935 /// - `libraryOptionValues`: Option values for loading.
7936 /// - `numLibraryOptions`: Number of options for loading.
7937 pub fn cuLibraryLoadData(
7938 library: *mut CUlibrary,
7939 code: *const ::core::ffi::c_void,
7940 jitOptions: *mut CUjit_option,
7941 jitOptionsValues: *mut *mut ::core::ffi::c_void,
7942 numJitOptions: ::core::ffi::c_uint,
7943 libraryOptions: *mut CUlibraryOption,
7944 libraryOptionValues: *mut *mut ::core::ffi::c_void,
7945 numLibraryOptions: ::core::ffi::c_uint,
7946 ) -> CUresult;
7947}
7948unsafe extern "C" {
7949 /// Load a library with specified file and options.
7950 ///
7951 /// Takes a pointer code and loads the corresponding library library based on the application defined library loading mode:
7952 ///
7953 /// * If module loading is set to EAGER, via the environment variables described in "Module loading", library is loaded eagerly into all contexts at the time of the call and future contexts at the time of creation until the library
7954 /// is unloaded with [`cuLibraryUnload`].
7955 /// * If the environment variables are set to LAZY, library is not immediately loaded onto all existent contexts and will only be loaded when a function is needed for that context,
7956 /// such as a kernel launch.
7957 ///
7958 /// These environment variables are described in the CUDA programming guide under the "CUDA environment variables" section.
7959 ///
7960 /// The file should be a cubin file as output by **nvcc**, or a PTX file either as output by **nvcc** or handwritten, or a fatbin file as output by **nvcc** or hand-written, or Tile IR file. A fatbin should also contain relocatable code when doing separate compilation.
7961 ///
7962 /// Options are passed as an array via jitOptions and any corresponding parameters are passed in jitOptionsValues. The number of total options is supplied via numJitOptions. Any outputs will be returned via jitOptionsValues.
7963 ///
7964 /// Library load options are passed as an array via libraryOptions and any corresponding parameters are passed in libraryOptionValues. The number of total library load options is supplied via numLibraryOptions.
7965 ///
7966 /// Note:
7967 ///
7968 /// If the library contains managed variables and no device in the system supports managed variables this call is expected to
7969 /// return [`cudaError_enum::CUDA_ERROR_NOT_SUPPORTED`]
7970 ///
7971 /// **See also:**
7972 ///
7973 /// [`cuLibraryLoadData`], [`cuLibraryUnload`], [`cuModuleLoad`], [`cuModuleLoadData`], [`cuModuleLoadDataEx`].
7974 ///
7975 /// # Parameters
7976 ///
7977 /// - `library`: Returned library.
7978 /// - `fileName`: File to load from.
7979 /// - `jitOptions`: Options for JIT.
7980 /// - `jitOptionsValues`: Option values for JIT.
7981 /// - `numJitOptions`: Number of options.
7982 /// - `libraryOptions`: Options for loading.
7983 /// - `libraryOptionValues`: Option values for loading.
7984 /// - `numLibraryOptions`: Number of options for loading.
7985 pub fn cuLibraryLoadFromFile(
7986 library: *mut CUlibrary,
7987 fileName: *const ::core::ffi::c_char,
7988 jitOptions: *mut CUjit_option,
7989 jitOptionsValues: *mut *mut ::core::ffi::c_void,
7990 numJitOptions: ::core::ffi::c_uint,
7991 libraryOptions: *mut CUlibraryOption,
7992 libraryOptionValues: *mut *mut ::core::ffi::c_void,
7993 numLibraryOptions: ::core::ffi::c_uint,
7994 ) -> CUresult;
7995}
7996unsafe extern "C" {
7997 /// Unloads a library.
7998 ///
7999 /// Unloads the library specified with library
8000 ///
8001 /// **See also:**
8002 ///
8003 /// [`cuLibraryLoadData`], [`cuLibraryLoadFromFile`], [`cuModuleUnload`].
8004 ///
8005 /// # Parameters
8006 ///
8007 /// - `library`: Library to unload.
8008 pub fn cuLibraryUnload(library: CUlibrary) -> CUresult;
8009}
8010unsafe extern "C" {
8011 /// Returns a kernel handle.
8012 ///
8013 /// Returns in pKernel the handle of the kernel with name name located in library library. If kernel handle is not found, the call returns [`cudaError_enum::CUDA_ERROR_NOT_FOUND`].
8014 ///
8015 /// **See also:**
8016 ///
8017 /// [`cuLibraryLoadData`], [`cuLibraryLoadFromFile`], [`cuLibraryUnload`], [`cuKernelGetFunction`], [`cuLibraryGetModule`], [`cuModuleGetFunction`].
8018 ///
8019 /// # Parameters
8020 ///
8021 /// - `pKernel`: Returned kernel handle.
8022 /// - `library`: Library to retrieve kernel from.
8023 /// - `name`: Name of kernel to retrieve.
8024 pub fn cuLibraryGetKernel(
8025 pKernel: *mut CUkernel,
8026 library: CUlibrary,
8027 name: *const ::core::ffi::c_char,
8028 ) -> CUresult;
8029}
8030unsafe extern "C" {
8031 /// Returns the number of kernels within a library.
8032 ///
8033 /// Returns in count the number of kernels in lib.
8034 ///
8035 /// # Parameters
8036 ///
8037 /// - `count`: Number of kernels found within the library.
8038 /// - `lib`: Library to query.
8039 pub fn cuLibraryGetKernelCount(
8040 count: *mut ::core::ffi::c_uint,
8041 lib: CUlibrary,
8042 ) -> CUresult;
8043}
8044unsafe extern "C" {
8045 /// Retrieve the kernel handles within a library.
8046 ///
8047 /// Returns in kernels a maximum number of numKernels kernel handles within lib. The returned kernel handle becomes invalid when the library is unloaded.
8048 ///
8049 /// **See also:**
8050 ///
8051 /// [`cuLibraryGetKernelCount`].
8052 ///
8053 /// # Parameters
8054 ///
8055 /// - `kernels`: Buffer where the kernel handles are returned to.
8056 /// - `numKernels`: Maximum number of kernel handles may be returned to the buffer.
8057 /// - `lib`: Library to query from.
8058 pub fn cuLibraryEnumerateKernels(
8059 kernels: *mut CUkernel,
8060 numKernels: ::core::ffi::c_uint,
8061 lib: CUlibrary,
8062 ) -> CUresult;
8063}
8064unsafe extern "C" {
8065 /// Returns a module handle.
8066 ///
8067 /// Returns in pMod the module handle associated with the current context located in library library. If module handle is not found, the call returns [`cudaError_enum::CUDA_ERROR_NOT_FOUND`].
8068 ///
8069 /// **See also:**
8070 ///
8071 /// [`cuLibraryLoadData`], [`cuLibraryLoadFromFile`], [`cuLibraryUnload`], [`cuModuleGetFunction`].
8072 ///
8073 /// # Parameters
8074 ///
8075 /// - `pMod`: Returned module handle.
8076 /// - `library`: Library to retrieve module from.
8077 pub fn cuLibraryGetModule(pMod: *mut CUmodule, library: CUlibrary) -> CUresult;
8078}
8079unsafe extern "C" {
8080 /// Returns a function handle.
8081 ///
8082 /// Returns in pFunc the handle of the function for the requested kernel kernel and the current context. If function handle is not found, the call returns [`cudaError_enum::CUDA_ERROR_NOT_FOUND`].
8083 ///
8084 /// **See also:**
8085 ///
8086 /// [`cuLibraryLoadData`], [`cuLibraryLoadFromFile`], [`cuLibraryUnload`], [`cuLibraryGetKernel`], [`cuLibraryGetModule`], [`cuModuleGetFunction`].
8087 ///
8088 /// # Parameters
8089 ///
8090 /// - `pFunc`: Returned function handle.
8091 /// - `kernel`: Kernel to retrieve function for the requested context.
8092 pub fn cuKernelGetFunction(pFunc: *mut CUfunction, kernel: CUkernel) -> CUresult;
8093}
8094unsafe extern "C" {
8095 /// Returns a library handle.
8096 ///
8097 /// Returns in pLib the handle of the library for the requested kernel kernel
8098 ///
8099 /// **See also:**
8100 ///
8101 /// [`cuLibraryLoadData`], [`cuLibraryLoadFromFile`], [`cuLibraryUnload`], [`cuLibraryGetKernel`].
8102 ///
8103 /// # Parameters
8104 ///
8105 /// - `pLib`: Returned library handle.
8106 /// - `kernel`: Kernel to retrieve library handle.
8107 pub fn cuKernelGetLibrary(pLib: *mut CUlibrary, kernel: CUkernel) -> CUresult;
8108}
8109unsafe extern "C" {
8110 /// Returns a global device pointer.
8111 ///
8112 /// Returns in \*dptr and \*bytes the base pointer and size of the global with name name for the requested library library and the current context. If no global for the requested name name exists, the call returns [`cudaError_enum::CUDA_ERROR_NOT_FOUND`]. One of the parameters dptr or bytes (not both) can be NULL in which case it is ignored.
8113 ///
8114 /// **See also:**
8115 ///
8116 /// [`cuLibraryLoadData`], [`cuLibraryLoadFromFile`], [`cuLibraryUnload`], [`cuLibraryGetModule`], [`cuModuleGetGlobal_v2`].
8117 ///
8118 /// # Parameters
8119 ///
8120 /// - `dptr`: Returned global device pointer for the requested context.
8121 /// - `bytes`: Returned global size in bytes.
8122 /// - `library`: Library to retrieve global from.
8123 /// - `name`: Name of global to retrieve.
8124 pub fn cuLibraryGetGlobal(
8125 dptr: *mut CUdeviceptr,
8126 bytes: *mut size_t,
8127 library: CUlibrary,
8128 name: *const ::core::ffi::c_char,
8129 ) -> CUresult;
8130}
8131unsafe extern "C" {
8132 /// Returns a pointer to managed memory.
8133 ///
8134 /// Returns in \*dptr and \*bytes the base pointer and size of the managed memory with name name for the requested library library. If no managed memory with the requested name name exists, the call returns [`cudaError_enum::CUDA_ERROR_NOT_FOUND`]. One of the parameters dptr or bytes (not both) can be NULL in which case it is ignored. Note that managed memory for library library is shared across devices and is registered when the library is loaded into at least one context.
8135 ///
8136 /// **See also:**
8137 ///
8138 /// [`cuLibraryLoadData`], [`cuLibraryLoadFromFile`], [`cuLibraryUnload`].
8139 ///
8140 /// # Parameters
8141 ///
8142 /// - `dptr`: Returned pointer to the managed memory.
8143 /// - `bytes`: Returned memory size in bytes.
8144 /// - `library`: Library to retrieve managed memory from.
8145 /// - `name`: Name of managed memory to retrieve.
8146 pub fn cuLibraryGetManaged(
8147 dptr: *mut CUdeviceptr,
8148 bytes: *mut size_t,
8149 library: CUlibrary,
8150 name: *const ::core::ffi::c_char,
8151 ) -> CUresult;
8152}
8153unsafe extern "C" {
8154 /// Returns a pointer to a unified function.
8155 ///
8156 /// Returns in \*fptr the function pointer to a unified function denoted by symbol. If no unified function with name symbol exists, the call returns [`cudaError_enum::CUDA_ERROR_NOT_FOUND`]. If there is no device with attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_UNIFIED_FUNCTION_POINTERS`] present in the system, the call may return [`cudaError_enum::CUDA_ERROR_NOT_FOUND`].
8157 ///
8158 /// **See also:**
8159 ///
8160 /// [`cuLibraryLoadData`], [`cuLibraryLoadFromFile`], [`cuLibraryUnload`].
8161 ///
8162 /// # Parameters
8163 ///
8164 /// - `fptr`: Returned pointer to a unified function.
8165 /// - `library`: Library to retrieve function pointer memory from.
8166 /// - `symbol`: Name of function pointer to retrieve.
8167 pub fn cuLibraryGetUnifiedFunction(
8168 fptr: *mut *mut ::core::ffi::c_void,
8169 library: CUlibrary,
8170 symbol: *const ::core::ffi::c_char,
8171 ) -> CUresult;
8172}
8173unsafe extern "C" {
8174 /// Returns information about a kernel.
8175 ///
8176 /// Returns in \*pi the integer value of the attribute attrib for the kernel kernel for the requested device dev. The supported attributes are:
8177 ///
8178 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK`]: The maximum number of threads per block, beyond which a launch of the kernel would fail. This number depends on both the
8179 /// kernel and the requested device.
8180 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES`]: The size in bytes of statically-allocated shared memory per block required by this kernel. This does not include dynamically-allocated
8181 /// shared memory requested by the user at runtime.
8182 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES`]: The size in bytes of user-allocated constant memory required by this kernel.
8183 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES`]: The size in bytes of local memory used by each thread of this kernel.
8184 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_NUM_REGS`]: The number of registers used by each thread of this kernel.
8185 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_PTX_VERSION`]: The PTX virtual architecture version for which the kernel was compiled. This value is the major PTX version \* 10 + the minor
8186 /// PTX version, so a PTX version 1.3 function would return the value 13. Note that this may return the undefined value of 0 for
8187 /// cubins compiled prior to CUDA 3.0.
8188 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_BINARY_VERSION`]: The binary architecture version for which the kernel was compiled. This value is the major binary version \* 10 + the minor
8189 /// binary version, so a binary version 1.3 function would return the value 13. Note that this will return a value of 10 for legacy
8190 /// cubins that do not have a properly-encoded binary architecture version.
8191 /// * CU_FUNC_CACHE_MODE_CA: The attribute to indicate whether the kernel has been compiled with user specified option "-Xptxas
8192 /// --dlcm=ca" set.
8193 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES`]: The maximum size in bytes of dynamically-allocated shared memory.
8194 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT`]: Preferred shared memory-L1 cache split ratio in percent of total shared memory.
8195 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_CLUSTER_SIZE_MUST_BE_SET`]: If this attribute is set, the kernel must launch with a valid cluster size specified.
8196 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH`]: The required cluster width in blocks.
8197 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT`]: The required cluster height in blocks.
8198 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH`]: The required cluster depth in blocks.
8199 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED`]: Indicates whether the function can be launched with non-portable cluster size. 1 is allowed, 0 is disallowed. A non-portable
8200 /// cluster size may only function on the specific SKUs the program is tested on. The launch might fail if the program is run
8201 /// on a different hardware platform. CUDA API provides cudaOccupancyMaxActiveClusters to assist with checking whether the desired
8202 /// size can be launched on the current device. A portable cluster size is guaranteed to be functional on all compute capabilities
8203 /// higher than the target compute capability. The portable cluster size for sm_90 is 8 blocks per cluster. This value may increase
8204 /// for future compute capabilities. The specific hardware unit may support higher cluster sizes that’s not guaranteed to be portable.
8205 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE`]: The block scheduling policy of a function. The value type is CUclusterSchedulingPolicy.
8206 ///
8207 /// Note:
8208 ///
8209 /// If another thread is trying to set the same attribute on the same device using [`cuKernelSetAttribute`] simultaneously, the attribute query will give the old or new value depending on the interleavings chosen by the OS scheduler
8210 /// and memory consistency.
8211 ///
8212 /// **See also:**
8213 ///
8214 /// [`cuLibraryLoadData`], [`cuLibraryLoadFromFile`], [`cuLibraryUnload`], [`cuKernelSetAttribute`], [`cuLibraryGetKernel`], [`cuLaunchKernel`], [`cuKernelGetFunction`], [`cuLibraryGetModule`], [`cuModuleGetFunction`], [`cuFuncGetAttribute`].
8215 ///
8216 /// # Parameters
8217 ///
8218 /// - `pi`: Returned attribute value.
8219 /// - `attrib`: Attribute requested.
8220 /// - `kernel`: Kernel to query attribute of.
8221 /// - `dev`: Device to query attribute of.
8222 pub fn cuKernelGetAttribute(
8223 pi: *mut ::core::ffi::c_int,
8224 attrib: CUfunction_attribute,
8225 kernel: CUkernel,
8226 dev: CUdevice,
8227 ) -> CUresult;
8228}
8229unsafe extern "C" {
8230 /// Sets information about a kernel.
8231 ///
8232 /// This call sets the value of a specified attribute attrib on the kernel kernel for the requested device dev to an integer value specified by val. This function returns [`CUresult::CUDA_SUCCESS`] if the new value of the attribute could be successfully set. If the set fails, this call
8233 /// will return an error. Not all attributes can have values set. Attempting to set a value on a read-only attribute will result
8234 /// in an error ([`CUresult::CUDA_ERROR_INVALID_VALUE`])
8235 ///
8236 /// Note that attributes set using [`cuFuncSetAttribute`] will override the attribute set by this API irrespective of whether the call to [`cuFuncSetAttribute`] is made before or after this API call. However, [`cuKernelGetAttribute`] will always return the attribute value set by this API.
8237 ///
8238 /// Supported attributes are:
8239 ///
8240 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES`]: This is the maximum size in bytes of dynamically-allocated shared memory. The value should contain the requested maximum
8241 /// size of dynamically-allocated shared memory. The sum of this value and the function attribute [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES`] cannot exceed the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN`]. The maximal size of requestable dynamic shared memory may differ by GPU architecture.
8242 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT`]: On devices where the L1 cache and shared memory use the same hardware resources, this sets the shared memory carveout preference,
8243 /// in percent of the total shared memory. See [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR`] This is only a hint, and the driver can choose a different ratio if required to execute the function.
8244 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH`]: The required cluster width in blocks. The width, height, and depth values must either all be 0 or all be positive. The validity
8245 /// of the cluster dimensions is checked at launch time. If the value is set during compile time, it cannot be set at runtime.
8246 /// Setting it at runtime will return [`CUresult::CUDA_ERROR_NOT_PERMITTED`].
8247 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT`]: The required cluster height in blocks. The width, height, and depth values must either all be 0 or all be positive. The
8248 /// validity of the cluster dimensions is checked at launch time. If the value is set during compile time, it cannot be set at
8249 /// runtime. Setting it at runtime will return [`CUresult::CUDA_ERROR_NOT_PERMITTED`].
8250 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH`]: The required cluster depth in blocks. The width, height, and depth values must either all be 0 or all be positive. The validity
8251 /// of the cluster dimensions is checked at launch time. If the value is set during compile time, it cannot be set at runtime.
8252 /// Setting it at runtime will return [`CUresult::CUDA_ERROR_NOT_PERMITTED`].
8253 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED`]: Indicates whether the function can be launched with non-portable cluster size. 1 is allowed, 0 is disallowed.
8254 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE`]: The block scheduling policy of a function. The value type is CUclusterSchedulingPolicy.
8255 ///
8256 /// Note:
8257 ///
8258 /// The API has stricter locking requirements in comparison to its legacy counterpart [`cuFuncSetAttribute`] due to device-wide semantics. If multiple threads are trying to set the same attribute on the same device simultaneously,
8259 /// the attribute setting will depend on the interleavings chosen by the OS scheduler and memory consistency.
8260 ///
8261 /// **See also:**
8262 ///
8263 /// [`cuLibraryLoadData`], [`cuLibraryLoadFromFile`], [`cuLibraryUnload`], [`cuKernelGetAttribute`], [`cuLibraryGetKernel`], [`cuLaunchKernel`], [`cuKernelGetFunction`], [`cuLibraryGetModule`], [`cuModuleGetFunction`], [`cuFuncSetAttribute`].
8264 ///
8265 /// # Parameters
8266 ///
8267 /// - `attrib`: Attribute requested.
8268 /// - `val`: Value to set.
8269 /// - `kernel`: Kernel to set attribute of.
8270 /// - `dev`: Device to set attribute of.
8271 pub fn cuKernelSetAttribute(
8272 attrib: CUfunction_attribute,
8273 val: ::core::ffi::c_int,
8274 kernel: CUkernel,
8275 dev: CUdevice,
8276 ) -> CUresult;
8277}
8278unsafe extern "C" {
8279 /// Sets the preferred cache configuration for a device kernel.
8280 ///
8281 /// On devices where the L1 cache and shared memory use the same hardware resources, this sets through config the preferred cache configuration for the device kernel kernel on the requested device dev. This is only a preference. The driver will use the requested configuration if possible, but it is free to choose a different
8282 /// configuration if required to execute kernel. Any context-wide preference set via [`cuCtxSetCacheConfig`] will be overridden by this per-kernel setting.
8283 ///
8284 /// Note that attributes set using [`cuFuncSetCacheConfig`] will override the attribute set by this API irrespective of whether the call to [`cuFuncSetCacheConfig`] is made before or after this API call.
8285 ///
8286 /// This setting does nothing on devices where the size of the L1 cache and shared memory are fixed.
8287 ///
8288 /// Launching a kernel with a different preference than the most recent preference setting may insert a device-side synchronization
8289 /// point.
8290 ///
8291 /// The supported cache configurations are:
8292 ///
8293 /// * [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_NONE`]: no preference for shared memory or L1 (default)
8294 /// * [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_SHARED`]: prefer larger shared memory and smaller L1 cache
8295 /// * [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_L1`]: prefer larger L1 cache and smaller shared memory
8296 /// * [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_EQUAL`]: prefer equal sized L1 cache and shared memory
8297 ///
8298 /// Note:
8299 ///
8300 /// The API has stricter locking requirements in comparison to its legacy counterpart [`cuFuncSetCacheConfig`] due to device-wide semantics. If multiple threads are trying to set a config on the same device simultaneously, the cache
8301 /// config setting will depend on the interleavings chosen by the OS scheduler and memory consistency.
8302 ///
8303 /// **See also:**
8304 ///
8305 /// [`cuLibraryLoadData`], [`cuLibraryLoadFromFile`], [`cuLibraryUnload`], [`cuLibraryGetKernel`], [`cuKernelGetFunction`], [`cuLibraryGetModule`], [`cuModuleGetFunction`], [`cuFuncSetCacheConfig`], [`cuCtxSetCacheConfig`], [`cuLaunchKernel`].
8306 ///
8307 /// # Parameters
8308 ///
8309 /// - `kernel`: Kernel to configure cache for.
8310 /// - `config`: Requested cache configuration.
8311 /// - `dev`: Device to set attribute of.
8312 pub fn cuKernelSetCacheConfig(
8313 kernel: CUkernel,
8314 config: CUfunc_cache,
8315 dev: CUdevice,
8316 ) -> CUresult;
8317}
8318unsafe extern "C" {
8319 /// Returns the function name for a CUkernel handle.
8320 ///
8321 /// Returns in \*\*name the function name associated with the kernel handle hfunc . The function name is returned as a null-terminated string. The returned name is only valid when the kernel handle is valid.
8322 /// If the library is unloaded or reloaded, one must call the API again to get the updated name. This API may return a mangled
8323 /// name if the function is not declared as having C linkage. If either \*\*name or hfunc is NULL, [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] is returned.
8324 ///
8325 /// Note:
8326 ///
8327 /// Note that this function may also return error codes from previous, asynchronous launches.
8328 ///
8329 /// # Parameters
8330 ///
8331 /// - `name`: The returned name of the function.
8332 /// - `hfunc`: The function handle to retrieve the name for.
8333 pub fn cuKernelGetName(
8334 name: *mut *const ::core::ffi::c_char,
8335 hfunc: CUkernel,
8336 ) -> CUresult;
8337}
8338unsafe extern "C" {
8339 /// Returns the offset and size of a kernel parameter in the device-side parameter layout.
8340 ///
8341 /// Queries the kernel parameter at paramIndex into kernel's list of parameters, and returns in paramOffset and paramSize the offset and size, respectively, where the parameter will reside in the device-side parameter layout. This information
8342 /// can be used to update kernel node parameters from the device via [cudaGraphKernelNodeSetParam()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__GRAPH.html#group__CUDART__GRAPH_1g0c2bd161eff1e47531eedce282e66d21) and [cudaGraphKernelNodeUpdatesApply()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__GRAPH.html#group__CUDART__GRAPH_1g2d558cf37c9616365c67447e61ac0d6a). paramIndex must be less than the number of parameters that kernel takes. paramSize can be set to NULL if only the parameter offset is desired.
8343 ///
8344 /// Note:
8345 ///
8346 /// Note that this function may also return error codes from previous, asynchronous launches.
8347 ///
8348 /// **See also:**
8349 ///
8350 /// [`cuFuncGetParamInfo`].
8351 ///
8352 /// # Parameters
8353 ///
8354 /// - `kernel`: The kernel to query.
8355 /// - `paramIndex`: The parameter index to query.
8356 /// - `paramOffset`: Returns the offset into the device-side parameter layout at which the parameter resides.
8357 /// - `paramSize`: Optionally returns the size of the parameter in the device-side parameter layout.
8358 pub fn cuKernelGetParamInfo(
8359 kernel: CUkernel,
8360 paramIndex: size_t,
8361 paramOffset: *mut size_t,
8362 paramSize: *mut size_t,
8363 ) -> CUresult;
8364}
8365unsafe extern "C" {
8366 /// Returns the number of parameters used by the kernel.
8367 ///
8368 /// Queries the number of kernel parameters used by kernel and returns it in paramCount.
8369 ///
8370 /// Note:
8371 ///
8372 /// Note that this function may also return error codes from previous, asynchronous launches.
8373 ///
8374 /// **See also:**
8375 ///
8376 /// [`cuKernelGetParamInfo`].
8377 ///
8378 /// # Parameters
8379 ///
8380 /// - `kernel`: The kernel to query.
8381 /// - `paramCount`: Returns the number of parameters used by the function.
8382 pub fn cuKernelGetParamCount(kernel: CUkernel, paramCount: *mut size_t) -> CUresult;
8383}
8384unsafe extern "C" {
8385 /// Gets free and total memory.
8386 ///
8387 /// Returns in \*total the total amount of memory available to the current context. Returns in \*free the amount of memory on the device that is free according to the OS. CUDA is not guaranteed to be able to allocate all of
8388 /// the memory that the OS reports as free. In a multi-tenet situation, free estimate returned is prone to race condition where
8389 /// a new allocation/free done by a different process or a different thread in the same process between the time when free memory
8390 /// was estimated and reported, will result in deviation in free value reported and actual free memory.
8391 ///
8392 /// The integrated GPU on Tegra shares memory with CPU and other component of the SoC. The free and total values returned by the
8393 /// API excludes the SWAP memory space maintained by the OS on some platforms. The OS may move some of the memory pages into swap
8394 /// area as the GPU or CPU allocate or access memory. See Tegra app note on how to calculate total and free memory on Tegra.
8395 ///
8396 /// Note:
8397 ///
8398 /// Note that this function may also return error codes from previous, asynchronous launches.
8399 ///
8400 /// **See also:**
8401 ///
8402 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMemGetInfo](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g376b97f5ab20321ca46f7cfa9511b978).
8403 ///
8404 /// # Parameters
8405 ///
8406 /// - `free`: Returned free memory in bytes.
8407 /// - `total`: Returned total memory in bytes.
8408 pub fn cuMemGetInfo_v2(free: *mut size_t, total: *mut size_t) -> CUresult;
8409}
8410unsafe extern "C" {
8411 /// Allocates device memory.
8412 ///
8413 /// Allocates bytesize bytes of linear memory on the device and returns in \*dptr a pointer to the allocated memory. The allocated memory is suitably aligned for any kind of variable. The memory is not cleared.
8414 /// If bytesize is 0, [`cuMemAlloc_v2`] returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`].
8415 ///
8416 /// Note:
8417 ///
8418 /// Note that this function may also return error codes from previous, asynchronous launches.
8419 ///
8420 /// **See also:**
8421 ///
8422 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMalloc](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g37d37965bfb4803b6d4e59ff26856356).
8423 ///
8424 /// # Parameters
8425 ///
8426 /// - `dptr`: Returned device pointer.
8427 /// - `bytesize`: Requested allocation size in bytes.
8428 pub fn cuMemAlloc_v2(dptr: *mut CUdeviceptr, bytesize: size_t) -> CUresult;
8429}
8430unsafe extern "C" {
8431 /// Allocates pitched device memory.
8432 ///
8433 /// Allocates at least WidthInBytes \* Height bytes of linear memory on the device and returns in \*dptr a pointer to the allocated memory. The function may pad the allocation to ensure that corresponding pointers in any given
8434 /// row will continue to meet the alignment requirements for coalescing as the address is updated from row to row. ElementSizeBytes specifies the size of the largest reads and writes that will be performed on the memory range. ElementSizeBytes may be 4, 8 or 16 (since coalesced memory transactions are not possible on other data sizes). If ElementSizeBytes is smaller than the actual read/write size of a kernel, the kernel will run correctly, but possibly at reduced speed. The
8435 /// pitch returned in \*pPitch by [`cuMemAllocPitch_v2`] is the width in bytes of the allocation. The intended usage of pitch is as a separate parameter of the allocation, used to
8436 /// compute addresses within the 2D array. Given the row and column of an array element of type **T**, the address is computed as:
8437 ///
8438 /// ```text
8439 /// T* pElement = (T*)((char*)BaseAddress + Row * Pitch) + Column;
8440 /// ```
8441 ///
8442 /// The pitch returned by [`cuMemAllocPitch_v2`] is guaranteed to work with [`cuMemcpy2D_v2`] under all circumstances. For allocations of 2D arrays, it is recommended that programmers consider performing pitch allocations
8443 /// using [`cuMemAllocPitch_v2`]. Due to alignment restrictions in the hardware, this is especially true if the application will be performing 2D memory copies
8444 /// between different regions of device memory (whether linear memory or CUDA arrays).
8445 ///
8446 /// The byte alignment of the pitch returned by [`cuMemAllocPitch_v2`] is guaranteed to match or exceed the alignment requirement for texture binding with [`cuTexRefSetAddress2D_v3`].
8447 ///
8448 /// Note:
8449 ///
8450 /// Note that this function may also return error codes from previous, asynchronous launches.
8451 ///
8452 /// **See also:**
8453 ///
8454 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMallocPitch](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g32bd7a39135594788a542ae72217775c).
8455 ///
8456 /// # Parameters
8457 ///
8458 /// - `dptr`: Returned device pointer.
8459 /// - `pPitch`: Returned pitch of allocation in bytes.
8460 /// - `WidthInBytes`: Requested allocation width in bytes.
8461 /// - `Height`: Requested allocation height in rows.
8462 /// - `ElementSizeBytes`: Size of largest reads/writes for range.
8463 pub fn cuMemAllocPitch_v2(
8464 dptr: *mut CUdeviceptr,
8465 pPitch: *mut size_t,
8466 WidthInBytes: size_t,
8467 Height: size_t,
8468 ElementSizeBytes: ::core::ffi::c_uint,
8469 ) -> CUresult;
8470}
8471unsafe extern "C" {
8472 /// Frees device memory.
8473 ///
8474 /// Frees the memory space pointed to by dptr, which must have been returned by a previous call to one of the following memory allocation APIs - [`cuMemAlloc_v2`], [`cuMemAllocPitch_v2`], [`cuMemAllocManaged`], [`cuMemAllocAsync`], [`cuMemAllocFromPoolAsync`]
8475 ///
8476 /// Note - This API will not perform any implict synchronization when the pointer was allocated with [`cuMemAllocAsync`] or [`cuMemAllocFromPoolAsync`]. Callers must ensure that all accesses to these pointer have completed before invoking [`cuMemFree_v2`]. For best performance and memory reuse, users should use [`cuMemFreeAsync`] to free memory allocated via the stream ordered memory allocator. For all other pointers, this API may perform implicit synchronization.
8477 ///
8478 /// Note:
8479 ///
8480 /// Note that this function may also return error codes from previous, asynchronous launches.
8481 ///
8482 /// **See also:**
8483 ///
8484 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemAllocManaged`], [`cuMemAllocAsync`], [`cuMemAllocFromPoolAsync`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemFreeAsync`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaFree](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1ga042655cbbf3408f01061652a075e094).
8485 ///
8486 /// # Parameters
8487 ///
8488 /// - `dptr`: Pointer to memory to free.
8489 pub fn cuMemFree_v2(dptr: CUdeviceptr) -> CUresult;
8490}
8491unsafe extern "C" {
8492 /// Get information on memory allocations.
8493 ///
8494 /// Returns the base address in \*pbase and size in \*psize of the allocation that contains the input pointer dptr. Both parameters pbase and psize are optional. If one of them is NULL, it is ignored.
8495 ///
8496 /// Note:
8497 ///
8498 /// Note that this function may also return error codes from previous, asynchronous launches.
8499 ///
8500 /// **See also:**
8501 ///
8502 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`].
8503 ///
8504 /// # Parameters
8505 ///
8506 /// - `pbase`: Returned base address.
8507 /// - `psize`: Returned size of device memory allocation.
8508 /// - `dptr`: Device pointer to query.
8509 pub fn cuMemGetAddressRange_v2(
8510 pbase: *mut CUdeviceptr,
8511 psize: *mut size_t,
8512 dptr: CUdeviceptr,
8513 ) -> CUresult;
8514}
8515unsafe extern "C" {
8516 /// Allocates page-locked host memory.
8517 ///
8518 /// Allocates bytesize bytes of host memory that is page-locked and accessible to the device. The driver tracks the virtual memory ranges allocated
8519 /// with this function and automatically accelerates calls to functions such as [`cuMemcpy`]. Since the memory can be accessed directly by the device, it can be read or written with much higher bandwidth than pageable
8520 /// memory obtained with functions such as malloc().
8521 ///
8522 /// On systems where [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES`] is true, [`cuMemAllocHost_v2`] may not page-lock the allocated memory.
8523 ///
8524 /// Page-locking excessive amounts of memory with [`cuMemAllocHost_v2`] may degrade system performance, since it reduces the amount of memory available to the system for paging. As a result, this
8525 /// function is best used sparingly to allocate staging areas for data exchange between host and device.
8526 ///
8527 /// Note all host memory allocated using [`cuMemAllocHost_v2`] will automatically be immediately accessible to all contexts on all devices which support unified addressing (as may be queried
8528 /// using [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING`]). The device pointer that may be used to access this host memory from those contexts is always equal to the returned host
8529 /// pointer \*pp. See [Unified Addressing](https://docs.nvidia.com/cuda/cuda-driver-api/unified-addressing.html#group__CUDA__UNIFIED) for additional details.
8530 ///
8531 /// Note:
8532 ///
8533 /// Note that this function may also return error codes from previous, asynchronous launches.
8534 ///
8535 /// **See also:**
8536 ///
8537 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMallocHost](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1gd5c991beb38e2b8419f50285707ae87e).
8538 ///
8539 /// # Parameters
8540 ///
8541 /// - `pp`: Returned pointer to host memory.
8542 /// - `bytesize`: Requested allocation size in bytes.
8543 pub fn cuMemAllocHost_v2(
8544 pp: *mut *mut ::core::ffi::c_void,
8545 bytesize: size_t,
8546 ) -> CUresult;
8547}
8548unsafe extern "C" {
8549 /// Frees page-locked host memory.
8550 ///
8551 /// Frees the memory space pointed to by p, which must have been returned by a previous call to [`cuMemAllocHost_v2`].
8552 ///
8553 /// Note:
8554 ///
8555 /// Note that this function may also return error codes from previous, asynchronous launches.
8556 ///
8557 /// **See also:**
8558 ///
8559 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaFreeHost](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g71c078689c17627566b2a91989184969).
8560 ///
8561 /// # Parameters
8562 ///
8563 /// - `p`: Pointer to memory to free.
8564 pub fn cuMemFreeHost(p: *mut ::core::ffi::c_void) -> CUresult;
8565}
8566unsafe extern "C" {
8567 /// Allocates page-locked host memory.
8568 ///
8569 /// Allocates bytesize bytes of host memory that is page-locked and accessible to the device. The driver tracks the virtual memory ranges allocated
8570 /// with this function and automatically accelerates calls to functions such as [`cuMemcpyHtoD_v2`]. Since the memory can be accessed directly by the device, it can be read or written with much higher bandwidth than pageable
8571 /// memory obtained with functions such as malloc().
8572 ///
8573 /// On systems where [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES`] is true, [`cuMemHostAlloc`] may not page-lock the allocated memory.
8574 ///
8575 /// Page-locking excessive amounts of memory may degrade system performance, since it reduces the amount of memory available to
8576 /// the system for paging. As a result, this function is best used sparingly to allocate staging areas for data exchange between
8577 /// host and device.
8578 ///
8579 /// The Flags parameter enables different options to be specified that affect the allocation, as follows.
8580 ///
8581 /// * [`CU_MEMHOSTALLOC_PORTABLE`]: The memory returned by this call will be considered as pinned memory by all CUDA contexts, not just the one that performed
8582 /// the allocation.
8583 ///
8584 /// * [`CU_MEMHOSTALLOC_DEVICEMAP`]: Maps the allocation into the CUDA address space. The device pointer to the memory may be obtained by calling [`cuMemHostGetDevicePointer_v2`].
8585 ///
8586 /// * [`CU_MEMHOSTALLOC_WRITECOMBINED`]: Allocates the memory as write-combined (WC). WC memory can be transferred across the PCI Express bus more quickly on some
8587 /// system configurations, but cannot be read efficiently by most CPUs. WC memory is a good option for buffers that will be written
8588 /// by the CPU and read by the GPU via mapped pinned memory or host->device transfers.
8589 ///
8590 /// All of these flags are orthogonal to one another: a developer may allocate memory that is portable, mapped and/or write-combined
8591 /// with no restrictions.
8592 ///
8593 /// The [`CU_MEMHOSTALLOC_DEVICEMAP`] flag may be specified on CUDA contexts for devices that do not support mapped pinned memory. The failure is deferred to [`cuMemHostGetDevicePointer_v2`] because the memory may be mapped into other CUDA contexts via the [`CU_MEMHOSTALLOC_PORTABLE`] flag.
8594 ///
8595 /// The memory allocated by this function must be freed with [`cuMemFreeHost`].
8596 ///
8597 /// Note all host memory allocated using [`cuMemHostAlloc`] will automatically be immediately accessible to all contexts on all devices which support unified addressing (as may be queried
8598 /// using [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING`]). Unless the flag [`CU_MEMHOSTALLOC_WRITECOMBINED`] is specified, the device pointer that may be used to access this host memory from those contexts is always equal to the returned
8599 /// host pointer \*pp. If the flag [`CU_MEMHOSTALLOC_WRITECOMBINED`] is specified, then the function [`cuMemHostGetDevicePointer_v2`] must be used to query the device pointer, even if the context supports unified addressing. See [Unified Addressing](https://docs.nvidia.com/cuda/cuda-driver-api/unified-addressing.html#group__CUDA__UNIFIED) for additional details.
8600 ///
8601 /// Note:
8602 ///
8603 /// Note that this function may also return error codes from previous, asynchronous launches.
8604 ///
8605 /// **See also:**
8606 ///
8607 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaHostAlloc](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1gb65da58f444e7230d3322b6126bb4902).
8608 ///
8609 /// # Parameters
8610 ///
8611 /// - `pp`: Returned pointer to host memory.
8612 /// - `bytesize`: Requested allocation size in bytes.
8613 /// - `Flags`: Flags for allocation request.
8614 pub fn cuMemHostAlloc(
8615 pp: *mut *mut ::core::ffi::c_void,
8616 bytesize: size_t,
8617 Flags: ::core::ffi::c_uint,
8618 ) -> CUresult;
8619}
8620unsafe extern "C" {
8621 /// Passes back device pointer of mapped pinned memory.
8622 ///
8623 /// Passes back the device pointer pdptr corresponding to the mapped, pinned host buffer p allocated by [`cuMemHostAlloc`].
8624 ///
8625 /// [`cuMemHostGetDevicePointer_v2`] will fail if the [`CU_MEMHOSTALLOC_DEVICEMAP`] flag was not specified at the time the memory was allocated, or if the function is called on a GPU that does not support
8626 /// mapped pinned memory.
8627 ///
8628 /// For devices that have a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM`], the memory can also be accessed from the device using the host pointer p. The device pointer returned by [`cuMemHostGetDevicePointer_v2`] may or may not match the original host pointer p and depends on the devices visible to the application. If all devices visible to the application have a non-zero value for
8629 /// the device attribute, the device pointer returned by [`cuMemHostGetDevicePointer_v2`] will match the original pointer p. If any device visible to the application has a zero value for the device attribute, the device pointer returned by [`cuMemHostGetDevicePointer_v2`] will not match the original host pointer p, but it will be suitable for use on all devices provided Unified Virtual Addressing is enabled. In such systems, it is valid
8630 /// to access the memory using either pointer on devices that have a non-zero value for the device attribute. Note however that
8631 /// such devices should access the memory using only one of the two pointers and not both.
8632 ///
8633 /// Flags provides for future releases. For now, it must be set to 0.
8634 ///
8635 /// Note:
8636 ///
8637 /// Note that this function may also return error codes from previous, asynchronous launches.
8638 ///
8639 /// **See also:**
8640 ///
8641 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaHostGetDevicePointer](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1gc00502b44e5f1bdc0b424487ebb08db0).
8642 ///
8643 /// # Parameters
8644 ///
8645 /// - `pdptr`: Returned device pointer.
8646 /// - `p`: Host pointer.
8647 /// - `Flags`: Options (must be 0).
8648 pub fn cuMemHostGetDevicePointer_v2(
8649 pdptr: *mut CUdeviceptr,
8650 p: *mut ::core::ffi::c_void,
8651 Flags: ::core::ffi::c_uint,
8652 ) -> CUresult;
8653}
8654unsafe extern "C" {
8655 /// Passes back flags that were used for a pinned allocation.
8656 ///
8657 /// Passes back the flags pFlags that were specified when allocating the pinned host buffer p allocated by [`cuMemHostAlloc`].
8658 ///
8659 /// [`cuMemHostGetFlags`] will fail if the pointer does not reside in an allocation performed by [`cuMemAllocHost_v2`] or [`cuMemHostAlloc`].
8660 ///
8661 /// Note:
8662 ///
8663 /// Note that this function may also return error codes from previous, asynchronous launches.
8664 ///
8665 /// **See also:**
8666 ///
8667 /// [`cuMemAllocHost_v2`], [`cuMemHostAlloc`], [cudaHostGetFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1gc470e9220559109f5088d9a01c0aeeda).
8668 ///
8669 /// # Parameters
8670 ///
8671 /// - `pFlags`: Returned flags word.
8672 /// - `p`: Host pointer.
8673 pub fn cuMemHostGetFlags(
8674 pFlags: *mut ::core::ffi::c_uint,
8675 p: *mut ::core::ffi::c_void,
8676 ) -> CUresult;
8677}
8678unsafe extern "C" {
8679 /// Allocates memory that will be automatically managed by the Unified Memory system.
8680 ///
8681 /// Allocates bytesize bytes of managed memory on the device and returns in \*dptr a pointer to the allocated memory. If the device doesn't support allocating managed memory, [`cudaError_enum::CUDA_ERROR_NOT_SUPPORTED`] is returned. Support for managed memory can be queried using the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY`]. The allocated memory is suitably aligned for any kind of variable. The memory is not cleared. If bytesize is 0, [`cuMemAllocManaged`] returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`]. The pointer is valid on the CPU and on all GPUs in the system that support managed memory. All accesses to this pointer
8682 /// must obey the Unified Memory programming model.
8683 ///
8684 /// flags specifies the default stream association for this allocation. flags must be one of [`CUmemAttach_flags_enum::CU_MEM_ATTACH_GLOBAL`] or [`CUmemAttach_flags_enum::CU_MEM_ATTACH_HOST`]. If [`CUmemAttach_flags_enum::CU_MEM_ATTACH_GLOBAL`] is specified, then this memory is accessible from any stream on any device. If [`CUmemAttach_flags_enum::CU_MEM_ATTACH_HOST`] is specified, then the allocation should not be accessed from devices that have a zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`]; an explicit call to [`cuStreamAttachMemAsync`] will be required to enable access on such devices.
8685 ///
8686 /// If the association is later changed via [`cuStreamAttachMemAsync`] to a single stream, the default association as specified during [`cuMemAllocManaged`] is restored when that stream is destroyed. For __managed__ variables, the default association is always [`CUmemAttach_flags_enum::CU_MEM_ATTACH_GLOBAL`]. Note that destroying a stream is an asynchronous operation, and as a result, the change to default association won't happen
8687 /// until all work in the stream has completed.
8688 ///
8689 /// Memory allocated with [`cuMemAllocManaged`] should be released with [`cuMemFree_v2`].
8690 ///
8691 /// Device memory oversubscription is possible for GPUs that have a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`]. Managed memory on such GPUs may be evicted from device memory to host memory at any time by the Unified Memory driver in
8692 /// order to make room for other allocations.
8693 ///
8694 /// In a system where all GPUs have a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`], managed memory may not be populated when this API returns and instead may be populated on access. In such systems, managed
8695 /// memory can migrate to any processor's memory at any time. The Unified Memory driver will employ heuristics to maintain data
8696 /// locality and prevent excessive page faults to the extent possible. The application can also guide the driver about memory
8697 /// usage patterns via [`cuMemAdvise_v2`]. The application can also explicitly migrate memory to a desired processor's memory via [`cuMemPrefetchAsync_v2`].
8698 ///
8699 /// In a multi-GPU system where all of the GPUs have a zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`] and all the GPUs have peer-to-peer support with each other, the physical storage for managed memory is created on the GPU
8700 /// which is active at the time [`cuMemAllocManaged`] is called. All other GPUs will reference the data at reduced bandwidth via peer mappings over the PCIe bus. The Unified Memory
8701 /// driver does not migrate memory among such GPUs.
8702 ///
8703 /// In a multi-GPU system where not all GPUs have peer-to-peer support with each other and where the value of the device attribute
8704 /// [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`] is zero for at least one of those GPUs, the location chosen for physical storage of managed memory is system-dependent.
8705 ///
8706 /// * On Linux, the location chosen will be device memory as long as the current set of active contexts are on devices that either
8707 /// have peer-to-peer support with each other or have a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`]. If there is an active context on a GPU that does not have a non-zero value for that device attribute and it does not have
8708 /// peer-to-peer support with the other devices that have active contexts on them, then the location for physical storage will
8709 /// be 'zero-copy' or host memory. Note that this means that managed memory that is located in device memory is migrated to host
8710 /// memory if a new context is created on a GPU that doesn't have a non-zero value for the device attribute and does not support
8711 /// peer-to-peer with at least one of the other devices that has an active context. This in turn implies that context creation
8712 /// may fail if there is insufficient host memory to migrate all managed allocations.
8713 /// * On Windows, the physical storage is always created in 'zero-copy' or host memory. All GPUs will reference the data at reduced
8714 /// bandwidth over the PCIe bus. In these circumstances, use of the environment variable CUDA_VISIBLE_DEVICES is recommended to
8715 /// restrict CUDA to only use those GPUs that have peer-to-peer support. Alternatively, users can also set CUDA_MANAGED_FORCE_DEVICE_ALLOC
8716 /// to a non-zero value to force the driver to always use device memory for physical storage. When this environment variable is
8717 /// set to a non-zero value, all contexts created in that process on devices that support managed memory have to be peer-to-peer
8718 /// compatible with each other. Context creation will fail if a context is created on a device that supports managed memory and
8719 /// is not peer-to-peer compatible with any of the other managed memory supporting devices on which contexts were previously created,
8720 /// even if those contexts have been destroyed. These environment variables are described in the CUDA programming guide under
8721 /// the "CUDA environment variables" section.
8722 /// * On ARM, managed memory is not available on discrete gpu with Drive PX-2.
8723 ///
8724 /// Note:
8725 ///
8726 /// Note that this function may also return error codes from previous, asynchronous launches.
8727 ///
8728 /// **See also:**
8729 ///
8730 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [`cuDeviceGetAttribute`], [`cuStreamAttachMemAsync`], [cudaMallocManaged](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1gcf6b9b1019e73c5bc2b39b39fe90816e).
8731 ///
8732 /// # Parameters
8733 ///
8734 /// - `dptr`: Returned device pointer.
8735 /// - `bytesize`: Requested allocation size in bytes.
8736 /// - `flags`: Must be one of [`CUmemAttach_flags_enum::CU_MEM_ATTACH_GLOBAL`] or [`CUmemAttach_flags_enum::CU_MEM_ATTACH_HOST`].
8737 pub fn cuMemAllocManaged(
8738 dptr: *mut CUdeviceptr,
8739 bytesize: size_t,
8740 flags: ::core::ffi::c_uint,
8741 ) -> CUresult;
8742}
8743unsafe extern "C" {
8744 /// Registers a callback function to receive async notifications.
8745 ///
8746 /// Registers callbackFunc to receive async notifications.
8747 ///
8748 /// The userData parameter is passed to the callback function at async notification time. Likewise, callback is also passed to the callback function to distinguish between multiple registered callbacks.
8749 ///
8750 /// The callback function being registered should be designed to return quickly (~10ms). Any long running tasks should be queued
8751 /// for execution on an application thread.
8752 ///
8753 /// Callbacks may not call cuDeviceRegisterAsyncNotification or cuDeviceUnregisterAsyncNotification. Doing so will result in [`cudaError_enum::CUDA_ERROR_NOT_PERMITTED`]. Async notification callbacks execute in an undefined order and may be serialized.
8754 ///
8755 /// Returns in \*callback a handle representing the registered callback instance.
8756 ///
8757 /// Note:
8758 ///
8759 /// Note that this function may also return error codes from previous, asynchronous launches.
8760 ///
8761 /// **See also:**
8762 ///
8763 /// [`cuDeviceUnregisterAsyncNotification`].
8764 ///
8765 /// # Parameters
8766 ///
8767 /// - `device`: The device on which to register the callback.
8768 /// - `callbackFunc`: The function to register as a callback.
8769 /// - `userData`: A generic pointer to user data. This is passed into the callback function.
8770 /// - `callback`: A handle representing the registered callback instance.
8771 pub fn cuDeviceRegisterAsyncNotification(
8772 device: CUdevice,
8773 callbackFunc: CUasyncCallback,
8774 userData: *mut ::core::ffi::c_void,
8775 callback: *mut CUasyncCallbackHandle,
8776 ) -> CUresult;
8777}
8778unsafe extern "C" {
8779 /// Unregisters an async notification callback.
8780 ///
8781 /// Unregisters callback so that the corresponding callback function will stop receiving async notifications.
8782 ///
8783 /// Note:
8784 ///
8785 /// Note that this function may also return error codes from previous, asynchronous launches.
8786 ///
8787 /// **See also:**
8788 ///
8789 /// [`cuDeviceRegisterAsyncNotification`].
8790 ///
8791 /// # Parameters
8792 ///
8793 /// - `device`: The device from which to remove callback.
8794 /// - `callback`: The callback instance to unregister from receiving async notifications.
8795 pub fn cuDeviceUnregisterAsyncNotification(
8796 device: CUdevice,
8797 callback: CUasyncCallbackHandle,
8798 ) -> CUresult;
8799}
8800unsafe extern "C" {
8801 /// Returns a handle to a compute device.
8802 ///
8803 /// Returns in \*device a device handle given a PCI bus ID string.
8804 ///
8805 /// Note:
8806 ///
8807 /// Note that this function may also return error codes from previous, asynchronous launches.
8808 ///
8809 /// **See also:**
8810 ///
8811 /// [`cuDeviceGet`], [`cuDeviceGetAttribute`], [`cuDeviceGetPCIBusId`], [cudaDeviceGetByPCIBusId](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g65f57fb8d0981ca03f6f9b20031c3e5d).
8812 ///
8813 /// # Parameters
8814 ///
8815 /// - `dev`: Returned device handle.
8816 /// - `pciBusId`: String in one of the following forms: \[domain\]:\[bus\]:\[device\].\[function\] \[domain\]:\[bus\]:\[device\] \[bus\]:\[device\].\[function\]
8817 /// where domain, bus, device, and function are all hexadecimal values.
8818 pub fn cuDeviceGetByPCIBusId(
8819 dev: *mut CUdevice,
8820 pciBusId: *const ::core::ffi::c_char,
8821 ) -> CUresult;
8822}
8823unsafe extern "C" {
8824 /// Returns a PCI Bus Id string for the device.
8825 ///
8826 /// Returns an ASCII string identifying the device dev in the NULL-terminated string pointed to by pciBusId. len specifies the maximum length of the string that may be returned.
8827 ///
8828 /// Note:
8829 ///
8830 /// Note that this function may also return error codes from previous, asynchronous launches.
8831 ///
8832 /// **See also:**
8833 ///
8834 /// [`cuDeviceGet`], [`cuDeviceGetAttribute`], [`cuDeviceGetByPCIBusId`], [cudaDeviceGetPCIBusId](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1gea264dad3d8c4898e0b82213c0253def).
8835 ///
8836 /// # Parameters
8837 ///
8838 /// - `pciBusId`: Returned identifier string for the device in the following format \[domain\]:\[bus\]:\[device\].\[function\] where domain, bus, device, and function are all hexadecimal values. pciBusId should be large enough to store 13 characters including the NULL-terminator.
8839 /// - `len`: Maximum length of string to store in name.
8840 /// - `dev`: Device to get identifier string for.
8841 pub fn cuDeviceGetPCIBusId(
8842 pciBusId: *mut ::core::ffi::c_char,
8843 len: ::core::ffi::c_int,
8844 dev: CUdevice,
8845 ) -> CUresult;
8846}
8847unsafe extern "C" {
8848 /// Gets an interprocess handle for a previously allocated event.
8849 ///
8850 /// Takes as input a previously allocated event. This event must have been created with the [`CUevent_flags_enum::CU_EVENT_INTERPROCESS`] and [`CUevent_flags_enum::CU_EVENT_DISABLE_TIMING`] flags set. This opaque handle may be copied into other processes and opened with [`cuIpcOpenEventHandle`] to allow efficient hardware synchronization between GPU work in different processes.
8851 ///
8852 /// After the event has been opened in the importing process, [`cuEventRecord`], [`cuEventSynchronize`], [`cuStreamWaitEvent`] and [`cuEventQuery`] may be used in either process. Performing operations on the imported event after the exported event has been freed with [`cuEventDestroy_v2`] will result in undefined behavior.
8853 ///
8854 /// IPC functionality is restricted to devices with support for unified addressing on Linux and Windows operating systems. IPC
8855 /// functionality on Windows is supported for compatibility purposes but not recommended as it comes with performance cost. Users
8856 /// can test their device for IPC functionality by calling [`cuDeviceGetAttribute`] with [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED`]
8857 ///
8858 /// **See also:**
8859 ///
8860 /// [`cuEventCreate`], [`cuEventDestroy_v2`], [`cuEventSynchronize`], [`cuEventQuery`], [`cuStreamWaitEvent`], [`cuIpcOpenEventHandle`], [`cuIpcGetMemHandle`], [`cuIpcOpenMemHandle_v2`], [`cuIpcCloseMemHandle`], [cudaIpcGetEventHandle](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g89a3abe1e9a11d08c665176669109784).
8861 ///
8862 /// # Parameters
8863 ///
8864 /// - `pHandle`: Pointer to a user allocated CUipcEventHandle in which to return the opaque event handle.
8865 /// - `event`: Event allocated with [`CUevent_flags_enum::CU_EVENT_INTERPROCESS`] and [`CUevent_flags_enum::CU_EVENT_DISABLE_TIMING`] flags.
8866 pub fn cuIpcGetEventHandle(
8867 pHandle: *mut CUipcEventHandle,
8868 event: CUevent,
8869 ) -> CUresult;
8870}
8871unsafe extern "C" {
8872 /// Opens an interprocess event handle for use in the current process.
8873 ///
8874 /// Opens an interprocess event handle exported from another process with [`cuIpcGetEventHandle`]. This function returns a [`CUevent`] that behaves like a locally created event with the [`CUevent_flags_enum::CU_EVENT_DISABLE_TIMING`] flag specified. This event must be freed with [`cuEventDestroy_v2`].
8875 ///
8876 /// Performing operations on the imported event after the exported event has been freed with [`cuEventDestroy_v2`] will result in undefined behavior.
8877 ///
8878 /// IPC functionality is restricted to devices with support for unified addressing on Linux and Windows operating systems. IPC
8879 /// functionality on Windows is supported for compatibility purposes but not recommended as it comes with performance cost. Users
8880 /// can test their device for IPC functionality by calling cuapiDeviceGetAttribute with [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED`]
8881 ///
8882 /// **See also:**
8883 ///
8884 /// [`cuEventCreate`], [`cuEventDestroy_v2`], [`cuEventSynchronize`], [`cuEventQuery`], [`cuStreamWaitEvent`], [`cuIpcGetEventHandle`], [`cuIpcGetMemHandle`], [`cuIpcOpenMemHandle_v2`], [`cuIpcCloseMemHandle`], [cudaIpcOpenEventHandle](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g9691446ab0aec1d6e528357387ed87b2).
8885 ///
8886 /// # Parameters
8887 ///
8888 /// - `phEvent`: Returns the imported event.
8889 /// - `handle`: Interprocess handle to open.
8890 pub fn cuIpcOpenEventHandle(
8891 phEvent: *mut CUevent,
8892 handle: CUipcEventHandle,
8893 ) -> CUresult;
8894}
8895unsafe extern "C" {
8896 /// Gets an interprocess memory handle for an existing device memory allocation.
8897 ///
8898 /// Takes a pointer to the base of an existing device memory allocation created with [`cuMemAlloc_v2`] and exports it for use in another process. This is a lightweight operation and may be called multiple times on an allocation
8899 /// without adverse effects.
8900 ///
8901 /// If a region of memory is freed with [`cuMemFree_v2`] and a subsequent call to [`cuMemAlloc_v2`] returns memory with the same device address, [`cuIpcGetMemHandle`] will return a unique handle for the new memory.
8902 ///
8903 /// IPC functionality is restricted to devices with support for unified addressing on Linux and Windows operating systems. IPC
8904 /// functionality on Windows is supported for compatibility purposes but not recommended as it comes with performance cost. Users
8905 /// can test their device for IPC functionality by calling cuapiDeviceGetAttribute with [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED`]
8906 ///
8907 /// **See also:**
8908 ///
8909 /// [`cuMemAlloc_v2`], [`cuMemFree_v2`], [`cuIpcGetEventHandle`], [`cuIpcOpenEventHandle`], [`cuIpcOpenMemHandle_v2`], [`cuIpcCloseMemHandle`], [cudaIpcGetMemHandle](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g8a37f7dfafaca652391d0758b3667539).
8910 ///
8911 /// # Parameters
8912 ///
8913 /// - `pHandle`: Pointer to user allocated CUipcMemHandle to return the handle in.
8914 /// - `dptr`: Base pointer to previously allocated device memory.
8915 pub fn cuIpcGetMemHandle(
8916 pHandle: *mut CUipcMemHandle,
8917 dptr: CUdeviceptr,
8918 ) -> CUresult;
8919}
8920unsafe extern "C" {
8921 /// Opens an interprocess memory handle exported from another process and returns a device pointer usable in the local process.
8922 ///
8923 /// Maps memory exported from another process with [`cuIpcGetMemHandle`] into the current device address space. For contexts on different devices [`cuIpcOpenMemHandle_v2`] can attempt to enable peer access between the devices as if the user called [`cuCtxEnablePeerAccess`]. This behavior is controlled by the [`CUipcMem_flags_enum::CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS`] flag. [`cuDeviceCanAccessPeer`] can determine if a mapping is possible.
8924 ///
8925 /// Contexts that may open CUipcMemHandles are restricted in the following way. CUipcMemHandles from each [`CUdevice`] in a given process may only be opened by one [`CUcontext`] per [`CUdevice`] per other process.
8926 ///
8927 /// If the memory handle has already been opened by the current context, the reference count on the handle is incremented by 1
8928 /// and the existing device pointer is returned.
8929 ///
8930 /// Memory returned from [`cuIpcOpenMemHandle_v2`] must be freed with [`cuIpcCloseMemHandle`].
8931 ///
8932 /// Calling [`cuMemFree_v2`] on an exported memory region before calling [`cuIpcCloseMemHandle`] in the importing context will result in undefined behavior.
8933 ///
8934 /// IPC functionality is restricted to devices with support for unified addressing on Linux and Windows operating systems. IPC
8935 /// functionality on Windows is supported for compatibility purposes but not recommended as it comes with performance cost. Users
8936 /// can test their device for IPC functionality by calling cuapiDeviceGetAttribute with [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED`]
8937 ///
8938 /// Note:
8939 ///
8940 /// No guarantees are made about the address returned in \*pdptr. In particular, multiple processes may not receive the same address for the same handle.
8941 ///
8942 /// **See also:**
8943 ///
8944 /// [`cuMemAlloc_v2`], [`cuMemFree_v2`], [`cuIpcGetEventHandle`], [`cuIpcOpenEventHandle`], [`cuIpcGetMemHandle`], [`cuIpcCloseMemHandle`], [`cuCtxEnablePeerAccess`], [`cuDeviceCanAccessPeer`], [cudaIpcOpenMemHandle](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g01050a29fefde385b1042081ada4cde9).
8945 ///
8946 /// # Parameters
8947 ///
8948 /// - `pdptr`: Returned device pointer.
8949 /// - `handle`: CUipcMemHandle to open.
8950 /// - `Flags`: Flags for this operation. Must be specified as [`CUipcMem_flags_enum::CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS`].
8951 pub fn cuIpcOpenMemHandle_v2(
8952 pdptr: *mut CUdeviceptr,
8953 handle: CUipcMemHandle,
8954 Flags: ::core::ffi::c_uint,
8955 ) -> CUresult;
8956}
8957unsafe extern "C" {
8958 /// Attempts to close memory mapped with cuIpcOpenMemHandle.
8959 ///
8960 /// Decrements the reference count of the memory returned by [`cuIpcOpenMemHandle_v2`] by 1. When the reference count reaches 0, this API unmaps the memory. The original allocation in the exporting process as
8961 /// well as imported mappings in other processes will be unaffected.
8962 ///
8963 /// Any resources used to enable peer access will be freed if this is the last mapping using them.
8964 ///
8965 /// IPC functionality is restricted to devices with support for unified addressing on Linux and Windows operating systems. IPC
8966 /// functionality on Windows is supported for compatibility purposes but not recommended as it comes with performance cost. Users
8967 /// can test their device for IPC functionality by calling cuapiDeviceGetAttribute with [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED`]
8968 ///
8969 /// **See also:**
8970 ///
8971 /// [`cuMemAlloc_v2`], [`cuMemFree_v2`], [`cuIpcGetEventHandle`], [`cuIpcOpenEventHandle`], [`cuIpcGetMemHandle`], [`cuIpcOpenMemHandle_v2`], [cudaIpcCloseMemHandle](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g02bb3632b5d223db6acae5f8744e2c91).
8972 ///
8973 /// # Parameters
8974 ///
8975 /// - `dptr`: Device pointer returned by [`cuIpcOpenMemHandle_v2`].
8976 pub fn cuIpcCloseMemHandle(dptr: CUdeviceptr) -> CUresult;
8977}
8978unsafe extern "C" {
8979 /// Registers an existing host memory range for use by CUDA.
8980 ///
8981 /// Page-locks the memory range specified by p and bytesize and maps it for the device(s) as specified by Flags. This memory range also is added to the same tracking mechanism as [`cuMemHostAlloc`] to automatically accelerate calls to functions such as [`cuMemcpyHtoD_v2`]. Since the memory can be accessed directly by the device, it can be read or written with much higher bandwidth than pageable
8982 /// memory that has not been registered. Page-locking excessive amounts of memory may degrade system performance, since it reduces
8983 /// the amount of memory available to the system for paging. As a result, this function is best used sparingly to register staging
8984 /// areas for data exchange between host and device.
8985 ///
8986 /// On systems where [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES`] is true, [`cuMemHostRegister_v2`] will not page-lock the memory range specified by ptr but only populate unpopulated pages.
8987 ///
8988 /// The Flags parameter enables different options to be specified that affect the allocation, as follows.
8989 ///
8990 /// * [`CU_MEMHOSTREGISTER_PORTABLE`]: The memory returned by this call will be considered as pinned memory by all CUDA contexts, not just the one that performed
8991 /// the allocation.
8992 ///
8993 /// * [`CU_MEMHOSTREGISTER_DEVICEMAP`]: Maps the allocation into the CUDA address space. The device pointer to the memory may be obtained by calling [`cuMemHostGetDevicePointer_v2`].
8994 ///
8995 /// * [`CU_MEMHOSTREGISTER_IOMEMORY`]: The pointer is treated as pointing to some I/O memory space, e.g. the PCI Express resource of a 3rd party device.
8996 ///
8997 /// * [`CU_MEMHOSTREGISTER_READ_ONLY`]: The pointer is treated as pointing to memory that is considered read-only by the device. On platforms without [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES`], this flag is required in order to register memory mapped to the CPU as read-only. Support for the use of this flag can be
8998 /// queried from the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED`]. Using this flag with a current context associated with a device that does not have this attribute set will cause [`cuMemHostRegister_v2`] to error with [`CUresult::CUDA_ERROR_NOT_SUPPORTED`].
8999 ///
9000 /// All of these flags are orthogonal to one another: a developer may page-lock memory that is portable or mapped with no restrictions.
9001 ///
9002 /// The [`CU_MEMHOSTREGISTER_DEVICEMAP`] flag may be specified on CUDA contexts for devices that do not support mapped pinned memory. The failure is deferred to [`cuMemHostGetDevicePointer_v2`] because the memory may be mapped into other CUDA contexts via the [`CU_MEMHOSTREGISTER_PORTABLE`] flag.
9003 ///
9004 /// For devices that have a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM`], the memory can also be accessed from the device using the host pointer p. The device pointer returned by [`cuMemHostGetDevicePointer_v2`] may or may not match the original host pointer ptr and depends on the devices visible to the application. If all devices visible to the application have a non-zero value for
9005 /// the device attribute, the device pointer returned by [`cuMemHostGetDevicePointer_v2`] will match the original pointer ptr. If any device visible to the application has a zero value for the device attribute, the device pointer returned by [`cuMemHostGetDevicePointer_v2`] will not match the original host pointer ptr, but it will be suitable for use on all devices provided Unified Virtual Addressing is enabled. In such systems, it is valid
9006 /// to access the memory using either pointer on devices that have a non-zero value for the device attribute. Note however that
9007 /// such devices should access the memory using only of the two pointers and not both.
9008 ///
9009 /// The memory page-locked by this function must be unregistered with [`cuMemHostUnregister`].
9010 ///
9011 /// Note:
9012 ///
9013 /// Note that this function may also return error codes from previous, asynchronous launches.
9014 ///
9015 /// **See also:**
9016 ///
9017 /// [`cuMemHostUnregister`], [`cuMemHostGetFlags`], [`cuMemHostGetDevicePointer_v2`], [cudaHostRegister](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1ge8d5c17670f16ac4fc8fcb4181cb490c).
9018 ///
9019 /// # Parameters
9020 ///
9021 /// - `p`: Host pointer to memory to page-lock.
9022 /// - `bytesize`: Size in bytes of the address range to page-lock.
9023 /// - `Flags`: Flags for allocation request.
9024 pub fn cuMemHostRegister_v2(
9025 p: *mut ::core::ffi::c_void,
9026 bytesize: size_t,
9027 Flags: ::core::ffi::c_uint,
9028 ) -> CUresult;
9029}
9030unsafe extern "C" {
9031 /// Unregisters a memory range that was registered with cuMemHostRegister.
9032 ///
9033 /// Unmaps the memory range whose base address is specified by p, and makes it pageable again.
9034 ///
9035 /// The base address must be the same one specified to [`cuMemHostRegister_v2`].
9036 ///
9037 /// Note:
9038 ///
9039 /// Note that this function may also return error codes from previous, asynchronous launches.
9040 ///
9041 /// **See also:**
9042 ///
9043 /// [`cuMemHostRegister_v2`], [cudaHostUnregister](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g81fd4101862bbefdb42a62d60e515eea).
9044 ///
9045 /// # Parameters
9046 ///
9047 /// - `p`: Host pointer to memory to unregister.
9048 pub fn cuMemHostUnregister(p: *mut ::core::ffi::c_void) -> CUresult;
9049}
9050unsafe extern "C" {
9051 /// Copies memory.
9052 ///
9053 /// Copies data between two pointers. dst and src are base pointers of the destination and source, respectively. ByteCount specifies the number of bytes to copy. Note that this function infers the type of the transfer (host to host, host to device,
9054 /// device to device, or device to host) from the pointer values. This function is only allowed in contexts which support unified
9055 /// addressing.
9056 ///
9057 /// Note:
9058 ///
9059 /// * Note that this function may also return error codes from previous, asynchronous launches.
9060 /// * This function exhibits [synchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-sync) behavior for most use cases.
9061 /// * Memory regions requested must be either entirely registered with CUDA, or in the case of host pageable transfers, not registered
9062 /// at all. Memory regions spanning over allocations that are both registered and not registered with CUDA are not supported and
9063 /// will return [`CUresult::CUDA_ERROR_INVALID_VALUE`].
9064 ///
9065 /// **See also:**
9066 ///
9067 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMemcpy](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1gc263dbe6574220cc776b45438fc351e8), [cudaMemcpyToSymbol](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g4561bf9c99d91c92684a91a0bd356bfe), [cudaMemcpyFromSymbol](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g99db510d18d37fbb0f5c075a8caf3b5f).
9068 ///
9069 /// # Parameters
9070 ///
9071 /// - `dst`: Destination unified virtual address space pointer.
9072 /// - `src`: Source unified virtual address space pointer.
9073 /// - `ByteCount`: Size of memory copy in bytes.
9074 pub fn cuMemcpy(dst: CUdeviceptr, src: CUdeviceptr, ByteCount: size_t) -> CUresult;
9075}
9076unsafe extern "C" {
9077 /// Copies device memory between two contexts.
9078 ///
9079 /// Copies from device memory in one context to device memory in another context. dstDevice is the base device pointer of the destination memory and dstContext is the destination context. srcDevice is the base device pointer of the source memory and srcContext is the source pointer. ByteCount specifies the number of bytes to copy.
9080 ///
9081 /// Note:
9082 ///
9083 /// * Note that this function may also return error codes from previous, asynchronous launches.
9084 /// * This function exhibits [synchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-sync) behavior for most use cases.
9085 ///
9086 /// **See also:**
9087 ///
9088 /// [`cuMemcpyDtoD_v2`], [`cuMemcpy3DPeer`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyPeerAsync`], [`cuMemcpy3DPeerAsync`], [cudaMemcpyPeer](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g88fd1245b2cb10d2d30c74900b7dfb9c).
9089 ///
9090 /// # Parameters
9091 ///
9092 /// - `dstDevice`: Destination device pointer.
9093 /// - `dstContext`: Destination context.
9094 /// - `srcDevice`: Source device pointer.
9095 /// - `srcContext`: Source context.
9096 /// - `ByteCount`: Size of memory copy in bytes.
9097 pub fn cuMemcpyPeer(
9098 dstDevice: CUdeviceptr,
9099 dstContext: CUcontext,
9100 srcDevice: CUdeviceptr,
9101 srcContext: CUcontext,
9102 ByteCount: size_t,
9103 ) -> CUresult;
9104}
9105unsafe extern "C" {
9106 /// Copies memory from Host to Device.
9107 ///
9108 /// Copies from host memory to device memory. dstDevice and srcHost are the base addresses of the destination and source, respectively. ByteCount specifies the number of bytes to copy.
9109 ///
9110 /// Note:
9111 ///
9112 /// * Note that this function may also return error codes from previous, asynchronous launches.
9113 /// * This function exhibits [synchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-sync) behavior for most use cases.
9114 /// * Memory regions requested must be either entirely registered with CUDA, or in the case of host pageable transfers, not registered
9115 /// at all. Memory regions spanning over allocations that are both registered and not registered with CUDA are not supported and
9116 /// will return [`CUresult::CUDA_ERROR_INVALID_VALUE`].
9117 ///
9118 /// **See also:**
9119 ///
9120 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMemcpy](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1gc263dbe6574220cc776b45438fc351e8), [cudaMemcpyToSymbol](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g4561bf9c99d91c92684a91a0bd356bfe).
9121 ///
9122 /// # Parameters
9123 ///
9124 /// - `dstDevice`: Destination device pointer.
9125 /// - `srcHost`: Source host pointer.
9126 /// - `ByteCount`: Size of memory copy in bytes.
9127 pub fn cuMemcpyHtoD_v2(
9128 dstDevice: CUdeviceptr,
9129 srcHost: *const ::core::ffi::c_void,
9130 ByteCount: size_t,
9131 ) -> CUresult;
9132}
9133unsafe extern "C" {
9134 /// Copies memory from Device to Host.
9135 ///
9136 /// Copies from device to host memory. dstHost and srcDevice specify the base pointers of the destination and source, respectively. ByteCount specifies the number of bytes to copy.
9137 ///
9138 /// Note:
9139 ///
9140 /// * Note that this function may also return error codes from previous, asynchronous launches.
9141 /// * This function exhibits [synchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-sync) behavior for most use cases.
9142 /// * Memory regions requested must be either entirely registered with CUDA, or in the case of host pageable transfers, not registered
9143 /// at all. Memory regions spanning over allocations that are both registered and not registered with CUDA are not supported and
9144 /// will return [`CUresult::CUDA_ERROR_INVALID_VALUE`].
9145 ///
9146 /// **See also:**
9147 ///
9148 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMemcpy](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1gc263dbe6574220cc776b45438fc351e8), [cudaMemcpyFromSymbol](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g99db510d18d37fbb0f5c075a8caf3b5f).
9149 ///
9150 /// # Parameters
9151 ///
9152 /// - `dstHost`: Destination host pointer.
9153 /// - `srcDevice`: Source device pointer.
9154 /// - `ByteCount`: Size of memory copy in bytes.
9155 pub fn cuMemcpyDtoH_v2(
9156 dstHost: *mut ::core::ffi::c_void,
9157 srcDevice: CUdeviceptr,
9158 ByteCount: size_t,
9159 ) -> CUresult;
9160}
9161unsafe extern "C" {
9162 /// Copies memory from Device to Device.
9163 ///
9164 /// Copies from device memory to device memory. dstDevice and srcDevice are the base pointers of the destination and source, respectively. ByteCount specifies the number of bytes to copy.
9165 ///
9166 /// Note:
9167 ///
9168 /// * Note that this function may also return error codes from previous, asynchronous launches.
9169 /// * This function exhibits [synchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-sync) behavior for most use cases.
9170 ///
9171 /// **See also:**
9172 ///
9173 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMemcpy](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1gc263dbe6574220cc776b45438fc351e8), [cudaMemcpyToSymbol](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g4561bf9c99d91c92684a91a0bd356bfe), [cudaMemcpyFromSymbol](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g99db510d18d37fbb0f5c075a8caf3b5f).
9174 ///
9175 /// # Parameters
9176 ///
9177 /// - `dstDevice`: Destination device pointer.
9178 /// - `srcDevice`: Source device pointer.
9179 /// - `ByteCount`: Size of memory copy in bytes.
9180 pub fn cuMemcpyDtoD_v2(
9181 dstDevice: CUdeviceptr,
9182 srcDevice: CUdeviceptr,
9183 ByteCount: size_t,
9184 ) -> CUresult;
9185}
9186unsafe extern "C" {
9187 /// Copies memory from Device to Array.
9188 ///
9189 /// Copies from device memory to a 1D CUDA array. dstArray and dstOffset specify the CUDA array handle and starting index of the destination data. srcDevice specifies the base pointer of the source. ByteCount specifies the number of bytes to copy.
9190 ///
9191 /// Note:
9192 ///
9193 /// * Note that this function may also return error codes from previous, asynchronous launches.
9194 /// * This function exhibits [synchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-sync) behavior for most use cases.
9195 ///
9196 /// **See also:**
9197 ///
9198 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMemcpyToArray](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY__DEPRECATED.html#group__CUDART__MEMORY__DEPRECATED_1g15b5d20cedf31dd13801c6015da0e828).
9199 ///
9200 /// # Parameters
9201 ///
9202 /// - `dstArray`: Destination array.
9203 /// - `dstOffset`: Offset in bytes of destination array.
9204 /// - `srcDevice`: Source device pointer.
9205 /// - `ByteCount`: Size of memory copy in bytes.
9206 pub fn cuMemcpyDtoA_v2(
9207 dstArray: CUarray,
9208 dstOffset: size_t,
9209 srcDevice: CUdeviceptr,
9210 ByteCount: size_t,
9211 ) -> CUresult;
9212}
9213unsafe extern "C" {
9214 /// Copies memory from Array to Device.
9215 ///
9216 /// Copies from one 1D CUDA array to device memory. dstDevice specifies the base pointer of the destination and must be naturally aligned with the CUDA array elements. srcArray and srcOffset specify the CUDA array handle and the offset in bytes into the array where the copy is to begin. ByteCount specifies the number of bytes to copy and must be evenly divisible by the array element size.
9217 ///
9218 /// Note:
9219 ///
9220 /// * Note that this function may also return error codes from previous, asynchronous launches.
9221 /// * This function exhibits [synchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-sync) behavior for most use cases.
9222 ///
9223 /// **See also:**
9224 ///
9225 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMemcpyFromArray](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY__DEPRECATED.html#group__CUDART__MEMORY__DEPRECATED_1g6fbe8ed786061afaeaf79dc17eef15e9).
9226 ///
9227 /// # Parameters
9228 ///
9229 /// - `dstDevice`: Destination device pointer.
9230 /// - `srcArray`: Source array.
9231 /// - `srcOffset`: Offset in bytes of source array.
9232 /// - `ByteCount`: Size of memory copy in bytes.
9233 pub fn cuMemcpyAtoD_v2(
9234 dstDevice: CUdeviceptr,
9235 srcArray: CUarray,
9236 srcOffset: size_t,
9237 ByteCount: size_t,
9238 ) -> CUresult;
9239}
9240unsafe extern "C" {
9241 /// Copies memory from Host to Array.
9242 ///
9243 /// Copies from host memory to a 1D CUDA array. dstArray and dstOffset specify the CUDA array handle and starting offset in bytes of the destination data. pSrc specifies the base address of the source. ByteCount specifies the number of bytes to copy.
9244 ///
9245 /// Note:
9246 ///
9247 /// * Note that this function may also return error codes from previous, asynchronous launches.
9248 /// * This function exhibits [synchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-sync) behavior for most use cases.
9249 /// * Memory regions requested must be either entirely registered with CUDA, or in the case of host pageable transfers, not registered
9250 /// at all. Memory regions spanning over allocations that are both registered and not registered with CUDA are not supported and
9251 /// will return [`CUresult::CUDA_ERROR_INVALID_VALUE`].
9252 ///
9253 /// **See also:**
9254 ///
9255 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMemcpyToArray](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY__DEPRECATED.html#group__CUDART__MEMORY__DEPRECATED_1g15b5d20cedf31dd13801c6015da0e828).
9256 ///
9257 /// # Parameters
9258 ///
9259 /// - `dstArray`: Destination array.
9260 /// - `dstOffset`: Offset in bytes of destination array.
9261 /// - `srcHost`: Source host pointer.
9262 /// - `ByteCount`: Size of memory copy in bytes.
9263 pub fn cuMemcpyHtoA_v2(
9264 dstArray: CUarray,
9265 dstOffset: size_t,
9266 srcHost: *const ::core::ffi::c_void,
9267 ByteCount: size_t,
9268 ) -> CUresult;
9269}
9270unsafe extern "C" {
9271 /// Copies memory from Array to Host.
9272 ///
9273 /// Copies from one 1D CUDA array to host memory. dstHost specifies the base pointer of the destination. srcArray and srcOffset specify the CUDA array handle and starting offset in bytes of the source data. ByteCount specifies the number of bytes to copy.
9274 ///
9275 /// Note:
9276 ///
9277 /// * Note that this function may also return error codes from previous, asynchronous launches.
9278 /// * This function exhibits [synchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-sync) behavior for most use cases.
9279 /// * Memory regions requested must be either entirely registered with CUDA, or in the case of host pageable transfers, not registered
9280 /// at all. Memory regions spanning over allocations that are both registered and not registered with CUDA are not supported and
9281 /// will return [`CUresult::CUDA_ERROR_INVALID_VALUE`].
9282 ///
9283 /// **See also:**
9284 ///
9285 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMemcpyFromArray](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY__DEPRECATED.html#group__CUDART__MEMORY__DEPRECATED_1g6fbe8ed786061afaeaf79dc17eef15e9).
9286 ///
9287 /// # Parameters
9288 ///
9289 /// - `dstHost`: Destination device pointer.
9290 /// - `srcArray`: Source array.
9291 /// - `srcOffset`: Offset in bytes of source array.
9292 /// - `ByteCount`: Size of memory copy in bytes.
9293 pub fn cuMemcpyAtoH_v2(
9294 dstHost: *mut ::core::ffi::c_void,
9295 srcArray: CUarray,
9296 srcOffset: size_t,
9297 ByteCount: size_t,
9298 ) -> CUresult;
9299}
9300unsafe extern "C" {
9301 /// Copies memory from Array to Array.
9302 ///
9303 /// Copies from one 1D CUDA array to another. dstArray and srcArray specify the handles of the destination and source CUDA arrays for the copy, respectively. dstOffset and srcOffset specify the destination and source offsets in bytes into the CUDA arrays. ByteCount is the number of bytes to be copied. The size of the elements in the CUDA arrays need not be the same format, but the elements
9304 /// must be the same size; and count must be evenly divisible by that size.
9305 ///
9306 /// Note:
9307 ///
9308 /// * Note that this function may also return error codes from previous, asynchronous launches.
9309 /// * This function exhibits [synchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-sync) behavior for most use cases.
9310 ///
9311 /// **See also:**
9312 ///
9313 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMemcpyArrayToArray](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY__DEPRECATED.html#group__CUDART__MEMORY__DEPRECATED_1g5daffa65811c6be7eba1ec3c6c19ddb0).
9314 ///
9315 /// # Parameters
9316 ///
9317 /// - `dstArray`: Destination array.
9318 /// - `dstOffset`: Offset in bytes of destination array.
9319 /// - `srcArray`: Source array.
9320 /// - `srcOffset`: Offset in bytes of source array.
9321 /// - `ByteCount`: Size of memory copy in bytes.
9322 pub fn cuMemcpyAtoA_v2(
9323 dstArray: CUarray,
9324 dstOffset: size_t,
9325 srcArray: CUarray,
9326 srcOffset: size_t,
9327 ByteCount: size_t,
9328 ) -> CUresult;
9329}
9330unsafe extern "C" {
9331 /// Copies memory for 2D arrays.
9332 ///
9333 /// Perform a 2D memory copy according to the parameters specified in pCopy. The CUDA_MEMCPY2D structure is defined as:
9334 ///
9335 /// ```text
9336 /// typedef struct CUDA_MEMCPY2D_st {
9337 /// unsigned int srcXInBytes, srcY;
9338 /// CUmemorytype srcMemoryType;
9339 /// const void *srcHost;
9340 /// CUdeviceptr srcDevice;
9341 /// CUarray srcArray;
9342 /// unsigned int srcPitch;
9343 ///
9344 /// unsigned int dstXInBytes, dstY;
9345 /// CUmemorytype dstMemoryType;
9346 /// void *dstHost;
9347 /// CUdeviceptr dstDevice;
9348 /// CUarray dstArray;
9349 /// unsigned int dstPitch;
9350 ///
9351 /// unsigned int WidthInBytes;
9352 /// unsigned int Height;
9353 /// } CUDA_MEMCPY2D;
9354 /// ```
9355 ///
9356 /// where:
9357 ///
9358 /// * srcMemoryType and dstMemoryType specify the type of memory of the source and destination, respectively; CUmemorytype_enum
9359 /// is defined as:
9360 ///
9361 /// ```text
9362 /// typedef enum CUmemorytype_enum {
9363 /// CU_MEMORYTYPE_HOST = 0x01,
9364 /// CU_MEMORYTYPE_DEVICE = 0x02,
9365 /// CU_MEMORYTYPE_ARRAY = 0x03,
9366 /// CU_MEMORYTYPE_UNIFIED = 0x04
9367 /// } CUmemorytype;
9368 /// ```
9369 ///
9370 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_UNIFIED`], srcDevice and srcPitch specify the (unified virtual address space) base address of the source data and the bytes per row
9371 /// to apply. srcArray is ignored. This value may be used only if unified addressing is supported in the calling context.
9372 ///
9373 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_HOST`], srcHost and srcPitch specify the (host) base address of the source data and the bytes per row to apply. srcArray is ignored.
9374 ///
9375 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_DEVICE`], srcDevice and srcPitch specify the (device) base address of the source data and the bytes per row to apply. srcArray is
9376 /// ignored.
9377 ///
9378 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_ARRAY`], srcArray specifies the handle of the source data. srcHost, srcDevice and srcPitch are ignored.
9379 ///
9380 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_HOST`], dstHost and dstPitch specify the (host) base address of the destination data and the bytes per row to apply. dstArray is
9381 /// ignored.
9382 ///
9383 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_UNIFIED`], dstDevice and dstPitch specify the (unified virtual address space) base address of the source data and the bytes per row
9384 /// to apply. dstArray is ignored. This value may be used only if unified addressing is supported in the calling context.
9385 ///
9386 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_DEVICE`], dstDevice and dstPitch specify the (device) base address of the destination data and the bytes per row to apply. dstArray
9387 /// is ignored.
9388 ///
9389 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_ARRAY`], dstArray specifies the handle of the destination data. dstHost, dstDevice and dstPitch are ignored.
9390 ///
9391 /// * srcXInBytes and srcY specify the base address of the source data for the copy.
9392 ///
9393 /// For host pointers, the starting address is
9394 ///
9395 /// ```text
9396 /// void* Start = (void*)((char*)srcHost+srcY*srcPitch + srcXInBytes);
9397 /// ```
9398 ///
9399 /// For device pointers, the starting address is
9400 ///
9401 /// ```text
9402 /// CUdeviceptr Start = srcDevice+srcY*srcPitch+srcXInBytes;
9403 /// ```
9404 ///
9405 /// For CUDA arrays, srcXInBytes must be evenly divisible by the array element size.
9406 ///
9407 /// * dstXInBytes and dstY specify the base address of the destination data for the copy.
9408 ///
9409 /// For host pointers, the base address is
9410 ///
9411 /// ```text
9412 /// void* dstStart = (void*)((char*)dstHost+dstY*dstPitch + dstXInBytes);
9413 /// ```
9414 ///
9415 /// For device pointers, the starting address is
9416 ///
9417 /// ```text
9418 /// CUdeviceptr dstStart = dstDevice+dstY*dstPitch+dstXInBytes;
9419 /// ```
9420 ///
9421 /// For CUDA arrays, dstXInBytes must be evenly divisible by the array element size.
9422 ///
9423 /// * WidthInBytes and Height specify the width (in bytes) and height of the 2D copy being performed.
9424 /// * If specified, srcPitch must be greater than or equal to WidthInBytes + srcXInBytes, and dstPitch must be greater than or equal
9425 /// to WidthInBytes + dstXInBytes.
9426 ///
9427 /// [`cuMemcpy2D_v2`] returns an error if any pitch is greater than the maximum allowed ([`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAX_PITCH`]). [`cuMemAllocPitch_v2`] passes back pitches that always work with [`cuMemcpy2D_v2`]. On intra-device memory copies (device to device, CUDA array to device, CUDA array to CUDA array), [`cuMemcpy2D_v2`] may fail for pitches not computed by [`cuMemAllocPitch_v2`]. [`cuMemcpy2DUnaligned_v2`] does not have this restriction, but may run significantly slower in the cases where [`cuMemcpy2D_v2`] would have returned an error code.
9428 ///
9429 /// Note:
9430 ///
9431 /// * Note that this function may also return error codes from previous, asynchronous launches.
9432 /// * This function exhibits [synchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-sync) behavior for most use cases.
9433 ///
9434 /// **See also:**
9435 ///
9436 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMemcpy2D](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g3a58270f6775efe56c65ac47843e7cee), [cudaMemcpy2DToArray](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g9509226164aaa58baf0c5b8ed165df58), [cudaMemcpy2DFromArray](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g0f944b3fd3c81edad0a352cf22de24f0).
9437 ///
9438 /// # Parameters
9439 ///
9440 /// - `pCopy`: Parameters for the memory copy.
9441 pub fn cuMemcpy2D_v2(pCopy: *const CUDA_MEMCPY2D) -> CUresult;
9442}
9443unsafe extern "C" {
9444 /// Copies memory for 2D arrays.
9445 ///
9446 /// Perform a 2D memory copy according to the parameters specified in pCopy. The CUDA_MEMCPY2D structure is defined as:
9447 ///
9448 /// ```text
9449 /// typedef struct CUDA_MEMCPY2D_st {
9450 /// unsigned int srcXInBytes, srcY;
9451 /// CUmemorytype srcMemoryType;
9452 /// const void *srcHost;
9453 /// CUdeviceptr srcDevice;
9454 /// CUarray srcArray;
9455 /// unsigned int srcPitch;
9456 /// unsigned int dstXInBytes, dstY;
9457 /// CUmemorytype dstMemoryType;
9458 /// void *dstHost;
9459 /// CUdeviceptr dstDevice;
9460 /// CUarray dstArray;
9461 /// unsigned int dstPitch;
9462 /// unsigned int WidthInBytes;
9463 /// unsigned int Height;
9464 /// } CUDA_MEMCPY2D;
9465 /// ```
9466 ///
9467 /// where:
9468 ///
9469 /// * srcMemoryType and dstMemoryType specify the type of memory of the source and destination, respectively; CUmemorytype_enum
9470 /// is defined as:
9471 ///
9472 /// ```text
9473 /// typedef enum CUmemorytype_enum {
9474 /// CU_MEMORYTYPE_HOST = 0x01,
9475 /// CU_MEMORYTYPE_DEVICE = 0x02,
9476 /// CU_MEMORYTYPE_ARRAY = 0x03,
9477 /// CU_MEMORYTYPE_UNIFIED = 0x04
9478 /// } CUmemorytype;
9479 /// ```
9480 ///
9481 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_UNIFIED`], srcDevice and srcPitch specify the (unified virtual address space) base address of the source data and the bytes per row
9482 /// to apply. srcArray is ignored. This value may be used only if unified addressing is supported in the calling context.
9483 ///
9484 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_HOST`], srcHost and srcPitch specify the (host) base address of the source data and the bytes per row to apply. srcArray is ignored.
9485 ///
9486 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_DEVICE`], srcDevice and srcPitch specify the (device) base address of the source data and the bytes per row to apply. srcArray is
9487 /// ignored.
9488 ///
9489 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_ARRAY`], srcArray specifies the handle of the source data. srcHost, srcDevice and srcPitch are ignored.
9490 ///
9491 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_UNIFIED`], dstDevice and dstPitch specify the (unified virtual address space) base address of the source data and the bytes per row
9492 /// to apply. dstArray is ignored. This value may be used only if unified addressing is supported in the calling context.
9493 ///
9494 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_HOST`], dstHost and dstPitch specify the (host) base address of the destination data and the bytes per row to apply. dstArray is
9495 /// ignored.
9496 ///
9497 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_DEVICE`], dstDevice and dstPitch specify the (device) base address of the destination data and the bytes per row to apply. dstArray
9498 /// is ignored.
9499 ///
9500 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_ARRAY`], dstArray specifies the handle of the destination data. dstHost, dstDevice and dstPitch are ignored.
9501 ///
9502 /// * srcXInBytes and srcY specify the base address of the source data for the copy.
9503 ///
9504 /// For host pointers, the starting address is
9505 ///
9506 /// ```text
9507 /// void* Start = (void*)((char*)srcHost+srcY*srcPitch + srcXInBytes);
9508 /// ```
9509 ///
9510 /// For device pointers, the starting address is
9511 ///
9512 /// ```text
9513 /// CUdeviceptr Start = srcDevice+srcY*srcPitch+srcXInBytes;
9514 /// ```
9515 ///
9516 /// For CUDA arrays, srcXInBytes must be evenly divisible by the array element size.
9517 ///
9518 /// * dstXInBytes and dstY specify the base address of the destination data for the copy.
9519 ///
9520 /// For host pointers, the base address is
9521 ///
9522 /// ```text
9523 /// void* dstStart = (void*)((char*)dstHost+dstY*dstPitch + dstXInBytes);
9524 /// ```
9525 ///
9526 /// For device pointers, the starting address is
9527 ///
9528 /// ```text
9529 /// CUdeviceptr dstStart = dstDevice+dstY*dstPitch+dstXInBytes;
9530 /// ```
9531 ///
9532 /// For CUDA arrays, dstXInBytes must be evenly divisible by the array element size.
9533 ///
9534 /// * WidthInBytes and Height specify the width (in bytes) and height of the 2D copy being performed.
9535 /// * If specified, srcPitch must be greater than or equal to WidthInBytes + srcXInBytes, and dstPitch must be greater than or equal
9536 /// to WidthInBytes + dstXInBytes.
9537 ///
9538 /// [`cuMemcpy2D_v2`] returns an error if any pitch is greater than the maximum allowed ([`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAX_PITCH`]). [`cuMemAllocPitch_v2`] passes back pitches that always work with [`cuMemcpy2D_v2`]. On intra-device memory copies (device to device, CUDA array to device, CUDA array to CUDA array), [`cuMemcpy2D_v2`] may fail for pitches not computed by [`cuMemAllocPitch_v2`]. [`cuMemcpy2DUnaligned_v2`] does not have this restriction, but may run significantly slower in the cases where [`cuMemcpy2D_v2`] would have returned an error code.
9539 ///
9540 /// Note:
9541 ///
9542 /// * Note that this function may also return error codes from previous, asynchronous launches.
9543 /// * This function exhibits [synchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-sync) behavior for most use cases.
9544 ///
9545 /// **See also:**
9546 ///
9547 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMemcpy2D](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g3a58270f6775efe56c65ac47843e7cee), [cudaMemcpy2DToArray](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g9509226164aaa58baf0c5b8ed165df58), [cudaMemcpy2DFromArray](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g0f944b3fd3c81edad0a352cf22de24f0).
9548 ///
9549 /// # Parameters
9550 ///
9551 /// - `pCopy`: Parameters for the memory copy.
9552 pub fn cuMemcpy2DUnaligned_v2(pCopy: *const CUDA_MEMCPY2D) -> CUresult;
9553}
9554unsafe extern "C" {
9555 /// Copies memory for 3D arrays.
9556 ///
9557 /// Perform a 3D memory copy according to the parameters specified in pCopy. The CUDA_MEMCPY3D structure is defined as:
9558 ///
9559 /// ```text
9560 /// typedef struct CUDA_MEMCPY3D_st {
9561 ///
9562 /// unsigned int srcXInBytes, srcY, srcZ;
9563 /// unsigned int srcLOD;
9564 /// CUmemorytype srcMemoryType;
9565 /// const void *srcHost;
9566 /// CUdeviceptr srcDevice;
9567 /// CUarray srcArray;
9568 /// unsigned int srcPitch; // ignored when src is array
9569 /// unsigned int srcHeight; // ignored when src is array; may be 0 if Depth==1
9570 ///
9571 /// unsigned int dstXInBytes, dstY, dstZ;
9572 /// unsigned int dstLOD;
9573 /// CUmemorytype dstMemoryType;
9574 /// void *dstHost;
9575 /// CUdeviceptr dstDevice;
9576 /// CUarray dstArray;
9577 /// unsigned int dstPitch; // ignored when dst is array
9578 /// unsigned int dstHeight; // ignored when dst is array; may be 0 if Depth==1
9579 ///
9580 /// unsigned int WidthInBytes;
9581 /// unsigned int Height;
9582 /// unsigned int Depth;
9583 /// } CUDA_MEMCPY3D;
9584 /// ```
9585 ///
9586 /// where:
9587 ///
9588 /// * srcMemoryType and dstMemoryType specify the type of memory of the source and destination, respectively; CUmemorytype_enum
9589 /// is defined as:
9590 ///
9591 /// ```text
9592 /// typedef enum CUmemorytype_enum {
9593 /// CU_MEMORYTYPE_HOST = 0x01,
9594 /// CU_MEMORYTYPE_DEVICE = 0x02,
9595 /// CU_MEMORYTYPE_ARRAY = 0x03,
9596 /// CU_MEMORYTYPE_UNIFIED = 0x04
9597 /// } CUmemorytype;
9598 /// ```
9599 ///
9600 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_UNIFIED`], srcDevice and srcPitch specify the (unified virtual address space) base address of the source data and the bytes per row
9601 /// to apply. srcArray is ignored. This value may be used only if unified addressing is supported in the calling context.
9602 ///
9603 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_HOST`], srcHost, srcPitch and srcHeight specify the (host) base address of the source data, the bytes per row, and the height of
9604 /// each 2D slice of the 3D array. srcArray is ignored.
9605 ///
9606 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_DEVICE`], srcDevice, srcPitch and srcHeight specify the (device) base address of the source data, the bytes per row, and the height
9607 /// of each 2D slice of the 3D array. srcArray is ignored.
9608 ///
9609 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_ARRAY`], srcArray specifies the handle of the source data. srcHost, srcDevice, srcPitch and srcHeight are ignored.
9610 ///
9611 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_UNIFIED`], dstDevice and dstPitch specify the (unified virtual address space) base address of the source data and the bytes per row
9612 /// to apply. dstArray is ignored. This value may be used only if unified addressing is supported in the calling context.
9613 ///
9614 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_HOST`], dstHost and dstPitch specify the (host) base address of the destination data, the bytes per row, and the height of each
9615 /// 2D slice of the 3D array. dstArray is ignored.
9616 ///
9617 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_DEVICE`], dstDevice and dstPitch specify the (device) base address of the destination data, the bytes per row, and the height of each
9618 /// 2D slice of the 3D array. dstArray is ignored.
9619 ///
9620 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_ARRAY`], dstArray specifies the handle of the destination data. dstHost, dstDevice, dstPitch and dstHeight are ignored.
9621 ///
9622 /// * srcXInBytes, srcY and srcZ specify the base address of the source data for the copy.
9623 ///
9624 /// For host pointers, the starting address is
9625 ///
9626 /// ```text
9627 /// void* Start = (void*)((char*)srcHost+(srcZ*srcHeight+srcY)*srcPitch + srcXInBytes);
9628 /// ```
9629 ///
9630 /// For device pointers, the starting address is
9631 ///
9632 /// ```text
9633 /// CUdeviceptr Start = srcDevice+(srcZ*srcHeight+srcY)*srcPitch+srcXInBytes;
9634 /// ```
9635 ///
9636 /// For CUDA arrays, srcXInBytes must be evenly divisible by the array element size.
9637 ///
9638 /// * dstXInBytes, dstY and dstZ specify the base address of the destination data for the copy.
9639 ///
9640 /// For host pointers, the base address is
9641 ///
9642 /// ```text
9643 /// void* dstStart = (void*)((char*)dstHost+(dstZ*dstHeight+dstY)*dstPitch + dstXInBytes);
9644 /// ```
9645 ///
9646 /// For device pointers, the starting address is
9647 ///
9648 /// ```text
9649 /// CUdeviceptr dstStart = dstDevice+(dstZ*dstHeight+dstY)*dstPitch+dstXInBytes;
9650 /// ```
9651 ///
9652 /// For CUDA arrays, dstXInBytes must be evenly divisible by the array element size.
9653 ///
9654 /// * WidthInBytes, Height and Depth specify the width (in bytes), height and depth of the 3D copy being performed.
9655 /// * If specified, srcPitch must be greater than or equal to WidthInBytes + srcXInBytes, and dstPitch must be greater than or equal
9656 /// to WidthInBytes + dstXInBytes.
9657 /// * If specified, srcHeight must be greater than or equal to Height + srcY, and dstHeight must be greater than or equal to Height
9658 /// + dstY.
9659 ///
9660 /// [`cuMemcpy3D_v2`] returns an error if any pitch is greater than the maximum allowed ([`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAX_PITCH`]).
9661 ///
9662 /// The srcLOD and dstLOD members of the CUDA_MEMCPY3D structure must be set to 0.
9663 ///
9664 /// Note:
9665 ///
9666 /// * Note that this function may also return error codes from previous, asynchronous launches.
9667 /// * This function exhibits [synchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-sync) behavior for most use cases.
9668 ///
9669 /// **See also:**
9670 ///
9671 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMemcpy3D](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1gfec7ee5257d48c8528a709ffad48d208).
9672 ///
9673 /// # Parameters
9674 ///
9675 /// - `pCopy`: Parameters for the memory copy.
9676 pub fn cuMemcpy3D_v2(pCopy: *const CUDA_MEMCPY3D) -> CUresult;
9677}
9678unsafe extern "C" {
9679 /// Copies memory between contexts.
9680 ///
9681 /// Perform a 3D memory copy according to the parameters specified in pCopy. See the definition of the CUDA_MEMCPY3D_PEER structure for documentation of its parameters.
9682 ///
9683 /// Note:
9684 ///
9685 /// * Note that this function may also return error codes from previous, asynchronous launches.
9686 /// * This function exhibits [synchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-sync) behavior for most use cases.
9687 ///
9688 /// **See also:**
9689 ///
9690 /// [`cuMemcpyDtoD_v2`], [`cuMemcpyPeer`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyPeerAsync`], [`cuMemcpy3DPeerAsync`], [cudaMemcpy3DPeer](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1geeab4601354962a5968eefc8b79ec2dd).
9691 ///
9692 /// # Parameters
9693 ///
9694 /// - `pCopy`: Parameters for the memory copy.
9695 pub fn cuMemcpy3DPeer(pCopy: *const CUDA_MEMCPY3D_PEER) -> CUresult;
9696}
9697unsafe extern "C" {
9698 /// Copies memory asynchronously.
9699 ///
9700 /// Copies data between two pointers. dst and src are base pointers of the destination and source, respectively. ByteCount specifies the number of bytes to copy. Note that this function infers the type of the transfer (host to host, host to device,
9701 /// device to device, or device to host) from the pointer values. This function is only allowed in contexts which support unified
9702 /// addressing.
9703 ///
9704 /// Note:
9705 ///
9706 /// * Note that this function may also return error codes from previous, asynchronous launches.
9707 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
9708 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
9709 /// * Memory regions requested must be either entirely registered with CUDA, or in the case of host pageable transfers, not registered
9710 /// at all. Memory regions spanning over allocations that are both registered and not registered with CUDA are not supported and
9711 /// will return [`CUresult::CUDA_ERROR_INVALID_VALUE`].
9712 ///
9713 /// **See also:**
9714 ///
9715 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemcpyAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g82d9453206dce593f007c64e60bae45a), [cudaMemcpyToSymbolAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1gd00b41ade29161aafbf6ff8aee3d6eb5), [cudaMemcpyFromSymbolAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g2d9f7a440f1e522555dfe994245a5946).
9716 ///
9717 /// # Parameters
9718 ///
9719 /// - `dst`: Destination unified virtual address space pointer.
9720 /// - `src`: Source unified virtual address space pointer.
9721 /// - `ByteCount`: Size of memory copy in bytes.
9722 /// - `hStream`: Stream identifier.
9723 pub fn cuMemcpyAsync(
9724 dst: CUdeviceptr,
9725 src: CUdeviceptr,
9726 ByteCount: size_t,
9727 hStream: CUstream,
9728 ) -> CUresult;
9729}
9730unsafe extern "C" {
9731 /// Copies device memory between two contexts asynchronously.
9732 ///
9733 /// Copies from device memory in one context to device memory in another context. dstDevice is the base device pointer of the destination memory and dstContext is the destination context. srcDevice is the base device pointer of the source memory and srcContext is the source pointer. ByteCount specifies the number of bytes to copy.
9734 ///
9735 /// Note:
9736 ///
9737 /// * Note that this function may also return error codes from previous, asynchronous launches.
9738 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
9739 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
9740 ///
9741 /// **See also:**
9742 ///
9743 /// [`cuMemcpyDtoD_v2`], [`cuMemcpyPeer`], [`cuMemcpy3DPeer`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpy3DPeerAsync`], [cudaMemcpyPeerAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1gbfde4ace9ff4823f4ac45e5c6bdcd2ee).
9744 ///
9745 /// # Parameters
9746 ///
9747 /// - `dstDevice`: Destination device pointer.
9748 /// - `dstContext`: Destination context.
9749 /// - `srcDevice`: Source device pointer.
9750 /// - `srcContext`: Source context.
9751 /// - `ByteCount`: Size of memory copy in bytes.
9752 /// - `hStream`: Stream identifier.
9753 pub fn cuMemcpyPeerAsync(
9754 dstDevice: CUdeviceptr,
9755 dstContext: CUcontext,
9756 srcDevice: CUdeviceptr,
9757 srcContext: CUcontext,
9758 ByteCount: size_t,
9759 hStream: CUstream,
9760 ) -> CUresult;
9761}
9762unsafe extern "C" {
9763 /// Copies memory from Host to Device.
9764 ///
9765 /// Copies from host memory to device memory. dstDevice and srcHost are the base addresses of the destination and source, respectively. ByteCount specifies the number of bytes to copy.
9766 ///
9767 /// Note:
9768 ///
9769 /// * Note that this function may also return error codes from previous, asynchronous launches.
9770 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
9771 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
9772 /// * Memory regions requested must be either entirely registered with CUDA, or in the case of host pageable transfers, not registered
9773 /// at all. Memory regions spanning over allocations that are both registered and not registered with CUDA are not supported and
9774 /// will return [`CUresult::CUDA_ERROR_INVALID_VALUE`].
9775 ///
9776 /// **See also:**
9777 ///
9778 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemcpyAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g82d9453206dce593f007c64e60bae45a), [cudaMemcpyToSymbolAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1gd00b41ade29161aafbf6ff8aee3d6eb5).
9779 ///
9780 /// # Parameters
9781 ///
9782 /// - `dstDevice`: Destination device pointer.
9783 /// - `srcHost`: Source host pointer.
9784 /// - `ByteCount`: Size of memory copy in bytes.
9785 /// - `hStream`: Stream identifier.
9786 pub fn cuMemcpyHtoDAsync_v2(
9787 dstDevice: CUdeviceptr,
9788 srcHost: *const ::core::ffi::c_void,
9789 ByteCount: size_t,
9790 hStream: CUstream,
9791 ) -> CUresult;
9792}
9793unsafe extern "C" {
9794 /// Copies memory from Device to Host.
9795 ///
9796 /// Copies from device to host memory. dstHost and srcDevice specify the base pointers of the destination and source, respectively. ByteCount specifies the number of bytes to copy.
9797 ///
9798 /// Note:
9799 ///
9800 /// * Note that this function may also return error codes from previous, asynchronous launches.
9801 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
9802 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
9803 /// * Memory regions requested must be either entirely registered with CUDA, or in the case of host pageable transfers, not registered
9804 /// at all. Memory regions spanning over allocations that are both registered and not registered with CUDA are not supported and
9805 /// will return [`CUresult::CUDA_ERROR_INVALID_VALUE`].
9806 ///
9807 /// **See also:**
9808 ///
9809 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemcpyAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g82d9453206dce593f007c64e60bae45a), [cudaMemcpyFromSymbolAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g2d9f7a440f1e522555dfe994245a5946).
9810 ///
9811 /// # Parameters
9812 ///
9813 /// - `dstHost`: Destination host pointer.
9814 /// - `srcDevice`: Source device pointer.
9815 /// - `ByteCount`: Size of memory copy in bytes.
9816 /// - `hStream`: Stream identifier.
9817 pub fn cuMemcpyDtoHAsync_v2(
9818 dstHost: *mut ::core::ffi::c_void,
9819 srcDevice: CUdeviceptr,
9820 ByteCount: size_t,
9821 hStream: CUstream,
9822 ) -> CUresult;
9823}
9824unsafe extern "C" {
9825 /// Copies memory from Device to Device.
9826 ///
9827 /// Copies from device memory to device memory. dstDevice and srcDevice are the base pointers of the destination and source, respectively. ByteCount specifies the number of bytes to copy.
9828 ///
9829 /// Note:
9830 ///
9831 /// * Note that this function may also return error codes from previous, asynchronous launches.
9832 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
9833 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
9834 ///
9835 /// **See also:**
9836 ///
9837 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemcpyAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g82d9453206dce593f007c64e60bae45a), [cudaMemcpyToSymbolAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1gd00b41ade29161aafbf6ff8aee3d6eb5), [cudaMemcpyFromSymbolAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g2d9f7a440f1e522555dfe994245a5946).
9838 ///
9839 /// # Parameters
9840 ///
9841 /// - `dstDevice`: Destination device pointer.
9842 /// - `srcDevice`: Source device pointer.
9843 /// - `ByteCount`: Size of memory copy in bytes.
9844 /// - `hStream`: Stream identifier.
9845 pub fn cuMemcpyDtoDAsync_v2(
9846 dstDevice: CUdeviceptr,
9847 srcDevice: CUdeviceptr,
9848 ByteCount: size_t,
9849 hStream: CUstream,
9850 ) -> CUresult;
9851}
9852unsafe extern "C" {
9853 /// Copies memory from Host to Array.
9854 ///
9855 /// Copies from host memory to a 1D CUDA array. dstArray and dstOffset specify the CUDA array handle and starting offset in bytes of the destination data. srcHost specifies the base address of the source. ByteCount specifies the number of bytes to copy.
9856 ///
9857 /// Note:
9858 ///
9859 /// * Note that this function may also return error codes from previous, asynchronous launches.
9860 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
9861 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
9862 /// * Memory regions requested must be either entirely registered with CUDA, or in the case of host pageable transfers, not registered
9863 /// at all. Memory regions spanning over allocations that are both registered and not registered with CUDA are not supported and
9864 /// will return [`CUresult::CUDA_ERROR_INVALID_VALUE`].
9865 ///
9866 /// **See also:**
9867 ///
9868 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemcpyToArrayAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY__DEPRECATED.html#group__CUDART__MEMORY__DEPRECATED_1g92f0eaaaa772fd428dfc7c7ba699d272).
9869 ///
9870 /// # Parameters
9871 ///
9872 /// - `dstArray`: Destination array.
9873 /// - `dstOffset`: Offset in bytes of destination array.
9874 /// - `srcHost`: Source host pointer.
9875 /// - `ByteCount`: Size of memory copy in bytes.
9876 /// - `hStream`: Stream identifier.
9877 pub fn cuMemcpyHtoAAsync_v2(
9878 dstArray: CUarray,
9879 dstOffset: size_t,
9880 srcHost: *const ::core::ffi::c_void,
9881 ByteCount: size_t,
9882 hStream: CUstream,
9883 ) -> CUresult;
9884}
9885unsafe extern "C" {
9886 /// Copies memory from Array to Host.
9887 ///
9888 /// Copies from one 1D CUDA array to host memory. dstHost specifies the base pointer of the destination. srcArray and srcOffset specify the CUDA array handle and starting offset in bytes of the source data. ByteCount specifies the number of bytes to copy.
9889 ///
9890 /// Note:
9891 ///
9892 /// * Note that this function may also return error codes from previous, asynchronous launches.
9893 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
9894 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
9895 /// * Memory regions requested must be either entirely registered with CUDA, or in the case of host pageable transfers, not registered
9896 /// at all. Memory regions spanning over allocations that are both registered and not registered with CUDA are not supported and
9897 /// will return [`CUresult::CUDA_ERROR_INVALID_VALUE`].
9898 ///
9899 /// **See also:**
9900 ///
9901 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemcpyFromArrayAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY__DEPRECATED.html#group__CUDART__MEMORY__DEPRECATED_1gfa22cfe6148b4c82593ecf3582f1dc33).
9902 ///
9903 /// # Parameters
9904 ///
9905 /// - `dstHost`: Destination pointer.
9906 /// - `srcArray`: Source array.
9907 /// - `srcOffset`: Offset in bytes of source array.
9908 /// - `ByteCount`: Size of memory copy in bytes.
9909 /// - `hStream`: Stream identifier.
9910 pub fn cuMemcpyAtoHAsync_v2(
9911 dstHost: *mut ::core::ffi::c_void,
9912 srcArray: CUarray,
9913 srcOffset: size_t,
9914 ByteCount: size_t,
9915 hStream: CUstream,
9916 ) -> CUresult;
9917}
9918unsafe extern "C" {
9919 /// Copies memory for 2D arrays.
9920 ///
9921 /// Perform a 2D memory copy according to the parameters specified in pCopy. The CUDA_MEMCPY2D structure is defined as:
9922 ///
9923 /// ```text
9924 /// typedef struct CUDA_MEMCPY2D_st {
9925 /// unsigned int srcXInBytes, srcY;
9926 /// CUmemorytype srcMemoryType;
9927 /// const void *srcHost;
9928 /// CUdeviceptr srcDevice;
9929 /// CUarray srcArray;
9930 /// unsigned int srcPitch;
9931 /// unsigned int dstXInBytes, dstY;
9932 /// CUmemorytype dstMemoryType;
9933 /// void *dstHost;
9934 /// CUdeviceptr dstDevice;
9935 /// CUarray dstArray;
9936 /// unsigned int dstPitch;
9937 /// unsigned int WidthInBytes;
9938 /// unsigned int Height;
9939 /// } CUDA_MEMCPY2D;
9940 /// ```
9941 ///
9942 /// where:
9943 ///
9944 /// * srcMemoryType and dstMemoryType specify the type of memory of the source and destination, respectively; CUmemorytype_enum
9945 /// is defined as:
9946 ///
9947 /// ```text
9948 /// typedef enum CUmemorytype_enum {
9949 /// CU_MEMORYTYPE_HOST = 0x01,
9950 /// CU_MEMORYTYPE_DEVICE = 0x02,
9951 /// CU_MEMORYTYPE_ARRAY = 0x03,
9952 /// CU_MEMORYTYPE_UNIFIED = 0x04
9953 /// } CUmemorytype;
9954 /// ```
9955 ///
9956 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_HOST`], srcHost and srcPitch specify the (host) base address of the source data and the bytes per row to apply. srcArray is ignored.
9957 ///
9958 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_UNIFIED`], srcDevice and srcPitch specify the (unified virtual address space) base address of the source data and the bytes per row
9959 /// to apply. srcArray is ignored. This value may be used only if unified addressing is supported in the calling context.
9960 ///
9961 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_DEVICE`], srcDevice and srcPitch specify the (device) base address of the source data and the bytes per row to apply. srcArray is
9962 /// ignored.
9963 ///
9964 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_ARRAY`], srcArray specifies the handle of the source data. srcHost, srcDevice and srcPitch are ignored.
9965 ///
9966 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_UNIFIED`], dstDevice and dstPitch specify the (unified virtual address space) base address of the source data and the bytes per row
9967 /// to apply. dstArray is ignored. This value may be used only if unified addressing is supported in the calling context.
9968 ///
9969 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_HOST`], dstHost and dstPitch specify the (host) base address of the destination data and the bytes per row to apply. dstArray is
9970 /// ignored.
9971 ///
9972 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_DEVICE`], dstDevice and dstPitch specify the (device) base address of the destination data and the bytes per row to apply. dstArray
9973 /// is ignored.
9974 ///
9975 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_ARRAY`], dstArray specifies the handle of the destination data. dstHost, dstDevice and dstPitch are ignored.
9976 ///
9977 /// * srcXInBytes and srcY specify the base address of the source data for the copy.
9978 ///
9979 /// For host pointers, the starting address is
9980 ///
9981 /// ```text
9982 /// void* Start = (void*)((char*)srcHost+srcY*srcPitch + srcXInBytes);
9983 /// ```
9984 ///
9985 /// For device pointers, the starting address is
9986 ///
9987 /// ```text
9988 /// CUdeviceptr Start = srcDevice+srcY*srcPitch+srcXInBytes;
9989 /// ```
9990 ///
9991 /// For CUDA arrays, srcXInBytes must be evenly divisible by the array element size.
9992 ///
9993 /// * dstXInBytes and dstY specify the base address of the destination data for the copy.
9994 ///
9995 /// For host pointers, the base address is
9996 ///
9997 /// ```text
9998 /// void* dstStart = (void*)((char*)dstHost+dstY*dstPitch + dstXInBytes);
9999 /// ```
10000 ///
10001 /// For device pointers, the starting address is
10002 ///
10003 /// ```text
10004 /// CUdeviceptr dstStart = dstDevice+dstY*dstPitch+dstXInBytes;
10005 /// ```
10006 ///
10007 /// For CUDA arrays, dstXInBytes must be evenly divisible by the array element size.
10008 ///
10009 /// * WidthInBytes and Height specify the width (in bytes) and height of the 2D copy being performed.
10010 /// * If specified, srcPitch must be greater than or equal to WidthInBytes + srcXInBytes, and dstPitch must be greater than or equal
10011 /// to WidthInBytes + dstXInBytes.
10012 /// * If specified, srcPitch must be greater than or equal to WidthInBytes + srcXInBytes, and dstPitch must be greater than or equal
10013 /// to WidthInBytes + dstXInBytes.
10014 /// * If specified, srcHeight must be greater than or equal to Height + srcY, and dstHeight must be greater than or equal to Height
10015 /// + dstY.
10016 ///
10017 /// [`cuMemcpy2DAsync_v2`] returns an error if any pitch is greater than the maximum allowed ([`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAX_PITCH`]). [`cuMemAllocPitch_v2`] passes back pitches that always work with [`cuMemcpy2D_v2`]. On intra-device memory copies (device to device, CUDA array to device, CUDA array to CUDA array), [`cuMemcpy2DAsync_v2`] may fail for pitches not computed by [`cuMemAllocPitch_v2`].
10018 ///
10019 /// Note:
10020 ///
10021 /// * Note that this function may also return error codes from previous, asynchronous launches.
10022 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
10023 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
10024 ///
10025 /// **See also:**
10026 ///
10027 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemcpy2DAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1ge529b926e8fb574c2666a9a1d58b0dc1), [cudaMemcpy2DToArrayAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g217af4b9e2de79d9252418fc661e6a6a), [cudaMemcpy2DFromArrayAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g1c81de45e9ed5e72008a8f28e706b599).
10028 ///
10029 /// # Parameters
10030 ///
10031 /// - `pCopy`: Parameters for the memory copy.
10032 /// - `hStream`: Stream identifier.
10033 pub fn cuMemcpy2DAsync_v2(
10034 pCopy: *const CUDA_MEMCPY2D,
10035 hStream: CUstream,
10036 ) -> CUresult;
10037}
10038unsafe extern "C" {
10039 /// Copies memory for 3D arrays.
10040 ///
10041 /// Perform a 3D memory copy according to the parameters specified in pCopy. The CUDA_MEMCPY3D structure is defined as:
10042 ///
10043 /// ```text
10044 /// typedef struct CUDA_MEMCPY3D_st {
10045 ///
10046 /// unsigned int srcXInBytes, srcY, srcZ;
10047 /// unsigned int srcLOD;
10048 /// CUmemorytype srcMemoryType;
10049 /// const void *srcHost;
10050 /// CUdeviceptr srcDevice;
10051 /// CUarray srcArray;
10052 /// unsigned int srcPitch; // ignored when src is array
10053 /// unsigned int srcHeight; // ignored when src is array; may be 0 if Depth==1
10054 ///
10055 /// unsigned int dstXInBytes, dstY, dstZ;
10056 /// unsigned int dstLOD;
10057 /// CUmemorytype dstMemoryType;
10058 /// void *dstHost;
10059 /// CUdeviceptr dstDevice;
10060 /// CUarray dstArray;
10061 /// unsigned int dstPitch; // ignored when dst is array
10062 /// unsigned int dstHeight; // ignored when dst is array; may be 0 if Depth==1
10063 ///
10064 /// unsigned int WidthInBytes;
10065 /// unsigned int Height;
10066 /// unsigned int Depth;
10067 /// } CUDA_MEMCPY3D;
10068 /// ```
10069 ///
10070 /// where:
10071 ///
10072 /// * srcMemoryType and dstMemoryType specify the type of memory of the source and destination, respectively; CUmemorytype_enum
10073 /// is defined as:
10074 ///
10075 /// ```text
10076 /// typedef enum CUmemorytype_enum {
10077 /// CU_MEMORYTYPE_HOST = 0x01,
10078 /// CU_MEMORYTYPE_DEVICE = 0x02,
10079 /// CU_MEMORYTYPE_ARRAY = 0x03,
10080 /// CU_MEMORYTYPE_UNIFIED = 0x04
10081 /// } CUmemorytype;
10082 /// ```
10083 ///
10084 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_UNIFIED`], srcDevice and srcPitch specify the (unified virtual address space) base address of the source data and the bytes per row
10085 /// to apply. srcArray is ignored. This value may be used only if unified addressing is supported in the calling context.
10086 ///
10087 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_HOST`], srcHost, srcPitch and srcHeight specify the (host) base address of the source data, the bytes per row, and the height of
10088 /// each 2D slice of the 3D array. srcArray is ignored.
10089 ///
10090 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_DEVICE`], srcDevice, srcPitch and srcHeight specify the (device) base address of the source data, the bytes per row, and the height
10091 /// of each 2D slice of the 3D array. srcArray is ignored.
10092 ///
10093 /// If srcMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_ARRAY`], srcArray specifies the handle of the source data. srcHost, srcDevice, srcPitch and srcHeight are ignored.
10094 ///
10095 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_UNIFIED`], dstDevice and dstPitch specify the (unified virtual address space) base address of the source data and the bytes per row
10096 /// to apply. dstArray is ignored. This value may be used only if unified addressing is supported in the calling context.
10097 ///
10098 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_HOST`], dstHost and dstPitch specify the (host) base address of the destination data, the bytes per row, and the height of each
10099 /// 2D slice of the 3D array. dstArray is ignored.
10100 ///
10101 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_DEVICE`], dstDevice and dstPitch specify the (device) base address of the destination data, the bytes per row, and the height of each
10102 /// 2D slice of the 3D array. dstArray is ignored.
10103 ///
10104 /// If dstMemoryType is [`CUmemorytype_enum::CU_MEMORYTYPE_ARRAY`], dstArray specifies the handle of the destination data. dstHost, dstDevice, dstPitch and dstHeight are ignored.
10105 ///
10106 /// * srcXInBytes, srcY and srcZ specify the base address of the source data for the copy.
10107 ///
10108 /// For host pointers, the starting address is
10109 ///
10110 /// ```text
10111 /// void* Start = (void*)((char*)srcHost+(srcZ*srcHeight+srcY)*srcPitch + srcXInBytes);
10112 /// ```
10113 ///
10114 /// For device pointers, the starting address is
10115 ///
10116 /// ```text
10117 /// CUdeviceptr Start = srcDevice+(srcZ*srcHeight+srcY)*srcPitch+srcXInBytes;
10118 /// ```
10119 ///
10120 /// For CUDA arrays, srcXInBytes must be evenly divisible by the array element size.
10121 ///
10122 /// * dstXInBytes, dstY and dstZ specify the base address of the destination data for the copy.
10123 ///
10124 /// For host pointers, the base address is
10125 ///
10126 /// ```text
10127 /// void* dstStart = (void*)((char*)dstHost+(dstZ*dstHeight+dstY)*dstPitch + dstXInBytes);
10128 /// ```
10129 ///
10130 /// For device pointers, the starting address is
10131 ///
10132 /// ```text
10133 /// CUdeviceptr dstStart = dstDevice+(dstZ*dstHeight+dstY)*dstPitch+dstXInBytes;
10134 /// ```
10135 ///
10136 /// For CUDA arrays, dstXInBytes must be evenly divisible by the array element size.
10137 ///
10138 /// * WidthInBytes, Height and Depth specify the width (in bytes), height and depth of the 3D copy being performed.
10139 /// * If specified, srcPitch must be greater than or equal to WidthInBytes + srcXInBytes, and dstPitch must be greater than or equal
10140 /// to WidthInBytes + dstXInBytes.
10141 /// * If specified, srcHeight must be greater than or equal to Height + srcY, and dstHeight must be greater than or equal to Height
10142 /// + dstY.
10143 ///
10144 /// [`cuMemcpy3DAsync_v2`] returns an error if any pitch is greater than the maximum allowed ([`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAX_PITCH`]).
10145 ///
10146 /// The srcLOD and dstLOD members of the CUDA_MEMCPY3D structure must be set to 0.
10147 ///
10148 /// Note:
10149 ///
10150 /// * Note that this function may also return error codes from previous, asynchronous launches.
10151 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
10152 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
10153 ///
10154 /// **See also:**
10155 ///
10156 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemcpy3DAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g785bd0963e476a740533382a67674641).
10157 ///
10158 /// # Parameters
10159 ///
10160 /// - `pCopy`: Parameters for the memory copy.
10161 /// - `hStream`: Stream identifier.
10162 pub fn cuMemcpy3DAsync_v2(
10163 pCopy: *const CUDA_MEMCPY3D,
10164 hStream: CUstream,
10165 ) -> CUresult;
10166}
10167unsafe extern "C" {
10168 /// Copies memory between contexts asynchronously.
10169 ///
10170 /// Perform a 3D memory copy according to the parameters specified in pCopy. See the definition of the CUDA_MEMCPY3D_PEER structure for documentation of its parameters.
10171 ///
10172 /// Note:
10173 ///
10174 /// * Note that this function may also return error codes from previous, asynchronous launches.
10175 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
10176 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
10177 ///
10178 /// **See also:**
10179 ///
10180 /// [`cuMemcpyDtoD_v2`], [`cuMemcpyPeer`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyPeerAsync`], [`cuMemcpy3DPeerAsync`], [cudaMemcpy3DPeerAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g7386b2845149b48c87f82ea017690aa8).
10181 ///
10182 /// # Parameters
10183 ///
10184 /// - `pCopy`: Parameters for the memory copy.
10185 /// - `hStream`: Stream identifier.
10186 pub fn cuMemcpy3DPeerAsync(
10187 pCopy: *const CUDA_MEMCPY3D_PEER,
10188 hStream: CUstream,
10189 ) -> CUresult;
10190}
10191unsafe extern "C" {
10192 /// Performs a batch of memory copies asynchronously.
10193 ///
10194 /// Performs a batch of memory copies. The batch as a whole executes in stream order but copies within a batch are not guaranteed
10195 /// to execute in any specific order. This API only supports pointer-to-pointer copies. For copies involving CUDA arrays, please
10196 /// see [`cuMemcpy3DBatchAsync_v2`].
10197 ///
10198 /// Performs memory copies from source buffers specified in srcs to destination buffers specified in dsts. The size of each copy is specified in sizes. All three arrays must be of the same length as specified by count. Since there are no ordering guarantees for copies within a batch, specifying any dependent copies within a batch will result
10199 /// in undefined behavior.
10200 ///
10201 /// Every copy in the batch has to be associated with a set of attributes specified in the attrs array. Each entry in this array can apply to more than one copy. This can be done by specifying in the attrsIdxs array, the index of the first copy that the corresponding entry in the attrs array applies to. Both attrs and attrsIdxs must be of the same length as specified by numAttrs. For example, if a batch has 10 copies listed in dst/src/sizes, the first 6 of which have one set of attributes and the remaining
10202 /// 4 another, then numAttrs will be 2, attrsIdxs will be {0, 6} and attrs will contains the two sets of attributes. Note that the first entry in attrsIdxs must always be 0. Also, each entry must be greater than the previous entry and the last entry should be less than count. Furthermore, numAttrs must be lesser than or equal to count.
10203 ///
10204 /// The [CUmemcpyAttributes::srcAccessOrder](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemcpyAttributes__v1.html#structCUmemcpyAttributes__v1_1d152922b22834808ca5714f688400761) indicates the source access ordering to be observed for copies associated with the attribute. If the source access order
10205 /// is set to [`CUmemcpySrcAccessOrder_enum::CU_MEMCPY_SRC_ACCESS_ORDER_STREAM`], then the source will be accessed in stream order. If the source access order is set to [`CUmemcpySrcAccessOrder_enum::CU_MEMCPY_SRC_ACCESS_ORDER_DURING_API_CALL`] then it indicates that access to the source pointer can be out of stream order and all accesses must be complete before the
10206 /// API call returns. This flag is suited for ephemeral sources (ex., stack variables) when it's known that no prior operations
10207 /// in the stream can be accessing the memory and also that the lifetime of the memory is limited to the scope that the source
10208 /// variable was declared in. Specifying this flag allows the driver to optimize the copy and removes the need for the user to
10209 /// synchronize the stream after the API call. If the source access order is set to [`CUmemcpySrcAccessOrder_enum::CU_MEMCPY_SRC_ACCESS_ORDER_ANY`] then it indicates that access to the source pointer can be out of stream order and the accesses can happen even after the
10210 /// API call returns. This flag is suited for host pointers allocated outside CUDA (ex., via malloc) when it's known that no prior
10211 /// operations in the stream can be accessing the memory. Specifying this flag allows the driver to optimize the copy on certain
10212 /// platforms. Each memcpy operation in the batch must have a valid CUmemcpyAttributes corresponding to it including the appropriate
10213 /// srcAccessOrder setting, otherwise the API will return [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`].
10214 ///
10215 /// The [CUmemcpyAttributes::srcLocHint](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemcpyAttributes__v1.html#structCUmemcpyAttributes__v1_12b2ea7d3968f58243d6d94f99bab6a55) and [CUmemcpyAttributes::dstLocHint](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemcpyAttributes__v1.html#structCUmemcpyAttributes__v1_15ef6cafc9e673f19d946cd5517dd05ec) allows applications to specify hint locations for operands of a copy when the operand doesn't have a fixed location. That
10216 /// is, these hints are only applicable for managed memory pointers on devices where [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`] is true or system-allocated pageable memory on devices where [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`] is true. For other cases, these hints are ignored.
10217 ///
10218 /// The [CUmemcpyAttributes::flags](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemcpyAttributes__v1.html#structCUmemcpyAttributes__v1_10c9ad8770c38c992894a6870991127e4) field can be used to specify certain flags for copies. Setting the [`CUmemcpyFlags_enum::CU_MEMCPY_FLAG_PREFER_OVERLAP_WITH_COMPUTE`] flag indicates that the associated copies should preferably overlap with any compute work. Note that this flag is a hint
10219 /// and can be ignored depending on the platform and other parameters of the copy.
10220 ///
10221 /// Note:
10222 ///
10223 /// * Note that this function may also return error codes from previous, asynchronous launches.
10224 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
10225 /// * Memory regions requested must be either entirely registered with CUDA, or in the case of host pageable transfers, not registered
10226 /// at all. Memory regions spanning over allocations that are both registered and not registered with CUDA are not supported and
10227 /// will return [`CUresult::CUDA_ERROR_INVALID_VALUE`].
10228 ///
10229 /// # Parameters
10230 ///
10231 /// - `dsts`: Array of destination pointers.
10232 /// - `srcs`: Array of memcpy source pointers.
10233 /// - `sizes`: Array of sizes for memcpy operations.
10234 /// - `count`: Size of dsts, srcs and sizes arrays.
10235 /// - `attrs`: Array of memcpy attributes.
10236 /// - `attrsIdxs`: Array of indices to specify which copies each entry in the attrs array applies to. The attributes specified in attrs\[k\] will be applied to copies starting from attrsIdxs\[k\] through attrsIdxs\[k+1\]
10237 /// - 1. Also attrs\[numAttrs-1\] will apply to copies starting from attrsIdxs\[numAttrs-1\] through count - 1.
10238 /// - `numAttrs`: Size of attrs and attrsIdxs arrays.
10239 /// - `hStream`: The stream to enqueue the operations in. Must not be legacy NULL stream.
10240 pub fn cuMemcpyBatchAsync_v2(
10241 dsts: *mut CUdeviceptr,
10242 srcs: *mut CUdeviceptr,
10243 sizes: *mut size_t,
10244 count: size_t,
10245 attrs: *mut CUmemcpyAttributes,
10246 attrsIdxs: *mut size_t,
10247 numAttrs: size_t,
10248 hStream: CUstream,
10249 ) -> CUresult;
10250}
10251unsafe extern "C" {
10252 /// Performs a batch of 3D memory copies asynchronously.
10253 ///
10254 /// Performs a batch of memory copies. The batch as a whole executes in stream order but copies within a batch are not guaranteed
10255 /// to execute in any specific order. Note that this means specifying any dependent copies within a batch will result in undefined
10256 /// behavior.
10257 ///
10258 /// Performs memory copies as specified in the opList array. The length of this array is specified in numOps. Each entry in this array describes a copy operation. This includes among other things, the source and destination operands
10259 /// for the copy as specified in CUDA_MEMCPY3D_BATCH_OP::src and CUDA_MEMCPY3D_BATCH_OP::dst respectively. The source and destination
10260 /// operands of a copy can either be a pointer or a CUDA array. The width, height and depth of a copy is specified in CUDA_MEMCPY3D_BATCH_OP::extent.
10261 /// The width, height and depth of a copy are specified in elements and must not be zero. For pointer-to-pointer copies, the element
10262 /// size is considered to be 1. For pointer to CUDA array or vice versa copies, the element size is determined by the CUDA array.
10263 /// For CUDA array to CUDA array copies, the element size of the two CUDA arrays must match.
10264 ///
10265 /// For a given operand, if CUmemcpy3DOperand::type is specified as [`CUmemcpy3DOperandType_enum::CU_MEMCPY_OPERAND_TYPE_POINTER`], then CUmemcpy3DOperand::op::ptr will be used. The CUmemcpy3DOperand::op::ptr::ptr field must contain the pointer where the
10266 /// copy should begin. The CUmemcpy3DOperand::op::ptr::rowLength field specifies the length of each row in elements and must either
10267 /// be zero or be greater than or equal to the width of the copy specified in CUDA_MEMCPY3D_BATCH_OP::extent::width. The CUmemcpy3DOperand::op::ptr::layerHeight
10268 /// field specifies the height of each layer and must either be zero or be greater than or equal to the height of the copy specified
10269 /// in CUDA_MEMCPY3D_BATCH_OP::extent::height. When either of these values is zero, that aspect of the operand is considered to
10270 /// be tightly packed according to the copy extent. For managed memory pointers on devices where [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`] is true or system-allocated pageable memory on devices where [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`] is true, the CUmemcpy3DOperand::op::ptr::locHint field can be used to hint the location of the operand.
10271 ///
10272 /// If an operand's type is specified as [`CUmemcpy3DOperandType_enum::CU_MEMCPY_OPERAND_TYPE_ARRAY`], then CUmemcpy3DOperand::op::array will be used. The CUmemcpy3DOperand::op::array::array field specifies the CUDA array and
10273 /// CUmemcpy3DOperand::op::array::offset specifies the 3D offset into that array where the copy begins.
10274 ///
10275 /// The [CUmemcpyAttributes::srcAccessOrder](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemcpyAttributes__v1.html#structCUmemcpyAttributes__v1_1d152922b22834808ca5714f688400761) indicates the source access ordering to be observed for copies associated with the attribute. If the source access order
10276 /// is set to [`CUmemcpySrcAccessOrder_enum::CU_MEMCPY_SRC_ACCESS_ORDER_STREAM`], then the source will be accessed in stream order. If the source access order is set to [`CUmemcpySrcAccessOrder_enum::CU_MEMCPY_SRC_ACCESS_ORDER_DURING_API_CALL`] then it indicates that access to the source pointer can be out of stream order and all accesses must be complete before the
10277 /// API call returns. This flag is suited for ephemeral sources (ex., stack variables) when it's known that no prior operations
10278 /// in the stream can be accessing the memory and also that the lifetime of the memory is limited to the scope that the source
10279 /// variable was declared in. Specifying this flag allows the driver to optimize the copy and removes the need for the user to
10280 /// synchronize the stream after the API call. If the source access order is set to [`CUmemcpySrcAccessOrder_enum::CU_MEMCPY_SRC_ACCESS_ORDER_ANY`] then it indicates that access to the source pointer can be out of stream order and the accesses can happen even after the
10281 /// API call returns. This flag is suited for host pointers allocated outside CUDA (ex., via malloc) when it's known that no prior
10282 /// operations in the stream can be accessing the memory. Specifying this flag allows the driver to optimize the copy on certain
10283 /// platforms. Each memcopy operation in opList must have a valid srcAccessOrder setting, otherwise this API will return [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`].
10284 ///
10285 /// The [CUmemcpyAttributes::flags](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemcpyAttributes__v1.html#structCUmemcpyAttributes__v1_10c9ad8770c38c992894a6870991127e4) field can be used to specify certain flags for copies. Setting the [`CUmemcpyFlags_enum::CU_MEMCPY_FLAG_PREFER_OVERLAP_WITH_COMPUTE`] flag indicates that the associated copies should preferably overlap with any compute work. Note that this flag is a hint
10286 /// and can be ignored depending on the platform and other parameters of the copy.
10287 ///
10288 /// Note:
10289 ///
10290 /// * Note that this function may also return error codes from previous, asynchronous launches.
10291 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
10292 /// * Memory regions requested must be either entirely registered with CUDA, or in the case of host pageable transfers, not registered
10293 /// at all. Memory regions spanning over allocations that are both registered and not registered with CUDA are not supported and
10294 /// will return [`CUresult::CUDA_ERROR_INVALID_VALUE`].
10295 ///
10296 /// # Parameters
10297 ///
10298 /// - `numOps`: Total number of memcpy operations.
10299 /// - `opList`: Array of size numOps containing the actual memcpy operations.
10300 /// - `flags`: Flags for future use, must be zero now.
10301 /// - `hStream`: The stream to enqueue the operations in. Must not be default NULL stream.
10302 pub fn cuMemcpy3DBatchAsync_v2(
10303 numOps: size_t,
10304 opList: *mut CUDA_MEMCPY3D_BATCH_OP,
10305 flags: ::core::ffi::c_ulonglong,
10306 hStream: CUstream,
10307 ) -> CUresult;
10308}
10309unsafe extern "C" {
10310 /// Performs asynchronous memory copy operation with the specified attributes.
10311 ///
10312 /// Performs asynchronous memory copy operation where dst and src are the destination and source pointers respectively. size specifies the number of bytes to copy. attr specifies the attributes for the copy and hStream specifies the stream to enqueue the operation in.
10313 ///
10314 /// For more information regarding the attributes, please refer to CUmemcpyAttributes and it's usage desciption [`cuMemcpyBatchAsync_v2`]
10315 ///
10316 /// Note:
10317 ///
10318 /// * Note that this function may also return error codes from previous, asynchronous launches.
10319 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
10320 /// * Memory regions requested must be either entirely registered with CUDA, or in the case of host pageable transfers, not registered
10321 /// at all. Memory regions spanning over allocations that are both registered and not registered with CUDA are not supported and
10322 /// will return [`CUresult::CUDA_ERROR_INVALID_VALUE`].
10323 ///
10324 /// **See also:**
10325 ///
10326 /// [`cuMemcpyBatchAsync_v2`].
10327 ///
10328 /// # Parameters
10329 ///
10330 /// - `dst`: Destination device pointer.
10331 /// - `src`: Source device pointer.
10332 /// - `size`: Number of bytes to copy.
10333 /// - `attr`: Attributes for the copy.
10334 /// - `hStream`: Stream to enqueue the operation in.
10335 pub fn cuMemcpyWithAttributesAsync(
10336 dst: CUdeviceptr,
10337 src: CUdeviceptr,
10338 size: size_t,
10339 attr: *mut CUmemcpyAttributes,
10340 hStream: CUstream,
10341 ) -> CUresult;
10342}
10343unsafe extern "C" {
10344 /// Performs 3D memory copy with attributes asynchronously
10345 ///
10346 /// Performs the copy operation specified in op. flags specifies the flags for the copy and hStream specifies the stream to enqueue the operation in.
10347 ///
10348 /// For more information regarding the operation, please refer to CUDA_MEMCPY3D_BATCH_OP and it's usage desciption [`cuMemcpy3DBatchAsync_v2`]
10349 ///
10350 /// Note:
10351 ///
10352 /// * Note that this function may also return error codes from previous, asynchronous launches.
10353 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
10354 /// * Memory regions requested must be either entirely registered with CUDA, or in the case of host pageable transfers, not registered
10355 /// at all. Memory regions spanning over allocations that are both registered and not registered with CUDA are not supported and
10356 /// will return [`CUresult::CUDA_ERROR_INVALID_VALUE`].
10357 ///
10358 /// **See also:**
10359 ///
10360 /// [`cuMemcpy3DBatchAsync_v2`].
10361 ///
10362 /// # Parameters
10363 ///
10364 /// - `op`: Operation to perform.
10365 /// - `flags`: Flags for the copy, must be zero now.
10366 /// - `hStream`: Stream to enqueue the operation in.
10367 pub fn cuMemcpy3DWithAttributesAsync(
10368 op: *mut CUDA_MEMCPY3D_BATCH_OP,
10369 flags: ::core::ffi::c_ulonglong,
10370 hStream: CUstream,
10371 ) -> CUresult;
10372}
10373unsafe extern "C" {
10374 /// Initializes device memory.
10375 ///
10376 /// Sets the memory range of N 8-bit values to the specified value uc.
10377 ///
10378 /// Note:
10379 ///
10380 /// * Note that this function may also return error codes from previous, asynchronous launches.
10381 /// * See also [memset synchronization details](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memset).
10382 ///
10383 /// **See also:**
10384 ///
10385 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemset](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1gf7338650f7683c51ee26aadc6973c63a).
10386 ///
10387 /// # Parameters
10388 ///
10389 /// - `dstDevice`: Destination device pointer.
10390 /// - `uc`: Value to set.
10391 /// - `N`: Number of elements.
10392 pub fn cuMemsetD8_v2(
10393 dstDevice: CUdeviceptr,
10394 uc: ::core::ffi::c_uchar,
10395 N: size_t,
10396 ) -> CUresult;
10397}
10398unsafe extern "C" {
10399 /// Initializes device memory.
10400 ///
10401 /// Sets the memory range of N 16-bit values to the specified value us. The dstDevice pointer must be two byte aligned.
10402 ///
10403 /// Note:
10404 ///
10405 /// * Note that this function may also return error codes from previous, asynchronous launches.
10406 /// * See also [memset synchronization details](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memset).
10407 ///
10408 /// **See also:**
10409 ///
10410 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemset](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1gf7338650f7683c51ee26aadc6973c63a).
10411 ///
10412 /// # Parameters
10413 ///
10414 /// - `dstDevice`: Destination device pointer.
10415 /// - `us`: Value to set.
10416 /// - `N`: Number of elements.
10417 pub fn cuMemsetD16_v2(
10418 dstDevice: CUdeviceptr,
10419 us: ::core::ffi::c_ushort,
10420 N: size_t,
10421 ) -> CUresult;
10422}
10423unsafe extern "C" {
10424 /// Initializes device memory.
10425 ///
10426 /// Sets the memory range of N 32-bit values to the specified value ui. The dstDevice pointer must be four byte aligned.
10427 ///
10428 /// Note:
10429 ///
10430 /// * Note that this function may also return error codes from previous, asynchronous launches.
10431 /// * See also [memset synchronization details](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memset).
10432 ///
10433 /// **See also:**
10434 ///
10435 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32Async`], [cudaMemset](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1gf7338650f7683c51ee26aadc6973c63a).
10436 ///
10437 /// # Parameters
10438 ///
10439 /// - `dstDevice`: Destination device pointer.
10440 /// - `ui`: Value to set.
10441 /// - `N`: Number of elements.
10442 pub fn cuMemsetD32_v2(
10443 dstDevice: CUdeviceptr,
10444 ui: ::core::ffi::c_uint,
10445 N: size_t,
10446 ) -> CUresult;
10447}
10448unsafe extern "C" {
10449 /// Initializes device memory.
10450 ///
10451 /// Sets the 2D memory range of Width 8-bit values to the specified value uc. Height specifies the number of rows to set, and dstPitch specifies the number of bytes between each row. This function performs fastest when the pitch is one that has been passed
10452 /// back by [`cuMemAllocPitch_v2`].
10453 ///
10454 /// Note:
10455 ///
10456 /// * Note that this function may also return error codes from previous, asynchronous launches.
10457 /// * See also [memset synchronization details](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memset).
10458 ///
10459 /// **See also:**
10460 ///
10461 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemset2D](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g120112b2bd627c7a896390efadc4d2c1).
10462 ///
10463 /// # Parameters
10464 ///
10465 /// - `dstDevice`: Destination device pointer.
10466 /// - `dstPitch`: Pitch of destination device pointer(Unused if Height is 1).
10467 /// - `uc`: Value to set.
10468 /// - `Width`: Width of row.
10469 /// - `Height`: Number of rows.
10470 pub fn cuMemsetD2D8_v2(
10471 dstDevice: CUdeviceptr,
10472 dstPitch: size_t,
10473 uc: ::core::ffi::c_uchar,
10474 Width: size_t,
10475 Height: size_t,
10476 ) -> CUresult;
10477}
10478unsafe extern "C" {
10479 /// Initializes device memory.
10480 ///
10481 /// Sets the 2D memory range of Width 16-bit values to the specified value us. Height specifies the number of rows to set, and dstPitch specifies the number of bytes between each row. The dstDevice pointer and dstPitch offset must be two byte aligned. This function performs fastest when the pitch is one that has been passed back by [`cuMemAllocPitch_v2`].
10482 ///
10483 /// Note:
10484 ///
10485 /// * Note that this function may also return error codes from previous, asynchronous launches.
10486 /// * See also [memset synchronization details](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memset).
10487 ///
10488 /// **See also:**
10489 ///
10490 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemset2D](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g120112b2bd627c7a896390efadc4d2c1).
10491 ///
10492 /// # Parameters
10493 ///
10494 /// - `dstDevice`: Destination device pointer.
10495 /// - `dstPitch`: Pitch of destination device pointer(Unused if Height is 1).
10496 /// - `us`: Value to set.
10497 /// - `Width`: Width of row.
10498 /// - `Height`: Number of rows.
10499 pub fn cuMemsetD2D16_v2(
10500 dstDevice: CUdeviceptr,
10501 dstPitch: size_t,
10502 us: ::core::ffi::c_ushort,
10503 Width: size_t,
10504 Height: size_t,
10505 ) -> CUresult;
10506}
10507unsafe extern "C" {
10508 /// Initializes device memory.
10509 ///
10510 /// Sets the 2D memory range of Width 32-bit values to the specified value ui. Height specifies the number of rows to set, and dstPitch specifies the number of bytes between each row. The dstDevice pointer and dstPitch offset must be four byte aligned. This function performs fastest when the pitch is one that has been passed back by [`cuMemAllocPitch_v2`].
10511 ///
10512 /// Note:
10513 ///
10514 /// * Note that this function may also return error codes from previous, asynchronous launches.
10515 /// * See also [memset synchronization details](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memset).
10516 ///
10517 /// **See also:**
10518 ///
10519 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemset2D](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g120112b2bd627c7a896390efadc4d2c1).
10520 ///
10521 /// # Parameters
10522 ///
10523 /// - `dstDevice`: Destination device pointer.
10524 /// - `dstPitch`: Pitch of destination device pointer(Unused if Height is 1).
10525 /// - `ui`: Value to set.
10526 /// - `Width`: Width of row.
10527 /// - `Height`: Number of rows.
10528 pub fn cuMemsetD2D32_v2(
10529 dstDevice: CUdeviceptr,
10530 dstPitch: size_t,
10531 ui: ::core::ffi::c_uint,
10532 Width: size_t,
10533 Height: size_t,
10534 ) -> CUresult;
10535}
10536unsafe extern "C" {
10537 /// Sets device memory.
10538 ///
10539 /// Sets the memory range of N 8-bit values to the specified value uc.
10540 ///
10541 /// Note:
10542 ///
10543 /// * Note that this function may also return error codes from previous, asynchronous launches.
10544 /// * See also [memset synchronization details](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memset).
10545 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
10546 ///
10547 /// **See also:**
10548 ///
10549 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemsetAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g7c9761e21d9f0999fd136c51e7b9b2a0).
10550 ///
10551 /// # Parameters
10552 ///
10553 /// - `dstDevice`: Destination device pointer.
10554 /// - `uc`: Value to set.
10555 /// - `N`: Number of elements.
10556 /// - `hStream`: Stream identifier.
10557 pub fn cuMemsetD8Async(
10558 dstDevice: CUdeviceptr,
10559 uc: ::core::ffi::c_uchar,
10560 N: size_t,
10561 hStream: CUstream,
10562 ) -> CUresult;
10563}
10564unsafe extern "C" {
10565 /// Sets device memory.
10566 ///
10567 /// Sets the memory range of N 16-bit values to the specified value us. The dstDevice pointer must be two byte aligned.
10568 ///
10569 /// Note:
10570 ///
10571 /// * Note that this function may also return error codes from previous, asynchronous launches.
10572 /// * See also [memset synchronization details](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memset).
10573 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
10574 ///
10575 /// **See also:**
10576 ///
10577 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemsetAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g7c9761e21d9f0999fd136c51e7b9b2a0).
10578 ///
10579 /// # Parameters
10580 ///
10581 /// - `dstDevice`: Destination device pointer.
10582 /// - `us`: Value to set.
10583 /// - `N`: Number of elements.
10584 /// - `hStream`: Stream identifier.
10585 pub fn cuMemsetD16Async(
10586 dstDevice: CUdeviceptr,
10587 us: ::core::ffi::c_ushort,
10588 N: size_t,
10589 hStream: CUstream,
10590 ) -> CUresult;
10591}
10592unsafe extern "C" {
10593 /// Sets device memory.
10594 ///
10595 /// Sets the memory range of N 32-bit values to the specified value ui. The dstDevice pointer must be four byte aligned.
10596 ///
10597 /// Note:
10598 ///
10599 /// * Note that this function may also return error codes from previous, asynchronous launches.
10600 /// * See also [memset synchronization details](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memset).
10601 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
10602 ///
10603 /// **See also:**
10604 ///
10605 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [cudaMemsetAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g7c9761e21d9f0999fd136c51e7b9b2a0).
10606 ///
10607 /// # Parameters
10608 ///
10609 /// - `dstDevice`: Destination device pointer.
10610 /// - `ui`: Value to set.
10611 /// - `N`: Number of elements.
10612 /// - `hStream`: Stream identifier.
10613 pub fn cuMemsetD32Async(
10614 dstDevice: CUdeviceptr,
10615 ui: ::core::ffi::c_uint,
10616 N: size_t,
10617 hStream: CUstream,
10618 ) -> CUresult;
10619}
10620unsafe extern "C" {
10621 /// Sets device memory.
10622 ///
10623 /// Sets the 2D memory range of Width 8-bit values to the specified value uc. Height specifies the number of rows to set, and dstPitch specifies the number of bytes between each row. This function performs fastest when the pitch is one that has been passed
10624 /// back by [`cuMemAllocPitch_v2`].
10625 ///
10626 /// Note:
10627 ///
10628 /// * Note that this function may also return error codes from previous, asynchronous launches.
10629 /// * See also [memset synchronization details](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memset).
10630 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
10631 ///
10632 /// **See also:**
10633 ///
10634 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemset2DAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g8fdcc53996ff49c570f4b5ead0256ef0).
10635 ///
10636 /// # Parameters
10637 ///
10638 /// - `dstDevice`: Destination device pointer.
10639 /// - `dstPitch`: Pitch of destination device pointer(Unused if Height is 1).
10640 /// - `uc`: Value to set.
10641 /// - `Width`: Width of row.
10642 /// - `Height`: Number of rows.
10643 /// - `hStream`: Stream identifier.
10644 pub fn cuMemsetD2D8Async(
10645 dstDevice: CUdeviceptr,
10646 dstPitch: size_t,
10647 uc: ::core::ffi::c_uchar,
10648 Width: size_t,
10649 Height: size_t,
10650 hStream: CUstream,
10651 ) -> CUresult;
10652}
10653unsafe extern "C" {
10654 /// Sets device memory.
10655 ///
10656 /// Sets the 2D memory range of Width 16-bit values to the specified value us. Height specifies the number of rows to set, and dstPitch specifies the number of bytes between each row. The dstDevice pointer and dstPitch offset must be two byte aligned. This function performs fastest when the pitch is one that has been passed back by [`cuMemAllocPitch_v2`].
10657 ///
10658 /// Note:
10659 ///
10660 /// * Note that this function may also return error codes from previous, asynchronous launches.
10661 /// * See also [memset synchronization details](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memset).
10662 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
10663 ///
10664 /// **See also:**
10665 ///
10666 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD2D32Async`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemset2DAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g8fdcc53996ff49c570f4b5ead0256ef0).
10667 ///
10668 /// # Parameters
10669 ///
10670 /// - `dstDevice`: Destination device pointer.
10671 /// - `dstPitch`: Pitch of destination device pointer(Unused if Height is 1).
10672 /// - `us`: Value to set.
10673 /// - `Width`: Width of row.
10674 /// - `Height`: Number of rows.
10675 /// - `hStream`: Stream identifier.
10676 pub fn cuMemsetD2D16Async(
10677 dstDevice: CUdeviceptr,
10678 dstPitch: size_t,
10679 us: ::core::ffi::c_ushort,
10680 Width: size_t,
10681 Height: size_t,
10682 hStream: CUstream,
10683 ) -> CUresult;
10684}
10685unsafe extern "C" {
10686 /// Sets device memory.
10687 ///
10688 /// Sets the 2D memory range of Width 32-bit values to the specified value ui. Height specifies the number of rows to set, and dstPitch specifies the number of bytes between each row. The dstDevice pointer and dstPitch offset must be four byte aligned. This function performs fastest when the pitch is one that has been passed back by [`cuMemAllocPitch_v2`].
10689 ///
10690 /// Note:
10691 ///
10692 /// * Note that this function may also return error codes from previous, asynchronous launches.
10693 /// * See also [memset synchronization details](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memset).
10694 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
10695 ///
10696 /// **See also:**
10697 ///
10698 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D8Async`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D16Async`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD8Async`], [`cuMemsetD16_v2`], [`cuMemsetD16Async`], [`cuMemsetD32_v2`], [`cuMemsetD32Async`], [cudaMemset2DAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g8fdcc53996ff49c570f4b5ead0256ef0).
10699 ///
10700 /// # Parameters
10701 ///
10702 /// - `dstDevice`: Destination device pointer.
10703 /// - `dstPitch`: Pitch of destination device pointer(Unused if Height is 1).
10704 /// - `ui`: Value to set.
10705 /// - `Width`: Width of row.
10706 /// - `Height`: Number of rows.
10707 /// - `hStream`: Stream identifier.
10708 pub fn cuMemsetD2D32Async(
10709 dstDevice: CUdeviceptr,
10710 dstPitch: size_t,
10711 ui: ::core::ffi::c_uint,
10712 Width: size_t,
10713 Height: size_t,
10714 hStream: CUstream,
10715 ) -> CUresult;
10716}
10717unsafe extern "C" {
10718 /// Creates a 1D or 2D CUDA array.
10719 ///
10720 /// Creates a CUDA array according to the CUDA_ARRAY_DESCRIPTOR structure pAllocateArray and returns a handle to the new CUDA array in \*pHandle. The CUDA_ARRAY_DESCRIPTOR is defined as:
10721 ///
10722 /// ```text
10723 /// typedef struct {
10724 /// unsigned int Width;
10725 /// unsigned int Height;
10726 /// CUarray_format Format;
10727 /// unsigned int NumChannels;
10728 /// } CUDA_ARRAY_DESCRIPTOR;
10729 /// ```
10730 ///
10731 /// where:
10732 ///
10733 /// * Width, and Height are the width, and height of the CUDA array (in elements); the CUDA array is one-dimensional if height is 0, two-dimensional
10734 /// otherwise;
10735 /// * Format specifies the format of the elements; `CUarray_format` is defined as:
10736 ///
10737 /// ```text
10738 /// typedef enum CUarray_format_enum {
10739 /// CU_AD_FORMAT_UNSIGNED_INT8 = 0x01,
10740 /// CU_AD_FORMAT_UNSIGNED_INT16 = 0x02,
10741 /// CU_AD_FORMAT_UNSIGNED_INT32 = 0x03,
10742 /// CU_AD_FORMAT_SIGNED_INT8 = 0x08,
10743 /// CU_AD_FORMAT_SIGNED_INT16 = 0x09,
10744 /// CU_AD_FORMAT_SIGNED_INT32 = 0x0a,
10745 /// CU_AD_FORMAT_HALF = 0x10,
10746 /// CU_AD_FORMAT_FLOAT = 0x20,
10747 /// CU_AD_FORMAT_NV12 = 0xb0,
10748 /// CU_AD_FORMAT_UNORM_INT8X1 = 0xc0,
10749 /// CU_AD_FORMAT_UNORM_INT8X2 = 0xc1,
10750 /// CU_AD_FORMAT_UNORM_INT8X4 = 0xc2,
10751 /// CU_AD_FORMAT_UNORM_INT16X1 = 0xc3,
10752 /// CU_AD_FORMAT_UNORM_INT16X2 = 0xc4,
10753 /// CU_AD_FORMAT_UNORM_INT16X4 = 0xc5,
10754 /// CU_AD_FORMAT_SNORM_INT8X1 = 0xc6,
10755 /// CU_AD_FORMAT_SNORM_INT8X2 = 0xc7,
10756 /// CU_AD_FORMAT_SNORM_INT8X4 = 0xc8,
10757 /// CU_AD_FORMAT_SNORM_INT16X1 = 0xc9,
10758 /// CU_AD_FORMAT_SNORM_INT16X2 = 0xca,
10759 /// CU_AD_FORMAT_SNORM_INT16X4 = 0xcb,
10760 /// CU_AD_FORMAT_BC1_UNORM = 0x91,
10761 /// CU_AD_FORMAT_BC1_UNORM_SRGB = 0x92,
10762 /// CU_AD_FORMAT_BC2_UNORM = 0x93,
10763 /// CU_AD_FORMAT_BC2_UNORM_SRGB = 0x94,
10764 /// CU_AD_FORMAT_BC3_UNORM = 0x95,
10765 /// CU_AD_FORMAT_BC3_UNORM_SRGB = 0x96,
10766 /// CU_AD_FORMAT_BC4_UNORM = 0x97,
10767 /// CU_AD_FORMAT_BC4_SNORM = 0x98,
10768 /// CU_AD_FORMAT_BC5_UNORM = 0x99,
10769 /// CU_AD_FORMAT_BC5_SNORM = 0x9a,
10770 /// CU_AD_FORMAT_BC6H_UF16 = 0x9b,
10771 /// CU_AD_FORMAT_BC6H_SF16 = 0x9c,
10772 /// CU_AD_FORMAT_BC7_UNORM = 0x9d,
10773 /// CU_AD_FORMAT_BC7_UNORM_SRGB = 0x9e,
10774 /// CU_AD_FORMAT_P010 = 0x9f,
10775 /// CU_AD_FORMAT_P016 = 0xa1,
10776 /// CU_AD_FORMAT_NV16 = 0xa2,
10777 /// CU_AD_FORMAT_P210 = 0xa3,
10778 /// CU_AD_FORMAT_P216 = 0xa4,
10779 /// CU_AD_FORMAT_YUY2 = 0xa5,
10780 /// CU_AD_FORMAT_Y210 = 0xa6,
10781 /// CU_AD_FORMAT_Y216 = 0xa7,
10782 /// CU_AD_FORMAT_AYUV = 0xa8,
10783 /// CU_AD_FORMAT_Y410 = 0xa9,
10784 /// CU_AD_FORMAT_Y416 = 0xb1,
10785 /// CU_AD_FORMAT_Y444_PLANAR8 = 0xb2,
10786 /// CU_AD_FORMAT_Y444_PLANAR10 = 0xb3,
10787 /// CU_AD_FORMAT_YUV444_8bit_SemiPlanar = 0xb4,
10788 /// CU_AD_FORMAT_YUV444_16bit_SemiPlanar = 0xb5,
10789 /// CU_AD_FORMAT_UNORM_INT_101010_2 = 0x50,
10790 /// CU_AD_FORMAT_UINT8_PACKED_422 = 0x51,
10791 /// CU_AD_FORMAT_UINT8_PACKED_444 = 0x52,
10792 /// CU_AD_FORMAT_UINT8_SEMIPLANAR_420 = 0x53,
10793 /// CU_AD_FORMAT_UINT16_SEMIPLANAR_420 = 0x54,
10794 /// CU_AD_FORMAT_UINT8_SEMIPLANAR_422 = 0x55,
10795 /// CU_AD_FORMAT_UINT16_SEMIPLANAR_422 = 0x56,
10796 /// CU_AD_FORMAT_UINT8_SEMIPLANAR_444 = 0x57,
10797 /// CU_AD_FORMAT_UINT16_SEMIPLANAR_444 = 0x58,
10798 /// CU_AD_FORMAT_UINT8_PLANAR_420 = 0x59,
10799 /// CU_AD_FORMAT_UINT16_PLANAR_420 = 0x5a,
10800 /// CU_AD_FORMAT_UINT8_PLANAR_422 = 0x5b,
10801 /// CU_AD_FORMAT_UINT16_PLANAR_422 = 0x5c,
10802 /// CU_AD_FORMAT_UINT8_PLANAR_444 = 0x5d,
10803 /// CU_AD_FORMAT_UINT16_PLANAR_444 = 0x5e,
10804 /// } CUarray_format;
10805 /// ```
10806 /// * NumChannels specifies the number of packed components per CUDA array element; it may be 1, 2, or 4;
10807 ///
10808 /// Here are examples of CUDA array descriptions:
10809 ///
10810 /// Description for a CUDA array of 2048 floats:
10811 ///
10812 /// ```text
10813 /// CUDA_ARRAY_DESCRIPTOR desc;
10814 /// desc.Format = CU_AD_FORMAT_FLOAT;
10815 /// desc.NumChannels = 1;
10816 /// desc.Width = 2048;
10817 /// desc.Height = 1;
10818 /// ```
10819 ///
10820 /// Description for a 64 x 64 CUDA array of floats:
10821 ///
10822 /// ```text
10823 /// CUDA_ARRAY_DESCRIPTOR desc;
10824 /// desc.Format = CU_AD_FORMAT_FLOAT;
10825 /// desc.NumChannels = 1;
10826 /// desc.Width = 64;
10827 /// desc.Height = 64;
10828 /// ```
10829 ///
10830 /// Description for a width x height CUDA array of 64-bit, 4x16-bit float16's:
10831 ///
10832 /// ```text
10833 /// CUDA_ARRAY_DESCRIPTOR desc;
10834 /// desc.Format = CU_AD_FORMAT_HALF;
10835 /// desc.NumChannels = 4;
10836 /// desc.Width = width;
10837 /// desc.Height = height;
10838 /// ```
10839 ///
10840 /// Description for a width x height CUDA array of 16-bit elements, each of which is two 8-bit unsigned chars:
10841 ///
10842 /// ```text
10843 /// CUDA_ARRAY_DESCRIPTOR arrayDesc;
10844 /// desc.Format = CU_AD_FORMAT_UNSIGNED_INT8;
10845 /// desc.NumChannels = 2;
10846 /// desc.Width = width;
10847 /// desc.Height = height;
10848 /// ```
10849 ///
10850 /// Note:
10851 ///
10852 /// Note that this function may also return error codes from previous, asynchronous launches.
10853 ///
10854 /// **See also:**
10855 ///
10856 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMallocArray](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g6728eb7dc25f332f50bdb16a19620d3d).
10857 ///
10858 /// # Parameters
10859 ///
10860 /// - `pHandle`: Returned array.
10861 /// - `pAllocateArray`: Array descriptor.
10862 pub fn cuArrayCreate_v2(
10863 pHandle: *mut CUarray,
10864 pAllocateArray: *const CUDA_ARRAY_DESCRIPTOR,
10865 ) -> CUresult;
10866}
10867unsafe extern "C" {
10868 /// Get a 1D or 2D CUDA array descriptor.
10869 ///
10870 /// Returns in \*pArrayDescriptor a descriptor containing information on the format and dimensions of the CUDA array hArray. It is useful for subroutines that have been passed a CUDA array, but need to know the CUDA array parameters for validation
10871 /// or other purposes.
10872 ///
10873 /// Note:
10874 ///
10875 /// Note that this function may also return error codes from previous, asynchronous launches.
10876 ///
10877 /// **See also:**
10878 ///
10879 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaArrayGetInfo](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g373dacf191566b0bf5e5b807517b6bf9).
10880 ///
10881 /// # Parameters
10882 ///
10883 /// - `pArrayDescriptor`: Returned array descriptor.
10884 /// - `hArray`: Array to get descriptor of.
10885 pub fn cuArrayGetDescriptor_v2(
10886 pArrayDescriptor: *mut CUDA_ARRAY_DESCRIPTOR,
10887 hArray: CUarray,
10888 ) -> CUresult;
10889}
10890unsafe extern "C" {
10891 /// Returns the layout properties of a sparse CUDA array.
10892 ///
10893 /// Returns the layout properties of a sparse CUDA array in sparseProperties If the CUDA array is not allocated with flag [`CUDA_ARRAY3D_SPARSE`] will be returned.
10894 ///
10895 /// If the returned value in [CUDA_ARRAY_SPARSE_PROPERTIES::flags](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structCUDA__ARRAY__SPARSE__PROPERTIES__v1_10e842bb64091fa47809112c700cb5f0a) contains [`CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL`], then [CUDA_ARRAY_SPARSE_PROPERTIES::miptailSize](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structCUDA__ARRAY__SPARSE__PROPERTIES__v1_1895ecb42681678271b0edba05bf1dcd9) represents the total size of the array. Otherwise, it will be zero. Also, the returned value in [CUDA_ARRAY_SPARSE_PROPERTIES::miptailFirstLevel](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structCUDA__ARRAY__SPARSE__PROPERTIES__v1_1edd0cca8fad1fcbb1789d537edd7e6b6) is always zero. Note that the array must have been allocated using [`cuArrayCreate_v2`] or [`cuArray3DCreate_v2`]. For CUDA arrays obtained using [`cuMipmappedArrayGetLevel`], [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] will be returned. Instead, [`cuMipmappedArrayGetSparseProperties`] must be used to obtain the sparse properties of the entire CUDA mipmapped array to which array belongs to.
10896 ///
10897 /// **See also:**
10898 ///
10899 /// [`cuMipmappedArrayGetSparseProperties`], [`cuMemMapArrayAsync`].
10900 ///
10901 /// # Parameters
10902 ///
10903 /// - `sparseProperties`: Pointer to CUDA_ARRAY_SPARSE_PROPERTIES.
10904 /// - `array`: CUDA array to get the sparse properties of.
10905 pub fn cuArrayGetSparseProperties(
10906 sparseProperties: *mut CUDA_ARRAY_SPARSE_PROPERTIES,
10907 array: CUarray,
10908 ) -> CUresult;
10909}
10910unsafe extern "C" {
10911 /// Returns the layout properties of a sparse CUDA mipmapped array.
10912 ///
10913 /// Returns the sparse array layout properties in sparseProperties If the CUDA mipmapped array is not allocated with flag [`CUDA_ARRAY3D_SPARSE`] will be returned.
10914 ///
10915 /// For non-layered CUDA mipmapped arrays, [CUDA_ARRAY_SPARSE_PROPERTIES::miptailSize](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structCUDA__ARRAY__SPARSE__PROPERTIES__v1_1895ecb42681678271b0edba05bf1dcd9) returns the size of the mip tail region. The mip tail region includes all mip levels whose width, height or depth is less
10916 /// than that of the tile. For layered CUDA mipmapped arrays, if [CUDA_ARRAY_SPARSE_PROPERTIES::flags](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structCUDA__ARRAY__SPARSE__PROPERTIES__v1_10e842bb64091fa47809112c700cb5f0a) contains [`CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL`], then [CUDA_ARRAY_SPARSE_PROPERTIES::miptailSize](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structCUDA__ARRAY__SPARSE__PROPERTIES__v1_1895ecb42681678271b0edba05bf1dcd9) specifies the size of the mip tail of all layers combined. Otherwise, [CUDA_ARRAY_SPARSE_PROPERTIES::miptailSize](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structCUDA__ARRAY__SPARSE__PROPERTIES__v1_1895ecb42681678271b0edba05bf1dcd9) specifies mip tail size per layer. The returned value of [CUDA_ARRAY_SPARSE_PROPERTIES::miptailFirstLevel](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structCUDA__ARRAY__SPARSE__PROPERTIES__v1_1edd0cca8fad1fcbb1789d537edd7e6b6) is valid only if [CUDA_ARRAY_SPARSE_PROPERTIES::miptailSize](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structCUDA__ARRAY__SPARSE__PROPERTIES__v1_1895ecb42681678271b0edba05bf1dcd9) is non-zero.
10917 ///
10918 /// **See also:**
10919 ///
10920 /// [`cuArrayGetSparseProperties`], [`cuMemMapArrayAsync`].
10921 ///
10922 /// # Parameters
10923 ///
10924 /// - `sparseProperties`: Pointer to CUDA_ARRAY_SPARSE_PROPERTIES.
10925 /// - `mipmap`: CUDA mipmapped array to get the sparse properties of.
10926 pub fn cuMipmappedArrayGetSparseProperties(
10927 sparseProperties: *mut CUDA_ARRAY_SPARSE_PROPERTIES,
10928 mipmap: CUmipmappedArray,
10929 ) -> CUresult;
10930}
10931unsafe extern "C" {
10932 /// Returns the memory requirements of a CUDA array.
10933 ///
10934 /// Returns the memory requirements of a CUDA array in memoryRequirements If the CUDA array is not allocated with flag [`CUDA_ARRAY3D_DEFERRED_MAPPING`] will be returned.
10935 ///
10936 /// The returned value in [CUDA_ARRAY_MEMORY_REQUIREMENTS::size](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__ARRAY__MEMORY__REQUIREMENTS__v1.html#structCUDA__ARRAY__MEMORY__REQUIREMENTS__v1_17a2851735a1d2c11af797f01b1d4969e) represents the total size of the CUDA array. The returned value in [CUDA_ARRAY_MEMORY_REQUIREMENTS::alignment](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__ARRAY__MEMORY__REQUIREMENTS__v1.html#structCUDA__ARRAY__MEMORY__REQUIREMENTS__v1_135c6c8106451b6313d1dffe9a28af755) represents the alignment necessary for mapping the CUDA array.
10937 ///
10938 /// **See also:**
10939 ///
10940 /// [`cuMipmappedArrayGetMemoryRequirements`], [`cuMemMapArrayAsync`].
10941 ///
10942 /// # Parameters
10943 ///
10944 /// - `memoryRequirements`: Pointer to CUDA_ARRAY_MEMORY_REQUIREMENTS.
10945 /// - `array`: CUDA array to get the memory requirements of.
10946 /// - `device`: Device to get the memory requirements for.
10947 pub fn cuArrayGetMemoryRequirements(
10948 memoryRequirements: *mut CUDA_ARRAY_MEMORY_REQUIREMENTS,
10949 array: CUarray,
10950 device: CUdevice,
10951 ) -> CUresult;
10952}
10953unsafe extern "C" {
10954 /// Returns the memory requirements of a CUDA mipmapped array.
10955 ///
10956 /// Returns the memory requirements of a CUDA mipmapped array in memoryRequirements If the CUDA mipmapped array is not allocated with flag [`CUDA_ARRAY3D_DEFERRED_MAPPING`] will be returned.
10957 ///
10958 /// The returned value in [CUDA_ARRAY_MEMORY_REQUIREMENTS::size](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__ARRAY__MEMORY__REQUIREMENTS__v1.html#structCUDA__ARRAY__MEMORY__REQUIREMENTS__v1_17a2851735a1d2c11af797f01b1d4969e) represents the total size of the CUDA mipmapped array. The returned value in [CUDA_ARRAY_MEMORY_REQUIREMENTS::alignment](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__ARRAY__MEMORY__REQUIREMENTS__v1.html#structCUDA__ARRAY__MEMORY__REQUIREMENTS__v1_135c6c8106451b6313d1dffe9a28af755) represents the alignment necessary for mapping the CUDA mipmapped array.
10959 ///
10960 /// **See also:**
10961 ///
10962 /// [`cuArrayGetMemoryRequirements`], [`cuMemMapArrayAsync`].
10963 ///
10964 /// # Parameters
10965 ///
10966 /// - `memoryRequirements`: Pointer to CUDA_ARRAY_MEMORY_REQUIREMENTS.
10967 /// - `mipmap`: CUDA mipmapped array to get the memory requirements of.
10968 /// - `device`: Device to get the memory requirements for.
10969 pub fn cuMipmappedArrayGetMemoryRequirements(
10970 memoryRequirements: *mut CUDA_ARRAY_MEMORY_REQUIREMENTS,
10971 mipmap: CUmipmappedArray,
10972 device: CUdevice,
10973 ) -> CUresult;
10974}
10975unsafe extern "C" {
10976 /// Gets a CUDA array plane from a CUDA array.
10977 ///
10978 /// Returns in pPlaneArray a CUDA array that represents a single format plane of the CUDA array hArray.
10979 ///
10980 /// If planeIdx is greater than the maximum number of planes in this array or if the array does not have a multi-planar format e.g: [`CUarray_format_enum::CU_AD_FORMAT_NV12`], then [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] is returned.
10981 ///
10982 /// Note that if the hArray has format [`CUarray_format_enum::CU_AD_FORMAT_NV12`], then passing in 0 for planeIdx returns a CUDA array of the same size as hArray but with one channel and [`CUarray_format_enum::CU_AD_FORMAT_UNSIGNED_INT8`] as its format. If 1 is passed for planeIdx, then the returned CUDA array has half the height and width of hArray with two channels and [`CUarray_format_enum::CU_AD_FORMAT_UNSIGNED_INT8`] as its format.
10983 ///
10984 /// Note:
10985 ///
10986 /// Note that this function may also return error codes from previous, asynchronous launches.
10987 ///
10988 /// **See also:**
10989 ///
10990 /// [`cuArrayCreate_v2`], [cudaArrayGetPlane](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g9a851663a2b9f222b549c727adc0e079).
10991 ///
10992 /// # Parameters
10993 ///
10994 /// - `pPlaneArray`: Returned CUDA array referenced by the planeIdx.
10995 /// - `hArray`: Multiplanar CUDA array.
10996 /// - `planeIdx`: Plane index.
10997 pub fn cuArrayGetPlane(
10998 pPlaneArray: *mut CUarray,
10999 hArray: CUarray,
11000 planeIdx: ::core::ffi::c_uint,
11001 ) -> CUresult;
11002}
11003unsafe extern "C" {
11004 /// Destroys a CUDA array.
11005 ///
11006 /// Destroys the CUDA array hArray.
11007 ///
11008 /// Note:
11009 ///
11010 /// Note that this function may also return error codes from previous, asynchronous launches.
11011 ///
11012 /// **See also:**
11013 ///
11014 /// [`cuArray3DCreate_v2`], [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaFreeArray](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g1b553f5f4806d67525230ac305d50900).
11015 ///
11016 /// # Parameters
11017 ///
11018 /// - `hArray`: Array to destroy.
11019 pub fn cuArrayDestroy(hArray: CUarray) -> CUresult;
11020}
11021unsafe extern "C" {
11022 /// Creates a 3D CUDA array.
11023 ///
11024 /// Creates a CUDA array according to the CUDA_ARRAY3D_DESCRIPTOR structure pAllocateArray and returns a handle to the new CUDA array in \*pHandle. The CUDA_ARRAY3D_DESCRIPTOR is defined as:
11025 ///
11026 /// ```text
11027 /// typedef struct {
11028 /// unsigned int Width;
11029 /// unsigned int Height;
11030 /// unsigned int Depth;
11031 /// CUarray_format Format;
11032 /// unsigned int NumChannels;
11033 /// unsigned int Flags;
11034 /// } CUDA_ARRAY3D_DESCRIPTOR;
11035 /// ```
11036 ///
11037 /// where:
11038 ///
11039 /// * Width, Height, and Depth are the width, height, and depth of the CUDA array (in elements); the following types of CUDA arrays can be allocated:
11040 /// + A 1D array is allocated if Height and Depth extents are both zero.
11041 /// + A 2D array is allocated if only Depth extent is zero.
11042 /// + A 3D array is allocated if all three extents are non-zero.
11043 /// + A 1D layered CUDA array is allocated if only Height is zero and the [`CUDA_ARRAY3D_LAYERED`] flag is set. Each layer is a 1D array. The number of layers is determined by the depth extent.
11044 /// + A 2D layered CUDA array is allocated if all three extents are non-zero and the [`CUDA_ARRAY3D_LAYERED`] flag is set. Each layer is a 2D array. The number of layers is determined by the depth extent.
11045 /// + A cubemap CUDA array is allocated if all three extents are non-zero and the [`CUDA_ARRAY3D_CUBEMAP`] flag is set. Width must be equal to Height, and Depth must be six. A cubemap is a special type of 2D layered CUDA array, where the six layers represent the six faces of a cube.
11046 /// The order of the six layers in memory is the same as that listed in `CUarray_cubemap_face`.
11047 /// + A cubemap layered CUDA array is allocated if all three extents are non-zero, and both, [`CUDA_ARRAY3D_CUBEMAP`] and [`CUDA_ARRAY3D_LAYERED`] flags are set. Width must be equal to Height, and Depth must be a multiple of six. A cubemap layered CUDA array is a special type of 2D layered CUDA array that consists of a collection
11048 /// of cubemaps. The first six layers represent the first cubemap, the next six layers form the second cubemap, and so on.
11049 ///
11050 /// * Format specifies the format of the elements; `CUarray_format` is defined as:
11051 ///
11052 /// ```text
11053 /// typedef enum CUarray_format_enum {
11054 /// CU_AD_FORMAT_UNSIGNED_INT8 = 0x01,
11055 /// CU_AD_FORMAT_UNSIGNED_INT16 = 0x02,
11056 /// CU_AD_FORMAT_UNSIGNED_INT32 = 0x03,
11057 /// CU_AD_FORMAT_SIGNED_INT8 = 0x08,
11058 /// CU_AD_FORMAT_SIGNED_INT16 = 0x09,
11059 /// CU_AD_FORMAT_SIGNED_INT32 = 0x0a,
11060 /// CU_AD_FORMAT_HALF = 0x10,
11061 /// CU_AD_FORMAT_FLOAT = 0x20,
11062 /// CU_AD_FORMAT_NV12 = 0xb0,
11063 /// CU_AD_FORMAT_UNORM_INT8X1 = 0xc0,
11064 /// CU_AD_FORMAT_UNORM_INT8X2 = 0xc1,
11065 /// CU_AD_FORMAT_UNORM_INT8X4 = 0xc2,
11066 /// CU_AD_FORMAT_UNORM_INT16X1 = 0xc3,
11067 /// CU_AD_FORMAT_UNORM_INT16X2 = 0xc4,
11068 /// CU_AD_FORMAT_UNORM_INT16X4 = 0xc5,
11069 /// CU_AD_FORMAT_SNORM_INT8X1 = 0xc6,
11070 /// CU_AD_FORMAT_SNORM_INT8X2 = 0xc7,
11071 /// CU_AD_FORMAT_SNORM_INT8X4 = 0xc8,
11072 /// CU_AD_FORMAT_SNORM_INT16X1 = 0xc9,
11073 /// CU_AD_FORMAT_SNORM_INT16X2 = 0xca,
11074 /// CU_AD_FORMAT_SNORM_INT16X4 = 0xcb,
11075 /// CU_AD_FORMAT_BC1_UNORM = 0x91,
11076 /// CU_AD_FORMAT_BC1_UNORM_SRGB = 0x92,
11077 /// CU_AD_FORMAT_BC2_UNORM = 0x93,
11078 /// CU_AD_FORMAT_BC2_UNORM_SRGB = 0x94,
11079 /// CU_AD_FORMAT_BC3_UNORM = 0x95,
11080 /// CU_AD_FORMAT_BC3_UNORM_SRGB = 0x96,
11081 /// CU_AD_FORMAT_BC4_UNORM = 0x97,
11082 /// CU_AD_FORMAT_BC4_SNORM = 0x98,
11083 /// CU_AD_FORMAT_BC5_UNORM = 0x99,
11084 /// CU_AD_FORMAT_BC5_SNORM = 0x9a,
11085 /// CU_AD_FORMAT_BC6H_UF16 = 0x9b,
11086 /// CU_AD_FORMAT_BC6H_SF16 = 0x9c,
11087 /// CU_AD_FORMAT_BC7_UNORM = 0x9d,
11088 /// CU_AD_FORMAT_BC7_UNORM_SRGB = 0x9e,
11089 /// CU_AD_FORMAT_P010 = 0x9f,
11090 /// CU_AD_FORMAT_P016 = 0xa1,
11091 /// CU_AD_FORMAT_NV16 = 0xa2,
11092 /// CU_AD_FORMAT_P210 = 0xa3,
11093 /// CU_AD_FORMAT_P216 = 0xa4,
11094 /// CU_AD_FORMAT_YUY2 = 0xa5,
11095 /// CU_AD_FORMAT_Y210 = 0xa6,
11096 /// CU_AD_FORMAT_Y216 = 0xa7,
11097 /// CU_AD_FORMAT_AYUV = 0xa8,
11098 /// CU_AD_FORMAT_Y410 = 0xa9,
11099 /// CU_AD_FORMAT_Y416 = 0xb1,
11100 /// CU_AD_FORMAT_Y444_PLANAR8 = 0xb2,
11101 /// CU_AD_FORMAT_Y444_PLANAR10 = 0xb3,
11102 /// CU_AD_FORMAT_YUV444_8bit_SemiPlanar = 0xb4,
11103 /// CU_AD_FORMAT_YUV444_16bit_SemiPlanar = 0xb5,
11104 /// CU_AD_FORMAT_UNORM_INT_101010_2 = 0x50,
11105 /// } CUarray_format;
11106 /// ```
11107 ///
11108 /// * NumChannels specifies the number of packed components per CUDA array element; it may be 1, 2, or 4;
11109 ///
11110 /// * Flags may be set to
11111 /// + [`CUDA_ARRAY3D_LAYERED`] to enable creation of layered CUDA arrays. If this flag is set, Depth specifies the number of layers, not the depth of a 3D array.
11112 /// + [`CUDA_ARRAY3D_SURFACE_LDST`] to enable surface references to be bound to the CUDA array. If this flag is not set, [`cuSurfRefSetArray`] will fail when attempting to bind the CUDA array to a surface reference.
11113 /// + [`CUDA_ARRAY3D_CUBEMAP`] to enable creation of cubemaps. If this flag is set, Width must be equal to Height, and Depth must be six. If the [`CUDA_ARRAY3D_LAYERED`] flag is also set, then Depth must be a multiple of six.
11114 /// + [`CUDA_ARRAY3D_TEXTURE_GATHER`] to indicate that the CUDA array will be used for texture gather. Texture gather can only be performed on 2D CUDA arrays.
11115 ///
11116 /// Width, Height and Depth must meet certain size requirements as listed in the following table. All values are specified in elements. Note that for
11117 /// brevity's sake, the full name of the device attribute is not specified. For ex., TEXTURE1D_WIDTH refers to the device attribute
11118 /// [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH`].
11119 ///
11120 /// Note that 2D CUDA arrays have different size requirements if the [`CUDA_ARRAY3D_TEXTURE_GATHER`] flag is set. Width and Height must not be greater than [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH`] and [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT`] respectively, in that case.
11121 ///
11122 /// | | | |
11123 /// | --- | --- | --- |
11124 /// | **CUDA array type** | **Valid extents that must always be met {(width range in elements), (height range), (depth range)}** | **Valid extents with CUDA_ARRAY3D_SURFACE_LDST set {(width range in elements), (height range), (depth range)}** |
11125 /// | 1D | { (1,TEXTURE1D_WIDTH), 0, 0 } | { (1,SURFACE1D_WIDTH), 0, 0 } |
11126 /// | 2D | { (1,TEXTURE2D_WIDTH), (1,TEXTURE2D_HEIGHT), 0 } | { (1,SURFACE2D_WIDTH), (1,SURFACE2D_HEIGHT), 0 } |
11127 /// | 3D | { (1,TEXTURE3D_WIDTH), (1,TEXTURE3D_HEIGHT), (1,TEXTURE3D_DEPTH) } OR { (1,TEXTURE3D_WIDTH_ALTERNATE), (1,TEXTURE3D_HEIGHT_ALTERNATE), (1,TEXTURE3D_DEPTH_ALTERNATE) } | { (1,SURFACE3D_WIDTH), (1,SURFACE3D_HEIGHT), (1,SURFACE3D_DEPTH) } |
11128 /// | 1D Layered | { (1,TEXTURE1D_LAYERED_WIDTH), 0, (1,TEXTURE1D_LAYERED_LAYERS) } | { (1,SURFACE1D_LAYERED_WIDTH), 0, (1,SURFACE1D_LAYERED_LAYERS) } |
11129 /// | 2D Layered | { (1,TEXTURE2D_LAYERED_WIDTH), (1,TEXTURE2D_LAYERED_HEIGHT), (1,TEXTURE2D_LAYERED_LAYERS) } | { (1,SURFACE2D_LAYERED_WIDTH), (1,SURFACE2D_LAYERED_HEIGHT), (1,SURFACE2D_LAYERED_LAYERS) } |
11130 /// | Cubemap | { (1,TEXTURECUBEMAP_WIDTH), (1,TEXTURECUBEMAP_WIDTH), 6 } | { (1,SURFACECUBEMAP_WIDTH), (1,SURFACECUBEMAP_WIDTH), 6 } |
11131 /// | Cubemap Layered | { (1,TEXTURECUBEMAP_LAYERED_WIDTH), (1,TEXTURECUBEMAP_LAYERED_WIDTH), (1,TEXTURECUBEMAP_LAYERED_LAYERS) } | { (1,SURFACECUBEMAP_LAYERED_WIDTH), (1,SURFACECUBEMAP_LAYERED_WIDTH), (1,SURFACECUBEMAP_LAYERED_LAYERS) } |
11132 ///
11133 /// Here are examples of CUDA array descriptions:
11134 ///
11135 /// Description for a CUDA array of 2048 floats:
11136 ///
11137 /// ```text
11138 /// CUDA_ARRAY3D_DESCRIPTOR desc;
11139 /// desc.Format = CU_AD_FORMAT_FLOAT;
11140 /// desc.NumChannels = 1;
11141 /// desc.Width = 2048;
11142 /// desc.Height = 0;
11143 /// desc.Depth = 0;
11144 /// ```
11145 ///
11146 /// Description for a 64 x 64 CUDA array of floats:
11147 ///
11148 /// ```text
11149 /// CUDA_ARRAY3D_DESCRIPTOR desc;
11150 /// desc.Format = CU_AD_FORMAT_FLOAT;
11151 /// desc.NumChannels = 1;
11152 /// desc.Width = 64;
11153 /// desc.Height = 64;
11154 /// desc.Depth = 0;
11155 /// ```
11156 ///
11157 /// Description for a width x height x depth CUDA array of 64-bit, 4x16-bit float16's:
11158 ///
11159 /// ```text
11160 /// CUDA_ARRAY3D_DESCRIPTOR desc;
11161 /// desc.Format = CU_AD_FORMAT_HALF;
11162 /// desc.NumChannels = 4;
11163 /// desc.Width = width;
11164 /// desc.Height = height;
11165 /// desc.Depth = depth;
11166 /// ```
11167 ///
11168 /// Note:
11169 ///
11170 /// Note that this function may also return error codes from previous, asynchronous launches.
11171 ///
11172 /// **See also:**
11173 ///
11174 /// [`cuArray3DGetDescriptor_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaMalloc3DArray](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g948143cf2423a072ac6a31fb635efd88).
11175 ///
11176 /// # Parameters
11177 ///
11178 /// - `pHandle`: Returned array.
11179 /// - `pAllocateArray`: 3D array descriptor.
11180 pub fn cuArray3DCreate_v2(
11181 pHandle: *mut CUarray,
11182 pAllocateArray: *const CUDA_ARRAY3D_DESCRIPTOR,
11183 ) -> CUresult;
11184}
11185unsafe extern "C" {
11186 /// Get a 3D CUDA array descriptor.
11187 ///
11188 /// Returns in \*pArrayDescriptor a descriptor containing information on the format and dimensions of the CUDA array hArray. It is useful for subroutines that have been passed a CUDA array, but need to know the CUDA array parameters for validation
11189 /// or other purposes.
11190 ///
11191 /// This function may be called on 1D and 2D arrays, in which case the Height and/or Depth members of the descriptor struct will be set to 0.
11192 ///
11193 /// Note:
11194 ///
11195 /// Note that this function may also return error codes from previous, asynchronous launches.
11196 ///
11197 /// **See also:**
11198 ///
11199 /// [`cuArray3DCreate_v2`], [`cuArrayCreate_v2`], [`cuArrayDestroy`], [`cuArrayGetDescriptor_v2`], [`cuMemAlloc_v2`], [`cuMemAllocHost_v2`], [`cuMemAllocPitch_v2`], [`cuMemcpy2D_v2`], [`cuMemcpy2DAsync_v2`], [`cuMemcpy2DUnaligned_v2`], [`cuMemcpy3D_v2`], [`cuMemcpy3DAsync_v2`], [`cuMemcpyAtoA_v2`], [`cuMemcpyAtoD_v2`], [`cuMemcpyAtoH_v2`], [`cuMemcpyAtoHAsync_v2`], [`cuMemcpyDtoA_v2`], [`cuMemcpyDtoD_v2`], [`cuMemcpyDtoDAsync_v2`], [`cuMemcpyDtoH_v2`], [`cuMemcpyDtoHAsync_v2`], [`cuMemcpyHtoA_v2`], [`cuMemcpyHtoAAsync_v2`], [`cuMemcpyHtoD_v2`], [`cuMemcpyHtoDAsync_v2`], [`cuMemFree_v2`], [`cuMemFreeHost`], [`cuMemGetAddressRange_v2`], [`cuMemGetInfo_v2`], [`cuMemHostAlloc`], [`cuMemHostGetDevicePointer_v2`], [`cuMemsetD2D8_v2`], [`cuMemsetD2D16_v2`], [`cuMemsetD2D32_v2`], [`cuMemsetD8_v2`], [`cuMemsetD16_v2`], [`cuMemsetD32_v2`], [cudaArrayGetInfo](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g373dacf191566b0bf5e5b807517b6bf9).
11200 ///
11201 /// # Parameters
11202 ///
11203 /// - `pArrayDescriptor`: Returned 3D array descriptor.
11204 /// - `hArray`: 3D array to get descriptor of.
11205 pub fn cuArray3DGetDescriptor_v2(
11206 pArrayDescriptor: *mut CUDA_ARRAY3D_DESCRIPTOR,
11207 hArray: CUarray,
11208 ) -> CUresult;
11209}
11210unsafe extern "C" {
11211 /// Creates a CUDA mipmapped array.
11212 ///
11213 /// Creates a CUDA mipmapped array according to the CUDA_ARRAY3D_DESCRIPTOR structure pMipmappedArrayDesc and returns a handle to the new CUDA mipmapped array in \*pHandle. numMipmapLevels specifies the number of mipmap levels to be allocated. This value is clamped to the range \[1, 1 + floor(log2(max(width, height,
11214 /// depth)))\].
11215 ///
11216 /// The CUDA_ARRAY3D_DESCRIPTOR is defined as:
11217 ///
11218 /// ```text
11219 /// typedef struct {
11220 /// unsigned int Width;
11221 /// unsigned int Height;
11222 /// unsigned int Depth;
11223 /// CUarray_format Format;
11224 /// unsigned int NumChannels;
11225 /// unsigned int Flags;
11226 /// } CUDA_ARRAY3D_DESCRIPTOR;
11227 /// ```
11228 ///
11229 /// where:
11230 ///
11231 /// * Width, Height, and Depth are the width, height, and depth of the CUDA array (in elements); the following types of CUDA arrays can be allocated:
11232 /// + A 1D mipmapped array is allocated if Height and Depth extents are both zero.
11233 /// + A 2D mipmapped array is allocated if only Depth extent is zero.
11234 /// + A 3D mipmapped array is allocated if all three extents are non-zero.
11235 /// + A 1D layered CUDA mipmapped array is allocated if only Height is zero and the [`CUDA_ARRAY3D_LAYERED`] flag is set. Each layer is a 1D array. The number of layers is determined by the depth extent.
11236 /// + A 2D layered CUDA mipmapped array is allocated if all three extents are non-zero and the [`CUDA_ARRAY3D_LAYERED`] flag is set. Each layer is a 2D array. The number of layers is determined by the depth extent.
11237 /// + A cubemap CUDA mipmapped array is allocated if all three extents are non-zero and the [`CUDA_ARRAY3D_CUBEMAP`] flag is set. Width must be equal to Height, and Depth must be six. A cubemap is a special type of 2D layered CUDA array, where the six layers represent the six faces of a cube.
11238 /// The order of the six layers in memory is the same as that listed in `CUarray_cubemap_face`.
11239 /// + A cubemap layered CUDA mipmapped array is allocated if all three extents are non-zero, and both, [`CUDA_ARRAY3D_CUBEMAP`] and [`CUDA_ARRAY3D_LAYERED`] flags are set. Width must be equal to Height, and Depth must be a multiple of six. A cubemap layered CUDA array is a special type of 2D layered CUDA array that consists of a collection
11240 /// of cubemaps. The first six layers represent the first cubemap, the next six layers form the second cubemap, and so on.
11241 ///
11242 /// * Format specifies the format of the elements; `CUarray_format` is defined as:
11243 ///
11244 /// ```text
11245 /// typedef enum CUarray_format_enum {
11246 /// CU_AD_FORMAT_UNSIGNED_INT8 = 0x01,
11247 /// CU_AD_FORMAT_UNSIGNED_INT16 = 0x02,
11248 /// CU_AD_FORMAT_UNSIGNED_INT32 = 0x03,
11249 /// CU_AD_FORMAT_SIGNED_INT8 = 0x08,
11250 /// CU_AD_FORMAT_SIGNED_INT16 = 0x09,
11251 /// CU_AD_FORMAT_SIGNED_INT32 = 0x0a,
11252 /// CU_AD_FORMAT_HALF = 0x10,
11253 /// CU_AD_FORMAT_FLOAT = 0x20,
11254 /// CU_AD_FORMAT_NV12 = 0xb0,
11255 /// CU_AD_FORMAT_UNORM_INT8X1 = 0xc0,
11256 /// CU_AD_FORMAT_UNORM_INT8X2 = 0xc1,
11257 /// CU_AD_FORMAT_UNORM_INT8X4 = 0xc2,
11258 /// CU_AD_FORMAT_UNORM_INT16X1 = 0xc3,
11259 /// CU_AD_FORMAT_UNORM_INT16X2 = 0xc4,
11260 /// CU_AD_FORMAT_UNORM_INT16X4 = 0xc5,
11261 /// CU_AD_FORMAT_SNORM_INT8X1 = 0xc6,
11262 /// CU_AD_FORMAT_SNORM_INT8X2 = 0xc7,
11263 /// CU_AD_FORMAT_SNORM_INT8X4 = 0xc8,
11264 /// CU_AD_FORMAT_SNORM_INT16X1 = 0xc9,
11265 /// CU_AD_FORMAT_SNORM_INT16X2 = 0xca,
11266 /// CU_AD_FORMAT_SNORM_INT16X4 = 0xcb,
11267 /// CU_AD_FORMAT_BC1_UNORM = 0x91,
11268 /// CU_AD_FORMAT_BC1_UNORM_SRGB = 0x92,
11269 /// CU_AD_FORMAT_BC2_UNORM = 0x93,
11270 /// CU_AD_FORMAT_BC2_UNORM_SRGB = 0x94,
11271 /// CU_AD_FORMAT_BC3_UNORM = 0x95,
11272 /// CU_AD_FORMAT_BC3_UNORM_SRGB = 0x96,
11273 /// CU_AD_FORMAT_BC4_UNORM = 0x97,
11274 /// CU_AD_FORMAT_BC4_SNORM = 0x98,
11275 /// CU_AD_FORMAT_BC5_UNORM = 0x99,
11276 /// CU_AD_FORMAT_BC5_SNORM = 0x9a,
11277 /// CU_AD_FORMAT_BC6H_UF16 = 0x9b,
11278 /// CU_AD_FORMAT_BC6H_SF16 = 0x9c,
11279 /// CU_AD_FORMAT_BC7_UNORM = 0x9d,
11280 /// CU_AD_FORMAT_BC7_UNORM_SRGB = 0x9e,
11281 /// CU_AD_FORMAT_P010 = 0x9f,
11282 /// CU_AD_FORMAT_P016 = 0xa1,
11283 /// CU_AD_FORMAT_NV16 = 0xa2,
11284 /// CU_AD_FORMAT_P210 = 0xa3,
11285 /// CU_AD_FORMAT_P216 = 0xa4,
11286 /// CU_AD_FORMAT_YUY2 = 0xa5,
11287 /// CU_AD_FORMAT_Y210 = 0xa6,
11288 /// CU_AD_FORMAT_Y216 = 0xa7,
11289 /// CU_AD_FORMAT_AYUV = 0xa8,
11290 /// CU_AD_FORMAT_Y410 = 0xa9,
11291 /// CU_AD_FORMAT_Y416 = 0xb1,
11292 /// CU_AD_FORMAT_Y444_PLANAR8 = 0xb2,
11293 /// CU_AD_FORMAT_Y444_PLANAR10 = 0xb3,
11294 /// CU_AD_FORMAT_YUV444_8bit_SemiPlanar = 0xb4,
11295 /// CU_AD_FORMAT_YUV444_16bit_SemiPlanar = 0xb5,
11296 /// CU_AD_FORMAT_UNORM_INT_101010_2 = 0x50,
11297 /// CU_AD_FORMAT_UINT8_PACKED_422 = 0x51,
11298 /// CU_AD_FORMAT_UINT8_PACKED_444 = 0x52,
11299 /// CU_AD_FORMAT_UINT8_SEMIPLANAR_420 = 0x53,
11300 /// CU_AD_FORMAT_UINT16_SEMIPLANAR_420 = 0x54,
11301 /// CU_AD_FORMAT_UINT8_SEMIPLANAR_422 = 0x55,
11302 /// CU_AD_FORMAT_UINT16_SEMIPLANAR_422 = 0x56,
11303 /// CU_AD_FORMAT_UINT8_SEMIPLANAR_444 = 0x57,
11304 /// CU_AD_FORMAT_UINT16_SEMIPLANAR_444 = 0x58,
11305 /// CU_AD_FORMAT_UINT8_PLANAR_420 = 0x59,
11306 /// CU_AD_FORMAT_UINT16_PLANAR_420 = 0x5a,
11307 /// CU_AD_FORMAT_UINT8_PLANAR_422 = 0x5b,
11308 /// CU_AD_FORMAT_UINT16_PLANAR_422 = 0x5c,
11309 /// CU_AD_FORMAT_UINT8_PLANAR_444 = 0x5d,
11310 /// CU_AD_FORMAT_UINT16_PLANAR_444 = 0x5e,
11311 /// } CUarray_format;
11312 /// ```
11313 ///
11314 /// * NumChannels specifies the number of packed components per CUDA array element; it may be 1, 2, or 4;
11315 ///
11316 /// * Flags may be set to
11317 /// + [`CUDA_ARRAY3D_LAYERED`] to enable creation of layered CUDA mipmapped arrays. If this flag is set, Depth specifies the number of layers, not the depth of a 3D array.
11318 /// + [`CUDA_ARRAY3D_SURFACE_LDST`] to enable surface references to be bound to individual mipmap levels of the CUDA mipmapped array. If this flag is not set,
11319 /// [`cuSurfRefSetArray`] will fail when attempting to bind a mipmap level of the CUDA mipmapped array to a surface reference.
11320 /// + [`CUDA_ARRAY3D_CUBEMAP`] to enable creation of mipmapped cubemaps. If this flag is set, Width must be equal to Height, and Depth must be six. If the [`CUDA_ARRAY3D_LAYERED`] flag is also set, then Depth must be a multiple of six.
11321 /// + [`CUDA_ARRAY3D_TEXTURE_GATHER`] to indicate that the CUDA mipmapped array will be used for texture gather. Texture gather can only be performed on 2D CUDA
11322 /// mipmapped arrays.
11323 ///
11324 /// Width, Height and Depth must meet certain size requirements as listed in the following table. All values are specified in elements. Note that for
11325 /// brevity's sake, the full name of the device attribute is not specified. For ex., TEXTURE1D_MIPMAPPED_WIDTH refers to the device
11326 /// attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH`].
11327 ///
11328 /// | | | |
11329 /// | --- | --- | --- |
11330 /// | **CUDA array type** | **Valid extents that must always be met {(width range in elements), (height range), (depth range)}** | **Valid extents with CUDA_ARRAY3D_SURFACE_LDST set {(width range in elements), (height range), (depth range)}** |
11331 /// | 1D | { (1,TEXTURE1D_MIPMAPPED_WIDTH), 0, 0 } | { (1,SURFACE1D_WIDTH), 0, 0 } |
11332 /// | 2D | { (1,TEXTURE2D_MIPMAPPED_WIDTH), (1,TEXTURE2D_MIPMAPPED_HEIGHT), 0 } | { (1,SURFACE2D_WIDTH), (1,SURFACE2D_HEIGHT), 0 } |
11333 /// | 3D | { (1,TEXTURE3D_WIDTH), (1,TEXTURE3D_HEIGHT), (1,TEXTURE3D_DEPTH) } OR { (1,TEXTURE3D_WIDTH_ALTERNATE), (1,TEXTURE3D_HEIGHT_ALTERNATE), (1,TEXTURE3D_DEPTH_ALTERNATE) } | { (1,SURFACE3D_WIDTH), (1,SURFACE3D_HEIGHT), (1,SURFACE3D_DEPTH) } |
11334 /// | 1D Layered | { (1,TEXTURE1D_LAYERED_WIDTH), 0, (1,TEXTURE1D_LAYERED_LAYERS) } | { (1,SURFACE1D_LAYERED_WIDTH), 0, (1,SURFACE1D_LAYERED_LAYERS) } |
11335 /// | 2D Layered | { (1,TEXTURE2D_LAYERED_WIDTH), (1,TEXTURE2D_LAYERED_HEIGHT), (1,TEXTURE2D_LAYERED_LAYERS) } | { (1,SURFACE2D_LAYERED_WIDTH), (1,SURFACE2D_LAYERED_HEIGHT), (1,SURFACE2D_LAYERED_LAYERS) } |
11336 /// | Cubemap | { (1,TEXTURECUBEMAP_WIDTH), (1,TEXTURECUBEMAP_WIDTH), 6 } | { (1,SURFACECUBEMAP_WIDTH), (1,SURFACECUBEMAP_WIDTH), 6 } |
11337 /// | Cubemap Layered | { (1,TEXTURECUBEMAP_LAYERED_WIDTH), (1,TEXTURECUBEMAP_LAYERED_WIDTH), (1,TEXTURECUBEMAP_LAYERED_LAYERS) } | { (1,SURFACECUBEMAP_LAYERED_WIDTH), (1,SURFACECUBEMAP_LAYERED_WIDTH), (1,SURFACECUBEMAP_LAYERED_LAYERS) } |
11338 ///
11339 /// Note:
11340 ///
11341 /// Note that this function may also return error codes from previous, asynchronous launches.
11342 ///
11343 /// **See also:**
11344 ///
11345 /// [`cuMipmappedArrayDestroy`], [`cuMipmappedArrayGetLevel`], [`cuArrayCreate_v2`], [cudaMallocMipmappedArray](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g9abd550dd3f655473d2640dc85be9774).
11346 ///
11347 /// # Parameters
11348 ///
11349 /// - `pHandle`: Returned mipmapped array.
11350 /// - `pMipmappedArrayDesc`: mipmapped array descriptor.
11351 /// - `numMipmapLevels`: Number of mipmap levels.
11352 pub fn cuMipmappedArrayCreate(
11353 pHandle: *mut CUmipmappedArray,
11354 pMipmappedArrayDesc: *const CUDA_ARRAY3D_DESCRIPTOR,
11355 numMipmapLevels: ::core::ffi::c_uint,
11356 ) -> CUresult;
11357}
11358unsafe extern "C" {
11359 /// Gets a mipmap level of a CUDA mipmapped array.
11360 ///
11361 /// Returns in \*pLevelArray a CUDA array that represents a single mipmap level of the CUDA mipmapped array hMipmappedArray.
11362 ///
11363 /// If level is greater than the maximum number of levels in this mipmapped array, [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] is returned.
11364 ///
11365 /// Note:
11366 ///
11367 /// Note that this function may also return error codes from previous, asynchronous launches.
11368 ///
11369 /// **See also:**
11370 ///
11371 /// [`cuMipmappedArrayCreate`], [`cuMipmappedArrayDestroy`], [`cuArrayCreate_v2`], [cudaGetMipmappedArrayLevel](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g7086e6f81e6dda1ddf4cdb6c1764094a).
11372 ///
11373 /// # Parameters
11374 ///
11375 /// - `pLevelArray`: Returned mipmap level CUDA array.
11376 /// - `hMipmappedArray`: CUDA mipmapped array.
11377 /// - `level`: Mipmap level.
11378 pub fn cuMipmappedArrayGetLevel(
11379 pLevelArray: *mut CUarray,
11380 hMipmappedArray: CUmipmappedArray,
11381 level: ::core::ffi::c_uint,
11382 ) -> CUresult;
11383}
11384unsafe extern "C" {
11385 /// Destroys a CUDA mipmapped array.
11386 ///
11387 /// Destroys the CUDA mipmapped array hMipmappedArray.
11388 ///
11389 /// Note:
11390 ///
11391 /// Note that this function may also return error codes from previous, asynchronous launches.
11392 ///
11393 /// **See also:**
11394 ///
11395 /// [`cuMipmappedArrayCreate`], [`cuMipmappedArrayGetLevel`], [`cuArrayCreate_v2`], [cudaFreeMipmappedArray](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g904669241eac5bdbfb410eb4124e4924).
11396 ///
11397 /// # Parameters
11398 ///
11399 /// - `hMipmappedArray`: Mipmapped array to destroy.
11400 pub fn cuMipmappedArrayDestroy(hMipmappedArray: CUmipmappedArray) -> CUresult;
11401}
11402unsafe extern "C" {
11403 /// Retrieve handle for an address range.
11404 ///
11405 /// Get a handle of the specified type to an address range. When requesting CUmemRangeHandleType::CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD,
11406 /// address range obtained by a prior call to either [`cuMemAlloc_v2`] or [`cuMemAddressReserve`] is supported if the [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED`] device attribute returns true. If the address range was obtained via [`cuMemAddressReserve`], it must also be fully mapped via [`cuMemMap`]. Address range obtained by a prior call to either [`cuMemAllocHost_v2`] or [`cuMemHostAlloc`] is supported if the [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_HOST_ALLOC_DMA_BUF_SUPPORTED`] device attribute returns true.
11407 ///
11408 /// As of CUDA 13.0, querying support for address range obtained by calling [`cuMemAllocHost_v2`] or [`cuMemHostAlloc`] using the [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED`] device attribute is deprecated.
11409 ///
11410 /// Users must ensure the dptr and size are aligned to the host page size.
11411 ///
11412 /// The handle will be interpreted as a pointer to an integer to store the dma_buf file descriptor. Users must ensure the entire address
11413 /// range is backed and mapped when the address range is allocated by [`cuMemAddressReserve`]. All the physical allocations backing the address range must be resident on the same device and have identical allocation
11414 /// properties. Users are also expected to retrieve a new handle every time the underlying physical allocation(s) corresponding
11415 /// to a previously queried VA range are changed.
11416 ///
11417 /// For CUmemRangeHandleType::CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD, users may set flags to [`CUmemRangeFlags_enum::CU_MEM_RANGE_FLAG_DMA_BUF_MAPPING_TYPE_PCIE`]. Which when set on a supported platform, will give a DMA_BUF handle mapped via PCIE BAR1 or will return an error otherwise.
11418 ///
11419 /// If the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_DMA_BUF_MMAP_SUPPORTED`] is set and a CUmemRangeHandleType::CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD is requested for a device memory range then the returned
11420 /// dmabuf file descriptor may be passed as the file descriptor argument to the mmap() system call.
11421 ///
11422 /// For device memory on x86 systems the mapping will be a write combined mapping. On coherent ARM platforms these mappings will
11423 /// be regular cached memory. On all other platforms these mappings will be uncached.
11424 ///
11425 /// # Parameters
11426 ///
11427 /// - `handle`: Pointer to the location where the returned handle will be stored.
11428 /// - `dptr`: Pointer to a valid CUDA device allocation. Must be aligned to host page size.
11429 /// - `size`: Length of the address range. Must be aligned to host page size.
11430 /// - `handleType`: Type of handle requested (defines type and size of the handle output parameter).
11431 /// - `flags`: When requesting CUmemRangeHandleType::CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD the value could be [`CUmemRangeFlags_enum::CU_MEM_RANGE_FLAG_DMA_BUF_MAPPING_TYPE_PCIE`], otherwise 0.
11432 pub fn cuMemGetHandleForAddressRange(
11433 handle: *mut ::core::ffi::c_void,
11434 dptr: CUdeviceptr,
11435 size: size_t,
11436 handleType: CUmemRangeHandleType,
11437 flags: ::core::ffi::c_ulonglong,
11438 ) -> CUresult;
11439}
11440#[repr(u32)]
11441#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
11442pub enum CUmemDecompressAlgorithm_enum {
11443 /// Decompression is unsupported.
11444 CU_MEM_DECOMPRESS_UNSUPPORTED = 0,
11445 /// Deflate is supported.
11446 CU_MEM_DECOMPRESS_ALGORITHM_DEFLATE = 1,
11447 /// Snappy is supported.
11448 CU_MEM_DECOMPRESS_ALGORITHM_SNAPPY = 2,
11449 /// LZ4 is supported.
11450 CU_MEM_DECOMPRESS_ALGORITHM_LZ4 = 4,
11451}
11452pub use self::CUmemDecompressAlgorithm_enum as CUmemDecompressAlgorithm;
11453#[repr(C)]
11454#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
11455pub struct CUmemDecompressParams_st {
11456 pub srcNumBytes: size_t,
11457 pub dstNumBytes: size_t,
11458 pub dstActBytes: *mut cuuint32_t,
11459 pub src: *const ::core::ffi::c_void,
11460 pub dst: *mut ::core::ffi::c_void,
11461 pub algo: CUmemDecompressAlgorithm,
11462 pub padding: [::core::ffi::c_uchar; 20usize],
11463}
11464impl Default for CUmemDecompressParams_st {
11465 fn default() -> Self {
11466 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
11467 unsafe {
11468 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11469 s.assume_init()
11470 }
11471 }
11472}
11473/// Structure describing the parameters that compose a single decompression operation.
11474pub type CUmemDecompressParams = CUmemDecompressParams_st;
11475unsafe extern "C" {
11476 /// Submit a batch of count independent decompression operations.
11477 ///
11478 /// Each of the count decompression operations is described by a single entry in the paramsArray array. Once the batch has been submitted, the function will return, and decompression will happen asynchronously with respect to the
11479 /// CPU. To the work completion tracking mechanisms in the CUDA driver, the batch will be considered a single unit of work and
11480 /// processed according to stream semantics, i.e., it is not possible to query the completion of individual decompression operations
11481 /// within a batch.
11482 ///
11483 /// The memory pointed to by each of [CUmemDecompressParams.src](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemDecompressParams.html#structCUmemDecompressParams_14d390c15ec5ed068f0912e42077ae0e0), [CUmemDecompressParams.dst](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemDecompressParams.html#structCUmemDecompressParams_139077e823122cfcfab6aeca53093c88c), and [CUmemDecompressParams.dstActBytes](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemDecompressParams.html#structCUmemDecompressParams_1df7e9b52dd81aa6c0ed689eeab86d1a7), must be capable of usage with the hardware decompress feature. That is, for each of said pointers, the pointer attribute
11484 /// [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_IS_HW_DECOMPRESS_CAPABLE`] should give a non-zero value. To ensure this, the memory backing the pointers should have been allocated using one of the
11485 /// following CUDA memory allocators: \* [`cuMemAlloc_v2`] \* [`cuMemCreate`] with the usage flag [`CU_MEM_CREATE_USAGE_HW_DECOMPRESS`] \* [`cuMemAllocFromPoolAsync`] from a pool that was created with the usage flag [`CU_MEM_POOL_CREATE_USAGE_HW_DECOMPRESS`] Additionally, [CUmemDecompressParams.src](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemDecompressParams.html#structCUmemDecompressParams_14d390c15ec5ed068f0912e42077ae0e0), [CUmemDecompressParams.dst](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemDecompressParams.html#structCUmemDecompressParams_139077e823122cfcfab6aeca53093c88c), and [CUmemDecompressParams.dstActBytes](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemDecompressParams.html#structCUmemDecompressParams_1df7e9b52dd81aa6c0ed689eeab86d1a7), must all be accessible from the device associated with the context where stream was created. For information on how to ensure this, see the documentation for the allocator of interest.
11486 ///
11487 /// Note:
11488 ///
11489 /// * Note that this function may also return error codes from previous, asynchronous launches.
11490 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
11491 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
11492 ///
11493 /// **See also:**
11494 ///
11495 /// [`cuMemAlloc_v2`], [`cuMemPoolCreate`], [`cuMemAllocFromPoolAsync`].
11496 ///
11497 /// # Parameters
11498 ///
11499 /// - `paramsArray`: The array of structures describing the independent decompression operations.
11500 /// - `count`: The number of entries in paramsArray array.
11501 /// - `flags`: Must be 0.
11502 /// - `errorIndex`: The index into paramsArray of the decompression operation for which the error returned by this function pertains to. If index is SIZE_MAX and the value returned is not [`cudaError_enum::CUDA_SUCCESS`], then the error returned by this function should be considered a general error that does not pertain to a particular decompression
11503 /// operation. May be NULL, in which case, no index will be recorded in the event of error.
11504 /// - `stream`: The stream where the work will be enqueued.
11505 pub fn cuMemBatchDecompressAsync(
11506 paramsArray: *mut CUmemDecompressParams,
11507 count: size_t,
11508 flags: ::core::ffi::c_uint,
11509 errorIndex: *mut size_t,
11510 stream: CUstream,
11511 ) -> CUresult;
11512}
11513unsafe extern "C" {
11514 /// Allocate an address range reservation.
11515 ///
11516 /// Reserves a virtual address range based on the given parameters, giving the starting address of the range in ptr. This API requires a system that supports UVA. The size and address parameters must be a multiple of the host page size and
11517 /// the alignment must be a power of two or zero for default alignment. If addr is 0, then the driver chooses the address at which to place the start of the reservation whereas when it is non-zero then
11518 /// the driver treats it as a hint about where to place the reservation.
11519 ///
11520 /// **See also:**
11521 ///
11522 /// [`cuMemAddressFree`].
11523 ///
11524 /// # Parameters
11525 ///
11526 /// - `ptr`: Resulting pointer to start of virtual address range allocated.
11527 /// - `size`: Size of the reserved virtual address range requested.
11528 /// - `alignment`: Alignment of the reserved virtual address range requested.
11529 /// - `addr`: Hint address for the start of the address range.
11530 /// - `flags`: Currently unused, must be zero.
11531 pub fn cuMemAddressReserve(
11532 ptr: *mut CUdeviceptr,
11533 size: size_t,
11534 alignment: size_t,
11535 addr: CUdeviceptr,
11536 flags: ::core::ffi::c_ulonglong,
11537 ) -> CUresult;
11538}
11539unsafe extern "C" {
11540 /// Free an address range reservation.
11541 ///
11542 /// Frees a virtual address range reserved by cuMemAddressReserve. The size must match what was given to memAddressReserve and
11543 /// the ptr given must match what was returned from memAddressReserve.
11544 ///
11545 /// **See also:**
11546 ///
11547 /// [`cuMemAddressReserve`].
11548 ///
11549 /// # Parameters
11550 ///
11551 /// - `ptr`: Starting address of the virtual address range to free.
11552 /// - `size`: Size of the virtual address region to free.
11553 pub fn cuMemAddressFree(ptr: CUdeviceptr, size: size_t) -> CUresult;
11554}
11555unsafe extern "C" {
11556 /// Create a CUDA memory handle representing a memory allocation of a given size described by the given properties.
11557 ///
11558 /// This creates a memory allocation on the target device specified through the prop structure. The created allocation will not have any device or host mappings. The generic memory handle for the allocation can be mapped to the address space of calling process via [`cuMemMap`]. This handle cannot be transmitted directly to other processes (see [`cuMemExportToShareableHandle`]). On Windows, the caller must also pass an LPSECURITYATTRIBUTE in prop to be associated with this handle which limits or allows access to this handle for a recipient process (see [CUmemAllocationProp::win32HandleMetaData](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemAllocationProp__v1.html#structCUmemAllocationProp__v1_1542262ad88e1d00f02b306c641270168) for more). The size of this allocation must be a multiple of the value given via [`cuMemGetAllocationGranularity`] with the [`CUmemAllocationGranularity_flags_enum::CU_MEM_ALLOC_GRANULARITY_MINIMUM`] flag. To create a CPU allocation that doesn't target any specific NUMA nodes, applications must set CUmemAllocationProp::CUmemLocation::type
11559 /// to [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST`]. CUmemAllocationProp::CUmemLocation::id is ignored for HOST allocations. HOST allocations are not IPC capable and [CUmemAllocationProp::requestedHandleTypes](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemAllocationProp__v1.html#structCUmemAllocationProp__v1_1e2e852e72e5d2053b771fbac49495efd) must be 0, any other value will result in [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`]. To create a CPU allocation targeting a specific host NUMA node, applications must set CUmemAllocationProp::CUmemLocation::type
11560 /// to [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`] and CUmemAllocationProp::CUmemLocation::id must specify the NUMA ID of the CPU. On systems where NUMA is not available CUmemAllocationProp::CUmemLocation::id
11561 /// must be set to 0. Specifying [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT`] as the [CUmemLocation::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_1a34fc29f2a55d501f00f912d92152d1b) will result in [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`].
11562 ///
11563 /// Applications that intend to use [`CUmemAllocationHandleType_enum::CU_MEM_HANDLE_TYPE_FABRIC`] based memory sharing must ensure: (1) `nvidia-caps-imex-channels` character device is created by the driver and is listed
11564 /// under /proc/devices (2) have at least one IMEX channel file accessible by the user launching the application.
11565 ///
11566 /// When exporter and importer CUDA processes have been granted access to the same IMEX channel, they can securely share memory.
11567 ///
11568 /// The IMEX channel security model works on a per user basis. Which means all processes under a user can share memory if the
11569 /// user has access to a valid IMEX channel. When multi-user isolation is desired, a separate IMEX channel is required for each
11570 /// user.
11571 ///
11572 /// These channel files exist in /dev/nvidia-caps-imex-channels/channel\* and can be created using standard OS native calls like
11573 /// mknod on Linux. For example: To create channel0 with the major number from /proc/devices users can execute the following command:
11574 /// `mknod /dev/nvidia-caps-imex-channels/channel0 c <major number>=""> 0`
11575 ///
11576 /// If CUmemAllocationProp::allocFlags::usage contains [`CU_MEM_CREATE_USAGE_TILE_POOL`] flag then the memory allocation is intended only to be used as backing tile pool for sparse CUDA arrays and sparse CUDA mipmapped
11577 /// arrays. (see [`cuMemMapArrayAsync`]).
11578 ///
11579 /// Note:
11580 ///
11581 /// Note that this function may also return error codes from previous, asynchronous launches.
11582 ///
11583 /// **See also:**
11584 ///
11585 /// [`cuMemRelease`], [`cuMemExportToShareableHandle`], [`cuMemImportFromShareableHandle`].
11586 ///
11587 /// # Parameters
11588 ///
11589 /// - `handle`: Value of handle returned. All operations on this allocation are to be performed using this handle.
11590 /// - `size`: Size of the allocation requested.
11591 /// - `prop`: Properties of the allocation to create.
11592 /// - `flags`: flags for future use, must be zero now.
11593 pub fn cuMemCreate(
11594 handle: *mut CUmemGenericAllocationHandle,
11595 size: size_t,
11596 prop: *const CUmemAllocationProp,
11597 flags: ::core::ffi::c_ulonglong,
11598 ) -> CUresult;
11599}
11600unsafe extern "C" {
11601 /// Release a memory handle representing a memory allocation which was previously allocated through cuMemCreate.
11602 ///
11603 /// Frees the memory that was allocated on a device through cuMemCreate.
11604 ///
11605 /// The memory allocation will be freed when all outstanding mappings to the memory are unmapped and when all outstanding references
11606 /// to the handle (including it's shareable counterparts) are also released. The generic memory handle can be freed when there
11607 /// are still outstanding mappings made with this handle. Each time a recipient process imports a shareable handle, it needs to
11608 /// pair it with [`cuMemRelease`] for the handle to be freed. If handle is not a valid handle the behavior is undefined.
11609 ///
11610 /// Note:
11611 ///
11612 /// Note that this function may also return error codes from previous, asynchronous launches.
11613 ///
11614 /// **See also:**
11615 ///
11616 /// [`cuMemCreate`].
11617 ///
11618 /// # Parameters
11619 ///
11620 /// - `handle`: Value of handle which was returned previously by cuMemCreate.
11621 pub fn cuMemRelease(handle: CUmemGenericAllocationHandle) -> CUresult;
11622}
11623unsafe extern "C" {
11624 /// Maps an allocation handle to a reserved virtual address range.
11625 ///
11626 /// Maps bytes of memory represented by handle starting from byte offset to size to address range \[addr, addr + size\]. This range must be an address reservation previously reserved with [`cuMemAddressReserve`], and offset + size must be less than the size of the memory allocation. Both ptr, size, and offset must be a multiple of the value given via [`cuMemGetAllocationGranularity`] with the [`CUmemAllocationGranularity_flags_enum::CU_MEM_ALLOC_GRANULARITY_MINIMUM`] flag. If handle represents a multicast object, ptr, size and offset must be aligned to the value returned by [`cuMulticastGetGranularity`] with the flag CU_MULTICAST_MINIMUM_GRANULARITY. For best performance however, it is recommended that ptr, size and offset be aligned to the value returned by [`cuMulticastGetGranularity`] with the flag CU_MULTICAST_RECOMMENDED_GRANULARITY.
11627 ///
11628 /// When handle represents a multicast object, this call may return [`CUresult::CUDA_ERROR_ILLEGAL_STATE`] if the system configuration is in an illegal
11629 /// state. In such cases, to continue using multicast, verify that the system configuration is in a valid state and all required
11630 /// driver daemons are running properly.
11631 ///
11632 /// Please note calling [`cuMemMap`] does not make the address accessible, the caller needs to update accessibility of a contiguous mapped VA range by calling
11633 /// [`cuMemSetAccess`].
11634 ///
11635 /// Once a recipient process obtains a shareable memory handle from [`cuMemImportFromShareableHandle`], the process must use [`cuMemMap`] to map the memory into its address ranges before setting accessibility with [`cuMemSetAccess`].
11636 ///
11637 /// [`cuMemMap`] can only create mappings on VA range reservations that are not currently mapped.
11638 ///
11639 /// Note:
11640 ///
11641 /// Note that this function may also return error codes from previous, asynchronous launches.
11642 ///
11643 /// **See also:**
11644 ///
11645 /// [`cuMemUnmap`], [`cuMemSetAccess`], [`cuMemCreate`], [`cuMemAddressReserve`], [`cuMemImportFromShareableHandle`].
11646 ///
11647 /// # Parameters
11648 ///
11649 /// - `ptr`: Address where memory will be mapped.
11650 /// - `size`: Size of the memory mapping.
11651 /// - `offset`: Offset into the memory represented by
11652 ///
11653 /// * handle from which to start mapping
11654 /// * Note: currently must be zero.
11655 /// - `handle`: Handle to a shareable memory.
11656 /// - `flags`: flags for future use, must be zero now.
11657 pub fn cuMemMap(
11658 ptr: CUdeviceptr,
11659 size: size_t,
11660 offset: size_t,
11661 handle: CUmemGenericAllocationHandle,
11662 flags: ::core::ffi::c_ulonglong,
11663 ) -> CUresult;
11664}
11665unsafe extern "C" {
11666 /// Maps or unmaps subregions of sparse CUDA arrays and sparse CUDA mipmapped arrays.
11667 ///
11668 /// Performs map or unmap operations on subregions of sparse CUDA arrays and sparse CUDA mipmapped arrays. Each operation is specified
11669 /// by a CUarrayMapInfo entry in the mapInfoList array of size count. The structure CUarrayMapInfo is defined as follow:
11670 ///
11671 /// ```text
11672 /// typedef struct CUarrayMapInfo_st {
11673 /// CUresourcetype resourceType;
11674 /// union {
11675 /// CUmipmappedArray mipmap;
11676 /// CUarray array;
11677 /// } resource;
11678 ///
11679 /// CUarraySparseSubresourceType subresourceType;
11680 /// union {
11681 /// struct {
11682 /// unsigned int level;
11683 /// unsigned int layer;
11684 /// unsigned int offsetX;
11685 /// unsigned int offsetY;
11686 /// unsigned int offsetZ;
11687 /// unsigned int extentWidth;
11688 /// unsigned int extentHeight;
11689 /// unsigned int extentDepth;
11690 /// } sparseLevel;
11691 /// struct {
11692 /// unsigned int layer;
11693 /// unsigned long long offset;
11694 /// unsigned long long size;
11695 /// } miptail;
11696 /// } subresource;
11697 ///
11698 /// CUmemOperationType memOperationType;
11699 ///
11700 /// CUmemHandleType memHandleType;
11701 /// union {
11702 /// CUmemGenericAllocationHandle memHandle;
11703 /// } memHandle;
11704 ///
11705 /// unsigned long long offset;
11706 /// unsigned int deviceBitMask;
11707 /// unsigned int flags;
11708 /// unsigned int reserved\[2\];
11709 /// } CUarrayMapInfo;
11710 /// ```
11711 ///
11712 /// where [CUarrayMapInfo::resourceType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUarrayMapInfo__v1.html#structCUarrayMapInfo__v1_18cf3c7ba97c834ab8b0fcfb50fec578c) specifies the type of resource to be operated on. If [CUarrayMapInfo::resourceType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUarrayMapInfo__v1.html#structCUarrayMapInfo__v1_18cf3c7ba97c834ab8b0fcfb50fec578c) is set to [`CUresourcetype::CU_RESOURCE_TYPE_ARRAY`] then CUarrayMapInfo::resource::array must be set to a valid sparse CUDA array handle. The CUDA array must be either a 2D,
11713 /// 2D layered or 3D CUDA array and must have been allocated using [`cuArrayCreate_v2`] or [`cuArray3DCreate_v2`] with the flag [`CUDA_ARRAY3D_SPARSE`] or [`CUDA_ARRAY3D_DEFERRED_MAPPING`]. For CUDA arrays obtained using [`cuMipmappedArrayGetLevel`], [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] will be returned. If [CUarrayMapInfo::resourceType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUarrayMapInfo__v1.html#structCUarrayMapInfo__v1_18cf3c7ba97c834ab8b0fcfb50fec578c) is set to [`CUresourcetype::CU_RESOURCE_TYPE_MIPMAPPED_ARRAY`] then CUarrayMapInfo::resource::mipmap must be set to a valid sparse CUDA mipmapped array handle. The CUDA mipmapped array
11714 /// must be either a 2D, 2D layered or 3D CUDA mipmapped array and must have been allocated using [`cuMipmappedArrayCreate`] with the flag [`CUDA_ARRAY3D_SPARSE`] or [`CUDA_ARRAY3D_DEFERRED_MAPPING`].
11715 ///
11716 /// [CUarrayMapInfo::subresourceType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUarrayMapInfo__v1.html#structCUarrayMapInfo__v1_17a2fe272bd8e44af2386f1c20c3d3c68) specifies the type of subresource within the resource. CUarraySparseSubresourceType_enum is defined as:
11717 ///
11718 /// ```text
11719 /// typedef enum CUarraySparseSubresourceType_enum {
11720 /// CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL = 0,
11721 /// CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL = 1
11722 /// } CUarraySparseSubresourceType;
11723 /// ```
11724 ///
11725 /// where CUarraySparseSubresourceType::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL indicates a sparse-miplevel which spans
11726 /// at least one tile in every dimension. The remaining miplevels which are too small to span at least one tile in any dimension
11727 /// constitute the mip tail region as indicated by CUarraySparseSubresourceType::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL subresource
11728 /// type.
11729 ///
11730 /// If [CUarrayMapInfo::subresourceType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUarrayMapInfo__v1.html#structCUarrayMapInfo__v1_17a2fe272bd8e44af2386f1c20c3d3c68) is set to CUarraySparseSubresourceType::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL then CUarrayMapInfo::subresource::sparseLevel
11731 /// struct must contain valid array subregion offsets and extents. The CUarrayMapInfo::subresource::sparseLevel::offsetX, CUarrayMapInfo::subresource::sparseLevel::offsetY
11732 /// and CUarrayMapInfo::subresource::sparseLevel::offsetZ must specify valid X, Y and Z offsets respectively. The CUarrayMapInfo::subresource::sparseLevel::extentWidth,
11733 /// CUarrayMapInfo::subresource::sparseLevel::extentHeight and CUarrayMapInfo::subresource::sparseLevel::extentDepth must specify
11734 /// valid width, height and depth extents respectively. These offsets and extents must be aligned to the corresponding tile dimension.
11735 /// For CUDA mipmapped arrays CUarrayMapInfo::subresource::sparseLevel::level must specify a valid mip level index. Otherwise,
11736 /// must be zero. For layered CUDA arrays and layered CUDA mipmapped arrays CUarrayMapInfo::subresource::sparseLevel::layer must
11737 /// specify a valid layer index. Otherwise, must be zero. CUarrayMapInfo::subresource::sparseLevel::offsetZ must be zero and CUarrayMapInfo::subresource::sparseLevel::extentDepth
11738 /// must be set to 1 for 2D and 2D layered CUDA arrays and CUDA mipmapped arrays. Tile extents can be obtained by calling [`cuArrayGetSparseProperties`] and [`cuMipmappedArrayGetSparseProperties`]
11739 ///
11740 /// If [CUarrayMapInfo::subresourceType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUarrayMapInfo__v1.html#structCUarrayMapInfo__v1_17a2fe272bd8e44af2386f1c20c3d3c68) is set to CUarraySparseSubresourceType::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL then CUarrayMapInfo::subresource::miptail
11741 /// struct must contain valid mip tail offset in CUarrayMapInfo::subresource::miptail::offset and size in CUarrayMapInfo::subresource::miptail::size.
11742 /// Both, mip tail offset and mip tail size must be aligned to the tile size. For layered CUDA mipmapped arrays which don't have
11743 /// the flag [`CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL`] set in [CUDA_ARRAY_SPARSE_PROPERTIES::flags](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structCUDA__ARRAY__SPARSE__PROPERTIES__v1_10e842bb64091fa47809112c700cb5f0a) as returned by [`cuMipmappedArrayGetSparseProperties`], CUarrayMapInfo::subresource::miptail::layer must specify a valid layer index. Otherwise, must be zero.
11744 ///
11745 /// If CUarrayMapInfo::resource::array or CUarrayMapInfo::resource::mipmap was created with [`CUDA_ARRAY3D_DEFERRED_MAPPING`] flag set the [CUarrayMapInfo::subresourceType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUarrayMapInfo__v1.html#structCUarrayMapInfo__v1_17a2fe272bd8e44af2386f1c20c3d3c68) and the contents of CUarrayMapInfo::subresource will be ignored.
11746 ///
11747 /// [CUarrayMapInfo::memOperationType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUarrayMapInfo__v1.html#structCUarrayMapInfo__v1_1dd139e9655407264f2aeb812cec0f19e) specifies the type of operation. `CUmemOperationType` is defined as:
11748 ///
11749 /// ```text
11750 /// typedef enum CUmemOperationType_enum {
11751 /// CU_MEM_OPERATION_TYPE_MAP = 1,
11752 /// CU_MEM_OPERATION_TYPE_UNMAP = 2
11753 /// } CUmemOperationType;
11754 /// ```
11755 ///
11756 /// If [CUarrayMapInfo::memOperationType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUarrayMapInfo__v1.html#structCUarrayMapInfo__v1_1dd139e9655407264f2aeb812cec0f19e) is set to CUmemOperationType::CU_MEM_OPERATION_TYPE_MAP then the subresource will be mapped onto the tile pool memory specified
11757 /// by CUarrayMapInfo::memHandle at offset [CUarrayMapInfo::offset](https://docs.nvidia.com/cuda/cuda-driver-api/structCUarrayMapInfo__v1.html#structCUarrayMapInfo__v1_14aee5e358272af897aeaf8b44fd15bdb). The tile pool allocation has to be created by specifying the [`CU_MEM_CREATE_USAGE_TILE_POOL`] flag when calling [`cuMemCreate`]. Also, [CUarrayMapInfo::memHandleType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUarrayMapInfo__v1.html#structCUarrayMapInfo__v1_1ed15e0aa10304948c68946fe8a5da161) must be set to CUmemHandleType::CU_MEM_HANDLE_TYPE_GENERIC.
11758 ///
11759 /// If [CUarrayMapInfo::memOperationType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUarrayMapInfo__v1.html#structCUarrayMapInfo__v1_1dd139e9655407264f2aeb812cec0f19e) is set to CUmemOperationType::CU_MEM_OPERATION_TYPE_UNMAP then an unmapping operation is performed. CUarrayMapInfo::memHandle
11760 /// must be NULL.
11761 ///
11762 /// [CUarrayMapInfo::deviceBitMask](https://docs.nvidia.com/cuda/cuda-driver-api/structCUarrayMapInfo__v1.html#structCUarrayMapInfo__v1_1f2d14f719018cc1daa786f7fd0652c2c) specifies the list of devices that must map or unmap physical memory. Currently, this mask must have exactly one bit set,
11763 /// and the corresponding device must match the device associated with the stream. If [CUarrayMapInfo::memOperationType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUarrayMapInfo__v1.html#structCUarrayMapInfo__v1_1dd139e9655407264f2aeb812cec0f19e) is set to CUmemOperationType::CU_MEM_OPERATION_TYPE_MAP, the device must also match the device associated with the tile pool
11764 /// memory allocation as specified by CUarrayMapInfo::memHandle.
11765 ///
11766 /// [CUarrayMapInfo::flags](https://docs.nvidia.com/cuda/cuda-driver-api/structCUarrayMapInfo__v1.html#structCUarrayMapInfo__v1_12e36982c16390693a56807d0b8e6380f) and [CUarrayMapInfo::reserved](https://docs.nvidia.com/cuda/cuda-driver-api/structCUarrayMapInfo__v1.html#structCUarrayMapInfo__v1_1cf7014dc4a157928de12563d0181ceba)[] are unused and must be set to zero.
11767 ///
11768 /// **See also:**
11769 ///
11770 /// [`cuMipmappedArrayCreate`], [`cuArrayCreate_v2`], [`cuArray3DCreate_v2`], [`cuMemCreate`], [`cuArrayGetSparseProperties`], [`cuMipmappedArrayGetSparseProperties`].
11771 ///
11772 /// # Parameters
11773 ///
11774 /// - `mapInfoList`: List of CUarrayMapInfo.
11775 /// - `count`: Count of CUarrayMapInfo in mapInfoList.
11776 /// - `hStream`: Stream identifier for the stream to use for map or unmap operations.
11777 pub fn cuMemMapArrayAsync(
11778 mapInfoList: *mut CUarrayMapInfo,
11779 count: ::core::ffi::c_uint,
11780 hStream: CUstream,
11781 ) -> CUresult;
11782}
11783unsafe extern "C" {
11784 /// Unmap the backing memory of a given address range.
11785 ///
11786 /// The range must be the entire contiguous address range that was mapped to. In other words, [`cuMemUnmap`] cannot unmap a sub-range of an address range mapped by [`cuMemCreate`] / [`cuMemMap`]. Any backing memory allocations will be freed if there are no existing mappings and there are no unreleased memory handles.
11787 ///
11788 /// When [`cuMemUnmap`] returns successfully the address range is converted to an address reservation and can be used for a future calls to [`cuMemMap`]. Any new mapping to this virtual address will need to have access granted through [`cuMemSetAccess`], as all mappings start with no accessibility setup.
11789 ///
11790 /// Note:
11791 ///
11792 /// * Note that this function may also return error codes from previous, asynchronous launches.
11793 /// * This function exhibits [synchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-sync) behavior for most use cases.
11794 ///
11795 /// **See also:**
11796 ///
11797 /// [`cuMemCreate`], [`cuMemAddressReserve`].
11798 ///
11799 /// # Parameters
11800 ///
11801 /// - `ptr`: Starting address for the virtual address range to unmap.
11802 /// - `size`: Size of the virtual address range to unmap.
11803 pub fn cuMemUnmap(ptr: CUdeviceptr, size: size_t) -> CUresult;
11804}
11805unsafe extern "C" {
11806 /// Set the access flags for each location specified in desc for the given virtual address range.
11807 ///
11808 /// Given the virtual address range via ptr and size, and the locations in the array given by desc and count, set the access flags for the target locations. The range must be a fully mapped address range containing all allocations
11809 /// created by [`cuMemMap`] / [`cuMemCreate`]. Users cannot specify [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`] accessibility for allocations created on with other location types. Note: When CUmemAccessDesc::CUmemLocation::type is [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`], CUmemAccessDesc::CUmemLocation::id is ignored. When setting the access flags for a virtual address range mapping a multicast
11810 /// object, ptr and size must be aligned to the value returned by [`cuMulticastGetGranularity`] with the flag CU_MULTICAST_MINIMUM_GRANULARITY. For best performance however, it is recommended that ptr and size be aligned to the value returned by [`cuMulticastGetGranularity`] with the flag CU_MULTICAST_RECOMMENDED_GRANULARITY.
11811 ///
11812 /// Note:
11813 ///
11814 /// * Note that this function may also return error codes from previous, asynchronous launches.
11815 /// * This function exhibits [synchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-sync) behavior for most use cases.
11816 ///
11817 /// **See also:**
11818 ///
11819 /// [`cuMemSetAccess`], [`cuMemCreate`], :[`cuMemMap`].
11820 ///
11821 /// # Parameters
11822 ///
11823 /// - `ptr`: Starting address for the virtual address range.
11824 /// - `size`: Length of the virtual address range.
11825 /// - `desc`: Array of CUmemAccessDesc that describe how to change the
11826 ///
11827 /// * mapping for each location specified.
11828 /// - `count`: Number of CUmemAccessDesc in desc.
11829 pub fn cuMemSetAccess(
11830 ptr: CUdeviceptr,
11831 size: size_t,
11832 desc: *const CUmemAccessDesc,
11833 count: size_t,
11834 ) -> CUresult;
11835}
11836unsafe extern "C" {
11837 /// Get the access flags set for the given location and ptr.
11838 ///
11839 /// **See also:**
11840 ///
11841 /// [`cuMemSetAccess`].
11842 ///
11843 /// # Parameters
11844 ///
11845 /// - `flags`: Flags set for this location.
11846 /// - `location`: Location in which to check the flags for.
11847 /// - `ptr`: Address in which to check the access flags for.
11848 pub fn cuMemGetAccess(
11849 flags: *mut ::core::ffi::c_ulonglong,
11850 location: *const CUmemLocation,
11851 ptr: CUdeviceptr,
11852 ) -> CUresult;
11853}
11854unsafe extern "C" {
11855 /// Exports an allocation to a requested shareable handle type.
11856 ///
11857 /// Given a CUDA memory handle, create a shareable memory allocation handle that can be used to share the memory with other processes.
11858 /// The recipient process can convert the shareable handle back into a CUDA memory handle using [`cuMemImportFromShareableHandle`] and map it with [`cuMemMap`]. The implementation of what this handle is and how it can be transferred is defined by the requested handle type in handleType
11859 ///
11860 /// Once all shareable handles are closed and the allocation is released, the allocated memory referenced will be released back
11861 /// to the OS and uses of the CUDA handle afterward will lead to undefined behavior.
11862 ///
11863 /// This API can also be used in conjunction with other APIs (e.g. Vulkan, OpenGL) that support importing memory from the shareable
11864 /// type
11865 ///
11866 /// **See also:**
11867 ///
11868 /// [`cuMemImportFromShareableHandle`].
11869 ///
11870 /// # Parameters
11871 ///
11872 /// - `shareableHandle`: Pointer to the location in which to store the requested handle type.
11873 /// - `handle`: CUDA handle for the memory allocation.
11874 /// - `handleType`: Type of shareable handle requested (defines type and size of the shareableHandle output parameter).
11875 /// - `flags`: Reserved, must be zero.
11876 pub fn cuMemExportToShareableHandle(
11877 shareableHandle: *mut ::core::ffi::c_void,
11878 handle: CUmemGenericAllocationHandle,
11879 handleType: CUmemAllocationHandleType,
11880 flags: ::core::ffi::c_ulonglong,
11881 ) -> CUresult;
11882}
11883unsafe extern "C" {
11884 /// Imports an allocation from a requested shareable handle type.
11885 ///
11886 /// If the current process cannot support the memory described by this shareable handle, this API will error as [`cudaError_enum::CUDA_ERROR_NOT_SUPPORTED`].
11887 ///
11888 /// If shHandleType is [`CUmemAllocationHandleType_enum::CU_MEM_HANDLE_TYPE_FABRIC`] and the importer process has not been granted access to the same IMEX channel as the exporter process, this API will error
11889 /// as [`cudaError_enum::CUDA_ERROR_NOT_PERMITTED`].
11890 ///
11891 /// Note:
11892 ///
11893 /// Importing shareable handles exported from some graphics APIs(VUlkan, OpenGL, etc) created on devices under an SLI group may
11894 /// not be supported, and thus this API will return [`CUresult::CUDA_ERROR_NOT_SUPPORTED`]. There is no guarantee that the contents of handle will be the same CUDA memory handle for the same given OS shareable handle, or the same underlying allocation.
11895 ///
11896 /// **See also:**
11897 ///
11898 /// [`cuMemExportToShareableHandle`], [`cuMemMap`], [`cuMemRelease`].
11899 ///
11900 /// # Parameters
11901 ///
11902 /// - `handle`: CUDA Memory handle for the memory allocation.
11903 /// - `osHandle`: Shareable Handle representing the memory allocation that is to be imported.
11904 /// - `shHandleType`: handle type of the exported handle `CUmemAllocationHandleType`.
11905 pub fn cuMemImportFromShareableHandle(
11906 handle: *mut CUmemGenericAllocationHandle,
11907 osHandle: *mut ::core::ffi::c_void,
11908 shHandleType: CUmemAllocationHandleType,
11909 ) -> CUresult;
11910}
11911unsafe extern "C" {
11912 /// Calculates either the minimal or recommended granularity.
11913 ///
11914 /// Calculates either the minimal or recommended granularity for a given allocation specification and returns it in granularity.
11915 /// This granularity can be used as a multiple for alignment, size, or address mapping.
11916 ///
11917 /// **See also:**
11918 ///
11919 /// [`cuMemCreate`], [`cuMemMap`].
11920 ///
11921 /// # Parameters
11922 ///
11923 /// - `granularity`: Returned granularity.
11924 /// - `prop`: Property for which to determine the granularity for.
11925 /// - `option`: Determines which granularity to return.
11926 pub fn cuMemGetAllocationGranularity(
11927 granularity: *mut size_t,
11928 prop: *const CUmemAllocationProp,
11929 option: CUmemAllocationGranularity_flags,
11930 ) -> CUresult;
11931}
11932unsafe extern "C" {
11933 /// Retrieve the contents of the property structure defining properties for this handle.
11934 ///
11935 /// **See also:**
11936 ///
11937 /// [`cuMemCreate`], [`cuMemImportFromShareableHandle`].
11938 ///
11939 /// # Parameters
11940 ///
11941 /// - `prop`: Pointer to a properties structure which will hold the information about this handle.
11942 /// - `handle`: Handle which to perform the query on.
11943 pub fn cuMemGetAllocationPropertiesFromHandle(
11944 prop: *mut CUmemAllocationProp,
11945 handle: CUmemGenericAllocationHandle,
11946 ) -> CUresult;
11947}
11948unsafe extern "C" {
11949 /// Given an address addr, returns the allocation handle of the backing memory allocation.
11950 ///
11951 /// The handle is guaranteed to be the same handle value used to map the memory. If the address requested is not mapped, the function
11952 /// will fail. The returned handle must be released with corresponding number of calls to [`cuMemRelease`].
11953 ///
11954 /// Note:
11955 ///
11956 /// The address addr, can be any address in a range previously mapped by [`cuMemMap`], and not necessarily the start address.
11957 ///
11958 /// **See also:**
11959 ///
11960 /// [`cuMemCreate`], [`cuMemRelease`], [`cuMemMap`].
11961 ///
11962 /// # Parameters
11963 ///
11964 /// - `handle`: CUDA Memory handle for the backing memory allocation.
11965 /// - `addr`: Memory address to query, that has been mapped previously.
11966 pub fn cuMemRetainAllocationHandle(
11967 handle: *mut CUmemGenericAllocationHandle,
11968 addr: *mut ::core::ffi::c_void,
11969 ) -> CUresult;
11970}
11971unsafe extern "C" {
11972 /// Frees memory with stream ordered semantics.
11973 ///
11974 /// Inserts a free operation into hStream. The allocation must not be accessed after stream execution reaches the free. After this API returns, accessing the memory
11975 /// from any subsequent work launched on the GPU or querying its pointer attributes results in undefined behavior.
11976 ///
11977 /// Note:
11978 ///
11979 /// During stream capture, this function results in the creation of a free node and must therefore be passed the address of a
11980 /// graph allocation.
11981 ///
11982 /// # Parameters
11983 ///
11984 /// - `dptr`: memory to free.
11985 /// - `hStream`: The stream establishing the stream ordering contract.
11986 pub fn cuMemFreeAsync(dptr: CUdeviceptr, hStream: CUstream) -> CUresult;
11987}
11988unsafe extern "C" {
11989 /// Allocates memory with stream ordered semantics.
11990 ///
11991 /// Inserts an allocation operation into hStream. A pointer to the allocated memory is returned immediately in \*dptr. The allocation must not be accessed until the allocation
11992 /// operation completes. The allocation comes from the memory pool current to the stream's device.
11993 ///
11994 /// Note:
11995 ///
11996 /// * The default memory pool of a device contains device memory from that device.
11997 /// * Basic stream ordering allows future work submitted into the same stream to use the allocation. Stream query, stream synchronize,
11998 /// and CUDA events can be used to guarantee that the allocation operation completes before work submitted in a separate stream
11999 /// runs.
12000 /// * During stream capture, this function results in the creation of an allocation node. In this case, the allocation is owned
12001 /// by the graph instead of the memory pool. The memory pool's properties are used to set the node's creation parameters.
12002 ///
12003 /// **See also:**
12004 ///
12005 /// [`cuMemAllocFromPoolAsync`], [`cuMemFreeAsync`], [`cuDeviceSetMemPool`], [`cuDeviceGetDefaultMemPool`], [`cuDeviceGetMemPool`], [`cuMemPoolCreate`], [`cuMemPoolSetAccess`], [`cuMemPoolSetAttribute`].
12006 ///
12007 /// # Parameters
12008 ///
12009 /// - `dptr`: Returned device pointer.
12010 /// - `bytesize`: Number of bytes to allocate.
12011 /// - `hStream`: The stream establishing the stream ordering contract and the memory pool to allocate from.
12012 pub fn cuMemAllocAsync(
12013 dptr: *mut CUdeviceptr,
12014 bytesize: size_t,
12015 hStream: CUstream,
12016 ) -> CUresult;
12017}
12018unsafe extern "C" {
12019 /// Tries to release memory back to the OS.
12020 ///
12021 /// Releases memory back to the OS until the pool contains fewer than minBytesToKeep reserved bytes, or there is no more memory
12022 /// that the allocator can safely release. The allocator cannot release OS allocations that back outstanding asynchronous allocations.
12023 /// The OS allocations may happen at different granularity from the user allocations.
12024 ///
12025 /// Note:
12026 ///
12027 /// * : Allocations that have not been freed count as outstanding.
12028 /// * : Allocations that have been asynchronously freed but whose completion has not been observed on the host (eg. by a synchronize)
12029 /// can count as outstanding.
12030 ///
12031 /// **See also:**
12032 ///
12033 /// [`cuMemAllocAsync`], [`cuMemFreeAsync`], [`cuDeviceGetDefaultMemPool`], [`cuDeviceGetMemPool`], [`cuMemPoolCreate`].
12034 ///
12035 /// # Parameters
12036 ///
12037 /// - `pool`: The memory pool to trim.
12038 /// - `minBytesToKeep`: If the pool has less than minBytesToKeep reserved, the TrimTo operation is a no-op. Otherwise the pool will be guaranteed
12039 /// to have at least minBytesToKeep bytes reserved after the operation.
12040 pub fn cuMemPoolTrimTo(pool: CUmemoryPool, minBytesToKeep: size_t) -> CUresult;
12041}
12042unsafe extern "C" {
12043 /// Sets attributes of a memory pool.
12044 ///
12045 /// Supported attributes are:
12046 ///
12047 /// * [`CUmemPool_attribute_enum::CU_MEMPOOL_ATTR_RELEASE_THRESHOLD`]: (value type = cuuint64_t) Amount of reserved memory in bytes to hold onto before trying to release memory back to the OS.
12048 /// When more than the release threshold bytes of memory are held by the memory pool, the allocator will try to release memory
12049 /// back to the OS on the next call to stream, event or context synchronize. (default 0)
12050 /// * [`CUmemPool_attribute_enum::CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES`]: (value type = int) Allow [`cuMemAllocAsync`] to use memory asynchronously freed in another stream as long as a stream ordering dependency of the allocating stream on
12051 /// the free action exists. CUDA events and null stream interactions can create the required stream ordered dependencies. (default
12052 /// enabled)
12053 /// * [`CUmemPool_attribute_enum::CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC`]: (value type = int) Allow reuse of already completed frees when there is no dependency between the free and allocation. (default
12054 /// enabled)
12055 /// * [`CUmemPool_attribute_enum::CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES`]: (value type = int) Allow [`cuMemAllocAsync`] to insert new stream dependencies in order to establish the stream ordering required to reuse a piece of memory released
12056 /// by [`cuMemFreeAsync`] (default enabled).
12057 /// * [`CUmemPool_attribute_enum::CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH`]: (value type = cuuint64_t) Reset the high watermark that tracks the amount of backing memory that was allocated for the memory
12058 /// pool. It is illegal to set this attribute to a non-zero value.
12059 /// * [`CUmemPool_attribute_enum::CU_MEMPOOL_ATTR_USED_MEM_HIGH`]: (value type = cuuint64_t) Reset the high watermark that tracks the amount of used memory that was allocated for the memory
12060 /// pool.
12061 ///
12062 /// **See also:**
12063 ///
12064 /// [`cuMemAllocAsync`], [`cuMemFreeAsync`], [`cuDeviceGetDefaultMemPool`], [`cuDeviceGetMemPool`], [`cuMemPoolCreate`].
12065 ///
12066 /// # Parameters
12067 ///
12068 /// - `pool`: The memory pool to modify.
12069 /// - `attr`: The attribute to modify.
12070 /// - `value`: Pointer to the value to assign.
12071 pub fn cuMemPoolSetAttribute(
12072 pool: CUmemoryPool,
12073 attr: CUmemPool_attribute,
12074 value: *mut ::core::ffi::c_void,
12075 ) -> CUresult;
12076}
12077unsafe extern "C" {
12078 /// Gets attributes of a memory pool.
12079 ///
12080 /// Supported attributes are:
12081 ///
12082 /// * [`CUmemPool_attribute_enum::CU_MEMPOOL_ATTR_RELEASE_THRESHOLD`]: (value type = cuuint64_t) Amount of reserved memory in bytes to hold onto before trying to release memory back to the OS.
12083 /// When more than the release threshold bytes of memory are held by the memory pool, the allocator will try to release memory
12084 /// back to the OS on the next call to stream, event or context synchronize. (default 0)
12085 /// * [`CUmemPool_attribute_enum::CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES`]: (value type = int) Allow [`cuMemAllocAsync`] to use memory asynchronously freed in another stream as long as a stream ordering dependency of the allocating stream on
12086 /// the free action exists. CUDA events and null stream interactions can create the required stream ordered dependencies. (default
12087 /// enabled)
12088 /// * [`CUmemPool_attribute_enum::CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC`]: (value type = int) Allow reuse of already completed frees when there is no dependency between the free and allocation. (default
12089 /// enabled)
12090 /// * [`CUmemPool_attribute_enum::CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES`]: (value type = int) Allow [`cuMemAllocAsync`] to insert new stream dependencies in order to establish the stream ordering required to reuse a piece of memory released
12091 /// by [`cuMemFreeAsync`] (default enabled).
12092 /// * [`CUmemPool_attribute_enum::CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT`]: (value type = cuuint64_t) Amount of backing memory currently allocated for the mempool
12093 /// * [`CUmemPool_attribute_enum::CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH`]: (value type = cuuint64_t) High watermark of backing memory allocated for the mempool since the last time it was reset.
12094 /// * [`CUmemPool_attribute_enum::CU_MEMPOOL_ATTR_USED_MEM_CURRENT`]: (value type = cuuint64_t) Amount of memory from the pool that is currently in use by the application.
12095 /// * [`CUmemPool_attribute_enum::CU_MEMPOOL_ATTR_USED_MEM_HIGH`]: (value type = cuuint64_t) High watermark of the amount of memory from the pool that was in use by the application.
12096 ///
12097 /// **See also:**
12098 ///
12099 /// [`cuMemAllocAsync`], [`cuMemFreeAsync`], [`cuDeviceGetDefaultMemPool`], [`cuDeviceGetMemPool`], [`cuMemPoolCreate`].
12100 ///
12101 /// # Parameters
12102 ///
12103 /// - `pool`: The memory pool to get attributes of.
12104 /// - `attr`: The attribute to get.
12105 /// - `value`: Retrieved value.
12106 pub fn cuMemPoolGetAttribute(
12107 pool: CUmemoryPool,
12108 attr: CUmemPool_attribute,
12109 value: *mut ::core::ffi::c_void,
12110 ) -> CUresult;
12111}
12112unsafe extern "C" {
12113 /// Controls visibility of pools between devices.
12114 ///
12115 /// **See also:**
12116 ///
12117 /// [`cuMemAllocAsync`], [`cuMemFreeAsync`], [`cuDeviceGetDefaultMemPool`], [`cuDeviceGetMemPool`], [`cuMemPoolCreate`].
12118 ///
12119 /// # Parameters
12120 ///
12121 /// - `pool`: The pool being modified.
12122 /// - `map`: Array of access descriptors. Each descriptor instructs the access to enable for a single gpu.
12123 /// - `count`: Number of descriptors in the map array.
12124 pub fn cuMemPoolSetAccess(
12125 pool: CUmemoryPool,
12126 map: *const CUmemAccessDesc,
12127 count: size_t,
12128 ) -> CUresult;
12129}
12130unsafe extern "C" {
12131 /// Returns the accessibility of a pool from a device.
12132 ///
12133 /// Returns the accessibility of the pool's memory from the specified location.
12134 ///
12135 /// **See also:**
12136 ///
12137 /// [`cuMemAllocAsync`], [`cuMemFreeAsync`], [`cuDeviceGetDefaultMemPool`], [`cuDeviceGetMemPool`], [`cuMemPoolCreate`].
12138 ///
12139 /// # Parameters
12140 ///
12141 /// - `flags`: the accessibility of the pool from the specified location.
12142 /// - `memPool`: the pool being queried.
12143 /// - `location`: the location accessing the pool.
12144 pub fn cuMemPoolGetAccess(
12145 flags: *mut CUmemAccess_flags,
12146 memPool: CUmemoryPool,
12147 location: *mut CUmemLocation,
12148 ) -> CUresult;
12149}
12150unsafe extern "C" {
12151 /// Creates a memory pool.
12152 ///
12153 /// Creates a CUDA memory pool and returns the handle in pool. The poolProps determines the properties of the pool such as the backing device and IPC capabilities.
12154 ///
12155 /// To create a memory pool for HOST memory not targeting a specific NUMA node, applications must set set CUmemPoolProps::CUmemLocation::type
12156 /// to [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST`]. CUmemPoolProps::CUmemLocation::id is ignored for such pools. Pools created with the type [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST`] are not IPC capable and [CUmemPoolProps::handleTypes](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemPoolProps__v1.html#structCUmemPoolProps__v1_169e75d604b122dbd39a8e3e3eacbe660) must be 0, any other values will result in [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`]. To create a memory pool targeting a specific host NUMA node, applications must set CUmemPoolProps::CUmemLocation::type to
12157 /// [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`] and CUmemPoolProps::CUmemLocation::id must specify the NUMA ID of the host memory node. Specifying [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT`] as the CUmemPoolProps::CUmemLocation::type will result in [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`]. By default, the pool's memory will be accessible from the device it is allocated on. In the case of pools created with [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`] or [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST`], their default accessibility will be from the host CPU. Applications can control the maximum size of the pool by specifying
12158 /// a non-zero value for [CUmemPoolProps::maxSize](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemPoolProps__v1.html#structCUmemPoolProps__v1_10f9278cc88653f1eee70ab6a7a2ad7f3). If set to 0, the maximum size of the pool will default to a system dependent value.
12159 ///
12160 /// Applications that intend to use [`CUmemAllocationHandleType_enum::CU_MEM_HANDLE_TYPE_FABRIC`] based memory sharing must ensure: (1) `nvidia-caps-imex-channels` character device is created by the driver and is listed
12161 /// under /proc/devices (2) have at least one IMEX channel file accessible by the user launching the application.
12162 ///
12163 /// When exporter and importer CUDA processes have been granted access to the same IMEX channel, they can securely share memory.
12164 ///
12165 /// The IMEX channel security model works on a per user basis. Which means all processes under a user can share memory if the
12166 /// user has access to a valid IMEX channel. When multi-user isolation is desired, a separate IMEX channel is required for each
12167 /// user.
12168 ///
12169 /// These channel files exist in /dev/nvidia-caps-imex-channels/channel\* and can be created using standard OS native calls like
12170 /// mknod on Linux. For example: To create channel0 with the major number from /proc/devices users can execute the following command:
12171 /// `mknod /dev/nvidia-caps-imex-channels/channel0 c <major number>=""> 0`
12172 ///
12173 /// To create a managed memory pool, applications must set `CUmemAllocationType` to [`CUmemAllocationType::CU_MEM_ALLOCATION_TYPE_MANAGED`]. `CUmemAllocationHandleType` must also be set to [`CUmemAllocationHandleType::CU_MEM_HANDLE_TYPE_NONE`] since IPC is not supported. For managed memory pools, CUmemPoolProps::CUmemLocation
12174 /// will be treated as the preferred location for all allocations created from the pool. An application can also set [`CUmemLocationType::CU_MEM_LOCATION_TYPE_NONE`]
12175 /// to indicate no preferred location. [CUmemPoolProps::maxSize](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemPoolProps__v1.html#structCUmemPoolProps__v1_10f9278cc88653f1eee70ab6a7a2ad7f3) must be set to zero for managed memory pools. [CUmemPoolProps::usage](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemPoolProps__v1.html#structCUmemPoolProps__v1_181dcd809a228c4346f8e732bb8e9070b) should be zero as decompress for managed memory is not supported. For managed memory pools, all devices on the system must
12176 /// have non-zero concurrentManagedAccess. If not, this call returns [`CUresult::CUDA_ERROR_NOT_SUPPORTED`]
12177 ///
12178 /// Note:
12179 ///
12180 /// Specifying [`CUmemAllocationHandleType::CU_MEM_HANDLE_TYPE_NONE`] creates a memory pool that will not support IPC.
12181 ///
12182 /// **See also:**
12183 ///
12184 /// [`cuDeviceSetMemPool`], [`cuDeviceGetMemPool`], [`cuDeviceGetDefaultMemPool`], [`cuMemAllocFromPoolAsync`], [`cuMemPoolExportToShareableHandle`].
12185 pub fn cuMemPoolCreate(
12186 pool: *mut CUmemoryPool,
12187 poolProps: *const CUmemPoolProps,
12188 ) -> CUresult;
12189}
12190unsafe extern "C" {
12191 /// Destroys the specified memory pool.
12192 ///
12193 /// If any pointers obtained from this pool haven't been freed or the pool has free operations that haven't completed when [`cuMemPoolDestroy`] is invoked, the function will return immediately and the resources associated with the pool will be released automatically
12194 /// once there are no more outstanding allocations.
12195 ///
12196 /// Destroying the current mempool of a device sets the default mempool of that device as the current mempool for that device.
12197 ///
12198 /// Note:
12199 ///
12200 /// A device's default memory pool cannot be destroyed.
12201 ///
12202 /// **See also:**
12203 ///
12204 /// [`cuMemFreeAsync`], [`cuDeviceSetMemPool`], [`cuDeviceGetMemPool`], [`cuDeviceGetDefaultMemPool`], [`cuMemPoolCreate`].
12205 pub fn cuMemPoolDestroy(pool: CUmemoryPool) -> CUresult;
12206}
12207unsafe extern "C" {
12208 /// Returns the default memory pool for a given location and allocation type.
12209 ///
12210 /// The memory location can be of one of [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE`], [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST`] or [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`]. The allocation type can be one of [`CUmemAllocationType_enum::CU_MEM_ALLOCATION_TYPE_PINNED`] or [`CUmemAllocationType_enum::CU_MEM_ALLOCATION_TYPE_MANAGED`]. When the allocation type is [`CUmemAllocationType_enum::CU_MEM_ALLOCATION_TYPE_MANAGED`], the location type can also be [CU_MEM_LOCATION_TYPE_NONE](https://docs.nvidia.com/cuda/cuda-driver-api/types.html#group__CUDA__TYPES_1gg75cfd5b9fa5c1c6ee2be2547bfbe882ecfc8f2ab14e813f7afe8019052526fa4) to indicate no preferred location for the managed memory pool. In all other cases, the call returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`].
12211 ///
12212 /// Note:
12213 ///
12214 /// Note that this function may also return error codes from previous, asynchronous launches.
12215 ///
12216 /// **See also:**
12217 ///
12218 /// [`cuMemAllocAsync`], [`cuMemPoolTrimTo`], [`cuMemPoolGetAttribute`], [`cuMemPoolSetAttribute`], [`cuMemPoolSetAccess`], [`cuMemGetMemPool`], [`cuMemPoolCreate`].
12219 pub fn cuMemGetDefaultMemPool(
12220 pool_out: *mut CUmemoryPool,
12221 location: *mut CUmemLocation,
12222 type_: CUmemAllocationType,
12223 ) -> CUresult;
12224}
12225unsafe extern "C" {
12226 /// Gets the current memory pool for a memory location and of a particular allocation type.
12227 ///
12228 /// The memory location can be of one of [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE`], [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST`] or [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`]. The allocation type can be one of [`CUmemAllocationType_enum::CU_MEM_ALLOCATION_TYPE_PINNED`] or [`CUmemAllocationType_enum::CU_MEM_ALLOCATION_TYPE_MANAGED`]. When the allocation type is [`CUmemAllocationType_enum::CU_MEM_ALLOCATION_TYPE_MANAGED`], the location type can also be [CU_MEM_LOCATION_TYPE_NONE](https://docs.nvidia.com/cuda/cuda-driver-api/types.html#group__CUDA__TYPES_1gg75cfd5b9fa5c1c6ee2be2547bfbe882ecfc8f2ab14e813f7afe8019052526fa4) to indicate no preferred location for the managed memory pool. In all other cases, the call returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`]
12229 ///
12230 /// Returns the last pool provided to [`cuMemSetMemPool`] or [`cuDeviceSetMemPool`] for this location and allocation type or the location's default memory pool if [`cuMemSetMemPool`] or [`cuDeviceSetMemPool`] for that allocType and location has never been called. By default the current mempool of a location is the default mempool
12231 /// for a device. Otherwise the returned pool must have been set with [`cuDeviceSetMemPool`].
12232 ///
12233 /// **See also:**
12234 ///
12235 /// [`cuDeviceGetDefaultMemPool`], [`cuMemPoolCreate`], [`cuDeviceSetMemPool`], [`cuMemSetMemPool`].
12236 pub fn cuMemGetMemPool(
12237 pool: *mut CUmemoryPool,
12238 location: *mut CUmemLocation,
12239 type_: CUmemAllocationType,
12240 ) -> CUresult;
12241}
12242unsafe extern "C" {
12243 /// Sets the current memory pool for a memory location and allocation type.
12244 ///
12245 /// The memory location can be of one of [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE`], [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST`] or [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`]. The allocation type can be one of [`CUmemAllocationType_enum::CU_MEM_ALLOCATION_TYPE_PINNED`] or [`CUmemAllocationType_enum::CU_MEM_ALLOCATION_TYPE_MANAGED`]. When the allocation type is [`CUmemAllocationType_enum::CU_MEM_ALLOCATION_TYPE_MANAGED`], the location type can also be [CU_MEM_LOCATION_TYPE_NONE](https://docs.nvidia.com/cuda/cuda-driver-api/types.html#group__CUDA__TYPES_1gg75cfd5b9fa5c1c6ee2be2547bfbe882ecfc8f2ab14e813f7afe8019052526fa4) to indicate no preferred location for the managed memory pool. In all other cases, the call returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`].
12246 ///
12247 /// When a memory pool is set as the current memory pool, the location parameter should be the same as the location of the pool.
12248 /// The location and allocation type specified must match those of the pool otherwise [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] is returned. By default, a memory location's current memory pool is its default memory pool that can be obtained via [`cuMemGetDefaultMemPool`]. If the location type is [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE`] and the allocation type is [`CUmemAllocationType_enum::CU_MEM_ALLOCATION_TYPE_PINNED`], then this API is the equivalent of calling [`cuDeviceSetMemPool`] with the location id as the device. For further details on the implications, please refer to the documentation for [`cuDeviceSetMemPool`].
12249 ///
12250 /// Note:
12251 ///
12252 /// Use [`cuMemAllocFromPoolAsync`] to specify asynchronous allocations from a device different than the one the stream runs on.
12253 ///
12254 /// **See also:**
12255 ///
12256 /// [`cuDeviceGetDefaultMemPool`], [`cuDeviceGetMemPool`], [`cuMemGetMemPool`], [`cuMemPoolCreate`], [`cuMemPoolDestroy`], [`cuMemAllocFromPoolAsync`].
12257 pub fn cuMemSetMemPool(
12258 location: *mut CUmemLocation,
12259 type_: CUmemAllocationType,
12260 pool: CUmemoryPool,
12261 ) -> CUresult;
12262}
12263unsafe extern "C" {
12264 /// Allocates memory from a specified pool with stream ordered semantics.
12265 ///
12266 /// Inserts an allocation operation into hStream. A pointer to the allocated memory is returned immediately in \*dptr. The allocation must not be accessed until the allocation
12267 /// operation completes. The allocation comes from the specified memory pool.
12268 ///
12269 /// Note:
12270 ///
12271 /// * The specified memory pool may be from a device different than that of the specified hStream.
12272 ///
12273 /// * Basic stream ordering allows future work submitted into the same stream to use the allocation. Stream query, stream synchronize,
12274 /// and CUDA events can be used to guarantee that the allocation operation completes before work submitted in a separate stream
12275 /// runs.
12276 ///
12277 /// Note:
12278 ///
12279 /// During stream capture, this function results in the creation of an allocation node. In this case, the allocation is owned
12280 /// by the graph instead of the memory pool. The memory pool's properties are used to set the node's creation parameters.
12281 ///
12282 /// **See also:**
12283 ///
12284 /// [`cuMemAllocAsync`], [`cuMemFreeAsync`], [`cuDeviceGetDefaultMemPool`], [`cuDeviceGetMemPool`], [`cuMemPoolCreate`], [`cuMemPoolSetAccess`], [`cuMemPoolSetAttribute`].
12285 ///
12286 /// # Parameters
12287 ///
12288 /// - `dptr`: Returned device pointer.
12289 /// - `bytesize`: Number of bytes to allocate.
12290 /// - `pool`: The pool to allocate from.
12291 /// - `hStream`: The stream establishing the stream ordering semantic.
12292 pub fn cuMemAllocFromPoolAsync(
12293 dptr: *mut CUdeviceptr,
12294 bytesize: size_t,
12295 pool: CUmemoryPool,
12296 hStream: CUstream,
12297 ) -> CUresult;
12298}
12299unsafe extern "C" {
12300 /// Exports a memory pool to the requested handle type.
12301 ///
12302 /// Given an IPC capable mempool, create an OS handle to share the pool with another process. A recipient process can convert
12303 /// the shareable handle into a mempool with [`cuMemPoolImportFromShareableHandle`]. Individual pointers can then be shared with the [`cuMemPoolExportPointer`] and [`cuMemPoolImportPointer`] APIs. The implementation of what the shareable handle is and how it can be transferred is defined by the requested handle
12304 /// type.
12305 ///
12306 /// Note:
12307 ///
12308 /// : To create an IPC capable mempool, create a mempool with a CUmemAllocationHandleType other than [`CUmemAllocationHandleType::CU_MEM_HANDLE_TYPE_NONE`].
12309 ///
12310 /// **See also:**
12311 ///
12312 /// [`cuMemPoolImportFromShareableHandle`], [`cuMemPoolExportPointer`], [`cuMemPoolImportPointer`], [`cuMemAllocAsync`], [`cuMemFreeAsync`], [`cuDeviceGetDefaultMemPool`], [`cuDeviceGetMemPool`], [`cuMemPoolCreate`], [`cuMemPoolSetAccess`], [`cuMemPoolSetAttribute`].
12313 ///
12314 /// # Parameters
12315 ///
12316 /// - `handle_out`: Returned OS handle.
12317 /// - `pool`: pool to export.
12318 /// - `handleType`: the type of handle to create.
12319 /// - `flags`: must be 0.
12320 pub fn cuMemPoolExportToShareableHandle(
12321 handle_out: *mut ::core::ffi::c_void,
12322 pool: CUmemoryPool,
12323 handleType: CUmemAllocationHandleType,
12324 flags: ::core::ffi::c_ulonglong,
12325 ) -> CUresult;
12326}
12327unsafe extern "C" {
12328 /// imports a memory pool from a shared handle.
12329 ///
12330 /// Specific allocations can be imported from the imported pool with cuMemPoolImportPointer.
12331 ///
12332 /// If handleType is [`CUmemAllocationHandleType_enum::CU_MEM_HANDLE_TYPE_FABRIC`] and the importer process has not been granted access to the same IMEX channel as the exporter process, this API will error
12333 /// as [`cudaError_enum::CUDA_ERROR_NOT_PERMITTED`].
12334 ///
12335 /// Note:
12336 ///
12337 /// Imported memory pools do not support creating new allocations. As such imported memory pools may not be used in cuDeviceSetMemPool
12338 /// or [`cuMemAllocFromPoolAsync`] calls.
12339 ///
12340 /// **See also:**
12341 ///
12342 /// [`cuMemPoolExportToShareableHandle`], [`cuMemPoolExportPointer`], [`cuMemPoolImportPointer`].
12343 ///
12344 /// # Parameters
12345 ///
12346 /// - `pool_out`: Returned memory pool.
12347 /// - `handle`: OS handle of the pool to open.
12348 /// - `handleType`: The type of handle being imported.
12349 /// - `flags`: must be 0.
12350 pub fn cuMemPoolImportFromShareableHandle(
12351 pool_out: *mut CUmemoryPool,
12352 handle: *mut ::core::ffi::c_void,
12353 handleType: CUmemAllocationHandleType,
12354 flags: ::core::ffi::c_ulonglong,
12355 ) -> CUresult;
12356}
12357unsafe extern "C" {
12358 /// Export data to share a memory pool allocation between processes.
12359 ///
12360 /// Constructs shareData_out for sharing a specific allocation from an already shared memory pool. The recipient process can import the allocation with
12361 /// the [`cuMemPoolImportPointer`] api. The data is not a handle and may be shared through any IPC mechanism.
12362 ///
12363 /// **See also:**
12364 ///
12365 /// [`cuMemPoolExportToShareableHandle`], [`cuMemPoolImportFromShareableHandle`], [`cuMemPoolImportPointer`].
12366 ///
12367 /// # Parameters
12368 ///
12369 /// - `shareData_out`: Returned export data.
12370 /// - `ptr`: pointer to memory being exported.
12371 pub fn cuMemPoolExportPointer(
12372 shareData_out: *mut CUmemPoolPtrExportData,
12373 ptr: CUdeviceptr,
12374 ) -> CUresult;
12375}
12376unsafe extern "C" {
12377 /// Import a memory pool allocation from another process.
12378 ///
12379 /// Returns in ptr_out a pointer to the imported memory. The imported memory must not be accessed before the allocation operation completes in the
12380 /// exporting process. The imported memory must be freed from all importing processes before being freed in the exporting process.
12381 /// The pointer may be freed with cuMemFree or cuMemFreeAsync. If cuMemFreeAsync is used, the free must be completed on the importing
12382 /// process before the free operation on the exporting process.
12383 ///
12384 /// Note:
12385 ///
12386 /// The cuMemFreeAsync api may be used in the exporting process before the cuMemFreeAsync operation completes in its stream as
12387 /// long as the cuMemFreeAsync in the exporting process specifies a stream with a stream dependency on the importing process's
12388 /// cuMemFreeAsync.
12389 ///
12390 /// **See also:**
12391 ///
12392 /// [`cuMemPoolExportToShareableHandle`], [`cuMemPoolImportFromShareableHandle`], [`cuMemPoolExportPointer`].
12393 ///
12394 /// # Parameters
12395 ///
12396 /// - `ptr_out`: pointer to imported memory.
12397 /// - `pool`: pool from which to import.
12398 /// - `shareData`: data specifying the memory to import.
12399 pub fn cuMemPoolImportPointer(
12400 ptr_out: *mut CUdeviceptr,
12401 pool: CUmemoryPool,
12402 shareData: *mut CUmemPoolPtrExportData,
12403 ) -> CUresult;
12404}
12405unsafe extern "C" {
12406 /// Create a generic allocation handle representing a multicast object described by the given properties.
12407 ///
12408 /// This creates a multicast object as described by prop. The number of participating devices is specified by [CUmulticastObjectProp::numDevices](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmulticastObjectProp__v1.html#structCUmulticastObjectProp__v1_1e5d44c9262847a6c74e4ae37acdc7478). Devices can be added to the multicast object via [`cuMulticastAddDevice`]. All participating devices must be added to the multicast object before memory can be bound to it. Memory is bound to the
12409 /// multicast object via [`cuMulticastBindMem`], [`cuMulticastBindMem_v2`], [`cuMulticastBindAddr`], or [`cuMulticastBindAddr_v2`]. and can be unbound via [`cuMulticastUnbind`]. The total amount of memory that can be bound per device is specified by :[CUmulticastObjectProp::size](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmulticastObjectProp__v1.html#structCUmulticastObjectProp__v1_1a45dfd715e2e442fcc7e43f5ce2f8a46). This size must be a multiple of the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`]. For best performance however, the size should be aligned to the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_RECOMMENDED`].
12410 ///
12411 /// After all participating devices have been added, multicast objects can also be mapped to a device's virtual address space
12412 /// using the virtual memory management APIs (see [`cuMemMap`] and [`cuMemSetAccess`]). Multicast objects can also be shared with other processes by requesting a shareable handle via [`cuMemExportToShareableHandle`]. Note that the desired types of shareable handles must be specified in the bitmask [CUmulticastObjectProp::handleTypes](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmulticastObjectProp__v1.html#structCUmulticastObjectProp__v1_1705cc17eda91d960e96982f2fda52d55). Multicast objects can be released using the virtual memory management API [`cuMemRelease`].
12413 ///
12414 /// **See also:**
12415 ///
12416 /// [`cuMulticastAddDevice`], [`cuMulticastBindMem`], [`cuMulticastBindAddr`], [`cuMulticastUnbind`]
12417 ///
12418 /// [`cuMemCreate`], [`cuMemRelease`], [`cuMemExportToShareableHandle`], [`cuMemImportFromShareableHandle`]
12419 ///
12420 /// [`cuMulticastBindAddr_v2`], [`cuMulticastBindMem_v2`].
12421 ///
12422 /// # Parameters
12423 ///
12424 /// - `mcHandle`: Value of handle returned.
12425 /// - `prop`: Properties of the multicast object to create.
12426 pub fn cuMulticastCreate(
12427 mcHandle: *mut CUmemGenericAllocationHandle,
12428 prop: *const CUmulticastObjectProp,
12429 ) -> CUresult;
12430}
12431unsafe extern "C" {
12432 /// Associate a device to a multicast object.
12433 ///
12434 /// Associates a device to a multicast object. The added device will be a part of the multicast team of size specified by [CUmulticastObjectProp::numDevices](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmulticastObjectProp__v1.html#structCUmulticastObjectProp__v1_1e5d44c9262847a6c74e4ae37acdc7478) during [`cuMulticastCreate`]. The association of the device to the multicast object is permanent during the life time of the multicast object. All devices
12435 /// must be added to the multicast team before any memory can be bound to any device in the team. Any calls to [`cuMulticastBindMem`], [`cuMulticastBindMem_v2`], [`cuMulticastBindAddr`], or [`cuMulticastBindAddr_v2`] will block until all devices have been added. Similarly all devices must be added to the multicast team before a virtual
12436 /// address range can be mapped to the multicast object. A call to [`cuMemMap`] will block until all devices have been added.
12437 ///
12438 /// **See also:**
12439 ///
12440 /// [`cuMulticastCreate`], [`cuMulticastBindMem`], [`cuMulticastBindAddr`].
12441 ///
12442 /// # Parameters
12443 ///
12444 /// - `mcHandle`: Handle representing a multicast object.
12445 /// - `dev`: Device that will be associated to the multicast object.
12446 pub fn cuMulticastAddDevice(
12447 mcHandle: CUmemGenericAllocationHandle,
12448 dev: CUdevice,
12449 ) -> CUresult;
12450}
12451unsafe extern "C" {
12452 /// Bind a memory allocation represented by a handle to a multicast object.
12453 ///
12454 /// Binds a memory allocation specified by memHandle and created via [`cuMemCreate`] to a multicast object represented by mcHandle and created via [`cuMulticastCreate`]. The intended size of the bind, the offset in the multicast range mcOffset as well as the offset in the memory memOffset must be a multiple of the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`]. For best performance however, size, mcOffset and memOffset should be aligned to the granularity of the memory allocation(see ::cuMemGetAllocationGranularity) or to the value returned
12455 /// by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_RECOMMENDED`].
12456 ///
12457 /// The size + memOffset cannot be larger than the size of the allocated memory. Similarly the size + mcOffset cannot be larger than the size of the multicast object.
12458 ///
12459 /// The memory allocation must have beeen created on one of the devices that was added to the multicast team via [`cuMulticastAddDevice`]. Externally shareable as well as imported multicast objects can be bound only to externally shareable memory. Note that this
12460 /// call will return [`CUresult::CUDA_ERROR_OUT_OF_MEMORY`] if there are insufficient resources required to perform the bind. This call may
12461 /// also return [`CUresult::CUDA_ERROR_SYSTEM_NOT_READY`] if the necessary system software is not initialized or running.
12462 ///
12463 /// This call may return [`CUresult::CUDA_ERROR_ILLEGAL_STATE`] if the system configuration is in an illegal state. In such cases, to continue
12464 /// using multicast, verify that the system configuration is in a valid state and all required driver daemons are running properly.
12465 ///
12466 /// **See also:**
12467 ///
12468 /// [`cuMulticastCreate`], [`cuMulticastAddDevice`], [`cuMemCreate`]
12469 ///
12470 /// [`cuMulticastBindMem_v2`].
12471 ///
12472 /// # Parameters
12473 ///
12474 /// - `mcHandle`: Handle representing a multicast object.
12475 /// - `mcOffset`: Offset into the multicast object for attachment.
12476 /// - `memHandle`: Handle representing a memory allocation.
12477 /// - `memOffset`: Offset into the memory for attachment.
12478 /// - `size`: Size of the memory that will be bound to the multicast object.
12479 /// - `flags`: Flags for future use, must be zero for now.
12480 pub fn cuMulticastBindMem(
12481 mcHandle: CUmemGenericAllocationHandle,
12482 mcOffset: size_t,
12483 memHandle: CUmemGenericAllocationHandle,
12484 memOffset: size_t,
12485 size: size_t,
12486 flags: ::core::ffi::c_ulonglong,
12487 ) -> CUresult;
12488}
12489unsafe extern "C" {
12490 /// Bind a memory allocation represented by a handle to a multicast object.
12491 ///
12492 /// Binds a memory allocation specified by memHandle and created via [`cuMemCreate`] to a multicast object represented by mcHandle and created via [`cuMulticastCreate`]. The binding will be applicable for the device dev. The intended size of the bind, the offset in the multicast range mcOffset as well as the offset in the memory memOffset must be a multiple of the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`]. For best performance however, size, mcOffset and memOffset should be aligned to the granularity of the memory allocation(see ::cuMemGetAllocationGranularity) or to the value returned
12493 /// by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_RECOMMENDED`].
12494 ///
12495 /// The size + memOffset cannot be larger than the size of the allocated memory. Similarly the size + mcOffset cannot be larger than the size of the multicast object.
12496 ///
12497 /// The memory allocation must have beeen created on one of the devices that was added to the multicast team via [`cuMulticastAddDevice`]. For device memory, i.e., type [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE`], the memory allocation must have been created on the device specified by dev. For host NUMA memory, i.e., type [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`], the memory allocation must have been created on the CPU NUMA node closest to dev. That is, the value returned when querying [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID`] for dev, must be the CPU NUMA node where the memory was allocated. In both cases, the device named by dev must have been added to the multicast team via [`cuMulticastAddDevice`]. Externally shareable as well as imported multicast objects can be bound only to externally shareable memory. Note that this
12498 /// call will return [`CUresult::CUDA_ERROR_OUT_OF_MEMORY`] if there are insufficient resources required to perform the bind. This call may
12499 /// also return [`CUresult::CUDA_ERROR_SYSTEM_NOT_READY`] if the necessary system software is not initialized or running.
12500 ///
12501 /// This call may return [`CUresult::CUDA_ERROR_ILLEGAL_STATE`] if the system configuration is in an illegal state. In such cases, to continue
12502 /// using multicast, verify that the system configuration is in a valid state and all required driver daemons are running properly.
12503 ///
12504 /// **See also:**
12505 ///
12506 /// [`cuMulticastCreate`], [`cuMulticastAddDevice`], [`cuMemCreate`].
12507 ///
12508 /// # Parameters
12509 ///
12510 /// - `mcHandle`: Handle representing a multicast object.
12511 /// - `dev`: The device that for which the multicast memory binding will be applicable.
12512 /// - `mcOffset`: Offset into the multicast object for attachment.
12513 /// - `memHandle`: Handle representing a memory allocation.
12514 /// - `memOffset`: Offset into the memory for attachment.
12515 /// - `size`: Size of the memory that will be bound to the multicast object.
12516 /// - `flags`: Flags for future use, must be zero for now.
12517 pub fn cuMulticastBindMem_v2(
12518 mcHandle: CUmemGenericAllocationHandle,
12519 dev: CUdevice,
12520 mcOffset: size_t,
12521 memHandle: CUmemGenericAllocationHandle,
12522 memOffset: size_t,
12523 size: size_t,
12524 flags: ::core::ffi::c_ulonglong,
12525 ) -> CUresult;
12526}
12527unsafe extern "C" {
12528 /// Bind a memory allocation represented by a virtual address to a multicast object.
12529 ///
12530 /// Binds a memory allocation specified by its mapped address memptr to a multicast object represented by mcHandle. The memory must have been allocated via [`cuMemCreate`] or [cudaMallocAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1ga31efcffc48981621feddd98d71a0feb). The intended size of the bind, the offset in the multicast range mcOffset and memptr must be a multiple of the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`]. For best performance however, size, mcOffset and memptr should be aligned to the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_RECOMMENDED`].
12531 ///
12532 /// The size cannot be larger than the size of the allocated memory. Similarly the size + mcOffset cannot be larger than the total size of the multicast object.
12533 ///
12534 /// The memory allocation must have beeen created on one of the devices that was added to the multicast team via [`cuMulticastAddDevice`]. Externally shareable as well as imported multicast objects can be bound only to externally shareable memory. Note that this
12535 /// call will return [`CUresult::CUDA_ERROR_OUT_OF_MEMORY`] if there are insufficient resources required to perform the bind. This call may
12536 /// also return [`CUresult::CUDA_ERROR_SYSTEM_NOT_READY`] if the necessary system software is not initialized or running.
12537 ///
12538 /// This call may return [`CUresult::CUDA_ERROR_ILLEGAL_STATE`] if the system configuration is in an illegal state. In such cases, to continue
12539 /// using multicast, verify that the system configuration is in a valid state and all required driver daemons are running properly.
12540 ///
12541 /// **See also:**
12542 ///
12543 /// [`cuMulticastCreate`], [`cuMulticastAddDevice`], [`cuMemCreate`]
12544 ///
12545 /// [`cuMulticastBindAddr_v2`].
12546 ///
12547 /// # Parameters
12548 ///
12549 /// - `mcHandle`: Handle representing a multicast object.
12550 /// - `mcOffset`: Offset into multicast va range for attachment.
12551 /// - `memptr`: Virtual address of the memory allocation.
12552 /// - `size`: Size of memory that will be bound to the multicast object.
12553 /// - `flags`: Flags for future use, must be zero now.
12554 pub fn cuMulticastBindAddr(
12555 mcHandle: CUmemGenericAllocationHandle,
12556 mcOffset: size_t,
12557 memptr: CUdeviceptr,
12558 size: size_t,
12559 flags: ::core::ffi::c_ulonglong,
12560 ) -> CUresult;
12561}
12562unsafe extern "C" {
12563 /// Bind a memory allocation represented by a virtual address to a multicast object.
12564 ///
12565 /// Binds a memory allocation specified by its mapped address memptr to a multicast object represented by mcHandle. The binding will be applicable for the device dev. The memory must have been allocated via [`cuMemCreate`] or [cudaMallocAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1ga31efcffc48981621feddd98d71a0feb). The intended size of the bind, the offset in the multicast range mcOffset and memptr must be a multiple of the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`]. For best performance however, size, mcOffset and memptr should be aligned to the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_RECOMMENDED`].
12566 ///
12567 /// The size cannot be larger than the size of the allocated memory. Similarly the size + mcOffset cannot be larger than the total size of the multicast object.
12568 ///
12569 /// For device memory, i.e., type [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE`], the memory allocation must have been created on the device specified by dev. For host NUMA memory, i.e., type [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`], the memory allocation must have been created on the CPU NUMA node closest to dev. That is, the value returned when querying [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID`] for dev, must be the CPU NUMA node where the memory was allocated. In both cases, the device named by dev must have been added to the multicast team via [`cuMulticastAddDevice`]. Externally shareable as well as imported multicast objects can be bound only to externally shareable memory. Note that this
12570 /// call will return [`CUresult::CUDA_ERROR_OUT_OF_MEMORY`] if there are insufficient resources required to perform the bind. This call may
12571 /// also return [`CUresult::CUDA_ERROR_SYSTEM_NOT_READY`] if the necessary system software is not initialized or running.
12572 ///
12573 /// This call may return [`CUresult::CUDA_ERROR_ILLEGAL_STATE`] if the system configuration is in an illegal state. In such cases, to continue
12574 /// using multicast, verify that the system configuration is in a valid state and all required driver daemons are running properly.
12575 ///
12576 /// **See also:**
12577 ///
12578 /// [`cuMulticastCreate`], [`cuMulticastAddDevice`], [`cuMemCreate`].
12579 ///
12580 /// # Parameters
12581 ///
12582 /// - `mcHandle`: Handle representing a multicast object.
12583 /// - `dev`: The device that for which the multicast memory binding will be applicable.
12584 /// - `mcOffset`: Offset into multicast va range for attachment.
12585 /// - `memptr`: Virtual address of the memory allocation.
12586 /// - `size`: Size of memory that will be bound to the multicast object.
12587 /// - `flags`: Flags for future use, must be zero now.
12588 pub fn cuMulticastBindAddr_v2(
12589 mcHandle: CUmemGenericAllocationHandle,
12590 dev: CUdevice,
12591 mcOffset: size_t,
12592 memptr: CUdeviceptr,
12593 size: size_t,
12594 flags: ::core::ffi::c_ulonglong,
12595 ) -> CUresult;
12596}
12597unsafe extern "C" {
12598 /// Unbind any memory allocations bound to a multicast object at a given offset and upto a given size.
12599 ///
12600 /// Unbinds any memory allocations hosted on dev and bound to a multicast object at mcOffset and upto a given size. The intended size of the unbind and the offset in the multicast range ( mcOffset ) must be a multiple of the value returned by [`cuMulticastGetGranularity`] flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`]. The size + mcOffset cannot be larger than the total size of the multicast object.
12601 ///
12602 /// Note:
12603 ///
12604 /// Warning: The mcOffset and the size must match the corresponding values specified during the bind call. Any other values may result in undefined behavior.
12605 ///
12606 /// **See also:**
12607 ///
12608 /// [`cuMulticastBindMem`], [`cuMulticastBindAddr`]
12609 ///
12610 /// [`cuMulticastBindMem_v2`], [`cuMulticastBindAddr_v2`].
12611 ///
12612 /// # Parameters
12613 ///
12614 /// - `mcHandle`: Handle representing a multicast object.
12615 /// - `dev`: Device that hosts the memory allocation.
12616 /// - `mcOffset`: Offset into the multicast object.
12617 /// - `size`: Desired size to unbind.
12618 pub fn cuMulticastUnbind(
12619 mcHandle: CUmemGenericAllocationHandle,
12620 dev: CUdevice,
12621 mcOffset: size_t,
12622 size: size_t,
12623 ) -> CUresult;
12624}
12625unsafe extern "C" {
12626 /// Calculates either the minimal or recommended granularity for multicast object.
12627 ///
12628 /// Calculates either the minimal or recommended granularity for a given set of multicast object properties and returns it in
12629 /// granularity. This granularity can be used as a multiple for size, bind offsets and address mappings of the multicast object.
12630 ///
12631 /// **See also:**
12632 ///
12633 /// [`cuMulticastCreate`], [`cuMulticastBindMem`], [`cuMulticastBindAddr`], [`cuMulticastUnbind`]
12634 ///
12635 /// [`cuMulticastBindMem_v2`], [`cuMulticastBindAddr_v2`].
12636 ///
12637 /// # Parameters
12638 ///
12639 /// - `granularity`: Returned granularity.
12640 /// - `prop`: Properties of the multicast object.
12641 /// - `option`: Determines which granularity to return.
12642 pub fn cuMulticastGetGranularity(
12643 granularity: *mut size_t,
12644 prop: *const CUmulticastObjectProp,
12645 option: CUmulticastGranularity_flags,
12646 ) -> CUresult;
12647}
12648pub type CUlogicalEndpointId = cuuint32_t;
12649#[repr(u32)]
12650#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
12651pub enum CUlogicalEndpointIpcHandleType_enum {
12652 CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_NONE = 0,
12653 CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_FABRIC = 1,
12654}
12655pub use self::CUlogicalEndpointIpcHandleType_enum as CUlogicalEndpointIpcHandleType;
12656#[repr(C)]
12657#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
12658pub struct CUlogicalEndpointFabricHandle_st {
12659 pub data: [::core::ffi::c_uchar; 64usize],
12660}
12661impl Default for CUlogicalEndpointFabricHandle_st {
12662 fn default() -> Self {
12663 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
12664 unsafe {
12665 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12666 s.assume_init()
12667 }
12668 }
12669}
12670pub type CUlogicalEndpointFabricHandle = CUlogicalEndpointFabricHandle_st;
12671#[repr(u32)]
12672#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
12673pub enum CUlogicalEndpointType_enum {
12674 CU_LOGICAL_ENDPOINT_TYPE_INVALID = 0,
12675 CU_LOGICAL_ENDPOINT_TYPE_UNICAST = 1,
12676 CU_LOGICAL_ENDPOINT_TYPE_MULTICAST = 2,
12677}
12678pub use self::CUlogicalEndpointType_enum as CUlogicalEndpointType;
12679#[repr(u32)]
12680#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
12681pub enum CUlogicalEndpointFlag_enum {
12682 CU_LOGICAL_ENDPOINT_FLAG_NONE = 0,
12683 CU_LOGICAL_ENDPOINT_FLAG_COUNTED_OPS = 1,
12684}
12685pub use self::CUlogicalEndpointFlag_enum as CUlogicalEndpointFlag;
12686#[repr(C)]
12687#[derive(Copy, Clone)]
12688pub struct CUlogicalEndpointProp_struct {
12689 pub type_: CUlogicalEndpointType,
12690 pub __bindgen_anon_1: CUlogicalEndpointProp_struct__bindgen_ty_1,
12691 pub size: ::core::ffi::c_ulonglong,
12692 pub ipcHandleTypes: ::core::ffi::c_uint,
12693 pub flags: ::core::ffi::c_uint,
12694}
12695#[repr(C)]
12696#[derive(Copy, Clone)]
12697pub union CUlogicalEndpointProp_struct__bindgen_ty_1 {
12698 pub unicast: CUlogicalEndpointProp_struct__bindgen_ty_1__bindgen_ty_1,
12699 pub multicast: CUlogicalEndpointProp_struct__bindgen_ty_1__bindgen_ty_2,
12700}
12701#[repr(C)]
12702#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
12703pub struct CUlogicalEndpointProp_struct__bindgen_ty_1__bindgen_ty_1 {
12704 pub device: CUdevice,
12705}
12706#[repr(C)]
12707#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
12708pub struct CUlogicalEndpointProp_struct__bindgen_ty_1__bindgen_ty_2 {
12709 pub numDevices: ::core::ffi::c_uint,
12710}
12711impl Default for CUlogicalEndpointProp_struct__bindgen_ty_1 {
12712 fn default() -> Self {
12713 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
12714 unsafe {
12715 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12716 s.assume_init()
12717 }
12718 }
12719}
12720impl Default for CUlogicalEndpointProp_struct {
12721 fn default() -> Self {
12722 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
12723 unsafe {
12724 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12725 s.assume_init()
12726 }
12727 }
12728}
12729pub type CUlogicalEndpointProp = CUlogicalEndpointProp_struct;
12730unsafe extern "C" {
12731 pub fn cuLogicalEndpointIdReserve(
12732 baseLeId: *mut CUlogicalEndpointId,
12733 count: cuuint32_t,
12734 ) -> CUresult;
12735}
12736unsafe extern "C" {
12737 pub fn cuLogicalEndpointIdRelease(
12738 baseLeId: CUlogicalEndpointId,
12739 count: cuuint32_t,
12740 ) -> CUresult;
12741}
12742unsafe extern "C" {
12743 pub fn cuLogicalEndpointCreate(
12744 leId: CUlogicalEndpointId,
12745 prop: *const CUlogicalEndpointProp,
12746 ) -> CUresult;
12747}
12748unsafe extern "C" {
12749 pub fn cuLogicalEndpointAddDevice(
12750 leId: CUlogicalEndpointId,
12751 dev: CUdevice,
12752 ) -> CUresult;
12753}
12754unsafe extern "C" {
12755 pub fn cuLogicalEndpointDestroy(leId: CUlogicalEndpointId) -> CUresult;
12756}
12757unsafe extern "C" {
12758 pub fn cuLogicalEndpointBindAddr(
12759 leId: CUlogicalEndpointId,
12760 dev: CUdevice,
12761 offset: cuuint64_t,
12762 ptr: *mut ::core::ffi::c_void,
12763 size: cuuint64_t,
12764 flags: ::core::ffi::c_ulonglong,
12765 ) -> CUresult;
12766}
12767unsafe extern "C" {
12768 pub fn cuLogicalEndpointBindMem(
12769 leId: CUlogicalEndpointId,
12770 dev: CUdevice,
12771 offset: cuuint64_t,
12772 memHandle: CUmemGenericAllocationHandle,
12773 memOffset: cuuint64_t,
12774 size: cuuint64_t,
12775 flags: ::core::ffi::c_ulonglong,
12776 ) -> CUresult;
12777}
12778unsafe extern "C" {
12779 pub fn cuLogicalEndpointUnbind(
12780 leId: CUlogicalEndpointId,
12781 dev: CUdevice,
12782 offset: cuuint64_t,
12783 size: cuuint64_t,
12784 ) -> CUresult;
12785}
12786unsafe extern "C" {
12787 pub fn cuLogicalEndpointExport(
12788 handle: *mut ::core::ffi::c_void,
12789 leId: CUlogicalEndpointId,
12790 handleType: CUlogicalEndpointIpcHandleType,
12791 ) -> CUresult;
12792}
12793unsafe extern "C" {
12794 pub fn cuLogicalEndpointImport(
12795 leId: CUlogicalEndpointId,
12796 handle: *const ::core::ffi::c_void,
12797 handleType: CUlogicalEndpointIpcHandleType,
12798 ) -> CUresult;
12799}
12800unsafe extern "C" {
12801 pub fn cuLogicalEndpointGetLimits(
12802 bindAlignment: *mut cuuint64_t,
12803 maxSize: *mut cuuint64_t,
12804 prop: *const CUlogicalEndpointProp,
12805 ) -> CUresult;
12806}
12807unsafe extern "C" {
12808 pub fn cuLogicalEndpointQuery(
12809 leId: CUlogicalEndpointId,
12810 count: cuuint32_t,
12811 queryStatus: *mut ::core::ffi::c_int,
12812 ) -> CUresult;
12813}
12814unsafe extern "C" {
12815 /// Returns information about a pointer.
12816 ///
12817 /// The supported attributes are:
12818 ///
12819 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_CONTEXT`]:
12820 ///
12821 /// Returns in \*data the [`CUcontext`] in which ptr was allocated or registered. The type of data must be [`CUcontext`] \*.
12822 ///
12823 /// If ptr was not allocated by, mapped by, or registered with a [`CUcontext`] which uses unified virtual addressing then [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] is returned.
12824 ///
12825 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_MEMORY_TYPE`]:
12826 ///
12827 /// Returns in \*data the physical memory type of the memory that ptr addresses as a `CUmemorytype` enumerated value. The type of data must be unsigned int.
12828 ///
12829 /// If ptr addresses device memory then \*data is set to [`CUmemorytype_enum::CU_MEMORYTYPE_DEVICE`]. The particular [`CUdevice`] on which the memory resides is the [`CUdevice`] of the [`CUcontext`] returned by the [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_CONTEXT`] attribute of ptr.
12830 ///
12831 /// If ptr addresses host memory then \*data is set to [`CUmemorytype_enum::CU_MEMORYTYPE_HOST`].
12832 ///
12833 /// If ptr was not allocated by, mapped by, or registered with a [`CUcontext`] which uses unified virtual addressing then [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] is returned.
12834 ///
12835 /// If the current [`CUcontext`] does not support unified virtual addressing then [`cudaError_enum::CUDA_ERROR_INVALID_CONTEXT`] is returned.
12836 ///
12837 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_DEVICE_POINTER`]:
12838 ///
12839 /// Returns in \*data the device pointer value through which ptr may be accessed by kernels running in the current [`CUcontext`]. The type of data must be CUdeviceptr \*.
12840 ///
12841 /// If there exists no device pointer value through which kernels running in the current [`CUcontext`] may access ptr then [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] is returned.
12842 ///
12843 /// If there is no current [`CUcontext`] then [`cudaError_enum::CUDA_ERROR_INVALID_CONTEXT`] is returned.
12844 ///
12845 /// Except in the exceptional disjoint addressing cases discussed below, the value returned in \*data will equal the input value ptr.
12846 ///
12847 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_HOST_POINTER`]:
12848 ///
12849 /// Returns in \*data the host pointer value through which ptr may be accessed by by the host program. The type of data must be void \*\*. If there exists no host pointer value through which the host program may directly access ptr then [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] is returned.
12850 ///
12851 /// Except in the exceptional disjoint addressing cases discussed below, the value returned in \*data will equal the input value ptr.
12852 ///
12853 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_P2P_TOKENS`]:
12854 ///
12855 /// Returns in \*data two tokens for use with the nv-p2p.h Linux kernel interface. data must be a struct of type CUDA_POINTER_ATTRIBUTE_P2P_TOKENS.
12856 ///
12857 /// ptr must be a pointer to memory obtained from :[`cuMemAlloc_v2`]. Note that p2pToken and vaSpaceToken are only valid for the lifetime of the source allocation. A subsequent allocation at
12858 /// the same address may return completely different tokens. Querying this attribute has a side effect of setting the attribute
12859 /// [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_SYNC_MEMOPS`] for the region of memory that ptr points to.
12860 ///
12861 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_SYNC_MEMOPS`]:
12862 ///
12863 /// A boolean attribute which when set, ensures that synchronous memory operations initiated on the region of memory that ptr points to will always synchronize. See further documentation in the section titled "API synchronization behavior" to learn
12864 /// more about cases when synchronous memory operations can exhibit asynchronous behavior.
12865 ///
12866 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_BUFFER_ID`]:
12867 ///
12868 /// Returns in \*data a buffer ID which is guaranteed to be unique within the process. data must point to an unsigned long long.
12869 ///
12870 /// ptr must be a pointer to memory obtained from a CUDA memory allocation API. Every memory allocation from any of the CUDA memory
12871 /// allocation APIs will have a unique ID over a process lifetime. Subsequent allocations do not reuse IDs from previous freed
12872 /// allocations. IDs are only unique within a single process.
12873 ///
12874 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_IS_MANAGED`]:
12875 ///
12876 /// Returns in \*data a boolean that indicates whether the pointer points to managed memory or not.
12877 ///
12878 /// If ptr is not a valid CUDA pointer then [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] is returned.
12879 ///
12880 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL`]:
12881 ///
12882 /// Returns in \*data an integer representing a device ordinal of a device against which the memory was allocated or registered.
12883 ///
12884 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE`]:
12885 ///
12886 /// Returns in \*data a boolean that indicates if this pointer maps to an allocation that is suitable for [cudaIpcGetMemHandle](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g8a37f7dfafaca652391d0758b3667539).
12887 ///
12888 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_RANGE_START_ADDR`]:
12889 ///
12890 /// Returns in \*data the starting address for the allocation referenced by the device pointer ptr. Note that this is not necessarily the address of the mapped region, but the address of the mappable address range ptr references (e.g. from [`cuMemAddressReserve`]).
12891 ///
12892 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_RANGE_SIZE`]:
12893 ///
12894 /// Returns in \*data the size for the allocation referenced by the device pointer ptr. Note that this is not necessarily the size of the mapped region, but the size of the mappable address range ptr references (e.g. from [`cuMemAddressReserve`]). To retrieve the size of the mapped region, see [`cuMemGetAddressRange_v2`]
12895 ///
12896 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_MAPPED`]:
12897 ///
12898 /// Returns in \*data a boolean that indicates if this pointer is in a valid address range that is mapped to a backing allocation.
12899 ///
12900 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES`]:
12901 ///
12902 /// Returns a bitmask of the allowed handle types for an allocation that may be passed to [`cuMemExportToShareableHandle`].
12903 ///
12904 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE`]:
12905 ///
12906 /// Returns in \*data the handle to the mempool that the allocation was obtained from.
12907 ///
12908 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_IS_HW_DECOMPRESS_CAPABLE`]:
12909 ///
12910 /// Returns in \*data a boolean that indicates whether the pointer points to memory that is capable to be used for hardware accelerated decompression.
12911 ///
12912 /// Note that for most allocations in the unified virtual address space the host and device pointer for accessing the allocation
12913 /// will be the same. The exceptions to this are
12914 ///
12915 /// * user memory registered using [`cuMemHostRegister_v2`]
12916 /// * host memory allocated using [`cuMemHostAlloc`] with the [`CU_MEMHOSTALLOC_WRITECOMBINED`] flag For these types of allocation there will exist separate, disjoint host and device addresses for accessing the allocation.
12917 /// In particular
12918 /// * The host address will correspond to an invalid unmapped device address (which will result in an exception if accessed from
12919 /// the device)
12920 /// * The device address will correspond to an invalid unmapped host address (which will result in an exception if accessed from
12921 /// the host). For these types of allocations, querying [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_HOST_POINTER`] and [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_DEVICE_POINTER`] may be used to retrieve the host and device addresses from either address.
12922 ///
12923 /// Note:
12924 ///
12925 /// Note that this function may also return error codes from previous, asynchronous launches.
12926 ///
12927 /// **See also:**
12928 ///
12929 /// [`cuPointerSetAttribute`], [`cuMemAlloc_v2`], [`cuMemFree_v2`], [`cuMemAllocHost_v2`], [`cuMemFreeHost`], [`cuMemHostAlloc`], [`cuMemHostRegister_v2`], [`cuMemHostUnregister`], [cudaPointerGetAttributes](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__UNIFIED.html#group__CUDART__UNIFIED_1gd89830e17d399c064a2f3c3fa8bb4390).
12930 ///
12931 /// # Parameters
12932 ///
12933 /// - `data`: Returned pointer attribute value.
12934 /// - `attribute`: Pointer attribute to query.
12935 /// - `ptr`: Pointer.
12936 pub fn cuPointerGetAttribute(
12937 data: *mut ::core::ffi::c_void,
12938 attribute: CUpointer_attribute,
12939 ptr: CUdeviceptr,
12940 ) -> CUresult;
12941}
12942unsafe extern "C" {
12943 /// Prefetches memory to the specified destination location.
12944 ///
12945 /// Prefetches memory to the specified destination location. devPtr is the base device pointer of the memory to be prefetched and location specifies the destination location. count specifies the number of bytes to copy. hStream is the stream in which the operation is enqueued. The memory range must refer to managed memory allocated via [`cuMemAllocManaged`], via cuMemAllocFromPool from a managed memory pool or declared via __managed__ variables.
12946 ///
12947 /// Specifying [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE`] for [CUmemLocation::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_1a34fc29f2a55d501f00f912d92152d1b) will prefetch memory to GPU specified by device ordinal [CUmemLocation::id](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_11d7b65b482228d640b6f953196e460dc) which must have non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`]. Additionally, hStream must be associated with a device that has a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`]. Specifying [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST`] as [CUmemLocation::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_1a34fc29f2a55d501f00f912d92152d1b) will prefetch data to host memory. Applications can request prefetching memory to a specific host NUMA node by specifying
12948 /// [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`] for [CUmemLocation::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_1a34fc29f2a55d501f00f912d92152d1b) and a valid host NUMA node id in [CUmemLocation::id](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_11d7b65b482228d640b6f953196e460dc) Users can also request prefetching memory to the host NUMA node closest to the current thread's CPU by specifying [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT`] for [CUmemLocation::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_1a34fc29f2a55d501f00f912d92152d1b). Note when [CUmemLocation::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_1a34fc29f2a55d501f00f912d92152d1b) is etiher [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST`] OR [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT`], [CUmemLocation::id](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_11d7b65b482228d640b6f953196e460dc) will be ignored.
12949 ///
12950 /// The start address and end address of the memory range will be rounded down and rounded up respectively to be aligned to CPU
12951 /// page size before the prefetch operation is enqueued in the stream.
12952 ///
12953 /// If no physical memory has been allocated for this region, then this memory region will be populated and mapped on the destination
12954 /// device. If there's insufficient memory to prefetch the desired region, the Unified Memory driver may evict pages from other
12955 /// [`cuMemAllocManaged`] allocations to host memory in order to make room. Device memory allocated using [`cuMemAlloc_v2`] or [`cuArrayCreate_v2`] will not be evicted.
12956 ///
12957 /// By default, any mappings to the previous location of the migrated pages are removed and mappings for the new location are
12958 /// only setup on the destination location. The exact behavior however also depends on the settings applied to this memory range
12959 /// via [`cuMemAdvise_v2`] as described below:
12960 ///
12961 /// If [`CUmem_advise_enum::CU_MEM_ADVISE_SET_READ_MOSTLY`] was set on any subset of this memory range, then that subset will create a read-only copy of the pages on destination location.
12962 /// If however the destination location is a host NUMA node, then any pages of that subset that are already in another host NUMA
12963 /// node will be transferred to the destination.
12964 ///
12965 /// If [`CUmem_advise_enum::CU_MEM_ADVISE_SET_PREFERRED_LOCATION`] was called on any subset of this memory range, then the pages will be migrated to location even if location is not the preferred location of any pages in the memory range.
12966 ///
12967 /// If [`CUmem_advise_enum::CU_MEM_ADVISE_SET_ACCESSED_BY`] was called on any subset of this memory range, then mappings to those pages from all the appropriate processors are updated
12968 /// to refer to the new location if establishing such a mapping is possible. Otherwise, those mappings are cleared.
12969 ///
12970 /// Note that this API is not required for functionality and only serves to improve performance by allowing the application to
12971 /// migrate data to a suitable location before it is accessed. Memory accesses to this range are always coherent and are allowed
12972 /// even when the data is actively being migrated.
12973 ///
12974 /// Note that this function is asynchronous with respect to the host and all work on other devices.
12975 ///
12976 /// Note:
12977 ///
12978 /// * Note that this function may also return error codes from previous, asynchronous launches.
12979 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
12980 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
12981 ///
12982 /// **See also:**
12983 ///
12984 /// [`cuMemcpy`], [`cuMemcpyPeer`], [`cuMemcpyAsync`], [`cuMemcpy3DPeerAsync`], [`cuMemAdvise_v2`], [cudaMemPrefetchAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g856fa41c8c0d28655e37b778cb9ffc65).
12985 ///
12986 /// # Parameters
12987 ///
12988 /// - `devPtr`: Pointer to be prefetched.
12989 /// - `count`: Size in bytes.
12990 /// - `location`: Location to prefetch to.
12991 /// - `flags`: flags for future use, must be zero now.
12992 /// - `hStream`: Stream to enqueue prefetch operation.
12993 pub fn cuMemPrefetchAsync_v2(
12994 devPtr: CUdeviceptr,
12995 count: size_t,
12996 location: CUmemLocation,
12997 flags: ::core::ffi::c_uint,
12998 hStream: CUstream,
12999 ) -> CUresult;
13000}
13001unsafe extern "C" {
13002 /// Advise about the usage of a given memory range.
13003 ///
13004 /// Advise the Unified Memory subsystem about the usage pattern for the memory range starting at devPtr with a size of count bytes. The start address and end address of the memory range will be rounded down and rounded up respectively to be aligned
13005 /// to CPU page size before the advice is applied. The memory range must refer to managed memory allocated via [`cuMemAllocManaged`] or declared via __managed__ variables. The memory range could also refer to system-allocated pageable memory provided it
13006 /// represents a valid, host-accessible region of memory and all additional constraints imposed by advice as outlined below are also satisfied. Specifying an invalid system-allocated pageable memory range results in an error being
13007 /// returned.
13008 ///
13009 /// The advice parameter can take the following values:
13010 ///
13011 /// * [`CUmem_advise_enum::CU_MEM_ADVISE_SET_READ_MOSTLY`]: This implies that the data is mostly going to be read from and only occasionally written to. Any read accesses from any
13012 /// processor to this region will create a read-only copy of at least the accessed pages in that processor's memory. Additionally,
13013 /// if [`cuMemPrefetchAsync_v2`] is called on this region, it will create a read-only copy of the data on the destination processor. If the target location
13014 /// for [`cuMemPrefetchAsync_v2`] is a host NUMA node and a read-only copy already exists on another host NUMA node, that copy will be migrated to the targeted
13015 /// host NUMA node. If any processor writes to this region, all copies of the corresponding page will be invalidated except for
13016 /// the one where the write occurred. If the writing processor is the CPU and the preferred location of the page is a host NUMA
13017 /// node, then the page will also be migrated to that host NUMA node. The location argument is ignored for this advice. Note that for a page to be read-duplicated, the accessing processor must either be the
13018 /// CPU or a GPU that has a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`]. Also, if a context is created on a device that does not have the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`] set, then read-duplication will not occur until all such contexts are destroyed. If the memory region refers to valid system-allocated
13019 /// pageable memory, then the accessing device must have a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`] for a read-only copy to be created on that device. Note however that if the accessing device also has a non-zero value for
13020 /// the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES`], then setting this advice will not create a read-only copy when that device accesses this memory region.
13021 ///
13022 /// * [`CUmem_advise_enum::CU_MEM_ADVISE_UNSET_READ_MOSTLY`]: Undoes the effect of [`CUmem_advise_enum::CU_MEM_ADVISE_SET_READ_MOSTLY`] and also prevents the Unified Memory driver from attempting heuristic read-duplication on the memory range. Any read-duplicated
13023 /// copies of the data will be collapsed into a single copy. The location for the collapsed copy will be the preferred location
13024 /// if the page has a preferred location and one of the read-duplicated copies was resident at that location. Otherwise, the location
13025 /// chosen is arbitrary. Note: The location argument is ignored for this advice.
13026 ///
13027 /// * [`CUmem_advise_enum::CU_MEM_ADVISE_SET_PREFERRED_LOCATION`]: This advice sets the preferred location for the data to be the memory belonging to location. When [CUmemLocation::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_1a34fc29f2a55d501f00f912d92152d1b) is [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST`], [CUmemLocation::id](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_11d7b65b482228d640b6f953196e460dc) is ignored and the preferred location is set to be host memory. To set the preferred location to a specific host NUMA node,
13028 /// applications must set [CUmemLocation::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_1a34fc29f2a55d501f00f912d92152d1b) to [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`] and [CUmemLocation::id](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_11d7b65b482228d640b6f953196e460dc) must specify the NUMA ID of the host NUMA node. If [CUmemLocation::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_1a34fc29f2a55d501f00f912d92152d1b) is set to [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT`], [CUmemLocation::id](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_11d7b65b482228d640b6f953196e460dc) will be ignored and the host NUMA node closest to the calling thread's CPU will be used as the preferred location. If
13029 /// [CUmemLocation::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_1a34fc29f2a55d501f00f912d92152d1b) is a [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE`], then [CUmemLocation::id](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_11d7b65b482228d640b6f953196e460dc) must be a valid device ordinal and the device must have a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`]. Setting the preferred location does not cause data to migrate to that location immediately. Instead, it guides the migration
13030 /// policy when a fault occurs on that memory region. If the data is already in its preferred location and the faulting processor
13031 /// can establish a mapping without requiring the data to be migrated, then data migration will be avoided. On the other hand,
13032 /// if the data is not in its preferred location or if a direct mapping cannot be established, then it will be migrated to the
13033 /// processor accessing it. It is important to note that setting the preferred location does not prevent data prefetching done
13034 /// using [`cuMemPrefetchAsync_v2`]. Having a preferred location can override the page thrash detection and resolution logic in the Unified Memory driver. Normally,
13035 /// if a page is detected to be constantly thrashing between for example host and device memory, the page may eventually be pinned
13036 /// to host memory by the Unified Memory driver. But if the preferred location is set as device memory, then the page will continue
13037 /// to thrash indefinitely. If [`CUmem_advise_enum::CU_MEM_ADVISE_SET_READ_MOSTLY`] is also set on this memory region or any subset of it, then the policies associated with that advice will override the policies
13038 /// of this advice, unless read accesses from location will not result in a read-only copy being created on that procesor as outlined in description for the advice [`CUmem_advise_enum::CU_MEM_ADVISE_SET_READ_MOSTLY`]. If the memory region refers to valid system-allocated pageable memory, and [CUmemLocation::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_1a34fc29f2a55d501f00f912d92152d1b) is [`CUmemLocationType::CU_MEM_LOCATION_TYPE_DEVICE`] then [CUmemLocation::id](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_11d7b65b482228d640b6f953196e460dc) must be a valid device that has a non-zero alue for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`].
13039 ///
13040 /// * [`CUmem_advise_enum::CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION`]: Undoes the effect of [`CUmem_advise_enum::CU_MEM_ADVISE_SET_PREFERRED_LOCATION`] and changes the preferred location to none. The location argument is ignored for this advice.
13041 ///
13042 /// * [`CUmem_advise_enum::CU_MEM_ADVISE_SET_ACCESSED_BY`]: This advice implies that the data will be accessed by processor location. The [CUmemLocation::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_1a34fc29f2a55d501f00f912d92152d1b) must be either [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE`] with [CUmemLocation::id](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_11d7b65b482228d640b6f953196e460dc) representing a valid device ordinal or [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST`] and [CUmemLocation::id](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_11d7b65b482228d640b6f953196e460dc) will be ignored. All other location types are invalid. If [CUmemLocation::id](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_11d7b65b482228d640b6f953196e460dc) is a GPU, then the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`] must be non-zero. This advice does not cause data migration and has no impact on the location of the data per se. Instead,
13043 /// it causes the data to always be mapped in the specified processor's page tables, as long as the location of the data permits
13044 /// a mapping to be established. If the data gets migrated for any reason, the mappings are updated accordingly. This advice is
13045 /// recommended in scenarios where data locality is not important, but avoiding faults is. Consider for example a system containing
13046 /// multiple GPUs with peer-to-peer access enabled, where the data located on one GPU is occasionally accessed by peer GPUs. In
13047 /// such scenarios, migrating data over to the other GPUs is not as important because the accesses are infrequent and the overhead
13048 /// of migration may be too high. But preventing faults can still help improve performance, and so having a mapping set up in
13049 /// advance is useful. Note that on CPU access of this data, the data may be migrated to host memory because the CPU typically
13050 /// cannot access device memory directly. Any GPU that had the [`CUmem_advise_enum::CU_MEM_ADVISE_SET_ACCESSED_BY`] flag set for this data will now have its mapping updated to point to the page in host memory. If [`CUmem_advise_enum::CU_MEM_ADVISE_SET_READ_MOSTLY`] is also set on this memory region or any subset of it, then the policies associated with that advice will override the policies
13051 /// of this advice. Additionally, if the preferred location of this memory region or any subset of it is also location, then the policies associated with [`CUmem_advise_enum::CU_MEM_ADVISE_SET_PREFERRED_LOCATION`] will override the policies of this advice. If the memory region refers to valid system-allocated pageable memory, and [CUmemLocation::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_1a34fc29f2a55d501f00f912d92152d1b) is [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE`] then device in [CUmemLocation::id](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_11d7b65b482228d640b6f953196e460dc) must have a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`]. Additionally, if [CUmemLocation::id](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_11d7b65b482228d640b6f953196e460dc) has a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES`], then this call has no effect.
13052 ///
13053 /// * [`CUmem_advise_enum::CU_MEM_ADVISE_UNSET_ACCESSED_BY`]: Undoes the effect of [`CUmem_advise_enum::CU_MEM_ADVISE_SET_ACCESSED_BY`]. Any mappings to the data from location may be removed at any time causing accesses to result in non-fatal page faults. If the memory region refers to valid system-allocated
13054 /// pageable memory, and [CUmemLocation::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_1a34fc29f2a55d501f00f912d92152d1b) is [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE`] then device in [CUmemLocation::id](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_11d7b65b482228d640b6f953196e460dc) must have a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`]. Additionally, if [CUmemLocation::id](https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemLocation__v1.html#structCUmemLocation__v1_11d7b65b482228d640b6f953196e460dc) has a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES`], then this call has no effect.
13055 ///
13056 /// Note:
13057 ///
13058 /// * Note that this function may also return error codes from previous, asynchronous launches.
13059 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
13060 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
13061 ///
13062 /// **See also:**
13063 ///
13064 /// [`cuMemcpy`], [`cuMemcpyPeer`], [`cuMemcpyAsync`], [`cuMemcpy3DPeerAsync`], [`cuMemPrefetchAsync_v2`], [cudaMemAdvise](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g5584e2dac446bebc695da3bb1c162607).
13065 ///
13066 /// # Parameters
13067 ///
13068 /// - `devPtr`: Pointer to memory to set the advice for.
13069 /// - `count`: Size in bytes of the memory range.
13070 /// - `advice`: Advice to be applied for the specified memory range.
13071 /// - `location`: location to apply the advice for.
13072 pub fn cuMemAdvise_v2(
13073 devPtr: CUdeviceptr,
13074 count: size_t,
13075 advice: CUmem_advise,
13076 location: CUmemLocation,
13077 ) -> CUresult;
13078}
13079unsafe extern "C" {
13080 /// Performs a batch of memory prefetches asynchronously.
13081 ///
13082 /// Performs a batch of memory prefetches. The batch as a whole executes in stream order but operations within a batch are not
13083 /// guaranteed to execute in any specific order. All devices in the system must have a non-zero value for the device attribute
13084 /// [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`] otherwise the API will return an error.
13085 ///
13086 /// The semantics of the individual prefetch operations are as described in [`cuMemPrefetchAsync_v2`].
13087 ///
13088 /// Performs memory prefetch on address ranges specified in dptrs and sizes. Both arrays must be of the same length as specified by count. Each memory range specified must refer to managed memory allocated via [`cuMemAllocManaged`] or declared via __managed__ variables or it may also refer to system-allocated memory when all devices have a non-zero value
13089 /// for [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`]. The prefetch location for every operation in the batch is specified in the prefetchLocs array. Each entry in this array can apply to more than one operation. This can be done by specifying in the prefetchLocIdxs array, the index of the first prefetch operation that the corresponding entry in the prefetchLocs array applies to. Both prefetchLocs and prefetchLocIdxs must be of the same length as specified by numPrefetchLocs. For example, if a batch has 10 prefetches listed in dptrs/sizes, the first 4 of which are to be prefetched to one location
13090 /// and the remaining 6 are to be prefetched to another, then numPrefetchLocs will be 2, prefetchLocIdxs will be {0, 4} and prefetchLocs will contain the two locations. Note the first entry in prefetchLocIdxs must always be 0. Also, each entry must be greater than the previous entry and the last entry should be less than count. Furthermore, numPrefetchLocs must be lesser than or equal to count.
13091 ///
13092 /// # Parameters
13093 ///
13094 /// - `dptrs`: Array of pointers to be prefetched.
13095 /// - `sizes`: Array of sizes for memory prefetch operations.
13096 /// - `count`: Size of dptrs and sizes arrays.
13097 /// - `prefetchLocs`: Array of locations to prefetch to.
13098 /// - `prefetchLocIdxs`: Array of indices to specify which operands each entry in the prefetchLocs array applies to. The locations specified in prefetchLocs\[k\] will be applied to copies starting from prefetchLocIdxs\[k\] through
13099 /// prefetchLocIdxs\[k+1\] - 1. Also prefetchLocs\[numPrefetchLocs - 1\] will apply to prefetches starting from prefetchLocIdxs\[numPrefetchLocs
13100 /// - 1\] through count - 1.
13101 /// - `numPrefetchLocs`: Size of prefetchLocs and prefetchLocIdxs arrays.
13102 /// - `flags`: Flags reserved for future use. Must be zero.
13103 /// - `hStream`: The stream to enqueue the operations in. Must not be legacy NULL stream.
13104 pub fn cuMemPrefetchBatchAsync(
13105 dptrs: *mut CUdeviceptr,
13106 sizes: *mut size_t,
13107 count: size_t,
13108 prefetchLocs: *mut CUmemLocation,
13109 prefetchLocIdxs: *mut size_t,
13110 numPrefetchLocs: size_t,
13111 flags: ::core::ffi::c_ulonglong,
13112 hStream: CUstream,
13113 ) -> CUresult;
13114}
13115unsafe extern "C" {
13116 /// Performs a batch of memory discards asynchronously.
13117 ///
13118 /// Performs a batch of memory discards. The batch as a whole executes in stream order but operations within a batch are not guaranteed
13119 /// to execute in any specific order. All devices in the system must have a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`] otherwise the API will return an error.
13120 ///
13121 /// Discarding a memory range informs the driver that the contents of that range are no longer useful. Discarding memory ranges
13122 /// allows the driver to optimize certain data migrations and can also help reduce memory pressure. This operation can be undone
13123 /// on any part of the range by either writing to it or prefetching it via [`cuMemPrefetchAsync_v2`] or [`cuMemPrefetchBatchAsync`]. Reading from a discarded range, without a subsequent write or prefetch to that part of the range, will return an indeterminate
13124 /// value. Note that any reads, writes or prefetches to any part of the memory range that occur simultaneously with the discard
13125 /// operation result in undefined behavior.
13126 ///
13127 /// Performs memory discard on address ranges specified in dptrs and sizes. Both arrays must be of the same length as specified by count. Each memory range specified must refer to managed memory allocated via [`cuMemAllocManaged`] or declared via __managed__ variables or it may also refer to system-allocated memory when all devices have a non-zero value
13128 /// for [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`].
13129 ///
13130 /// # Parameters
13131 ///
13132 /// - `dptrs`: Array of pointers to be discarded.
13133 /// - `sizes`: Array of sizes for memory discard operations.
13134 /// - `count`: Size of dptrs and sizes arrays.
13135 /// - `flags`: Flags reserved for future use. Must be zero.
13136 /// - `hStream`: The stream to enqueue the operations in. Must not be legacy NULL stream.
13137 pub fn cuMemDiscardBatchAsync(
13138 dptrs: *mut CUdeviceptr,
13139 sizes: *mut size_t,
13140 count: size_t,
13141 flags: ::core::ffi::c_ulonglong,
13142 hStream: CUstream,
13143 ) -> CUresult;
13144}
13145unsafe extern "C" {
13146 /// Performs a batch of memory discards and prefetches asynchronously.
13147 ///
13148 /// Performs a batch of memory discards followed by prefetches. The batch as a whole executes in stream order but operations within
13149 /// a batch are not guaranteed to execute in any specific order. All devices in the system must have a non-zero value for the
13150 /// device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`] otherwise the API will return an error.
13151 ///
13152 /// Calling [`cuMemDiscardAndPrefetchBatchAsync`] is semantically equivalent to calling [`cuMemDiscardBatchAsync`] followed by [`cuMemPrefetchBatchAsync`], but is more optimal. For more details on what discarding and prefetching imply, please refer to [`cuMemDiscardBatchAsync`] and [`cuMemPrefetchBatchAsync`] respectively. Note that any reads, writes or prefetches to any part of the memory range that occur simultaneously with this
13153 /// combined discard+prefetch operation result in undefined behavior.
13154 ///
13155 /// Performs memory discard and prefetch on address ranges specified in dptrs and sizes. Both arrays must be of the same length as specified by count. Each memory range specified must refer to managed memory allocated via [`cuMemAllocManaged`] or declared via __managed__ variables or it may also refer to system-allocated memory when all devices have a non-zero value
13156 /// for [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`]. Every operation in the batch has to be associated with a valid location to prefetch the address range to and specified in
13157 /// the prefetchLocs array. Each entry in this array can apply to more than one operation. This can be done by specifying in the prefetchLocIdxs array, the index of the first operation that the corresponding entry in the prefetchLocs array applies to. Both prefetchLocs and prefetchLocIdxs must be of the same length as specified by numPrefetchLocs. For example, if a batch has 10 operations listed in dptrs/sizes, the first 6 of which are to be prefetched to one location
13158 /// and the remaining 4 are to be prefetched to another, then numPrefetchLocs will be 2, prefetchLocIdxs will be {0, 6} and prefetchLocs will contain the two set of locations. Note the first entry in prefetchLocIdxs must always be 0. Also, each entry must be greater than the previous entry and the last entry should be less than count. Furthermore, numPrefetchLocs must be lesser than or equal to count.
13159 ///
13160 /// # Parameters
13161 ///
13162 /// - `dptrs`: Array of pointers to be discarded.
13163 /// - `sizes`: Array of sizes for memory discard operations.
13164 /// - `count`: Size of dptrs and sizes arrays.
13165 /// - `prefetchLocs`: Array of locations to prefetch to.
13166 /// - `prefetchLocIdxs`: Array of indices to specify which operands each entry in the prefetchLocs array applies to. The locations specified in prefetchLocs\[k\] will be applied to operations starting from prefetchLocIdxs\[k\]
13167 /// through prefetchLocIdxs\[k+1\] - 1. Also prefetchLocs\[numPrefetchLocs - 1\] will apply to copies starting from prefetchLocIdxs\[numPrefetchLocs
13168 /// - 1\] through count - 1.
13169 /// - `numPrefetchLocs`: Size of prefetchLocs and prefetchLocIdxs arrays.
13170 /// - `flags`: Flags reserved for future use. Must be zero.
13171 /// - `hStream`: The stream to enqueue the operations in. Must not be legacy NULL stream.
13172 pub fn cuMemDiscardAndPrefetchBatchAsync(
13173 dptrs: *mut CUdeviceptr,
13174 sizes: *mut size_t,
13175 count: size_t,
13176 prefetchLocs: *mut CUmemLocation,
13177 prefetchLocIdxs: *mut size_t,
13178 numPrefetchLocs: size_t,
13179 flags: ::core::ffi::c_ulonglong,
13180 hStream: CUstream,
13181 ) -> CUresult;
13182}
13183unsafe extern "C" {
13184 /// Query an attribute of a given memory range.
13185 ///
13186 /// Query an attribute about the memory range starting at devPtr with a size of count bytes. The memory range must refer to managed memory allocated via [`cuMemAllocManaged`] or declared via __managed__ variables.
13187 ///
13188 /// The attribute parameter can take the following values:
13189 ///
13190 /// * [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY`]: If this attribute is specified, data will be interpreted as a 32-bit integer, and dataSize must be 4. The result returned will be 1 if all pages in the given memory range have read-duplication enabled, or 0 otherwise.
13191 /// * [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION`]: If this attribute is specified, data will be interpreted as a 32-bit integer, and dataSize must be 4. The result returned will be a GPU device id if all pages in the memory range have that GPU as their preferred
13192 /// location, or it will be CU_DEVICE_CPU if all pages in the memory range have the CPU as their preferred location, or it will
13193 /// be CU_DEVICE_INVALID if either all the pages don't have the same preferred location or some of the pages don't have a preferred
13194 /// location at all. Note that the actual location of the pages in the memory range at the time of the query may be different
13195 /// from the preferred location.
13196 /// * [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY`]: If this attribute is specified, data will be interpreted as an array of 32-bit integers, and dataSize must be a non-zero multiple of 4. The result returned will be a list of device ids that had [`CUmem_advise_enum::CU_MEM_ADVISE_SET_ACCESSED_BY`] set for that entire memory range. If any device does not have that advice set for the entire memory range, that device will
13197 /// not be included. If data is larger than the number of devices that have that advice set for that memory range, CU_DEVICE_INVALID will be returned
13198 /// in all the extra space provided. For ex., if dataSize is 12 (i.e. data has 3 elements) and only device 0 has the advice set, then the result returned will be { 0, CU_DEVICE_INVALID, CU_DEVICE_INVALID
13199 /// }. If data is smaller than the number of devices that have that advice set, then only as many devices will be returned as can fit in
13200 /// the array. There is no guarantee on which specific devices will be returned, however.
13201 /// * [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION`]: If this attribute is specified, data will be interpreted as a 32-bit integer, and dataSize must be 4. The result returned will be the last location to which all pages in the memory range were prefetched explicitly
13202 /// via [`cuMemPrefetchAsync_v2`]. This will either be a GPU id or CU_DEVICE_CPU depending on whether the last location for prefetch was a GPU or the CPU respectively.
13203 /// If any page in the memory range was never explicitly prefetched or if all pages were not prefetched to the same location,
13204 /// CU_DEVICE_INVALID will be returned. Note that this simply returns the last location that the application requested to prefetch
13205 /// the memory range to. It gives no indication as to whether the prefetch operation to that location has completed or even begun.
13206 /// * [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE`]: If this attribute is specified, data will be interpreted as a `CUmemLocationType`, and dataSize must be sizeof(CUmemLocationType). The `CUmemLocationType` returned will be [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE`] if all pages in the memory range have the same GPU as their preferred location, or `CUmemLocationType` will be [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST`] if all pages in the memory range have the CPU as their preferred location, or it will be [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`] if all the pages in the memory range have the same host NUMA node ID as their preferred location or it will be [`CUmemLocationType::CU_MEM_LOCATION_TYPE_INVALID`]
13207 /// if either all the pages don't have the same preferred location or some of the pages don't have a preferred location at all.
13208 /// Note that the actual location type of the pages in the memory range at the time of the query may be different from the preferred
13209 /// location type.
13210 /// + [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID`]: If this attribute is specified, data will be interpreted as a 32-bit integer, and dataSize must be 4. If the [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE`] query for the same address range returns [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE`], it will be a valid device ordinal or if it returns [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`], it will be a valid host NUMA node ID or if it returns any other location type, the id should be ignored.
13211 /// * [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE`]: If this attribute is specified, data will be interpreted as a `CUmemLocationType`, and dataSize must be sizeof(CUmemLocationType). The result returned will be the last location to which all pages in the memory range were
13212 /// prefetched explicitly via [`cuMemPrefetchAsync_v2`]. The `CUmemLocationType` returned will be [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE`] if the last prefetch location was a GPU or [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST`] if it was the CPU or [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`] if the last prefetch location was a specific host NUMA node. If any page in the memory range was never explicitly prefetched
13213 /// or if all pages were not prefetched to the same location, `CUmemLocationType` will be [`CUmemLocationType::CU_MEM_LOCATION_TYPE_INVALID`]. Note that this simply returns the last location type that the application requested
13214 /// to prefetch the memory range to. It gives no indication as to whether the prefetch operation to that location has completed
13215 /// or even begun.
13216 /// + [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_ID`]: If this attribute is specified, data will be interpreted as a 32-bit integer, and dataSize must be 4. If the [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE`] query for the same address range returns [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE`], it will be a valid device ordinal or if it returns [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`], it will be a valid host NUMA node ID or if it returns any other location type, the id should be ignored.
13217 ///
13218 /// Note:
13219 ///
13220 /// * Note that this function may also return error codes from previous, asynchronous launches.
13221 /// * This function exhibits [asynchronous](https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html#api-sync-behavior__memcpy-async) behavior for most use cases.
13222 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
13223 ///
13224 /// **See also:**
13225 ///
13226 /// [`cuMemRangeGetAttributes`], [`cuMemPrefetchAsync_v2`], [`cuMemAdvise_v2`], [cudaMemRangeGetAttribute](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g8048f6ea5ad77917444567656c140c5a).
13227 ///
13228 /// # Parameters
13229 ///
13230 /// - `data`: A pointers to a memory location where the result of each attribute query will be written to.
13231 /// - `dataSize`: Array containing the size of data.
13232 /// - `attribute`: The attribute to query.
13233 /// - `devPtr`: Start of the range to query.
13234 /// - `count`: Size of the range to query.
13235 pub fn cuMemRangeGetAttribute(
13236 data: *mut ::core::ffi::c_void,
13237 dataSize: size_t,
13238 attribute: CUmem_range_attribute,
13239 devPtr: CUdeviceptr,
13240 count: size_t,
13241 ) -> CUresult;
13242}
13243unsafe extern "C" {
13244 /// Query attributes of a given memory range.
13245 ///
13246 /// Query attributes of the memory range starting at devPtr with a size of count bytes. The memory range must refer to managed memory allocated via [`cuMemAllocManaged`] or declared via __managed__ variables. The attributes array will be interpreted to have numAttributes entries. The dataSizes array will also be interpreted to have numAttributes entries. The results of the query will be stored in data.
13247 ///
13248 /// The list of supported attributes are given below. Please refer to [`cuMemRangeGetAttribute`] for attribute descriptions and restrictions.
13249 ///
13250 /// * [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY`]
13251 /// * [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION`]
13252 /// * [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY`]
13253 /// * [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION`]
13254 /// * [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE`]
13255 /// * [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID`]
13256 /// * [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE`]
13257 /// * [`CUmem_range_attribute_enum::CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_ID`]
13258 ///
13259 /// Note:
13260 ///
13261 /// Note that this function may also return error codes from previous, asynchronous launches.
13262 ///
13263 /// **See also:**
13264 ///
13265 /// [`cuMemRangeGetAttribute`], [`cuMemAdvise_v2`], [`cuMemPrefetchAsync_v2`], [cudaMemRangeGetAttributes](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g1a9199e7709c7817d1c715cfbe174d05).
13266 ///
13267 /// # Parameters
13268 ///
13269 /// - `data`: A two-dimensional array containing pointers to memory locations where the result of each attribute query will be written
13270 /// ```text
13271 /// to.
13272 /// ```
13273 /// - `dataSizes`: Array containing the sizes of each result.
13274 /// - `attributes`: An array of attributes to query (numAttributes and the number of attributes in this array should match).
13275 /// - `numAttributes`: Number of attributes to query.
13276 /// - `devPtr`: Start of the range to query.
13277 /// - `count`: Size of the range to query.
13278 pub fn cuMemRangeGetAttributes(
13279 data: *mut *mut ::core::ffi::c_void,
13280 dataSizes: *mut size_t,
13281 attributes: *mut CUmem_range_attribute,
13282 numAttributes: size_t,
13283 devPtr: CUdeviceptr,
13284 count: size_t,
13285 ) -> CUresult;
13286}
13287unsafe extern "C" {
13288 /// Set attributes on a previously allocated memory region.
13289 ///
13290 /// The supported attributes are:
13291 ///
13292 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_SYNC_MEMOPS`]:
13293 ///
13294 /// A boolean attribute that can either be set (1) or unset (0). When set, the region of memory that ptr points to is guaranteed to always synchronize memory operations that are synchronous. If there are some previously initiated
13295 /// synchronous memory operations that are pending when this attribute is set, the function does not return until those memory
13296 /// operations are complete. See further documentation in the section titled "API synchronization behavior" to learn more about
13297 /// cases when synchronous memory operations can exhibit asynchronous behavior. value will be considered as a pointer to an unsigned integer to which this attribute is to be set.
13298 ///
13299 /// Note:
13300 ///
13301 /// Note that this function may also return error codes from previous, asynchronous launches.
13302 ///
13303 /// **See also:**
13304 ///
13305 /// [`cuPointerGetAttribute`], [`cuPointerGetAttributes`], [`cuMemAlloc_v2`], [`cuMemFree_v2`], [`cuMemAllocHost_v2`], [`cuMemFreeHost`], [`cuMemHostAlloc`], [`cuMemHostRegister_v2`], [`cuMemHostUnregister`].
13306 ///
13307 /// # Parameters
13308 ///
13309 /// - `value`: Pointer to memory containing the value to be set.
13310 /// - `attribute`: Pointer attribute to set.
13311 /// - `ptr`: Pointer to a memory region allocated using CUDA memory allocation APIs.
13312 pub fn cuPointerSetAttribute(
13313 value: *const ::core::ffi::c_void,
13314 attribute: CUpointer_attribute,
13315 ptr: CUdeviceptr,
13316 ) -> CUresult;
13317}
13318unsafe extern "C" {
13319 /// Returns information about a pointer.
13320 ///
13321 /// The supported attributes are (refer to [`cuPointerGetAttribute`] for attribute descriptions and restrictions):
13322 ///
13323 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_CONTEXT`]
13324 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_MEMORY_TYPE`]
13325 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_DEVICE_POINTER`]
13326 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_HOST_POINTER`]
13327 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_SYNC_MEMOPS`]
13328 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_BUFFER_ID`]
13329 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_IS_MANAGED`]
13330 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL`]
13331 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_RANGE_START_ADDR`]
13332 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_RANGE_SIZE`]
13333 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_MAPPED`]
13334 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE`]
13335 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES`]
13336 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE`]
13337 /// * [`CUpointer_attribute_enum::CU_POINTER_ATTRIBUTE_IS_HW_DECOMPRESS_CAPABLE`]
13338 ///
13339 /// Unlike [`cuPointerGetAttribute`], this function will not return an error when the ptr encountered is not a valid CUDA pointer. Instead, the attributes are assigned default NULL values and [`CUresult::CUDA_SUCCESS`] is returned.
13340 ///
13341 /// If ptr was not allocated by, mapped by, or registered with a [`CUcontext`] which uses UVA (Unified Virtual Addressing), [`cudaError_enum::CUDA_ERROR_INVALID_CONTEXT`] is returned.
13342 ///
13343 /// Note:
13344 ///
13345 /// Note that this function may also return error codes from previous, asynchronous launches.
13346 ///
13347 /// **See also:**
13348 ///
13349 /// [`cuPointerGetAttribute`], [`cuPointerSetAttribute`], [cudaPointerGetAttributes](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__UNIFIED.html#group__CUDART__UNIFIED_1gd89830e17d399c064a2f3c3fa8bb4390).
13350 ///
13351 /// # Parameters
13352 ///
13353 /// - `numAttributes`: Number of attributes to query.
13354 /// - `attributes`: An array of attributes to query (numAttributes and the number of attributes in this array should match).
13355 /// - `data`: A two-dimensional array containing pointers to memory locations where the result of each attribute query will be written
13356 /// ```text
13357 /// to.
13358 /// ```
13359 /// - `ptr`: Pointer to query.
13360 pub fn cuPointerGetAttributes(
13361 numAttributes: ::core::ffi::c_uint,
13362 attributes: *mut CUpointer_attribute,
13363 data: *mut *mut ::core::ffi::c_void,
13364 ptr: CUdeviceptr,
13365 ) -> CUresult;
13366}
13367unsafe extern "C" {
13368 /// Create a stream.
13369 ///
13370 /// Creates a stream and returns a handle in phStream. The Flags argument determines behaviors of the stream.
13371 ///
13372 /// Valid values for Flags are:
13373 ///
13374 /// * [`CUstream_flags_enum::CU_STREAM_DEFAULT`]: Default stream creation flag.
13375 /// * [`CUstream_flags_enum::CU_STREAM_NON_BLOCKING`]: Specifies that work running in the created stream may run concurrently with work in stream 0 (the NULL stream), and that
13376 /// the created stream should perform no implicit synchronization with stream 0.
13377 ///
13378 /// Note:
13379 ///
13380 /// Note that this function may also return error codes from previous, asynchronous launches.
13381 ///
13382 /// **See also:**
13383 ///
13384 /// [`cuStreamDestroy_v2`], [`cuStreamCreateWithPriority`], [`cuGreenCtxStreamCreate`], [`cuStreamGetPriority`], [`cuStreamGetFlags`], [`cuStreamGetDevice`], [cudaStreamCreateWithFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1gb1e32aff9f59119e4d0a9858991c4ad3).
13385 ///
13386 /// # Parameters
13387 ///
13388 /// - `phStream`: Returned newly created stream.
13389 /// - `Flags`: Parameters for stream creation.
13390 pub fn cuStreamCreate(
13391 phStream: *mut CUstream,
13392 Flags: ::core::ffi::c_uint,
13393 ) -> CUresult;
13394}
13395unsafe extern "C" {
13396 /// Create a stream with the given priority.
13397 ///
13398 /// Creates a stream with the specified priority and returns a handle in phStream. This affects the scheduling priority of work in the stream. Priorities provide a hint to preferentially run work with higher
13399 /// priority when possible, but do not preempt already-running work or provide any other functional guarantee on execution order.
13400 ///
13401 /// priority follows a convention where lower numbers represent higher priorities. '0' represents default priority. The range of meaningful
13402 /// numerical priorities can be queried using [`cuCtxGetStreamPriorityRange`]. If the specified priority is outside the numerical range returned by [`cuCtxGetStreamPriorityRange`], it will automatically be clamped to the lowest or the highest number in the range.
13403 ///
13404 /// Note:
13405 ///
13406 /// * Note that this function may also return error codes from previous, asynchronous launches.
13407 /// * Stream priorities are supported only on GPUs with compute capability 3.5 or higher.
13408 /// * In the current implementation, only compute kernels launched in priority streams are affected by the stream's priority. Stream
13409 /// priorities have no effect on host-to-device and device-to-host memory operations.
13410 ///
13411 /// **See also:**
13412 ///
13413 /// [`cuStreamDestroy_v2`], [`cuStreamCreate`], [`cuGreenCtxStreamCreate`], [`cuStreamGetPriority`], [`cuCtxGetStreamPriorityRange`], [`cuStreamGetFlags`], [`cuStreamGetDevice`], [`cuStreamWaitEvent`], [`cuStreamQuery`], [`cuStreamSynchronize`], [`cuStreamAddCallback`], [cudaStreamCreateWithPriority](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1ge2be9e9858849bf62ba4a8b66d1c3540).
13414 ///
13415 /// # Parameters
13416 ///
13417 /// - `phStream`: Returned newly created stream.
13418 /// - `flags`: Flags for stream creation. See [`cuStreamCreate`] for a list of valid flags.
13419 /// - `priority`: Stream priority. Lower numbers represent higher priorities. See [`cuCtxGetStreamPriorityRange`] for more information about meaningful stream priorities that can be passed.
13420 pub fn cuStreamCreateWithPriority(
13421 phStream: *mut CUstream,
13422 flags: ::core::ffi::c_uint,
13423 priority: ::core::ffi::c_int,
13424 ) -> CUresult;
13425}
13426unsafe extern "C" {
13427 /// Begins capture to CIG on a stream.
13428 ///
13429 /// Support for CIG streams with D3D12 can be determined using [`cuDeviceGetAttribute`] with [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_D3D12_CIG_STREAMS_SUPPORTED`].
13430 ///
13431 /// Begin CIG (CUDA in Graphics) capture on hStream for the graphics API as provided in streamCigCaptureParams. When a stream is in CIG capture mode, all operations pushed into the stream will not be executed, but will instead be captured
13432 /// into a graphics API command list/command buffer. All kernel launches and memory copy/memory set operations on the CIG stream
13433 /// will be recorded. When the command list is executed by the graphics API, all the stream's operations will execute in order
13434 /// along with other graphics API commands in the command list.
13435 ///
13436 /// CIG stream capture may not be initiated if stream is CU_STREAM_LEGACY. Capture must be ended on the same stream in which it was initiated, and it may only be initiated if
13437 /// the stream is not already in CIG capture mode.
13438 ///
13439 /// The context must be also created in CIG mode previously, otherwise this operation will fail and [`cudaError_enum::CUDA_ERROR_INVALID_CONTEXT`] will be returned.
13440 ///
13441 /// Data from the graphics client can be shared with CUDA via the streamSharedData in streamCigCaptureParams. The format of streamSharedData is dependent on the type of the graphics client. For D3D12, streamSharedData is an ID3D12CommandList object pointer. The command list must be in ready state for recording commands whenever kernels are
13442 /// launched on the stream. The command list provided must belong to the graphics API device that the CIG context was created
13443 /// with, otherwise the behavior will be undefined.
13444 ///
13445 /// The stream object may not be destroyed until its associated command list has finished executing on the GPU. The command list/command
13446 /// buffer used for capture may not be submitted for execution before a call to [`cuStreamEndCaptureToCig`] is made on the associated stream.
13447 ///
13448 /// Graphics resources to be accessed by work recorded on the CIG stream must use UAV barriers on the command list prior to recording
13449 /// work that accesses them on the stream.
13450 ///
13451 /// Resubmission of the same recorded command list is not allowed. Further more, care must be taken for the order of execution
13452 /// of the recorded CUDA work with regards to other CUDA work submitted under the same CIG context. Out-of-order execution can
13453 /// lead to device hangs or exceptions.
13454 ///
13455 /// CIG capture mode operates similarly to cuStreamBeginCapture with the [`CUstreamCaptureMode::CU_STREAM_CAPTURE_MODE_RELAXED`] option. There are additional limitations to streams in CIG capture mode. The following functions are not allowed for CIG
13456 /// streams whether directly or indirectly via a recorded graph launch: [`cuLaunchHostFunc`]cuStreamAddCallback [`cuStreamSynchronize`]cuStreamWaitValue32 [`cuStreamWaitValue64_v2`]cuStreamBatchMemOp [`cuStreamBeginCapture_v2`]cuStreamBeginCaptureToGraph [`cuMemAllocAsync`][`cuMemFreeAsync`]
13457 ///
13458 /// Note:
13459 ///
13460 /// Note that this function may also return error codes from previous, asynchronous launches.
13461 ///
13462 /// **See also:**
13463 ///
13464 /// [`cuStreamEndCaptureToCig`], [`cuStreamBeginCapture_v2`], [`cuStreamWaitEvent`], [`cuStreamQuery`], [`cuStreamSynchronize`], [`cuStreamAddCallback`].
13465 ///
13466 /// # Parameters
13467 ///
13468 /// - `hStream`: Stream in which to initiate capture to CIG.
13469 /// - `streamCigCaptureParams`: CIG capture parameters.
13470 pub fn cuStreamBeginCaptureToCig(
13471 hStream: CUstream,
13472 streamCigCaptureParams: *mut CUstreamCigCaptureParams,
13473 ) -> CUresult;
13474}
13475unsafe extern "C" {
13476 /// Ends CIG capture on a stream.
13477 ///
13478 /// End CIG capture on hStream. Capture must have been initiated on hStream via a call to [`cuStreamBeginCaptureToCig`]. Once this function is called, hStream will exit CIG capture mode and return to its original state, thus removing all CIG stream restrictions. Also, the command
13479 /// list/command buffer that was associated with hStream in the previous call to [`cuStreamBeginCaptureToCig`] is now allowed to be submitted for execution on the graphics API. However, the stream may not be destroyed until execution
13480 /// of the command list is fully done on the GPU. This requirements extends also to all streams dependent on the CIG stream (e.g.
13481 /// via event waits).
13482 ///
13483 /// Note:
13484 ///
13485 /// Note that this function may also return error codes from previous, asynchronous launches.
13486 ///
13487 /// **See also:**
13488 ///
13489 /// [`cuStreamBeginCaptureToCig`].
13490 ///
13491 /// # Parameters
13492 ///
13493 /// - `hStream`: Stream to end CIG capture.
13494 pub fn cuStreamEndCaptureToCig(hStream: CUstream) -> CUresult;
13495}
13496unsafe extern "C" {
13497 /// Query the priority of a given stream.
13498 ///
13499 /// Query the priority of a stream created using [`cuStreamCreate`], [`cuStreamCreateWithPriority`] or [`cuGreenCtxStreamCreate`] and return the priority in priority. Note that if the stream was created with a priority outside the numerical range returned by [`cuCtxGetStreamPriorityRange`], this function returns the clamped priority. See [`cuStreamCreateWithPriority`] for details about priority clamping.
13500 ///
13501 /// Note:
13502 ///
13503 /// Note that this function may also return error codes from previous, asynchronous launches.
13504 ///
13505 /// **See also:**
13506 ///
13507 /// [`cuStreamDestroy_v2`], [`cuStreamCreate`], [`cuStreamCreateWithPriority`], [`cuGreenCtxStreamCreate`], [`cuCtxGetStreamPriorityRange`], [`cuStreamGetFlags`], [`cuStreamGetDevice`], [cudaStreamGetPriority](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1g192bb727d15c4407c119747de7d198a6).
13508 ///
13509 /// # Parameters
13510 ///
13511 /// - `hStream`: Handle to the stream to be queried.
13512 /// - `priority`: Pointer to a signed integer in which the stream's priority is returned.
13513 pub fn cuStreamGetPriority(
13514 hStream: CUstream,
13515 priority: *mut ::core::ffi::c_int,
13516 ) -> CUresult;
13517}
13518unsafe extern "C" {
13519 /// Returns the device handle of the stream.
13520 ///
13521 /// Returns in \*device the device handle of the stream
13522 ///
13523 /// Note:
13524 ///
13525 /// Note that this function may also return error codes from previous, asynchronous launches.
13526 ///
13527 /// **See also:**
13528 ///
13529 /// [`cuStreamDestroy_v2`], [`cuStreamCreate`], [`cuGreenCtxStreamCreate`], [`cuStreamGetFlags`].
13530 ///
13531 /// # Parameters
13532 ///
13533 /// - `hStream`: Handle to the stream to be queried.
13534 /// - `device`: Returns the device to which a stream belongs.
13535 pub fn cuStreamGetDevice(hStream: CUstream, device: *mut CUdevice) -> CUresult;
13536}
13537unsafe extern "C" {
13538 /// Query the flags of a given stream.
13539 ///
13540 /// Query the flags of a stream created using [`cuStreamCreate`], [`cuStreamCreateWithPriority`] or [`cuGreenCtxStreamCreate`] and return the flags in flags.
13541 ///
13542 /// Note:
13543 ///
13544 /// Note that this function may also return error codes from previous, asynchronous launches.
13545 ///
13546 /// **See also:**
13547 ///
13548 /// [`cuStreamDestroy_v2`], [`cuStreamCreate`], [`cuGreenCtxStreamCreate`], [`cuStreamGetPriority`], [cudaStreamGetFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1ga7f311f88126d751b9a7d3302ad6d0f8), [`cuStreamGetDevice`].
13549 ///
13550 /// # Parameters
13551 ///
13552 /// - `hStream`: Handle to the stream to be queried.
13553 /// - `flags`: Pointer to an unsigned integer in which the stream's flags are returned The value returned in flags is a logical 'OR' of all flags that were used while creating this stream. See [`cuStreamCreate`] for the list of valid flags.
13554 pub fn cuStreamGetFlags(
13555 hStream: CUstream,
13556 flags: *mut ::core::ffi::c_uint,
13557 ) -> CUresult;
13558}
13559unsafe extern "C" {
13560 /// Returns the unique Id associated with the stream handle supplied.
13561 ///
13562 /// Returns in streamId the unique Id which is associated with the given stream handle. The Id is unique for the life of the program.
13563 ///
13564 /// The stream handle hStream can refer to any of the following:
13565 ///
13566 /// * a stream created via any of the CUDA driver APIs such as [`cuStreamCreate`] and [`cuStreamCreateWithPriority`], or their runtime API equivalents such as [cudaStreamCreate](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1g6a3c4b819e6a994c26d0c4824a4c80da), [cudaStreamCreateWithFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1gb1e32aff9f59119e4d0a9858991c4ad3) and [cudaStreamCreateWithPriority](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1ge2be9e9858849bf62ba4a8b66d1c3540). Passing an invalid handle will result in undefined behavior.
13567 /// * any of the special streams such as the NULL stream, `CU_STREAM_LEGACY` and `CU_STREAM_PER_THREAD`. The runtime API equivalents of these are also accepted, which are NULL, [cudaStreamLegacy](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html#group__CUDART__TYPES_1g4e62d09dde16ba457b0a97f3a5262246) and [cudaStreamPerThread](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html#group__CUDART__TYPES_1g7b7129befd6f52708309acafd1c46197) respectively.
13568 ///
13569 /// Note:
13570 ///
13571 /// Note that this function may also return error codes from previous, asynchronous launches.
13572 ///
13573 /// **See also:**
13574 ///
13575 /// [`cuStreamDestroy_v2`], [`cuStreamCreate`], [`cuStreamGetPriority`], [cudaStreamGetId](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1g5799ae8dd744e561dfdeda02c53e82df).
13576 ///
13577 /// # Parameters
13578 ///
13579 /// - `hStream`: Handle to the stream to be queried.
13580 /// - `streamId`: Pointer to store the Id of the stream.
13581 pub fn cuStreamGetId(
13582 hStream: CUstream,
13583 streamId: *mut ::core::ffi::c_ulonglong,
13584 ) -> CUresult;
13585}
13586unsafe extern "C" {
13587 /// Query the context associated with a stream.
13588 ///
13589 /// Returns the CUDA context that the stream is associated with.
13590 ///
13591 /// If the stream was created via the API [`cuGreenCtxStreamCreate`], the returned context is equivalent to the one returned by [`cuCtxFromGreenCtx`] on the green context associated with the stream at creation time.
13592 ///
13593 /// The stream handle hStream can refer to any of the following:
13594 ///
13595 /// * a stream created via any of the CUDA driver APIs such as [`cuStreamCreate`] and [`cuStreamCreateWithPriority`], or their runtime API equivalents such as [cudaStreamCreate](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1g6a3c4b819e6a994c26d0c4824a4c80da), [cudaStreamCreateWithFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1gb1e32aff9f59119e4d0a9858991c4ad3) and [cudaStreamCreateWithPriority](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1ge2be9e9858849bf62ba4a8b66d1c3540). The returned context is the context that was active in the calling thread when the stream was created. Passing an invalid
13596 /// handle will result in undefined behavior.
13597 /// * any of the special streams such as the NULL stream, `CU_STREAM_LEGACY` and `CU_STREAM_PER_THREAD`. The runtime API equivalents of these are also accepted, which are NULL, [cudaStreamLegacy](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html#group__CUDART__TYPES_1g4e62d09dde16ba457b0a97f3a5262246) and [cudaStreamPerThread](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html#group__CUDART__TYPES_1g7b7129befd6f52708309acafd1c46197) respectively. Specifying any of the special handles will return the context current to the calling thread. If no context
13598 /// is current to the calling thread, [`cudaError_enum::CUDA_ERROR_INVALID_CONTEXT`] is returned.
13599 ///
13600 /// Note:
13601 ///
13602 /// Note that this function may also return error codes from previous, asynchronous launches.
13603 ///
13604 /// **See also:**
13605 ///
13606 /// [`cuStreamDestroy_v2`], [`cuStreamCreateWithPriority`], [`cuStreamGetPriority`], [`cuStreamGetFlags`], [`cuStreamGetDevice`], [cudaStreamCreateWithFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1gb1e32aff9f59119e4d0a9858991c4ad3).
13607 ///
13608 /// # Parameters
13609 ///
13610 /// - `hStream`: Handle to the stream to be queried.
13611 /// - `pctx`: Returned context associated with the stream.
13612 pub fn cuStreamGetCtx(hStream: CUstream, pctx: *mut CUcontext) -> CUresult;
13613}
13614unsafe extern "C" {
13615 /// Query the contexts associated with a stream.
13616 ///
13617 /// Returns the contexts that the stream is associated with.
13618 ///
13619 /// If the stream is associated with a green context, the API returns the green context in pGreenCtx and the primary context of the associated device in pCtx.
13620 ///
13621 /// If the stream is associated with a regular context, the API returns the regular context in pCtx and NULL in pGreenCtx.
13622 ///
13623 /// The stream handle hStream can refer to any of the following:
13624 ///
13625 /// * a stream created via any of the CUDA driver APIs such as [`cuStreamCreate`], [`cuStreamCreateWithPriority`] and [`cuGreenCtxStreamCreate`], or their runtime API equivalents such as [cudaStreamCreate](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1g6a3c4b819e6a994c26d0c4824a4c80da), [cudaStreamCreateWithFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1gb1e32aff9f59119e4d0a9858991c4ad3) and [cudaStreamCreateWithPriority](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1ge2be9e9858849bf62ba4a8b66d1c3540). Passing an invalid handle will result in undefined behavior.
13626 /// * any of the special streams such as the NULL stream, `CU_STREAM_LEGACY` and `CU_STREAM_PER_THREAD`. The runtime API equivalents of these are also accepted, which are NULL, [cudaStreamLegacy](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html#group__CUDART__TYPES_1g4e62d09dde16ba457b0a97f3a5262246) and [cudaStreamPerThread](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html#group__CUDART__TYPES_1g7b7129befd6f52708309acafd1c46197) respectively. If any of the special handles are specified, the API will operate on the context current to the calling thread.
13627 /// If a green context (that was converted via [`cuCtxFromGreenCtx`] before setting it current) is current to the calling thread, the API will return the green context in pGreenCtx and the primary context of the associated device in pCtx. If a regular context is current, the API returns the regular context in pCtx and NULL in pGreenCtx. Note that specifying `CU_STREAM_PER_THREAD` or [cudaStreamPerThread](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html#group__CUDART__TYPES_1g7b7129befd6f52708309acafd1c46197) will return [`cudaError_enum::CUDA_ERROR_INVALID_HANDLE`] if a green context is current to the calling thread. If no context is current to the calling thread, [`cudaError_enum::CUDA_ERROR_INVALID_CONTEXT`] is returned.
13628 ///
13629 /// Note:
13630 ///
13631 /// Note that this function may also return error codes from previous, asynchronous launches.
13632 ///
13633 /// **See also:**
13634 ///
13635 /// [`cuStreamDestroy_v2`], [`cuStreamCreate`], [cudaStreamCreateWithFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1gb1e32aff9f59119e4d0a9858991c4ad3),.
13636 ///
13637 /// # Parameters
13638 ///
13639 /// - `hStream`: Handle to the stream to be queried.
13640 /// - `pCtx`: Returned regular context associated with the stream.
13641 /// - `pGreenCtx`: Returned green context if the stream is associated with a green context or NULL if not.
13642 pub fn cuStreamGetCtx_v2(
13643 hStream: CUstream,
13644 pCtx: *mut CUcontext,
13645 pGreenCtx: *mut CUgreenCtx,
13646 ) -> CUresult;
13647}
13648unsafe extern "C" {
13649 /// Make a compute stream wait on an event.
13650 ///
13651 /// Makes all future work submitted to hStream wait for all work captured in hEvent. See [`cuEventRecord`] for details on what is captured by an event. The synchronization will be performed efficiently on the device when applicable.
13652 /// hEvent may be from a different context or device than hStream.
13653 ///
13654 /// flags include:
13655 ///
13656 /// * [`CUevent_wait_flags_enum::CU_EVENT_WAIT_DEFAULT`]: Default event creation flag.
13657 /// * [`CUevent_wait_flags_enum::CU_EVENT_WAIT_EXTERNAL`]: Event is captured in the graph as an external event node when performing stream capture. This flag is invalid outside of
13658 /// stream capture.
13659 ///
13660 /// Note:
13661 ///
13662 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
13663 /// * Note that this function may also return error codes from previous, asynchronous launches.
13664 ///
13665 /// **See also:**
13666 ///
13667 /// [`cuStreamCreate`], [`cuEventRecord`], [`cuStreamQuery`], [`cuStreamSynchronize`], [`cuStreamAddCallback`], [`cuStreamDestroy_v2`], [cudaStreamWaitEvent](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1g7840e3984799941a61839de40413d1d9).
13668 ///
13669 /// # Parameters
13670 ///
13671 /// - `hStream`: Stream to wait.
13672 /// - `hEvent`: Event to wait on (may not be NULL).
13673 /// - `Flags`: See CUevent_capture_flags.
13674 pub fn cuStreamWaitEvent(
13675 hStream: CUstream,
13676 hEvent: CUevent,
13677 Flags: ::core::ffi::c_uint,
13678 ) -> CUresult;
13679}
13680unsafe extern "C" {
13681 /// Add a callback to a compute stream.
13682 ///
13683 /// Note:
13684 ///
13685 /// This function is slated for eventual deprecation and removal. If you do not require the callback to execute in case of a device
13686 /// error, consider using [`cuLaunchHostFunc`]. Additionally, this function is not supported with [`cuStreamBeginCapture_v2`] and [`cuStreamEndCapture`], unlike [`cuLaunchHostFunc`].
13687 ///
13688 /// Adds a callback to be called on the host after all currently enqueued items in the stream have completed. For each cuStreamAddCallback
13689 /// call, the callback will be executed exactly once. The callback will block later work in the stream until it is finished.
13690 ///
13691 /// The callback may be passed [`cudaError_enum::CUDA_SUCCESS`] or an error code. In the event of a device error, all subsequently executed callbacks will receive an appropriate `CUresult`.
13692 ///
13693 /// Callbacks must not make any CUDA API calls. Attempting to use a CUDA API will result in [`cudaError_enum::CUDA_ERROR_NOT_PERMITTED`]. Callbacks must not perform any synchronization that may depend on outstanding device work or other callbacks that are not
13694 /// mandated to run earlier. Callbacks without a mandated order (in independent streams) execute in undefined order and may be
13695 /// serialized.
13696 ///
13697 /// For the purposes of Unified Memory, callback execution makes a number of guarantees:
13698 ///
13699 /// * The callback stream is considered idle for the duration of the callback. Thus, for example, a callback may always use memory
13700 /// attached to the callback stream.
13701 /// * The start of execution of a callback has the same effect as synchronizing an event recorded in the same stream immediately
13702 /// prior to the callback. It thus synchronizes streams which have been "joined" prior to the callback.
13703 /// * Adding device work to any stream does not have the effect of making the stream active until all preceding host functions and
13704 /// stream callbacks have executed. Thus, for example, a callback might use global attached memory even if work has been added
13705 /// to another stream, if the work has been ordered behind the callback with an event.
13706 /// * Completion of a callback does not cause a stream to become active except as described above. The callback stream will remain
13707 /// idle if no device work follows the callback, and will remain idle across consecutive callbacks without device work in between.
13708 /// Thus, for example, stream synchronization can be done by signaling from a callback at the end of the stream.
13709 ///
13710 /// Note:
13711 ///
13712 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
13713 /// * Note that this function may also return error codes from previous, asynchronous launches.
13714 ///
13715 /// **See also:**
13716 ///
13717 /// [`cuStreamCreate`], [`cuStreamQuery`], [`cuStreamSynchronize`], [`cuStreamWaitEvent`], [`cuStreamDestroy_v2`], [`cuMemAllocManaged`], [`cuStreamAttachMemAsync`], [`cuLaunchHostFunc`], [cudaStreamAddCallback](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1g74aa9f4b1c2f12d994bf13876a5a2498).
13718 ///
13719 /// # Parameters
13720 ///
13721 /// - `hStream`: Stream to add callback to.
13722 /// - `callback`: The function to call once preceding stream operations are complete.
13723 /// - `userData`: User specified data to be passed to the callback function.
13724 /// - `flags`: Reserved for future use, must be 0.
13725 pub fn cuStreamAddCallback(
13726 hStream: CUstream,
13727 callback: CUstreamCallback,
13728 userData: *mut ::core::ffi::c_void,
13729 flags: ::core::ffi::c_uint,
13730 ) -> CUresult;
13731}
13732unsafe extern "C" {
13733 /// Begins graph capture on a stream.
13734 ///
13735 /// Begin graph capture on hStream. When a stream is in capture mode, all operations pushed into the stream will not be executed, but will instead be captured
13736 /// into a graph, which will be returned via [`cuStreamEndCapture`]. Capture may not be initiated if stream is CU_STREAM_LEGACY. Capture must be ended on the same stream in which it was initiated, and it may only be initiated if
13737 /// the stream is not already in capture mode. The capture mode may be queried via [`cuStreamIsCapturing`]. A unique id representing the capture sequence may be queried via [`cuStreamGetCaptureInfo_v3`].
13738 ///
13739 /// If mode is not [`CUstreamCaptureMode::CU_STREAM_CAPTURE_MODE_RELAXED`], [`cuStreamEndCapture`] must be called on this stream from the same thread.
13740 ///
13741 /// Note:
13742 ///
13743 /// Kernels captured using this API must not use texture and surface references. Reading or writing through any texture or surface
13744 /// reference is undefined behavior. This restriction does not apply to texture and surface objects.
13745 ///
13746 /// Note:
13747 ///
13748 /// Note that this function may also return error codes from previous, asynchronous launches.
13749 ///
13750 /// **See also:**
13751 ///
13752 /// [`cuStreamCreate`], [`cuStreamIsCapturing`], [`cuStreamEndCapture`], [`cuThreadExchangeStreamCaptureMode`].
13753 ///
13754 /// # Parameters
13755 ///
13756 /// - `hStream`: Stream in which to initiate capture.
13757 /// - `mode`: Controls the interaction of this capture sequence with other API calls that are potentially unsafe. For more details see
13758 /// [`cuThreadExchangeStreamCaptureMode`].
13759 pub fn cuStreamBeginCapture_v2(
13760 hStream: CUstream,
13761 mode: CUstreamCaptureMode,
13762 ) -> CUresult;
13763}
13764#[repr(u32)]
13765#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
13766pub enum CUgraphRecaptureStatus_enum {
13767 CU_GRAPH_RECAPTURE_ELIGIBLE_FOR_UPDATE = 0,
13768 CU_GRAPH_RECAPTURE_INELIGIBLE_FOR_UPDATE = 1,
13769 CU_GRAPH_RECAPTURE_ERROR = 2,
13770}
13771pub use self::CUgraphRecaptureStatus_enum as CUgraphRecaptureStatus;
13772/// Callback function invoked when node parameter mismatches are detected while recapturing to an existing graph. Parameter struct
13773/// pointers are only valid within the callback.
13774pub type CUgraphRecaptureCallback = ::core::option::Option<
13775 unsafe extern "C" fn(
13776 data: *mut ::core::ffi::c_void,
13777 node: CUgraphNode,
13778 originalParams: *const CUgraphNodeParams,
13779 recaptureParams: *const CUgraphNodeParams,
13780 status: CUgraphRecaptureStatus,
13781 ) -> CUresult,
13782>;
13783unsafe extern "C" {
13784 /// Begin graph capture on a stream to an existing graph.
13785 ///
13786 /// Begin graph capture on hStream to the existing hGraph. The node creation order while recapturing the graph must be identical to the original graph. The recapture will fail immediately
13787 /// for: \* Topology mismatches between the existing graph and the recaptured graph \* Parameter mismatches for memory allocation
13788 /// or free nodes
13789 ///
13790 /// Any other node parameter mismatches during recapture can be configured to call the function provided in callbackFunc. The recapture will fail immediately if the callback returns anything other than [`CUresult::CUDA_SUCCESS`].
13791 ///
13792 /// If the recapture fails for any reason, the graph will be in an undefined state and should be destroyed.
13793 ///
13794 /// See cuStreamBeginCapture for additional detail on beginning the capture.
13795 ///
13796 /// Note:
13797 ///
13798 /// Any user objects associated with graph will be released prior to the recapture.
13799 ///
13800 /// Note:
13801 ///
13802 /// Note that this function may also return error codes from previous, asynchronous launches.
13803 ///
13804 /// **See also:**
13805 ///
13806 /// [`cuStreamCreate`], [`cuStreamBeginCapture_v2`], [`cuStreamIsCapturing`], [`cuStreamEndCapture`], [`cuThreadExchangeStreamCaptureMode`].
13807 ///
13808 /// # Parameters
13809 ///
13810 /// - `hStream`: Stream in which to initiate capture.
13811 /// - `mode`: Controls the interaction of this capture sequence with other API calls that are potentially unsafe. For more details see
13812 /// [`cuThreadExchangeStreamCaptureMode`].
13813 /// - `hGraph`: Existing CUDA graph to be captured into.
13814 /// - `callbackFunc`: Function that will be called for all parameter mismatches from the original graph.
13815 /// - `userData`: A generic pointer to user data that is passed into the callback function.
13816 pub fn cuStreamBeginRecaptureToGraph(
13817 hStream: CUstream,
13818 mode: CUstreamCaptureMode,
13819 hGraph: CUgraph,
13820 callbackFunc: CUgraphRecaptureCallback,
13821 userData: *mut ::core::ffi::c_void,
13822 ) -> CUresult;
13823}
13824unsafe extern "C" {
13825 /// Begins graph capture on a stream to an existing graph.
13826 ///
13827 /// Begin graph capture on hStream, placing new nodes into an existing graph. When a stream is in capture mode, all operations pushed into the stream will not
13828 /// be executed, but will instead be captured into hGraph. The graph will not be instantiable until the user calls [`cuStreamEndCapture`].
13829 ///
13830 /// Capture may not be initiated if stream is CU_STREAM_LEGACY. Capture must be ended on the same stream in which it was initiated, and it may only be initiated if
13831 /// the stream is not already in capture mode. The capture mode may be queried via [`cuStreamIsCapturing`]. A unique id representing the capture sequence may be queried via [`cuStreamGetCaptureInfo_v3`].
13832 ///
13833 /// If mode is not [`CUstreamCaptureMode::CU_STREAM_CAPTURE_MODE_RELAXED`], [`cuStreamEndCapture`] must be called on this stream from the same thread.
13834 ///
13835 /// Note:
13836 ///
13837 /// Kernels captured using this API must not use texture and surface references. Reading or writing through any texture or surface
13838 /// reference is undefined behavior. This restriction does not apply to texture and surface objects.
13839 ///
13840 /// Note:
13841 ///
13842 /// Note that this function may also return error codes from previous, asynchronous launches.
13843 ///
13844 /// **See also:**
13845 ///
13846 /// [`cuStreamBeginCapture_v2`], [`cuStreamCreate`], [`cuStreamIsCapturing`], [`cuStreamEndCapture`], [`cuThreadExchangeStreamCaptureMode`], [`cuGraphAddNode_v2`].
13847 ///
13848 /// # Parameters
13849 ///
13850 /// - `hStream`: Stream in which to initiate capture.
13851 /// - `hGraph`: Graph to capture into.
13852 /// - `dependencies`: Dependencies of the first node captured in the stream. Can be NULL if numDependencies is 0.
13853 /// - `dependencyData`: Optional array of data associated with each dependency.
13854 /// - `numDependencies`: Number of dependencies.
13855 /// - `mode`: Controls the interaction of this capture sequence with other API calls that are potentially unsafe. For more details see
13856 /// [`cuThreadExchangeStreamCaptureMode`].
13857 pub fn cuStreamBeginCaptureToGraph(
13858 hStream: CUstream,
13859 hGraph: CUgraph,
13860 dependencies: *const CUgraphNode,
13861 dependencyData: *const CUgraphEdgeData,
13862 numDependencies: size_t,
13863 mode: CUstreamCaptureMode,
13864 ) -> CUresult;
13865}
13866unsafe extern "C" {
13867 /// Swaps the stream capture interaction mode for a thread.
13868 ///
13869 /// Sets the calling thread's stream capture interaction mode to the value contained in \*mode, and overwrites \*mode with the previous mode for the thread. To facilitate deterministic behavior across function or module boundaries, callers
13870 /// are encouraged to use this API in a push-pop fashion:
13871 ///
13872 /// ```text
13873 /// CUstreamCaptureMode mode = desiredMode;
13874 /// cuThreadExchangeStreamCaptureMode(&mode);
13875 /// ...
13876 /// cuThreadExchangeStreamCaptureMode(&mode); // restore previous mode
13877 /// ```
13878 ///
13879 /// During stream capture (see [`cuStreamBeginCapture_v2`]), some actions, such as a call to [cudaMalloc](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g37d37965bfb4803b6d4e59ff26856356), may be unsafe. In the case of [cudaMalloc](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g37d37965bfb4803b6d4e59ff26856356), the operation is not enqueued asynchronously to a stream, and is not observed by stream capture. Therefore, if the sequence
13880 /// of operations captured via [`cuStreamBeginCapture_v2`] depended on the allocation being replayed whenever the graph is launched, the captured graph would be invalid.
13881 ///
13882 /// Therefore, stream capture places restrictions on API calls that can be made within or concurrently to a [`cuStreamBeginCapture_v2`]-[`cuStreamEndCapture`] sequence. This behavior can be controlled via this API and flags to [`cuStreamBeginCapture_v2`].
13883 ///
13884 /// A thread's mode is one of the following:
13885 ///
13886 /// * [`CUstreamCaptureMode::CU_STREAM_CAPTURE_MODE_GLOBAL`]: This is the default mode. If the local thread has an ongoing capture sequence that was not initiated with [`CUstreamCaptureMode::CU_STREAM_CAPTURE_MODE_RELAXED`] at cuStreamBeginCapture, or if any other thread has a concurrent capture sequence initiated with [`CUstreamCaptureMode::CU_STREAM_CAPTURE_MODE_GLOBAL`], this thread is prohibited from potentially unsafe API calls.
13887 /// * [`CUstreamCaptureMode::CU_STREAM_CAPTURE_MODE_THREAD_LOCAL`]: If the local thread has an ongoing capture sequence not initiated with [`CUstreamCaptureMode::CU_STREAM_CAPTURE_MODE_RELAXED`], it is prohibited from potentially unsafe API calls. Concurrent capture sequences in other threads are ignored.
13888 /// * [`CUstreamCaptureMode::CU_STREAM_CAPTURE_MODE_RELAXED`]: The local thread is not prohibited from potentially unsafe API calls. Note that the thread is still prohibited from API calls
13889 /// which necessarily conflict with stream capture, for example, attempting [`cuEventQuery`] on an event that was last recorded inside a capture sequence.
13890 ///
13891 /// Note:
13892 ///
13893 /// Note that this function may also return error codes from previous, asynchronous launches.
13894 ///
13895 /// **See also:**
13896 ///
13897 /// [`cuStreamBeginCapture_v2`].
13898 ///
13899 /// # Parameters
13900 ///
13901 /// - `mode`: Pointer to mode value to swap with the current mode.
13902 pub fn cuThreadExchangeStreamCaptureMode(mode: *mut CUstreamCaptureMode) -> CUresult;
13903}
13904unsafe extern "C" {
13905 /// Ends capture on a stream, returning the captured graph.
13906 ///
13907 /// End capture on hStream, returning the captured graph via phGraph. Capture must have been initiated on hStream via a call to [`cuStreamBeginCapture_v2`]. If capture was invalidated, due to a violation of the rules of stream capture, then a NULL graph will be returned.
13908 ///
13909 /// If the mode argument to [`cuStreamBeginCapture_v2`] was not [`CUstreamCaptureMode::CU_STREAM_CAPTURE_MODE_RELAXED`], this call must be from the same thread as [`cuStreamBeginCapture_v2`].
13910 ///
13911 /// Note:
13912 ///
13913 /// Note that this function may also return error codes from previous, asynchronous launches.
13914 ///
13915 /// **See also:**
13916 ///
13917 /// [`cuStreamCreate`], [`cuStreamBeginCapture_v2`], [`cuStreamIsCapturing`], [`cuGraphDestroy`].
13918 ///
13919 /// # Parameters
13920 ///
13921 /// - `hStream`: Stream to query.
13922 /// - `phGraph`: The captured graph.
13923 pub fn cuStreamEndCapture(hStream: CUstream, phGraph: *mut CUgraph) -> CUresult;
13924}
13925unsafe extern "C" {
13926 /// Returns a stream's capture status.
13927 ///
13928 /// Return the capture status of hStream via captureStatus. After a successful call, \*captureStatus will contain one of the following:
13929 ///
13930 /// * [`CUstreamCaptureStatus_enum::CU_STREAM_CAPTURE_STATUS_NONE`]: The stream is not capturing.
13931 /// * [`CUstreamCaptureStatus_enum::CU_STREAM_CAPTURE_STATUS_ACTIVE`]: The stream is capturing.
13932 /// * [`CUstreamCaptureStatus_enum::CU_STREAM_CAPTURE_STATUS_INVALIDATED`]: The stream was capturing but an error has invalidated the capture sequence. The capture sequence must be terminated with
13933 /// [`cuStreamEndCapture`] on the stream where it was initiated in order to continue using hStream.
13934 ///
13935 /// Note that, if this is called on `CU_STREAM_LEGACY` (the "null stream") while a blocking stream in the same context is capturing, it will return [`cudaError_enum::CUDA_ERROR_STREAM_CAPTURE_IMPLICIT`] and \*captureStatus is unspecified after the call. The blocking stream capture is not invalidated.
13936 ///
13937 /// When a blocking stream is capturing, the legacy stream is in an unusable state until the blocking stream capture is terminated.
13938 /// The legacy stream is not supported for stream capture, but attempted use would have an implicit dependency on the capturing
13939 /// stream(s).
13940 ///
13941 /// Note:
13942 ///
13943 /// Note that this function may also return error codes from previous, asynchronous launches.
13944 ///
13945 /// **See also:**
13946 ///
13947 /// [`cuStreamCreate`], [`cuStreamBeginCapture_v2`], [`cuStreamEndCapture`].
13948 ///
13949 /// # Parameters
13950 ///
13951 /// - `hStream`: Stream to query.
13952 /// - `captureStatus`: Returns the stream's capture status.
13953 pub fn cuStreamIsCapturing(
13954 hStream: CUstream,
13955 captureStatus: *mut CUstreamCaptureStatus,
13956 ) -> CUresult;
13957}
13958unsafe extern "C" {
13959 /// Query a stream's capture state.
13960 ///
13961 /// Query stream state related to stream capture.
13962 ///
13963 /// If called on `CU_STREAM_LEGACY` (the "null stream") while a stream not created with [`CUstream_flags_enum::CU_STREAM_NON_BLOCKING`] is capturing, returns [`cudaError_enum::CUDA_ERROR_STREAM_CAPTURE_IMPLICIT`].
13964 ///
13965 /// Valid data (other than capture status) is returned only if both of the following are true:
13966 ///
13967 /// * the call returns [`CUresult::CUDA_SUCCESS`]
13968 /// * the returned capture status is [`CUstreamCaptureStatus_enum::CU_STREAM_CAPTURE_STATUS_ACTIVE`]
13969 ///
13970 /// If edgeData_out is non-NULL then dependencies_out must be as well. If dependencies_out is non-NULL and edgeData_out is NULL, but there is non-zero edge data for one or more of the current stream dependencies, the call will return [`cudaError_enum::CUDA_ERROR_LOSSY_QUERY`].
13971 ///
13972 /// Note:
13973 ///
13974 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
13975 /// * Note that this function may also return error codes from previous, asynchronous launches.
13976 ///
13977 /// **See also:**
13978 ///
13979 /// [`cuStreamBeginCapture_v2`], [`cuStreamIsCapturing`], [`cuStreamUpdateCaptureDependencies_v2`].
13980 ///
13981 /// # Parameters
13982 ///
13983 /// - `hStream`: The stream to query.
13984 /// - `captureStatus_out`: Location to return the capture status of the stream; required.
13985 /// - `id_out`: Optional location to return an id for the capture sequence, which is unique over the lifetime of the process.
13986 /// - `graph_out`: Optional location to return the graph being captured into. All operations other than destroy and node removal are permitted
13987 /// on the graph while the capture sequence is in progress. This API does not transfer ownership of the graph, which is transferred
13988 /// or destroyed at [`cuStreamEndCapture`]. Note that the graph handle may be invalidated before end of capture for certain errors. Nodes that are or become unreachable
13989 /// from the original stream at [`cuStreamEndCapture`] due to direct actions on the graph do not trigger [`cudaError_enum::CUDA_ERROR_STREAM_CAPTURE_UNJOINED`].
13990 /// - `dependencies_out`: Optional location to store a pointer to an array of nodes. The next node to be captured in the stream will depend on this
13991 /// set of nodes, absent operations such as event wait which modify this set. The array pointer is valid until the next API call
13992 /// which operates on the stream or until the capture is terminated. The node handles may be copied out and are valid until they
13993 /// or the graph is destroyed. The driver-owned array may also be passed directly to APIs that operate on the graph (not the stream)
13994 /// without copying.
13995 /// - `edgeData_out`: Optional location to store a pointer to an array of graph edge data. This array parallels dependencies_out; the next node to be added has an edge to dependencies_out\[i\] with annotation edgeData_out\[i\] for each i. The array pointer is valid until the next API call which operates on the stream or until the capture is terminated.
13996 /// - `numDependencies_out`: Optional location to store the size of the array returned in dependencies_out.
13997 pub fn cuStreamGetCaptureInfo_v3(
13998 hStream: CUstream,
13999 captureStatus_out: *mut CUstreamCaptureStatus,
14000 id_out: *mut cuuint64_t,
14001 graph_out: *mut CUgraph,
14002 dependencies_out: *mut *const CUgraphNode,
14003 edgeData_out: *mut *const CUgraphEdgeData,
14004 numDependencies_out: *mut size_t,
14005 ) -> CUresult;
14006}
14007unsafe extern "C" {
14008 /// Update the set of dependencies in a capturing stream.
14009 ///
14010 /// Modifies the dependency set of a capturing stream. The dependency set is the set of nodes that the next captured node in the
14011 /// stream will depend on along with the edge data for those dependencies.
14012 ///
14013 /// Valid flags are [`CUstreamUpdateCaptureDependencies_flags_enum::CU_STREAM_ADD_CAPTURE_DEPENDENCIES`] and [`CUstreamUpdateCaptureDependencies_flags_enum::CU_STREAM_SET_CAPTURE_DEPENDENCIES`]. These control whether the set passed to the API is added to the existing set or replaces it. A flags value of 0 defaults
14014 /// to [`CUstreamUpdateCaptureDependencies_flags_enum::CU_STREAM_ADD_CAPTURE_DEPENDENCIES`].
14015 ///
14016 /// Nodes that are removed from the dependency set via this API do not result in [`cudaError_enum::CUDA_ERROR_STREAM_CAPTURE_UNJOINED`] if they are unreachable from the stream at [`cuStreamEndCapture`].
14017 ///
14018 /// Returns [`cudaError_enum::CUDA_ERROR_ILLEGAL_STATE`] if the stream is not capturing.
14019 ///
14020 /// **See also:**
14021 ///
14022 /// [`cuStreamBeginCapture_v2`], [`cuStreamGetCaptureInfo_v3`].
14023 ///
14024 /// # Parameters
14025 ///
14026 /// - `hStream`: The stream to update.
14027 /// - `dependencies`: The set of dependencies to add.
14028 /// - `dependencyData`: Optional array of data associated with each dependency.
14029 /// - `numDependencies`: The size of the dependencies array.
14030 /// - `flags`: See above.
14031 pub fn cuStreamUpdateCaptureDependencies_v2(
14032 hStream: CUstream,
14033 dependencies: *mut CUgraphNode,
14034 dependencyData: *const CUgraphEdgeData,
14035 numDependencies: size_t,
14036 flags: ::core::ffi::c_uint,
14037 ) -> CUresult;
14038}
14039unsafe extern "C" {
14040 /// Attach memory to a stream asynchronously.
14041 ///
14042 /// Enqueues an operation in hStream to specify stream association of length bytes of memory starting from dptr. This function is a stream-ordered operation, meaning that it is dependent on, and will only take effect when, previous work
14043 /// in stream has completed. Any previous association is automatically replaced.
14044 ///
14045 /// dptr must point to one of the following types of memories:
14046 ///
14047 /// * managed memory declared using the __managed__ keyword or allocated with [`cuMemAllocManaged`].
14048 /// * a valid host-accessible region of system-allocated pageable memory. This type of memory may only be specified if the device
14049 /// associated with the stream reports a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`].
14050 ///
14051 /// For managed allocations, length must be either zero or the entire allocation's size. Both indicate that the entire allocation's stream association is being
14052 /// changed. Currently, it is not possible to change stream association for a portion of a managed allocation.
14053 ///
14054 /// For pageable host allocations, length must be non-zero.
14055 ///
14056 /// The stream association is specified using flags which must be one of `CUmemAttach_flags`. If the [`CUmemAttach_flags_enum::CU_MEM_ATTACH_GLOBAL`] flag is specified, the memory can be accessed by any stream on any device. If the [`CUmemAttach_flags_enum::CU_MEM_ATTACH_HOST`] flag is specified, the program makes a guarantee that it won't access the memory on the device from any stream on a device
14057 /// that has a zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`]. If the [`CUmemAttach_flags_enum::CU_MEM_ATTACH_SINGLE`] flag is specified and hStream is associated with a device that has a zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`], the program makes a guarantee that it will only access the memory on the device from hStream. It is illegal to attach singly to the NULL stream, because the NULL stream is a virtual global stream and not a specific
14058 /// stream. An error will be returned in this case.
14059 ///
14060 /// When memory is associated with a single stream, the Unified Memory system will allow CPU access to this memory region so long
14061 /// as all operations in hStream have completed, regardless of whether other streams are active. In effect, this constrains exclusive ownership of the managed
14062 /// memory region by an active GPU to per-stream activity instead of whole-GPU activity.
14063 ///
14064 /// Accessing memory on the device from streams that are not associated with it will produce undefined results. No error checking
14065 /// is performed by the Unified Memory system to ensure that kernels launched into other streams do not access this region.
14066 ///
14067 /// It is a program's responsibility to order calls to [`cuStreamAttachMemAsync`] via events, synchronization or other means to ensure legal access to memory at all times. Data visibility and coherency will
14068 /// be changed appropriately for all kernels which follow a stream-association change.
14069 ///
14070 /// If hStream is destroyed while data is associated with it, the association is removed and the association reverts to the default visibility
14071 /// of the allocation as specified at [`cuMemAllocManaged`]. For __managed__ variables, the default association is always [`CUmemAttach_flags_enum::CU_MEM_ATTACH_GLOBAL`]. Note that destroying a stream is an asynchronous operation, and as a result, the change to default association won't happen
14072 /// until all work in the stream has completed.
14073 ///
14074 /// Note:
14075 ///
14076 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
14077 /// * Note that this function may also return error codes from previous, asynchronous launches.
14078 ///
14079 /// **See also:**
14080 ///
14081 /// [`cuStreamCreate`], [`cuStreamQuery`], [`cuStreamSynchronize`], [`cuStreamWaitEvent`], [`cuStreamDestroy_v2`], [`cuMemAllocManaged`], [cudaStreamAttachMemAsync](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g496353d630c29c44a2e33f531a3944d1).
14082 ///
14083 /// # Parameters
14084 ///
14085 /// - `hStream`: Stream in which to enqueue the attach operation.
14086 /// - `dptr`: Pointer to memory (must be a pointer to managed memory or to a valid host-accessible region of system-allocated pageable
14087 /// ```text
14088 /// memory)
14089 /// ```
14090 /// - `length`: Length of memory.
14091 /// - `flags`: Must be one of `CUmemAttach_flags`.
14092 pub fn cuStreamAttachMemAsync(
14093 hStream: CUstream,
14094 dptr: CUdeviceptr,
14095 length: size_t,
14096 flags: ::core::ffi::c_uint,
14097 ) -> CUresult;
14098}
14099unsafe extern "C" {
14100 /// Determine status of a compute stream.
14101 ///
14102 /// Returns [`cudaError_enum::CUDA_SUCCESS`] if all operations in the stream specified by hStream have completed, or [`cudaError_enum::CUDA_ERROR_NOT_READY`] if not.
14103 ///
14104 /// For the purposes of Unified Memory, a return value of [`cudaError_enum::CUDA_SUCCESS`] is equivalent to having called [`cuStreamSynchronize`].
14105 ///
14106 /// Note:
14107 ///
14108 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
14109 /// * Note that this function may also return error codes from previous, asynchronous launches.
14110 ///
14111 /// **See also:**
14112 ///
14113 /// [`cuStreamCreate`], [`cuStreamWaitEvent`], [`cuStreamDestroy_v2`], [`cuStreamSynchronize`], [`cuStreamAddCallback`], [cudaStreamQuery](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1g2021adeb17905c7ec2a3c1bf125c5435).
14114 ///
14115 /// # Parameters
14116 ///
14117 /// - `hStream`: Stream to query status of.
14118 pub fn cuStreamQuery(hStream: CUstream) -> CUresult;
14119}
14120unsafe extern "C" {
14121 /// Wait until a stream's tasks are completed.
14122 ///
14123 /// Waits until the device has completed all operations in the stream specified by hStream. If the context was created with the [`CUctx_flags_enum::CU_CTX_SCHED_BLOCKING_SYNC`] flag, the CPU thread will block until the stream is finished with all of its tasks.
14124 ///
14125 /// Note:
14126 ///
14127 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
14128 /// * Note that this function may also return error codes from previous, asynchronous launches.
14129 ///
14130 /// **See also:**
14131 ///
14132 /// [`cuStreamCreate`], [`cuStreamDestroy_v2`], [`cuStreamWaitEvent`], [`cuStreamQuery`], [`cuStreamAddCallback`], [cudaStreamSynchronize](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1g82b5784f674c17c6df64affe618bf45e).
14133 ///
14134 /// # Parameters
14135 ///
14136 /// - `hStream`: Stream to wait for.
14137 pub fn cuStreamSynchronize(hStream: CUstream) -> CUresult;
14138}
14139unsafe extern "C" {
14140 /// Destroys a stream.
14141 ///
14142 /// Destroys the stream specified by hStream.
14143 ///
14144 /// In case the device is still doing work in the stream hStream when [`cuStreamDestroy_v2`] is called, the function will return immediately and the resources associated with hStream will be released automatically once the device has completed all work in hStream.
14145 ///
14146 /// Note:
14147 ///
14148 /// Note that this function may also return error codes from previous, asynchronous launches.
14149 ///
14150 /// **See also:**
14151 ///
14152 /// [`cuStreamCreate`], [`cuStreamWaitEvent`], [`cuStreamQuery`], [`cuStreamSynchronize`], [`cuStreamAddCallback`], [cudaStreamDestroy](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1gfda584f1788ca983cb21c5f4d2033a62).
14153 ///
14154 /// # Parameters
14155 ///
14156 /// - `hStream`: Stream to destroy.
14157 pub fn cuStreamDestroy_v2(hStream: CUstream) -> CUresult;
14158}
14159unsafe extern "C" {
14160 /// Copies attributes from source stream to destination stream.
14161 ///
14162 /// Copies attributes from source stream src to destination stream dst. Both streams must have the same context.
14163 ///
14164 /// Note:
14165 ///
14166 /// Note that this function may also return error codes from previous, asynchronous launches.
14167 ///
14168 /// **See also:**
14169 ///
14170 /// [`CUaccessPolicyWindow`].
14171 ///
14172 /// # Parameters
14173 ///
14174 /// - `dst`: Destination stream.
14175 /// - `src`: Source stream For list of attributes see CUstreamAttrID.
14176 pub fn cuStreamCopyAttributes(dst: CUstream, src: CUstream) -> CUresult;
14177}
14178unsafe extern "C" {
14179 /// Queries stream attribute.
14180 ///
14181 /// Queries attribute attr from hStream and stores it in corresponding member of value_out.
14182 ///
14183 /// Note:
14184 ///
14185 /// Note that this function may also return error codes from previous, asynchronous launches.
14186 ///
14187 /// **See also:**
14188 ///
14189 /// [`CUaccessPolicyWindow`].
14190 pub fn cuStreamGetAttribute(
14191 hStream: CUstream,
14192 attr: CUstreamAttrID,
14193 value_out: *mut CUstreamAttrValue,
14194 ) -> CUresult;
14195}
14196unsafe extern "C" {
14197 /// Sets stream attribute.
14198 ///
14199 /// Sets attribute attr on hStream from corresponding attribute of value. The updated attribute will be applied to subsequent work submitted to the stream. It will not affect previously submitted
14200 /// work.
14201 ///
14202 /// Note:
14203 ///
14204 /// Note that this function may also return error codes from previous, asynchronous launches.
14205 ///
14206 /// **See also:**
14207 ///
14208 /// [`CUaccessPolicyWindow`].
14209 pub fn cuStreamSetAttribute(
14210 hStream: CUstream,
14211 attr: CUstreamAttrID,
14212 value: *const CUstreamAttrValue,
14213 ) -> CUresult;
14214}
14215unsafe extern "C" {
14216 /// Creates an event.
14217 ///
14218 /// Creates an event \*phEvent for the current context with the flags specified via Flags. Valid flags include:
14219 ///
14220 /// * [`CUevent_flags_enum::CU_EVENT_DEFAULT`]: Default event creation flag.
14221 /// * [`CUevent_flags_enum::CU_EVENT_BLOCKING_SYNC`]: Specifies that the created event should use blocking synchronization. A CPU thread that uses [`cuEventSynchronize`] to wait on an event created with this flag will block until the event has actually been recorded.
14222 /// * [`CUevent_flags_enum::CU_EVENT_DISABLE_TIMING`]: Specifies that the created event does not need to record timing data. Events created with this flag specified and the [`CUevent_flags_enum::CU_EVENT_BLOCKING_SYNC`] flag not specified will provide the best performance when used with [`cuStreamWaitEvent`] and [`cuEventQuery`].
14223 /// * [`CUevent_flags_enum::CU_EVENT_INTERPROCESS`]: Specifies that the created event may be used as an interprocess event by [`cuIpcGetEventHandle`]. [`CUevent_flags_enum::CU_EVENT_INTERPROCESS`] must be specified along with [`CUevent_flags_enum::CU_EVENT_DISABLE_TIMING`].
14224 ///
14225 /// Note:
14226 ///
14227 /// Note that this function may also return error codes from previous, asynchronous launches.
14228 ///
14229 /// **See also:**
14230 ///
14231 /// [`cuEventRecord`], [`cuEventQuery`], [`cuEventSynchronize`], [`cuEventDestroy_v2`], [`cuEventElapsedTime_v2`], [cudaEventCreate](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g4b5fdb19d7fb5f6f8862559f9279f6c3), [cudaEventCreateWithFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__EVENT.html#group__CUDART__EVENT_1g7b317e07ff385d85aa656204b971a042).
14232 ///
14233 /// # Parameters
14234 ///
14235 /// - `phEvent`: Returns newly created event.
14236 /// - `Flags`: Event creation flags.
14237 pub fn cuEventCreate(phEvent: *mut CUevent, Flags: ::core::ffi::c_uint) -> CUresult;
14238}
14239unsafe extern "C" {
14240 /// Records an event.
14241 ///
14242 /// Captures in hEvent the contents of hStream at the time of this call. hEvent and hStream must be from the same context otherwise [`cudaError_enum::CUDA_ERROR_INVALID_HANDLE`] is returned. Calls such as [`cuEventQuery`] or [`cuStreamWaitEvent`] will then examine or wait for completion of the work that was captured. Uses of hStream after this call do not modify hEvent. See note on default stream behavior for what is captured in the default case.
14243 ///
14244 /// [`cuEventRecord`] can be called multiple times on the same event and will overwrite the previously captured state. Other APIs such as [`cuStreamWaitEvent`] use the most recently captured state at the time of the API call, and are not affected by later calls to [`cuEventRecord`]. Before the first call to [`cuEventRecord`], an event represents an empty set of work, so for example [`cuEventQuery`] would return [`cudaError_enum::CUDA_SUCCESS`].
14245 ///
14246 /// Note:
14247 ///
14248 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
14249 /// * Note that this function may also return error codes from previous, asynchronous launches.
14250 ///
14251 /// **See also:**
14252 ///
14253 /// [`cuEventCreate`], [`cuEventQuery`], [`cuEventSynchronize`], [`cuStreamWaitEvent`], [`cuEventDestroy_v2`], [`cuEventElapsedTime_v2`], [cudaEventRecord](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__EVENT.html#group__CUDART__EVENT_1gf4fcb74343aa689f4159791967868446), [`cuEventRecordWithFlags`].
14254 ///
14255 /// # Parameters
14256 ///
14257 /// - `hEvent`: Event to record.
14258 /// - `hStream`: Stream to record event for.
14259 pub fn cuEventRecord(hEvent: CUevent, hStream: CUstream) -> CUresult;
14260}
14261unsafe extern "C" {
14262 /// Records an event.
14263 ///
14264 /// Captures in hEvent the contents of hStream at the time of this call. hEvent and hStream must be from the same context otherwise [`cudaError_enum::CUDA_ERROR_INVALID_HANDLE`] is returned. Calls such as [`cuEventQuery`] or [`cuStreamWaitEvent`] will then examine or wait for completion of the work that was captured. Uses of hStream after this call do not modify hEvent. See note on default stream behavior for what is captured in the default case.
14265 ///
14266 /// [`cuEventRecordWithFlags`] can be called multiple times on the same event and will overwrite the previously captured state. Other APIs such as [`cuStreamWaitEvent`] use the most recently captured state at the time of the API call, and are not affected by later calls to [`cuEventRecordWithFlags`]. Before the first call to [`cuEventRecordWithFlags`], an event represents an empty set of work, so for example [`cuEventQuery`] would return [`cudaError_enum::CUDA_SUCCESS`].
14267 ///
14268 /// flags include:
14269 ///
14270 /// * [`CUevent_record_flags_enum::CU_EVENT_RECORD_DEFAULT`]: Default event creation flag.
14271 /// * [`CUevent_record_flags_enum::CU_EVENT_RECORD_EXTERNAL`]: Event is captured in the graph as an external event node when performing stream capture. This flag is invalid outside of
14272 /// stream capture.
14273 ///
14274 /// Note:
14275 ///
14276 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
14277 /// * Note that this function may also return error codes from previous, asynchronous launches.
14278 ///
14279 /// **See also:**
14280 ///
14281 /// [`cuEventCreate`], [`cuEventQuery`], [`cuEventSynchronize`], [`cuStreamWaitEvent`], [`cuEventDestroy_v2`], [`cuEventElapsedTime_v2`], [`cuEventRecord`], [cudaEventRecord](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__EVENT.html#group__CUDART__EVENT_1gf4fcb74343aa689f4159791967868446).
14282 ///
14283 /// # Parameters
14284 ///
14285 /// - `hEvent`: Event to record.
14286 /// - `hStream`: Stream to record event for.
14287 /// - `flags`: See CUevent_capture_flags.
14288 pub fn cuEventRecordWithFlags(
14289 hEvent: CUevent,
14290 hStream: CUstream,
14291 flags: ::core::ffi::c_uint,
14292 ) -> CUresult;
14293}
14294unsafe extern "C" {
14295 /// Queries an event's status.
14296 ///
14297 /// Queries the status of all work currently captured by hEvent. See [`cuEventRecord`] for details on what is captured by an event.
14298 ///
14299 /// Returns [`cudaError_enum::CUDA_SUCCESS`] if all captured work has been completed, or [`cudaError_enum::CUDA_ERROR_NOT_READY`] if any captured work is incomplete.
14300 ///
14301 /// For the purposes of Unified Memory, a return value of [`cudaError_enum::CUDA_SUCCESS`] is equivalent to having called [`cuEventSynchronize`].
14302 ///
14303 /// Note:
14304 ///
14305 /// Note that this function may also return error codes from previous, asynchronous launches.
14306 ///
14307 /// **See also:**
14308 ///
14309 /// [`cuEventCreate`], [`cuEventRecord`], [`cuEventSynchronize`], [`cuEventDestroy_v2`], [`cuEventElapsedTime_v2`], [cudaEventQuery](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__EVENT.html#group__CUDART__EVENT_1g2bf738909b4a059023537eaa29d8a5b7).
14310 ///
14311 /// # Parameters
14312 ///
14313 /// - `hEvent`: Event to query.
14314 pub fn cuEventQuery(hEvent: CUevent) -> CUresult;
14315}
14316unsafe extern "C" {
14317 /// Waits for an event to complete.
14318 ///
14319 /// Waits until the completion of all work currently captured in hEvent. See [`cuEventRecord`] for details on what is captured by an event.
14320 ///
14321 /// Waiting for an event that was created with the [`CUevent_flags_enum::CU_EVENT_BLOCKING_SYNC`] flag will cause the calling CPU thread to block until the event has been completed by the device. If the [`CUevent_flags_enum::CU_EVENT_BLOCKING_SYNC`] flag has not been set, then the CPU thread will busy-wait until the event has been completed by the device.
14322 ///
14323 /// Note:
14324 ///
14325 /// Note that this function may also return error codes from previous, asynchronous launches.
14326 ///
14327 /// **See also:**
14328 ///
14329 /// [`cuEventCreate`], [`cuEventRecord`], [`cuEventQuery`], [`cuEventDestroy_v2`], [`cuEventElapsedTime_v2`], [cudaEventSynchronize](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__EVENT.html#group__CUDART__EVENT_1g949aa42b30ae9e622f6ba0787129ff22).
14330 ///
14331 /// # Parameters
14332 ///
14333 /// - `hEvent`: Event to wait for.
14334 pub fn cuEventSynchronize(hEvent: CUevent) -> CUresult;
14335}
14336unsafe extern "C" {
14337 /// Destroys an event.
14338 ///
14339 /// Destroys the event specified by hEvent.
14340 ///
14341 /// An event may be destroyed before it is complete (i.e., while [`cuEventQuery`] would return [`cudaError_enum::CUDA_ERROR_NOT_READY`]). In this case, the call does not block on completion of the event, and any associated resources will automatically be released
14342 /// asynchronously at completion.
14343 ///
14344 /// Note:
14345 ///
14346 /// Note that this function may also return error codes from previous, asynchronous launches.
14347 ///
14348 /// **See also:**
14349 ///
14350 /// [`cuEventCreate`], [`cuEventRecord`], [`cuEventQuery`], [`cuEventSynchronize`], [`cuEventElapsedTime_v2`], [cudaEventDestroy](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__EVENT.html#group__CUDART__EVENT_1g2cb6baa0830a1cd0bd957bfd8705045b).
14351 ///
14352 /// # Parameters
14353 ///
14354 /// - `hEvent`: Event to destroy.
14355 pub fn cuEventDestroy_v2(hEvent: CUevent) -> CUresult;
14356}
14357unsafe extern "C" {
14358 /// Computes the elapsed time between two events.
14359 ///
14360 /// Computes the elapsed time between two events (in milliseconds with a resolution of around 0.5 microseconds). Note this API
14361 /// is not guaranteed to return the latest errors for pending work. As such this API is intended to serve as an elapsed time calculation
14362 /// only and any polling for completion on the events to be compared should be done with [`cuEventQuery`] instead.
14363 ///
14364 /// If either event was last recorded in a non-NULL stream, the resulting time may be greater than expected (even if both used
14365 /// the same stream handle). This happens because the [`cuEventRecord`] operation takes place asynchronously and there is no guarantee that the measured latency is actually just between the two
14366 /// events. Any number of other different stream operations could execute in between the two measured events, thus altering the
14367 /// timing in a significant way.
14368 ///
14369 /// If [`cuEventRecord`] has not been called on either event then [`cudaError_enum::CUDA_ERROR_INVALID_HANDLE`] is returned. If [`cuEventRecord`] has been called on both events but one or both of them has not yet been completed (that is, [`cuEventQuery`] would return [`cudaError_enum::CUDA_ERROR_NOT_READY`] on at least one of the events), [`cudaError_enum::CUDA_ERROR_NOT_READY`] is returned. If either event was created with the [`CUevent_flags_enum::CU_EVENT_DISABLE_TIMING`] flag, then this function will return [`cudaError_enum::CUDA_ERROR_INVALID_HANDLE`].
14370 ///
14371 /// Note:
14372 ///
14373 /// Note that this function may also return error codes from previous, asynchronous launches.
14374 ///
14375 /// **See also:**
14376 ///
14377 /// [`cuEventCreate`], [`cuEventRecord`], [`cuEventQuery`], [`cuEventSynchronize`], [`cuEventDestroy_v2`], [cudaEventElapsedTime](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__EVENT.html#group__CUDART__EVENT_1g40159125411db92c835edb46a0989cd6).
14378 ///
14379 /// # Parameters
14380 ///
14381 /// - `pMilliseconds`: Time between hStart and hEnd in ms.
14382 /// - `hStart`: Starting event.
14383 /// - `hEnd`: Ending event.
14384 pub fn cuEventElapsedTime_v2(
14385 pMilliseconds: *mut f32,
14386 hStart: CUevent,
14387 hEnd: CUevent,
14388 ) -> CUresult;
14389}
14390unsafe extern "C" {
14391 /// Imports an external memory object.
14392 ///
14393 /// Imports an externally allocated memory object and returns a handle to that in extMem_out.
14394 ///
14395 /// The properties of the handle being imported must be described in memHandleDesc. The CUDA_EXTERNAL_MEMORY_HANDLE_DESC structure is defined as follows:
14396 ///
14397 /// ```text
14398 /// typedef struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st {
14399 /// CUexternalMemoryHandleType type;
14400 /// union {
14401 /// int fd;
14402 /// struct {
14403 /// void *handle;
14404 /// const void *name;
14405 /// } win32;
14406 /// const void *nvSciBufObject;
14407 /// } handle;
14408 /// unsigned long long size;
14409 /// unsigned int flags;
14410 /// } CUDA_EXTERNAL_MEMORY_HANDLE_DESC;
14411 /// ```
14412 ///
14413 /// where [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1_1d4e3663348d28278d066980b422ab70e) specifies the type of handle being imported. `CUexternalMemoryHandleType` is defined as:
14414 ///
14415 /// ```text
14416 /// typedef enum CUexternalMemoryHandleType_enum {
14417 /// CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD = 1,
14418 /// CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32 = 2,
14419 /// CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3,
14420 /// CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP = 4,
14421 /// CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE = 5,
14422 /// CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE = 6,
14423 /// CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT = 7,
14424 /// CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF = 8,
14425 /// CU_EXTERNAL_MEMORY_HANDLE_TYPE_DMABUF_FD = 9
14426 /// } CUexternalMemoryHandleType;
14427 /// ```
14428 ///
14429 /// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1_1d4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD`], then CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::fd must be a valid file descriptor referencing a memory object. Ownership
14430 /// of the file descriptor is transferred to the CUDA driver when the handle is imported successfully. Performing any operations
14431 /// on the file descriptor after it is imported results in undefined behavior.
14432 ///
14433 /// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1_1d4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32`], then exactly one of CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle and CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name
14434 /// must not be NULL. If CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle is not NULL, then it must represent a valid shared
14435 /// NT handle that references a memory object. Ownership of this handle is not transferred to CUDA after the import operation,
14436 /// so the application must release the handle using the appropriate system call. If CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name
14437 /// is not NULL, then it must point to a NULL-terminated array of UTF-16 characters that refers to a memory object.
14438 ///
14439 /// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1_1d4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT`], then CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle must be non-NULL and CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name
14440 /// must be NULL. The handle specified must be a globally shared KMT handle. This handle does not hold a reference to the underlying
14441 /// object, and thus will be invalid when all references to the memory object are destroyed.
14442 ///
14443 /// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1_1d4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP`], then exactly one of CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle and CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name
14444 /// must not be NULL. If CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle is not NULL, then it must represent a valid shared
14445 /// NT handle that is returned by ID3D12Device::CreateSharedHandle when referring to a ID3D12Heap object. This handle holds a
14446 /// reference to the underlying object. If CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name is not NULL, then it must point
14447 /// to a NULL-terminated array of UTF-16 characters that refers to a ID3D12Heap object.
14448 ///
14449 /// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1_1d4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE`], then exactly one of CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle and CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name
14450 /// must not be NULL. If CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle is not NULL, then it must represent a valid shared
14451 /// NT handle that is returned by ID3D12Device::CreateSharedHandle when referring to a ID3D12Resource object. This handle holds
14452 /// a reference to the underlying object. If CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name is not NULL, then it must point
14453 /// to a NULL-terminated array of UTF-16 characters that refers to a ID3D12Resource object.
14454 ///
14455 /// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1_1d4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE`], then CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle must represent a valid shared NT handle that is returned by
14456 /// IDXGIResource1::CreateSharedHandle when referring to a ID3D11Resource object. If CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name
14457 /// is not NULL, then it must point to a NULL-terminated array of UTF-16 characters that refers to a ID3D11Resource object.
14458 ///
14459 /// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1_1d4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT`], then CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle must represent a valid shared KMT handle that is returned by
14460 /// IDXGIResource::GetSharedHandle when referring to a ID3D11Resource object and CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name
14461 /// must be NULL.
14462 ///
14463 /// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1_1d4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF`], then CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::nvSciBufObject must be non-NULL and reference a valid NvSciBuf object. If
14464 /// the NvSciBuf object imported into CUDA is also mapped by other drivers, then the application must use [`cuWaitExternalSemaphoresAsync`] or [`cuSignalExternalSemaphoresAsync`] as appropriate barriers to maintain coherence between CUDA and the other drivers. See [`CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC`] and [`CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC`] for memory synchronization.
14465 ///
14466 /// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1_1d4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_DMABUF_FD`], then CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::fd must be a valid file descriptor referencing a dma_buf object and [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::flags](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1_144d7c253f6b6f34e46b8726496e425c9) must be zero. Importing a dma_buf object is supported only on Tegra Jetson platform starting with Thor series. Mapping an
14467 /// imported dma_buf object as CUDA mipmapped array using [`cuExternalMemoryGetMappedMipmappedArray`] is not supported.
14468 ///
14469 /// The size of the memory object must be specified in [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::size](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1_136570cee9bbfa12b3f34d0d1d98029ce).
14470 ///
14471 /// Specifying the flag [`CUDA_EXTERNAL_MEMORY_DEDICATED`] in [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::flags](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1_144d7c253f6b6f34e46b8726496e425c9) indicates that the resource is a dedicated resource. The definition of what a dedicated resource is outside the scope of
14472 /// this extension. This flag must be set if [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1_1d4e3663348d28278d066980b422ab70e) is one of the following: [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE`][`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE`][`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT`]
14473 ///
14474 /// Note:
14475 ///
14476 /// * Note that this function may also return error codes from previous, asynchronous launches.
14477 /// * If the Vulkan memory imported into CUDA is mapped on the CPU then the application must use vkInvalidateMappedMemoryRanges/vkFlushMappedMemoryRanges
14478 /// as well as appropriate Vulkan pipeline barriers to maintain coherence between CPU and GPU. For more information on these APIs,
14479 /// please refer to "Synchronization and Cache Control" chapter from Vulkan specification.
14480 ///
14481 /// **See also:**
14482 ///
14483 /// [`cuDestroyExternalMemory`], [`cuExternalMemoryGetMappedBuffer`], [`cuExternalMemoryGetMappedMipmappedArray`].
14484 ///
14485 /// # Parameters
14486 ///
14487 /// - `extMem_out`: Returned handle to an external memory object.
14488 /// - `memHandleDesc`: Memory import handle descriptor.
14489 pub fn cuImportExternalMemory(
14490 extMem_out: *mut CUexternalMemory,
14491 memHandleDesc: *const CUDA_EXTERNAL_MEMORY_HANDLE_DESC,
14492 ) -> CUresult;
14493}
14494unsafe extern "C" {
14495 /// Maps a buffer onto an imported memory object.
14496 ///
14497 /// Maps a buffer onto an imported memory object and returns a device pointer in devPtr.
14498 ///
14499 /// The properties of the buffer being mapped must be described in bufferDesc. The CUDA_EXTERNAL_MEMORY_BUFFER_DESC structure is defined as follows:
14500 ///
14501 /// ```text
14502 /// typedef struct CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st {
14503 /// unsigned long long offset;
14504 /// unsigned long long size;
14505 /// unsigned int flags;
14506 /// } CUDA_EXTERNAL_MEMORY_BUFFER_DESC;
14507 /// ```
14508 ///
14509 /// where [CUDA_EXTERNAL_MEMORY_BUFFER_DESC::offset](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__BUFFER__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__BUFFER__DESC__v1_1734130661fb389658d29d10ed6cf41cd) is the offset in the memory object where the buffer's base address is. [CUDA_EXTERNAL_MEMORY_BUFFER_DESC::size](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__BUFFER__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__BUFFER__DESC__v1_1b736c75bec5e1461f565e95500c8227f) is the size of the buffer. [CUDA_EXTERNAL_MEMORY_BUFFER_DESC::flags](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__BUFFER__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__BUFFER__DESC__v1_186aad4fc1ddac67d953daddec0a5c94a) must be zero.
14510 ///
14511 /// The offset and size have to be suitably aligned to match the requirements of the external API. Mapping two buffers whose ranges
14512 /// overlap may or may not result in the same virtual address being returned for the overlapped portion. In such cases, the application
14513 /// must ensure that all accesses to that region from the GPU are volatile. Otherwise writes made via one address are not guaranteed
14514 /// to be visible via the other address, even if they're issued by the same thread. It is recommended that applications map the
14515 /// combined range instead of mapping separate buffers and then apply the appropriate offsets to the returned pointer to derive
14516 /// the individual buffers.
14517 ///
14518 /// The returned pointer devPtr must be freed using [`cuMemFree_v2`].
14519 ///
14520 /// Note:
14521 ///
14522 /// Note that this function may also return error codes from previous, asynchronous launches.
14523 ///
14524 /// **See also:**
14525 ///
14526 /// [`cuImportExternalMemory`], [`cuDestroyExternalMemory`], [`cuExternalMemoryGetMappedMipmappedArray`].
14527 ///
14528 /// # Parameters
14529 ///
14530 /// - `devPtr`: Returned device pointer to buffer.
14531 /// - `extMem`: Handle to external memory object.
14532 /// - `bufferDesc`: Buffer descriptor.
14533 pub fn cuExternalMemoryGetMappedBuffer(
14534 devPtr: *mut CUdeviceptr,
14535 extMem: CUexternalMemory,
14536 bufferDesc: *const CUDA_EXTERNAL_MEMORY_BUFFER_DESC,
14537 ) -> CUresult;
14538}
14539unsafe extern "C" {
14540 /// Maps a CUDA mipmapped array onto an external memory object.
14541 ///
14542 /// Maps a CUDA mipmapped array onto an external object and returns a handle to it in mipmap.
14543 ///
14544 /// The properties of the CUDA mipmapped array being mapped must be described in mipmapDesc. The structure CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC is defined as follows:
14545 ///
14546 /// ```text
14547 /// typedef struct CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st {
14548 /// unsigned long long offset;
14549 /// CUDA_ARRAY3D_DESCRIPTOR arrayDesc;
14550 /// unsigned int numLevels;
14551 /// } CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC;
14552 /// ```
14553 ///
14554 /// where [CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC::offset](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__MIPMAPPED__ARRAY__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__MIPMAPPED__ARRAY__DESC__v1_1c4a2c246eab269279434d8153d6e15aa) is the offset in the memory object where the base level of the mipmap chain is. [CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC::arrayDesc](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__MIPMAPPED__ARRAY__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__MIPMAPPED__ARRAY__DESC__v1_17c3e0998380d9922a9fcddadeecd186d) describes the format, dimensions and type of the base level of the mipmap chain. For further details on these parameters,
14555 /// please refer to the documentation for [`cuMipmappedArrayCreate`]. Note that if the mipmapped array is bound as a color target in the graphics API, then the flag [`CUDA_ARRAY3D_COLOR_ATTACHMENT`] must be specified in CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC::arrayDesc::Flags. [CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC::numLevels](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__MIPMAPPED__ARRAY__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__MIPMAPPED__ARRAY__DESC__v1_1938185e3178ee0fb5920ac104035b321) specifies the total number of levels in the mipmap chain.
14556 ///
14557 /// If extMem was imported from a handle of type [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF`], then [CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC::numLevels](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__MEMORY__MIPMAPPED__ARRAY__DESC__v1.html#structCUDA__EXTERNAL__MEMORY__MIPMAPPED__ARRAY__DESC__v1_1938185e3178ee0fb5920ac104035b321) must be equal to 1.
14558 ///
14559 /// Mapping extMem imported from a handle of type [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_DMABUF_FD`], is not supported.
14560 ///
14561 /// The returned CUDA mipmapped array must be freed using [`cuMipmappedArrayDestroy`].
14562 ///
14563 /// Note:
14564 ///
14565 /// Note that this function may also return error codes from previous, asynchronous launches.
14566 ///
14567 /// **See also:**
14568 ///
14569 /// [`cuImportExternalMemory`], [`cuDestroyExternalMemory`], [`cuExternalMemoryGetMappedBuffer`].
14570 ///
14571 /// # Parameters
14572 ///
14573 /// - `mipmap`: Returned CUDA mipmapped array.
14574 /// - `extMem`: Handle to external memory object.
14575 /// - `mipmapDesc`: CUDA array descriptor.
14576 pub fn cuExternalMemoryGetMappedMipmappedArray(
14577 mipmap: *mut CUmipmappedArray,
14578 extMem: CUexternalMemory,
14579 mipmapDesc: *const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC,
14580 ) -> CUresult;
14581}
14582unsafe extern "C" {
14583 /// Destroys an external memory object.
14584 ///
14585 /// Destroys the specified external memory object. Any existing buffers and CUDA mipmapped arrays mapped onto this object must
14586 /// no longer be used and must be explicitly freed using [`cuMemFree_v2`] and [`cuMipmappedArrayDestroy`] respectively.
14587 ///
14588 /// Note:
14589 ///
14590 /// Note that this function may also return error codes from previous, asynchronous launches.
14591 ///
14592 /// **See also:**
14593 ///
14594 /// [`cuImportExternalMemory`], [`cuExternalMemoryGetMappedBuffer`], [`cuExternalMemoryGetMappedMipmappedArray`].
14595 ///
14596 /// # Parameters
14597 ///
14598 /// - `extMem`: External memory object to be destroyed.
14599 pub fn cuDestroyExternalMemory(extMem: CUexternalMemory) -> CUresult;
14600}
14601unsafe extern "C" {
14602 /// Imports an external semaphore.
14603 ///
14604 /// Imports an externally allocated synchronization object and returns a handle to that in extSem_out.
14605 ///
14606 /// The properties of the handle being imported must be described in semHandleDesc. The CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC is defined as follows:
14607 ///
14608 /// ```text
14609 /// typedef struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st {
14610 /// CUexternalSemaphoreHandleType type;
14611 /// union {
14612 /// int fd;
14613 /// struct {
14614 /// void *handle;
14615 /// const void *name;
14616 /// } win32;
14617 /// const void* NvSciSyncObj;
14618 /// } handle;
14619 /// unsigned int flags;
14620 /// } CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC;
14621 /// ```
14622 ///
14623 /// where [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1_1cf32b96f55beec6f904b2455effed87d) specifies the type of handle being imported. `CUexternalSemaphoreHandleType` is defined as:
14624 ///
14625 /// ```text
14626 /// typedef enum CUexternalSemaphoreHandleType_enum {
14627 /// CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD = 1,
14628 /// CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32 = 2,
14629 /// CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3,
14630 /// CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE = 4,
14631 /// CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE = 5,
14632 /// CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC = 6,
14633 /// CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX = 7,
14634 /// CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT = 8,
14635 /// CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD = 9,
14636 /// CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 = 10
14637 /// } CUexternalSemaphoreHandleType;
14638 /// ```
14639 ///
14640 /// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1_1cf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD`], then CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::fd must be a valid file descriptor referencing a synchronization object.
14641 /// Ownership of the file descriptor is transferred to the CUDA driver when the handle is imported successfully. Performing any
14642 /// operations on the file descriptor after it is imported results in undefined behavior.
14643 ///
14644 /// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1_1cf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32`], then exactly one of CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle and CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name
14645 /// must not be NULL. If CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle is not NULL, then it must represent a valid
14646 /// shared NT handle that references a synchronization object. Ownership of this handle is not transferred to CUDA after the import
14647 /// operation, so the application must release the handle using the appropriate system call. If CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name
14648 /// is not NULL, then it must name a valid synchronization object.
14649 ///
14650 /// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1_1cf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT`], then CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle must be non-NULL and CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name
14651 /// must be NULL. The handle specified must be a globally shared KMT handle. This handle does not hold a reference to the underlying
14652 /// object, and thus will be invalid when all references to the synchronization object are destroyed.
14653 ///
14654 /// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1_1cf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE`], then exactly one of CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle and CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name
14655 /// must not be NULL. If CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle is not NULL, then it must represent a valid
14656 /// shared NT handle that is returned by ID3D12Device::CreateSharedHandle when referring to a ID3D12Fence object. This handle
14657 /// holds a reference to the underlying object. If CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name is not NULL, then
14658 /// it must name a valid synchronization object that refers to a valid ID3D12Fence object.
14659 ///
14660 /// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1_1cf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE`], then CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle represents a valid shared NT handle that is returned by
14661 /// ID3D11Fence::CreateSharedHandle. If CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name is not NULL, then it must name
14662 /// a valid synchronization object that refers to a valid ID3D11Fence object.
14663 ///
14664 /// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1_1cf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC`], then CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::nvSciSyncObj represents a valid NvSciSyncObj.
14665 ///
14666 /// [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX`], then CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle represents a valid shared NT handle that is returned by
14667 /// IDXGIResource1::CreateSharedHandle when referring to a IDXGIKeyedMutex object. If CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name
14668 /// is not NULL, then it must name a valid synchronization object that refers to a valid IDXGIKeyedMutex object.
14669 ///
14670 /// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1_1cf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT`], then CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle represents a valid shared KMT handle that is returned by
14671 /// IDXGIResource::GetSharedHandle when referring to a IDXGIKeyedMutex object and CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name
14672 /// must be NULL.
14673 ///
14674 /// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1_1cf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD`], then CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::fd must be a valid file descriptor referencing a synchronization object.
14675 /// Ownership of the file descriptor is transferred to the CUDA driver when the handle is imported successfully. Performing any
14676 /// operations on the file descriptor after it is imported results in undefined behavior.
14677 ///
14678 /// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1_1cf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32`], then exactly one of CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle and CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name
14679 /// must not be NULL. If CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle is not NULL, then it must represent a valid
14680 /// shared NT handle that references a synchronization object. Ownership of this handle is not transferred to CUDA after the import
14681 /// operation, so the application must release the handle using the appropriate system call. If CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name
14682 /// is not NULL, then it must name a valid synchronization object.
14683 ///
14684 /// Note:
14685 ///
14686 /// Note that this function may also return error codes from previous, asynchronous launches.
14687 ///
14688 /// **See also:**
14689 ///
14690 /// [`cuDestroyExternalSemaphore`], [`cuSignalExternalSemaphoresAsync`], [`cuWaitExternalSemaphoresAsync`].
14691 ///
14692 /// # Parameters
14693 ///
14694 /// - `extSem_out`: Returned handle to an external semaphore.
14695 /// - `semHandleDesc`: Semaphore import handle descriptor.
14696 pub fn cuImportExternalSemaphore(
14697 extSem_out: *mut CUexternalSemaphore,
14698 semHandleDesc: *const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC,
14699 ) -> CUresult;
14700}
14701unsafe extern "C" {
14702 /// Signals a set of external semaphore objects.
14703 ///
14704 /// Enqueues a signal operation on a set of externally allocated semaphore object in the specified stream. The operations will
14705 /// be executed when all prior operations in the stream complete.
14706 ///
14707 /// The exact semantics of signaling a semaphore depends on the type of the object.
14708 ///
14709 /// If the semaphore object is any one of the following types: [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD`], [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32`], [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT`] then signaling the semaphore will set it to the signaled state.
14710 ///
14711 /// If the semaphore object is any one of the following types: [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE`], [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE`], [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD`], [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32`] then the semaphore will be set to the value specified in CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS::params::fence::value.
14712 ///
14713 /// If the semaphore object is of the type [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC`] this API sets CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS::params::nvSciSync::fence to a value that can be used by subsequent waiters
14714 /// of the same NvSciSync object to order operations with those currently submitted in stream. Such an update will overwrite previous contents of CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS::params::nvSciSync::fence. By default,
14715 /// signaling such an external semaphore object causes appropriate memory synchronization operations to be performed over all
14716 /// external memory objects that are imported as [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF`]. This ensures that any subsequent accesses made by other importers of the same set of NvSciBuf memory object(s) are coherent.
14717 /// These operations can be skipped by specifying the flag [`CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC`], which can be used as a performance optimization when data coherency is not required. But specifying this flag in scenarios
14718 /// where data coherency is required results in undefined behavior. Also, for semaphore object of the type [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC`], if the NvSciSyncAttrList used to create the NvSciSyncObj had not set the flags in [`cuDeviceGetNvSciSyncAttributes`] to CUDA_NVSCISYNC_ATTR_SIGNAL, this API will return [`CUresult::CUDA_ERROR_NOT_SUPPORTED`]. NvSciSyncFence associated with semaphore object
14719 /// of the type [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC`] can be deterministic. For this the NvSciSyncAttrList used to create the semaphore object must have value of NvSciSyncAttrKey_RequireDeterministicFences
14720 /// key set to true. Deterministic fences allow users to enqueue a wait over the semaphore object even before corresponding signal
14721 /// is enqueued. For such a semaphore object, CUDA guarantees that each signal operation will increment the fence value by '1'.
14722 /// Users are expected to track count of signals enqueued on the semaphore object and insert waits accordingly. When such a semaphore
14723 /// object is signaled from multiple streams, due to concurrent stream execution, it is possible that the order in which the semaphore
14724 /// gets signaled is indeterministic. This could lead to waiters of the semaphore getting unblocked incorrectly. Users are expected
14725 /// to handle such situations, either by not using the same semaphore object with deterministic fence support enabled in different
14726 /// streams or by adding explicit dependency amongst such streams so that the semaphore is signaled in order. NvSciSyncFence associated
14727 /// with semaphore object of the type [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC`] can be timestamp enabled. For this the NvSciSyncAttrList used to create the object must have the value of NvSciSyncAttrKey_WaiterRequireTimestamps
14728 /// key set to true. Timestamps are emitted asynchronously by the GPU and CUDA saves the GPU timestamp in the corresponding NvSciSyncFence
14729 /// at the time of signal on GPU. Users are expected to convert GPU clocks to CPU clocks using appropriate scaling functions.
14730 /// Users are expected to wait for the completion of the fence before extracting timestamp using appropriate NvSciSync APIs. Users
14731 /// are expected to ensure that there is only one outstanding timestamp enabled fence per CUDA-NvSciSync object at any point of
14732 /// time, failing which leads to undefined behavior. Extracting the timestamp before the corresponding fence is signalled could
14733 /// lead to undefined behavior. Timestamp extracted via appropriate NvSciSync API would be in microseconds.
14734 ///
14735 /// If the semaphore object is any one of the following types: [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX`], [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT`] then the keyed mutex will be released with the key specified in CUDA_EXTERNAL_SEMAPHORE_PARAMS::params::keyedmutex::key.
14736 ///
14737 /// Note:
14738 ///
14739 /// Note that this function may also return error codes from previous, asynchronous launches.
14740 ///
14741 /// **See also:**
14742 ///
14743 /// [`cuImportExternalSemaphore`], [`cuDestroyExternalSemaphore`], [`cuWaitExternalSemaphoresAsync`].
14744 ///
14745 /// # Parameters
14746 ///
14747 /// - `extSemArray`: Set of external semaphores to be signaled.
14748 /// - `paramsArray`: Array of semaphore parameters.
14749 /// - `numExtSems`: Number of semaphores to signal.
14750 /// - `stream`: Stream to enqueue the signal operations in.
14751 pub fn cuSignalExternalSemaphoresAsync(
14752 extSemArray: *const CUexternalSemaphore,
14753 paramsArray: *const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS,
14754 numExtSems: ::core::ffi::c_uint,
14755 stream: CUstream,
14756 ) -> CUresult;
14757}
14758unsafe extern "C" {
14759 /// Waits on a set of external semaphore objects.
14760 ///
14761 /// Enqueues a wait operation on a set of externally allocated semaphore object in the specified stream. The operations will be
14762 /// executed when all prior operations in the stream complete.
14763 ///
14764 /// The exact semantics of waiting on a semaphore depends on the type of the object.
14765 ///
14766 /// If the semaphore object is any one of the following types: [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD`], [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32`], [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT`] then waiting on the semaphore will wait until the semaphore reaches the signaled state. The semaphore will then be reset
14767 /// to the unsignaled state. Therefore for every signal operation, there can only be one wait operation.
14768 ///
14769 /// If the semaphore object is any one of the following types: [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE`], [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE`], [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD`], [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32`] then waiting on the semaphore will wait until the value of the semaphore is greater than or equal to CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS::params::fence::value.
14770 ///
14771 /// If the semaphore object is of the type [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC`] then, waiting on the semaphore will wait until the CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS::params::nvSciSync::fence is signaled
14772 /// by the signaler of the NvSciSyncObj that was associated with this semaphore object. By default, waiting on such an external
14773 /// semaphore object causes appropriate memory synchronization operations to be performed over all external memory objects that
14774 /// are imported as [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF`]. This ensures that any subsequent accesses made by other importers of the same set of NvSciBuf memory object(s) are coherent.
14775 /// These operations can be skipped by specifying the flag [`CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC`], which can be used as a performance optimization when data coherency is not required. But specifying this flag in scenarios
14776 /// where data coherency is required results in undefined behavior. Also, for semaphore object of the type [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC`], if the NvSciSyncAttrList used to create the NvSciSyncObj had not set the flags in [`cuDeviceGetNvSciSyncAttributes`] to CUDA_NVSCISYNC_ATTR_WAIT, this API will return [`CUresult::CUDA_ERROR_NOT_SUPPORTED`].
14777 ///
14778 /// If the semaphore object is any one of the following types: [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX`], [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT`] then the keyed mutex will be acquired when it is released with the key specified in CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS::params::keyedmutex::key
14779 /// or until the timeout specified by CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS::params::keyedmutex::timeoutMs has lapsed. The timeout
14780 /// interval can either be a finite value specified in milliseconds or an infinite value. In case an infinite value is specified
14781 /// the timeout never elapses. The windows INFINITE macro must be used to specify infinite timeout.
14782 ///
14783 /// Note:
14784 ///
14785 /// Note that this function may also return error codes from previous, asynchronous launches.
14786 ///
14787 /// **See also:**
14788 ///
14789 /// [`cuImportExternalSemaphore`], [`cuDestroyExternalSemaphore`], [`cuSignalExternalSemaphoresAsync`].
14790 ///
14791 /// # Parameters
14792 ///
14793 /// - `extSemArray`: External semaphores to be waited on.
14794 /// - `paramsArray`: Array of semaphore parameters.
14795 /// - `numExtSems`: Number of semaphores to wait on.
14796 /// - `stream`: Stream to enqueue the wait operations in.
14797 pub fn cuWaitExternalSemaphoresAsync(
14798 extSemArray: *const CUexternalSemaphore,
14799 paramsArray: *const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS,
14800 numExtSems: ::core::ffi::c_uint,
14801 stream: CUstream,
14802 ) -> CUresult;
14803}
14804unsafe extern "C" {
14805 /// Destroys an external semaphore.
14806 ///
14807 /// Destroys an external semaphore object and releases any references to the underlying resource. Any outstanding signals or waits
14808 /// must have completed before the semaphore is destroyed.
14809 ///
14810 /// Note:
14811 ///
14812 /// Note that this function may also return error codes from previous, asynchronous launches.
14813 ///
14814 /// **See also:**
14815 ///
14816 /// [`cuImportExternalSemaphore`], [`cuSignalExternalSemaphoresAsync`], [`cuWaitExternalSemaphoresAsync`].
14817 ///
14818 /// # Parameters
14819 ///
14820 /// - `extSem`: External semaphore to be destroyed.
14821 pub fn cuDestroyExternalSemaphore(extSem: CUexternalSemaphore) -> CUresult;
14822}
14823unsafe extern "C" {
14824 /// Wait on a memory location.
14825 ///
14826 /// Enqueues a synchronization of the stream on the given memory location. Work ordered after the operation will block until the
14827 /// given condition on the memory is satisfied. By default, the condition is to wait for (int32_t)(\*addr - value) >= 0, a cyclic
14828 /// greater-or-equal. Other condition types can be specified via flags.
14829 ///
14830 /// If the memory was registered via [`cuMemHostRegister_v2`], the device pointer should be obtained with [`cuMemHostGetDevicePointer_v2`]. This function cannot be used with managed memory ([`cuMemAllocManaged`]).
14831 ///
14832 /// Support for [`CUstreamWaitValue_flags::CU_STREAM_WAIT_VALUE_NOR`] can be queried with [`cuDeviceGetAttribute`] and CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR_V2.
14833 ///
14834 /// Note:
14835 ///
14836 /// Warning: Improper use of this API may deadlock the application. Synchronization ordering established through this API is not
14837 /// visible to CUDA. CUDA tasks that are (even indirectly) ordered by this API should also have that order expressed with CUDA-visible
14838 /// dependencies such as events. This ensures that the scheduler does not serialize them in an improper order.
14839 ///
14840 /// Note:
14841 ///
14842 /// Note that this function may also return error codes from previous, asynchronous launches.
14843 ///
14844 /// **See also:**
14845 ///
14846 /// [`cuStreamWaitValue64_v2`], [`cuStreamWriteValue32_v2`], [`cuStreamWriteValue64_v2`], [`cuStreamBatchMemOp_v2`], [`cuMemHostRegister_v2`], [`cuStreamWaitEvent`].
14847 ///
14848 /// # Parameters
14849 ///
14850 /// - `stream`: The stream to synchronize on the memory location.
14851 /// - `addr`: The memory location to wait on.
14852 /// - `value`: The value to compare with the memory location.
14853 /// - `flags`: See `CUstreamWaitValue_flags`.
14854 pub fn cuStreamWaitValue32_v2(
14855 stream: CUstream,
14856 addr: CUdeviceptr,
14857 value: cuuint32_t,
14858 flags: ::core::ffi::c_uint,
14859 ) -> CUresult;
14860}
14861unsafe extern "C" {
14862 /// Wait on a memory location.
14863 ///
14864 /// Enqueues a synchronization of the stream on the given memory location. Work ordered after the operation will block until the
14865 /// given condition on the memory is satisfied. By default, the condition is to wait for (int64_t)(\*addr - value) >= 0, a cyclic
14866 /// greater-or-equal. Other condition types can be specified via flags.
14867 ///
14868 /// If the memory was registered via [`cuMemHostRegister_v2`], the device pointer should be obtained with [`cuMemHostGetDevicePointer_v2`].
14869 ///
14870 /// Support for this can be queried with [`cuDeviceGetAttribute`] and [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS`].
14871 ///
14872 /// Note:
14873 ///
14874 /// Warning: Improper use of this API may deadlock the application. Synchronization ordering established through this API is not
14875 /// visible to CUDA. CUDA tasks that are (even indirectly) ordered by this API should also have that order expressed with CUDA-visible
14876 /// dependencies such as events. This ensures that the scheduler does not serialize them in an improper order.
14877 ///
14878 /// Note:
14879 ///
14880 /// Note that this function may also return error codes from previous, asynchronous launches.
14881 ///
14882 /// **See also:**
14883 ///
14884 /// [`cuStreamWaitValue32_v2`], [`cuStreamWriteValue32_v2`], [`cuStreamWriteValue64_v2`], [`cuStreamBatchMemOp_v2`], [`cuMemHostRegister_v2`], [`cuStreamWaitEvent`].
14885 ///
14886 /// # Parameters
14887 ///
14888 /// - `stream`: The stream to synchronize on the memory location.
14889 /// - `addr`: The memory location to wait on.
14890 /// - `value`: The value to compare with the memory location.
14891 /// - `flags`: See `CUstreamWaitValue_flags`.
14892 pub fn cuStreamWaitValue64_v2(
14893 stream: CUstream,
14894 addr: CUdeviceptr,
14895 value: cuuint64_t,
14896 flags: ::core::ffi::c_uint,
14897 ) -> CUresult;
14898}
14899unsafe extern "C" {
14900 /// Write a value to memory.
14901 ///
14902 /// Write a value to memory.
14903 ///
14904 /// If the memory was registered via [`cuMemHostRegister_v2`], the device pointer should be obtained with [`cuMemHostGetDevicePointer_v2`]. This function cannot be used with managed memory ([`cuMemAllocManaged`]).
14905 ///
14906 /// Note:
14907 ///
14908 /// Note that this function may also return error codes from previous, asynchronous launches.
14909 ///
14910 /// **See also:**
14911 ///
14912 /// [`cuStreamWriteValue64_v2`], [`cuStreamWaitValue32_v2`], [`cuStreamWaitValue64_v2`], [`cuStreamBatchMemOp_v2`], [`cuMemHostRegister_v2`], [`cuEventRecord`].
14913 ///
14914 /// # Parameters
14915 ///
14916 /// - `stream`: The stream to do the write in.
14917 /// - `addr`: The device address to write to.
14918 /// - `value`: The value to write.
14919 /// - `flags`: See `CUstreamWriteValue_flags`.
14920 pub fn cuStreamWriteValue32_v2(
14921 stream: CUstream,
14922 addr: CUdeviceptr,
14923 value: cuuint32_t,
14924 flags: ::core::ffi::c_uint,
14925 ) -> CUresult;
14926}
14927unsafe extern "C" {
14928 /// Write a value to memory.
14929 ///
14930 /// Write a value to memory.
14931 ///
14932 /// If the memory was registered via [`cuMemHostRegister_v2`], the device pointer should be obtained with [`cuMemHostGetDevicePointer_v2`].
14933 ///
14934 /// Support for this can be queried with [`cuDeviceGetAttribute`] and [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS`].
14935 ///
14936 /// Note:
14937 ///
14938 /// Note that this function may also return error codes from previous, asynchronous launches.
14939 ///
14940 /// **See also:**
14941 ///
14942 /// [`cuStreamWriteValue32_v2`], [`cuStreamWaitValue32_v2`], [`cuStreamWaitValue64_v2`], [`cuStreamBatchMemOp_v2`], [`cuMemHostRegister_v2`], [`cuEventRecord`].
14943 ///
14944 /// # Parameters
14945 ///
14946 /// - `stream`: The stream to do the write in.
14947 /// - `addr`: The device address to write to.
14948 /// - `value`: The value to write.
14949 /// - `flags`: See `CUstreamWriteValue_flags`.
14950 pub fn cuStreamWriteValue64_v2(
14951 stream: CUstream,
14952 addr: CUdeviceptr,
14953 value: cuuint64_t,
14954 flags: ::core::ffi::c_uint,
14955 ) -> CUresult;
14956}
14957unsafe extern "C" {
14958 /// Batch operations to synchronize the stream via memory operations.
14959 ///
14960 /// This is a batch version of [`cuStreamWaitValue32_v2`] and [`cuStreamWriteValue32_v2`]. Batching operations may avoid some performance overhead in both the API call and the device execution versus adding them
14961 /// to the stream in separate API calls. The operations are enqueued in the order they appear in the array.
14962 ///
14963 /// See `CUstreamBatchMemOpType` for the full set of supported operations, and [`cuStreamWaitValue32_v2`], [`cuStreamWaitValue64_v2`], [`cuStreamWriteValue32_v2`], and [`cuStreamWriteValue64_v2`] for details of specific operations.
14964 ///
14965 /// See related APIs for details on querying support for specific operations.
14966 ///
14967 /// Note:
14968 ///
14969 /// Warning: Improper use of this API may deadlock the application. Synchronization ordering established through this API is not
14970 /// visible to CUDA. CUDA tasks that are (even indirectly) ordered by this API should also have that order expressed with CUDA-visible
14971 /// dependencies such as events. This ensures that the scheduler does not serialize them in an improper order.
14972 ///
14973 /// Note:
14974 ///
14975 /// Note that this function may also return error codes from previous, asynchronous launches.
14976 ///
14977 /// **See also:**
14978 ///
14979 /// [`cuStreamWaitValue32_v2`], [`cuStreamWaitValue64_v2`], [`cuStreamWriteValue32_v2`], [`cuStreamWriteValue64_v2`], [`cuMemHostRegister_v2`].
14980 ///
14981 /// # Parameters
14982 ///
14983 /// - `stream`: The stream to enqueue the operations in.
14984 /// - `count`: The number of operations in the array. Must be less than 256.
14985 /// - `paramArray`: The types and parameters of the individual operations.
14986 /// - `flags`: Reserved for future expansion; must be 0.
14987 pub fn cuStreamBatchMemOp_v2(
14988 stream: CUstream,
14989 count: ::core::ffi::c_uint,
14990 paramArray: *mut CUstreamBatchMemOpParams,
14991 flags: ::core::ffi::c_uint,
14992 ) -> CUresult;
14993}
14994unsafe extern "C" {
14995 /// Returns information about a function.
14996 ///
14997 /// Returns in \*pi the integer value of the attribute attrib on the kernel given by hfunc. The supported attributes are:
14998 ///
14999 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK`]: The maximum number of threads per block, beyond which a launch of the function would fail. This number depends on both the
15000 /// function and the device on which the function is currently loaded.
15001 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES`]: The size in bytes of statically-allocated shared memory per block required by this function. This does not include dynamically-allocated
15002 /// shared memory requested by the user at runtime.
15003 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES`]: The size in bytes of user-allocated constant memory required by this function.
15004 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES`]: The size in bytes of local memory used by each thread of this function.
15005 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_NUM_REGS`]: The number of registers used by each thread of this function.
15006 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_PTX_VERSION`]: The PTX virtual architecture version for which the function was compiled. This value is the major PTX version \* 10 + the
15007 /// minor PTX version, so a PTX version 1.3 function would return the value 13. Note that this may return the undefined value
15008 /// of 0 for cubins compiled prior to CUDA 3.0.
15009 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_BINARY_VERSION`]: The binary architecture version for which the function was compiled. This value is the major binary version \* 10 + the minor
15010 /// binary version, so a binary version 1.3 function would return the value 13. Note that this will return a value of 10 for legacy
15011 /// cubins that do not have a properly-encoded binary architecture version.
15012 /// * CU_FUNC_CACHE_MODE_CA: The attribute to indicate whether the function has been compiled with user specified option "-Xptxas
15013 /// --dlcm=ca" set .
15014 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES`]: The maximum size in bytes of dynamically-allocated shared memory.
15015 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT`]: Preferred shared memory-L1 cache split ratio in percent of total shared memory.
15016 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_CLUSTER_SIZE_MUST_BE_SET`]: If this attribute is set, the kernel must launch with a valid cluster size specified.
15017 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH`]: The required cluster width in blocks.
15018 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT`]: The required cluster height in blocks.
15019 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH`]: The required cluster depth in blocks.
15020 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED`]: Indicates whether the function can be launched with non-portable cluster size. 1 is allowed, 0 is disallowed. A non-portable
15021 /// cluster size may only function on the specific SKUs the program is tested on. The launch might fail if the program is run
15022 /// on a different hardware platform. CUDA API provides cudaOccupancyMaxActiveClusters to assist with checking whether the desired
15023 /// size can be launched on the current device. A portable cluster size is guaranteed to be functional on all compute capabilities
15024 /// higher than the target compute capability. The portable cluster size for sm_90 is 8 blocks per cluster. This value may increase
15025 /// for future compute capabilities. The specific hardware unit may support higher cluster sizes that’s not guaranteed to be portable.
15026 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE`]: The block scheduling policy of a function. The value type is CUclusterSchedulingPolicy.
15027 ///
15028 /// With a few execeptions, function attributes may also be queried on unloaded function handles returned from [`cuModuleEnumerateFunctions`]. [`cudaError_enum::CUDA_ERROR_FUNCTION_NOT_LOADED`] is returned if the attribute requires a fully loaded function but the function is not loaded. The loading state of a function
15029 /// may be queried using cuFuncIsloaded. [`cuFuncLoad`] may be called to explicitly load a function before querying the following attributes that require the function to be loaded:
15030 ///
15031 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK`]
15032 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES`]
15033 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES`]
15034 ///
15035 /// Note:
15036 ///
15037 /// Note that this function may also return error codes from previous, asynchronous launches.
15038 ///
15039 /// **See also:**
15040 ///
15041 /// [`cuCtxGetCacheConfig`], [`cuCtxSetCacheConfig`], [`cuFuncSetCacheConfig`], [`cuLaunchKernel`], [cudaFuncGetAttributes](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g0e78e02c6d12ebddd4577ac6ebadf494), [cudaFuncSetAttribute](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g61085e9f04656b92573af16072bbc78d), [`cuFuncIsLoaded`], [`cuFuncLoad`], [`cuKernelGetAttribute`].
15042 ///
15043 /// # Parameters
15044 ///
15045 /// - `pi`: Returned attribute value.
15046 /// - `attrib`: Attribute requested.
15047 /// - `hfunc`: Function to query attribute of.
15048 pub fn cuFuncGetAttribute(
15049 pi: *mut ::core::ffi::c_int,
15050 attrib: CUfunction_attribute,
15051 hfunc: CUfunction,
15052 ) -> CUresult;
15053}
15054unsafe extern "C" {
15055 /// Sets information about a function.
15056 ///
15057 /// This call sets the value of a specified attribute attrib on the kernel given by hfunc to an integer value specified by val This function returns [`CUresult::CUDA_SUCCESS`] if the new value of the attribute could be successfully set. If the set fails, this call
15058 /// will return an error. Not all attributes can have values set. Attempting to set a value on a read-only attribute will result
15059 /// in an error ([`CUresult::CUDA_ERROR_INVALID_VALUE`])
15060 ///
15061 /// Supported attributes for the cuFuncSetAttribute call are:
15062 ///
15063 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES`]: This maximum size in bytes of dynamically-allocated shared memory. The value should contain the requested maximum size of
15064 /// dynamically-allocated shared memory. The sum of this value and the function attribute [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES`] cannot exceed the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN`]. The maximal size of requestable dynamic shared memory may differ by GPU architecture.
15065 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT`]: On devices where the L1 cache and shared memory use the same hardware resources, this sets the shared memory carveout preference,
15066 /// in percent of the total shared memory. See [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR`] This is only a hint, and the driver can choose a different ratio if required to execute the function.
15067 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH`]: The required cluster width in blocks. The width, height, and depth values must either all be 0 or all be positive. The validity
15068 /// of the cluster dimensions is checked at launch time. If the value is set during compile time, it cannot be set at runtime.
15069 /// Setting it at runtime will return [`CUresult::CUDA_ERROR_NOT_PERMITTED`].
15070 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT`]: The required cluster height in blocks. The width, height, and depth values must either all be 0 or all be positive. The
15071 /// validity of the cluster dimensions is checked at launch time. If the value is set during compile time, it cannot be set at
15072 /// runtime. Setting it at runtime will return [`CUresult::CUDA_ERROR_NOT_PERMITTED`].
15073 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH`]: The required cluster depth in blocks. The width, height, and depth values must either all be 0 or all be positive. The validity
15074 /// of the cluster dimensions is checked at launch time. If the value is set during compile time, it cannot be set at runtime.
15075 /// Setting it at runtime will return [`CUresult::CUDA_ERROR_NOT_PERMITTED`].
15076 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED`]: Indicates whether the function can be launched with non-portable cluster size. 1 is allowed, 0 is disallowed.
15077 /// * [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE`]: The block scheduling policy of a function. The value type is CUclusterSchedulingPolicy.
15078 ///
15079 /// Note:
15080 ///
15081 /// Note that this function may also return error codes from previous, asynchronous launches.
15082 ///
15083 /// **See also:**
15084 ///
15085 /// [`cuCtxGetCacheConfig`], [`cuCtxSetCacheConfig`], [`cuFuncSetCacheConfig`], [`cuLaunchKernel`], [cudaFuncGetAttributes](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g0e78e02c6d12ebddd4577ac6ebadf494), [cudaFuncSetAttribute](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g61085e9f04656b92573af16072bbc78d), [`cuKernelSetAttribute`].
15086 ///
15087 /// # Parameters
15088 ///
15089 /// - `hfunc`: Function to query attribute of.
15090 /// - `attrib`: Attribute requested.
15091 /// - `value`: The value to set.
15092 pub fn cuFuncSetAttribute(
15093 hfunc: CUfunction,
15094 attrib: CUfunction_attribute,
15095 value: ::core::ffi::c_int,
15096 ) -> CUresult;
15097}
15098unsafe extern "C" {
15099 /// Sets the preferred cache configuration for a device function.
15100 ///
15101 /// On devices where the L1 cache and shared memory use the same hardware resources, this sets through config the preferred cache configuration for the device function hfunc. This is only a preference. The driver will use the requested configuration if possible, but it is free to choose a different
15102 /// configuration if required to execute hfunc. Any context-wide preference set via [`cuCtxSetCacheConfig`] will be overridden by this per-function setting unless the per-function setting is [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_NONE`]. In that case, the current context-wide setting will be used.
15103 ///
15104 /// This setting does nothing on devices where the size of the L1 cache and shared memory are fixed.
15105 ///
15106 /// Launching a kernel with a different preference than the most recent preference setting may insert a device-side synchronization
15107 /// point.
15108 ///
15109 /// The supported cache configurations are:
15110 ///
15111 /// * [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_NONE`]: no preference for shared memory or L1 (default)
15112 /// * [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_SHARED`]: prefer larger shared memory and smaller L1 cache
15113 /// * [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_L1`]: prefer larger L1 cache and smaller shared memory
15114 /// * [`CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_EQUAL`]: prefer equal sized L1 cache and shared memory
15115 ///
15116 /// Note:
15117 ///
15118 /// Note that this function may also return error codes from previous, asynchronous launches.
15119 ///
15120 /// **See also:**
15121 ///
15122 /// [`cuCtxGetCacheConfig`], [`cuCtxSetCacheConfig`], [`cuFuncGetAttribute`], [`cuLaunchKernel`], [cudaFuncSetCacheConfig](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g7d9cc996fe45b6260ebb086caff1c685), [`cuKernelSetCacheConfig`].
15123 ///
15124 /// # Parameters
15125 ///
15126 /// - `hfunc`: Kernel to configure cache for.
15127 /// - `config`: Requested cache configuration.
15128 pub fn cuFuncSetCacheConfig(hfunc: CUfunction, config: CUfunc_cache) -> CUresult;
15129}
15130unsafe extern "C" {
15131 /// Returns a module handle.
15132 ///
15133 /// Returns in \*hmod the handle of the module that function hfunc is located in. The lifetime of the module corresponds to the lifetime of the context it was loaded in or until the module
15134 /// is explicitly unloaded.
15135 ///
15136 /// The CUDA runtime manages its own modules loaded into the primary context. If the handle returned by this API refers to a module
15137 /// loaded by the CUDA runtime, calling [`cuModuleUnload`] on that module will result in undefined behavior.
15138 ///
15139 /// Note:
15140 ///
15141 /// Note that this function may also return error codes from previous, asynchronous launches.
15142 ///
15143 /// # Parameters
15144 ///
15145 /// - `hmod`: Returned module handle.
15146 /// - `hfunc`: Function to retrieve module for.
15147 pub fn cuFuncGetModule(hmod: *mut CUmodule, hfunc: CUfunction) -> CUresult;
15148}
15149unsafe extern "C" {
15150 /// Returns the function name for a CUfunction handle.
15151 ///
15152 /// Returns in \*\*name the function name associated with the function handle hfunc . The function name is returned as a null-terminated string. The returned name is only valid when the function handle is
15153 /// valid. If the module is unloaded or reloaded, one must call the API again to get the updated name. This API may return a mangled
15154 /// name if the function is not declared as having C linkage. If either \*\*name or hfunc is NULL, [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] is returned.
15155 ///
15156 /// Note:
15157 ///
15158 /// Note that this function may also return error codes from previous, asynchronous launches.
15159 ///
15160 /// # Parameters
15161 ///
15162 /// - `name`: The returned name of the function.
15163 /// - `hfunc`: The function handle to retrieve the name for.
15164 pub fn cuFuncGetName(
15165 name: *mut *const ::core::ffi::c_char,
15166 hfunc: CUfunction,
15167 ) -> CUresult;
15168}
15169unsafe extern "C" {
15170 /// Returns the offset and size of a kernel parameter in the device-side parameter layout.
15171 ///
15172 /// Queries the kernel parameter at paramIndex into func's list of parameters, and returns in paramOffset and paramSize the offset and size, respectively, where the parameter will reside in the device-side parameter layout. This information
15173 /// can be used to update kernel node parameters from the device via [cudaGraphKernelNodeSetParam()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__GRAPH.html#group__CUDART__GRAPH_1g0c2bd161eff1e47531eedce282e66d21) and [cudaGraphKernelNodeUpdatesApply()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__GRAPH.html#group__CUDART__GRAPH_1g2d558cf37c9616365c67447e61ac0d6a). paramIndex must be less than the number of parameters that func takes. paramSize can be set to NULL if only the parameter offset is desired.
15174 ///
15175 /// Note:
15176 ///
15177 /// Note that this function may also return error codes from previous, asynchronous launches.
15178 ///
15179 /// **See also:**
15180 ///
15181 /// [`cuKernelGetParamInfo`].
15182 ///
15183 /// # Parameters
15184 ///
15185 /// - `func`: The function to query.
15186 /// - `paramIndex`: The parameter index to query.
15187 /// - `paramOffset`: Returns the offset into the device-side parameter layout at which the parameter resides.
15188 /// - `paramSize`: Optionally returns the size of the parameter in the device-side parameter layout.
15189 pub fn cuFuncGetParamInfo(
15190 func: CUfunction,
15191 paramIndex: size_t,
15192 paramOffset: *mut size_t,
15193 paramSize: *mut size_t,
15194 ) -> CUresult;
15195}
15196unsafe extern "C" {
15197 /// Returns the number of parameters used by the function.
15198 ///
15199 /// Queries the number of kernel parameters used by func and returns it in paramCount.
15200 ///
15201 /// Note:
15202 ///
15203 /// Note that this function may also return error codes from previous, asynchronous launches.
15204 ///
15205 /// **See also:**
15206 ///
15207 /// [`cuFuncGetParamInfo`].
15208 ///
15209 /// # Parameters
15210 ///
15211 /// - `func`: The function to query.
15212 /// - `paramCount`: Returns the number of parameters used by the function.
15213 pub fn cuFuncGetParamCount(func: CUfunction, paramCount: *mut size_t) -> CUresult;
15214}
15215#[repr(u32)]
15216#[derive(
15217 Debug,
15218 Copy,
15219 Clone,
15220 Hash,
15221 PartialOrd,
15222 Ord,
15223 PartialEq,
15224 Eq,
15225 TryFromPrimitive,
15226 IntoPrimitive,
15227)]
15228pub enum CUfunctionLoadingState_enum {
15229 CU_FUNCTION_LOADING_STATE_UNLOADED = 0,
15230 CU_FUNCTION_LOADING_STATE_LOADED = 1,
15231 CU_FUNCTION_LOADING_STATE_MAX = 2,
15232}
15233pub use self::CUfunctionLoadingState_enum as CUfunctionLoadingState;
15234unsafe extern "C" {
15235 /// Returns if the function is loaded.
15236 ///
15237 /// Returns in state the loading state of function.
15238 ///
15239 /// **See also:**
15240 ///
15241 /// [`cuFuncLoad`], [`cuModuleEnumerateFunctions`].
15242 ///
15243 /// # Parameters
15244 ///
15245 /// - `state`: returned loading state.
15246 /// - `function`: the function to check.
15247 pub fn cuFuncIsLoaded(
15248 state: *mut CUfunctionLoadingState,
15249 function: CUfunction,
15250 ) -> CUresult;
15251}
15252unsafe extern "C" {
15253 /// Loads a function.
15254 ///
15255 /// Finalizes function loading for function. Calling this API with a fully loaded function has no effect.
15256 ///
15257 /// **See also:**
15258 ///
15259 /// [`cuModuleEnumerateFunctions`], [`cuFuncIsLoaded`].
15260 ///
15261 /// # Parameters
15262 ///
15263 /// - `function`: the function to load.
15264 pub fn cuFuncLoad(function: CUfunction) -> CUresult;
15265}
15266unsafe extern "C" {
15267 /// Launches a CUDA function CUfunction or a CUDA kernel CUkernel.
15268 ///
15269 /// Invokes the function [`CUfunction`] or the kernel [`CUkernel`]f on a gridDimX x gridDimY x gridDimZ grid of blocks. Each block contains blockDimX x blockDimY x blockDimZ threads.
15270 ///
15271 /// sharedMemBytes sets the amount of dynamic shared memory that will be available to each thread block.
15272 ///
15273 /// Kernel parameters to f can be specified in one of two ways:
15274 ///
15275 /// 1) Kernel parameters can be specified via kernelParams. If f has N parameters, then kernelParams needs to be an array of N pointers. Each of kernelParams\[0\] through kernelParams\[N-1\] must point to a region of memory from which the actual kernel parameter will be copied. The number of kernel parameters
15276 /// and their offsets and sizes do not need to be specified as that information is retrieved directly from the kernel's image.
15277 ///
15278 /// 2) Kernel parameters can also be packaged by the application into a single buffer that is passed in via the extra parameter. This places the burden on the application of knowing each kernel parameter's size and alignment/padding within
15279 /// the buffer. Here is an example of using the extra parameter in this manner:
15280 ///
15281 /// ```text
15282 /// size_t argBufferSize;
15283 /// char argBuffer\[256\];
15284 ///
15285 /// // populate argBuffer and argBufferSize
15286 ///
15287 /// void *config[] = {
15288 /// CU_LAUNCH_PARAM_BUFFER_POINTER, argBuffer,
15289 /// CU_LAUNCH_PARAM_BUFFER_SIZE, &argBufferSize,
15290 /// CU_LAUNCH_PARAM_END
15291 /// };
15292 /// status = cuLaunchKernel(f, gx, gy, gz, bx, by, bz, sh, s, NULL, config);
15293 /// ```
15294 ///
15295 /// The extra parameter exists to allow [`cuLaunchKernel`] to take additional less commonly used arguments. extra specifies a list of names of extra settings and their corresponding values. Each extra setting name is immediately followed
15296 /// by the corresponding value. The list must be terminated with either NULL or `CU_LAUNCH_PARAM_END`.
15297 ///
15298 /// * `CU_LAUNCH_PARAM_END`, which indicates the end of the extra array;
15299 /// * `CU_LAUNCH_PARAM_BUFFER_POINTER`, which specifies that the next value in extra will be a pointer to a buffer containing all the kernel parameters for launching kernel f;
15300 /// * `CU_LAUNCH_PARAM_BUFFER_SIZE`, which specifies that the next value in extra will be a pointer to a size_t containing the size of the buffer specified with `CU_LAUNCH_PARAM_BUFFER_POINTER`;
15301 ///
15302 /// The error [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] will be returned if kernel parameters are specified with both kernelParams and extra (i.e. both kernelParams and extra are non-NULL).
15303 ///
15304 /// Calling [`cuLaunchKernel`] invalidates the persistent function state set through the following deprecated APIs: [`cuFuncSetBlockShape`], [`cuFuncSetSharedSize`], [`cuParamSetSize`], [`cuParamSeti`], [`cuParamSetf`], [`cuParamSetv`].
15305 ///
15306 /// Note that to use [`cuLaunchKernel`], the kernel f must either have been compiled with toolchain version 3.2 or later so that it will contain kernel parameter information,
15307 /// or have no kernel parameters. If either of these conditions is not met, then [`cuLaunchKernel`] will return [`cudaError_enum::CUDA_ERROR_INVALID_IMAGE`].
15308 ///
15309 /// Note that the API can also be used to launch context-less kernel [`CUkernel`] by querying the handle using [`cuLibraryGetKernel`] and then passing it to the API by casting to [`CUfunction`]. Here, the context to launch the kernel on will either be taken from the specified stream hStream or the current context in case of NULL stream.
15310 ///
15311 /// Note:
15312 ///
15313 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
15314 /// * Note that this function may also return error codes from previous, asynchronous launches.
15315 ///
15316 /// **See also:**
15317 ///
15318 /// [`cuCtxGetCacheConfig`], [`cuCtxSetCacheConfig`], [`cuFuncSetCacheConfig`], [`cuFuncGetAttribute`], [cudaLaunchKernel](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g2c91bfe5e072fcd28de6606dd43cd64b), [`cuLibraryGetKernel`], [`cuKernelSetCacheConfig`], [`cuKernelGetAttribute`], [`cuKernelSetAttribute`].
15319 ///
15320 /// # Parameters
15321 ///
15322 /// - `f`: Function [`CUfunction`] or Kernel [`CUkernel`] to launch.
15323 /// - `gridDimX`: Width of grid in blocks.
15324 /// - `gridDimY`: Height of grid in blocks.
15325 /// - `gridDimZ`: Depth of grid in blocks.
15326 /// - `blockDimX`: X dimension of each thread block.
15327 /// - `blockDimY`: Y dimension of each thread block.
15328 /// - `blockDimZ`: Z dimension of each thread block.
15329 /// - `sharedMemBytes`: Dynamic shared-memory size per thread block in bytes.
15330 /// - `hStream`: Stream identifier.
15331 /// - `kernelParams`: Array of pointers to kernel parameters.
15332 /// - `extra`: Extra options.
15333 pub fn cuLaunchKernel(
15334 f: CUfunction,
15335 gridDimX: ::core::ffi::c_uint,
15336 gridDimY: ::core::ffi::c_uint,
15337 gridDimZ: ::core::ffi::c_uint,
15338 blockDimX: ::core::ffi::c_uint,
15339 blockDimY: ::core::ffi::c_uint,
15340 blockDimZ: ::core::ffi::c_uint,
15341 sharedMemBytes: ::core::ffi::c_uint,
15342 hStream: CUstream,
15343 kernelParams: *mut *mut ::core::ffi::c_void,
15344 extra: *mut *mut ::core::ffi::c_void,
15345 ) -> CUresult;
15346}
15347unsafe extern "C" {
15348 /// Launches a CUDA function CUfunction or a CUDA kernel CUkernel with launch-time configuration.
15349 ///
15350 /// Invokes the function [`CUfunction`] or the kernel [`CUkernel`]f with the specified launch-time configuration config.
15351 ///
15352 /// The [`CUlaunchConfig`] structure is defined as:
15353 ///
15354 /// ```text
15355 /// typedef struct CUlaunchConfig_st {
15356 /// unsigned int gridDimX;
15357 /// unsigned int gridDimY;
15358 /// unsigned int gridDimZ;
15359 /// unsigned int blockDimX;
15360 /// unsigned int blockDimY;
15361 /// unsigned int blockDimZ;
15362 /// unsigned int sharedMemBytes;
15363 /// CUstream hStream;
15364 /// CUlaunchAttribute *attrs;
15365 /// unsigned int numAttrs;
15366 /// } CUlaunchConfig;
15367 /// ```
15368 ///
15369 /// where:
15370 ///
15371 /// * [CUlaunchConfig::gridDimX](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchConfig.html#structCUlaunchConfig_1689d9cc16fd423b080ec828b5bc9d885) is the width of the grid in blocks.
15372 /// * [CUlaunchConfig::gridDimY](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchConfig.html#structCUlaunchConfig_18c2c6a003a635f55703d3e00873c1a04) is the height of the grid in blocks.
15373 /// * [CUlaunchConfig::gridDimZ](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchConfig.html#structCUlaunchConfig_12ee1e4c17d2976638d5c1def7aab2173) is the depth of the grid in blocks.
15374 /// * [CUlaunchConfig::blockDimX](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchConfig.html#structCUlaunchConfig_1c6348b2aec5d4cbe883351f0a4ca2404) is the X dimension of each thread block.
15375 /// * [CUlaunchConfig::blockDimX](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchConfig.html#structCUlaunchConfig_1c6348b2aec5d4cbe883351f0a4ca2404) is the Y dimension of each thread block.
15376 /// * [CUlaunchConfig::blockDimZ](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchConfig.html#structCUlaunchConfig_114969c04364799742f22a4eb97501f75) is the Z dimension of each thread block.
15377 /// * [CUlaunchConfig::sharedMemBytes](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchConfig.html#structCUlaunchConfig_139281cdd7b80edb790b0fa85b2bca38f) is the dynamic shared-memory size per thread block in bytes.
15378 /// * [CUlaunchConfig::hStream](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchConfig.html#structCUlaunchConfig_18bbdd01ea0d4d380fad9e8be14fb928b) is the handle to the stream to perform the launch in. The CUDA context associated with this stream must match that associated
15379 /// with function f.
15380 /// * [CUlaunchConfig::attrs](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchConfig.html#structCUlaunchConfig_189bd86e2a9d67c421d5ad9650e57f375) is an array of [CUlaunchConfig::numAttrs](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchConfig.html#structCUlaunchConfig_1c64a4dd37ff79255de128a5868658e06) continguous [`CUlaunchAttribute`] elements. The value of this pointer is not considered if [CUlaunchConfig::numAttrs](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchConfig.html#structCUlaunchConfig_1c64a4dd37ff79255de128a5868658e06) is zero. However, in that case, it is recommended to set the pointer to NULL.
15381 /// * [CUlaunchConfig::numAttrs](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchConfig.html#structCUlaunchConfig_1c64a4dd37ff79255de128a5868658e06) is the number of attributes populating the first [CUlaunchConfig::numAttrs](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchConfig.html#structCUlaunchConfig_1c64a4dd37ff79255de128a5868658e06) positions of the [CUlaunchConfig::attrs](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchConfig.html#structCUlaunchConfig_189bd86e2a9d67c421d5ad9650e57f375) array.
15382 ///
15383 /// Launch-time configuration is specified by adding entries to [CUlaunchConfig::attrs](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchConfig.html#structCUlaunchConfig_189bd86e2a9d67c421d5ad9650e57f375). Each entry is an attribute ID and a corresponding attribute value.
15384 ///
15385 /// The [`CUlaunchAttribute`] structure is defined as:
15386 ///
15387 /// ```text
15388 /// typedef struct CUlaunchAttribute_st {
15389 /// CUlaunchAttributeID id;
15390 /// CUlaunchAttributeValue value;
15391 /// } CUlaunchAttribute;
15392 /// ```
15393 ///
15394 /// where:
15395 ///
15396 /// * [CUlaunchAttribute::id](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchAttribute.html#structCUlaunchAttribute_132aed095f6c0ffe51ea05d61ee83a5df) is a unique enum identifying the attribute.
15397 /// * [CUlaunchAttribute::value](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchAttribute.html#structCUlaunchAttribute_1924768cf94d6cf1d94691d30e491fc55) is a union that hold the attribute value.
15398 ///
15399 /// An example of using the config parameter:
15400 ///
15401 /// ```text
15402 /// CUlaunchAttribute coopAttr = {.id = CU_LAUNCH_ATTRIBUTE_COOPERATIVE,
15403 /// .value = 1};
15404 /// CUlaunchConfig config = {... // set block and grid dimensions
15405 /// .attrs = &coopAttr,
15406 /// .numAttrs = 1};
15407 ///
15408 /// cuLaunchKernelEx(&config, kernel, NULL, NULL);
15409 /// ```
15410 ///
15411 /// The `CUlaunchAttributeID` enum is defined as:
15412 ///
15413 /// ```text
15414 /// typedef enum CUlaunchAttributeID_enum {
15415 /// CU_LAUNCH_ATTRIBUTE_IGNORE = 0,
15416 /// CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW = 1,
15417 /// CU_LAUNCH_ATTRIBUTE_COOPERATIVE = 2,
15418 /// CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY = 3,
15419 /// CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION = 4,
15420 /// CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = 5,
15421 /// CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION = 6,
15422 /// CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT = 7,
15423 /// CU_LAUNCH_ATTRIBUTE_PRIORITY = 8,
15424 /// CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = 9,
15425 /// CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN = 10,
15426 /// CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION = 11,
15427 /// CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT = 12,
15428 /// CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE = 13,
15429 /// } CUlaunchAttributeID;
15430 /// ```
15431 ///
15432 /// and the corresponding [`CUlaunchAttributeValue`] union as :
15433 ///
15434 /// ```text
15435 /// typedef union CUlaunchAttributeValue_union {
15436 /// CUaccessPolicyWindow accessPolicyWindow;
15437 /// int cooperative;
15438 /// CUsynchronizationPolicy syncPolicy;
15439 /// struct {
15440 /// unsigned int x;
15441 /// unsigned int y;
15442 /// unsigned int z;
15443 /// } clusterDim;
15444 /// CUclusterSchedulingPolicy clusterSchedulingPolicyPreference;
15445 /// int programmaticStreamSerializationAllowed;
15446 /// struct {
15447 /// CUevent event;
15448 /// int flags;
15449 /// int triggerAtBlockStart;
15450 /// } programmaticEvent;
15451 /// int priority;
15452 /// CUlaunchMemSyncDomainMap memSyncDomainMap;
15453 /// CUlaunchMemSyncDomain memSyncDomain;
15454 /// struct {
15455 /// unsigned int x;
15456 /// unsigned int y;
15457 /// unsigned int z;
15458 /// } preferredClusterDim;
15459 /// struct {
15460 /// CUevent event;
15461 /// int flags;
15462 /// } launchCompletionEvent;
15463 /// struct {
15464 /// int deviceUpdatable;
15465 /// CUgraphDeviceNode devNode;
15466 /// } deviceUpdatableKernelNode;
15467 /// } CUlaunchAttributeValue;
15468 /// ```
15469 ///
15470 /// Setting [`CUlaunchAttributeID_enum::CU_LAUNCH_ATTRIBUTE_COOPERATIVE`] to a non-zero value causes the kernel launch to be a cooperative launch, with exactly the same usage and semantics of [`cuLaunchCooperativeKernel`].
15471 ///
15472 /// Setting [`CUlaunchAttributeID_enum::CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION`] to a non-zero values causes the kernel to use programmatic means to resolve its stream dependency -- enabling the CUDA runtime
15473 /// to opportunistically allow the grid's execution to overlap with the previous kernel in the stream, if that kernel requests
15474 /// the overlap.
15475 ///
15476 /// [`CUlaunchAttributeID_enum::CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT`] records an event along with the kernel launch. Event recorded through this launch attribute is guaranteed to only trigger
15477 /// after all block in the associated kernel trigger the event. A block can trigger the event through PTX launchdep.release or
15478 /// CUDA builtin function [cudaTriggerProgrammaticLaunchCompletion()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__EXECUTION.html#group__CUDART__EXECUTION_1ge194af462d927583bed3acf60d450218). A trigger can also be inserted at the beginning of each block's execution if triggerAtBlockStart is set to non-0. Note that
15479 /// dependents (including the CPU thread calling [`cuEventSynchronize`]) are not guaranteed to observe the release precisely when it is released. For example, [`cuEventSynchronize`] may only observe the event trigger long after the associated kernel has completed. This recording type is primarily meant
15480 /// for establishing programmatic dependency between device tasks. The event supplied must not be an interprocess or interop event.
15481 /// The event must disable timing (i.e. created with [`CUevent_flags_enum::CU_EVENT_DISABLE_TIMING`] flag set).
15482 ///
15483 /// [`CUlaunchAttributeID_enum::CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT`] records an event along with the kernel launch. Nominally, the event is triggered once all blocks of the kernel have begun
15484 /// execution. Currently this is a best effort. If a kernel B has a launch completion dependency on a kernel A, B may wait until
15485 /// A is complete. Alternatively, blocks of B may begin before all blocks of A have begun, for example:
15486 ///
15487 /// * If B can claim execution resources unavailable to A, for example if they run on different GPUs.
15488 /// * If B is a higher priority than A.
15489 ///
15490 /// Exercise caution if such an ordering inversion could lead to deadlock. The event supplied must not be an interprocess or interop
15491 /// event. The event must disable timing (i.e. must be created with the [`CUevent_flags_enum::CU_EVENT_DISABLE_TIMING`] flag set).
15492 ///
15493 /// Setting [`CUlaunchAttributeID_enum::CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE`] to 1 on a captured launch causes the resulting kernel node to be device-updatable. This attribute is specific to graphs,
15494 /// and passing it to a launch in a non-capturing stream results in an error. Passing a value other than 0 or 1 is not allowed.
15495 ///
15496 /// On success, a handle will be returned via CUlaunchAttributeValue::deviceUpdatableKernelNode::devNode which can be passed to
15497 /// the various device-side update functions to update the node's kernel parameters from within another kernel. For more information
15498 /// on the types of device updates that can be made, as well as the relevant limitations thereof, see [cudaGraphKernelNodeUpdatesApply](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__GRAPH.html#group__CUDART__GRAPH_1g2d558cf37c9616365c67447e61ac0d6a).
15499 ///
15500 /// Kernel nodes which are device-updatable have additional restrictions compared to regular kernel nodes. Firstly, device-updatable
15501 /// nodes cannot be removed from their graph via [`cuGraphDestroyNode`]. Additionally, once opted-in to this functionality, a node cannot opt out, and any attempt to set the attribute to 0 will
15502 /// result in an error. Graphs containing one or more device-updatable node also do not allow multiple instantiation.
15503 ///
15504 /// [`CUlaunchAttributeID_enum::CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION`] allows the kernel launch to specify a preferred substitute cluster dimension. Blocks may be grouped according to either the
15505 /// dimensions specified with this attribute (grouped into a "preferred substitute cluster"), or the one specified with [`CUlaunchAttributeID_enum::CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION`] attribute (grouped into a "regular cluster"). The cluster dimensions of a "preferred substitute cluster" shall be an integer
15506 /// multiple greater than zero of the regular cluster dimensions. The device will attempt - on a best-effort basis - to group
15507 /// thread blocks into preferred clusters over grouping them into regular clusters. When it deems necessary (primarily when the
15508 /// device temporarily runs out of physical resources to launch the larger preferred clusters), the device may switch to launch
15509 /// the regular clusters instead to attempt to utilize as much of the physical device resources as possible.
15510 ///
15511 /// Each type of cluster will have its enumeration / coordinate setup as if the grid consists solely of its type of cluster. For
15512 /// example, if the preferred substitute cluster dimensions double the regular cluster dimensions, there might be simultaneously
15513 /// a regular cluster indexed at (1,0,0), and a preferred cluster indexed at (1,0,0). In this example, the preferred substitute
15514 /// cluster (1,0,0) replaces regular clusters (2,0,0) and (3,0,0) and groups their blocks.
15515 ///
15516 /// This attribute will only take effect when a regular cluster dimension has been specified. The preferred substitute The preferred
15517 /// substitute cluster dimension must be an integer multiple greater than zero of the regular cluster dimension and must divide
15518 /// the grid. It must also be no more than `maxBlocksPerCluster`, if it is set in the kernel's `__launch_bounds__`. Otherwise
15519 /// it must be less than the maximum value the driver can support. Otherwise, setting this attribute to a value physically unable
15520 /// to fit on any particular device is permitted.
15521 ///
15522 /// The effect of other attributes is consistent with their effect when set via persistent APIs.
15523 ///
15524 /// See [`cuStreamSetAttribute`] for
15525 ///
15526 /// * [`CUlaunchAttributeID_enum::CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW`]
15527 /// * [`CUlaunchAttributeID_enum::CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY`]
15528 ///
15529 /// See [`cuFuncSetAttribute`] for
15530 ///
15531 /// * [`CUlaunchAttributeID_enum::CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION`]
15532 /// * [`CUlaunchAttributeID_enum::CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE`]
15533 ///
15534 /// Kernel parameters to f can be specified in the same ways that they can be using [`cuLaunchKernel`].
15535 ///
15536 /// Note that the API can also be used to launch context-less kernel [`CUkernel`] by querying the handle using [`cuLibraryGetKernel`] and then passing it to the API by casting to [`CUfunction`]. Here, the context to launch the kernel on will either be taken from the specified stream [CUlaunchConfig::hStream](https://docs.nvidia.com/cuda/cuda-driver-api/structCUlaunchConfig.html#structCUlaunchConfig_18bbdd01ea0d4d380fad9e8be14fb928b) or the current context in case of NULL stream.
15537 ///
15538 /// Note:
15539 ///
15540 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
15541 /// * Note that this function may also return error codes from previous, asynchronous launches.
15542 ///
15543 /// **See also:**
15544 ///
15545 /// [`cuCtxGetCacheConfig`], [`cuCtxSetCacheConfig`], [`cuFuncSetCacheConfig`], [`cuFuncGetAttribute`], [cudaLaunchKernel](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g2c91bfe5e072fcd28de6606dd43cd64b), [cudaLaunchKernelEx](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g98d60efe48c3400a1c17a1edb698e530), [`cuLibraryGetKernel`], [`cuKernelSetCacheConfig`], [`cuKernelGetAttribute`], [`cuKernelSetAttribute`].
15546 ///
15547 /// # Parameters
15548 ///
15549 /// - `config`: Config to launch.
15550 /// - `f`: Function [`CUfunction`] or Kernel [`CUkernel`] to launch.
15551 /// - `kernelParams`: Array of pointers to kernel parameters.
15552 /// - `extra`: Extra options.
15553 pub fn cuLaunchKernelEx(
15554 config: *const CUlaunchConfig,
15555 f: CUfunction,
15556 kernelParams: *mut *mut ::core::ffi::c_void,
15557 extra: *mut *mut ::core::ffi::c_void,
15558 ) -> CUresult;
15559}
15560unsafe extern "C" {
15561 /// Launches a CUDA function CUfunction or a CUDA kernel CUkernel where thread blocks can cooperate and synchronize as they execute.
15562 ///
15563 /// Invokes the function [`CUfunction`] or the kernel [`CUkernel`]f on a gridDimX x gridDimY x gridDimZ grid of blocks. Each block contains blockDimX x blockDimY x blockDimZ threads.
15564 ///
15565 /// sharedMemBytes sets the amount of dynamic shared memory that will be available to each thread block.
15566 ///
15567 /// The device on which this kernel is invoked must have a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH`].
15568 ///
15569 /// The total number of blocks launched cannot exceed the maximum number of blocks per multiprocessor as returned by [`cuOccupancyMaxActiveBlocksPerMultiprocessor`] (or [`cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags`]) times the number of multiprocessors as specified by the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT`].
15570 ///
15571 /// The kernel cannot make use of CUDA dynamic parallelism.
15572 ///
15573 /// Kernel parameters must be specified via kernelParams. If f has N parameters, then kernelParams needs to be an array of N pointers. Each of kernelParams\[0\] through kernelParams\[N-1\] must point to a region of memory from which the actual kernel parameter will be copied. The number of kernel parameters
15574 /// and their offsets and sizes do not need to be specified as that information is retrieved directly from the kernel's image.
15575 ///
15576 /// Calling [`cuLaunchCooperativeKernel`] sets persistent function state that is the same as function state set through [`cuLaunchKernel`] API
15577 ///
15578 /// When the kernel f is launched via [`cuLaunchCooperativeKernel`], the previous block shape, shared size and parameter info associated with f is overwritten.
15579 ///
15580 /// Note that to use [`cuLaunchCooperativeKernel`], the kernel f must either have been compiled with toolchain version 3.2 or later so that it will contain kernel parameter information,
15581 /// or have no kernel parameters. If either of these conditions is not met, then [`cuLaunchCooperativeKernel`] will return [`cudaError_enum::CUDA_ERROR_INVALID_IMAGE`].
15582 ///
15583 /// Note that the API can also be used to launch context-less kernel [`CUkernel`] by querying the handle using [`cuLibraryGetKernel`] and then passing it to the API by casting to [`CUfunction`]. Here, the context to launch the kernel on will either be taken from the specified stream hStream or the current context in case of NULL stream.
15584 ///
15585 /// Note:
15586 ///
15587 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
15588 /// * Note that this function may also return error codes from previous, asynchronous launches.
15589 ///
15590 /// **See also:**
15591 ///
15592 /// [`cuCtxGetCacheConfig`], [`cuCtxSetCacheConfig`], [`cuFuncSetCacheConfig`], [`cuFuncGetAttribute`], [`cuLaunchCooperativeKernelMultiDevice`], [cudaLaunchCooperativeKernel](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g7c4cb6c44a6c4608da36c44374499b31), [`cuLibraryGetKernel`], [`cuKernelSetCacheConfig`], [`cuKernelGetAttribute`], [`cuKernelSetAttribute`].
15593 ///
15594 /// # Parameters
15595 ///
15596 /// - `f`: Function [`CUfunction`] or Kernel [`CUkernel`] to launch.
15597 /// - `gridDimX`: Width of grid in blocks.
15598 /// - `gridDimY`: Height of grid in blocks.
15599 /// - `gridDimZ`: Depth of grid in blocks.
15600 /// - `blockDimX`: X dimension of each thread block.
15601 /// - `blockDimY`: Y dimension of each thread block.
15602 /// - `blockDimZ`: Z dimension of each thread block.
15603 /// - `sharedMemBytes`: Dynamic shared-memory size per thread block in bytes.
15604 /// - `hStream`: Stream identifier.
15605 /// - `kernelParams`: Array of pointers to kernel parameters.
15606 pub fn cuLaunchCooperativeKernel(
15607 f: CUfunction,
15608 gridDimX: ::core::ffi::c_uint,
15609 gridDimY: ::core::ffi::c_uint,
15610 gridDimZ: ::core::ffi::c_uint,
15611 blockDimX: ::core::ffi::c_uint,
15612 blockDimY: ::core::ffi::c_uint,
15613 blockDimZ: ::core::ffi::c_uint,
15614 sharedMemBytes: ::core::ffi::c_uint,
15615 hStream: CUstream,
15616 kernelParams: *mut *mut ::core::ffi::c_void,
15617 ) -> CUresult;
15618}
15619unsafe extern "C" {
15620 /// Enqueues a host function call in a stream.
15621 ///
15622 /// Enqueues a host function to run in a stream. The function will be called after currently enqueued work and will block work
15623 /// added after it.
15624 ///
15625 /// The host function must not make any CUDA API calls. Attempting to use a CUDA API may result in [`cudaError_enum::CUDA_ERROR_NOT_PERMITTED`], but this is not required. The host function must not perform any synchronization that may depend on outstanding CUDA work
15626 /// not mandated to run earlier. Host functions without a mandated order (such as in independent streams) execute in undefined
15627 /// order and may be serialized.
15628 ///
15629 /// For the purposes of Unified Memory, execution makes a number of guarantees:
15630 ///
15631 /// * The stream is considered idle for the duration of the function's execution. Thus, for example, the function may always use
15632 /// memory attached to the stream it was enqueued in.
15633 /// * The start of execution of the function has the same effect as synchronizing an event recorded in the same stream immediately
15634 /// prior to the function. It thus synchronizes streams which have been "joined" prior to the function.
15635 /// * Adding device work to any stream does not have the effect of making the stream active until all preceding host functions and
15636 /// stream callbacks have executed. Thus, for example, a function might use global attached memory even if work has been added
15637 /// to another stream, if the work has been ordered behind the function call with an event.
15638 /// * Completion of the function does not cause a stream to become active except as described above. The stream will remain idle
15639 /// if no device work follows the function, and will remain idle across consecutive host functions or stream callbacks without
15640 /// device work in between. Thus, for example, stream synchronization can be done by signaling from a host function at the end
15641 /// of the stream.
15642 ///
15643 /// Note that, in contrast to [`cuStreamAddCallback`], the function will not be called in the event of an error in the CUDA context.
15644 ///
15645 /// Note:
15646 ///
15647 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
15648 /// * Note that this function may also return error codes from previous, asynchronous launches.
15649 ///
15650 /// **See also:**
15651 ///
15652 /// [`cuStreamCreate`], [`cuStreamQuery`], [`cuStreamSynchronize`], [`cuStreamWaitEvent`], [`cuStreamDestroy_v2`], [`cuMemAllocManaged`], [`cuStreamAttachMemAsync`], [`cuStreamAddCallback`].
15653 ///
15654 /// # Parameters
15655 ///
15656 /// - `hStream`: Stream to enqueue function call in.
15657 /// - `userData`: User-specified data to be passed to the function.
15658 pub fn cuLaunchHostFunc(
15659 hStream: CUstream,
15660 fn_: CUhostFn,
15661 userData: *mut ::core::ffi::c_void,
15662 ) -> CUresult;
15663}
15664unsafe extern "C" {
15665 /// Enqueues a host function call in a stream.
15666 ///
15667 /// Enqueues a host function to run in a stream. The function will be called after currently enqueued work and will block work
15668 /// added after it.
15669 ///
15670 /// The host function must not make any CUDA API calls. Attempting to use a CUDA API may result in [`cudaError_enum::CUDA_ERROR_NOT_PERMITTED`], but this is not required. The host function must not perform any synchronization that may depend on outstanding CUDA work
15671 /// not mandated to run earlier. Host functions without a mandated order (such as in independent streams) execute in undefined
15672 /// order and may be serialized.
15673 ///
15674 /// For the purposes of Unified Memory, execution makes a number of guarantees:
15675 ///
15676 /// * The stream is considered idle for the duration of the function's execution. Thus, for example, the function may always use
15677 /// memory attached to the stream it was enqueued in.
15678 /// * The start of execution of the function has the same effect as synchronizing an event recorded in the same stream immediately
15679 /// prior to the function. It thus synchronizes streams which have been "joined" prior to the function.
15680 /// * Adding device work to any stream does not have the effect of making the stream active until all preceding host functions and
15681 /// stream callbacks have executed. Thus, for example, a function might use global attached memory even if work has been added
15682 /// to another stream, if the work has been ordered behind the function call with an event.
15683 /// * Completion of the function does not cause a stream to become active except as described above. The stream will remain idle
15684 /// if no device work follows the function, and will remain idle across consecutive host functions or stream callbacks without
15685 /// device work in between. Thus, for example, stream synchronization can be done by signaling from a host function at the end
15686 /// of the stream.
15687 ///
15688 /// Note that, in contrast to [`cuStreamAddCallback`], the function will not be called in the event of an error in the CUDA context.
15689 ///
15690 /// Note:
15691 ///
15692 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
15693 /// * Note that this function may also return error codes from previous, asynchronous launches.
15694 ///
15695 /// **See also:**
15696 ///
15697 /// [`cuStreamCreate`], [`cuStreamQuery`], [`cuStreamSynchronize`], [`cuStreamWaitEvent`], [`cuStreamDestroy_v2`], [`cuMemAllocManaged`], [`cuStreamAttachMemAsync`], [`cuStreamAddCallback`].
15698 ///
15699 /// # Parameters
15700 ///
15701 /// - `hStream`: Stream to enqueue function call in.
15702 /// - `userData`: User-specified data to be passed to the function.
15703 /// - `syncMode`: Synchronization mode for the host function.
15704 pub fn cuLaunchHostFunc_v2(
15705 hStream: CUstream,
15706 fn_: CUhostFn,
15707 userData: *mut ::core::ffi::c_void,
15708 syncMode: ::core::ffi::c_uint,
15709 ) -> CUresult;
15710}
15711unsafe extern "C" {
15712 /// Sets the block-dimensions for the function.
15713 ///
15714 /// x
15715 ///
15716 /// y
15717 ///
15718 /// z
15719 ///
15720 /// hfunc
15721 ///
15722 /// Note:
15723 ///
15724 /// Note that this function may also return error codes from previous, asynchronous launches.
15725 ///
15726 /// **See also:**
15727 ///
15728 /// [`cuFuncSetSharedSize`], [`cuFuncSetCacheConfig`], [`cuFuncGetAttribute`], [`cuParamSetSize`], [`cuParamSeti`], [`cuParamSetf`], [`cuParamSetv`], [`cuLaunch`], [`cuLaunchGrid`], [`cuLaunchGridAsync`], [`cuLaunchKernel`].
15729 ///
15730 /// # Parameters
15731 ///
15732 /// - `hfunc`: Kernel to specify dimensions of.
15733 /// - `x`: X dimension.
15734 /// - `y`: Y dimension.
15735 /// - `z`: Z dimension.
15736 #[deprecated]
15737 pub fn cuFuncSetBlockShape(
15738 hfunc: CUfunction,
15739 x: ::core::ffi::c_int,
15740 y: ::core::ffi::c_int,
15741 z: ::core::ffi::c_int,
15742 ) -> CUresult;
15743}
15744unsafe extern "C" {
15745 /// Sets the dynamic shared-memory size for the function.
15746 ///
15747 /// bytes
15748 ///
15749 /// hfunc
15750 ///
15751 /// Note:
15752 ///
15753 /// Note that this function may also return error codes from previous, asynchronous launches.
15754 ///
15755 /// **See also:**
15756 ///
15757 /// [`cuFuncSetBlockShape`], [`cuFuncSetCacheConfig`], [`cuFuncGetAttribute`], [`cuParamSetSize`], [`cuParamSeti`], [`cuParamSetf`], [`cuParamSetv`], [`cuLaunch`], [`cuLaunchGrid`], [`cuLaunchGridAsync`], [`cuLaunchKernel`].
15758 ///
15759 /// # Parameters
15760 ///
15761 /// - `hfunc`: Kernel to specify dynamic shared-memory size for.
15762 /// - `bytes`: Dynamic shared-memory size per thread in bytes.
15763 #[deprecated]
15764 pub fn cuFuncSetSharedSize(
15765 hfunc: CUfunction,
15766 bytes: ::core::ffi::c_uint,
15767 ) -> CUresult;
15768}
15769unsafe extern "C" {
15770 /// Sets the parameter size for the function.
15771 ///
15772 /// numbytes
15773 ///
15774 /// hfunc
15775 ///
15776 /// Note:
15777 ///
15778 /// Note that this function may also return error codes from previous, asynchronous launches.
15779 ///
15780 /// **See also:**
15781 ///
15782 /// [`cuFuncSetBlockShape`], [`cuFuncSetSharedSize`], [`cuFuncGetAttribute`], [`cuParamSetf`], [`cuParamSeti`], [`cuParamSetv`], [`cuLaunch`], [`cuLaunchGrid`], [`cuLaunchGridAsync`], [`cuLaunchKernel`].
15783 ///
15784 /// # Parameters
15785 ///
15786 /// - `hfunc`: Kernel to set parameter size for.
15787 /// - `numbytes`: Size of parameter list in bytes.
15788 #[deprecated]
15789 pub fn cuParamSetSize(hfunc: CUfunction, numbytes: ::core::ffi::c_uint) -> CUresult;
15790}
15791unsafe extern "C" {
15792 /// Adds an integer parameter to the function's argument list.
15793 ///
15794 /// hfunc
15795 ///
15796 /// offset
15797 ///
15798 /// Note:
15799 ///
15800 /// Note that this function may also return error codes from previous, asynchronous launches.
15801 ///
15802 /// **See also:**
15803 ///
15804 /// [`cuFuncSetBlockShape`], [`cuFuncSetSharedSize`], [`cuFuncGetAttribute`], [`cuParamSetSize`], [`cuParamSetf`], [`cuParamSetv`], [`cuLaunch`], [`cuLaunchGrid`], [`cuLaunchGridAsync`], [`cuLaunchKernel`].
15805 ///
15806 /// # Parameters
15807 ///
15808 /// - `hfunc`: Kernel to add parameter to.
15809 /// - `offset`: Offset to add parameter to argument list.
15810 /// - `value`: Value of parameter.
15811 #[deprecated]
15812 pub fn cuParamSeti(
15813 hfunc: CUfunction,
15814 offset: ::core::ffi::c_int,
15815 value: ::core::ffi::c_uint,
15816 ) -> CUresult;
15817}
15818unsafe extern "C" {
15819 /// Adds a floating-point parameter to the function's argument list.
15820 ///
15821 /// hfunc
15822 ///
15823 /// offset
15824 ///
15825 /// Note:
15826 ///
15827 /// Note that this function may also return error codes from previous, asynchronous launches.
15828 ///
15829 /// **See also:**
15830 ///
15831 /// [`cuFuncSetBlockShape`], [`cuFuncSetSharedSize`], [`cuFuncGetAttribute`], [`cuParamSetSize`], [`cuParamSeti`], [`cuParamSetv`], [`cuLaunch`], [`cuLaunchGrid`], [`cuLaunchGridAsync`], [`cuLaunchKernel`].
15832 ///
15833 /// # Parameters
15834 ///
15835 /// - `hfunc`: Kernel to add parameter to.
15836 /// - `offset`: Offset to add parameter to argument list.
15837 /// - `value`: Value of parameter.
15838 #[deprecated]
15839 pub fn cuParamSetf(
15840 hfunc: CUfunction,
15841 offset: ::core::ffi::c_int,
15842 value: f32,
15843 ) -> CUresult;
15844}
15845unsafe extern "C" {
15846 /// Adds arbitrary data to the function's argument list.
15847 ///
15848 /// numbytes
15849 ///
15850 /// ptr
15851 ///
15852 /// hfunc
15853 ///
15854 /// offset
15855 ///
15856 /// Note:
15857 ///
15858 /// Note that this function may also return error codes from previous, asynchronous launches.
15859 ///
15860 /// **See also:**
15861 ///
15862 /// [`cuFuncSetBlockShape`], [`cuFuncSetSharedSize`], [`cuFuncGetAttribute`], [`cuParamSetSize`], [`cuParamSetf`], [`cuParamSeti`], [`cuLaunch`], [`cuLaunchGrid`], [`cuLaunchGridAsync`], [`cuLaunchKernel`].
15863 ///
15864 /// # Parameters
15865 ///
15866 /// - `hfunc`: Kernel to add data to.
15867 /// - `offset`: Offset to add data to argument list.
15868 /// - `ptr`: Pointer to arbitrary data.
15869 /// - `numbytes`: Size of data to copy in bytes.
15870 #[deprecated]
15871 pub fn cuParamSetv(
15872 hfunc: CUfunction,
15873 offset: ::core::ffi::c_int,
15874 ptr: *mut ::core::ffi::c_void,
15875 numbytes: ::core::ffi::c_uint,
15876 ) -> CUresult;
15877}
15878unsafe extern "C" {
15879 /// Launches a CUDA function.
15880 ///
15881 /// f
15882 ///
15883 /// [`cuFuncSetBlockShape`]
15884 ///
15885 /// The block shape, dynamic shared memory size, and parameter information must be set using [`cuFuncSetBlockShape`], [`cuFuncSetSharedSize`], [`cuParamSetSize`], [`cuParamSeti`], [`cuParamSetf`], and [`cuParamSetv`] prior to calling this function.
15886 ///
15887 /// Launching a function via [`cuLaunchKernel`] invalidates the function's block shape, dynamic shared memory size, and parameter information. After launching via cuLaunchKernel,
15888 /// this state must be re-initialized prior to calling this function. Failure to do so results in undefined behavior.
15889 ///
15890 /// Note:
15891 ///
15892 /// Note that this function may also return error codes from previous, asynchronous launches.
15893 ///
15894 /// **See also:**
15895 ///
15896 /// [`cuFuncSetBlockShape`], [`cuFuncSetSharedSize`], [`cuFuncGetAttribute`], [`cuParamSetSize`], [`cuParamSetf`], [`cuParamSeti`], [`cuParamSetv`], [`cuLaunchGrid`], [`cuLaunchGridAsync`], [`cuLaunchKernel`].
15897 ///
15898 /// # Parameters
15899 ///
15900 /// - `f`: Kernel to launch.
15901 #[deprecated]
15902 pub fn cuLaunch(f: CUfunction) -> CUresult;
15903}
15904unsafe extern "C" {
15905 /// Launches a CUDA function.
15906 ///
15907 /// f
15908 ///
15909 /// grid_width
15910 ///
15911 /// grid_height
15912 ///
15913 /// [`cuFuncSetBlockShape`]
15914 ///
15915 /// The block shape, dynamic shared memory size, and parameter information must be set using [`cuFuncSetBlockShape`], [`cuFuncSetSharedSize`], [`cuParamSetSize`], [`cuParamSeti`], [`cuParamSetf`], and [`cuParamSetv`] prior to calling this function.
15916 ///
15917 /// Launching a function via [`cuLaunchKernel`] invalidates the function's block shape, dynamic shared memory size, and parameter information. After launching via cuLaunchKernel,
15918 /// this state must be re-initialized prior to calling this function. Failure to do so results in undefined behavior.
15919 ///
15920 /// Note:
15921 ///
15922 /// Note that this function may also return error codes from previous, asynchronous launches.
15923 ///
15924 /// **See also:**
15925 ///
15926 /// [`cuFuncSetBlockShape`], [`cuFuncSetSharedSize`], [`cuFuncGetAttribute`], [`cuParamSetSize`], [`cuParamSetf`], [`cuParamSeti`], [`cuParamSetv`], [`cuLaunch`], [`cuLaunchGridAsync`], [`cuLaunchKernel`].
15927 ///
15928 /// # Parameters
15929 ///
15930 /// - `f`: Kernel to launch.
15931 /// - `grid_width`: Width of grid in blocks.
15932 /// - `grid_height`: Height of grid in blocks.
15933 #[deprecated]
15934 pub fn cuLaunchGrid(
15935 f: CUfunction,
15936 grid_width: ::core::ffi::c_int,
15937 grid_height: ::core::ffi::c_int,
15938 ) -> CUresult;
15939}
15940unsafe extern "C" {
15941 /// Launches a CUDA function.
15942 ///
15943 /// f
15944 ///
15945 /// grid_width
15946 ///
15947 /// grid_height
15948 ///
15949 /// [`cuFuncSetBlockShape`]
15950 ///
15951 /// The block shape, dynamic shared memory size, and parameter information must be set using [`cuFuncSetBlockShape`], [`cuFuncSetSharedSize`], [`cuParamSetSize`], [`cuParamSeti`], [`cuParamSetf`], and [`cuParamSetv`] prior to calling this function.
15952 ///
15953 /// Launching a function via [`cuLaunchKernel`] invalidates the function's block shape, dynamic shared memory size, and parameter information. After launching via cuLaunchKernel,
15954 /// this state must be re-initialized prior to calling this function. Failure to do so results in undefined behavior.
15955 ///
15956 /// Note:
15957 ///
15958 /// * In certain cases where cubins are created with no ABI (i.e., using ptxas--abi-compileno), this function may serialize kernel launches. The CUDA driver retains asynchronous behavior by growing the per-thread stack
15959 /// as needed per launch and not shrinking it afterwards.
15960 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
15961 /// * Note that this function may also return error codes from previous, asynchronous launches.
15962 ///
15963 /// **See also:**
15964 ///
15965 /// [`cuFuncSetBlockShape`], [`cuFuncSetSharedSize`], [`cuFuncGetAttribute`], [`cuParamSetSize`], [`cuParamSetf`], [`cuParamSeti`], [`cuParamSetv`], [`cuLaunch`], [`cuLaunchGrid`], [`cuLaunchKernel`].
15966 ///
15967 /// # Parameters
15968 ///
15969 /// - `f`: Kernel to launch.
15970 /// - `grid_width`: Width of grid in blocks.
15971 /// - `grid_height`: Height of grid in blocks.
15972 /// - `hStream`: Stream identifier.
15973 #[deprecated]
15974 pub fn cuLaunchGridAsync(
15975 f: CUfunction,
15976 grid_width: ::core::ffi::c_int,
15977 grid_height: ::core::ffi::c_int,
15978 hStream: CUstream,
15979 ) -> CUresult;
15980}
15981unsafe extern "C" {
15982 /// Launches CUDA functions on multiple devices where thread blocks can cooperate and synchronize as they execute.
15983 ///
15984 /// Invokes kernels as specified in the launchParamsList array where each element of the array specifies all the parameters required to perform a single kernel launch. These kernels
15985 /// can cooperate and synchronize as they execute. The size of the array is specified by numDevices.
15986 ///
15987 /// No two kernels can be launched on the same device. All the devices targeted by this multi-device launch must be identical.
15988 /// All devices must have a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH`].
15989 ///
15990 /// All kernels launched must be identical with respect to the compiled code. Note that any __device__, __constant__ or __managed__
15991 /// variables present in the module that owns the kernel launched on each device, are independently instantiated on every device.
15992 /// It is the application's responsibility to ensure these variables are initialized and used appropriately.
15993 ///
15994 /// The size of the grids as specified in blocks, the size of the blocks themselves and the amount of shared memory used by each
15995 /// thread block must also match across all launched kernels.
15996 ///
15997 /// The streams used to launch these kernels must have been created via either [`cuStreamCreate`] or [`cuStreamCreateWithPriority`]. The NULL stream or `CU_STREAM_LEGACY` or `CU_STREAM_PER_THREAD` cannot be used.
15998 ///
15999 /// The total number of blocks launched per kernel cannot exceed the maximum number of blocks per multiprocessor as returned by
16000 /// [`cuOccupancyMaxActiveBlocksPerMultiprocessor`] (or [`cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags`]) times the number of multiprocessors as specified by the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT`]. Since the total number of blocks launched per device has to match across all devices, the maximum number of blocks that
16001 /// can be launched per device will be limited by the device with the least number of multiprocessors.
16002 ///
16003 /// The kernels cannot make use of CUDA dynamic parallelism.
16004 ///
16005 /// The CUDA_LAUNCH_PARAMS structure is defined as:
16006 ///
16007 /// ```text
16008 /// typedef struct CUDA_LAUNCH_PARAMS_st
16009 /// {
16010 /// CUfunction function;
16011 /// unsigned int gridDimX;
16012 /// unsigned int gridDimY;
16013 /// unsigned int gridDimZ;
16014 /// unsigned int blockDimX;
16015 /// unsigned int blockDimY;
16016 /// unsigned int blockDimZ;
16017 /// unsigned int sharedMemBytes;
16018 /// CUstream hStream;
16019 /// void **kernelParams;
16020 /// } CUDA_LAUNCH_PARAMS;
16021 /// ```
16022 ///
16023 /// where:
16024 ///
16025 /// * [CUDA_LAUNCH_PARAMS::function](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__LAUNCH__PARAMS__v1.html#structCUDA__LAUNCH__PARAMS__v1_1ad25005328ba7debf0f5bd2d39a5363c) specifies the kernel to be launched. All functions must be identical with respect to the compiled code. Note that you can
16026 /// also specify context-less kernel [`CUkernel`] by querying the handle using [`cuLibraryGetKernel`] and then casting to [`CUfunction`]. In this case, the context to launch the kernel on be taken from the specified stream [CUDA_LAUNCH_PARAMS::hStream](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__LAUNCH__PARAMS__v1.html#structCUDA__LAUNCH__PARAMS__v1_1d7b7a742ef397fe918c18bf1f5e63576).
16027 /// * [CUDA_LAUNCH_PARAMS::gridDimX](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__LAUNCH__PARAMS__v1.html#structCUDA__LAUNCH__PARAMS__v1_14328c3a1123bed3c08894d66ae9f0e8f) is the width of the grid in blocks. This must match across all kernels launched.
16028 /// * [CUDA_LAUNCH_PARAMS::gridDimY](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__LAUNCH__PARAMS__v1.html#structCUDA__LAUNCH__PARAMS__v1_175e5d98e55ad9c877acf3511f9e4c6bc) is the height of the grid in blocks. This must match across all kernels launched.
16029 /// * [CUDA_LAUNCH_PARAMS::gridDimZ](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__LAUNCH__PARAMS__v1.html#structCUDA__LAUNCH__PARAMS__v1_16e34c343c3dc355e93f3c47d5c3e3fbe) is the depth of the grid in blocks. This must match across all kernels launched.
16030 /// * [CUDA_LAUNCH_PARAMS::blockDimX](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__LAUNCH__PARAMS__v1.html#structCUDA__LAUNCH__PARAMS__v1_1a31d64be7210f4f21404e89ed3c8bc09) is the X dimension of each thread block. This must match across all kernels launched.
16031 /// * [CUDA_LAUNCH_PARAMS::blockDimX](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__LAUNCH__PARAMS__v1.html#structCUDA__LAUNCH__PARAMS__v1_1a31d64be7210f4f21404e89ed3c8bc09) is the Y dimension of each thread block. This must match across all kernels launched.
16032 /// * [CUDA_LAUNCH_PARAMS::blockDimZ](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__LAUNCH__PARAMS__v1.html#structCUDA__LAUNCH__PARAMS__v1_1e35cc15ae81f10e20fc4c91dbc7356ea) is the Z dimension of each thread block. This must match across all kernels launched.
16033 /// * [CUDA_LAUNCH_PARAMS::sharedMemBytes](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__LAUNCH__PARAMS__v1.html#structCUDA__LAUNCH__PARAMS__v1_113811a872234e77c9903dd977f7c7ac3) is the dynamic shared-memory size per thread block in bytes. This must match across all kernels launched.
16034 /// * [CUDA_LAUNCH_PARAMS::hStream](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__LAUNCH__PARAMS__v1.html#structCUDA__LAUNCH__PARAMS__v1_1d7b7a742ef397fe918c18bf1f5e63576) is the handle to the stream to perform the launch in. This cannot be the NULL stream or `CU_STREAM_LEGACY` or `CU_STREAM_PER_THREAD`. The CUDA context associated with this stream must match that associated with [CUDA_LAUNCH_PARAMS::function](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__LAUNCH__PARAMS__v1.html#structCUDA__LAUNCH__PARAMS__v1_1ad25005328ba7debf0f5bd2d39a5363c).
16035 /// * [CUDA_LAUNCH_PARAMS::kernelParams](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__LAUNCH__PARAMS__v1.html#structCUDA__LAUNCH__PARAMS__v1_16788671fda12351d95398142aa4c3bcd) is an array of pointers to kernel parameters. If [CUDA_LAUNCH_PARAMS::function](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__LAUNCH__PARAMS__v1.html#structCUDA__LAUNCH__PARAMS__v1_1ad25005328ba7debf0f5bd2d39a5363c) has N parameters, then [CUDA_LAUNCH_PARAMS::kernelParams](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__LAUNCH__PARAMS__v1.html#structCUDA__LAUNCH__PARAMS__v1_16788671fda12351d95398142aa4c3bcd) needs to be an array of N pointers. Each of [CUDA_LAUNCH_PARAMS::kernelParams](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__LAUNCH__PARAMS__v1.html#structCUDA__LAUNCH__PARAMS__v1_16788671fda12351d95398142aa4c3bcd)\[0\] through [CUDA_LAUNCH_PARAMS::kernelParams](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__LAUNCH__PARAMS__v1.html#structCUDA__LAUNCH__PARAMS__v1_16788671fda12351d95398142aa4c3bcd)\[N-1\] must point to a region of memory from which the actual kernel parameter will be copied. The number of kernel parameters
16036 /// and their offsets and sizes do not need to be specified as that information is retrieved directly from the kernel's image.
16037 ///
16038 /// By default, the kernel won't begin execution on any GPU until all prior work in all the specified streams has completed. This
16039 /// behavior can be overridden by specifying the flag [`CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_PRE_LAUNCH_SYNC`]. When this flag is specified, each kernel will only wait for prior work in the stream corresponding to that GPU to complete
16040 /// before it begins execution.
16041 ///
16042 /// Similarly, by default, any subsequent work pushed in any of the specified streams will not begin execution until the kernels
16043 /// on all GPUs have completed. This behavior can be overridden by specifying the flag [`CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_POST_LAUNCH_SYNC`]. When this flag is specified, any subsequent work pushed in any of the specified streams will only wait for the kernel launched
16044 /// on the GPU corresponding to that stream to complete before it begins execution.
16045 ///
16046 /// Calling [`cuLaunchCooperativeKernelMultiDevice`] sets persistent function state that is the same as function state set through [`cuLaunchKernel`] API when called individually for each element in launchParamsList.
16047 ///
16048 /// When kernels are launched via [`cuLaunchCooperativeKernelMultiDevice`], the previous block shape, shared size and parameter info associated with each [CUDA_LAUNCH_PARAMS::function](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__LAUNCH__PARAMS__v1.html#structCUDA__LAUNCH__PARAMS__v1_1ad25005328ba7debf0f5bd2d39a5363c) in launchParamsList is overwritten.
16049 ///
16050 /// Note that to use [`cuLaunchCooperativeKernelMultiDevice`], the kernels must either have been compiled with toolchain version 3.2 or later so that it will contain kernel parameter
16051 /// information, or have no kernel parameters. If either of these conditions is not met, then [`cuLaunchCooperativeKernelMultiDevice`] will return [`cudaError_enum::CUDA_ERROR_INVALID_IMAGE`].
16052 ///
16053 /// Note:
16054 ///
16055 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
16056 /// * Note that this function may also return error codes from previous, asynchronous launches.
16057 ///
16058 /// **See also:**
16059 ///
16060 /// [`cuCtxGetCacheConfig`], [`cuCtxSetCacheConfig`], [`cuFuncSetCacheConfig`], [`cuFuncGetAttribute`], [`cuLaunchCooperativeKernel`], cudaLaunchCooperativeKernelMultiDevice.
16061 ///
16062 /// # Parameters
16063 ///
16064 /// - `launchParamsList`: List of launch parameters, one per device.
16065 /// - `numDevices`: Size of the launchParamsList array.
16066 /// - `flags`: Flags to control launch behavior.
16067 #[deprecated]
16068 pub fn cuLaunchCooperativeKernelMultiDevice(
16069 launchParamsList: *mut CUDA_LAUNCH_PARAMS,
16070 numDevices: ::core::ffi::c_uint,
16071 flags: ::core::ffi::c_uint,
16072 ) -> CUresult;
16073}
16074unsafe extern "C" {
16075 /// Adds a texture-reference to the function's argument list.
16076 ///
16077 /// hTexRef
16078 ///
16079 /// [`cuModuleGetTexRef`]
16080 ///
16081 /// texunit
16082 ///
16083 /// [`CU_PARAM_TR_DEFAULT`]
16084 ///
16085 /// Note:
16086 ///
16087 /// Note that this function may also return error codes from previous, asynchronous launches.
16088 ///
16089 /// # Parameters
16090 ///
16091 /// - `hfunc`: Kernel to add texture-reference to.
16092 /// - `texunit`: Texture unit (must be [`CU_PARAM_TR_DEFAULT`]).
16093 /// - `hTexRef`: Texture-reference to add to argument list.
16094 #[deprecated]
16095 pub fn cuParamSetTexRef(
16096 hfunc: CUfunction,
16097 texunit: ::core::ffi::c_int,
16098 hTexRef: CUtexref,
16099 ) -> CUresult;
16100}
16101unsafe extern "C" {
16102 /// Sets the shared memory configuration for a device function.
16103 ///
16104 /// Any per-function setting of shared memory bank size set via [`cuFuncSetSharedMemConfig`] will override the context wide setting set with [`cuCtxSetSharedMemConfig`].
16105 ///
16106 /// Changing the shared memory bank size will not increase shared memory usage or affect occupancy of kernels, but may have major
16107 /// effects on performance. Larger bank sizes will allow for greater potential bandwidth to shared memory, but will change what
16108 /// kinds of accesses to shared memory will result in bank conflicts.
16109 ///
16110 /// This function will do nothing on devices with fixed shared memory bank size.
16111 ///
16112 /// The supported bank configurations are:
16113 ///
16114 /// * [`CUsharedconfig_enum::CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE`]: use the context's shared memory configuration when launching this function.
16115 /// * [`CUsharedconfig_enum::CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE`]: set shared memory bank width to be natively four bytes when launching this function.
16116 /// * [`CUsharedconfig_enum::CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE`]: set shared memory bank width to be natively eight bytes when launching this function.
16117 ///
16118 /// Note:
16119 ///
16120 /// Note that this function may also return error codes from previous, asynchronous launches.
16121 ///
16122 /// **See also:**
16123 ///
16124 /// [`cuCtxGetCacheConfig`], [`cuCtxSetCacheConfig`], [`cuCtxGetSharedMemConfig`], [`cuCtxSetSharedMemConfig`], [`cuFuncGetAttribute`], [`cuLaunchKernel`], [cudaFuncSetSharedMemConfig](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__EXECUTION__DEPRECATED.html#group__CUDART__EXECUTION__DEPRECATED_1gbd189716def6fdb5f819dae77452d30b).
16125 ///
16126 /// # Parameters
16127 ///
16128 /// - `hfunc`: kernel to be given a shared memory config.
16129 /// - `config`: requested shared memory configuration.
16130 #[deprecated]
16131 pub fn cuFuncSetSharedMemConfig(
16132 hfunc: CUfunction,
16133 config: CUsharedconfig,
16134 ) -> CUresult;
16135}
16136unsafe extern "C" {
16137 /// Creates a graph.
16138 ///
16139 /// Creates an empty graph, which is returned via phGraph.
16140 ///
16141 /// Note:
16142 ///
16143 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16144 /// * Note that this function may also return error codes from previous, asynchronous launches.
16145 ///
16146 /// **See also:**
16147 ///
16148 /// [`cuGraphAddChildGraphNode`], [`cuGraphAddEmptyNode`], [`cuGraphAddKernelNode_v2`], [`cuGraphAddHostNode`], [`cuGraphAddMemcpyNode`], [`cuGraphAddMemsetNode`], `cuGraphInstantiate`, [`cuGraphDestroy`], [`cuGraphGetNodes`], [`cuGraphGetRootNodes`], [`cuGraphGetEdges_v2`], [`cuGraphClone`].
16149 ///
16150 /// # Parameters
16151 ///
16152 /// - `phGraph`: Returns newly created graph.
16153 /// - `flags`: Graph creation flags, must be 0.
16154 pub fn cuGraphCreate(phGraph: *mut CUgraph, flags: ::core::ffi::c_uint) -> CUresult;
16155}
16156unsafe extern "C" {
16157 /// Creates a kernel execution node and adds it to a graph.
16158 ///
16159 /// Creates a new kernel execution node and adds it to hGraph with numDependencies dependencies specified via dependencies and arguments specified in nodeParams. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. dependencies may not have any duplicate entries. A handle to the new node will be returned in phGraphNode.
16160 ///
16161 /// The CUDA_KERNEL_NODE_PARAMS structure is defined as:
16162 ///
16163 /// ```text
16164 /// typedef struct CUDA_KERNEL_NODE_PARAMS_st {
16165 /// CUfunction func;
16166 /// unsigned int gridDimX;
16167 /// unsigned int gridDimY;
16168 /// unsigned int gridDimZ;
16169 /// unsigned int blockDimX;
16170 /// unsigned int blockDimY;
16171 /// unsigned int blockDimZ;
16172 /// unsigned int sharedMemBytes;
16173 /// void **kernelParams;
16174 /// void **extra;
16175 /// CUkernel kern;
16176 /// CUcontext ctx;
16177 /// } CUDA_KERNEL_NODE_PARAMS;
16178 /// ```
16179 ///
16180 /// When the graph is launched, the node will invoke kernel func on a (gridDimX x gridDimY x gridDimZ) grid of blocks. Each block contains (blockDimX x blockDimY x blockDimZ) threads.
16181 ///
16182 /// sharedMemBytes sets the amount of dynamic shared memory that will be available to each thread block.
16183 ///
16184 /// Kernel parameters to func can be specified in one of two ways:
16185 ///
16186 /// 1) Kernel parameters can be specified via kernelParams. If the kernel has N parameters, then kernelParams needs to be an array of N pointers. Each pointer, from kernelParams\[0\] to kernelParams\[N-1\], points to the region of memory from which the actual parameter will be copied. The number of kernel parameters and
16187 /// their offsets and sizes do not need to be specified as that information is retrieved directly from the kernel's image.
16188 ///
16189 /// 2) Kernel parameters for non-cooperative kernels can also be packaged by the application into a single buffer that is passed
16190 /// in via extra. This places the burden on the application of knowing each kernel parameter's size and alignment/padding within the buffer.
16191 /// The extra parameter exists to allow this function to take additional less commonly used arguments. extra specifies a list of names of extra settings and their corresponding values. Each extra setting name is immediately followed
16192 /// by the corresponding value. The list must be terminated with either NULL or CU_LAUNCH_PARAM_END.
16193 ///
16194 /// * `CU_LAUNCH_PARAM_END`, which indicates the end of the extra array;
16195 /// * `CU_LAUNCH_PARAM_BUFFER_POINTER`, which specifies that the next value in extra will be a pointer to a buffer containing all the kernel parameters for launching kernel func;
16196 /// * `CU_LAUNCH_PARAM_BUFFER_SIZE`, which specifies that the next value in extra will be a pointer to a size_t containing the size of the buffer specified with `CU_LAUNCH_PARAM_BUFFER_POINTER`;
16197 ///
16198 /// The error [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] will be returned if kernel parameters are specified with both kernelParams and extra (i.e. both kernelParams and extra are non-NULL). [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] will be returned if extra is used for a cooperative kernel.
16199 ///
16200 /// The kernelParams or extra array, as well as the argument values it points to, are copied during this call.
16201 ///
16202 /// Note:
16203 ///
16204 /// Kernels launched using graphs must not use texture and surface references. Reading or writing through any texture or surface
16205 /// reference is undefined behavior. This restriction does not apply to texture and surface objects.
16206 ///
16207 /// Note:
16208 ///
16209 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16210 /// * Note that this function may also return error codes from previous, asynchronous launches.
16211 ///
16212 /// **See also:**
16213 ///
16214 /// [`cuGraphAddNode_v2`], [`cuLaunchKernel`], [`cuLaunchCooperativeKernel`], [`cuGraphKernelNodeGetParams_v2`], [`cuGraphKernelNodeSetParams_v2`], [`cuGraphCreate`], [`cuGraphDestroyNode`], [`cuGraphAddChildGraphNode`], [`cuGraphAddEmptyNode`], [`cuGraphAddHostNode`], [`cuGraphAddMemcpyNode`], [`cuGraphAddMemsetNode`].
16215 ///
16216 /// # Parameters
16217 ///
16218 /// - `phGraphNode`: Returns newly created node.
16219 /// - `hGraph`: Graph to which to add the node.
16220 /// - `dependencies`: Dependencies of the node.
16221 /// - `numDependencies`: Number of dependencies.
16222 /// - `nodeParams`: Parameters for the GPU execution node.
16223 pub fn cuGraphAddKernelNode_v2(
16224 phGraphNode: *mut CUgraphNode,
16225 hGraph: CUgraph,
16226 dependencies: *const CUgraphNode,
16227 numDependencies: size_t,
16228 nodeParams: *const CUDA_KERNEL_NODE_PARAMS,
16229 ) -> CUresult;
16230}
16231unsafe extern "C" {
16232 /// Returns a kernel node's parameters.
16233 ///
16234 /// Returns the parameters of kernel node hNode in nodeParams. The kernelParams or extra array returned in nodeParams, as well as the argument values it points to, are owned by the node. This memory remains valid until the node is destroyed
16235 /// or its parameters are modified, and should not be modified directly. Use [`cuGraphKernelNodeSetParams_v2`] to update the parameters of this node.
16236 ///
16237 /// The params will contain either kernelParams or extra, according to which of these was most recently set on the node.
16238 ///
16239 /// Note:
16240 ///
16241 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16242 /// * Note that this function may also return error codes from previous, asynchronous launches.
16243 ///
16244 /// **See also:**
16245 ///
16246 /// [`cuGraphNodeGetParams`], [`cuLaunchKernel`], [`cuGraphAddKernelNode_v2`], [`cuGraphKernelNodeSetParams_v2`].
16247 ///
16248 /// # Parameters
16249 ///
16250 /// - `hNode`: Node to get the parameters for.
16251 /// - `nodeParams`: Pointer to return the parameters.
16252 pub fn cuGraphKernelNodeGetParams_v2(
16253 hNode: CUgraphNode,
16254 nodeParams: *mut CUDA_KERNEL_NODE_PARAMS,
16255 ) -> CUresult;
16256}
16257unsafe extern "C" {
16258 /// Sets a kernel node's parameters.
16259 ///
16260 /// Sets the parameters of kernel node hNode to nodeParams.
16261 ///
16262 /// Note:
16263 ///
16264 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16265 /// * Note that this function may also return error codes from previous, asynchronous launches.
16266 ///
16267 /// **See also:**
16268 ///
16269 /// [`cuGraphNodeSetParams`], [`cuLaunchKernel`], [`cuGraphAddKernelNode_v2`], [`cuGraphKernelNodeGetParams_v2`].
16270 ///
16271 /// # Parameters
16272 ///
16273 /// - `hNode`: Node to set the parameters for.
16274 /// - `nodeParams`: Parameters to copy.
16275 pub fn cuGraphKernelNodeSetParams_v2(
16276 hNode: CUgraphNode,
16277 nodeParams: *const CUDA_KERNEL_NODE_PARAMS,
16278 ) -> CUresult;
16279}
16280unsafe extern "C" {
16281 /// Creates a memcpy node and adds it to a graph.
16282 ///
16283 /// Creates a new memcpy node and adds it to hGraph with numDependencies dependencies specified via dependencies. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. dependencies may not have any duplicate entries. A handle to the new node will be returned in phGraphNode.
16284 ///
16285 /// When the graph is launched, the node will perform the memcpy described by copyParams. See [`cuMemcpy3D_v2`] for a description of the structure and its restrictions.
16286 ///
16287 /// Memcpy nodes have some additional restrictions with regards to managed memory, if the system contains at least one device
16288 /// which has a zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`]. If one or more of the operands refer to managed memory, then using the memory type [`CUmemorytype_enum::CU_MEMORYTYPE_UNIFIED`] is disallowed for those operand(s). The managed memory will be treated as residing on either the host or the device, depending
16289 /// on which memory type is specified.
16290 ///
16291 /// Note:
16292 ///
16293 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16294 /// * Note that this function may also return error codes from previous, asynchronous launches.
16295 ///
16296 /// **See also:**
16297 ///
16298 /// [`cuGraphAddNode_v2`], [`cuMemcpy3D_v2`], [`cuGraphMemcpyNodeGetParams`], [`cuGraphMemcpyNodeSetParams`], [`cuGraphCreate`], [`cuGraphDestroyNode`], [`cuGraphAddChildGraphNode`], [`cuGraphAddEmptyNode`], [`cuGraphAddKernelNode_v2`], [`cuGraphAddHostNode`], [`cuGraphAddMemsetNode`].
16299 ///
16300 /// # Parameters
16301 ///
16302 /// - `phGraphNode`: Returns newly created node.
16303 /// - `hGraph`: Graph to which to add the node.
16304 /// - `dependencies`: Dependencies of the node.
16305 /// - `numDependencies`: Number of dependencies.
16306 /// - `copyParams`: Parameters for the memory copy.
16307 /// - `ctx`: Context on which to run the node.
16308 pub fn cuGraphAddMemcpyNode(
16309 phGraphNode: *mut CUgraphNode,
16310 hGraph: CUgraph,
16311 dependencies: *const CUgraphNode,
16312 numDependencies: size_t,
16313 copyParams: *const CUDA_MEMCPY3D,
16314 ctx: CUcontext,
16315 ) -> CUresult;
16316}
16317unsafe extern "C" {
16318 /// Returns a memcpy node's parameters.
16319 ///
16320 /// Returns the parameters of memcpy node hNode in nodeParams.
16321 ///
16322 /// Note:
16323 ///
16324 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16325 /// * Note that this function may also return error codes from previous, asynchronous launches.
16326 ///
16327 /// **See also:**
16328 ///
16329 /// [`cuGraphNodeGetParams`], [`cuMemcpy3D_v2`], [`cuGraphAddMemcpyNode`], [`cuGraphMemcpyNodeSetParams`].
16330 ///
16331 /// # Parameters
16332 ///
16333 /// - `hNode`: Node to get the parameters for.
16334 /// - `nodeParams`: Pointer to return the parameters.
16335 pub fn cuGraphMemcpyNodeGetParams(
16336 hNode: CUgraphNode,
16337 nodeParams: *mut CUDA_MEMCPY3D,
16338 ) -> CUresult;
16339}
16340unsafe extern "C" {
16341 /// Sets a memcpy node's parameters.
16342 ///
16343 /// Sets the parameters of memcpy node hNode to nodeParams.
16344 ///
16345 /// Note:
16346 ///
16347 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16348 /// * Note that this function may also return error codes from previous, asynchronous launches.
16349 ///
16350 /// **See also:**
16351 ///
16352 /// [`cuGraphNodeSetParams`], [`cuMemcpy3D_v2`], [`cuGraphAddMemcpyNode`], [`cuGraphMemcpyNodeGetParams`].
16353 ///
16354 /// # Parameters
16355 ///
16356 /// - `hNode`: Node to set the parameters for.
16357 /// - `nodeParams`: Parameters to copy.
16358 pub fn cuGraphMemcpyNodeSetParams(
16359 hNode: CUgraphNode,
16360 nodeParams: *const CUDA_MEMCPY3D,
16361 ) -> CUresult;
16362}
16363unsafe extern "C" {
16364 /// Creates a memset node and adds it to a graph.
16365 ///
16366 /// Creates a new memset node and adds it to hGraph with numDependencies dependencies specified via dependencies. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. dependencies may not have any duplicate entries. A handle to the new node will be returned in phGraphNode.
16367 ///
16368 /// The element size must be 1, 2, or 4 bytes. When the graph is launched, the node will perform the memset described by memsetParams.
16369 ///
16370 /// Note:
16371 ///
16372 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16373 /// * Note that this function may also return error codes from previous, asynchronous launches.
16374 ///
16375 /// **See also:**
16376 ///
16377 /// [`cuGraphAddNode_v2`], [`cuMemsetD2D32_v2`], [`cuGraphMemsetNodeGetParams`], [`cuGraphMemsetNodeSetParams`], [`cuGraphCreate`], [`cuGraphDestroyNode`], [`cuGraphAddChildGraphNode`], [`cuGraphAddEmptyNode`], [`cuGraphAddKernelNode_v2`], [`cuGraphAddHostNode`], [`cuGraphAddMemcpyNode`].
16378 ///
16379 /// # Parameters
16380 ///
16381 /// - `phGraphNode`: Returns newly created node.
16382 /// - `hGraph`: Graph to which to add the node.
16383 /// - `dependencies`: Dependencies of the node.
16384 /// - `numDependencies`: Number of dependencies.
16385 /// - `memsetParams`: Parameters for the memory set.
16386 /// - `ctx`: Context on which to run the node.
16387 pub fn cuGraphAddMemsetNode(
16388 phGraphNode: *mut CUgraphNode,
16389 hGraph: CUgraph,
16390 dependencies: *const CUgraphNode,
16391 numDependencies: size_t,
16392 memsetParams: *const CUDA_MEMSET_NODE_PARAMS,
16393 ctx: CUcontext,
16394 ) -> CUresult;
16395}
16396unsafe extern "C" {
16397 /// Returns a memset node's parameters.
16398 ///
16399 /// Returns the parameters of memset node hNode in nodeParams.
16400 ///
16401 /// Note:
16402 ///
16403 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16404 /// * Note that this function may also return error codes from previous, asynchronous launches.
16405 ///
16406 /// **See also:**
16407 ///
16408 /// [`cuGraphNodeGetParams`], [`cuMemsetD2D32_v2`], [`cuGraphAddMemsetNode`], [`cuGraphMemsetNodeSetParams`].
16409 ///
16410 /// # Parameters
16411 ///
16412 /// - `hNode`: Node to get the parameters for.
16413 /// - `nodeParams`: Pointer to return the parameters.
16414 pub fn cuGraphMemsetNodeGetParams(
16415 hNode: CUgraphNode,
16416 nodeParams: *mut CUDA_MEMSET_NODE_PARAMS,
16417 ) -> CUresult;
16418}
16419unsafe extern "C" {
16420 /// Sets a memset node's parameters.
16421 ///
16422 /// Sets the parameters of memset node hNode to nodeParams.
16423 ///
16424 /// Note:
16425 ///
16426 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16427 /// * Note that this function may also return error codes from previous, asynchronous launches.
16428 ///
16429 /// **See also:**
16430 ///
16431 /// [`cuGraphNodeSetParams`], [`cuMemsetD2D32_v2`], [`cuGraphAddMemsetNode`], [`cuGraphMemsetNodeGetParams`].
16432 ///
16433 /// # Parameters
16434 ///
16435 /// - `hNode`: Node to set the parameters for.
16436 /// - `nodeParams`: Parameters to copy.
16437 pub fn cuGraphMemsetNodeSetParams(
16438 hNode: CUgraphNode,
16439 nodeParams: *const CUDA_MEMSET_NODE_PARAMS,
16440 ) -> CUresult;
16441}
16442unsafe extern "C" {
16443 /// Creates a host execution node and adds it to a graph.
16444 ///
16445 /// Creates a new CPU execution node and adds it to hGraph with numDependencies dependencies specified via dependencies and arguments specified in nodeParams. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. dependencies may not have any duplicate entries. A handle to the new node will be returned in phGraphNode.
16446 ///
16447 /// When the graph is launched, the node will invoke the specified CPU function. Host nodes are not supported under MPS with pre-Volta
16448 /// GPUs.
16449 ///
16450 /// Note:
16451 ///
16452 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16453 /// * Note that this function may also return error codes from previous, asynchronous launches.
16454 ///
16455 /// **See also:**
16456 ///
16457 /// [`cuGraphAddNode_v2`], [`cuLaunchHostFunc`], [`cuGraphHostNodeGetParams`], [`cuGraphHostNodeSetParams`], [`cuGraphCreate`], [`cuGraphDestroyNode`], [`cuGraphAddChildGraphNode`], [`cuGraphAddEmptyNode`], [`cuGraphAddKernelNode_v2`], [`cuGraphAddMemcpyNode`], [`cuGraphAddMemsetNode`].
16458 ///
16459 /// # Parameters
16460 ///
16461 /// - `phGraphNode`: Returns newly created node.
16462 /// - `hGraph`: Graph to which to add the node.
16463 /// - `dependencies`: Dependencies of the node.
16464 /// - `numDependencies`: Number of dependencies.
16465 /// - `nodeParams`: Parameters for the host node.
16466 pub fn cuGraphAddHostNode(
16467 phGraphNode: *mut CUgraphNode,
16468 hGraph: CUgraph,
16469 dependencies: *const CUgraphNode,
16470 numDependencies: size_t,
16471 nodeParams: *const CUDA_HOST_NODE_PARAMS,
16472 ) -> CUresult;
16473}
16474unsafe extern "C" {
16475 /// Returns a host node's parameters.
16476 ///
16477 /// Returns the parameters of host node hNode in nodeParams.
16478 ///
16479 /// Note:
16480 ///
16481 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16482 /// * Note that this function may also return error codes from previous, asynchronous launches.
16483 ///
16484 /// **See also:**
16485 ///
16486 /// [`cuGraphNodeGetParams`], [`cuLaunchHostFunc`], [`cuGraphAddHostNode`], [`cuGraphHostNodeSetParams`].
16487 ///
16488 /// # Parameters
16489 ///
16490 /// - `hNode`: Node to get the parameters for.
16491 /// - `nodeParams`: Pointer to return the parameters.
16492 pub fn cuGraphHostNodeGetParams(
16493 hNode: CUgraphNode,
16494 nodeParams: *mut CUDA_HOST_NODE_PARAMS,
16495 ) -> CUresult;
16496}
16497unsafe extern "C" {
16498 /// Sets a host node's parameters.
16499 ///
16500 /// Sets the parameters of host node hNode to nodeParams.
16501 ///
16502 /// Note:
16503 ///
16504 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16505 /// * Note that this function may also return error codes from previous, asynchronous launches.
16506 ///
16507 /// **See also:**
16508 ///
16509 /// [`cuGraphNodeSetParams`], [`cuLaunchHostFunc`], [`cuGraphAddHostNode`], [`cuGraphHostNodeGetParams`].
16510 ///
16511 /// # Parameters
16512 ///
16513 /// - `hNode`: Node to set the parameters for.
16514 /// - `nodeParams`: Parameters to copy.
16515 pub fn cuGraphHostNodeSetParams(
16516 hNode: CUgraphNode,
16517 nodeParams: *const CUDA_HOST_NODE_PARAMS,
16518 ) -> CUresult;
16519}
16520unsafe extern "C" {
16521 /// Creates a child graph node and adds it to a graph.
16522 ///
16523 /// Creates a new node which executes an embedded graph, and adds it to hGraph with numDependencies dependencies specified via dependencies. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. dependencies may not have any duplicate entries. A handle to the new node will be returned in phGraphNode.
16524 ///
16525 /// If childGraph contains allocation nodes, free nodes, or conditional nodes, this call will return an error.
16526 ///
16527 /// The node executes an embedded child graph. The child graph is cloned in this call.
16528 ///
16529 /// Note:
16530 ///
16531 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16532 /// * Note that this function may also return error codes from previous, asynchronous launches.
16533 ///
16534 /// **See also:**
16535 ///
16536 /// [`cuGraphAddNode_v2`], [`cuGraphChildGraphNodeGetGraph`], [`cuGraphCreate`], [`cuGraphDestroyNode`], [`cuGraphAddEmptyNode`], [`cuGraphAddKernelNode_v2`], [`cuGraphAddHostNode`], [`cuGraphAddMemcpyNode`], [`cuGraphAddMemsetNode`], [`cuGraphClone`].
16537 ///
16538 /// # Parameters
16539 ///
16540 /// - `phGraphNode`: Returns newly created node.
16541 /// - `hGraph`: Graph to which to add the node.
16542 /// - `dependencies`: Dependencies of the node.
16543 /// - `numDependencies`: Number of dependencies.
16544 /// - `childGraph`: The graph to clone into this node.
16545 pub fn cuGraphAddChildGraphNode(
16546 phGraphNode: *mut CUgraphNode,
16547 hGraph: CUgraph,
16548 dependencies: *const CUgraphNode,
16549 numDependencies: size_t,
16550 childGraph: CUgraph,
16551 ) -> CUresult;
16552}
16553unsafe extern "C" {
16554 /// Gets a handle to the embedded graph of a child graph node.
16555 ///
16556 /// Gets a handle to the embedded graph in a child graph node. This call does not clone the graph. Changes to the graph will be
16557 /// reflected in the node, and the node retains ownership of the graph.
16558 ///
16559 /// Allocation and free nodes cannot be added to the returned graph. Attempting to do so will return an error.
16560 ///
16561 /// Note:
16562 ///
16563 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16564 /// * Note that this function may also return error codes from previous, asynchronous launches.
16565 ///
16566 /// **See also:**
16567 ///
16568 /// [`cuGraphAddChildGraphNode`], [`cuGraphNodeFindInClone`].
16569 ///
16570 /// # Parameters
16571 ///
16572 /// - `hNode`: Node to get the embedded graph for.
16573 /// - `phGraph`: Location to store a handle to the graph.
16574 pub fn cuGraphChildGraphNodeGetGraph(
16575 hNode: CUgraphNode,
16576 phGraph: *mut CUgraph,
16577 ) -> CUresult;
16578}
16579unsafe extern "C" {
16580 /// Creates an empty node and adds it to a graph.
16581 ///
16582 /// Creates a new node which performs no operation, and adds it to hGraph with numDependencies dependencies specified via dependencies. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. dependencies may not have any duplicate entries. A handle to the new node will be returned in phGraphNode.
16583 ///
16584 /// An empty node performs no operation during execution, but can be used for transitive ordering. For example, a phased execution
16585 /// graph with 2 groups of n nodes with a barrier between them can be represented using an empty node and 2\*n dependency edges,
16586 /// rather than no empty node and n^2 dependency edges.
16587 ///
16588 /// Note:
16589 ///
16590 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16591 /// * Note that this function may also return error codes from previous, asynchronous launches.
16592 ///
16593 /// **See also:**
16594 ///
16595 /// [`cuGraphAddNode_v2`], [`cuGraphCreate`], [`cuGraphDestroyNode`], [`cuGraphAddChildGraphNode`], [`cuGraphAddKernelNode_v2`], [`cuGraphAddHostNode`], [`cuGraphAddMemcpyNode`], [`cuGraphAddMemsetNode`].
16596 ///
16597 /// # Parameters
16598 ///
16599 /// - `phGraphNode`: Returns newly created node.
16600 /// - `hGraph`: Graph to which to add the node.
16601 /// - `dependencies`: Dependencies of the node.
16602 /// - `numDependencies`: Number of dependencies.
16603 pub fn cuGraphAddEmptyNode(
16604 phGraphNode: *mut CUgraphNode,
16605 hGraph: CUgraph,
16606 dependencies: *const CUgraphNode,
16607 numDependencies: size_t,
16608 ) -> CUresult;
16609}
16610unsafe extern "C" {
16611 /// Creates an event record node and adds it to a graph.
16612 ///
16613 /// Creates a new event record node and adds it to hGraph with numDependencies dependencies specified via dependencies and event specified in event. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. dependencies may not have any duplicate entries. A handle to the new node will be returned in phGraphNode.
16614 ///
16615 /// Each launch of the graph will record event to capture execution of the node's dependencies.
16616 ///
16617 /// Note:
16618 ///
16619 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16620 /// * Note that this function may also return error codes from previous, asynchronous launches.
16621 ///
16622 /// **See also:**
16623 ///
16624 /// [`cuGraphAddNode_v2`], [`cuGraphAddEventWaitNode`], [`cuEventRecordWithFlags`], [`cuStreamWaitEvent`], [`cuGraphCreate`], [`cuGraphDestroyNode`], [`cuGraphAddChildGraphNode`], [`cuGraphAddEmptyNode`], [`cuGraphAddKernelNode_v2`], [`cuGraphAddMemcpyNode`], [`cuGraphAddMemsetNode`].
16625 ///
16626 /// # Parameters
16627 ///
16628 /// - `phGraphNode`: Returns newly created node.
16629 /// - `hGraph`: Graph to which to add the node.
16630 /// - `dependencies`: Dependencies of the node.
16631 /// - `numDependencies`: Number of dependencies.
16632 /// - `event`: Event for the node.
16633 pub fn cuGraphAddEventRecordNode(
16634 phGraphNode: *mut CUgraphNode,
16635 hGraph: CUgraph,
16636 dependencies: *const CUgraphNode,
16637 numDependencies: size_t,
16638 event: CUevent,
16639 ) -> CUresult;
16640}
16641unsafe extern "C" {
16642 /// Returns the event associated with an event record node.
16643 ///
16644 /// Returns the event of event record node hNode in event_out.
16645 ///
16646 /// Note:
16647 ///
16648 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16649 /// * Note that this function may also return error codes from previous, asynchronous launches.
16650 ///
16651 /// **See also:**
16652 ///
16653 /// [`cuGraphAddEventRecordNode`], [`cuGraphEventRecordNodeSetEvent`], [`cuGraphEventWaitNodeGetEvent`], [`cuEventRecordWithFlags`], [`cuStreamWaitEvent`].
16654 ///
16655 /// # Parameters
16656 ///
16657 /// - `hNode`: Node to get the event for.
16658 /// - `event_out`: Pointer to return the event.
16659 pub fn cuGraphEventRecordNodeGetEvent(
16660 hNode: CUgraphNode,
16661 event_out: *mut CUevent,
16662 ) -> CUresult;
16663}
16664unsafe extern "C" {
16665 /// Sets an event record node's event.
16666 ///
16667 /// Sets the event of event record node hNode to event.
16668 ///
16669 /// Note:
16670 ///
16671 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16672 /// * Note that this function may also return error codes from previous, asynchronous launches.
16673 ///
16674 /// **See also:**
16675 ///
16676 /// [`cuGraphNodeSetParams`], [`cuGraphAddEventRecordNode`], [`cuGraphEventRecordNodeGetEvent`], [`cuGraphEventWaitNodeSetEvent`], [`cuEventRecordWithFlags`], [`cuStreamWaitEvent`].
16677 ///
16678 /// # Parameters
16679 ///
16680 /// - `hNode`: Node to set the event for.
16681 /// - `event`: Event to use.
16682 pub fn cuGraphEventRecordNodeSetEvent(
16683 hNode: CUgraphNode,
16684 event: CUevent,
16685 ) -> CUresult;
16686}
16687unsafe extern "C" {
16688 /// Creates an event wait node and adds it to a graph.
16689 ///
16690 /// Creates a new event wait node and adds it to hGraph with numDependencies dependencies specified via dependencies and event specified in event. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. dependencies may not have any duplicate entries. A handle to the new node will be returned in phGraphNode.
16691 ///
16692 /// The graph node will wait for all work captured in event. See [`cuEventRecord`] for details on what is captured by an event. event may be from a different context or device than the launch stream.
16693 ///
16694 /// Note:
16695 ///
16696 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16697 /// * Note that this function may also return error codes from previous, asynchronous launches.
16698 ///
16699 /// **See also:**
16700 ///
16701 /// [`cuGraphAddNode_v2`], [`cuGraphAddEventRecordNode`], [`cuEventRecordWithFlags`], [`cuStreamWaitEvent`], [`cuGraphCreate`], [`cuGraphDestroyNode`], [`cuGraphAddChildGraphNode`], [`cuGraphAddEmptyNode`], [`cuGraphAddKernelNode_v2`], [`cuGraphAddMemcpyNode`], [`cuGraphAddMemsetNode`].
16702 ///
16703 /// # Parameters
16704 ///
16705 /// - `phGraphNode`: Returns newly created node.
16706 /// - `hGraph`: Graph to which to add the node.
16707 /// - `dependencies`: Dependencies of the node.
16708 /// - `numDependencies`: Number of dependencies.
16709 /// - `event`: Event for the node.
16710 pub fn cuGraphAddEventWaitNode(
16711 phGraphNode: *mut CUgraphNode,
16712 hGraph: CUgraph,
16713 dependencies: *const CUgraphNode,
16714 numDependencies: size_t,
16715 event: CUevent,
16716 ) -> CUresult;
16717}
16718unsafe extern "C" {
16719 /// Returns the event associated with an event wait node.
16720 ///
16721 /// Returns the event of event wait node hNode in event_out.
16722 ///
16723 /// Note:
16724 ///
16725 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16726 /// * Note that this function may also return error codes from previous, asynchronous launches.
16727 ///
16728 /// **See also:**
16729 ///
16730 /// [`cuGraphAddEventWaitNode`], [`cuGraphEventWaitNodeSetEvent`], [`cuGraphEventRecordNodeGetEvent`], [`cuEventRecordWithFlags`], [`cuStreamWaitEvent`].
16731 ///
16732 /// # Parameters
16733 ///
16734 /// - `hNode`: Node to get the event for.
16735 /// - `event_out`: Pointer to return the event.
16736 pub fn cuGraphEventWaitNodeGetEvent(
16737 hNode: CUgraphNode,
16738 event_out: *mut CUevent,
16739 ) -> CUresult;
16740}
16741unsafe extern "C" {
16742 /// Sets an event wait node's event.
16743 ///
16744 /// Sets the event of event wait node hNode to event.
16745 ///
16746 /// Note:
16747 ///
16748 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16749 /// * Note that this function may also return error codes from previous, asynchronous launches.
16750 ///
16751 /// **See also:**
16752 ///
16753 /// [`cuGraphNodeSetParams`], [`cuGraphAddEventWaitNode`], [`cuGraphEventWaitNodeGetEvent`], [`cuGraphEventRecordNodeSetEvent`], [`cuEventRecordWithFlags`], [`cuStreamWaitEvent`].
16754 ///
16755 /// # Parameters
16756 ///
16757 /// - `hNode`: Node to set the event for.
16758 /// - `event`: Event to use.
16759 pub fn cuGraphEventWaitNodeSetEvent(hNode: CUgraphNode, event: CUevent) -> CUresult;
16760}
16761unsafe extern "C" {
16762 /// Creates an external semaphore signal node and adds it to a graph.
16763 ///
16764 /// Creates a new external semaphore signal node and adds it to hGraph with numDependencies dependencies specified via dependencies and arguments specified in nodeParams. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. dependencies may not have any duplicate entries. A handle to the new node will be returned in phGraphNode.
16765 ///
16766 /// Performs a signal operation on a set of externally allocated semaphore objects when the node is launched. The operation(s)
16767 /// will occur after all of the node's dependencies have completed.
16768 ///
16769 /// Note:
16770 ///
16771 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16772 /// * Note that this function may also return error codes from previous, asynchronous launches.
16773 ///
16774 /// **See also:**
16775 ///
16776 /// [`cuGraphAddNode_v2`], [`cuGraphExternalSemaphoresSignalNodeGetParams`], [`cuGraphExternalSemaphoresSignalNodeSetParams`], [`cuGraphExecExternalSemaphoresSignalNodeSetParams`], [`cuGraphAddExternalSemaphoresWaitNode`], [`cuImportExternalSemaphore`], [`cuSignalExternalSemaphoresAsync`], [`cuWaitExternalSemaphoresAsync`], [`cuGraphCreate`], [`cuGraphDestroyNode`], [`cuGraphAddEventRecordNode`], [`cuGraphAddEventWaitNode`], [`cuGraphAddChildGraphNode`], [`cuGraphAddEmptyNode`], [`cuGraphAddKernelNode_v2`], [`cuGraphAddMemcpyNode`], [`cuGraphAddMemsetNode`].
16777 ///
16778 /// # Parameters
16779 ///
16780 /// - `phGraphNode`: Returns newly created node.
16781 /// - `hGraph`: Graph to which to add the node.
16782 /// - `dependencies`: Dependencies of the node.
16783 /// - `numDependencies`: Number of dependencies.
16784 /// - `nodeParams`: Parameters for the node.
16785 pub fn cuGraphAddExternalSemaphoresSignalNode(
16786 phGraphNode: *mut CUgraphNode,
16787 hGraph: CUgraph,
16788 dependencies: *const CUgraphNode,
16789 numDependencies: size_t,
16790 nodeParams: *const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS,
16791 ) -> CUresult;
16792}
16793unsafe extern "C" {
16794 /// Returns an external semaphore signal node's parameters.
16795 ///
16796 /// Returns the parameters of an external semaphore signal node hNode in params_out. The extSemArray and paramsArray returned in params_out, are owned by the node. This memory remains valid until the node is destroyed or its parameters are modified, and should
16797 /// not be modified directly. Use [`cuGraphExternalSemaphoresSignalNodeSetParams`] to update the parameters of this node.
16798 ///
16799 /// Note:
16800 ///
16801 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16802 /// * Note that this function may also return error codes from previous, asynchronous launches.
16803 ///
16804 /// **See also:**
16805 ///
16806 /// [`cuGraphNodeGetParams`], [`cuLaunchKernel`], [`cuGraphAddExternalSemaphoresSignalNode`], [`cuGraphExternalSemaphoresSignalNodeSetParams`], [`cuGraphAddExternalSemaphoresWaitNode`], [`cuSignalExternalSemaphoresAsync`], [`cuWaitExternalSemaphoresAsync`].
16807 ///
16808 /// # Parameters
16809 ///
16810 /// - `hNode`: Node to get the parameters for.
16811 /// - `params_out`: Pointer to return the parameters.
16812 pub fn cuGraphExternalSemaphoresSignalNodeGetParams(
16813 hNode: CUgraphNode,
16814 params_out: *mut CUDA_EXT_SEM_SIGNAL_NODE_PARAMS,
16815 ) -> CUresult;
16816}
16817unsafe extern "C" {
16818 /// Sets an external semaphore signal node's parameters.
16819 ///
16820 /// Sets the parameters of an external semaphore signal node hNode to nodeParams.
16821 ///
16822 /// Note:
16823 ///
16824 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16825 /// * Note that this function may also return error codes from previous, asynchronous launches.
16826 ///
16827 /// **See also:**
16828 ///
16829 /// [`cuGraphNodeSetParams`], [`cuGraphAddExternalSemaphoresSignalNode`], [`cuGraphExternalSemaphoresSignalNodeSetParams`], [`cuGraphAddExternalSemaphoresWaitNode`], [`cuSignalExternalSemaphoresAsync`], [`cuWaitExternalSemaphoresAsync`].
16830 ///
16831 /// # Parameters
16832 ///
16833 /// - `hNode`: Node to set the parameters for.
16834 /// - `nodeParams`: Parameters to copy.
16835 pub fn cuGraphExternalSemaphoresSignalNodeSetParams(
16836 hNode: CUgraphNode,
16837 nodeParams: *const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS,
16838 ) -> CUresult;
16839}
16840unsafe extern "C" {
16841 /// Creates an external semaphore wait node and adds it to a graph.
16842 ///
16843 /// Creates a new external semaphore wait node and adds it to hGraph with numDependencies dependencies specified via dependencies and arguments specified in nodeParams. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. dependencies may not have any duplicate entries. A handle to the new node will be returned in phGraphNode.
16844 ///
16845 /// Performs a wait operation on a set of externally allocated semaphore objects when the node is launched. The node's dependencies
16846 /// will not be launched until the wait operation has completed.
16847 ///
16848 /// Note:
16849 ///
16850 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16851 /// * Note that this function may also return error codes from previous, asynchronous launches.
16852 ///
16853 /// **See also:**
16854 ///
16855 /// [`cuGraphAddNode_v2`], [`cuGraphExternalSemaphoresWaitNodeGetParams`], [`cuGraphExternalSemaphoresWaitNodeSetParams`], [`cuGraphExecExternalSemaphoresWaitNodeSetParams`], [`cuGraphAddExternalSemaphoresSignalNode`], [`cuImportExternalSemaphore`], [`cuSignalExternalSemaphoresAsync`], [`cuWaitExternalSemaphoresAsync`], [`cuGraphCreate`], [`cuGraphDestroyNode`], [`cuGraphAddEventRecordNode`], [`cuGraphAddEventWaitNode`], [`cuGraphAddChildGraphNode`], [`cuGraphAddEmptyNode`], [`cuGraphAddKernelNode_v2`], [`cuGraphAddMemcpyNode`], [`cuGraphAddMemsetNode`].
16856 ///
16857 /// # Parameters
16858 ///
16859 /// - `phGraphNode`: Returns newly created node.
16860 /// - `hGraph`: Graph to which to add the node.
16861 /// - `dependencies`: Dependencies of the node.
16862 /// - `numDependencies`: Number of dependencies.
16863 /// - `nodeParams`: Parameters for the node.
16864 pub fn cuGraphAddExternalSemaphoresWaitNode(
16865 phGraphNode: *mut CUgraphNode,
16866 hGraph: CUgraph,
16867 dependencies: *const CUgraphNode,
16868 numDependencies: size_t,
16869 nodeParams: *const CUDA_EXT_SEM_WAIT_NODE_PARAMS,
16870 ) -> CUresult;
16871}
16872unsafe extern "C" {
16873 /// Returns an external semaphore wait node's parameters.
16874 ///
16875 /// Returns the parameters of an external semaphore wait node hNode in params_out. The extSemArray and paramsArray returned in params_out, are owned by the node. This memory remains valid until the node is destroyed or its parameters are modified, and should
16876 /// not be modified directly. Use [`cuGraphExternalSemaphoresSignalNodeSetParams`] to update the parameters of this node.
16877 ///
16878 /// Note:
16879 ///
16880 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16881 /// * Note that this function may also return error codes from previous, asynchronous launches.
16882 ///
16883 /// **See also:**
16884 ///
16885 /// [`cuGraphNodeGetParams`], [`cuLaunchKernel`], [`cuGraphAddExternalSemaphoresWaitNode`], [`cuGraphExternalSemaphoresWaitNodeSetParams`], [`cuGraphAddExternalSemaphoresWaitNode`], [`cuSignalExternalSemaphoresAsync`], [`cuWaitExternalSemaphoresAsync`].
16886 ///
16887 /// # Parameters
16888 ///
16889 /// - `hNode`: Node to get the parameters for.
16890 /// - `params_out`: Pointer to return the parameters.
16891 pub fn cuGraphExternalSemaphoresWaitNodeGetParams(
16892 hNode: CUgraphNode,
16893 params_out: *mut CUDA_EXT_SEM_WAIT_NODE_PARAMS,
16894 ) -> CUresult;
16895}
16896unsafe extern "C" {
16897 /// Sets an external semaphore wait node's parameters.
16898 ///
16899 /// Sets the parameters of an external semaphore wait node hNode to nodeParams.
16900 ///
16901 /// Note:
16902 ///
16903 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16904 /// * Note that this function may also return error codes from previous, asynchronous launches.
16905 ///
16906 /// **See also:**
16907 ///
16908 /// [`cuGraphNodeSetParams`], [`cuGraphAddExternalSemaphoresWaitNode`], [`cuGraphExternalSemaphoresWaitNodeSetParams`], [`cuGraphAddExternalSemaphoresWaitNode`], [`cuSignalExternalSemaphoresAsync`], [`cuWaitExternalSemaphoresAsync`].
16909 ///
16910 /// # Parameters
16911 ///
16912 /// - `hNode`: Node to set the parameters for.
16913 /// - `nodeParams`: Parameters to copy.
16914 pub fn cuGraphExternalSemaphoresWaitNodeSetParams(
16915 hNode: CUgraphNode,
16916 nodeParams: *const CUDA_EXT_SEM_WAIT_NODE_PARAMS,
16917 ) -> CUresult;
16918}
16919unsafe extern "C" {
16920 /// Creates a batch memory operation node and adds it to a graph.
16921 ///
16922 /// Creates a new batch memory operation node and adds it to hGraph with numDependencies dependencies specified via dependencies and arguments specified in nodeParams. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. dependencies may not have any duplicate entries. A handle to the new node will be returned in phGraphNode.
16923 ///
16924 /// When the node is added, the paramArray inside nodeParams is copied and therefore it can be freed after the call returns.
16925 ///
16926 /// Note:
16927 ///
16928 /// Warning: Improper use of this API may deadlock the application. Synchronization ordering established through this API is not
16929 /// visible to CUDA. CUDA tasks that are (even indirectly) ordered by this API should also have that order expressed with CUDA-visible
16930 /// dependencies such as events. This ensures that the scheduler does not serialize them in an improper order.
16931 ///
16932 /// Note:
16933 ///
16934 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16935 /// * Note that this function may also return error codes from previous, asynchronous launches.
16936 ///
16937 /// **See also:**
16938 ///
16939 /// [`cuGraphAddNode_v2`], [`cuStreamBatchMemOp_v2`], [`cuStreamWaitValue32_v2`], [`cuStreamWriteValue32_v2`], [`cuStreamWaitValue64_v2`], [`cuStreamWriteValue64_v2`], [`cuGraphBatchMemOpNodeGetParams`], [`cuGraphBatchMemOpNodeSetParams`], [`cuGraphCreate`], [`cuGraphDestroyNode`], [`cuGraphAddChildGraphNode`], [`cuGraphAddEmptyNode`], [`cuGraphAddKernelNode_v2`], [`cuGraphAddMemcpyNode`], [`cuGraphAddMemsetNode`].
16940 ///
16941 /// # Parameters
16942 ///
16943 /// - `phGraphNode`: Returns newly created node.
16944 /// - `hGraph`: Graph to which to add the node.
16945 /// - `dependencies`: Dependencies of the node.
16946 /// - `numDependencies`: Number of dependencies.
16947 /// - `nodeParams`: Parameters for the node.
16948 pub fn cuGraphAddBatchMemOpNode(
16949 phGraphNode: *mut CUgraphNode,
16950 hGraph: CUgraph,
16951 dependencies: *const CUgraphNode,
16952 numDependencies: size_t,
16953 nodeParams: *const CUDA_BATCH_MEM_OP_NODE_PARAMS,
16954 ) -> CUresult;
16955}
16956unsafe extern "C" {
16957 /// Returns a batch mem op node's parameters.
16958 ///
16959 /// Returns the parameters of batch mem op node hNode in nodeParams_out. The paramArray returned in nodeParams_out is owned by the node. This memory remains valid until the node is destroyed or its parameters are modified, and should not
16960 /// be modified directly. Use [`cuGraphBatchMemOpNodeSetParams`] to update the parameters of this node.
16961 ///
16962 /// Note:
16963 ///
16964 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16965 /// * Note that this function may also return error codes from previous, asynchronous launches.
16966 ///
16967 /// **See also:**
16968 ///
16969 /// [`cuGraphNodeGetParams`], [`cuStreamBatchMemOp_v2`], [`cuGraphAddBatchMemOpNode`], [`cuGraphBatchMemOpNodeSetParams`].
16970 ///
16971 /// # Parameters
16972 ///
16973 /// - `hNode`: Node to get the parameters for.
16974 /// - `nodeParams_out`: Pointer to return the parameters.
16975 pub fn cuGraphBatchMemOpNodeGetParams(
16976 hNode: CUgraphNode,
16977 nodeParams_out: *mut CUDA_BATCH_MEM_OP_NODE_PARAMS,
16978 ) -> CUresult;
16979}
16980unsafe extern "C" {
16981 /// Sets a batch mem op node's parameters.
16982 ///
16983 /// Sets the parameters of batch mem op node hNode to nodeParams.
16984 ///
16985 /// The paramArray inside nodeParams is copied and therefore it can be freed after the call returns.
16986 ///
16987 /// Note:
16988 ///
16989 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
16990 /// * Note that this function may also return error codes from previous, asynchronous launches.
16991 ///
16992 /// **See also:**
16993 ///
16994 /// [`cuGraphNodeSetParams`], [`cuStreamBatchMemOp_v2`], [`cuGraphAddBatchMemOpNode`], [`cuGraphBatchMemOpNodeGetParams`].
16995 ///
16996 /// # Parameters
16997 ///
16998 /// - `hNode`: Node to set the parameters for.
16999 /// - `nodeParams`: Parameters to copy.
17000 pub fn cuGraphBatchMemOpNodeSetParams(
17001 hNode: CUgraphNode,
17002 nodeParams: *const CUDA_BATCH_MEM_OP_NODE_PARAMS,
17003 ) -> CUresult;
17004}
17005unsafe extern "C" {
17006 /// Sets the parameters for a batch mem op node in the given graphExec.
17007 ///
17008 /// Sets the parameters of a batch mem op node in an executable graph hGraphExec. The node is identified by the corresponding node hNode in the non-executable graph, from which the executable graph was instantiated.
17009 ///
17010 /// The following fields on operations may be modified on an executable graph:
17011 ///
17012 /// op.waitValue.address op.waitValue.value\[64\] op.waitValue.flags bits corresponding to wait type (i.e. [`CUstreamWaitValue_flags::CU_STREAM_WAIT_VALUE_FLUSH`]
17013 /// bit cannot be modified) op.writeValue.address op.writeValue.value\[64\]
17014 ///
17015 /// Other fields, such as the context, count or type of operations, and other types of operations such as membars, may not be
17016 /// modified.
17017 ///
17018 /// hNode must not have been removed from the original graph.
17019 ///
17020 /// The modifications only affect future launches of hGraphExec. Already enqueued or running launches of hGraphExec are not affected by this call. hNode is also not modified by this call.
17021 ///
17022 /// The paramArray inside nodeParams is copied and therefore it can be freed after the call returns.
17023 ///
17024 /// Note:
17025 ///
17026 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17027 /// * Note that this function may also return error codes from previous, asynchronous launches.
17028 ///
17029 /// **See also:**
17030 ///
17031 /// [`cuGraphExecNodeSetParams`], [`cuStreamBatchMemOp_v2`], [`cuGraphAddBatchMemOpNode`], [`cuGraphBatchMemOpNodeGetParams`], [`cuGraphBatchMemOpNodeSetParams`], `cuGraphInstantiate`.
17032 ///
17033 /// # Parameters
17034 ///
17035 /// - `hGraphExec`: The executable graph in which to set the specified node.
17036 /// - `hNode`: Batch mem op node from the graph from which graphExec was instantiated.
17037 /// - `nodeParams`: Updated Parameters to set.
17038 pub fn cuGraphExecBatchMemOpNodeSetParams(
17039 hGraphExec: CUgraphExec,
17040 hNode: CUgraphNode,
17041 nodeParams: *const CUDA_BATCH_MEM_OP_NODE_PARAMS,
17042 ) -> CUresult;
17043}
17044unsafe extern "C" {
17045 /// Creates an allocation node and adds it to a graph.
17046 ///
17047 /// Creates a new allocation node and adds it to hGraph with numDependencies dependencies specified via dependencies and arguments specified in nodeParams. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. dependencies may not have any duplicate entries. A handle to the new node will be returned in phGraphNode.
17048 ///
17049 /// When [`cuGraphAddMemAllocNode`] creates an allocation node, it returns the address of the allocation in nodeParams.dptr. The allocation's address remains fixed across instantiations and launches.
17050 ///
17051 /// If the allocation is freed in the same graph, by creating a free node using [`cuGraphAddMemFreeNode`], the allocation can be accessed by nodes ordered after the allocation node but before the free node. These allocations cannot
17052 /// be freed outside the owning graph, and they can only be freed once in the owning graph.
17053 ///
17054 /// If the allocation is not freed in the same graph, then it can be accessed not only by nodes in the graph which are ordered
17055 /// after the allocation node, but also by stream operations ordered after the graph's execution but before the allocation is
17056 /// freed.
17057 ///
17058 /// Allocations which are not freed in the same graph can be freed by:
17059 ///
17060 /// * passing the allocation to [`cuMemFreeAsync`] or [`cuMemFree_v2`];
17061 /// * launching a graph with a free node for that allocation; or
17062 /// * specifying [`CUgraphInstantiate_flags_enum::CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH`] during instantiation, which makes each launch behave as though it called [`cuMemFreeAsync`] for every unfreed allocation.
17063 ///
17064 /// It is not possible to free an allocation in both the owning graph and another graph. If the allocation is freed in the same
17065 /// graph, a free node cannot be added to another graph. If the allocation is freed in another graph, a free node can no longer
17066 /// be added to the owning graph.
17067 ///
17068 /// The following restrictions apply to graphs which contain allocation and/or memory free nodes:
17069 ///
17070 /// * Nodes and edges of the graph cannot be deleted.
17071 /// * The graph can only be used in a child node if the ownership is moved to the parent.
17072 /// * Only one instantiation of the graph may exist at any point in time.
17073 /// * The graph cannot be cloned.
17074 ///
17075 /// Note:
17076 ///
17077 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17078 /// * Note that this function may also return error codes from previous, asynchronous launches.
17079 ///
17080 /// **See also:**
17081 ///
17082 /// [`cuGraphAddNode_v2`], [`cuGraphAddMemFreeNode`], [`cuGraphMemAllocNodeGetParams`], [`cuDeviceGraphMemTrim`], [`cuDeviceGetGraphMemAttribute`], [`cuDeviceSetGraphMemAttribute`], [`cuMemAllocAsync`], [`cuMemFreeAsync`], [`cuGraphCreate`], [`cuGraphDestroyNode`], [`cuGraphAddChildGraphNode`], [`cuGraphAddEmptyNode`], [`cuGraphAddEventRecordNode`], [`cuGraphAddEventWaitNode`], [`cuGraphAddExternalSemaphoresSignalNode`], [`cuGraphAddExternalSemaphoresWaitNode`], [`cuGraphAddKernelNode_v2`], [`cuGraphAddMemcpyNode`], [`cuGraphAddMemsetNode`].
17083 ///
17084 /// # Parameters
17085 ///
17086 /// - `phGraphNode`: Returns newly created node.
17087 /// - `hGraph`: Graph to which to add the node.
17088 /// - `dependencies`: Dependencies of the node.
17089 /// - `numDependencies`: Number of dependencies.
17090 /// - `nodeParams`: Parameters for the node.
17091 pub fn cuGraphAddMemAllocNode(
17092 phGraphNode: *mut CUgraphNode,
17093 hGraph: CUgraph,
17094 dependencies: *const CUgraphNode,
17095 numDependencies: size_t,
17096 nodeParams: *mut CUDA_MEM_ALLOC_NODE_PARAMS,
17097 ) -> CUresult;
17098}
17099unsafe extern "C" {
17100 /// Returns a memory alloc node's parameters.
17101 ///
17102 /// Returns the parameters of a memory alloc node hNode in params_out. The poolProps and accessDescs returned in params_out, are owned by the node. This memory remains valid until the node is destroyed. The returned parameters must not be modified.
17103 ///
17104 /// Note:
17105 ///
17106 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17107 /// * Note that this function may also return error codes from previous, asynchronous launches.
17108 ///
17109 /// **See also:**
17110 ///
17111 /// [`cuGraphNodeGetParams`], [`cuGraphAddMemAllocNode`], [`cuGraphMemFreeNodeGetParams`].
17112 ///
17113 /// # Parameters
17114 ///
17115 /// - `hNode`: Node to get the parameters for.
17116 /// - `params_out`: Pointer to return the parameters.
17117 pub fn cuGraphMemAllocNodeGetParams(
17118 hNode: CUgraphNode,
17119 params_out: *mut CUDA_MEM_ALLOC_NODE_PARAMS,
17120 ) -> CUresult;
17121}
17122unsafe extern "C" {
17123 /// Creates a memory free node and adds it to a graph.
17124 ///
17125 /// Creates a new memory free node and adds it to hGraph with numDependencies dependencies specified via dependencies and arguments specified in nodeParams. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. dependencies may not have any duplicate entries. A handle to the new node will be returned in phGraphNode.
17126 ///
17127 /// [`cuGraphAddMemFreeNode`] will return [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] if the user attempts to free:
17128 ///
17129 /// * an allocation twice in the same graph.
17130 /// * an address that was not returned by an allocation node.
17131 /// * an invalid address.
17132 ///
17133 /// The following restrictions apply to graphs which contain allocation and/or memory free nodes:
17134 ///
17135 /// * Nodes and edges of the graph cannot be deleted.
17136 /// * The graph can only be used in a child node if the ownership is moved to the parent.
17137 /// * Only one instantiation of the graph may exist at any point in time.
17138 /// * The graph cannot be cloned.
17139 ///
17140 /// Note:
17141 ///
17142 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17143 /// * Note that this function may also return error codes from previous, asynchronous launches.
17144 ///
17145 /// **See also:**
17146 ///
17147 /// [`cuGraphAddNode_v2`], [`cuGraphAddMemAllocNode`], [`cuGraphMemFreeNodeGetParams`], [`cuDeviceGraphMemTrim`], [`cuDeviceGetGraphMemAttribute`], [`cuDeviceSetGraphMemAttribute`], [`cuMemAllocAsync`], [`cuMemFreeAsync`], [`cuGraphCreate`], [`cuGraphDestroyNode`], [`cuGraphAddChildGraphNode`], [`cuGraphAddEmptyNode`], [`cuGraphAddEventRecordNode`], [`cuGraphAddEventWaitNode`], [`cuGraphAddExternalSemaphoresSignalNode`], [`cuGraphAddExternalSemaphoresWaitNode`], [`cuGraphAddKernelNode_v2`], [`cuGraphAddMemcpyNode`], [`cuGraphAddMemsetNode`].
17148 ///
17149 /// # Parameters
17150 ///
17151 /// - `phGraphNode`: Returns newly created node.
17152 /// - `hGraph`: Graph to which to add the node.
17153 /// - `dependencies`: Dependencies of the node.
17154 /// - `numDependencies`: Number of dependencies.
17155 /// - `dptr`: Address of memory to free.
17156 pub fn cuGraphAddMemFreeNode(
17157 phGraphNode: *mut CUgraphNode,
17158 hGraph: CUgraph,
17159 dependencies: *const CUgraphNode,
17160 numDependencies: size_t,
17161 dptr: CUdeviceptr,
17162 ) -> CUresult;
17163}
17164unsafe extern "C" {
17165 /// Returns a memory free node's parameters.
17166 ///
17167 /// Returns the address of a memory free node hNode in dptr_out.
17168 ///
17169 /// Note:
17170 ///
17171 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17172 /// * Note that this function may also return error codes from previous, asynchronous launches.
17173 ///
17174 /// **See also:**
17175 ///
17176 /// [`cuGraphNodeGetParams`], [`cuGraphAddMemFreeNode`], [`cuGraphMemAllocNodeGetParams`].
17177 ///
17178 /// # Parameters
17179 ///
17180 /// - `hNode`: Node to get the parameters for.
17181 /// - `dptr_out`: Pointer to return the device address.
17182 pub fn cuGraphMemFreeNodeGetParams(
17183 hNode: CUgraphNode,
17184 dptr_out: *mut CUdeviceptr,
17185 ) -> CUresult;
17186}
17187unsafe extern "C" {
17188 /// Free unused memory that was cached on the specified device for use with graphs back to the OS.
17189 ///
17190 /// Blocks which are not in use by a graph that is either currently executing or scheduled to execute are freed back to the operating
17191 /// system.
17192 ///
17193 /// **See also:**
17194 ///
17195 /// [`cuGraphAddMemAllocNode`], [`cuGraphAddMemFreeNode`], [`cuDeviceSetGraphMemAttribute`], [`cuDeviceGetGraphMemAttribute`].
17196 ///
17197 /// # Parameters
17198 ///
17199 /// - `device`: The device for which cached memory should be freed.
17200 pub fn cuDeviceGraphMemTrim(device: CUdevice) -> CUresult;
17201}
17202unsafe extern "C" {
17203 /// Query asynchronous allocation attributes related to graphs.
17204 ///
17205 /// Valid attributes are:
17206 ///
17207 /// * [`CUgraphMem_attribute_enum::CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT`]: Amount of memory, in bytes, currently associated with graphs
17208 /// * [`CUgraphMem_attribute_enum::CU_GRAPH_MEM_ATTR_USED_MEM_HIGH`]: High watermark of memory, in bytes, associated with graphs since the last time it was reset. High watermark can only be
17209 /// reset to zero.
17210 /// * [`CUgraphMem_attribute_enum::CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT`]: Amount of memory, in bytes, currently allocated for use by the CUDA graphs asynchronous allocator.
17211 /// * [`CUgraphMem_attribute_enum::CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH`]: High watermark of memory, in bytes, currently allocated for use by the CUDA graphs asynchronous allocator.
17212 ///
17213 /// **See also:**
17214 ///
17215 /// [`cuDeviceSetGraphMemAttribute`], [`cuGraphAddMemAllocNode`], [`cuGraphAddMemFreeNode`].
17216 ///
17217 /// # Parameters
17218 ///
17219 /// - `device`: Specifies the scope of the query.
17220 /// - `attr`: attribute to get.
17221 /// - `value`: retrieved value.
17222 pub fn cuDeviceGetGraphMemAttribute(
17223 device: CUdevice,
17224 attr: CUgraphMem_attribute,
17225 value: *mut ::core::ffi::c_void,
17226 ) -> CUresult;
17227}
17228unsafe extern "C" {
17229 /// Set asynchronous allocation attributes related to graphs.
17230 ///
17231 /// Valid attributes are:
17232 ///
17233 /// * [`CUgraphMem_attribute_enum::CU_GRAPH_MEM_ATTR_USED_MEM_HIGH`]: High watermark of memory, in bytes, associated with graphs since the last time it was reset. High watermark can only be
17234 /// reset to zero.
17235 /// * [`CUgraphMem_attribute_enum::CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH`]: High watermark of memory, in bytes, currently allocated for use by the CUDA graphs asynchronous allocator.
17236 ///
17237 /// **See also:**
17238 ///
17239 /// [`cuDeviceGetGraphMemAttribute`], [`cuGraphAddMemAllocNode`], [`cuGraphAddMemFreeNode`].
17240 ///
17241 /// # Parameters
17242 ///
17243 /// - `device`: Specifies the scope of the query.
17244 /// - `attr`: attribute to get.
17245 /// - `value`: pointer to value to set.
17246 pub fn cuDeviceSetGraphMemAttribute(
17247 device: CUdevice,
17248 attr: CUgraphMem_attribute,
17249 value: *mut ::core::ffi::c_void,
17250 ) -> CUresult;
17251}
17252unsafe extern "C" {
17253 /// Clones a graph.
17254 ///
17255 /// This function creates a copy of originalGraph and returns it in phGraphClone. All parameters are copied into the cloned graph. The original graph may be modified after this call without affecting the
17256 /// clone.
17257 ///
17258 /// Child graph nodes in the original graph are recursively copied into the clone.
17259 ///
17260 /// Note:
17261 ///
17262 /// : Cloning is not supported for graphs which contain memory allocation nodes, memory free nodes, or conditional nodes.
17263 ///
17264 /// Note:
17265 ///
17266 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17267 /// * Note that this function may also return error codes from previous, asynchronous launches.
17268 ///
17269 /// **See also:**
17270 ///
17271 /// [`cuGraphCreate`], [`cuGraphNodeFindInClone`].
17272 ///
17273 /// # Parameters
17274 ///
17275 /// - `phGraphClone`: Returns newly created cloned graph.
17276 /// - `originalGraph`: Graph to clone.
17277 pub fn cuGraphClone(phGraphClone: *mut CUgraph, originalGraph: CUgraph) -> CUresult;
17278}
17279unsafe extern "C" {
17280 /// Finds a cloned version of a node.
17281 ///
17282 /// This function returns the node in hClonedGraph corresponding to hOriginalNode in the original graph.
17283 ///
17284 /// hClonedGraph must have been cloned from hOriginalGraph via [`cuGraphClone`]. hOriginalNode must have been in hOriginalGraph at the time of the call to [`cuGraphClone`], and the corresponding cloned node in hClonedGraph must not have been removed. The cloned node is then returned via phClonedNode.
17285 ///
17286 /// Note:
17287 ///
17288 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17289 /// * Note that this function may also return error codes from previous, asynchronous launches.
17290 ///
17291 /// **See also:**
17292 ///
17293 /// [`cuGraphClone`].
17294 ///
17295 /// # Parameters
17296 ///
17297 /// - `phNode`: Returns handle to the cloned node.
17298 /// - `hOriginalNode`: Handle to the original node.
17299 /// - `hClonedGraph`: Cloned graph to query.
17300 pub fn cuGraphNodeFindInClone(
17301 phNode: *mut CUgraphNode,
17302 hOriginalNode: CUgraphNode,
17303 hClonedGraph: CUgraph,
17304 ) -> CUresult;
17305}
17306unsafe extern "C" {
17307 /// Returns a node's type.
17308 ///
17309 /// Returns the node type of hNode in type.
17310 ///
17311 /// Note:
17312 ///
17313 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17314 /// * Note that this function may also return error codes from previous, asynchronous launches.
17315 ///
17316 /// **See also:**
17317 ///
17318 /// [`cuGraphGetNodes`], [`cuGraphGetRootNodes`], [`cuGraphChildGraphNodeGetGraph`], [`cuGraphKernelNodeGetParams_v2`], [`cuGraphKernelNodeSetParams_v2`], [`cuGraphHostNodeGetParams`], [`cuGraphHostNodeSetParams`], [`cuGraphMemcpyNodeGetParams`], [`cuGraphMemcpyNodeSetParams`], [`cuGraphMemsetNodeGetParams`], [`cuGraphMemsetNodeSetParams`].
17319 ///
17320 /// # Parameters
17321 ///
17322 /// - `hNode`: Node to query.
17323 pub fn cuGraphNodeGetType(
17324 hNode: CUgraphNode,
17325 type_: *mut CUgraphNodeType,
17326 ) -> CUresult;
17327}
17328unsafe extern "C" {
17329 /// Returns the graph that contains a given graph node.
17330 ///
17331 /// Returns the graph that contains hNode in \*phGraph. If hNode is in a child graph, the child graph it is in is returned.
17332 ///
17333 /// **See also:**
17334 ///
17335 /// [`cuGraphGetNodes`], [`cuGraphDebugDotPrint`]cuGraphNodeGetLocalId [`cuGraphNodeGetToolsId`]cuGraphGetId [`cuGraphExecGetId`].
17336 ///
17337 /// # Parameters
17338 ///
17339 /// - `hNode`: Node to query.
17340 pub fn cuGraphNodeGetContainingGraph(
17341 hNode: CUgraphNode,
17342 phGraph: *mut CUgraph,
17343 ) -> CUresult;
17344}
17345unsafe extern "C" {
17346 /// Returns the local node id of a given graph node.
17347 ///
17348 /// Returns the node id of hNode in \*nodeId. The nodeId matches that referenced by [`cuGraphDebugDotPrint`]. The local nodeId and graphId together can uniquely identify the node.
17349 ///
17350 /// **See also:**
17351 ///
17352 /// [`cuGraphGetNodes`], [`cuGraphDebugDotPrint`]cuGraphNodeGetContainingGraph [`cuGraphNodeGetToolsId`]cuGraphGetId [`cuGraphExecGetId`].
17353 ///
17354 /// # Parameters
17355 ///
17356 /// - `hNode`: Node to query.
17357 /// - `nodeId`: Pointer to return the nodeId.
17358 pub fn cuGraphNodeGetLocalId(
17359 hNode: CUgraphNode,
17360 nodeId: *mut ::core::ffi::c_uint,
17361 ) -> CUresult;
17362}
17363unsafe extern "C" {
17364 /// Returns an id used by tools to identify a given node.
17365 ///
17366 /// **See also:**
17367 ///
17368 /// [`cuGraphGetNodes`], [`cuGraphDebugDotPrint`]cuGraphNodeGetContainingGraph [`cuGraphNodeGetLocalId`]cuGraphGetId [`cuGraphExecGetId`].
17369 ///
17370 /// # Parameters
17371 ///
17372 /// - `hNode`: Node to query.
17373 pub fn cuGraphNodeGetToolsId(
17374 hNode: CUgraphNode,
17375 toolsNodeId: *mut ::core::ffi::c_ulonglong,
17376 ) -> CUresult;
17377}
17378unsafe extern "C" {
17379 /// Returns the id of a given graph.
17380 ///
17381 /// Returns the id of hGraph in \*graphId. The value in \*graphId will match that referenced by [`cuGraphDebugDotPrint`].
17382 ///
17383 /// **See also:**
17384 ///
17385 /// [`cuGraphGetNodes`], [`cuGraphDebugDotPrint`]cuGraphNodeGetContainingGraph [`cuGraphNodeGetLocalId`]cuGraphNodeGetToolsId [`cuGraphExecGetId`].
17386 ///
17387 /// # Parameters
17388 ///
17389 /// - `hGraph`: Graph to query.
17390 pub fn cuGraphGetId(hGraph: CUgraph, graphId: *mut ::core::ffi::c_uint) -> CUresult;
17391}
17392unsafe extern "C" {
17393 /// Returns the id of a given graph exec.
17394 ///
17395 /// Returns the id of hGraphExec in \*graphId. The value in \*graphId will match that referenced by [`cuGraphDebugDotPrint`].
17396 ///
17397 /// **See also:**
17398 ///
17399 /// [`cuGraphGetNodes`], [`cuGraphDebugDotPrint`]cuGraphNodeGetContainingGraph [`cuGraphNodeGetLocalId`]cuGraphNodeGetToolsId [`cuGraphGetId`].
17400 ///
17401 /// # Parameters
17402 ///
17403 /// - `hGraphExec`: Graph to query.
17404 pub fn cuGraphExecGetId(
17405 hGraphExec: CUgraphExec,
17406 graphId: *mut ::core::ffi::c_uint,
17407 ) -> CUresult;
17408}
17409unsafe extern "C" {
17410 /// Returns a graph's nodes.
17411 ///
17412 /// Returns a list of hGraph's nodes. nodes may be NULL, in which case this function will return the number of nodes in numNodes. Otherwise, numNodes entries will be filled in. If numNodes is higher than the actual number of nodes, the remaining entries in nodes will be set to NULL, and the number of nodes actually obtained will be returned in numNodes.
17413 ///
17414 /// Note:
17415 ///
17416 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17417 /// * Note that this function may also return error codes from previous, asynchronous launches.
17418 ///
17419 /// **See also:**
17420 ///
17421 /// [`cuGraphCreate`], [`cuGraphGetRootNodes`], [`cuGraphGetEdges_v2`], [`cuGraphNodeGetType`], [`cuGraphNodeGetDependencies_v2`], [`cuGraphNodeGetDependentNodes_v2`].
17422 ///
17423 /// # Parameters
17424 ///
17425 /// - `hGraph`: Graph to query.
17426 /// - `nodes`: Pointer to return the nodes.
17427 /// - `numNodes`: See description.
17428 pub fn cuGraphGetNodes(
17429 hGraph: CUgraph,
17430 nodes: *mut CUgraphNode,
17431 numNodes: *mut size_t,
17432 ) -> CUresult;
17433}
17434unsafe extern "C" {
17435 /// Returns a graph's root nodes.
17436 ///
17437 /// Returns a list of hGraph's root nodes. rootNodes may be NULL, in which case this function will return the number of root nodes in numRootNodes. Otherwise, numRootNodes entries will be filled in. If numRootNodes is higher than the actual number of root nodes, the remaining entries in rootNodes will be set to NULL, and the number of nodes actually obtained will be returned in numRootNodes.
17438 ///
17439 /// Note:
17440 ///
17441 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17442 /// * Note that this function may also return error codes from previous, asynchronous launches.
17443 ///
17444 /// **See also:**
17445 ///
17446 /// [`cuGraphCreate`], [`cuGraphGetNodes`], [`cuGraphGetEdges_v2`], [`cuGraphNodeGetType`], [`cuGraphNodeGetDependencies_v2`], [`cuGraphNodeGetDependentNodes_v2`].
17447 ///
17448 /// # Parameters
17449 ///
17450 /// - `hGraph`: Graph to query.
17451 /// - `rootNodes`: Pointer to return the root nodes.
17452 /// - `numRootNodes`: See description.
17453 pub fn cuGraphGetRootNodes(
17454 hGraph: CUgraph,
17455 rootNodes: *mut CUgraphNode,
17456 numRootNodes: *mut size_t,
17457 ) -> CUresult;
17458}
17459unsafe extern "C" {
17460 /// Returns a graph's dependency edges.
17461 ///
17462 /// Returns a list of hGraph's dependency edges. Edges are returned via corresponding indices in from, to and edgeData; that is, the node in to\[i\] has a dependency on the node in from\[i\] with data edgeData\[i\]. from and to may both be NULL, in which case this function only returns the number of edges in numEdges. Otherwise, numEdges entries will be filled in. If numEdges is higher than the actual number of edges, the remaining entries in from and to will be set to NULL, and the number of edges actually returned will be written to numEdges. edgeData may alone be NULL, in which case the edges must all have default (zeroed) edge data. Attempting a lossy query via NULL edgeData will result in [`cudaError_enum::CUDA_ERROR_LOSSY_QUERY`]. If edgeData is non-NULL then from and to must be as well.
17463 ///
17464 /// Note:
17465 ///
17466 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17467 /// * Note that this function may also return error codes from previous, asynchronous launches.
17468 ///
17469 /// **See also:**
17470 ///
17471 /// [`cuGraphGetNodes`], [`cuGraphGetRootNodes`], [`cuGraphAddDependencies_v2`], [`cuGraphRemoveDependencies_v2`], [`cuGraphNodeGetDependencies_v2`], [`cuGraphNodeGetDependentNodes_v2`].
17472 ///
17473 /// # Parameters
17474 ///
17475 /// - `hGraph`: Graph to get the edges from.
17476 /// - `from`: Location to return edge endpoints.
17477 /// - `to`: Location to return edge endpoints.
17478 /// - `edgeData`: Optional location to return edge data.
17479 /// - `numEdges`: See description.
17480 pub fn cuGraphGetEdges_v2(
17481 hGraph: CUgraph,
17482 from: *mut CUgraphNode,
17483 to: *mut CUgraphNode,
17484 edgeData: *mut CUgraphEdgeData,
17485 numEdges: *mut size_t,
17486 ) -> CUresult;
17487}
17488unsafe extern "C" {
17489 /// Returns a node's dependencies.
17490 ///
17491 /// Returns a list of node's dependencies. dependencies may be NULL, in which case this function will return the number of dependencies in numDependencies. Otherwise, numDependencies entries will be filled in. If numDependencies is higher than the actual number of dependencies, the remaining entries in dependencies will be set to NULL, and the number of nodes actually obtained will be returned in numDependencies.
17492 ///
17493 /// Note that if an edge has non-zero (non-default) edge data and edgeData is NULL, this API will return [`cudaError_enum::CUDA_ERROR_LOSSY_QUERY`]. If edgeData is non-NULL, then dependencies must be as well.
17494 ///
17495 /// Note:
17496 ///
17497 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17498 /// * Note that this function may also return error codes from previous, asynchronous launches.
17499 ///
17500 /// **See also:**
17501 ///
17502 /// [`cuGraphNodeGetDependentNodes_v2`], [`cuGraphGetNodes`], [`cuGraphGetRootNodes`], [`cuGraphGetEdges_v2`], [`cuGraphAddDependencies_v2`], [`cuGraphRemoveDependencies_v2`].
17503 ///
17504 /// # Parameters
17505 ///
17506 /// - `hNode`: Node to query.
17507 /// - `dependencies`: Pointer to return the dependencies.
17508 /// - `edgeData`: Optional array to return edge data for each dependency.
17509 /// - `numDependencies`: See description.
17510 pub fn cuGraphNodeGetDependencies_v2(
17511 hNode: CUgraphNode,
17512 dependencies: *mut CUgraphNode,
17513 edgeData: *mut CUgraphEdgeData,
17514 numDependencies: *mut size_t,
17515 ) -> CUresult;
17516}
17517unsafe extern "C" {
17518 /// Returns a node's dependent nodes.
17519 ///
17520 /// Returns a list of node's dependent nodes. dependentNodes may be NULL, in which case this function will return the number of dependent nodes in numDependentNodes. Otherwise, numDependentNodes entries will be filled in. If numDependentNodes is higher than the actual number of dependent nodes, the remaining entries in dependentNodes will be set to NULL, and the number of nodes actually obtained will be returned in numDependentNodes.
17521 ///
17522 /// Note that if an edge has non-zero (non-default) edge data and edgeData is NULL, this API will return [`cudaError_enum::CUDA_ERROR_LOSSY_QUERY`]. If edgeData is non-NULL, then dependentNodes must be as well.
17523 ///
17524 /// Note:
17525 ///
17526 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17527 /// * Note that this function may also return error codes from previous, asynchronous launches.
17528 ///
17529 /// **See also:**
17530 ///
17531 /// [`cuGraphNodeGetDependencies_v2`], [`cuGraphGetNodes`], [`cuGraphGetRootNodes`], [`cuGraphGetEdges_v2`], [`cuGraphAddDependencies_v2`], [`cuGraphRemoveDependencies_v2`].
17532 ///
17533 /// # Parameters
17534 ///
17535 /// - `hNode`: Node to query.
17536 /// - `dependentNodes`: Pointer to return the dependent nodes.
17537 /// - `edgeData`: Optional pointer to return edge data for dependent nodes.
17538 /// - `numDependentNodes`: See description.
17539 pub fn cuGraphNodeGetDependentNodes_v2(
17540 hNode: CUgraphNode,
17541 dependentNodes: *mut CUgraphNode,
17542 edgeData: *mut CUgraphEdgeData,
17543 numDependentNodes: *mut size_t,
17544 ) -> CUresult;
17545}
17546unsafe extern "C" {
17547 /// Adds dependency edges to a graph.
17548 ///
17549 /// The number of dependencies to be added is defined by numDependencies Elements in from and to at corresponding indices define a dependency. Each node in from and to must belong to hGraph.
17550 ///
17551 /// If numDependencies is 0, elements in from and to will be ignored. Specifying an existing dependency will return an error.
17552 ///
17553 /// Note:
17554 ///
17555 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17556 /// * Note that this function may also return error codes from previous, asynchronous launches.
17557 ///
17558 /// **See also:**
17559 ///
17560 /// [`cuGraphRemoveDependencies_v2`], [`cuGraphGetEdges_v2`], [`cuGraphNodeGetDependencies_v2`], [`cuGraphNodeGetDependentNodes_v2`].
17561 ///
17562 /// # Parameters
17563 ///
17564 /// - `hGraph`: Graph to which dependencies are added.
17565 /// - `from`: Array of nodes that provide the dependencies.
17566 /// - `to`: Array of dependent nodes.
17567 /// - `edgeData`: Optional array of edge data. If NULL, default (zeroed) edge data is assumed.
17568 /// - `numDependencies`: Number of dependencies to be added.
17569 pub fn cuGraphAddDependencies_v2(
17570 hGraph: CUgraph,
17571 from: *const CUgraphNode,
17572 to: *const CUgraphNode,
17573 edgeData: *const CUgraphEdgeData,
17574 numDependencies: size_t,
17575 ) -> CUresult;
17576}
17577unsafe extern "C" {
17578 /// Removes dependency edges from a graph.
17579 ///
17580 /// The number of dependencies to be removed is defined by numDependencies. Elements in from and to at corresponding indices define a dependency. Each node in from and to must belong to hGraph.
17581 ///
17582 /// If numDependencies is 0, elements in from and to will be ignored. Specifying an edge that does not exist in the graph, with data matching edgeData, results in an error. edgeData is nullable, which is equivalent to passing default (zeroed) data for each edge.
17583 ///
17584 /// Dependencies cannot be removed from graphs which contain allocation or free nodes. Any attempt to do so will return an error.
17585 ///
17586 /// Note:
17587 ///
17588 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17589 /// * Note that this function may also return error codes from previous, asynchronous launches.
17590 ///
17591 /// **See also:**
17592 ///
17593 /// [`cuGraphAddDependencies_v2`], [`cuGraphGetEdges_v2`], [`cuGraphNodeGetDependencies_v2`], [`cuGraphNodeGetDependentNodes_v2`].
17594 ///
17595 /// # Parameters
17596 ///
17597 /// - `hGraph`: Graph from which to remove dependencies.
17598 /// - `from`: Array of nodes that provide the dependencies.
17599 /// - `to`: Array of dependent nodes.
17600 /// - `edgeData`: Optional array of edge data. If NULL, edge data is assumed to be default (zeroed).
17601 /// - `numDependencies`: Number of dependencies to be removed.
17602 pub fn cuGraphRemoveDependencies_v2(
17603 hGraph: CUgraph,
17604 from: *const CUgraphNode,
17605 to: *const CUgraphNode,
17606 edgeData: *const CUgraphEdgeData,
17607 numDependencies: size_t,
17608 ) -> CUresult;
17609}
17610unsafe extern "C" {
17611 /// Remove a node from the graph.
17612 ///
17613 /// Removes hNode from its graph. This operation also severs any dependencies of other nodes on hNode and vice versa.
17614 ///
17615 /// Nodes which belong to a graph which contains allocation or free nodes cannot be destroyed. Any attempt to do so will return
17616 /// an error.
17617 ///
17618 /// Note:
17619 ///
17620 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17621 /// * Note that this function may also return error codes from previous, asynchronous launches.
17622 ///
17623 /// **See also:**
17624 ///
17625 /// [`cuGraphAddChildGraphNode`], [`cuGraphAddEmptyNode`], [`cuGraphAddKernelNode_v2`], [`cuGraphAddHostNode`], [`cuGraphAddMemcpyNode`], [`cuGraphAddMemsetNode`].
17626 ///
17627 /// # Parameters
17628 ///
17629 /// - `hNode`: Node to remove.
17630 pub fn cuGraphDestroyNode(hNode: CUgraphNode) -> CUresult;
17631}
17632unsafe extern "C" {
17633 pub fn cuGraphInstantiateWithFlags(
17634 phGraphExec: *mut CUgraphExec,
17635 hGraph: CUgraph,
17636 flags: ::core::ffi::c_ulonglong,
17637 ) -> CUresult;
17638}
17639unsafe extern "C" {
17640 /// Creates an executable graph from a graph.
17641 ///
17642 /// Instantiates hGraph as an executable graph according to the instantiateParams structure. The graph is validated for any structural constraints or intra-node constraints which were not previously validated.
17643 /// If instantiation is successful, a handle to the instantiated graph is returned in phGraphExec.
17644 ///
17645 /// instantiateParams controls the behavior of instantiation and subsequent graph launches, as well as returning more detailed information in the
17646 /// event of an error. [`CUDA_GRAPH_INSTANTIATE_PARAMS`] is defined as:
17647 ///
17648 /// ```text
17649 /// typedef struct {
17650 /// cuuint64_t flags;
17651 /// CUstream hUploadStream;
17652 /// CUgraphNode hErrNode_out;
17653 /// CUgraphInstantiateResult result_out;
17654 /// } CUDA_GRAPH_INSTANTIATE_PARAMS;
17655 /// ```
17656 ///
17657 /// The flags field controls the behavior of instantiation and subsequent graph launches. Valid flags are:
17658 ///
17659 /// * [`CUgraphInstantiate_flags_enum::CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH`], which configures a graph containing memory allocation nodes to automatically free any unfreed memory allocations before
17660 /// the graph is relaunched.
17661 ///
17662 /// * [`CUgraphInstantiate_flags_enum::CUDA_GRAPH_INSTANTIATE_FLAG_UPLOAD`], which will perform an upload of the graph into hUploadStream once the graph has been instantiated.
17663 ///
17664 /// * [`CUgraphInstantiate_flags_enum::CUDA_GRAPH_INSTANTIATE_FLAG_DEVICE_LAUNCH`], which configures the graph for launch from the device. If this flag is passed, the executable graph handle returned can
17665 /// be used to launch the graph from both the host and device. This flag can only be used on platforms which support unified addressing.
17666 /// This flag cannot be used in conjunction with [`CUgraphInstantiate_flags_enum::CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH`].
17667 ///
17668 /// * [`CUgraphInstantiate_flags_enum::CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY`], which causes the graph to use the priorities from the per-node attributes rather than the priority of the launch stream
17669 /// during execution. Note that priorities are only available on kernel nodes, and are copied from stream priority during stream
17670 /// capture.
17671 ///
17672 /// If hGraph contains any allocation or free nodes, there can be at most one executable graph in existence for that graph at a time. An
17673 /// attempt to instantiate a second executable graph before destroying the first with [`cuGraphExecDestroy`] will result in an error. The same also applies if hGraph contains any device-updatable kernel nodes.
17674 ///
17675 /// If hGraph contains kernels which call device-side [cudaGraphLaunch()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__GRAPH.html#group__CUDART__GRAPH_1g1920584881db959c8c74130d79019b73) from multiple contexts, this will result in an error.
17676 ///
17677 /// Graphs instantiated for launch on the device have additional restrictions which do not apply to host graphs:
17678 ///
17679 /// * The graph's nodes must reside on a single context.
17680 /// * The graph can only contain kernel nodes, memcpy nodes, memset nodes, and child graph nodes.
17681 /// * The graph cannot be empty and must contain at least one kernel, memcpy, or memset node. Operation-specific restrictions are
17682 /// outlined below.
17683 /// * Kernel nodes:
17684 /// + Use of CUDA Dynamic Parallelism is not permitted.
17685 /// + Cooperative launches are permitted as long as MPS is not in use.
17686 /// * Memcpy nodes:
17687 /// + Only copies involving device memory and/or pinned device-mapped host memory are permitted.
17688 /// + Copies involving CUDA arrays are not permitted.
17689 /// + Both operands must be accessible from the current context, and the current context must match the context of other nodes in
17690 /// the graph.
17691 ///
17692 /// In the event of an error, the result_out and hErrNode_out fields will contain more information about the nature of the error. Possible error reporting includes:
17693 ///
17694 /// * [`CUgraphInstantiateResult_enum::CUDA_GRAPH_INSTANTIATE_ERROR`], if passed an invalid value or if an unexpected error occurred which is described by the return value of the function. hErrNode_out will be set to NULL.
17695 /// * [`CUgraphInstantiateResult_enum::CUDA_GRAPH_INSTANTIATE_INVALID_STRUCTURE`], if the graph structure is invalid. hErrNode_out will be set to one of the offending nodes.
17696 /// * [`CUgraphInstantiateResult_enum::CUDA_GRAPH_INSTANTIATE_NODE_OPERATION_NOT_SUPPORTED`], if the graph is instantiated for device launch but contains a node of an unsupported node type, or a node which performs
17697 /// unsupported operations, such as use of CUDA dynamic parallelism within a kernel node. hErrNode_out will be set to this node.
17698 /// * [`CUgraphInstantiateResult_enum::CUDA_GRAPH_INSTANTIATE_MULTIPLE_CTXS_NOT_SUPPORTED`], if the graph is instantiated for device launch but a node’s context differs from that of another node. This error can also
17699 /// be returned if a graph is not instantiated for device launch and it contains kernels which call device-side [cudaGraphLaunch()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__GRAPH.html#group__CUDART__GRAPH_1g1920584881db959c8c74130d79019b73) from multiple contexts. hErrNode_out will be set to this node.
17700 ///
17701 /// If instantiation is successful, result_out will be set to [`CUgraphInstantiateResult_enum::CUDA_GRAPH_INSTANTIATE_SUCCESS`], and hErrNode_out will be set to NULL.
17702 ///
17703 /// Note:
17704 ///
17705 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17706 /// * Note that this function may also return error codes from previous, asynchronous launches.
17707 ///
17708 /// **See also:**
17709 ///
17710 /// [`cuGraphCreate`], `cuGraphInstantiate`, [`cuGraphExecDestroy`].
17711 ///
17712 /// # Parameters
17713 ///
17714 /// - `phGraphExec`: Returns instantiated graph.
17715 /// - `hGraph`: Graph to instantiate.
17716 /// - `instantiateParams`: Instantiation parameters.
17717 pub fn cuGraphInstantiateWithParams(
17718 phGraphExec: *mut CUgraphExec,
17719 hGraph: CUgraph,
17720 instantiateParams: *mut CUDA_GRAPH_INSTANTIATE_PARAMS,
17721 ) -> CUresult;
17722}
17723unsafe extern "C" {
17724 /// Query the instantiation flags of an executable graph.
17725 ///
17726 /// Returns the flags that were passed to instantiation for the given executable graph. [`CUgraphInstantiate_flags_enum::CUDA_GRAPH_INSTANTIATE_FLAG_UPLOAD`] will not be returned by this API as it does not affect the resulting executable graph.
17727 ///
17728 /// Note:
17729 ///
17730 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17731 /// * Note that this function may also return error codes from previous, asynchronous launches.
17732 ///
17733 /// **See also:**
17734 ///
17735 /// `cuGraphInstantiate`, [`cuGraphInstantiateWithParams`].
17736 ///
17737 /// # Parameters
17738 ///
17739 /// - `hGraphExec`: The executable graph to query.
17740 /// - `flags`: Returns the instantiation flags.
17741 pub fn cuGraphExecGetFlags(
17742 hGraphExec: CUgraphExec,
17743 flags: *mut cuuint64_t,
17744 ) -> CUresult;
17745}
17746unsafe extern "C" {
17747 /// Sets the parameters for a kernel node in the given graphExec.
17748 ///
17749 /// Sets the parameters of a kernel node in an executable graph hGraphExec. The node is identified by the corresponding node hNode in the non-executable graph, from which the executable graph was instantiated.
17750 ///
17751 /// hNode must not have been removed from the original graph. All nodeParams fields may change, but the following restrictions apply to func updates:
17752 ///
17753 /// * The owning context of the function cannot change.
17754 /// * A node whose function originally did not use CUDA dynamic parallelism cannot be updated to a function which uses CDP
17755 /// * A node whose function originally did not make device-side update calls cannot be updated to a function which makes device-side
17756 /// update calls.
17757 /// * If hGraphExec was not instantiated for device launch, a node whose function originally did not use device-side [cudaGraphLaunch()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__GRAPH.html#group__CUDART__GRAPH_1g1920584881db959c8c74130d79019b73) cannot be updated to a function which uses device-side [cudaGraphLaunch()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__GRAPH.html#group__CUDART__GRAPH_1g1920584881db959c8c74130d79019b73) unless the node resides on the same context as nodes which contained such calls at instantiate-time. If no such calls were
17758 /// present at instantiation, these updates cannot be performed at all.
17759 ///
17760 /// The modifications only affect future launches of hGraphExec. Already enqueued or running launches of hGraphExec are not affected by this call. hNode is also not modified by this call.
17761 ///
17762 /// If hNode is a device-updatable kernel node, the next upload/launch of hGraphExec will overwrite any previous device-side updates. Additionally, applying host updates to a device-updatable kernel node while
17763 /// it is being updated from the device will result in undefined behavior.
17764 ///
17765 /// Note:
17766 ///
17767 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17768 /// * Note that this function may also return error codes from previous, asynchronous launches.
17769 ///
17770 /// **See also:**
17771 ///
17772 /// [`cuGraphExecNodeSetParams`], [`cuGraphAddKernelNode_v2`], [`cuGraphKernelNodeSetParams_v2`], [`cuGraphExecMemcpyNodeSetParams`], [`cuGraphExecMemsetNodeSetParams`], [`cuGraphExecHostNodeSetParams`], [`cuGraphExecChildGraphNodeSetParams`], [`cuGraphExecEventRecordNodeSetEvent`], [`cuGraphExecEventWaitNodeSetEvent`], [`cuGraphExecExternalSemaphoresSignalNodeSetParams`], [`cuGraphExecExternalSemaphoresWaitNodeSetParams`], [`cuGraphExecUpdate_v2`], `cuGraphInstantiate`.
17773 ///
17774 /// # Parameters
17775 ///
17776 /// - `hGraphExec`: The executable graph in which to set the specified node.
17777 /// - `hNode`: kernel node from the graph from which graphExec was instantiated.
17778 /// - `nodeParams`: Updated Parameters to set.
17779 pub fn cuGraphExecKernelNodeSetParams_v2(
17780 hGraphExec: CUgraphExec,
17781 hNode: CUgraphNode,
17782 nodeParams: *const CUDA_KERNEL_NODE_PARAMS,
17783 ) -> CUresult;
17784}
17785unsafe extern "C" {
17786 /// Sets the parameters for a memcpy node in the given graphExec.
17787 ///
17788 /// Updates the work represented by hNode in hGraphExec as though hNode had contained copyParams at instantiation. hNode must remain in the graph which was used to instantiate hGraphExec. Changed edges to and from hNode are ignored.
17789 ///
17790 /// The source and destination memory in copyParams must be allocated from the same contexts as the original source and destination memory. Both the instantiation-time memory
17791 /// operands and the memory operands in copyParams must be 1-dimensional. Zero-length operations are not supported.
17792 ///
17793 /// The modifications only affect future launches of hGraphExec. Already enqueued or running launches of hGraphExec are not affected by this call. hNode is also not modified by this call.
17794 ///
17795 /// Returns [`CUresult::CUDA_ERROR_INVALID_VALUE`] if the memory operands' mappings changed or either the original or new memory operands are
17796 /// multidimensional.
17797 ///
17798 /// Note:
17799 ///
17800 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17801 /// * Note that this function may also return error codes from previous, asynchronous launches.
17802 ///
17803 /// **See also:**
17804 ///
17805 /// [`cuGraphExecNodeSetParams`], [`cuGraphAddMemcpyNode`], [`cuGraphMemcpyNodeSetParams`], [`cuGraphExecKernelNodeSetParams_v2`], [`cuGraphExecMemsetNodeSetParams`], [`cuGraphExecHostNodeSetParams`], [`cuGraphExecChildGraphNodeSetParams`], [`cuGraphExecEventRecordNodeSetEvent`], [`cuGraphExecEventWaitNodeSetEvent`], [`cuGraphExecExternalSemaphoresSignalNodeSetParams`], [`cuGraphExecExternalSemaphoresWaitNodeSetParams`], [`cuGraphExecUpdate_v2`], `cuGraphInstantiate`.
17806 ///
17807 /// # Parameters
17808 ///
17809 /// - `hGraphExec`: The executable graph in which to set the specified node.
17810 /// - `hNode`: Memcpy node from the graph which was used to instantiate graphExec.
17811 /// - `copyParams`: The updated parameters to set.
17812 /// - `ctx`: Context on which to run the node.
17813 pub fn cuGraphExecMemcpyNodeSetParams(
17814 hGraphExec: CUgraphExec,
17815 hNode: CUgraphNode,
17816 copyParams: *const CUDA_MEMCPY3D,
17817 ctx: CUcontext,
17818 ) -> CUresult;
17819}
17820unsafe extern "C" {
17821 /// Sets the parameters for a memset node in the given graphExec.
17822 ///
17823 /// Updates the work represented by hNode in hGraphExec as though hNode had contained memsetParams at instantiation. hNode must remain in the graph which was used to instantiate hGraphExec. Changed edges to and from hNode are ignored.
17824 ///
17825 /// Zero sized operations are not supported.
17826 ///
17827 /// The new destination pointer in memsetParams must be to the same kind of allocation as the original destination pointer and
17828 /// have the same context association and device mapping as the original destination pointer.
17829 ///
17830 /// Both the value and pointer address may be updated. Changing other aspects of the memset (width, height, element size or pitch)
17831 /// may cause the update to be rejected. Specifically, for 2d memsets, all dimension changes are rejected. For 1d memsets, changes
17832 /// in height are explicitly rejected and other changes are opportunistically allowed if the resulting work maps onto the work
17833 /// resources already allocated for the node.
17834 ///
17835 /// The modifications only affect future launches of hGraphExec. Already enqueued or running launches of hGraphExec are not affected by this call. hNode is also not modified by this call.
17836 ///
17837 /// Note:
17838 ///
17839 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17840 /// * Note that this function may also return error codes from previous, asynchronous launches.
17841 ///
17842 /// **See also:**
17843 ///
17844 /// [`cuGraphExecNodeSetParams`], [`cuGraphAddMemsetNode`], [`cuGraphMemsetNodeSetParams`], [`cuGraphExecKernelNodeSetParams_v2`], [`cuGraphExecMemcpyNodeSetParams`], [`cuGraphExecHostNodeSetParams`], [`cuGraphExecChildGraphNodeSetParams`], [`cuGraphExecEventRecordNodeSetEvent`], [`cuGraphExecEventWaitNodeSetEvent`], [`cuGraphExecExternalSemaphoresSignalNodeSetParams`], [`cuGraphExecExternalSemaphoresWaitNodeSetParams`], [`cuGraphExecUpdate_v2`], `cuGraphInstantiate`.
17845 ///
17846 /// # Parameters
17847 ///
17848 /// - `hGraphExec`: The executable graph in which to set the specified node.
17849 /// - `hNode`: Memset node from the graph which was used to instantiate graphExec.
17850 /// - `memsetParams`: The updated parameters to set.
17851 /// - `ctx`: Context on which to run the node.
17852 pub fn cuGraphExecMemsetNodeSetParams(
17853 hGraphExec: CUgraphExec,
17854 hNode: CUgraphNode,
17855 memsetParams: *const CUDA_MEMSET_NODE_PARAMS,
17856 ctx: CUcontext,
17857 ) -> CUresult;
17858}
17859unsafe extern "C" {
17860 /// Sets the parameters for a host node in the given graphExec.
17861 ///
17862 /// Updates the work represented by hNode in hGraphExec as though hNode had contained nodeParams at instantiation. hNode must remain in the graph which was used to instantiate hGraphExec. Changed edges to and from hNode are ignored.
17863 ///
17864 /// The modifications only affect future launches of hGraphExec. Already enqueued or running launches of hGraphExec are not affected by this call. hNode is also not modified by this call.
17865 ///
17866 /// Note:
17867 ///
17868 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17869 /// * Note that this function may also return error codes from previous, asynchronous launches.
17870 ///
17871 /// **See also:**
17872 ///
17873 /// [`cuGraphExecNodeSetParams`], [`cuGraphAddHostNode`], [`cuGraphHostNodeSetParams`], [`cuGraphExecKernelNodeSetParams_v2`], [`cuGraphExecMemcpyNodeSetParams`], [`cuGraphExecMemsetNodeSetParams`], [`cuGraphExecChildGraphNodeSetParams`], [`cuGraphExecEventRecordNodeSetEvent`], [`cuGraphExecEventWaitNodeSetEvent`], [`cuGraphExecExternalSemaphoresSignalNodeSetParams`], [`cuGraphExecExternalSemaphoresWaitNodeSetParams`], [`cuGraphExecUpdate_v2`], `cuGraphInstantiate`.
17874 ///
17875 /// # Parameters
17876 ///
17877 /// - `hGraphExec`: The executable graph in which to set the specified node.
17878 /// - `hNode`: Host node from the graph which was used to instantiate graphExec.
17879 /// - `nodeParams`: The updated parameters to set.
17880 pub fn cuGraphExecHostNodeSetParams(
17881 hGraphExec: CUgraphExec,
17882 hNode: CUgraphNode,
17883 nodeParams: *const CUDA_HOST_NODE_PARAMS,
17884 ) -> CUresult;
17885}
17886unsafe extern "C" {
17887 /// Updates node parameters in the child graph node in the given graphExec.
17888 ///
17889 /// Updates the work represented by hNode in hGraphExec as though the nodes contained in hNode's graph had the parameters contained in childGraph's nodes at instantiation. hNode must remain in the graph which was used to instantiate hGraphExec. Changed edges to and from hNode are ignored.
17890 ///
17891 /// The modifications only affect future launches of hGraphExec. Already enqueued or running launches of hGraphExec are not affected by this call. hNode is also not modified by this call.
17892 ///
17893 /// The topology of childGraph, as well as the node insertion order, must match that of the graph contained in hNode. See [`cuGraphExecUpdate_v2`] for a list of restrictions on what can be updated in an instantiated graph. The update is recursive, so child graph nodes
17894 /// contained within the top level child graph will also be updated.
17895 ///
17896 /// Note:
17897 ///
17898 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17899 /// * Note that this function may also return error codes from previous, asynchronous launches.
17900 ///
17901 /// **See also:**
17902 ///
17903 /// [`cuGraphExecNodeSetParams`], [`cuGraphAddChildGraphNode`], [`cuGraphChildGraphNodeGetGraph`], [`cuGraphExecKernelNodeSetParams_v2`], [`cuGraphExecMemcpyNodeSetParams`], [`cuGraphExecMemsetNodeSetParams`], [`cuGraphExecHostNodeSetParams`], [`cuGraphExecEventRecordNodeSetEvent`], [`cuGraphExecEventWaitNodeSetEvent`], [`cuGraphExecExternalSemaphoresSignalNodeSetParams`], [`cuGraphExecExternalSemaphoresWaitNodeSetParams`], [`cuGraphExecUpdate_v2`], `cuGraphInstantiate`.
17904 ///
17905 /// # Parameters
17906 ///
17907 /// - `hGraphExec`: The executable graph in which to set the specified node.
17908 /// - `hNode`: Host node from the graph which was used to instantiate graphExec.
17909 /// - `childGraph`: The graph supplying the updated parameters.
17910 pub fn cuGraphExecChildGraphNodeSetParams(
17911 hGraphExec: CUgraphExec,
17912 hNode: CUgraphNode,
17913 childGraph: CUgraph,
17914 ) -> CUresult;
17915}
17916unsafe extern "C" {
17917 /// Sets the event for an event record node in the given graphExec.
17918 ///
17919 /// Sets the event of an event record node in an executable graph hGraphExec. The node is identified by the corresponding node hNode in the non-executable graph, from which the executable graph was instantiated.
17920 ///
17921 /// The modifications only affect future launches of hGraphExec. Already enqueued or running launches of hGraphExec are not affected by this call. hNode is also not modified by this call.
17922 ///
17923 /// Note:
17924 ///
17925 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17926 /// * Note that this function may also return error codes from previous, asynchronous launches.
17927 ///
17928 /// **See also:**
17929 ///
17930 /// [`cuGraphExecNodeSetParams`], [`cuGraphAddEventRecordNode`], [`cuGraphEventRecordNodeGetEvent`], [`cuGraphEventWaitNodeSetEvent`], [`cuEventRecordWithFlags`], [`cuStreamWaitEvent`], [`cuGraphExecKernelNodeSetParams_v2`], [`cuGraphExecMemcpyNodeSetParams`], [`cuGraphExecMemsetNodeSetParams`], [`cuGraphExecHostNodeSetParams`], [`cuGraphExecChildGraphNodeSetParams`], [`cuGraphExecEventWaitNodeSetEvent`], [`cuGraphExecExternalSemaphoresSignalNodeSetParams`], [`cuGraphExecExternalSemaphoresWaitNodeSetParams`], [`cuGraphExecUpdate_v2`], `cuGraphInstantiate`.
17931 ///
17932 /// # Parameters
17933 ///
17934 /// - `hGraphExec`: The executable graph in which to set the specified node.
17935 /// - `hNode`: event record node from the graph from which graphExec was instantiated.
17936 /// - `event`: Updated event to use.
17937 pub fn cuGraphExecEventRecordNodeSetEvent(
17938 hGraphExec: CUgraphExec,
17939 hNode: CUgraphNode,
17940 event: CUevent,
17941 ) -> CUresult;
17942}
17943unsafe extern "C" {
17944 /// Sets the event for an event wait node in the given graphExec.
17945 ///
17946 /// Sets the event of an event wait node in an executable graph hGraphExec. The node is identified by the corresponding node hNode in the non-executable graph, from which the executable graph was instantiated.
17947 ///
17948 /// The modifications only affect future launches of hGraphExec. Already enqueued or running launches of hGraphExec are not affected by this call. hNode is also not modified by this call.
17949 ///
17950 /// Note:
17951 ///
17952 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17953 /// * Note that this function may also return error codes from previous, asynchronous launches.
17954 ///
17955 /// **See also:**
17956 ///
17957 /// [`cuGraphExecNodeSetParams`], [`cuGraphAddEventWaitNode`], [`cuGraphEventWaitNodeGetEvent`], [`cuGraphEventRecordNodeSetEvent`], [`cuEventRecordWithFlags`], [`cuStreamWaitEvent`], [`cuGraphExecKernelNodeSetParams_v2`], [`cuGraphExecMemcpyNodeSetParams`], [`cuGraphExecMemsetNodeSetParams`], [`cuGraphExecHostNodeSetParams`], [`cuGraphExecChildGraphNodeSetParams`], [`cuGraphExecEventRecordNodeSetEvent`], [`cuGraphExecExternalSemaphoresSignalNodeSetParams`], [`cuGraphExecExternalSemaphoresWaitNodeSetParams`], [`cuGraphExecUpdate_v2`], `cuGraphInstantiate`.
17958 ///
17959 /// # Parameters
17960 ///
17961 /// - `hGraphExec`: The executable graph in which to set the specified node.
17962 /// - `hNode`: event wait node from the graph from which graphExec was instantiated.
17963 /// - `event`: Updated event to use.
17964 pub fn cuGraphExecEventWaitNodeSetEvent(
17965 hGraphExec: CUgraphExec,
17966 hNode: CUgraphNode,
17967 event: CUevent,
17968 ) -> CUresult;
17969}
17970unsafe extern "C" {
17971 /// Sets the parameters for an external semaphore signal node in the given graphExec.
17972 ///
17973 /// Sets the parameters of an external semaphore signal node in an executable graph hGraphExec. The node is identified by the corresponding node hNode in the non-executable graph, from which the executable graph was instantiated.
17974 ///
17975 /// hNode must not have been removed from the original graph.
17976 ///
17977 /// The modifications only affect future launches of hGraphExec. Already enqueued or running launches of hGraphExec are not affected by this call. hNode is also not modified by this call.
17978 ///
17979 /// Changing nodeParams->numExtSems is not supported.
17980 ///
17981 /// Note:
17982 ///
17983 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
17984 /// * Note that this function may also return error codes from previous, asynchronous launches.
17985 ///
17986 /// **See also:**
17987 ///
17988 /// [`cuGraphExecNodeSetParams`], [`cuGraphAddExternalSemaphoresSignalNode`], [`cuImportExternalSemaphore`], [`cuSignalExternalSemaphoresAsync`], [`cuWaitExternalSemaphoresAsync`], [`cuGraphExecKernelNodeSetParams_v2`], [`cuGraphExecMemcpyNodeSetParams`], [`cuGraphExecMemsetNodeSetParams`], [`cuGraphExecHostNodeSetParams`], [`cuGraphExecChildGraphNodeSetParams`], [`cuGraphExecEventRecordNodeSetEvent`], [`cuGraphExecEventWaitNodeSetEvent`], [`cuGraphExecExternalSemaphoresWaitNodeSetParams`], [`cuGraphExecUpdate_v2`], `cuGraphInstantiate`.
17989 ///
17990 /// # Parameters
17991 ///
17992 /// - `hGraphExec`: The executable graph in which to set the specified node.
17993 /// - `hNode`: semaphore signal node from the graph from which graphExec was instantiated.
17994 /// - `nodeParams`: Updated Parameters to set.
17995 pub fn cuGraphExecExternalSemaphoresSignalNodeSetParams(
17996 hGraphExec: CUgraphExec,
17997 hNode: CUgraphNode,
17998 nodeParams: *const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS,
17999 ) -> CUresult;
18000}
18001unsafe extern "C" {
18002 /// Sets the parameters for an external semaphore wait node in the given graphExec.
18003 ///
18004 /// Sets the parameters of an external semaphore wait node in an executable graph hGraphExec. The node is identified by the corresponding node hNode in the non-executable graph, from which the executable graph was instantiated.
18005 ///
18006 /// hNode must not have been removed from the original graph.
18007 ///
18008 /// The modifications only affect future launches of hGraphExec. Already enqueued or running launches of hGraphExec are not affected by this call. hNode is also not modified by this call.
18009 ///
18010 /// Changing nodeParams->numExtSems is not supported.
18011 ///
18012 /// Note:
18013 ///
18014 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
18015 /// * Note that this function may also return error codes from previous, asynchronous launches.
18016 ///
18017 /// **See also:**
18018 ///
18019 /// [`cuGraphExecNodeSetParams`], [`cuGraphAddExternalSemaphoresWaitNode`], [`cuImportExternalSemaphore`], [`cuSignalExternalSemaphoresAsync`], [`cuWaitExternalSemaphoresAsync`], [`cuGraphExecKernelNodeSetParams_v2`], [`cuGraphExecMemcpyNodeSetParams`], [`cuGraphExecMemsetNodeSetParams`], [`cuGraphExecHostNodeSetParams`], [`cuGraphExecChildGraphNodeSetParams`], [`cuGraphExecEventRecordNodeSetEvent`], [`cuGraphExecEventWaitNodeSetEvent`], [`cuGraphExecExternalSemaphoresSignalNodeSetParams`], [`cuGraphExecUpdate_v2`], `cuGraphInstantiate`.
18020 ///
18021 /// # Parameters
18022 ///
18023 /// - `hGraphExec`: The executable graph in which to set the specified node.
18024 /// - `hNode`: semaphore wait node from the graph from which graphExec was instantiated.
18025 /// - `nodeParams`: Updated Parameters to set.
18026 pub fn cuGraphExecExternalSemaphoresWaitNodeSetParams(
18027 hGraphExec: CUgraphExec,
18028 hNode: CUgraphNode,
18029 nodeParams: *const CUDA_EXT_SEM_WAIT_NODE_PARAMS,
18030 ) -> CUresult;
18031}
18032unsafe extern "C" {
18033 /// Enables or disables the specified node in the given graphExec.
18034 ///
18035 /// Sets hNode to be either enabled or disabled. Disabled nodes are functionally equivalent to empty nodes until they are reenabled. Existing
18036 /// node parameters are not affected by disabling/enabling the node.
18037 ///
18038 /// The node is identified by the corresponding node hNode in the non-executable graph, from which the executable graph was instantiated.
18039 ///
18040 /// hNode must not have been removed from the original graph.
18041 ///
18042 /// The modifications only affect future launches of hGraphExec. Already enqueued or running launches of hGraphExec are not affected by this call. hNode is also not modified by this call.
18043 ///
18044 /// If hNode is a device-updatable kernel node, the next upload/launch of hGraphExec will overwrite any previous device-side updates. Additionally, applying host updates to a device-updatable kernel node while
18045 /// it is being updated from the device will result in undefined behavior.
18046 ///
18047 /// Note:
18048 ///
18049 /// Currently only kernel, memset and memcpy nodes are supported.
18050 ///
18051 /// Note:
18052 ///
18053 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
18054 /// * Note that this function may also return error codes from previous, asynchronous launches.
18055 ///
18056 /// **See also:**
18057 ///
18058 /// [`cuGraphNodeGetEnabled`], [`cuGraphExecUpdate_v2`], `cuGraphInstantiate `[`cuGraphLaunch`].
18059 ///
18060 /// # Parameters
18061 ///
18062 /// - `hGraphExec`: The executable graph in which to set the specified node.
18063 /// - `hNode`: Node from the graph from which graphExec was instantiated.
18064 /// - `isEnabled`: Node is enabled if != 0, otherwise the node is disabled.
18065 pub fn cuGraphNodeSetEnabled(
18066 hGraphExec: CUgraphExec,
18067 hNode: CUgraphNode,
18068 isEnabled: ::core::ffi::c_uint,
18069 ) -> CUresult;
18070}
18071unsafe extern "C" {
18072 /// Query whether a node in the given graphExec is enabled.
18073 ///
18074 /// Sets isEnabled to 1 if hNode is enabled, or 0 if hNode is disabled.
18075 ///
18076 /// The node is identified by the corresponding node hNode in the non-executable graph, from which the executable graph was instantiated.
18077 ///
18078 /// hNode must not have been removed from the original graph.
18079 ///
18080 /// Note:
18081 ///
18082 /// * Currently only kernel, memset and memcpy nodes are supported.
18083 /// * This function will not reflect device-side updates for device-updatable kernel nodes.
18084 ///
18085 /// Note:
18086 ///
18087 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
18088 /// * Note that this function may also return error codes from previous, asynchronous launches.
18089 ///
18090 /// **See also:**
18091 ///
18092 /// [`cuGraphNodeSetEnabled`], [`cuGraphExecUpdate_v2`], `cuGraphInstantiate `[`cuGraphLaunch`].
18093 ///
18094 /// # Parameters
18095 ///
18096 /// - `hGraphExec`: The executable graph in which to set the specified node.
18097 /// - `hNode`: Node from the graph from which graphExec was instantiated.
18098 /// - `isEnabled`: Location to return the enabled status of the node.
18099 pub fn cuGraphNodeGetEnabled(
18100 hGraphExec: CUgraphExec,
18101 hNode: CUgraphNode,
18102 isEnabled: *mut ::core::ffi::c_uint,
18103 ) -> CUresult;
18104}
18105unsafe extern "C" {
18106 /// Uploads an executable graph in a stream.
18107 ///
18108 /// Uploads hGraphExec to the device in hStream without executing it. Uploads of the same hGraphExec will be serialized. Each upload is ordered behind both any previous work in hStream and any previous launches of hGraphExec. Uses memory cached by stream to back the allocations owned by hGraphExec.
18109 ///
18110 /// Note:
18111 ///
18112 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
18113 /// * Note that this function may also return error codes from previous, asynchronous launches.
18114 ///
18115 /// **See also:**
18116 ///
18117 /// `cuGraphInstantiate`, [`cuGraphLaunch`], [`cuGraphExecDestroy`].
18118 ///
18119 /// # Parameters
18120 ///
18121 /// - `hGraphExec`: Executable graph to upload.
18122 /// - `hStream`: Stream in which to upload the graph.
18123 pub fn cuGraphUpload(hGraphExec: CUgraphExec, hStream: CUstream) -> CUresult;
18124}
18125unsafe extern "C" {
18126 /// Launches an executable graph in a stream.
18127 ///
18128 /// Executes hGraphExec in hStream. Only one instance of hGraphExec may be executing at a time. Each launch is ordered behind both any previous work in hStream and any previous launches of hGraphExec. To execute a graph concurrently, it must be instantiated multiple times into multiple executable graphs.
18129 ///
18130 /// If any allocations created by hGraphExec remain unfreed (from a previous launch) and hGraphExec was not instantiated with [`CUgraphInstantiate_flags_enum::CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH`], the launch will fail with [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`].
18131 ///
18132 /// Note:
18133 ///
18134 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
18135 /// * Note that this function may also return error codes from previous, asynchronous launches.
18136 ///
18137 /// **See also:**
18138 ///
18139 /// `cuGraphInstantiate`, [`cuGraphUpload`], [`cuGraphExecDestroy`].
18140 ///
18141 /// # Parameters
18142 ///
18143 /// - `hGraphExec`: Executable graph to launch.
18144 /// - `hStream`: Stream in which to launch the graph.
18145 pub fn cuGraphLaunch(hGraphExec: CUgraphExec, hStream: CUstream) -> CUresult;
18146}
18147unsafe extern "C" {
18148 /// Destroys an executable graph.
18149 ///
18150 /// Destroys the executable graph specified by hGraphExec, as well as all of its executable nodes. If the executable graph is in-flight, it will not be terminated, but rather freed
18151 /// asynchronously on completion.
18152 ///
18153 /// Note:
18154 ///
18155 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
18156 /// * Note that this function may also return error codes from previous, asynchronous launches.
18157 ///
18158 /// **See also:**
18159 ///
18160 /// `cuGraphInstantiate`, [`cuGraphUpload`], [`cuGraphLaunch`].
18161 ///
18162 /// # Parameters
18163 ///
18164 /// - `hGraphExec`: Executable graph to destroy.
18165 pub fn cuGraphExecDestroy(hGraphExec: CUgraphExec) -> CUresult;
18166}
18167unsafe extern "C" {
18168 /// Destroys a graph.
18169 ///
18170 /// Destroys the graph specified by hGraph, as well as all of its nodes.
18171 ///
18172 /// Note:
18173 ///
18174 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
18175 /// * Note that this function may also return error codes from previous, asynchronous launches.
18176 ///
18177 /// **See also:**
18178 ///
18179 /// [`cuGraphCreate`].
18180 ///
18181 /// # Parameters
18182 ///
18183 /// - `hGraph`: Graph to destroy.
18184 pub fn cuGraphDestroy(hGraph: CUgraph) -> CUresult;
18185}
18186unsafe extern "C" {
18187 /// Check whether an executable graph can be updated with a graph and perform the update if possible.
18188 ///
18189 /// Updates the node parameters in the instantiated graph specified by hGraphExec with the node parameters in a topologically identical graph specified by hGraph.
18190 ///
18191 /// Limitations:
18192 ///
18193 /// * Kernel nodes:
18194 /// + The owning context of the function cannot change.
18195 /// + A node whose function originally did not use CUDA dynamic parallelism cannot be updated to a function which uses CDP.
18196 /// + A node whose function originally did not make device-side update calls cannot be updated to a function which makes device-side
18197 /// update calls.
18198 /// + A cooperative node cannot be updated to a non-cooperative node, and vice-versa.
18199 /// + If the graph was instantiated with [`CUgraphInstantiate_flags::CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY`], the priority attribute cannot change. Equality
18200 /// is checked on the originally requested priority values, before they are clamped to the device's supported range.
18201 /// + If hGraphExec was not instantiated for device launch, a node whose function originally did not use device-side [cudaGraphLaunch()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__GRAPH.html#group__CUDART__GRAPH_1g1920584881db959c8c74130d79019b73) cannot be updated to a function which uses device-side [cudaGraphLaunch()](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__GRAPH.html#group__CUDART__GRAPH_1g1920584881db959c8c74130d79019b73) unless the node resides on the same context as nodes which contained such calls at instantiate-time. If no such calls were
18202 /// present at instantiation, these updates cannot be performed at all.
18203 /// + Neither hGraph nor hGraphExec may contain device-updatable kernel nodes.
18204 /// * Memset and memcpy nodes:
18205 /// + The CUDA device(s) to which the operand(s) was allocated/mapped cannot change.
18206 /// + The source/destination memory must be allocated from the same contexts as the original source/destination memory.
18207 /// + For 2d memsets, only address and assigned value may be updated.
18208 /// + For 1d memsets, updating dimensions is also allowed, but may fail if the resulting operation doesn't map onto the work resources
18209 /// already allocated for the node.
18210 /// * Additional memcpy node restrictions:
18211 /// + Changing either the source or destination memory type(i.e. [`CUmemorytype::CU_MEMORYTYPE_DEVICE`], [`CUmemorytype::CU_MEMORYTYPE_ARRAY`], etc.) is not supported.
18212 /// * External semaphore wait nodes and record nodes:
18213 /// + Changing the number of semaphores is not supported.
18214 /// * Conditional nodes:
18215 /// + Changing node parameters is not supported.
18216 /// + Changing parameters of nodes within the conditional body graph is subject to the rules above.
18217 /// + Conditional handle flags and default values are updated as part of the graph update.
18218 ///
18219 /// Note: The API may add further restrictions in future releases. The return code should always be checked.
18220 ///
18221 /// cuGraphExecUpdate sets the result member of resultInfo to [`CUgraphExecUpdateResult::CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED`] under the following conditions:
18222 ///
18223 /// * The count of nodes directly in hGraphExec and hGraph differ, in which case resultInfo->errorNode is set to NULL.
18224 /// * hGraph has more exit nodes than hGraph, in which case resultInfo->errorNode is set to one of the exit nodes in hGraph.
18225 /// * A node in hGraph has a different number of dependencies than the node from hGraphExec it is paired with, in which case resultInfo->errorNode is set to the node from hGraph.
18226 /// * A node in hGraph has a dependency that does not match with the corresponding dependency of the paired node from hGraphExec. resultInfo->errorNode will be set to the node from hGraph. resultInfo->errorFromNode will be set to the mismatched dependency. The dependencies are paired based on edge order and
18227 /// a dependency does not match when the nodes are already paired based on other edges examined in the graph.
18228 ///
18229 /// cuGraphExecUpdate sets the result member of resultInfo to:
18230 ///
18231 /// * [`CUgraphExecUpdateResult::CU_GRAPH_EXEC_UPDATE_ERROR`] if passed an invalid value.
18232 /// * [`CUgraphExecUpdateResult::CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED`] if the graph topology changed
18233 /// * [`CUgraphExecUpdateResult::CU_GRAPH_EXEC_UPDATE_ERROR_NODE_TYPE_CHANGED`] if the type of a node changed, in which case hErrorNode_out is set to the node from hGraph.
18234 /// * [`CUgraphExecUpdateResult::CU_GRAPH_EXEC_UPDATE_ERROR_UNSUPPORTED_FUNCTION_CHANGE`] if the function changed in an unsupported way(see note above), in which
18235 /// case hErrorNode_out is set to the node from hGraph
18236 /// * [`CUgraphExecUpdateResult::CU_GRAPH_EXEC_UPDATE_ERROR_PARAMETERS_CHANGED`] if any parameters to a node changed in a way that is not supported, in which
18237 /// case hErrorNode_out is set to the node from hGraph.
18238 /// * [`CUgraphExecUpdateResult::CU_GRAPH_EXEC_UPDATE_ERROR_ATTRIBUTES_CHANGED`] if any attributes of a node changed in a way that is not supported, in which
18239 /// case hErrorNode_out is set to the node from hGraph.
18240 /// * [`CUgraphExecUpdateResult::CU_GRAPH_EXEC_UPDATE_ERROR_NOT_SUPPORTED`] if something about a node is unsupported, like the node's type or configuration,
18241 /// in which case hErrorNode_out is set to the node from hGraph
18242 ///
18243 /// If the update fails for a reason not listed above, the result member of resultInfo will be set to [`CUgraphExecUpdateResult::CU_GRAPH_EXEC_UPDATE_ERROR`]. If the update succeeds, the result member will be set to [`CUgraphExecUpdateResult::CU_GRAPH_EXEC_UPDATE_SUCCESS`].
18244 ///
18245 /// cuGraphExecUpdate returns [`CUresult::CUDA_SUCCESS`] when the updated was performed successfully. It returns [`CUresult::CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE`]
18246 /// if the graph update was not performed because it included changes which violated constraints specific to instantiated graph
18247 /// update.
18248 ///
18249 /// Note:
18250 ///
18251 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
18252 /// * Note that this function may also return error codes from previous, asynchronous launches.
18253 ///
18254 /// **See also:**
18255 ///
18256 /// `cuGraphInstantiate`.
18257 ///
18258 /// # Parameters
18259 ///
18260 /// - `hGraphExec`: The instantiated graph to be updated.
18261 /// - `hGraph`: The graph containing the updated parameters.
18262 /// - `resultInfo`: the error info structure.
18263 pub fn cuGraphExecUpdate_v2(
18264 hGraphExec: CUgraphExec,
18265 hGraph: CUgraph,
18266 resultInfo: *mut CUgraphExecUpdateResultInfo,
18267 ) -> CUresult;
18268}
18269unsafe extern "C" {
18270 /// Copies attributes from source node to destination node.
18271 ///
18272 /// Copies attributes from source node src to destination node dst. Both node must have the same context.
18273 ///
18274 /// Note:
18275 ///
18276 /// Note that this function may also return error codes from previous, asynchronous launches.
18277 ///
18278 /// **See also:**
18279 ///
18280 /// [`CUaccessPolicyWindow`].
18281 ///
18282 /// # Parameters
18283 ///
18284 /// - `dst`: Destination node.
18285 /// - `src`: Source node For list of attributes see CUkernelNodeAttrID.
18286 pub fn cuGraphKernelNodeCopyAttributes(
18287 dst: CUgraphNode,
18288 src: CUgraphNode,
18289 ) -> CUresult;
18290}
18291unsafe extern "C" {
18292 /// Queries node attribute.
18293 ///
18294 /// Queries attribute attr from node hNode and stores it in corresponding member of value_out.
18295 ///
18296 /// Note:
18297 ///
18298 /// Note that this function may also return error codes from previous, asynchronous launches.
18299 ///
18300 /// **See also:**
18301 ///
18302 /// [`CUaccessPolicyWindow`].
18303 pub fn cuGraphKernelNodeGetAttribute(
18304 hNode: CUgraphNode,
18305 attr: CUkernelNodeAttrID,
18306 value_out: *mut CUkernelNodeAttrValue,
18307 ) -> CUresult;
18308}
18309unsafe extern "C" {
18310 /// Sets node attribute.
18311 ///
18312 /// Sets attribute attr on node hNode from corresponding attribute of value.
18313 ///
18314 /// Note:
18315 ///
18316 /// Note that this function may also return error codes from previous, asynchronous launches.
18317 ///
18318 /// **See also:**
18319 ///
18320 /// [`CUaccessPolicyWindow`].
18321 pub fn cuGraphKernelNodeSetAttribute(
18322 hNode: CUgraphNode,
18323 attr: CUkernelNodeAttrID,
18324 value: *const CUkernelNodeAttrValue,
18325 ) -> CUresult;
18326}
18327unsafe extern "C" {
18328 /// Write a DOT file describing graph structure.
18329 ///
18330 /// Using the provided hGraph, write to path a DOT formatted description of the graph. By default this includes the graph topology, node types, node id, kernel names
18331 /// and memcpy direction. flags can be specified to write more detailed information about each node type such as parameter values, kernel attributes, node
18332 /// and function handles.
18333 ///
18334 /// # Parameters
18335 ///
18336 /// - `hGraph`: The graph to create a DOT file from.
18337 /// - `path`: The path to write the DOT file to.
18338 /// - `flags`: Flags from CUgraphDebugDot_flags for specifying which additional node information to write.
18339 pub fn cuGraphDebugDotPrint(
18340 hGraph: CUgraph,
18341 path: *const ::core::ffi::c_char,
18342 flags: ::core::ffi::c_uint,
18343 ) -> CUresult;
18344}
18345unsafe extern "C" {
18346 /// Create a user object.
18347 ///
18348 /// Create a user object with the specified destructor callback and initial reference count. The initial references are owned
18349 /// by the caller.
18350 ///
18351 /// Destructor callbacks cannot make CUDA API calls and should avoid blocking behavior, as they are executed by a shared internal
18352 /// thread. Another thread may be signaled to perform such actions, if it does not block forward progress of tasks scheduled through
18353 /// CUDA.
18354 ///
18355 /// See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects.
18356 ///
18357 /// **See also:**
18358 ///
18359 /// [`cuUserObjectRetain`], [`cuUserObjectRelease`], [`cuGraphRetainUserObject`], [`cuGraphReleaseUserObject`], [`cuGraphCreate`].
18360 ///
18361 /// # Parameters
18362 ///
18363 /// - `object_out`: Location to return the user object handle.
18364 /// - `ptr`: The pointer to pass to the destroy function.
18365 /// - `destroy`: Callback to free the user object when it is no longer in use.
18366 /// - `initialRefcount`: The initial refcount to create the object with, typically 1. The initial references are owned by the calling thread.
18367 /// - `flags`: Currently it is required to pass [`CUuserObject_flags_enum::CU_USER_OBJECT_NO_DESTRUCTOR_SYNC`], which is the only defined flag. This indicates that the destroy callback cannot be waited on by any CUDA API. Users requiring
18368 /// synchronization of the callback should signal its completion manually.
18369 pub fn cuUserObjectCreate(
18370 object_out: *mut CUuserObject,
18371 ptr: *mut ::core::ffi::c_void,
18372 destroy: CUhostFn,
18373 initialRefcount: ::core::ffi::c_uint,
18374 flags: ::core::ffi::c_uint,
18375 ) -> CUresult;
18376}
18377unsafe extern "C" {
18378 /// Retain a reference to a user object.
18379 ///
18380 /// Retains new references to a user object. The new references are owned by the caller.
18381 ///
18382 /// See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects.
18383 ///
18384 /// **See also:**
18385 ///
18386 /// [`cuUserObjectCreate`], [`cuUserObjectRelease`], [`cuGraphRetainUserObject`], [`cuGraphReleaseUserObject`], [`cuGraphCreate`].
18387 ///
18388 /// # Parameters
18389 ///
18390 /// - `object`: The object to retain.
18391 /// - `count`: The number of references to retain, typically 1. Must be nonzero and not larger than INT_MAX.
18392 pub fn cuUserObjectRetain(
18393 object: CUuserObject,
18394 count: ::core::ffi::c_uint,
18395 ) -> CUresult;
18396}
18397unsafe extern "C" {
18398 /// Release a reference to a user object.
18399 ///
18400 /// Releases user object references owned by the caller. The object's destructor is invoked if the reference count reaches zero.
18401 ///
18402 /// It is undefined behavior to release references not owned by the caller, or to use a user object handle after all references
18403 /// are released.
18404 ///
18405 /// See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects.
18406 ///
18407 /// **See also:**
18408 ///
18409 /// [`cuUserObjectCreate`], [`cuUserObjectRetain`], [`cuGraphRetainUserObject`], [`cuGraphReleaseUserObject`], [`cuGraphCreate`].
18410 ///
18411 /// # Parameters
18412 ///
18413 /// - `object`: The object to release.
18414 /// - `count`: The number of references to release, typically 1. Must be nonzero and not larger than INT_MAX.
18415 pub fn cuUserObjectRelease(
18416 object: CUuserObject,
18417 count: ::core::ffi::c_uint,
18418 ) -> CUresult;
18419}
18420unsafe extern "C" {
18421 /// Retain a reference to a user object from a graph.
18422 ///
18423 /// Creates or moves user object references that will be owned by a CUDA graph.
18424 ///
18425 /// See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects.
18426 ///
18427 /// **See also:**
18428 ///
18429 /// [`cuUserObjectCreate`], [`cuUserObjectRetain`], [`cuUserObjectRelease`], [`cuGraphReleaseUserObject`], [`cuGraphCreate`].
18430 ///
18431 /// # Parameters
18432 ///
18433 /// - `graph`: The graph to associate the reference with.
18434 /// - `object`: The user object to retain a reference for.
18435 /// - `count`: The number of references to add to the graph, typically 1. Must be nonzero and not larger than INT_MAX.
18436 /// - `flags`: The optional flag [`CUuserObjectRetain_flags_enum::CU_GRAPH_USER_OBJECT_MOVE`] transfers references from the calling thread, rather than create new references. Pass 0 to create new references.
18437 pub fn cuGraphRetainUserObject(
18438 graph: CUgraph,
18439 object: CUuserObject,
18440 count: ::core::ffi::c_uint,
18441 flags: ::core::ffi::c_uint,
18442 ) -> CUresult;
18443}
18444unsafe extern "C" {
18445 /// Release a user object reference from a graph.
18446 ///
18447 /// Releases user object references owned by a graph.
18448 ///
18449 /// See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects.
18450 ///
18451 /// **See also:**
18452 ///
18453 /// [`cuUserObjectCreate`], [`cuUserObjectRetain`], [`cuUserObjectRelease`], [`cuGraphRetainUserObject`], [`cuGraphCreate`].
18454 ///
18455 /// # Parameters
18456 ///
18457 /// - `graph`: The graph that will release the reference.
18458 /// - `object`: The user object to release a reference for.
18459 /// - `count`: The number of references to release, typically 1. Must be nonzero and not larger than INT_MAX.
18460 pub fn cuGraphReleaseUserObject(
18461 graph: CUgraph,
18462 object: CUuserObject,
18463 count: ::core::ffi::c_uint,
18464 ) -> CUresult;
18465}
18466unsafe extern "C" {
18467 /// Adds a node of arbitrary type to a graph.
18468 ///
18469 /// Creates a new node in hGraph described by nodeParams with numDependencies dependencies specified via dependencies. numDependencies may be 0. dependencies may be null if numDependencies is 0. dependencies may not have any duplicate entries.
18470 ///
18471 /// nodeParams is a tagged union. The node type should be specified in the type field, and type-specific parameters in the corresponding union member. All unused bytes - that is, reserved0 and all bytes past the utilized union member - must be set to zero. It is recommended to use brace initialization or memset
18472 /// to ensure all bytes are initialized.
18473 ///
18474 /// Note that for some node types, nodeParams may contain "out parameters" which are modified during the call, such as nodeParams->alloc.dptr.
18475 ///
18476 /// A handle to the new node will be returned in phGraphNode.
18477 ///
18478 /// Note:
18479 ///
18480 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
18481 /// * Note that this function may also return error codes from previous, asynchronous launches.
18482 ///
18483 /// **See also:**
18484 ///
18485 /// [`cuGraphCreate`], [`cuGraphNodeSetParams`], [`cuGraphExecNodeSetParams`].
18486 ///
18487 /// # Parameters
18488 ///
18489 /// - `phGraphNode`: Returns newly created node.
18490 /// - `hGraph`: Graph to which to add the node.
18491 /// - `dependencies`: Dependencies of the node.
18492 /// - `dependencyData`: Optional edge data for the dependencies. If NULL, the data is assumed to be default (zeroed) for all dependencies.
18493 /// - `numDependencies`: Number of dependencies.
18494 /// - `nodeParams`: Specification of the node.
18495 pub fn cuGraphAddNode_v2(
18496 phGraphNode: *mut CUgraphNode,
18497 hGraph: CUgraph,
18498 dependencies: *const CUgraphNode,
18499 dependencyData: *const CUgraphEdgeData,
18500 numDependencies: size_t,
18501 nodeParams: *mut CUgraphNodeParams,
18502 ) -> CUresult;
18503}
18504unsafe extern "C" {
18505 /// Update a graph node's parameters.
18506 ///
18507 /// Sets the parameters of graph node hNode to nodeParams. The node type specified by nodeParams->type must match the type of hNode. nodeParams must be fully initialized and all unused bytes (reserved, padding) zeroed.
18508 ///
18509 /// Modifying parameters is not supported for node types [`CUgraphNodeType::CU_GRAPH_NODE_TYPE_MEM_ALLOC`] and [`CUgraphNodeType::CU_GRAPH_NODE_TYPE_MEM_FREE`].
18510 ///
18511 /// Note:
18512 ///
18513 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
18514 /// * Note that this function may also return error codes from previous, asynchronous launches.
18515 ///
18516 /// **See also:**
18517 ///
18518 /// [`cuGraphAddNode_v2`], [`cuGraphNodeGetParams`], [`cuGraphExecNodeSetParams`].
18519 ///
18520 /// # Parameters
18521 ///
18522 /// - `hNode`: Node to set the parameters for.
18523 /// - `nodeParams`: Parameters to copy.
18524 pub fn cuGraphNodeSetParams(
18525 hNode: CUgraphNode,
18526 nodeParams: *mut CUgraphNodeParams,
18527 ) -> CUresult;
18528}
18529unsafe extern "C" {
18530 /// Return a graph node's parameters.
18531 ///
18532 /// Returns the parameters of graph node hNode in \*nodeParams.
18533 ///
18534 /// Any pointers returned in \*nodeParams point to driver-owned memory associated with the node. This memory remains valid until the node is destroyed. Any memory
18535 /// pointed to from \*nodeParams must not be modified.
18536 ///
18537 /// The returned parameters are a description of the node, but may not be identical to the struct provided at creation and may
18538 /// not be suitable for direct creation of identical nodes. This is because parameters may be partially unspecified and filled
18539 /// in by the driver at creation, may reference non-copyable handles, or may describe ownership semantics or other parameters
18540 /// that govern behavior of node creation but are not part of the final functional descriptor.
18541 ///
18542 /// Note:
18543 ///
18544 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
18545 /// * Note that this function may also return error codes from previous, asynchronous launches.
18546 ///
18547 /// **See also:**
18548 ///
18549 /// [`cuGraphNodeSetParams`], [`cuGraphAddNode_v2`], [`cuGraphExecNodeSetParams`].
18550 ///
18551 /// # Parameters
18552 ///
18553 /// - `hNode`: Node to get the parameters for.
18554 /// - `nodeParams`: Pointer to return the parameters.
18555 pub fn cuGraphNodeGetParams(
18556 hNode: CUgraphNode,
18557 nodeParams: *mut CUgraphNodeParams,
18558 ) -> CUresult;
18559}
18560unsafe extern "C" {
18561 /// Update a graph node's parameters in an instantiated graph.
18562 ///
18563 /// Sets the parameters of a node in an executable graph hGraphExec. The node is identified by the corresponding node hNode in the non-executable graph from which the executable graph was instantiated. hNode must not have been removed from the original graph.
18564 ///
18565 /// The modifications only affect future launches of hGraphExec. Already enqueued or running launches of hGraphExec are not affected by this call. hNode is also not modified by this call.
18566 ///
18567 /// Allowed changes to parameters on executable graphs are as follows:
18568 ///
18569 /// | Node type | Allowed changes |
18570 /// | --- | --- |
18571 /// | kernel | See [`cuGraphExecKernelNodeSetParams_v2`] |
18572 /// | memcpy | Addresses for 1-dimensional copies if allocated in same context; see [`cuGraphExecMemcpyNodeSetParams`] |
18573 /// | memset | Addresses for 1-dimensional memsets if allocated in same context; see [`cuGraphExecMemsetNodeSetParams`] |
18574 /// | host | Unrestricted |
18575 /// | child graph | Topology must match and restrictions apply recursively; see [`cuGraphExecUpdate_v2`] |
18576 /// | event wait | Unrestricted |
18577 /// | event record | Unrestricted |
18578 /// | external semaphore signal | Number of semaphore operations cannot change |
18579 /// | external semaphore wait | Number of semaphore operations cannot change |
18580 /// | memory allocation | API unsupported |
18581 /// | memory free | API unsupported |
18582 /// | batch memops | Addresses, values, and operation type for wait operations; see [`cuGraphExecBatchMemOpNodeSetParams`] |
18583 ///
18584 /// Note:
18585 ///
18586 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
18587 /// * Note that this function may also return error codes from previous, asynchronous launches.
18588 ///
18589 /// **See also:**
18590 ///
18591 /// [`cuGraphAddNode_v2`], [`cuGraphNodeSetParams`][`cuGraphExecUpdate_v2`], `cuGraphInstantiate`.
18592 ///
18593 /// # Parameters
18594 ///
18595 /// - `hGraphExec`: The executable graph in which to update the specified node.
18596 /// - `hNode`: Corresponding node from the graph from which graphExec was instantiated.
18597 /// - `nodeParams`: Updated Parameters to set.
18598 pub fn cuGraphExecNodeSetParams(
18599 hGraphExec: CUgraphExec,
18600 hNode: CUgraphNode,
18601 nodeParams: *mut CUgraphNodeParams,
18602 ) -> CUresult;
18603}
18604unsafe extern "C" {
18605 /// Create a conditional handle.
18606 ///
18607 /// Creates a conditional handle associated with hGraph.
18608 ///
18609 /// The conditional handle must be associated with a conditional node in this graph or one of its children.
18610 ///
18611 /// Handles not associated with a conditional node may cause graph instantiation to fail.
18612 ///
18613 /// Handles can only be set from the context with which they are associated.
18614 ///
18615 /// Note:
18616 ///
18617 /// * Graph objects are not threadsafe. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/graphs-thread-safety.html#graphs-thread-safety).
18618 /// * Note that this function may also return error codes from previous, asynchronous launches.
18619 ///
18620 /// **See also:**
18621 ///
18622 /// [`cuGraphAddNode_v2`].
18623 ///
18624 /// # Parameters
18625 ///
18626 /// - `pHandle_out`: Pointer used to return the handle to the caller.
18627 /// - `hGraph`: Graph which will contain the conditional node using this handle.
18628 /// - `ctx`: Context for the handle and associated conditional node.
18629 /// - `defaultLaunchValue`: Optional initial value for the conditional variable. Applied at the beginning of each graph execution if CU_GRAPH_COND_ASSIGN_DEFAULT
18630 /// is set in flags.
18631 /// - `flags`: Currently must be CU_GRAPH_COND_ASSIGN_DEFAULT or 0.
18632 pub fn cuGraphConditionalHandleCreate(
18633 pHandle_out: *mut CUgraphConditionalHandle,
18634 hGraph: CUgraph,
18635 ctx: CUcontext,
18636 defaultLaunchValue: ::core::ffi::c_uint,
18637 flags: ::core::ffi::c_uint,
18638 ) -> CUresult;
18639}
18640unsafe extern "C" {
18641 /// Returns occupancy of a function.
18642 ///
18643 /// Returns in \*numBlocks the number of the maximum active blocks per streaming multiprocessor.
18644 ///
18645 /// Note that the API can also be used with context-less kernel [`CUkernel`] by querying the handle using [`cuLibraryGetKernel`] and then passing it to the API by casting to [`CUfunction`]. Here, the context to use for calculations will be the current context.
18646 ///
18647 /// Note:
18648 ///
18649 /// Note that this function may also return error codes from previous, asynchronous launches.
18650 ///
18651 /// **See also:**
18652 ///
18653 /// [cudaOccupancyMaxActiveBlocksPerMultiprocessor](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g5a5d67a3c907371559ba692195e8a38c).
18654 ///
18655 /// # Parameters
18656 ///
18657 /// - `numBlocks`: Returned occupancy.
18658 /// - `func`: Kernel for which occupancy is calculated.
18659 /// - `blockSize`: Block size the kernel is intended to be launched with.
18660 /// - `dynamicSMemSize`: Per-block dynamic shared memory usage intended, in bytes.
18661 pub fn cuOccupancyMaxActiveBlocksPerMultiprocessor(
18662 numBlocks: *mut ::core::ffi::c_int,
18663 func: CUfunction,
18664 blockSize: ::core::ffi::c_int,
18665 dynamicSMemSize: size_t,
18666 ) -> CUresult;
18667}
18668unsafe extern "C" {
18669 /// Returns occupancy of a function.
18670 ///
18671 /// Returns in \*numBlocks the number of the maximum active blocks per streaming multiprocessor.
18672 ///
18673 /// The Flags parameter controls how special cases are handled. The valid flags are:
18674 ///
18675 /// * [`CUoccupancy_flags_enum::CU_OCCUPANCY_DEFAULT`], which maintains the default behavior as [`cuOccupancyMaxActiveBlocksPerMultiprocessor`];
18676 ///
18677 /// * [`CUoccupancy_flags_enum::CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE`], which suppresses the default behavior on platform where global caching affects occupancy. On such platforms, if caching
18678 /// is enabled, but per-block SM resource usage would result in zero occupancy, the occupancy calculator will calculate the occupancy
18679 /// as if caching is disabled. Setting [`CUoccupancy_flags_enum::CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE`] makes the occupancy calculator to return 0 in such cases. More information can be found about this feature in the "Unified
18680 /// L1/Texture Cache" section of the Maxwell tuning guide.
18681 ///
18682 /// Note that the API can also be with launch context-less kernel [`CUkernel`] by querying the handle using [`cuLibraryGetKernel`] and then passing it to the API by casting to [`CUfunction`]. Here, the context to use for calculations will be the current context.
18683 ///
18684 /// Note:
18685 ///
18686 /// Note that this function may also return error codes from previous, asynchronous launches.
18687 ///
18688 /// **See also:**
18689 ///
18690 /// [cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g603b86b20b37823253ff89fe8688ba83).
18691 ///
18692 /// # Parameters
18693 ///
18694 /// - `numBlocks`: Returned occupancy.
18695 /// - `func`: Kernel for which occupancy is calculated.
18696 /// - `blockSize`: Block size the kernel is intended to be launched with.
18697 /// - `dynamicSMemSize`: Per-block dynamic shared memory usage intended, in bytes.
18698 /// - `flags`: Requested behavior for the occupancy calculator.
18699 pub fn cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
18700 numBlocks: *mut ::core::ffi::c_int,
18701 func: CUfunction,
18702 blockSize: ::core::ffi::c_int,
18703 dynamicSMemSize: size_t,
18704 flags: ::core::ffi::c_uint,
18705 ) -> CUresult;
18706}
18707unsafe extern "C" {
18708 /// Suggest a launch configuration with reasonable occupancy.
18709 ///
18710 /// Returns in \*blockSize a reasonable block size that can achieve the maximum occupancy (or, the maximum number of active warps with the fewest blocks
18711 /// per multiprocessor), and in \*minGridSize the minimum grid size to achieve the maximum occupancy.
18712 ///
18713 /// If blockSizeLimit is 0, the configurator will use the maximum block size permitted by the device / function instead.
18714 ///
18715 /// If per-block dynamic shared memory allocation is not needed, the user should leave both blockSizeToDynamicSMemSize and dynamicSMemSize as 0.
18716 ///
18717 /// If per-block dynamic shared memory allocation is needed, then if the dynamic shared memory size is constant regardless of
18718 /// block size, the size should be passed through dynamicSMemSize, and blockSizeToDynamicSMemSize should be NULL.
18719 ///
18720 /// Otherwise, if the per-block dynamic shared memory size varies with different block sizes, the user needs to provide a unary
18721 /// function through blockSizeToDynamicSMemSize that computes the dynamic shared memory needed by func for any given block size. dynamicSMemSize is ignored. An example signature is:
18722 ///
18723 /// ```text
18724 /// // Take block size, returns dynamic shared memory needed
18725 /// size_t blockToSmem(int blockSize);
18726 /// ```
18727 ///
18728 /// Note that the API can also be used with context-less kernel [`CUkernel`] by querying the handle using [`cuLibraryGetKernel`] and then passing it to the API by casting to [`CUfunction`]. Here, the context to use for calculations will be the current context.
18729 ///
18730 /// Note:
18731 ///
18732 /// Note that this function may also return error codes from previous, asynchronous launches.
18733 ///
18734 /// **See also:**
18735 ///
18736 /// [cudaOccupancyMaxPotentialBlockSize](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1gee5334618ed4bb0871e4559a77643fc1).
18737 ///
18738 /// # Parameters
18739 ///
18740 /// - `minGridSize`: Returned minimum grid size needed to achieve the maximum occupancy.
18741 /// - `blockSize`: Returned maximum block size that can achieve the maximum occupancy.
18742 /// - `func`: Kernel for which launch configuration is calculated.
18743 /// - `blockSizeToDynamicSMemSize`: A function that calculates how much per-block dynamic shared memory func uses based on the block size.
18744 /// - `dynamicSMemSize`: Dynamic shared memory usage intended, in bytes.
18745 /// - `blockSizeLimit`: The maximum block size func is designed to handle.
18746 pub fn cuOccupancyMaxPotentialBlockSize(
18747 minGridSize: *mut ::core::ffi::c_int,
18748 blockSize: *mut ::core::ffi::c_int,
18749 func: CUfunction,
18750 blockSizeToDynamicSMemSize: CUoccupancyB2DSize,
18751 dynamicSMemSize: size_t,
18752 blockSizeLimit: ::core::ffi::c_int,
18753 ) -> CUresult;
18754}
18755unsafe extern "C" {
18756 /// Suggest a launch configuration with reasonable occupancy.
18757 ///
18758 /// An extended version of [`cuOccupancyMaxPotentialBlockSize`]. In addition to arguments passed to [`cuOccupancyMaxPotentialBlockSize`], [`cuOccupancyMaxPotentialBlockSizeWithFlags`] also takes a Flags parameter.
18759 ///
18760 /// The Flags parameter controls how special cases are handled. The valid flags are:
18761 ///
18762 /// * [`CUoccupancy_flags_enum::CU_OCCUPANCY_DEFAULT`], which maintains the default behavior as [`cuOccupancyMaxPotentialBlockSize`];
18763 ///
18764 /// * [`CUoccupancy_flags_enum::CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE`], which suppresses the default behavior on platform where global caching affects occupancy. On such platforms, the launch
18765 /// configurations that produces maximal occupancy might not support global caching. Setting [`CUoccupancy_flags_enum::CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE`] guarantees that the produced launch configuration is global caching compatible at a potential cost of occupancy. More
18766 /// information can be found about this feature in the "Unified L1/Texture Cache" section of the Maxwell tuning guide.
18767 ///
18768 /// Note that the API can also be used with context-less kernel [`CUkernel`] by querying the handle using [`cuLibraryGetKernel`] and then passing it to the API by casting to [`CUfunction`]. Here, the context to use for calculations will be the current context.
18769 ///
18770 /// Note:
18771 ///
18772 /// Note that this function may also return error codes from previous, asynchronous launches.
18773 ///
18774 /// **See also:**
18775 ///
18776 /// [cudaOccupancyMaxPotentialBlockSizeWithFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1gd0524825c5c01bbc9a5e29e890745800).
18777 ///
18778 /// # Parameters
18779 ///
18780 /// - `minGridSize`: Returned minimum grid size needed to achieve the maximum occupancy.
18781 /// - `blockSize`: Returned maximum block size that can achieve the maximum occupancy.
18782 /// - `func`: Kernel for which launch configuration is calculated.
18783 /// - `blockSizeToDynamicSMemSize`: A function that calculates how much per-block dynamic shared memory func uses based on the block size.
18784 /// - `dynamicSMemSize`: Dynamic shared memory usage intended, in bytes.
18785 /// - `blockSizeLimit`: The maximum block size func is designed to handle.
18786 /// - `flags`: Options.
18787 pub fn cuOccupancyMaxPotentialBlockSizeWithFlags(
18788 minGridSize: *mut ::core::ffi::c_int,
18789 blockSize: *mut ::core::ffi::c_int,
18790 func: CUfunction,
18791 blockSizeToDynamicSMemSize: CUoccupancyB2DSize,
18792 dynamicSMemSize: size_t,
18793 blockSizeLimit: ::core::ffi::c_int,
18794 flags: ::core::ffi::c_uint,
18795 ) -> CUresult;
18796}
18797unsafe extern "C" {
18798 /// Returns dynamic shared memory available per block when launching numBlocks blocks on SM.
18799 ///
18800 /// Returns in \*dynamicSmemSize the maximum size of dynamic shared memory to allow numBlocks blocks per SM.
18801 ///
18802 /// Note that the API can also be used with context-less kernel [`CUkernel`] by querying the handle using [`cuLibraryGetKernel`] and then passing it to the API by casting to [`CUfunction`]. Here, the context to use for calculations will be the current context.
18803 ///
18804 /// Note:
18805 ///
18806 /// Note that this function may also return error codes from previous, asynchronous launches.
18807 ///
18808 /// # Parameters
18809 ///
18810 /// - `dynamicSmemSize`: Returned maximum dynamic shared memory.
18811 /// - `func`: Kernel function for which occupancy is calculated.
18812 /// - `numBlocks`: Number of blocks to fit on SM.
18813 /// - `blockSize`: Size of the blocks.
18814 pub fn cuOccupancyAvailableDynamicSMemPerBlock(
18815 dynamicSmemSize: *mut size_t,
18816 func: CUfunction,
18817 numBlocks: ::core::ffi::c_int,
18818 blockSize: ::core::ffi::c_int,
18819 ) -> CUresult;
18820}
18821unsafe extern "C" {
18822 /// Given the kernel function (func) and launch configuration (config), return the maximum cluster size in \*clusterSize.
18823 ///
18824 /// The cluster dimensions in config are ignored. If func has a required cluster size set (see [cudaFuncGetAttributes](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g0e78e02c6d12ebddd4577ac6ebadf494) / [`cuFuncGetAttribute`]),\*clusterSize will reflect the required cluster size.
18825 ///
18826 /// By default this function will always return a value that's portable on future hardware. A higher value may be returned if
18827 /// the kernel function allows non-portable cluster sizes.
18828 ///
18829 /// This function will respect the compile time launch bounds.
18830 ///
18831 /// Note that the API can also be used with context-less kernel [`CUkernel`] by querying the handle using [`cuLibraryGetKernel`] and then passing it to the API by casting to [`CUfunction`]. Here, the context to use for calculations will either be taken from the specified stream config->hStream or the current context in case of NULL stream.
18832 ///
18833 /// Note:
18834 ///
18835 /// Note that this function may also return error codes from previous, asynchronous launches.
18836 ///
18837 /// **See also:**
18838 ///
18839 /// [cudaFuncGetAttributes](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g0e78e02c6d12ebddd4577ac6ebadf494), [`cuFuncGetAttribute`].
18840 ///
18841 /// # Parameters
18842 ///
18843 /// - `clusterSize`: Returned maximum cluster size that can be launched for the given kernel function and launch configuration.
18844 /// - `func`: Kernel function for which maximum cluster size is calculated.
18845 /// - `config`: Launch configuration for the given kernel function.
18846 pub fn cuOccupancyMaxPotentialClusterSize(
18847 clusterSize: *mut ::core::ffi::c_int,
18848 func: CUfunction,
18849 config: *const CUlaunchConfig,
18850 ) -> CUresult;
18851}
18852unsafe extern "C" {
18853 /// Given the kernel function (func) and launch configuration (config), return the maximum number of clusters that could co-exist on the target device in \*numClusters.
18854 ///
18855 /// If the function has required cluster size already set (see [cudaFuncGetAttributes](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g0e78e02c6d12ebddd4577ac6ebadf494) / [`cuFuncGetAttribute`]), the cluster size from config must either be unspecified or match the required size. Without required sizes, the cluster
18856 /// size must be specified in config, else the function will return an error.
18857 ///
18858 /// Note that various attributes of the kernel function may affect occupancy calculation. Runtime environment may affect how the
18859 /// hardware schedules the clusters, so the calculated occupancy is not guaranteed to be achievable.
18860 ///
18861 /// Note that the API can also be used with context-less kernel [`CUkernel`] by querying the handle using [`cuLibraryGetKernel`] and then passing it to the API by casting to [`CUfunction`]. Here, the context to use for calculations will either be taken from the specified stream config->hStream or the current context in case of NULL stream.
18862 ///
18863 /// Note:
18864 ///
18865 /// Note that this function may also return error codes from previous, asynchronous launches.
18866 ///
18867 /// **See also:**
18868 ///
18869 /// [cudaFuncGetAttributes](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g0e78e02c6d12ebddd4577ac6ebadf494), [`cuFuncGetAttribute`].
18870 ///
18871 /// # Parameters
18872 ///
18873 /// - `numClusters`: Returned maximum number of clusters that could co-exist on the target device.
18874 /// - `func`: Kernel function for which maximum number of clusters are calculated.
18875 /// - `config`: Launch configuration for the given kernel function.
18876 pub fn cuOccupancyMaxActiveClusters(
18877 numClusters: *mut ::core::ffi::c_int,
18878 func: CUfunction,
18879 config: *const CUlaunchConfig,
18880 ) -> CUresult;
18881}
18882unsafe extern "C" {
18883 /// Binds an array as a texture reference.
18884 ///
18885 /// hArray
18886 ///
18887 /// hTexRef
18888 ///
18889 /// Flags
18890 ///
18891 /// [`CU_TRSA_OVERRIDE_FORMAT`]
18892 ///
18893 /// hTexRef
18894 ///
18895 /// **See also:**
18896 ///
18897 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetFilterMode`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
18898 ///
18899 /// # Parameters
18900 ///
18901 /// - `hTexRef`: Texture reference to bind.
18902 /// - `hArray`: Array to bind.
18903 /// - `Flags`: Options (must be [`CU_TRSA_OVERRIDE_FORMAT`]).
18904 #[deprecated]
18905 pub fn cuTexRefSetArray(
18906 hTexRef: CUtexref,
18907 hArray: CUarray,
18908 Flags: ::core::ffi::c_uint,
18909 ) -> CUresult;
18910}
18911unsafe extern "C" {
18912 /// Binds a mipmapped array to a texture reference.
18913 ///
18914 /// hMipmappedArray
18915 ///
18916 /// hTexRef
18917 ///
18918 /// Flags
18919 ///
18920 /// [`CU_TRSA_OVERRIDE_FORMAT`]
18921 ///
18922 /// hTexRef
18923 ///
18924 /// **See also:**
18925 ///
18926 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetFilterMode`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
18927 ///
18928 /// # Parameters
18929 ///
18930 /// - `hTexRef`: Texture reference to bind.
18931 /// - `hMipmappedArray`: Mipmapped array to bind.
18932 /// - `Flags`: Options (must be [`CU_TRSA_OVERRIDE_FORMAT`]).
18933 #[deprecated]
18934 pub fn cuTexRefSetMipmappedArray(
18935 hTexRef: CUtexref,
18936 hMipmappedArray: CUmipmappedArray,
18937 Flags: ::core::ffi::c_uint,
18938 ) -> CUresult;
18939}
18940unsafe extern "C" {
18941 /// Binds an address as a texture reference.
18942 ///
18943 /// hTexRef
18944 ///
18945 /// hTexRef
18946 ///
18947 /// Since the hardware enforces an alignment requirement on texture base addresses, [`cuTexRefSetAddress_v2`] passes back a byte offset in \*ByteOffset that must be applied to texture fetches in order to read from the desired memory. This offset must be divided by the texel
18948 /// size and passed to kernels that read from the texture so they can be applied to the tex1Dfetch() function.
18949 ///
18950 /// If the device memory pointer was returned from [`cuMemAlloc_v2`], the offset is guaranteed to be 0 and NULL may be passed as the ByteOffset parameter.
18951 ///
18952 /// The total number of elements (or texels) in the linear address range cannot exceed [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH`]. The number of elements is computed as (bytes / bytesPerElement), where bytesPerElement is determined from the data format and number of components set using [`cuTexRefSetFormat`].
18953 ///
18954 /// **See also:**
18955 ///
18956 /// [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFilterMode`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
18957 ///
18958 /// # Parameters
18959 ///
18960 /// - `ByteOffset`: Returned byte offset.
18961 /// - `hTexRef`: Texture reference to bind.
18962 /// - `dptr`: Device pointer to bind.
18963 /// - `bytes`: Size of memory to bind in bytes.
18964 #[deprecated]
18965 pub fn cuTexRefSetAddress_v2(
18966 ByteOffset: *mut size_t,
18967 hTexRef: CUtexref,
18968 dptr: CUdeviceptr,
18969 bytes: size_t,
18970 ) -> CUresult;
18971}
18972unsafe extern "C" {
18973 /// Binds an address as a 2D texture reference.
18974 ///
18975 /// hTexRef
18976 ///
18977 /// hTexRef
18978 ///
18979 /// Using a tex2D() function inside a kernel requires a call to either [`cuTexRefSetArray`] to bind the corresponding texture reference to an array, or [`cuTexRefSetAddress2D_v3`] to bind the texture reference to linear memory.
18980 ///
18981 /// Function calls to [`cuTexRefSetFormat`] cannot follow calls to [`cuTexRefSetAddress2D_v3`] for the same texture reference.
18982 ///
18983 /// It is required that dptr be aligned to the appropriate hardware-specific texture alignment. You can query this value using the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT`]. If an unaligned dptr is supplied, [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] is returned.
18984 ///
18985 /// Pitch has to be aligned to the hardware-specific texture pitch alignment. This value can be queried using the device attribute
18986 /// [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT`]. If an unaligned Pitch is supplied, [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] is returned.
18987 ///
18988 /// Width and Height, which are specified in elements (or texels), cannot exceed [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH`] and [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT`] respectively. Pitch, which is specified in bytes, cannot exceed [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH`].
18989 ///
18990 /// **See also:**
18991 ///
18992 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFilterMode`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
18993 ///
18994 /// # Parameters
18995 ///
18996 /// - `hTexRef`: Texture reference to bind.
18997 /// - `desc`: Descriptor of CUDA array.
18998 /// - `dptr`: Device pointer to bind.
18999 /// - `Pitch`: Line pitch in bytes.
19000 #[deprecated]
19001 pub fn cuTexRefSetAddress2D_v3(
19002 hTexRef: CUtexref,
19003 desc: *const CUDA_ARRAY_DESCRIPTOR,
19004 dptr: CUdeviceptr,
19005 Pitch: size_t,
19006 ) -> CUresult;
19007}
19008unsafe extern "C" {
19009 /// Sets the format for a texture reference.
19010 ///
19011 /// hTexRef
19012 ///
19013 /// fmt
19014 ///
19015 /// NumPackedComponents
19016 ///
19017 /// **See also:**
19018 ///
19019 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFilterMode`], [`cuTexRefSetFlags`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`], [cudaCreateChannelDesc](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g655725c27d8ffe75accb9b531ecf2d15).
19020 ///
19021 /// # Parameters
19022 ///
19023 /// - `hTexRef`: Texture reference.
19024 /// - `fmt`: Format to set.
19025 /// - `NumPackedComponents`: Number of components per array element.
19026 #[deprecated]
19027 pub fn cuTexRefSetFormat(
19028 hTexRef: CUtexref,
19029 fmt: CUarray_format,
19030 NumPackedComponents: ::core::ffi::c_int,
19031 ) -> CUresult;
19032}
19033unsafe extern "C" {
19034 /// Sets the addressing mode for a texture reference.
19035 ///
19036 /// am
19037 ///
19038 /// dim
19039 ///
19040 /// hTexRef
19041 ///
19042 /// dim
19043 ///
19044 /// dim
19045 ///
19046 /// `CUaddress_mode`
19047 ///
19048 /// ```text
19049 /// typedef enum CUaddress_mode_enum {
19050 /// CU_TR_ADDRESS_MODE_WRAP = 0,
19051 /// CU_TR_ADDRESS_MODE_CLAMP = 1,
19052 /// CU_TR_ADDRESS_MODE_MIRROR = 2,
19053 /// CU_TR_ADDRESS_MODE_BORDER = 3
19054 /// } CUaddress_mode;
19055 /// ```
19056 ///
19057 /// Note that this call has no effect if hTexRef is bound to linear memory. Also, if the flag, [`CU_TRSF_NORMALIZED_COORDINATES`], is not set, the only supported address mode is [`CUaddress_mode_enum::CU_TR_ADDRESS_MODE_CLAMP`].
19058 ///
19059 /// **See also:**
19060 ///
19061 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetArray`], [`cuTexRefSetFilterMode`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
19062 ///
19063 /// # Parameters
19064 ///
19065 /// - `hTexRef`: Texture reference.
19066 /// - `dim`: Dimension.
19067 /// - `am`: Addressing mode to set.
19068 #[deprecated]
19069 pub fn cuTexRefSetAddressMode(
19070 hTexRef: CUtexref,
19071 dim: ::core::ffi::c_int,
19072 am: CUaddress_mode,
19073 ) -> CUresult;
19074}
19075unsafe extern "C" {
19076 /// Sets the filtering mode for a texture reference.
19077 ///
19078 /// fm
19079 ///
19080 /// hTexRef
19081 ///
19082 /// ```text
19083 /// typedef enum CUfilter_mode_enum {
19084 /// CU_TR_FILTER_MODE_POINT = 0,
19085 /// CU_TR_FILTER_MODE_LINEAR = 1
19086 /// } CUfilter_mode;
19087 /// ```
19088 ///
19089 /// Note that this call has no effect if hTexRef is bound to linear memory.
19090 ///
19091 /// **See also:**
19092 ///
19093 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
19094 ///
19095 /// # Parameters
19096 ///
19097 /// - `hTexRef`: Texture reference.
19098 /// - `fm`: Filtering mode to set.
19099 #[deprecated]
19100 pub fn cuTexRefSetFilterMode(hTexRef: CUtexref, fm: CUfilter_mode) -> CUresult;
19101}
19102unsafe extern "C" {
19103 /// Sets the mipmap filtering mode for a texture reference.
19104 ///
19105 /// fm
19106 ///
19107 /// hTexRef
19108 ///
19109 /// ```text
19110 /// typedef enum CUfilter_mode_enum {
19111 /// CU_TR_FILTER_MODE_POINT = 0,
19112 /// CU_TR_FILTER_MODE_LINEAR = 1
19113 /// } CUfilter_mode;
19114 /// ```
19115 ///
19116 /// Note that this call has no effect if hTexRef is not bound to a mipmapped array.
19117 ///
19118 /// **See also:**
19119 ///
19120 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
19121 ///
19122 /// # Parameters
19123 ///
19124 /// - `hTexRef`: Texture reference.
19125 /// - `fm`: Filtering mode to set.
19126 #[deprecated]
19127 pub fn cuTexRefSetMipmapFilterMode(hTexRef: CUtexref, fm: CUfilter_mode) -> CUresult;
19128}
19129unsafe extern "C" {
19130 /// Sets the mipmap level bias for a texture reference.
19131 ///
19132 /// bias
19133 ///
19134 /// hTexRef
19135 ///
19136 /// Note that this call has no effect if hTexRef is not bound to a mipmapped array.
19137 ///
19138 /// **See also:**
19139 ///
19140 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
19141 ///
19142 /// # Parameters
19143 ///
19144 /// - `hTexRef`: Texture reference.
19145 /// - `bias`: Mipmap level bias.
19146 #[deprecated]
19147 pub fn cuTexRefSetMipmapLevelBias(hTexRef: CUtexref, bias: f32) -> CUresult;
19148}
19149unsafe extern "C" {
19150 /// Sets the mipmap min/max mipmap level clamps for a texture reference.
19151 ///
19152 /// minMipmapLevelClamp
19153 ///
19154 /// maxMipmapLevelClamp
19155 ///
19156 /// hTexRef
19157 ///
19158 /// Note that this call has no effect if hTexRef is not bound to a mipmapped array.
19159 ///
19160 /// **See also:**
19161 ///
19162 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
19163 ///
19164 /// # Parameters
19165 ///
19166 /// - `hTexRef`: Texture reference.
19167 /// - `minMipmapLevelClamp`: Mipmap min level clamp.
19168 /// - `maxMipmapLevelClamp`: Mipmap max level clamp.
19169 #[deprecated]
19170 pub fn cuTexRefSetMipmapLevelClamp(
19171 hTexRef: CUtexref,
19172 minMipmapLevelClamp: f32,
19173 maxMipmapLevelClamp: f32,
19174 ) -> CUresult;
19175}
19176unsafe extern "C" {
19177 /// Sets the maximum anisotropy for a texture reference.
19178 ///
19179 /// maxAniso
19180 ///
19181 /// hTexRef
19182 ///
19183 /// Note that this call has no effect if hTexRef is bound to linear memory.
19184 ///
19185 /// **See also:**
19186 ///
19187 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
19188 ///
19189 /// # Parameters
19190 ///
19191 /// - `hTexRef`: Texture reference.
19192 /// - `maxAniso`: Maximum anisotropy.
19193 #[deprecated]
19194 pub fn cuTexRefSetMaxAnisotropy(
19195 hTexRef: CUtexref,
19196 maxAniso: ::core::ffi::c_uint,
19197 ) -> CUresult;
19198}
19199unsafe extern "C" {
19200 /// Sets the border color for a texture reference.
19201 ///
19202 /// pBorderColor
19203 ///
19204 /// hTexRef
19205 ///
19206 /// Note that the color values can be set only when the Address mode is set to [`CUaddress_mode::CU_TR_ADDRESS_MODE_BORDER`] using [`cuTexRefSetAddressMode`]. Applications using integer border color values have to "reinterpret_cast" their values to float.
19207 ///
19208 /// **See also:**
19209 ///
19210 /// [`cuTexRefSetAddressMode`], [`cuTexRefGetAddressMode`], [`cuTexRefGetBorderColor`].
19211 ///
19212 /// # Parameters
19213 ///
19214 /// - `hTexRef`: Texture reference.
19215 /// - `pBorderColor`: RGBA color.
19216 #[deprecated]
19217 pub fn cuTexRefSetBorderColor(hTexRef: CUtexref, pBorderColor: *mut f32) -> CUresult;
19218}
19219unsafe extern "C" {
19220 /// Sets the flags for a texture reference.
19221 ///
19222 /// Flags
19223 ///
19224 /// hTexRef
19225 ///
19226 /// * [`CU_TRSF_READ_AS_INTEGER`], which suppresses the default behavior of having the texture promote integer data to floating point data in the range \[0,
19227 /// 1\]. Note that texture with 32-bit integer format would not be promoted, regardless of whether or not this flag is specified;
19228 /// * [`CU_TRSF_NORMALIZED_COORDINATES`], which suppresses the default behavior of having the texture coordinates range from 0, Dim) where Dim is the width or height
19229 /// of the CUDA array. Instead, the texture coordinates [0, 1.0) reference the entire breadth of the array dimension;
19230 /// * [CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION, which disables any trilinear filtering optimizations. Trilinear optimizations improve texture filtering performance by allowing
19231 /// bilinear filtering on textures in scenarios where it can closely approximate the expected results.
19232 ///
19233 /// **See also:**
19234 ///
19235 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFilterMode`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
19236 ///
19237 /// # Parameters
19238 ///
19239 /// - `hTexRef`: Texture reference.
19240 /// - `Flags`: Optional flags to set.
19241 #[deprecated]
19242 pub fn cuTexRefSetFlags(hTexRef: CUtexref, Flags: ::core::ffi::c_uint) -> CUresult;
19243}
19244unsafe extern "C" {
19245 /// Gets the address associated with a texture reference.
19246 ///
19247 /// \*pdptr
19248 ///
19249 /// hTexRef
19250 ///
19251 /// [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`]
19252 ///
19253 /// **See also:**
19254 ///
19255 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFilterMode`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
19256 ///
19257 /// # Parameters
19258 ///
19259 /// - `pdptr`: Returned device address.
19260 /// - `hTexRef`: Texture reference.
19261 #[deprecated]
19262 pub fn cuTexRefGetAddress_v2(pdptr: *mut CUdeviceptr, hTexRef: CUtexref) -> CUresult;
19263}
19264unsafe extern "C" {
19265 /// Gets the array bound to a texture reference.
19266 ///
19267 /// \*phArray
19268 ///
19269 /// hTexRef
19270 ///
19271 /// [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`]
19272 ///
19273 /// **See also:**
19274 ///
19275 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFilterMode`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
19276 ///
19277 /// # Parameters
19278 ///
19279 /// - `phArray`: Returned array.
19280 /// - `hTexRef`: Texture reference.
19281 #[deprecated]
19282 pub fn cuTexRefGetArray(phArray: *mut CUarray, hTexRef: CUtexref) -> CUresult;
19283}
19284unsafe extern "C" {
19285 /// Gets the mipmapped array bound to a texture reference.
19286 ///
19287 /// \*phMipmappedArray
19288 ///
19289 /// hTexRef
19290 ///
19291 /// [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`]
19292 ///
19293 /// **See also:**
19294 ///
19295 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFilterMode`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
19296 ///
19297 /// # Parameters
19298 ///
19299 /// - `phMipmappedArray`: Returned mipmapped array.
19300 /// - `hTexRef`: Texture reference.
19301 #[deprecated]
19302 pub fn cuTexRefGetMipmappedArray(
19303 phMipmappedArray: *mut CUmipmappedArray,
19304 hTexRef: CUtexref,
19305 ) -> CUresult;
19306}
19307unsafe extern "C" {
19308 /// Gets the addressing mode used by a texture reference.
19309 ///
19310 /// \*pam
19311 ///
19312 /// dim
19313 ///
19314 /// hTexRef
19315 ///
19316 /// dim
19317 ///
19318 /// **See also:**
19319 ///
19320 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFilterMode`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
19321 ///
19322 /// # Parameters
19323 ///
19324 /// - `pam`: Returned addressing mode.
19325 /// - `hTexRef`: Texture reference.
19326 /// - `dim`: Dimension.
19327 #[deprecated]
19328 pub fn cuTexRefGetAddressMode(
19329 pam: *mut CUaddress_mode,
19330 hTexRef: CUtexref,
19331 dim: ::core::ffi::c_int,
19332 ) -> CUresult;
19333}
19334unsafe extern "C" {
19335 /// Gets the filter-mode used by a texture reference.
19336 ///
19337 /// \*pfm
19338 ///
19339 /// hTexRef
19340 ///
19341 /// **See also:**
19342 ///
19343 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFilterMode`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
19344 ///
19345 /// # Parameters
19346 ///
19347 /// - `pfm`: Returned filtering mode.
19348 /// - `hTexRef`: Texture reference.
19349 #[deprecated]
19350 pub fn cuTexRefGetFilterMode(pfm: *mut CUfilter_mode, hTexRef: CUtexref) -> CUresult;
19351}
19352unsafe extern "C" {
19353 /// Gets the format used by a texture reference.
19354 ///
19355 /// \*pFormat
19356 ///
19357 /// \*pNumChannels
19358 ///
19359 /// hTexRef
19360 ///
19361 /// pFormat
19362 ///
19363 /// pNumChannels
19364 ///
19365 /// **See also:**
19366 ///
19367 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFilterMode`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`].
19368 ///
19369 /// # Parameters
19370 ///
19371 /// - `pFormat`: Returned format.
19372 /// - `pNumChannels`: Returned number of components.
19373 /// - `hTexRef`: Texture reference.
19374 #[deprecated]
19375 pub fn cuTexRefGetFormat(
19376 pFormat: *mut CUarray_format,
19377 pNumChannels: *mut ::core::ffi::c_int,
19378 hTexRef: CUtexref,
19379 ) -> CUresult;
19380}
19381unsafe extern "C" {
19382 /// Gets the mipmap filtering mode for a texture reference.
19383 ///
19384 /// pfm
19385 ///
19386 /// hTexRef
19387 ///
19388 /// **See also:**
19389 ///
19390 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
19391 ///
19392 /// # Parameters
19393 ///
19394 /// - `pfm`: Returned mipmap filtering mode.
19395 /// - `hTexRef`: Texture reference.
19396 #[deprecated]
19397 pub fn cuTexRefGetMipmapFilterMode(
19398 pfm: *mut CUfilter_mode,
19399 hTexRef: CUtexref,
19400 ) -> CUresult;
19401}
19402unsafe extern "C" {
19403 /// Gets the mipmap level bias for a texture reference.
19404 ///
19405 /// pBias
19406 ///
19407 /// hTexRef
19408 ///
19409 /// **See also:**
19410 ///
19411 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
19412 ///
19413 /// # Parameters
19414 ///
19415 /// - `pbias`: Returned mipmap level bias.
19416 /// - `hTexRef`: Texture reference.
19417 #[deprecated]
19418 pub fn cuTexRefGetMipmapLevelBias(pbias: *mut f32, hTexRef: CUtexref) -> CUresult;
19419}
19420unsafe extern "C" {
19421 /// Gets the min/max mipmap level clamps for a texture reference.
19422 ///
19423 /// pminMipmapLevelClamp
19424 ///
19425 /// pmaxMipmapLevelClamp
19426 ///
19427 /// hTexRef
19428 ///
19429 /// **See also:**
19430 ///
19431 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
19432 ///
19433 /// # Parameters
19434 ///
19435 /// - `pminMipmapLevelClamp`: Returned mipmap min level clamp.
19436 /// - `pmaxMipmapLevelClamp`: Returned mipmap max level clamp.
19437 /// - `hTexRef`: Texture reference.
19438 #[deprecated]
19439 pub fn cuTexRefGetMipmapLevelClamp(
19440 pminMipmapLevelClamp: *mut f32,
19441 pmaxMipmapLevelClamp: *mut f32,
19442 hTexRef: CUtexref,
19443 ) -> CUresult;
19444}
19445unsafe extern "C" {
19446 /// Gets the maximum anisotropy for a texture reference.
19447 ///
19448 /// pmaxAniso
19449 ///
19450 /// hTexRef
19451 ///
19452 /// **See also:**
19453 ///
19454 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFlags`], [`cuTexRefGetFormat`].
19455 ///
19456 /// # Parameters
19457 ///
19458 /// - `pmaxAniso`: Returned maximum anisotropy.
19459 /// - `hTexRef`: Texture reference.
19460 #[deprecated]
19461 pub fn cuTexRefGetMaxAnisotropy(
19462 pmaxAniso: *mut ::core::ffi::c_int,
19463 hTexRef: CUtexref,
19464 ) -> CUresult;
19465}
19466unsafe extern "C" {
19467 /// Gets the border color used by a texture reference.
19468 ///
19469 /// pBorderColor
19470 ///
19471 /// hTexRef
19472 ///
19473 /// **See also:**
19474 ///
19475 /// [`cuTexRefSetAddressMode`], [`cuTexRefSetAddressMode`], [`cuTexRefSetBorderColor`].
19476 ///
19477 /// # Parameters
19478 ///
19479 /// - `pBorderColor`: Returned Type and Value of RGBA color.
19480 /// - `hTexRef`: Texture reference.
19481 #[deprecated]
19482 pub fn cuTexRefGetBorderColor(pBorderColor: *mut f32, hTexRef: CUtexref) -> CUresult;
19483}
19484unsafe extern "C" {
19485 /// Gets the flags used by a texture reference.
19486 ///
19487 /// \*pFlags
19488 ///
19489 /// hTexRef
19490 ///
19491 /// **See also:**
19492 ///
19493 /// [`cuTexRefSetAddress_v2`], [`cuTexRefSetAddress2D_v3`], [`cuTexRefSetAddressMode`], [`cuTexRefSetArray`], [`cuTexRefSetFilterMode`], [`cuTexRefSetFlags`], [`cuTexRefSetFormat`], [`cuTexRefGetAddress_v2`], [`cuTexRefGetAddressMode`], [`cuTexRefGetArray`], [`cuTexRefGetFilterMode`], [`cuTexRefGetFormat`].
19494 ///
19495 /// # Parameters
19496 ///
19497 /// - `pFlags`: Returned flags.
19498 /// - `hTexRef`: Texture reference.
19499 #[deprecated]
19500 pub fn cuTexRefGetFlags(
19501 pFlags: *mut ::core::ffi::c_uint,
19502 hTexRef: CUtexref,
19503 ) -> CUresult;
19504}
19505unsafe extern "C" {
19506 /// Creates a texture reference.
19507 ///
19508 /// \*pTexRef
19509 ///
19510 /// [`cuTexRefSetArray`]
19511 ///
19512 /// [`cuTexRefSetAddress_v2`]
19513 ///
19514 /// **See also:**
19515 ///
19516 /// [`cuTexRefDestroy`].
19517 ///
19518 /// # Parameters
19519 ///
19520 /// - `pTexRef`: Returned texture reference.
19521 #[deprecated]
19522 pub fn cuTexRefCreate(pTexRef: *mut CUtexref) -> CUresult;
19523}
19524unsafe extern "C" {
19525 /// Destroys a texture reference.
19526 ///
19527 /// hTexRef
19528 ///
19529 /// **See also:**
19530 ///
19531 /// [`cuTexRefCreate`].
19532 ///
19533 /// # Parameters
19534 ///
19535 /// - `hTexRef`: Texture reference to destroy.
19536 #[deprecated]
19537 pub fn cuTexRefDestroy(hTexRef: CUtexref) -> CUresult;
19538}
19539unsafe extern "C" {
19540 /// Sets the CUDA array for a surface reference.
19541 ///
19542 /// hArray
19543 ///
19544 /// hSurfRef
19545 ///
19546 /// Flags
19547 ///
19548 /// [`CUDA_ARRAY3D_SURFACE_LDST`]
19549 ///
19550 /// hSurfRef
19551 ///
19552 /// **See also:**
19553 ///
19554 /// [`cuModuleGetSurfRef`], [`cuSurfRefGetArray`].
19555 ///
19556 /// # Parameters
19557 ///
19558 /// - `hSurfRef`: Surface reference handle.
19559 /// - `hArray`: CUDA array handle.
19560 /// - `Flags`: set to 0.
19561 #[deprecated]
19562 pub fn cuSurfRefSetArray(
19563 hSurfRef: CUsurfref,
19564 hArray: CUarray,
19565 Flags: ::core::ffi::c_uint,
19566 ) -> CUresult;
19567}
19568unsafe extern "C" {
19569 /// Passes back the CUDA array bound to a surface reference.
19570 ///
19571 /// \*phArray
19572 ///
19573 /// hSurfRef
19574 ///
19575 /// [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`]
19576 ///
19577 /// **See also:**
19578 ///
19579 /// [`cuModuleGetSurfRef`], [`cuSurfRefSetArray`].
19580 ///
19581 /// # Parameters
19582 ///
19583 /// - `phArray`: Surface reference handle.
19584 /// - `hSurfRef`: Surface reference handle.
19585 #[deprecated]
19586 pub fn cuSurfRefGetArray(phArray: *mut CUarray, hSurfRef: CUsurfref) -> CUresult;
19587}
19588unsafe extern "C" {
19589 /// Creates a texture object.
19590 ///
19591 /// Creates a texture object and returns it in pTexObject. pResDesc describes the data to texture from. pTexDesc describes how the data should be sampled. pResViewDesc is an optional argument that specifies an alternate format for the data described by pResDesc, and also describes the subresource region to restrict access to when texturing. pResViewDesc can only be specified if the type of resource is a CUDA array or a CUDA mipmapped array not in a block compressed format.
19592 ///
19593 /// Texture objects are only supported on devices of compute capability 3.0 or higher. Additionally, a texture object is an opaque
19594 /// value, and, as such, should only be accessed through CUDA API calls.
19595 ///
19596 /// The CUDA_RESOURCE_DESC structure is defined as:
19597 ///
19598 /// ```text
19599 /// typedef struct CUDA_RESOURCE_DESC_st
19600 /// {
19601 /// CUresourcetype resType;
19602 ///
19603 /// union {
19604 /// struct {
19605 /// CUarray hArray;
19606 /// } array;
19607 /// struct {
19608 /// CUmipmappedArray hMipmappedArray;
19609 /// } mipmap;
19610 /// struct {
19611 /// CUdeviceptr devPtr;
19612 /// CUarray_format format;
19613 /// unsigned int numChannels;
19614 /// size_t sizeInBytes;
19615 /// } linear;
19616 /// struct {
19617 /// CUdeviceptr devPtr;
19618 /// CUarray_format format;
19619 /// unsigned int numChannels;
19620 /// size_t width;
19621 /// size_t height;
19622 /// size_t pitchInBytes;
19623 /// } pitch2D;
19624 /// } res;
19625 ///
19626 /// unsigned int flags;
19627 /// } CUDA_RESOURCE_DESC;
19628 /// ```
19629 ///
19630 /// where:
19631 ///
19632 /// * [CUDA_RESOURCE_DESC::resType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__RESOURCE__DESC__v1.html#structCUDA__RESOURCE__DESC__v1_1fe341889f4a57165e7acc0efcfc38b64) specifies the type of resource to texture from. CUresourceType is defined as:
19633 ///
19634 /// ```text
19635 /// typedef enum CUresourcetype_enum {
19636 /// CU_RESOURCE_TYPE_ARRAY = 0x00,
19637 /// CU_RESOURCE_TYPE_MIPMAPPED_ARRAY = 0x01,
19638 /// CU_RESOURCE_TYPE_LINEAR = 0x02,
19639 /// CU_RESOURCE_TYPE_PITCH2D = 0x03
19640 /// } CUresourcetype;
19641 /// ```
19642 ///
19643 /// If [CUDA_RESOURCE_DESC::resType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__RESOURCE__DESC__v1.html#structCUDA__RESOURCE__DESC__v1_1fe341889f4a57165e7acc0efcfc38b64) is set to [`CUresourcetype_enum::CU_RESOURCE_TYPE_ARRAY`], CUDA_RESOURCE_DESC::res::array::hArray must be set to a valid CUDA array handle.
19644 ///
19645 /// If [CUDA_RESOURCE_DESC::resType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__RESOURCE__DESC__v1.html#structCUDA__RESOURCE__DESC__v1_1fe341889f4a57165e7acc0efcfc38b64) is set to [`CUresourcetype_enum::CU_RESOURCE_TYPE_MIPMAPPED_ARRAY`], CUDA_RESOURCE_DESC::res::mipmap::hMipmappedArray must be set to a valid CUDA mipmapped array handle.
19646 ///
19647 /// If [CUDA_RESOURCE_DESC::resType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__RESOURCE__DESC__v1.html#structCUDA__RESOURCE__DESC__v1_1fe341889f4a57165e7acc0efcfc38b64) is set to [`CUresourcetype_enum::CU_RESOURCE_TYPE_LINEAR`], CUDA_RESOURCE_DESC::res::linear::devPtr must be set to a valid device pointer, that is aligned to [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT`]. CUDA_RESOURCE_DESC::res::linear::format and CUDA_RESOURCE_DESC::res::linear::numChannels describe the format of each component
19648 /// and the number of components per array element. CUDA_RESOURCE_DESC::res::linear::sizeInBytes specifies the size of the array
19649 /// in bytes. The total number of elements in the linear address range cannot exceed [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH`]. The number of elements is computed as (sizeInBytes / (sizeof(format) \* numChannels)).
19650 ///
19651 /// If [CUDA_RESOURCE_DESC::resType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__RESOURCE__DESC__v1.html#structCUDA__RESOURCE__DESC__v1_1fe341889f4a57165e7acc0efcfc38b64) is set to [`CUresourcetype_enum::CU_RESOURCE_TYPE_PITCH2D`], CUDA_RESOURCE_DESC::res::pitch2D::devPtr must be set to a valid device pointer, that is aligned to [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT`]. CUDA_RESOURCE_DESC::res::pitch2D::format and CUDA_RESOURCE_DESC::res::pitch2D::numChannels describe the format of each component
19652 /// and the number of components per array element. CUDA_RESOURCE_DESC::res::pitch2D::width and CUDA_RESOURCE_DESC::res::pitch2D::height
19653 /// specify the width and height of the array in elements, and cannot exceed [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH`] and [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT`] respectively. CUDA_RESOURCE_DESC::res::pitch2D::pitchInBytes specifies the pitch between two rows in bytes and has to be
19654 /// aligned to [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT`]. Pitch cannot exceed [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH`].
19655 ///
19656 /// * flags must be set to zero.
19657 ///
19658 /// The CUDA_TEXTURE_DESC struct is defined as
19659 ///
19660 /// ```text
19661 /// typedef struct CUDA_TEXTURE_DESC_st {
19662 /// CUaddress_mode addressMode\[3\];
19663 /// CUfilter_mode filterMode;
19664 /// unsigned int flags;
19665 /// unsigned int maxAnisotropy;
19666 /// CUfilter_mode mipmapFilterMode;
19667 /// float mipmapLevelBias;
19668 /// float minMipmapLevelClamp;
19669 /// float maxMipmapLevelClamp;
19670 /// } CUDA_TEXTURE_DESC;
19671 /// ```
19672 ///
19673 /// where
19674 ///
19675 /// * [CUDA_TEXTURE_DESC::addressMode](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__TEXTURE__DESC__v1.html#structCUDA__TEXTURE__DESC__v1_1aeb3f6fa73835433a7700b80eea8d49b) specifies the addressing mode for each dimension of the texture data. `CUaddress_mode` is defined as:
19676 ///
19677 /// ```text
19678 /// typedef enum CUaddress_mode_enum {
19679 /// CU_TR_ADDRESS_MODE_WRAP = 0,
19680 /// CU_TR_ADDRESS_MODE_CLAMP = 1,
19681 /// CU_TR_ADDRESS_MODE_MIRROR = 2,
19682 /// CU_TR_ADDRESS_MODE_BORDER = 3
19683 /// } CUaddress_mode;
19684 /// ```
19685 ///
19686 /// This is ignored if [CUDA_RESOURCE_DESC::resType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__RESOURCE__DESC__v1.html#structCUDA__RESOURCE__DESC__v1_1fe341889f4a57165e7acc0efcfc38b64) is [`CUresourcetype_enum::CU_RESOURCE_TYPE_LINEAR`]. Also, if the flag, [`CU_TRSF_NORMALIZED_COORDINATES`] is not set, the only supported address mode is [`CUaddress_mode_enum::CU_TR_ADDRESS_MODE_CLAMP`].
19687 ///
19688 /// * [CUDA_TEXTURE_DESC::filterMode](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__TEXTURE__DESC__v1.html#structCUDA__TEXTURE__DESC__v1_182e92599f2f13422d8cc6cfe947e6b17) specifies the filtering mode to be used when fetching from the texture. CUfilter_mode is defined as:
19689 ///
19690 /// ```text
19691 /// typedef enum CUfilter_mode_enum {
19692 /// CU_TR_FILTER_MODE_POINT = 0,
19693 /// CU_TR_FILTER_MODE_LINEAR = 1
19694 /// } CUfilter_mode;
19695 /// ```
19696 ///
19697 /// This is ignored if [CUDA_RESOURCE_DESC::resType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__RESOURCE__DESC__v1.html#structCUDA__RESOURCE__DESC__v1_1fe341889f4a57165e7acc0efcfc38b64) is [`CUresourcetype_enum::CU_RESOURCE_TYPE_LINEAR`].
19698 ///
19699 /// * [CUDA_TEXTURE_DESC::flags](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__TEXTURE__DESC__v1.html#structCUDA__TEXTURE__DESC__v1_1f50575c45ea8767561db54f4e785cabd) can be any combination of the following:
19700 /// + [`CU_TRSF_READ_AS_INTEGER`], which suppresses the default behavior of having the texture promote integer data to floating point data in the range [0,
19701 /// ```text
19702 /// 1]. Note that texture with 32-bit integer format would not be promoted, regardless of whether or not this flag is specified.
19703 /// ```
19704 /// + [`CU_TRSF_NORMALIZED_COORDINATES`], which suppresses the default behavior of having the texture coordinates range from 0, Dim) where Dim is the width or height
19705 /// ```text
19706 /// of the CUDA array. Instead, the texture coordinates [0, 1.0) reference the entire breadth of the array dimension; Note that
19707 /// for CUDA mipmapped arrays, this flag has to be set.
19708 /// ```
19709 /// + [CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION, which disables any trilinear filtering optimizations. Trilinear optimizations improve texture filtering performance by allowing
19710 /// bilinear filtering on textures in scenarios where it can closely approximate the expected results.
19711 /// + [`CU_TRSF_SEAMLESS_CUBEMAP`], which enables seamless cube map filtering. This flag can only be specified if the underlying resource is a CUDA array or
19712 /// a CUDA mipmapped array that was created with the flag [`CUDA_ARRAY3D_CUBEMAP`]. When seamless cube map filtering is enabled, texture address modes specified by [CUDA_TEXTURE_DESC::addressMode](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__TEXTURE__DESC__v1.html#structCUDA__TEXTURE__DESC__v1_1aeb3f6fa73835433a7700b80eea8d49b) are ignored. Instead, if the [CUDA_TEXTURE_DESC::filterMode](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__TEXTURE__DESC__v1.html#structCUDA__TEXTURE__DESC__v1_182e92599f2f13422d8cc6cfe947e6b17) is set to [`CUfilter_mode_enum::CU_TR_FILTER_MODE_POINT`] the address mode [`CUaddress_mode_enum::CU_TR_ADDRESS_MODE_CLAMP`] will be applied for all dimensions. If the [CUDA_TEXTURE_DESC::filterMode](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__TEXTURE__DESC__v1.html#structCUDA__TEXTURE__DESC__v1_182e92599f2f13422d8cc6cfe947e6b17) is set to [`CUfilter_mode_enum::CU_TR_FILTER_MODE_LINEAR`] seamless cube map filtering will be performed when sampling along the cube face borders.
19713 ///
19714 /// * [CUDA_TEXTURE_DESC::maxAnisotropy](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__TEXTURE__DESC__v1.html#structCUDA__TEXTURE__DESC__v1_139035372a07e031d233445673427f34a) specifies the maximum anisotropy ratio to be used when doing anisotropic filtering. This value will be clamped to the range
19715 /// \[1,16\].
19716 ///
19717 /// * [CUDA_TEXTURE_DESC::mipmapFilterMode](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__TEXTURE__DESC__v1.html#structCUDA__TEXTURE__DESC__v1_117333d832def1d97420ddd0bce8c73ce) specifies the filter mode when the calculated mipmap level lies between two defined mipmap levels.
19718 ///
19719 /// * [CUDA_TEXTURE_DESC::mipmapLevelBias](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__TEXTURE__DESC__v1.html#structCUDA__TEXTURE__DESC__v1_10b1c10e7f1eedc4a8ab547da5741ce2d) specifies the offset to be applied to the calculated mipmap level.
19720 ///
19721 /// * [CUDA_TEXTURE_DESC::minMipmapLevelClamp](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__TEXTURE__DESC__v1.html#structCUDA__TEXTURE__DESC__v1_1bf7da8359ccf52ba8afcd28c31b48be8) specifies the lower end of the mipmap level range to clamp access to.
19722 ///
19723 /// * [CUDA_TEXTURE_DESC::maxMipmapLevelClamp](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__TEXTURE__DESC__v1.html#structCUDA__TEXTURE__DESC__v1_1149eca11ac6059979a1754bffcc6c210) specifies the upper end of the mipmap level range to clamp access to.
19724 ///
19725 /// The CUDA_RESOURCE_VIEW_DESC struct is defined as
19726 ///
19727 /// ```text
19728 /// typedef struct CUDA_RESOURCE_VIEW_DESC_st
19729 /// {
19730 /// CUresourceViewFormat format;
19731 /// size_t width;
19732 /// size_t height;
19733 /// size_t depth;
19734 /// unsigned int firstMipmapLevel;
19735 /// unsigned int lastMipmapLevel;
19736 /// unsigned int firstLayer;
19737 /// unsigned int lastLayer;
19738 /// } CUDA_RESOURCE_VIEW_DESC;
19739 /// ```
19740 ///
19741 /// where:
19742 ///
19743 /// * [CUDA_RESOURCE_VIEW_DESC::format](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__RESOURCE__VIEW__DESC__v1.html#structCUDA__RESOURCE__VIEW__DESC__v1_17ee307ae64bba468ea89bb502d3f8386) specifies how the data contained in the CUDA array or CUDA mipmapped array should be interpreted. Note that this can incur
19744 /// a change in size of the texture data. If the resource view format is a block compressed format, then the underlying CUDA array
19745 /// or CUDA mipmapped array has to have a base of format [`CUarray_format_enum::CU_AD_FORMAT_UNSIGNED_INT32`]. with 2 or 4 channels, depending on the block compressed format. For ex., BC1 and BC4 require the underlying CUDA array to
19746 /// have a format of [`CUarray_format_enum::CU_AD_FORMAT_UNSIGNED_INT32`] with 2 channels. The other BC formats require the underlying resource to have the same base format but with 4 channels.
19747 ///
19748 /// * [CUDA_RESOURCE_VIEW_DESC::width](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__RESOURCE__VIEW__DESC__v1.html#structCUDA__RESOURCE__VIEW__DESC__v1_17a74f483b2af8a73d2a1876688926e63) specifies the new width of the texture data. If the resource view format is a block compressed format, this value has to
19749 /// be 4 times the original width of the resource. For non block compressed formats, this value has to be equal to that of the
19750 /// original resource.
19751 ///
19752 /// * [CUDA_RESOURCE_VIEW_DESC::height](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__RESOURCE__VIEW__DESC__v1.html#structCUDA__RESOURCE__VIEW__DESC__v1_1a2737a7f88568199ab94d7c3f696bed3) specifies the new height of the texture data. If the resource view format is a block compressed format, this value has to
19753 /// be 4 times the original height of the resource. For non block compressed formats, this value has to be equal to that of the
19754 /// original resource.
19755 ///
19756 /// * [CUDA_RESOURCE_VIEW_DESC::depth](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__RESOURCE__VIEW__DESC__v1.html#structCUDA__RESOURCE__VIEW__DESC__v1_164ca74e2623b821d8dfbbabbc5c839f6) specifies the new depth of the texture data. This value has to be equal to that of the original resource.
19757 ///
19758 /// * [CUDA_RESOURCE_VIEW_DESC::firstMipmapLevel](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__RESOURCE__VIEW__DESC__v1.html#structCUDA__RESOURCE__VIEW__DESC__v1_134105380b4498ef2a7b6f9898f983df3) specifies the most detailed mipmap level. This will be the new mipmap level zero. For non-mipmapped resources, this value
19759 /// has to be zero.[CUDA_TEXTURE_DESC::minMipmapLevelClamp](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__TEXTURE__DESC__v1.html#structCUDA__TEXTURE__DESC__v1_1bf7da8359ccf52ba8afcd28c31b48be8) and [CUDA_TEXTURE_DESC::maxMipmapLevelClamp](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__TEXTURE__DESC__v1.html#structCUDA__TEXTURE__DESC__v1_1149eca11ac6059979a1754bffcc6c210) will be relative to this value. For ex., if the firstMipmapLevel is set to 2, and a minMipmapLevelClamp of 1.2 is specified,
19760 /// then the actual minimum mipmap level clamp will be 3.2.
19761 ///
19762 /// * [CUDA_RESOURCE_VIEW_DESC::lastMipmapLevel](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__RESOURCE__VIEW__DESC__v1.html#structCUDA__RESOURCE__VIEW__DESC__v1_16e0dc4da9bcf7518fc66aee8f0dd928e) specifies the least detailed mipmap level. For non-mipmapped resources, this value has to be zero.
19763 ///
19764 /// * [CUDA_RESOURCE_VIEW_DESC::firstLayer](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__RESOURCE__VIEW__DESC__v1.html#structCUDA__RESOURCE__VIEW__DESC__v1_154262bb560a5c52aa73dfe97077334f9) specifies the first layer index for layered textures. This will be the new layer zero. For non-layered resources, this value
19765 /// has to be zero.
19766 ///
19767 /// * [CUDA_RESOURCE_VIEW_DESC::lastLayer](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__RESOURCE__VIEW__DESC__v1.html#structCUDA__RESOURCE__VIEW__DESC__v1_14f2845ad9438911320a33e3fb1017964) specifies the last layer index for layered textures. For non-layered resources, this value has to be zero.
19768 ///
19769 /// **See also:**
19770 ///
19771 /// [`cuTexObjectDestroy`], [cudaCreateTextureObject](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TEXTURE__OBJECT.html#group__CUDART__TEXTURE__OBJECT_1g16ac75814780c3a16e4c63869feb9ad3).
19772 ///
19773 /// # Parameters
19774 ///
19775 /// - `pTexObject`: Texture object to create.
19776 /// - `pResDesc`: Resource descriptor.
19777 /// - `pTexDesc`: Texture descriptor.
19778 /// - `pResViewDesc`: Resource view descriptor.
19779 pub fn cuTexObjectCreate(
19780 pTexObject: *mut CUtexObject,
19781 pResDesc: *const CUDA_RESOURCE_DESC,
19782 pTexDesc: *const CUDA_TEXTURE_DESC,
19783 pResViewDesc: *const CUDA_RESOURCE_VIEW_DESC,
19784 ) -> CUresult;
19785}
19786unsafe extern "C" {
19787 /// Destroys a texture object.
19788 ///
19789 /// Destroys the texture object specified by texObject.
19790 ///
19791 /// **See also:**
19792 ///
19793 /// [`cuTexObjectCreate`], [cudaDestroyTextureObject](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TEXTURE__OBJECT.html#group__CUDART__TEXTURE__OBJECT_1g27be12e215f162cc877be94390da75bb).
19794 ///
19795 /// # Parameters
19796 ///
19797 /// - `texObject`: Texture object to destroy.
19798 pub fn cuTexObjectDestroy(texObject: CUtexObject) -> CUresult;
19799}
19800unsafe extern "C" {
19801 /// Returns a texture object's resource descriptor.
19802 ///
19803 /// Returns the resource descriptor for the texture object specified by texObject.
19804 ///
19805 /// **See also:**
19806 ///
19807 /// [`cuTexObjectCreate`], [cudaGetTextureObjectResourceDesc](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TEXTURE__OBJECT.html#group__CUDART__TEXTURE__OBJECT_1g4ac6e3f033c356ecc4ab6fb85154f066),.
19808 ///
19809 /// # Parameters
19810 ///
19811 /// - `pResDesc`: Resource descriptor.
19812 /// - `texObject`: Texture object.
19813 pub fn cuTexObjectGetResourceDesc(
19814 pResDesc: *mut CUDA_RESOURCE_DESC,
19815 texObject: CUtexObject,
19816 ) -> CUresult;
19817}
19818unsafe extern "C" {
19819 /// Returns a texture object's texture descriptor.
19820 ///
19821 /// Returns the texture descriptor for the texture object specified by texObject.
19822 ///
19823 /// **See also:**
19824 ///
19825 /// [`cuTexObjectCreate`], [cudaGetTextureObjectTextureDesc](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TEXTURE__OBJECT.html#group__CUDART__TEXTURE__OBJECT_1g152565714ff9dce6867b6099afc05e50).
19826 ///
19827 /// # Parameters
19828 ///
19829 /// - `pTexDesc`: Texture descriptor.
19830 /// - `texObject`: Texture object.
19831 pub fn cuTexObjectGetTextureDesc(
19832 pTexDesc: *mut CUDA_TEXTURE_DESC,
19833 texObject: CUtexObject,
19834 ) -> CUresult;
19835}
19836unsafe extern "C" {
19837 /// Returns a texture object's resource view descriptor.
19838 ///
19839 /// Returns the resource view descriptor for the texture object specified by texObject. If no resource view was set for texObject, the [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] is returned.
19840 ///
19841 /// **See also:**
19842 ///
19843 /// [`cuTexObjectCreate`], [cudaGetTextureObjectResourceViewDesc](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TEXTURE__OBJECT.html#group__CUDART__TEXTURE__OBJECT_1g0332bef8105771003c64d7f09d6163fe).
19844 ///
19845 /// # Parameters
19846 ///
19847 /// - `pResViewDesc`: Resource view descriptor.
19848 /// - `texObject`: Texture object.
19849 pub fn cuTexObjectGetResourceViewDesc(
19850 pResViewDesc: *mut CUDA_RESOURCE_VIEW_DESC,
19851 texObject: CUtexObject,
19852 ) -> CUresult;
19853}
19854unsafe extern "C" {
19855 /// Creates a surface object.
19856 ///
19857 /// Creates a surface object and returns it in pSurfObject. pResDesc describes the data to perform surface load/stores on. [CUDA_RESOURCE_DESC::resType](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__RESOURCE__DESC__v1.html#structCUDA__RESOURCE__DESC__v1_1fe341889f4a57165e7acc0efcfc38b64) must be [`CUresourcetype_enum::CU_RESOURCE_TYPE_ARRAY`] and CUDA_RESOURCE_DESC::res::array::hArray must be set to a valid CUDA array handle. [CUDA_RESOURCE_DESC::flags](https://docs.nvidia.com/cuda/cuda-driver-api/structCUDA__RESOURCE__DESC__v1.html#structCUDA__RESOURCE__DESC__v1_1857d9251dec54700bd8cd071accc3bdf) must be set to zero.
19858 ///
19859 /// Surface objects are only supported on devices of compute capability 3.0 or higher. Additionally, a surface object is an opaque
19860 /// value, and, as such, should only be accessed through CUDA API calls.
19861 ///
19862 /// **See also:**
19863 ///
19864 /// [`cuSurfObjectDestroy`], [cudaCreateSurfaceObject](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__SURFACE__OBJECT.html#group__CUDART__SURFACE__OBJECT_1g958899474ab2c5f40d233b524d6c5a01).
19865 ///
19866 /// # Parameters
19867 ///
19868 /// - `pSurfObject`: Surface object to create.
19869 /// - `pResDesc`: Resource descriptor.
19870 pub fn cuSurfObjectCreate(
19871 pSurfObject: *mut CUsurfObject,
19872 pResDesc: *const CUDA_RESOURCE_DESC,
19873 ) -> CUresult;
19874}
19875unsafe extern "C" {
19876 /// Destroys a surface object.
19877 ///
19878 /// Destroys the surface object specified by surfObject.
19879 ///
19880 /// **See also:**
19881 ///
19882 /// [`cuSurfObjectCreate`], [cudaDestroySurfaceObject](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__SURFACE__OBJECT.html#group__CUDART__SURFACE__OBJECT_1g9fab66c3a39b9f8f52b718eea794ad60).
19883 ///
19884 /// # Parameters
19885 ///
19886 /// - `surfObject`: Surface object to destroy.
19887 pub fn cuSurfObjectDestroy(surfObject: CUsurfObject) -> CUresult;
19888}
19889unsafe extern "C" {
19890 /// Returns a surface object's resource descriptor.
19891 ///
19892 /// Returns the resource descriptor for the surface object specified by surfObject.
19893 ///
19894 /// **See also:**
19895 ///
19896 /// [`cuSurfObjectCreate`], [cudaGetSurfaceObjectResourceDesc](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__SURFACE__OBJECT.html#group__CUDART__SURFACE__OBJECT_1gd7087318f73ae605645d6721d51486bd).
19897 ///
19898 /// # Parameters
19899 ///
19900 /// - `pResDesc`: Resource descriptor.
19901 /// - `surfObject`: Surface object.
19902 pub fn cuSurfObjectGetResourceDesc(
19903 pResDesc: *mut CUDA_RESOURCE_DESC,
19904 surfObject: CUsurfObject,
19905 ) -> CUresult;
19906}
19907unsafe extern "C" {
19908 /// Create a tensor map descriptor object representing tiled memory region.
19909 ///
19910 /// Creates a descriptor for Tensor Memory Access (TMA) object specified by the parameters describing a tiled region and returns
19911 /// it in tensorMap.
19912 ///
19913 /// Tensor map objects are only supported on devices of compute capability 9.0 or higher. Additionally, a tensor map object is
19914 /// an opaque value, and, as such, should only be accessed through CUDA APIs and PTX.
19915 ///
19916 /// The parameters passed are bound to the following requirements:
19917 ///
19918 /// * tensorMap address must be aligned to 64 bytes.
19919 ///
19920 /// * tensorDataType has to be an enum from `CUtensorMapDataType` which is defined as:
19921 ///
19922 /// ```text
19923 /// typedef enum CUtensorMapDataType_enum {
19924 /// CU_TENSOR_MAP_DATA_TYPE_UINT8 = 0, // 1 byte
19925 /// CU_TENSOR_MAP_DATA_TYPE_UINT16, // 2 bytes
19926 /// CU_TENSOR_MAP_DATA_TYPE_UINT32, // 4 bytes
19927 /// CU_TENSOR_MAP_DATA_TYPE_INT32, // 4 bytes
19928 /// CU_TENSOR_MAP_DATA_TYPE_UINT64, // 8 bytes
19929 /// CU_TENSOR_MAP_DATA_TYPE_INT64, // 8 bytes
19930 /// CU_TENSOR_MAP_DATA_TYPE_FLOAT16, // 2 bytes
19931 /// CU_TENSOR_MAP_DATA_TYPE_FLOAT32, // 4 bytes
19932 /// CU_TENSOR_MAP_DATA_TYPE_FLOAT64, // 8 bytes
19933 /// CU_TENSOR_MAP_DATA_TYPE_BFLOAT16, // 2 bytes
19934 /// CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ, // 4 bytes
19935 /// CU_TENSOR_MAP_DATA_TYPE_TFLOAT32, // 4 bytes
19936 /// CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ, // 4 bytes
19937 /// CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B, // 4 bits
19938 /// CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B, // 4 bits
19939 /// CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B // 6 bits
19940 /// } CUtensorMapDataType;
19941 /// ```
19942 ///
19943 /// [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B`] copies '16 x U4' packed values to memory aligned as 8 bytes. There are no gaps between
19944 /// packed values. [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`] copies '16 x U4' packed values to memory aligned as 16 bytes. There are
19945 /// 8 byte gaps between every 8 byte chunk of packed values. [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] copies '16 x U6' packed values
19946 /// to memory aligned as 16 bytes. There are 4 byte gaps between every 12 byte chunk of packed values.
19947 ///
19948 /// * tensorRank must be non-zero and less than or equal to the maximum supported dimensionality of 5. If interleave is not [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_NONE`], then tensorRank must additionally be greater than or equal to 3.
19949 ///
19950 /// * globalAddress, which specifies the starting address of the memory region described, must be 16 byte aligned. The following requirements
19951 /// need to also be met:
19952 /// + When interleave is [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_32B`], globalAddress must be 32 byte aligned.
19953 /// + When tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] or [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], globalAddress must be 32 byte aligned.
19954 ///
19955 /// * globalDim array, which specifies tensor size of each of the tensorRank dimensions, must be non-zero and less than or equal to 2^32. Additionally, the following requirements need to be met for
19956 /// the packed data types:
19957 /// + When tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] or [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], globalDim\[0\] must be a multiple of 128.
19958 /// + When tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B`], globalDim\[0\] must be a multiple of 2.
19959 /// + Dimension for the packed data types must reflect the number of individual U# values.
19960 ///
19961 /// * globalStrides array, which specifies tensor stride of each of the lower tensorRank - 1 dimensions in bytes, must be a multiple of 16 and less than 2^40. Additionally, the following requirements need to be
19962 /// met:
19963 /// + When interleave is [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_32B`], the strides must be a multiple of 32.
19964 /// + When tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] or [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], the strides must be a multiple of 32.
19965 /// Each following dimension specified includes previous dimension stride:
19966 ///
19967 /// ```text
19968 /// globalStrides\[0\] = globalDim\[0\] * elementSizeInBytes(tensorDataType) + padding\[0\];
19969 /// for (i = 1; i < tensorRank - 1; i++)
19970 /// globalStrides\[i\] = globalStrides\[i – 1\] * (globalDim\[i\] + padding\[i\]);
19971 /// assert(globalStrides\[i\] >= globalDim\[i\]);
19972 /// ```
19973 ///
19974 /// * boxDim array, which specifies number of elements to be traversed along each of the tensorRank dimensions, must be non-zero and less than or equal to 256. Additionally, the following requirements need to be met:
19975 /// + When interleave is [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_NONE`], { boxDim\[0\] \* elementSizeInBytes( tensorDataType ) } must be a multiple of 16 bytes.
19976 /// + When tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] or [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], boxDim\[0\] must be 128.
19977 ///
19978 /// * elementStrides array, which specifies the iteration step along each of the tensorRank dimensions, must be non-zero and less than or equal to 8. Note that when interleave is [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_NONE`], the first element of this array is ignored since TMA doesn’t support the stride for dimension
19979 /// zero. When all elements of elementStrides array is one, boxDim specifies the number of elements to load. However, if the elementStrides\[i\] is not equal to one, then TMA loads ceil( boxDim\[i\] / elementStrides\[i\]) number of elements along i-th dimension. To load N elements along i-th dimension, boxDim\[i\] must be set to N \* elementStrides\[i\].
19980 ///
19981 /// * interleave specifies the interleaved layout of type `CUtensorMapInterleave`, which is defined as:
19982 ///
19983 /// ```text
19984 /// typedef enum CUtensorMapInterleave_enum {
19985 /// CU_TENSOR_MAP_INTERLEAVE_NONE = 0,
19986 /// CU_TENSOR_MAP_INTERLEAVE_16B,
19987 /// CU_TENSOR_MAP_INTERLEAVE_32B
19988 /// } CUtensorMapInterleave;
19989 /// ```
19990 ///
19991 /// TMA supports interleaved layouts like NC/8HWC8 where C8 utilizes 16 bytes in memory assuming 2 byte per channel or NC/16HWC16
19992 /// where C16 uses 32 bytes. When interleave is [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_NONE`] and swizzle is not [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_NONE`], the bounding box inner dimension (computed as boxDim\[0\] multiplied by element size derived from tensorDataType) must be less than or equal to the swizzle size.
19993 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_32B`] requires the bounding box inner dimension to be <= 32.
19994 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_64B`] requires the bounding box inner dimension to be <= 64.
19995 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_128B`]\* require the bounding box inner dimension to be <= 128. Additionally, tensorDataType of [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] requires interleave to be [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_NONE`].
19996 ///
19997 /// * swizzle, which specifies the shared memory bank swizzling pattern, has to be of type `CUtensorMapSwizzle` which is defined as:
19998 ///
19999 /// ```text
20000 /// typedef enum CUtensorMapSwizzle_enum {
20001 /// CU_TENSOR_MAP_SWIZZLE_NONE = 0,
20002 /// CU_TENSOR_MAP_SWIZZLE_32B, // Swizzle 16B chunks within 32B span
20003 /// CU_TENSOR_MAP_SWIZZLE_64B, // Swizzle 16B chunks within 64B span
20004 /// CU_TENSOR_MAP_SWIZZLE_128B, // Swizzle 16B chunks within 128B span
20005 /// CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B, // Swizzle 32B chunks within 128B span
20006 /// CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B_FLIP_8B, // Swizzle 32B chunks within 128B span, additionally swap lower 8B with upper 8B within each 16B for every alternate row
20007 /// CU_TENSOR_MAP_SWIZZLE_128B_ATOM_64B, // Swizzle 64B chunks within 128B span
20008 /// } CUtensorMapSwizzle;
20009 /// ```
20010 ///
20011 /// Data are organized in a specific order in global memory; however, this may not match the order in which the application accesses
20012 /// data in shared memory. This difference in data organization may cause bank conflicts when shared memory is accessed. In order
20013 /// to avoid this problem, data can be loaded to shared memory with shuffling across shared memory banks. When interleave is [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_32B`], swizzle must be [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_32B`]. Other interleave modes can have any swizzling pattern. When the tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`], only the following swizzle modes are supported:
20014 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_NONE`] (Load & Store)
20015 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_128B`] (Load & Store)
20016 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B`] (Load & Store)
20017 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_128B_ATOM_64B`] (Store only) When the tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], only the following swizzle modes are supported:
20018 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_NONE`] (Load only)
20019 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_128B`] (Load only)
20020 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B`] (Load only)
20021 ///
20022 /// * l2Promotion specifies L2 fetch size which indicates the byte granurality at which L2 requests is filled from DRAM. It must be of type
20023 /// `CUtensorMapL2promotion`, which is defined as:
20024 ///
20025 /// ```text
20026 /// typedef enum CUtensorMapL2promotion_enum {
20027 /// CU_TENSOR_MAP_L2_PROMOTION_NONE = 0,
20028 /// CU_TENSOR_MAP_L2_PROMOTION_L2_64B,
20029 /// CU_TENSOR_MAP_L2_PROMOTION_L2_128B,
20030 /// CU_TENSOR_MAP_L2_PROMOTION_L2_256B
20031 /// } CUtensorMapL2promotion;
20032 /// ```
20033 ///
20034 /// * oobFill, which indicates whether zero or a special NaN constant should be used to fill out-of-bound elements, must be of type `CUtensorMapFloatOOBfill` which is defined as:
20035 ///
20036 /// ```text
20037 /// typedef enum CUtensorMapFloatOOBfill_enum {
20038 /// CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE = 0,
20039 /// CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA
20040 /// } CUtensorMapFloatOOBfill;
20041 /// ```
20042 ///
20043 /// Note that [`CUtensorMapFloatOOBfill::CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA`] can only be used when tensorDataType represents a floating-point data type, and when tensorDataType is not [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B`], [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], and [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`].
20044 ///
20045 /// **See also:**
20046 ///
20047 /// [`cuTensorMapEncodeIm2col`], [`cuTensorMapEncodeIm2colWide`], [`cuTensorMapReplaceAddress`].
20048 ///
20049 /// # Parameters
20050 ///
20051 /// - `tensorMap`: Tensor map object to create.
20052 /// - `tensorDataType`: Tensor data type.
20053 /// - `tensorRank`: Dimensionality of tensor.
20054 /// - `globalAddress`: Starting address of memory region described by tensor.
20055 /// - `globalDim`: Array containing tensor size (number of elements) along each of the tensorRank dimensions.
20056 /// - `globalStrides`: Array containing stride size (in bytes) along each of the tensorRank - 1 dimensions.
20057 /// - `boxDim`: Array containing traversal box size (number of elments) along each of the tensorRank dimensions. Specifies how many elements to be traversed along each tensor dimension.
20058 /// - `elementStrides`: Array containing traversal stride in each of the tensorRank dimensions.
20059 /// - `interleave`: Type of interleaved layout the tensor addresses.
20060 /// - `swizzle`: Bank swizzling pattern inside shared memory.
20061 /// - `l2Promotion`: L2 promotion size.
20062 /// - `oobFill`: Indicate whether zero or special NaN constant must be used to fill out-of-bound elements.
20063 pub fn cuTensorMapEncodeTiled(
20064 tensorMap: *mut CUtensorMap,
20065 tensorDataType: CUtensorMapDataType,
20066 tensorRank: cuuint32_t,
20067 globalAddress: *mut ::core::ffi::c_void,
20068 globalDim: *const cuuint64_t,
20069 globalStrides: *const cuuint64_t,
20070 boxDim: *const cuuint32_t,
20071 elementStrides: *const cuuint32_t,
20072 interleave: CUtensorMapInterleave,
20073 swizzle: CUtensorMapSwizzle,
20074 l2Promotion: CUtensorMapL2promotion,
20075 oobFill: CUtensorMapFloatOOBfill,
20076 ) -> CUresult;
20077}
20078unsafe extern "C" {
20079 /// Create a tensor map descriptor object representing im2col memory region.
20080 ///
20081 /// Creates a descriptor for Tensor Memory Access (TMA) object specified by the parameters describing a im2col memory layout and
20082 /// returns it in tensorMap.
20083 ///
20084 /// Tensor map objects are only supported on devices of compute capability 9.0 or higher. Additionally, a tensor map object is
20085 /// an opaque value, and, as such, should only be accessed through CUDA APIs and PTX.
20086 ///
20087 /// The parameters passed are bound to the following requirements:
20088 ///
20089 /// * tensorMap address must be aligned to 64 bytes.
20090 ///
20091 /// * tensorDataType has to be an enum from `CUtensorMapDataType` which is defined as:
20092 ///
20093 /// ```text
20094 /// typedef enum CUtensorMapDataType_enum {
20095 /// CU_TENSOR_MAP_DATA_TYPE_UINT8 = 0, // 1 byte
20096 /// CU_TENSOR_MAP_DATA_TYPE_UINT16, // 2 bytes
20097 /// CU_TENSOR_MAP_DATA_TYPE_UINT32, // 4 bytes
20098 /// CU_TENSOR_MAP_DATA_TYPE_INT32, // 4 bytes
20099 /// CU_TENSOR_MAP_DATA_TYPE_UINT64, // 8 bytes
20100 /// CU_TENSOR_MAP_DATA_TYPE_INT64, // 8 bytes
20101 /// CU_TENSOR_MAP_DATA_TYPE_FLOAT16, // 2 bytes
20102 /// CU_TENSOR_MAP_DATA_TYPE_FLOAT32, // 4 bytes
20103 /// CU_TENSOR_MAP_DATA_TYPE_FLOAT64, // 8 bytes
20104 /// CU_TENSOR_MAP_DATA_TYPE_BFLOAT16, // 2 bytes
20105 /// CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ, // 4 bytes
20106 /// CU_TENSOR_MAP_DATA_TYPE_TFLOAT32, // 4 bytes
20107 /// CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ // 4 bytes
20108 /// CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B, // 4 bits
20109 /// CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B, // 4 bits
20110 /// CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B // 6 bits
20111 /// } CUtensorMapDataType;
20112 /// ```
20113 ///
20114 /// [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B`] copies '16 x U4' packed values to memory aligned as 8 bytes. There are no gaps between
20115 /// packed values. [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`] copies '16 x U4' packed values to memory aligned as 16 bytes. There are
20116 /// 8 byte gaps between every 8 byte chunk of packed values. [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] copies '16 x U6' packed values
20117 /// to memory aligned as 16 bytes. There are 4 byte gaps between every 12 byte chunk of packed values.
20118 ///
20119 /// * tensorRank, which specifies the number of tensor dimensions, must be 3, 4, or 5.
20120 ///
20121 /// * globalAddress, which specifies the starting address of the memory region described, must be 16 byte aligned. The following requirements
20122 /// need to also be met:
20123 /// + When interleave is [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_32B`], globalAddress must be 32 byte aligned.
20124 /// + When tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] or [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], globalAddress must be 32 byte aligned.
20125 ///
20126 /// * globalDim array, which specifies tensor size of each of the tensorRank dimensions, must be non-zero and less than or equal to 2^32. Additionally, the following requirements need to be met for
20127 /// the packed data types:
20128 /// + When tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] or [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], globalDim\[0\] must be a multiple of 128.
20129 /// + When tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B`], globalDim\[0\] must be a multiple of 2.
20130 /// + Dimension for the packed data types must reflect the number of individual U# values.
20131 ///
20132 /// * globalStrides array, which specifies tensor stride of each of the lower tensorRank - 1 dimensions in bytes, must be a multiple of 16 and less than 2^40. Additionally, the following requirements need to be
20133 /// met:
20134 /// + When interleave is [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_32B`], the strides must be a multiple of 32.
20135 /// + When tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] or [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], the strides must be a multiple of 32.
20136 /// Each following dimension specified includes previous dimension stride:
20137 ///
20138 /// ```text
20139 /// globalStrides\[0\] = globalDim\[0\] * elementSizeInBytes(tensorDataType) + padding\[0\];
20140 /// for (i = 1; i < tensorRank - 1; i++)
20141 /// globalStrides\[i\] = globalStrides\[i – 1\] * (globalDim\[i\] + padding\[i\]);
20142 /// assert(globalStrides\[i\] >= globalDim\[i\]);
20143 /// ```
20144 ///
20145 /// * pixelBoxLowerCorner array specifies the coordinate offsets {D, H, W} of the bounding box from top/left/front corner. The number of offsets and
20146 /// their precision depend on the tensor dimensionality:
20147 /// + When tensorRank is 3, one signed offset within range \[-32768, 32767\] is supported.
20148 /// + When tensorRank is 4, two signed offsets each within range \[-128, 127\] are supported.
20149 /// + When tensorRank is 5, three offsets each within range \[-16, 15\] are supported.
20150 ///
20151 /// * pixelBoxUpperCorner array specifies the coordinate offsets {D, H, W} of the bounding box from bottom/right/back corner. The number of offsets
20152 /// and their precision depend on the tensor dimensionality:
20153 /// + When tensorRank is 3, one signed offset within range \[-32768, 32767\] is supported.
20154 /// + When tensorRank is 4, two signed offsets each within range \[-128, 127\] are supported.
20155 /// + When tensorRank is 5, three offsets each within range \[-16, 15\] are supported. The bounding box specified by pixelBoxLowerCorner and pixelBoxUpperCorner must have non-zero area.
20156 ///
20157 /// * channelsPerPixel, which specifies the number of elements which must be accessed along C dimension, must be less than or equal to 256. Additionally,
20158 /// when tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] or [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], channelsPerPixel must be 128.
20159 ///
20160 /// * pixelsPerColumn, which specifies the number of elements that must be accessed along the {N, D, H, W} dimensions, must be less than or equal
20161 /// to 1024.
20162 ///
20163 /// * elementStrides array, which specifies the iteration step along each of the tensorRank dimensions, must be non-zero and less than or equal to 8. Note that when interleave is [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_NONE`], the first element of this array is ignored since TMA doesn’t support the stride for dimension
20164 /// zero. When all elements of the elementStrides array are one, boxDim specifies the number of elements to load. However, if elementStrides\[i\] is not equal to one for some i, then TMA loads ceil( boxDim\[i\] / elementStrides\[i\]) number of elements along i-th dimension. To load N elements along i-th dimension, boxDim\[i\] must be set to N \* elementStrides\[i\].
20165 ///
20166 /// * interleave specifies the interleaved layout of type `CUtensorMapInterleave`, which is defined as:
20167 ///
20168 /// ```text
20169 /// typedef enum CUtensorMapInterleave_enum {
20170 /// CU_TENSOR_MAP_INTERLEAVE_NONE = 0,
20171 /// CU_TENSOR_MAP_INTERLEAVE_16B,
20172 /// CU_TENSOR_MAP_INTERLEAVE_32B
20173 /// } CUtensorMapInterleave;
20174 /// ```
20175 ///
20176 /// TMA supports interleaved layouts like NC/8HWC8 where C8 utilizes 16 bytes in memory assuming 2 byte per channel or NC/16HWC16
20177 /// where C16 uses 32 bytes. When interleave is [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_NONE`] and swizzle is not [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_NONE`], the bounding box inner dimension (computed as channelsPerPixel multiplied by element size in bytes derived from tensorDataType) must be less than or equal to the swizzle size.
20178 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_32B`] requires the bounding box inner dimension to be <= 32.
20179 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_64B`] requires the bounding box inner dimension to be <= 64.
20180 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_128B`]\* require the bounding box inner dimension to be <= 128. Additionally, tensorDataType of [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] requires interleave to be [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_NONE`].
20181 ///
20182 /// * swizzle, which specifies the shared memory bank swizzling pattern, has to be of type `CUtensorMapSwizzle` which is defined as:
20183 ///
20184 /// ```text
20185 /// typedef enum CUtensorMapSwizzle_enum {
20186 /// CU_TENSOR_MAP_SWIZZLE_NONE = 0,
20187 /// CU_TENSOR_MAP_SWIZZLE_32B, // Swizzle 16B chunks within 32B span
20188 /// CU_TENSOR_MAP_SWIZZLE_64B, // Swizzle 16B chunks within 64B span
20189 /// CU_TENSOR_MAP_SWIZZLE_128B, // Swizzle 16B chunks within 128B span
20190 /// CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B, // Swizzle 32B chunks within 128B span
20191 /// CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B_FLIP_8B, // Swizzle 32B chunks within 128B span, additionally swap lower 8B with upper 8B within each 16B for every alternate row
20192 /// CU_TENSOR_MAP_SWIZZLE_128B_ATOM_64B, // Swizzle 64B chunks within 128B span
20193 /// } CUtensorMapSwizzle;
20194 /// ```
20195 ///
20196 /// Data are organized in a specific order in global memory; however, this may not match the order in which the application accesses
20197 /// data in shared memory. This difference in data organization may cause bank conflicts when shared memory is accessed. In order
20198 /// to avoid this problem, data can be loaded to shared memory with shuffling across shared memory banks. When interleave is [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_32B`], swizzle must be [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_32B`]. Other interleave modes can have any swizzling pattern. When the tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`], only the following swizzle modes are supported:
20199 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_NONE`] (Load & Store)
20200 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_128B`] (Load & Store)
20201 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B`] (Load & Store)
20202 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_128B_ATOM_64B`] (Store only) When the tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], only the following swizzle modes are supported:
20203 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_NONE`] (Load only)
20204 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_128B`] (Load only)
20205 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B`] (Load only)
20206 ///
20207 /// * l2Promotion specifies L2 fetch size which indicates the byte granularity at which L2 requests are filled from DRAM. It must be of type
20208 /// `CUtensorMapL2promotion`, which is defined as:
20209 ///
20210 /// ```text
20211 /// typedef enum CUtensorMapL2promotion_enum {
20212 /// CU_TENSOR_MAP_L2_PROMOTION_NONE = 0,
20213 /// CU_TENSOR_MAP_L2_PROMOTION_L2_64B,
20214 /// CU_TENSOR_MAP_L2_PROMOTION_L2_128B,
20215 /// CU_TENSOR_MAP_L2_PROMOTION_L2_256B
20216 /// } CUtensorMapL2promotion;
20217 /// ```
20218 ///
20219 /// * oobFill, which indicates whether zero or a special NaN constant should be used to fill out-of-bound elements, must be of type `CUtensorMapFloatOOBfill` which is defined as:
20220 ///
20221 /// ```text
20222 /// typedef enum CUtensorMapFloatOOBfill_enum {
20223 /// CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE = 0,
20224 /// CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA
20225 /// } CUtensorMapFloatOOBfill;
20226 /// ```
20227 ///
20228 /// Note that [`CUtensorMapFloatOOBfill::CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA`] can only be used when tensorDataType represents a floating-point data type, and when tensorDataType is not [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B`], [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], and [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`].
20229 ///
20230 /// **See also:**
20231 ///
20232 /// [`cuTensorMapEncodeTiled`], [`cuTensorMapEncodeIm2colWide`], [`cuTensorMapReplaceAddress`].
20233 ///
20234 /// # Parameters
20235 ///
20236 /// - `tensorMap`: Tensor map object to create.
20237 /// - `tensorDataType`: Tensor data type.
20238 /// - `tensorRank`: Dimensionality of tensor; must be at least 3.
20239 /// - `globalAddress`: Starting address of memory region described by tensor.
20240 /// - `globalDim`: Array containing tensor size (number of elements) along each of the tensorRank dimensions.
20241 /// - `globalStrides`: Array containing stride size (in bytes) along each of the tensorRank - 1 dimensions.
20242 /// - `pixelBoxLowerCorner`: Array containing DHW dimensions of lower box corner.
20243 /// - `pixelBoxUpperCorner`: Array containing DHW dimensions of upper box corner.
20244 /// - `channelsPerPixel`: Number of channels per pixel.
20245 /// - `pixelsPerColumn`: Number of pixels per column.
20246 /// - `elementStrides`: Array containing traversal stride in each of the tensorRank dimensions.
20247 /// - `interleave`: Type of interleaved layout the tensor addresses.
20248 /// - `swizzle`: Bank swizzling pattern inside shared memory.
20249 /// - `l2Promotion`: L2 promotion size.
20250 /// - `oobFill`: Indicate whether zero or special NaN constant will be used to fill out-of-bound elements.
20251 pub fn cuTensorMapEncodeIm2col(
20252 tensorMap: *mut CUtensorMap,
20253 tensorDataType: CUtensorMapDataType,
20254 tensorRank: cuuint32_t,
20255 globalAddress: *mut ::core::ffi::c_void,
20256 globalDim: *const cuuint64_t,
20257 globalStrides: *const cuuint64_t,
20258 pixelBoxLowerCorner: *const ::core::ffi::c_int,
20259 pixelBoxUpperCorner: *const ::core::ffi::c_int,
20260 channelsPerPixel: cuuint32_t,
20261 pixelsPerColumn: cuuint32_t,
20262 elementStrides: *const cuuint32_t,
20263 interleave: CUtensorMapInterleave,
20264 swizzle: CUtensorMapSwizzle,
20265 l2Promotion: CUtensorMapL2promotion,
20266 oobFill: CUtensorMapFloatOOBfill,
20267 ) -> CUresult;
20268}
20269unsafe extern "C" {
20270 /// Create a tensor map descriptor object representing im2col memory region, but where the elements are exclusively loaded along
20271 /// the W dimension.
20272 ///
20273 /// Creates a descriptor for Tensor Memory Access (TMA) object specified by the parameters describing a im2col memory layout and
20274 /// where the row is always loaded along the W dimensuin and returns it in tensorMap. This assumes the tensor layout in memory is either NDHWC, NHWC, or NWC.
20275 ///
20276 /// This API is only supported on devices of compute capability 10.0 or higher. Additionally, a tensor map object is an opaque
20277 /// value, and, as such, should only be accessed through CUDA APIs and PTX.
20278 ///
20279 /// The parameters passed are bound to the following requirements:
20280 ///
20281 /// * tensorMap address must be aligned to 64 bytes.
20282 ///
20283 /// * tensorDataType has to be an enum from `CUtensorMapDataType` which is defined as:
20284 ///
20285 /// ```text
20286 /// typedef enum CUtensorMapDataType_enum {
20287 /// CU_TENSOR_MAP_DATA_TYPE_UINT8 = 0, // 1 byte
20288 /// CU_TENSOR_MAP_DATA_TYPE_UINT16, // 2 bytes
20289 /// CU_TENSOR_MAP_DATA_TYPE_UINT32, // 4 bytes
20290 /// CU_TENSOR_MAP_DATA_TYPE_INT32, // 4 bytes
20291 /// CU_TENSOR_MAP_DATA_TYPE_UINT64, // 8 bytes
20292 /// CU_TENSOR_MAP_DATA_TYPE_INT64, // 8 bytes
20293 /// CU_TENSOR_MAP_DATA_TYPE_FLOAT16, // 2 bytes
20294 /// CU_TENSOR_MAP_DATA_TYPE_FLOAT32, // 4 bytes
20295 /// CU_TENSOR_MAP_DATA_TYPE_FLOAT64, // 8 bytes
20296 /// CU_TENSOR_MAP_DATA_TYPE_BFLOAT16, // 2 bytes
20297 /// CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ, // 4 bytes
20298 /// CU_TENSOR_MAP_DATA_TYPE_TFLOAT32, // 4 bytes
20299 /// CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ // 4 bytes
20300 /// CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B, // 4 bits
20301 /// CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B, // 4 bits
20302 /// CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B // 6 bits
20303 /// } CUtensorMapDataType;
20304 /// ```
20305 ///
20306 /// [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B`] copies '16 x U4' packed values to memory aligned as 8 bytes. There are no gaps between
20307 /// packed values. [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`] copies '16 x U4' packed values to memory aligned as 16 bytes. There are
20308 /// 8 byte gaps between every 8 byte chunk of packed values. [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] copies '16 x U6' packed values
20309 /// to memory aligned as 16 bytes. There are 4 byte gaps between every 12 byte chunk of packed values.
20310 ///
20311 /// * tensorRank, which specifies the number of tensor dimensions, must be 3, 4, or 5.
20312 ///
20313 /// * globalAddress, which specifies the starting address of the memory region described, must be 16 byte aligned. The following requirements
20314 /// need to also be met:
20315 /// + When interleave is [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_32B`], globalAddress must be 32 byte aligned.
20316 /// + When tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] or [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], globalAddress must be 32 byte aligned.
20317 ///
20318 /// * globalDim array, which specifies tensor size of each of the tensorRank dimensions, must be non-zero and less than or equal to 2^32. Additionally, the following requirements need to be met for
20319 /// the packed data types:
20320 /// + When tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] or [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], globalDim\[0\] must be a multiple of 128.
20321 /// + When tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B`], globalDim\[0\] must be a multiple of 2.
20322 /// + Dimension for the packed data types must reflect the number of individual U# values.
20323 ///
20324 /// * globalStrides array, which specifies tensor stride of each of the lower tensorRank - 1 dimensions in bytes, must be a multiple of 16 and less than 2^40. Additionally, the following requirements need to be
20325 /// met:
20326 /// + When interleave is [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_32B`], the strides must be a multiple of 32.
20327 /// + When tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] or [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], the strides must be a multiple of 32.
20328 /// Each following dimension specified includes previous dimension stride:
20329 ///
20330 /// ```text
20331 /// globalStrides\[0\] = globalDim\[0\] * elementSizeInBytes(tensorDataType) + padding\[0\];
20332 /// for (i = 1; i < tensorRank - 1; i++)
20333 /// globalStrides\[i\] = globalStrides\[i – 1\] * (globalDim\[i\] + padding\[i\]);
20334 /// assert(globalStrides\[i\] >= globalDim\[i\]);
20335 /// ```
20336 ///
20337 /// * pixelBoxLowerCornerWidth specifies the coordinate offset W of the bounding box from left corner. The offset must be within range \[-32768, 32767\].
20338 ///
20339 /// * pixelBoxUpperCornerWidth specifies the coordinate offset W of the bounding box from right corner. The offset must be within range \[-32768, 32767\].
20340 ///
20341 /// The bounding box specified by pixelBoxLowerCornerWidth and pixelBoxUpperCornerWidth must have non-zero area. Note that the size of the box along D and H dimensions is always equal to one.
20342 ///
20343 /// * channelsPerPixel, which specifies the number of elements which must be accessed along C dimension, must be less than or equal to 256. Additionally,
20344 /// when tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] or [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], channelsPerPixel must be 128.
20345 ///
20346 /// * pixelsPerColumn, which specifies the number of elements that must be accessed along the W dimension, must be less than or equal to 1024.
20347 /// This field is ignored when mode is [`CUtensorMapIm2ColWideMode::CU_TENSOR_MAP_IM2COL_WIDE_MODE_W128`].
20348 ///
20349 /// * elementStrides array, which specifies the iteration step along each of the tensorRank dimensions, must be non-zero and less than or equal to 8. Note that when interleave is [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_NONE`], the first element of this array is ignored since TMA doesn’t support the stride for dimension
20350 /// zero. When all elements of the elementStrides array are one, boxDim specifies the number of elements to load. However, if elementStrides\[i\] is not equal to one for some i, then TMA loads ceil( boxDim\[i\] / elementStrides\[i\]) number of elements along i-th dimension. To load N elements along i-th dimension, boxDim\[i\] must be set to N \* elementStrides\[i\].
20351 ///
20352 /// * interleave specifies the interleaved layout of type `CUtensorMapInterleave`, which is defined as:
20353 ///
20354 /// ```text
20355 /// typedef enum CUtensorMapInterleave_enum {
20356 /// CU_TENSOR_MAP_INTERLEAVE_NONE = 0,
20357 /// CU_TENSOR_MAP_INTERLEAVE_16B,
20358 /// CU_TENSOR_MAP_INTERLEAVE_32B
20359 /// } CUtensorMapInterleave;
20360 /// ```
20361 ///
20362 /// TMA supports interleaved layouts like NC/8HWC8 where C8 utilizes 16 bytes in memory assuming 2 byte per channel or NC/16HWC16
20363 /// where C16 uses 32 bytes. When interleave is [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_NONE`], the bounding box inner dimension (computed as channelsPerPixel multiplied by element size in bytes derived from tensorDataType) must be less than or equal to the swizzle size.
20364 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_64B`] requires the bounding box inner dimension to be <= 64.
20365 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_128B`]\* require the bounding box inner dimension to be <= 128. Additionally, tensorDataType of [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`] requires interleave to be [`CUtensorMapInterleave::CU_TENSOR_MAP_INTERLEAVE_NONE`].
20366 ///
20367 /// * mode, which describes loading of elements loaded along the W dimension, has to be one of the following `CUtensorMapIm2ColWideMode` types:
20368 ///
20369 /// ```text
20370 /// CU_TENSOR_MAP_IM2COL_WIDE_MODE_W,
20371 /// CU_TENSOR_MAP_IM2COL_WIDE_MODE_W128
20372 /// ```
20373 ///
20374 /// [`CUtensorMapIm2ColWideMode::CU_TENSOR_MAP_IM2COL_WIDE_MODE_W`] allows the number of elements loaded along the W dimension to be specified via the pixelsPerColumn field.
20375 ///
20376 /// * swizzle, which specifies the shared memory bank swizzling pattern, must be one of the following `CUtensorMapSwizzle` modes (other swizzle modes are not supported):
20377 ///
20378 /// ```text
20379 /// typedef enum CUtensorMapSwizzle_enum {
20380 /// CU_TENSOR_MAP_SWIZZLE_64B, // Swizzle 16B chunks within 64B span
20381 /// CU_TENSOR_MAP_SWIZZLE_128B, // Swizzle 16B chunks within 128B span
20382 /// CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B, // Swizzle 32B chunks within 128B span
20383 /// } CUtensorMapSwizzle;
20384 /// ```
20385 ///
20386 /// Data are organized in a specific order in global memory; however, this may not match the order in which the application accesses
20387 /// data in shared memory. This difference in data organization may cause bank conflicts when shared memory is accessed. In order
20388 /// to avoid this problem, data can be loaded to shared memory with shuffling across shared memory banks. When the tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`], only the following swizzle modes are supported:
20389 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_64B`] (Store only)
20390 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_128B`] (Load & Store)
20391 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B`] (Load & Store) When the tensorDataType is [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], only the following swizzle modes are supported:
20392 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_128B`] (Load only)
20393 /// + [`CUtensorMapSwizzle::CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B`] (Load only)
20394 ///
20395 /// Additionally, CU_TENSOR_MAP_SWIZZLE_96B is supported only when mode is [`CUtensorMapIm2ColWideMode::CU_TENSOR_MAP_IM2COL_WIDE_MODE_W`].
20396 ///
20397 /// * l2Promotion specifies L2 fetch size which indicates the byte granularity at which L2 requests are filled from DRAM. It must be of type
20398 /// `CUtensorMapL2promotion`, which is defined as:
20399 ///
20400 /// ```text
20401 /// typedef enum CUtensorMapL2promotion_enum {
20402 /// CU_TENSOR_MAP_L2_PROMOTION_NONE = 0,
20403 /// CU_TENSOR_MAP_L2_PROMOTION_L2_64B,
20404 /// CU_TENSOR_MAP_L2_PROMOTION_L2_128B,
20405 /// CU_TENSOR_MAP_L2_PROMOTION_L2_256B
20406 /// } CUtensorMapL2promotion;
20407 /// ```
20408 ///
20409 /// * oobFill, which indicates whether zero or a special NaN constant should be used to fill out-of-bound elements, must be of type `CUtensorMapFloatOOBfill` which is defined as:
20410 ///
20411 /// ```text
20412 /// typedef enum CUtensorMapFloatOOBfill_enum {
20413 /// CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE = 0,
20414 /// CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA
20415 /// } CUtensorMapFloatOOBfill;
20416 /// ```
20417 ///
20418 /// Note that [`CUtensorMapFloatOOBfill::CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA`] can only be used when tensorDataType represents a floating-point data type, and when tensorDataType is not [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B`], [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`], and [`CUtensorMapDataType::CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`].
20419 ///
20420 /// **See also:**
20421 ///
20422 /// [`cuTensorMapEncodeTiled`], [`cuTensorMapEncodeIm2col`], [`cuTensorMapReplaceAddress`].
20423 ///
20424 /// # Parameters
20425 ///
20426 /// - `tensorMap`: Tensor map object to create.
20427 /// - `tensorDataType`: Tensor data type.
20428 /// - `tensorRank`: Dimensionality of tensor; must be at least 3.
20429 /// - `globalAddress`: Starting address of memory region described by tensor.
20430 /// - `globalDim`: Array containing tensor size (number of elements) along each of the tensorRank dimensions.
20431 /// - `globalStrides`: Array containing stride size (in bytes) along each of the tensorRank - 1 dimensions.
20432 /// - `pixelBoxLowerCornerWidth`: Width offset of left box corner.
20433 /// - `pixelBoxUpperCornerWidth`: Width offset of right box corner.
20434 /// - `channelsPerPixel`: Number of channels per pixel.
20435 /// - `pixelsPerColumn`: Number of pixels per column.
20436 /// - `elementStrides`: Array containing traversal stride in each of the tensorRank dimensions.
20437 /// - `interleave`: Type of interleaved layout the tensor addresses.
20438 /// - `mode`: W or W128 mode.
20439 /// - `swizzle`: Bank swizzling pattern inside shared memory.
20440 /// - `l2Promotion`: L2 promotion size.
20441 /// - `oobFill`: Indicate whether zero or special NaN constant will be used to fill out-of-bound elements.
20442 pub fn cuTensorMapEncodeIm2colWide(
20443 tensorMap: *mut CUtensorMap,
20444 tensorDataType: CUtensorMapDataType,
20445 tensorRank: cuuint32_t,
20446 globalAddress: *mut ::core::ffi::c_void,
20447 globalDim: *const cuuint64_t,
20448 globalStrides: *const cuuint64_t,
20449 pixelBoxLowerCornerWidth: ::core::ffi::c_int,
20450 pixelBoxUpperCornerWidth: ::core::ffi::c_int,
20451 channelsPerPixel: cuuint32_t,
20452 pixelsPerColumn: cuuint32_t,
20453 elementStrides: *const cuuint32_t,
20454 interleave: CUtensorMapInterleave,
20455 mode: CUtensorMapIm2ColWideMode,
20456 swizzle: CUtensorMapSwizzle,
20457 l2Promotion: CUtensorMapL2promotion,
20458 oobFill: CUtensorMapFloatOOBfill,
20459 ) -> CUresult;
20460}
20461unsafe extern "C" {
20462 /// Modify an existing tensor map descriptor with an updated global address.
20463 ///
20464 /// Modifies the descriptor for Tensor Memory Access (TMA) object passed in tensorMap with an updated globalAddress.
20465 ///
20466 /// Tensor map objects are only supported on devices of compute capability 9.0 or higher. Additionally, a tensor map object is
20467 /// an opaque value, and, as such, should only be accessed through CUDA API calls.
20468 ///
20469 /// **See also:**
20470 ///
20471 /// [`cuTensorMapEncodeTiled`], [`cuTensorMapEncodeIm2col`], [`cuTensorMapEncodeIm2colWide`].
20472 ///
20473 /// # Parameters
20474 ///
20475 /// - `tensorMap`: Tensor map object to modify.
20476 /// - `globalAddress`: Starting address of memory region described by tensor, must follow previous alignment requirements.
20477 pub fn cuTensorMapReplaceAddress(
20478 tensorMap: *mut CUtensorMap,
20479 globalAddress: *mut ::core::ffi::c_void,
20480 ) -> CUresult;
20481}
20482unsafe extern "C" {
20483 /// Queries if a device may directly access a peer device's memory.
20484 ///
20485 /// Returns in \*canAccessPeer a value of 1 if contexts on dev are capable of directly accessing memory from contexts on peerDev and 0 otherwise. If direct access of peerDev from dev is possible, then access may be enabled on two specific contexts by calling [`cuCtxEnablePeerAccess`].
20486 ///
20487 /// Note:
20488 ///
20489 /// Note that this function may also return error codes from previous, asynchronous launches.
20490 ///
20491 /// **See also:**
20492 ///
20493 /// [`cuCtxEnablePeerAccess`], [`cuCtxDisablePeerAccess`], [cudaDeviceCanAccessPeer](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__PEER.html#group__CUDART__PEER_1g4db0d04e44995d5c1c34be4ecc863f22).
20494 ///
20495 /// # Parameters
20496 ///
20497 /// - `canAccessPeer`: Returned access capability.
20498 /// - `dev`: Device from which allocations on peerDev are to be directly accessed.
20499 /// - `peerDev`: Device on which the allocations to be directly accessed by dev reside.
20500 pub fn cuDeviceCanAccessPeer(
20501 canAccessPeer: *mut ::core::ffi::c_int,
20502 dev: CUdevice,
20503 peerDev: CUdevice,
20504 ) -> CUresult;
20505}
20506unsafe extern "C" {
20507 /// Enables direct access to memory allocations in a peer context.
20508 ///
20509 /// If both the current context and peerContext are on devices which support unified addressing (as may be queried using [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING`]) and same major compute capability, then on success all allocations from peerContext will immediately be accessible by the current context. See [Unified Addressing](https://docs.nvidia.com/cuda/cuda-driver-api/unified-addressing.html#group__CUDA__UNIFIED) for additional details.
20510 ///
20511 /// Note that access granted by this call is unidirectional and that in order to access memory from the current context in peerContext, a separate symmetric call to [`cuCtxEnablePeerAccess`] is required.
20512 ///
20513 /// Note that there are both device-wide and system-wide limitations per system configuration, as noted in the CUDA Programming
20514 /// Guide under the section "Peer-to-Peer Memory Access".
20515 ///
20516 /// Returns [`cudaError_enum::CUDA_ERROR_PEER_ACCESS_UNSUPPORTED`] if [`cuDeviceCanAccessPeer`] indicates that the [`CUdevice`] of the current context cannot directly access memory from the [`CUdevice`] of peerContext.
20517 ///
20518 /// Returns [`cudaError_enum::CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED`] if direct access of peerContext from the current context has already been enabled.
20519 ///
20520 /// Returns [`cudaError_enum::CUDA_ERROR_TOO_MANY_PEERS`] if direct peer access is not possible because hardware resources required for peer access have been exhausted.
20521 ///
20522 /// Returns [`cudaError_enum::CUDA_ERROR_INVALID_CONTEXT`] if there is no current context, peerContext is not a valid context, or if the current context is peerContext.
20523 ///
20524 /// Returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] if Flags is not 0.
20525 ///
20526 /// Note:
20527 ///
20528 /// Note that this function may also return error codes from previous, asynchronous launches.
20529 ///
20530 /// **See also:**
20531 ///
20532 /// [`cuDeviceCanAccessPeer`], [`cuCtxDisablePeerAccess`], [cudaDeviceEnablePeerAccess](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__PEER.html#group__CUDART__PEER_1g2b0adabf90db37e5cfddc92cbb2589f3).
20533 ///
20534 /// # Parameters
20535 ///
20536 /// - `peerContext`: Peer context to enable direct access to from the current context.
20537 /// - `Flags`: Reserved for future use and must be set to 0.
20538 pub fn cuCtxEnablePeerAccess(
20539 peerContext: CUcontext,
20540 Flags: ::core::ffi::c_uint,
20541 ) -> CUresult;
20542}
20543unsafe extern "C" {
20544 /// Disables direct access to memory allocations in a peer context and unregisters any registered allocations.
20545 ///
20546 /// Returns [`cudaError_enum::CUDA_ERROR_PEER_ACCESS_NOT_ENABLED`] if direct peer access has not yet been enabled from peerContext to the current context.
20547 ///
20548 /// Returns [`cudaError_enum::CUDA_ERROR_INVALID_CONTEXT`] if there is no current context, or if peerContext is not a valid context.
20549 ///
20550 /// Note:
20551 ///
20552 /// Note that this function may also return error codes from previous, asynchronous launches.
20553 ///
20554 /// **See also:**
20555 ///
20556 /// [`cuDeviceCanAccessPeer`], [`cuCtxEnablePeerAccess`], [cudaDeviceDisablePeerAccess](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__PEER.html#group__CUDART__PEER_1g9663734ad02653207ad6836053bf572e).
20557 ///
20558 /// # Parameters
20559 ///
20560 /// - `peerContext`: Peer context to disable direct access to.
20561 pub fn cuCtxDisablePeerAccess(peerContext: CUcontext) -> CUresult;
20562}
20563unsafe extern "C" {
20564 /// Queries attributes of the link between two devices.
20565 ///
20566 /// Returns in \*value the value of the requested attribute attrib of the link between srcDevice and dstDevice. The supported attributes are:
20567 ///
20568 /// * [`CUdevice_P2PAttribute_enum::CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK`]: A relative value indicating the performance of the link between two devices.
20569 /// * [`CUdevice_P2PAttribute_enum::CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED`] P2P: 1 if P2P Access is enable.
20570 /// * [`CUdevice_P2PAttribute_enum::CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED`]: 1 if all CUDA-valid atomic operations over the link are supported.
20571 /// * [CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED](https://docs.nvidia.com/cuda/cuda-driver-api/types.html#group__CUDA__TYPES_1gg578d7cf687ce20f7e99468e8c14e22de83a83eb1e8d535b6b8ecf00f509f4097): 1 if cudaArray can be accessed over the link.
20572 /// * [`CUdevice_P2PAttribute_enum::CU_DEVICE_P2P_ATTRIBUTE_ONLY_PARTIAL_NATIVE_ATOMIC_SUPPORTED`]: 1 if some CUDA-valid atomic operations over the link are supported. Information about specific operations can be retrieved
20573 /// with [`cuDeviceGetP2PAtomicCapabilities`].
20574 ///
20575 /// Returns [`cudaError_enum::CUDA_ERROR_INVALID_DEVICE`] if srcDevice or dstDevice are not valid or if they represent the same device.
20576 ///
20577 /// Returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] if attrib is not valid or if value is a null pointer.
20578 ///
20579 /// Note:
20580 ///
20581 /// Note that this function may also return error codes from previous, asynchronous launches.
20582 ///
20583 /// **See also:**
20584 ///
20585 /// [`cuCtxEnablePeerAccess`], [`cuCtxDisablePeerAccess`], [`cuDeviceCanAccessPeer`], [`cuDeviceGetP2PAtomicCapabilities`], [cudaDeviceGetP2PAttribute](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1gc63e5bf168e53b2daf71904eab048fa9).
20586 ///
20587 /// # Parameters
20588 ///
20589 /// - `value`: Returned value of the requested attribute.
20590 /// - `attrib`: The requested attribute of the link between srcDevice and dstDevice.
20591 /// - `srcDevice`: The source device of the target link.
20592 /// - `dstDevice`: The destination device of the target link.
20593 pub fn cuDeviceGetP2PAttribute(
20594 value: *mut ::core::ffi::c_int,
20595 attrib: CUdevice_P2PAttribute,
20596 srcDevice: CUdevice,
20597 dstDevice: CUdevice,
20598 ) -> CUresult;
20599}
20600unsafe extern "C" {
20601 /// Queries details about atomic operations supported between two devices.
20602 ///
20603 /// Returns in \*capabilities the details about requested atomic \*operations over the link between srcDevice and dstDevice. The allocated size of \*operations and \*capabilities must be count.
20604 ///
20605 /// For each `CUatomicOperation` in \*operations, the corresponding result in \*capabilities will be a bitmask indicating which of `CUatomicOperationCapability` the link supports natively.
20606 ///
20607 /// Returns [`cudaError_enum::CUDA_ERROR_INVALID_DEVICE`] if srcDevice or dstDevice are not valid or if they represent the same device.
20608 ///
20609 /// Returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] if \*capabilities or \*operations is NULL, if count is 0, or if any of \*operations is not valid.
20610 ///
20611 /// Note:
20612 ///
20613 /// Note that this function may also return error codes from previous, asynchronous launches.
20614 ///
20615 /// **See also:**
20616 ///
20617 /// [`cuDeviceGetP2PAttribute`], [cudaDeviceGetP2PAttribute](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1gc63e5bf168e53b2daf71904eab048fa9), [cudaDeviceGetP2PAtomicCapabilities](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1ga608cadee2598ca942b362db73267c2b).
20618 ///
20619 /// # Parameters
20620 ///
20621 /// - `capabilities`: Returned capability details of each requested operation.
20622 /// - `operations`: Requested operations.
20623 /// - `count`: Count of requested operations and size of capabilities.
20624 /// - `srcDevice`: The source device of the target link.
20625 /// - `dstDevice`: The destination device of the target link.
20626 pub fn cuDeviceGetP2PAtomicCapabilities(
20627 capabilities: *mut ::core::ffi::c_uint,
20628 operations: *const CUatomicOperation,
20629 count: ::core::ffi::c_uint,
20630 srcDevice: CUdevice,
20631 dstDevice: CUdevice,
20632 ) -> CUresult;
20633}
20634unsafe extern "C" {
20635 /// Unregisters a graphics resource for access by CUDA.
20636 ///
20637 /// Unregisters the graphics resource resource so it is not accessible by CUDA unless registered again.
20638 ///
20639 /// If resource is invalid then [`cudaError_enum::CUDA_ERROR_INVALID_HANDLE`] is returned.
20640 ///
20641 /// Note:
20642 ///
20643 /// Note that this function may also return error codes from previous, asynchronous launches.
20644 ///
20645 /// **See also:**
20646 ///
20647 /// `cuGraphicsD3D9RegisterResource`, `cuGraphicsD3D10RegisterResource`, `cuGraphicsD3D11RegisterResource`, `cuGraphicsGLRegisterBuffer`, `cuGraphicsGLRegisterImage`, [cudaGraphicsUnregisterResource](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__INTEROP.html#group__CUDART__INTEROP_1gc65d1f2900086747de1e57301d709940).
20648 ///
20649 /// # Parameters
20650 ///
20651 /// - `resource`: Resource to unregister.
20652 pub fn cuGraphicsUnregisterResource(resource: CUgraphicsResource) -> CUresult;
20653}
20654unsafe extern "C" {
20655 /// Get an array through which to access a subresource of a mapped graphics resource.
20656 ///
20657 /// Returns in \*pArray an array through which the subresource of the mapped graphics resource resource which corresponds to array index arrayIndex and mipmap level mipLevel may be accessed. The value set in \*pArray may change every time that resource is mapped.
20658 ///
20659 /// If resource is not a texture then it cannot be accessed via an array and [`cudaError_enum::CUDA_ERROR_NOT_MAPPED_AS_ARRAY`] is returned. If arrayIndex is not a valid array index for resource then [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] is returned. If mipLevel is not a valid mipmap level for resource then [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] is returned. If resource is not mapped then [`cudaError_enum::CUDA_ERROR_NOT_MAPPED`] is returned.
20660 ///
20661 /// Note:
20662 ///
20663 /// Note that this function may also return error codes from previous, asynchronous launches.
20664 ///
20665 /// **See also:**
20666 ///
20667 /// [`cuGraphicsResourceGetMappedPointer_v2`], [cudaGraphicsSubResourceGetMappedArray](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__INTEROP.html#group__CUDART__INTEROP_1g0dd6b5f024dfdcff5c28a08ef9958031).
20668 ///
20669 /// # Parameters
20670 ///
20671 /// - `pArray`: Returned array through which a subresource of resource may be accessed.
20672 /// - `resource`: Mapped resource to access.
20673 /// - `arrayIndex`: Array index for array textures or cubemap face index as defined by `CUarray_cubemap_face` for cubemap textures for the subresource to access.
20674 /// - `mipLevel`: Mipmap level for the subresource to access.
20675 pub fn cuGraphicsSubResourceGetMappedArray(
20676 pArray: *mut CUarray,
20677 resource: CUgraphicsResource,
20678 arrayIndex: ::core::ffi::c_uint,
20679 mipLevel: ::core::ffi::c_uint,
20680 ) -> CUresult;
20681}
20682unsafe extern "C" {
20683 /// Get a mipmapped array through which to access a mapped graphics resource.
20684 ///
20685 /// Returns in \*pMipmappedArray a mipmapped array through which the mapped graphics resource resource. The value set in \*pMipmappedArray may change every time that resource is mapped.
20686 ///
20687 /// If resource is not a texture then it cannot be accessed via a mipmapped array and [`cudaError_enum::CUDA_ERROR_NOT_MAPPED_AS_ARRAY`] is returned. If resource is not mapped then [`cudaError_enum::CUDA_ERROR_NOT_MAPPED`] is returned.
20688 ///
20689 /// Note:
20690 ///
20691 /// Note that this function may also return error codes from previous, asynchronous launches.
20692 ///
20693 /// **See also:**
20694 ///
20695 /// [`cuGraphicsResourceGetMappedPointer_v2`], [cudaGraphicsResourceGetMappedMipmappedArray](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__INTEROP.html#group__CUDART__INTEROP_1g84c3772d2ed06cda8c92bc43cdc893d0).
20696 ///
20697 /// # Parameters
20698 ///
20699 /// - `pMipmappedArray`: Returned mipmapped array through which resource may be accessed.
20700 /// - `resource`: Mapped resource to access.
20701 pub fn cuGraphicsResourceGetMappedMipmappedArray(
20702 pMipmappedArray: *mut CUmipmappedArray,
20703 resource: CUgraphicsResource,
20704 ) -> CUresult;
20705}
20706unsafe extern "C" {
20707 /// Get a device pointer through which to access a mapped graphics resource.
20708 ///
20709 /// Returns in \*pDevPtr a pointer through which the mapped graphics resource resource may be accessed. Returns in pSize the size of the memory in bytes which may be accessed from that pointer. The value set in pPointer may change every time that resource is mapped.
20710 ///
20711 /// If resource is not a buffer then it cannot be accessed via a pointer and [`cudaError_enum::CUDA_ERROR_NOT_MAPPED_AS_POINTER`] is returned. If resource is not mapped then [`cudaError_enum::CUDA_ERROR_NOT_MAPPED`] is returned. \*
20712 ///
20713 /// Note:
20714 ///
20715 /// Note that this function may also return error codes from previous, asynchronous launches.
20716 ///
20717 /// **See also:**
20718 ///
20719 /// [`cuGraphicsMapResources`], [`cuGraphicsSubResourceGetMappedArray`], [cudaGraphicsResourceGetMappedPointer](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__INTEROP.html#group__CUDART__INTEROP_1ga36881081c8deb4df25c256158e1ac99).
20720 ///
20721 /// # Parameters
20722 ///
20723 /// - `pDevPtr`: Returned pointer through which resource may be accessed.
20724 /// - `pSize`: Returned size of the buffer accessible starting at \*pPointer.
20725 /// - `resource`: Mapped resource to access.
20726 pub fn cuGraphicsResourceGetMappedPointer_v2(
20727 pDevPtr: *mut CUdeviceptr,
20728 pSize: *mut size_t,
20729 resource: CUgraphicsResource,
20730 ) -> CUresult;
20731}
20732unsafe extern "C" {
20733 /// Set usage flags for mapping a graphics resource.
20734 ///
20735 /// Set flags for mapping the graphics resource resource.
20736 ///
20737 /// Changes to flags will take effect the next time resource is mapped. The flags argument may be any of the following:
20738 ///
20739 /// * [`CUgraphicsMapResourceFlags::CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE`]: Specifies no hints about how this resource will be used. It is therefore assumed that
20740 /// this resource will be read from and written to by CUDA kernels. This is the default value.
20741 /// * CU_GRAPHICS_MAP_RESOURCE_FLAGS_READONLY: Specifies that CUDA kernels which access this resource will not write to this resource.
20742 /// * CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITEDISCARD: Specifies that CUDA kernels which access this resource will not read from this
20743 /// resource and will write over the entire contents of the resource, so none of the data previously stored in the resource will
20744 /// be preserved.
20745 ///
20746 /// If resource is presently mapped for access by CUDA then [`cudaError_enum::CUDA_ERROR_ALREADY_MAPPED`] is returned. If flags is not one of the above values then [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] is returned.
20747 ///
20748 /// Note:
20749 ///
20750 /// Note that this function may also return error codes from previous, asynchronous launches.
20751 ///
20752 /// **See also:**
20753 ///
20754 /// [`cuGraphicsMapResources`], [cudaGraphicsResourceSetMapFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__INTEROP.html#group__CUDART__INTEROP_1g5f94a0043909fddc100ab5f0c2476b9f).
20755 ///
20756 /// # Parameters
20757 ///
20758 /// - `resource`: Registered resource to set flags for.
20759 /// - `flags`: Parameters for resource mapping.
20760 pub fn cuGraphicsResourceSetMapFlags_v2(
20761 resource: CUgraphicsResource,
20762 flags: ::core::ffi::c_uint,
20763 ) -> CUresult;
20764}
20765unsafe extern "C" {
20766 /// Map graphics resources for access by CUDA.
20767 ///
20768 /// Maps the count graphics resources in resources for access by CUDA.
20769 ///
20770 /// The resources in resources may be accessed by CUDA until they are unmapped. The graphics API from which resources were registered should not access any resources while they are mapped by CUDA. If an application does so, the results are
20771 /// undefined.
20772 ///
20773 /// This function provides the synchronization guarantee that any graphics calls issued before [`cuGraphicsMapResources`] will complete before any subsequent CUDA work issued in stream begins.
20774 ///
20775 /// If resources includes any duplicate entries then [`cudaError_enum::CUDA_ERROR_INVALID_HANDLE`] is returned. If any of resources are presently mapped for access by CUDA then [`cudaError_enum::CUDA_ERROR_ALREADY_MAPPED`] is returned.
20776 ///
20777 /// Note:
20778 ///
20779 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
20780 /// * Note that this function may also return error codes from previous, asynchronous launches.
20781 ///
20782 /// **See also:**
20783 ///
20784 /// [`cuGraphicsResourceGetMappedPointer_v2`], [`cuGraphicsSubResourceGetMappedArray`], [`cuGraphicsUnmapResources`], [cudaGraphicsMapResources](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__INTEROP.html#group__CUDART__INTEROP_1gad8fbe74d02adefb8e7efb4971ee6322).
20785 ///
20786 /// # Parameters
20787 ///
20788 /// - `count`: Number of resources to map.
20789 /// - `resources`: Resources to map for CUDA usage.
20790 /// - `hStream`: Stream with which to synchronize.
20791 pub fn cuGraphicsMapResources(
20792 count: ::core::ffi::c_uint,
20793 resources: *mut CUgraphicsResource,
20794 hStream: CUstream,
20795 ) -> CUresult;
20796}
20797unsafe extern "C" {
20798 /// Unmap graphics resources.
20799 ///
20800 /// Unmaps the count graphics resources in resources.
20801 ///
20802 /// Once unmapped, the resources in resources may not be accessed by CUDA until they are mapped again.
20803 ///
20804 /// This function provides the synchronization guarantee that any CUDA work issued in stream before [`cuGraphicsUnmapResources`] will complete before any subsequently issued graphics work begins.
20805 ///
20806 /// If resources includes any duplicate entries then [`cudaError_enum::CUDA_ERROR_INVALID_HANDLE`] is returned. If any of resources are not presently mapped for access by CUDA then [`cudaError_enum::CUDA_ERROR_NOT_MAPPED`] is returned.
20807 ///
20808 /// Note:
20809 ///
20810 /// * This function uses standard [default stream](https://docs.nvidia.com/cuda/cuda-driver-api/stream-sync-behavior.html#stream-sync-behavior__default-stream) semantics.
20811 /// * Note that this function may also return error codes from previous, asynchronous launches.
20812 ///
20813 /// **See also:**
20814 ///
20815 /// [`cuGraphicsMapResources`], [cudaGraphicsUnmapResources](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__INTEROP.html#group__CUDART__INTEROP_1g11988ab4431b11ddb7cbde7aedb60491).
20816 ///
20817 /// # Parameters
20818 ///
20819 /// - `count`: Number of resources to unmap.
20820 /// - `resources`: Resources to unmap.
20821 /// - `hStream`: Stream with which to synchronize.
20822 pub fn cuGraphicsUnmapResources(
20823 count: ::core::ffi::c_uint,
20824 resources: *mut CUgraphicsResource,
20825 hStream: CUstream,
20826 ) -> CUresult;
20827}
20828unsafe extern "C" {
20829 /// Returns the requested driver API function pointer.
20830 ///
20831 /// Returns in \*\*pfn the address of the CUDA driver function for the requested CUDA version and flags.
20832 ///
20833 /// The CUDA version is specified as (1000 \* major + 10 \* minor), so CUDA 11.2 should be specified as 11020. For a requested driver
20834 /// symbol, if the specified CUDA version is greater than or equal to the CUDA version in which the driver symbol was introduced,
20835 /// this API will return the function pointer to the corresponding versioned function. If the specified CUDA version is greater
20836 /// than the driver version, the API will return [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`].
20837 ///
20838 /// The pointer returned by the API should be cast to a function pointer matching the requested driver function's definition in
20839 /// the API header file. The function pointer typedef can be picked up from the corresponding typedefs header file. For example,
20840 /// cudaTypedefs.h consists of function pointer typedefs for driver APIs defined in cuda.h.
20841 ///
20842 /// The API will return [`cudaError_enum::CUDA_SUCCESS`] and set the returned pfn to NULL if the requested driver function is not supported on the platform, no ABI compatible driver function exists for the
20843 /// specified cudaVersion or if the driver symbol is invalid.
20844 ///
20845 /// It will also set the optional symbolStatus to one of the values in `CUdriverProcAddressQueryResult` with the following meanings:
20846 ///
20847 /// * [`CUdriverProcAddressQueryResult_enum::CU_GET_PROC_ADDRESS_SUCCESS`] - The requested symbol was succesfully found based on input arguments and pfn is valid
20848 /// * [`CUdriverProcAddressQueryResult_enum::CU_GET_PROC_ADDRESS_SYMBOL_NOT_FOUND`] - The requested symbol was not found
20849 /// * [`CUdriverProcAddressQueryResult_enum::CU_GET_PROC_ADDRESS_VERSION_NOT_SUFFICIENT`] - The requested symbol was found but is not supported by cudaVersion specified
20850 ///
20851 /// The requested flags can be:
20852 ///
20853 /// * [`CUdriverProcAddress_flags_enum::CU_GET_PROC_ADDRESS_DEFAULT`]: This is the default mode. This is equivalent to [`CUdriverProcAddress_flags_enum::CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM`] if the code is compiled with --default-stream per-thread compilation flag or the macro CUDA_API_PER_THREAD_DEFAULT_STREAM
20854 /// is defined; [`CUdriverProcAddress_flags_enum::CU_GET_PROC_ADDRESS_LEGACY_STREAM`] otherwise.
20855 /// * [`CUdriverProcAddress_flags_enum::CU_GET_PROC_ADDRESS_LEGACY_STREAM`]: This will enable the search for all driver symbols that match the requested driver symbol name except the corresponding
20856 /// per-thread versions.
20857 /// * [`CUdriverProcAddress_flags_enum::CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM`]: This will enable the search for all driver symbols that match the requested driver symbol name including the per-thread
20858 /// versions. If a per-thread version is not found, the API will return the legacy version of the driver function.
20859 ///
20860 /// Note:
20861 ///
20862 /// Version mixing among CUDA-defined types and driver API versions is strongly discouraged and doing so can result in an undefined
20863 /// behavior. [More here](https://docs.nvidia.com/cuda/cuda-driver-api/version-mixing-rules.html#version-mixing-rules).
20864 ///
20865 /// **See also:**
20866 ///
20867 /// [cudaGetDriverEntryPointByVersion](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DRIVER__ENTRY__POINT.html#group__CUDART__DRIVER__ENTRY__POINT_1gda6c90a43afbe8043128285afbaf8c04).
20868 ///
20869 /// # Parameters
20870 ///
20871 /// - `symbol`: The base name of the driver API function to look for. As an example, for the driver API cuMemAlloc_v2, symbol would be cuMemAlloc and cudaVersion would be the ABI compatible CUDA version for the _v2 variant.
20872 /// - `pfn`: Location to return the function pointer to the requested driver function.
20873 /// - `cudaVersion`: The CUDA version to look for the requested driver symbol.
20874 /// - `flags`: Flags to specify search options.
20875 /// - `symbolStatus`: Optional location to store the status of the search for symbol based on cudaVersion. See `CUdriverProcAddressQueryResult` for possible values.
20876 pub fn cuGetProcAddress_v2(
20877 symbol: *const ::core::ffi::c_char,
20878 pfn: *mut *mut ::core::ffi::c_void,
20879 cudaVersion: ::core::ffi::c_int,
20880 flags: cuuint64_t,
20881 symbolStatus: *mut CUdriverProcAddressQueryResult,
20882 ) -> CUresult;
20883}
20884/// Flags for choosing a coredump attribute to get/set.
20885#[repr(u32)]
20886#[derive(
20887 Debug,
20888 Copy,
20889 Clone,
20890 Hash,
20891 PartialOrd,
20892 Ord,
20893 PartialEq,
20894 Eq,
20895 TryFromPrimitive,
20896 IntoPrimitive,
20897)]
20898pub enum CUcoredumpSettings_enum {
20899 CU_COREDUMP_ENABLE_ON_EXCEPTION = 1,
20900 CU_COREDUMP_TRIGGER_HOST = 2,
20901 CU_COREDUMP_LIGHTWEIGHT = 3,
20902 CU_COREDUMP_ENABLE_USER_TRIGGER = 4,
20903 CU_COREDUMP_FILE = 5,
20904 CU_COREDUMP_PIPE = 6,
20905 CU_COREDUMP_GENERATION_FLAGS = 7,
20906 CU_COREDUMP_MAX = 8,
20907}
20908pub use self::CUcoredumpSettings_enum as CUcoredumpSettings;
20909/// Flags for controlling coredump contents.
20910#[repr(i32)]
20911#[derive(
20912 Debug,
20913 Copy,
20914 Clone,
20915 Hash,
20916 PartialOrd,
20917 Ord,
20918 PartialEq,
20919 Eq,
20920 TryFromPrimitive,
20921 IntoPrimitive,
20922)]
20923pub enum CUCoredumpGenerationFlags {
20924 CU_COREDUMP_DEFAULT_FLAGS = 0,
20925 CU_COREDUMP_SKIP_NONRELOCATED_ELF_IMAGES = 1,
20926 CU_COREDUMP_SKIP_GLOBAL_MEMORY = 2,
20927 CU_COREDUMP_SKIP_SHARED_MEMORY = 4,
20928 CU_COREDUMP_SKIP_LOCAL_MEMORY = 8,
20929 CU_COREDUMP_SKIP_ABORT = 16,
20930 CU_COREDUMP_SKIP_CONSTBANK_MEMORY = 32,
20931 CU_COREDUMP_GZIP_COMPRESS = 64,
20932 CU_COREDUMP_FAULTED_CONTEXTS_ONLY = 128,
20933 CU_COREDUMP_NO_ERRBAR_AT_EXIT = 1073741824,
20934 CU_COREDUMP_LOG_ONLY = -2147483648,
20935 CU_COREDUMP_LIGHTWEIGHT_FLAGS = 47,
20936}
20937unsafe extern "C" {
20938 /// Allows caller to fetch a coredump attribute value for the current context.
20939 ///
20940 /// Returns in \*value the requested value specified by attrib. It is up to the caller to ensure that the data type and size of \*value matches the request.
20941 ///
20942 /// If the caller calls this function with \*value equal to NULL, the size of the memory region (in bytes) expected for attrib will be placed in size.
20943 ///
20944 /// The supported attributes are:
20945 ///
20946 /// * [`CUcoredumpSettings::CU_COREDUMP_ENABLE_ON_EXCEPTION`]: Bool where true means that GPU exceptions from this context will create a coredump at the
20947 /// location specified by [`CUcoredumpSettings::CU_COREDUMP_FILE`]. The default value is false unless set to true globally or locally, or the [`CUctx_flags::CU_CTX_USER_COREDUMP_ENABLE`]
20948 /// flag was set during context creation.
20949 /// * [`CUcoredumpSettings::CU_COREDUMP_TRIGGER_HOST`]: Bool where true means that the host CPU will also create a coredump. The default value is true unless
20950 /// set to false globally or or locally. This value is deprecated as of CUDA 12.5 - raise the [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_ABORT`] flag to disable
20951 /// host device abort() if needed.
20952 /// * [`CUcoredumpSettings::CU_COREDUMP_LIGHTWEIGHT`]: Bool where true means that any resulting coredumps will not have a dump of GPU memory or non-reloc
20953 /// ELF images. The default value is false unless set to true globally or locally. This attribute is deprecated as of CUDA 12.5,
20954 /// please use [`CUcoredumpSettings::CU_COREDUMP_GENERATION_FLAGS`] instead.
20955 /// * [`CUcoredumpSettings::CU_COREDUMP_ENABLE_USER_TRIGGER`]: Bool where true means that a coredump can be created by writing to the system pipe specified
20956 /// by [`CUcoredumpSettings::CU_COREDUMP_PIPE`]. The default value is false unless set to true globally or locally.
20957 /// * [`CUcoredumpSettings::CU_COREDUMP_FILE`]: String of up to 1023 characters that defines the location where any coredumps generated by this context
20958 /// will be written. The default value is core.cuda.HOSTNAME.PID where HOSTNAME is the host name of the machine running the CUDA
20959 /// applications and PID is the process ID of the CUDA application.
20960 /// * [`CUcoredumpSettings::CU_COREDUMP_PIPE`]: String of up to 1023 characters that defines the name of the pipe that will be monitored if user-triggered
20961 /// coredumps are enabled. The default value is corepipe.cuda.HOSTNAME.PID where HOSTNAME is the host name of the machine running
20962 /// the CUDA application and PID is the process ID of the CUDA application.
20963 /// * [`CUcoredumpSettings::CU_COREDUMP_GENERATION_FLAGS`]: An integer with values to allow granular control the data contained in a coredump specified
20964 /// as a bitwise OR combination of the following values: + [`CUCoredumpGenerationFlags::CU_COREDUMP_DEFAULT_FLAGS`] - if set by itself, coredump generation returns
20965 /// to its default settings of including all memory regions that it is able to access + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_NONRELOCATED_ELF_IMAGES`]
20966 /// - Coredump will not include the data from CUDA source modules that are not relocated at runtime. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_GLOBAL_MEMORY`]
20967 /// - Coredump will not include device-side global data that does not belong to any context. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_SHARED_MEMORY`]
20968 /// - Coredump will not include grid-scale shared memory for the warp that the dumped kernel belonged to. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_LOCAL_MEMORY`]
20969 /// - Coredump will not include local memory from the kernel. + [`CUCoredumpGenerationFlags::CU_COREDUMP_LIGHTWEIGHT_FLAGS`] - Enables all of the above options.
20970 /// Equiavlent to setting the [`CUcoredumpSettings::CU_COREDUMP_LIGHTWEIGHT`] attribute to true. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_ABORT`] - If set, GPU exceptions will
20971 /// not raise an abort() in the host CPU process. Same functional goal as [`CUcoredumpSettings::CU_COREDUMP_TRIGGER_HOST`] but better reflects the default
20972 /// behavior. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_CONSTBANK_MEMORY`] - Coredump will not include constbank memory. + [`CUCoredumpGenerationFlags::CU_COREDUMP_GZIP_COMPRESS`] -
20973 /// The generated coredump will be compressed with gzip, and .gz suffix will be appended to the filename, if it's not a part of
20974 /// it already. + [`CUCoredumpGenerationFlags::CU_COREDUMP_FAULTED_CONTEXTS_ONLY`] - The coredump will only include contexts that have encountered an exception
20975 /// or a trap. + [`CUCoredumpGenerationFlags::CU_COREDUMP_NO_ERRBAR_AT_EXIT`] - By default, when coredumps are requested, the GPU will ensure memory faults and
20976 /// other errors prevent warps from exiting, if possible. This can potentially affect the performance of the application. Setting
20977 /// this flag will disable this functionality, making it possible for faulted warps to exit, but also avoiding the potential performance
20978 /// hit. + [`CUCoredumpGenerationFlags::CU_COREDUMP_LOG_ONLY`] - Setting this flag will disable actual generation of the coredump file, but exception details
20979 /// will still be logged.
20980 ///
20981 /// **See also:**
20982 ///
20983 /// [`cuCoredumpGetAttributeGlobal`], [`cuCoredumpSetAttribute`], [`cuCoredumpSetAttributeGlobal`].
20984 ///
20985 /// # Parameters
20986 ///
20987 /// - `attrib`: The enum defining which value to fetch.
20988 /// - `value`: void\* containing the requested data.
20989 /// - `size`: The size of the memory region value points to.
20990 pub fn cuCoredumpGetAttribute(
20991 attrib: CUcoredumpSettings,
20992 value: *mut ::core::ffi::c_void,
20993 size: *mut size_t,
20994 ) -> CUresult;
20995}
20996unsafe extern "C" {
20997 /// Allows caller to fetch a coredump attribute value for the entire application.
20998 ///
20999 /// Returns in \*value the requested value specified by attrib. It is up to the caller to ensure that the data type and size of \*value matches the request.
21000 ///
21001 /// If the caller calls this function with \*value equal to NULL, the size of the memory region (in bytes) expected for attrib will be placed in size.
21002 ///
21003 /// The supported attributes are:
21004 ///
21005 /// * [`CUcoredumpSettings::CU_COREDUMP_ENABLE_ON_EXCEPTION`]: Bool where true means that GPU exceptions from this context will create a coredump at the
21006 /// location specified by [`CUcoredumpSettings::CU_COREDUMP_FILE`]. The default value is false.
21007 /// * [`CUcoredumpSettings::CU_COREDUMP_TRIGGER_HOST`]: Bool where true means that the host CPU will also create a coredump. The default value is true unless
21008 /// set to false globally or or locally. This value is deprecated as of CUDA 12.5 - raise the [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_ABORT`] flag to disable
21009 /// host device abort() if needed.
21010 /// * [`CUcoredumpSettings::CU_COREDUMP_LIGHTWEIGHT`]: Bool where true means that any resulting coredumps will not have a dump of GPU memory or non-reloc
21011 /// ELF images. The default value is false. This attribute is deprecated as of CUDA 12.5, please use [`CUcoredumpSettings::CU_COREDUMP_GENERATION_FLAGS`]
21012 /// instead.
21013 /// * [`CUcoredumpSettings::CU_COREDUMP_ENABLE_USER_TRIGGER`]: Bool where true means that a coredump can be created by writing to the system pipe specified
21014 /// by [`CUcoredumpSettings::CU_COREDUMP_PIPE`]. The default value is false.
21015 /// * [`CUcoredumpSettings::CU_COREDUMP_FILE`]: String of up to 1023 characters that defines the location where any coredumps generated by this context
21016 /// will be written. The default value is core.cuda.HOSTNAME.PID where HOSTNAME is the host name of the machine running the CUDA
21017 /// applications and PID is the process ID of the CUDA application.
21018 /// * [`CUcoredumpSettings::CU_COREDUMP_PIPE`]: String of up to 1023 characters that defines the name of the pipe that will be monitored if user-triggered
21019 /// coredumps are enabled. The default value is corepipe.cuda.HOSTNAME.PID where HOSTNAME is the host name of the machine running
21020 /// the CUDA application and PID is the process ID of the CUDA application.
21021 /// * [`CUcoredumpSettings::CU_COREDUMP_GENERATION_FLAGS`]: An integer with values to allow granular control the data contained in a coredump specified
21022 /// as a bitwise OR combination of the following values: + [`CUCoredumpGenerationFlags::CU_COREDUMP_DEFAULT_FLAGS`] - if set by itself, coredump generation returns
21023 /// to its default settings of including all memory regions that it is able to access + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_NONRELOCATED_ELF_IMAGES`]
21024 /// - Coredump will not include the data from CUDA source modules that are not relocated at runtime. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_GLOBAL_MEMORY`]
21025 /// - Coredump will not include device-side global data that does not belong to any context. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_SHARED_MEMORY`]
21026 /// - Coredump will not include grid-scale shared memory for the warp that the dumped kernel belonged to. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_LOCAL_MEMORY`]
21027 /// - Coredump will not include local memory from the kernel. + [`CUCoredumpGenerationFlags::CU_COREDUMP_LIGHTWEIGHT_FLAGS`] - Enables all of the above options.
21028 /// Equiavlent to setting the [`CUcoredumpSettings::CU_COREDUMP_LIGHTWEIGHT`] attribute to true. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_ABORT`] - If set, GPU exceptions will
21029 /// not raise an abort() in the host CPU process. Same functional goal as [`CUcoredumpSettings::CU_COREDUMP_TRIGGER_HOST`] but better reflects the default
21030 /// behavior. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_CONSTBANK_MEMORY`] - Coredump will not include constbank memory. + [`CUCoredumpGenerationFlags::CU_COREDUMP_GZIP_COMPRESS`] -
21031 /// The generated coredump will be compressed with gzip, and .gz suffix will be appended to the filename, if it's not a part of
21032 /// it already. + [`CUCoredumpGenerationFlags::CU_COREDUMP_FAULTED_CONTEXTS_ONLY`] - The coredump will only include contexts that have encountered an exception
21033 /// or a trap. + [`CUCoredumpGenerationFlags::CU_COREDUMP_NO_ERRBAR_AT_EXIT`] - By default, when coredumps are requested, the GPU will ensure memory faults and
21034 /// other errors prevent warps from exiting, if possible. This can potentially affect the performance of the application. Setting
21035 /// this flag will disable this functionality, making it possible for faulted warps to exit, but also avoiding the potential performance
21036 /// hit. + [`CUCoredumpGenerationFlags::CU_COREDUMP_LOG_ONLY`] - Setting this flag will disable actual generation of the coredump file, but exception details
21037 /// will still be logged.
21038 ///
21039 /// **See also:**
21040 ///
21041 /// [`cuCoredumpGetAttribute`], [`cuCoredumpSetAttribute`], [`cuCoredumpSetAttributeGlobal`].
21042 ///
21043 /// # Parameters
21044 ///
21045 /// - `attrib`: The enum defining which value to fetch.
21046 /// - `value`: void\* containing the requested data.
21047 /// - `size`: The size of the memory region value points to.
21048 pub fn cuCoredumpGetAttributeGlobal(
21049 attrib: CUcoredumpSettings,
21050 value: *mut ::core::ffi::c_void,
21051 size: *mut size_t,
21052 ) -> CUresult;
21053}
21054unsafe extern "C" {
21055 /// Allows caller to set a coredump attribute value for the current context.
21056 ///
21057 /// This function should be considered an alternate interface to the CUDA-GDB environment variables defined in this document:
21058 /// <https://docs.nvidia.com/cuda/cuda-gdb/index.html#gpu-coredump>
21059 ///
21060 /// An important design decision to note is that any coredump environment variable values set before CUDA initializes will take
21061 /// permanent precedence over any values set with this function. This decision was made to ensure no change in behavior for any
21062 /// users that may be currently using these variables to get coredumps.
21063 ///
21064 /// \*value shall contain the requested value specified by set. It is up to the caller to ensure that the data type and size of \*value matches the request.
21065 ///
21066 /// If the caller calls this function with \*value equal to NULL, the size of the memory region (in bytes) expected for set will be placed in size.
21067 ///
21068 /// /note This function will return [`cudaError_enum::CUDA_ERROR_NOT_SUPPORTED`] if the caller attempts to set [`CUcoredumpSettings::CU_COREDUMP_ENABLE_ON_EXCEPTION`] on a GPU of with Compute Capability < 6.0. [`cuCoredumpSetAttributeGlobal`] works on those platforms as an alternative.
21069 ///
21070 /// /note [`CUcoredumpSettings::CU_COREDUMP_ENABLE_USER_TRIGGER`] and [`CUcoredumpSettings::CU_COREDUMP_PIPE`] cannot be set on a per-context basis.
21071 ///
21072 /// The supported attributes are:
21073 ///
21074 /// * [`CUcoredumpSettings::CU_COREDUMP_ENABLE_ON_EXCEPTION`]: Bool where true means that GPU exceptions from this context will create a coredump at the
21075 /// location specified by [`CUcoredumpSettings::CU_COREDUMP_FILE`]. The default value is false.
21076 /// * [`CUcoredumpSettings::CU_COREDUMP_TRIGGER_HOST`]: Bool where true means that the host CPU will also create a coredump. The default value is true unless
21077 /// set to false globally or or locally. This value is deprecated as of CUDA 12.5 - raise the [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_ABORT`] flag to disable
21078 /// host device abort() if needed.
21079 /// * [`CUcoredumpSettings::CU_COREDUMP_LIGHTWEIGHT`]: Bool where true means that any resulting coredumps will not have a dump of GPU memory or non-reloc
21080 /// ELF images. The default value is false. This attribute is deprecated as of CUDA 12.5, please use [`CUcoredumpSettings::CU_COREDUMP_GENERATION_FLAGS`]
21081 /// instead.
21082 /// * [`CUcoredumpSettings::CU_COREDUMP_FILE`]: String of up to 1023 characters that defines the location where any coredumps generated by this context
21083 /// will be written. The default value is core.cuda.HOSTNAME.PID where HOSTNAME is the host name of the machine running the CUDA
21084 /// applications and PID is the process ID of the CUDA application.
21085 /// * [`CUcoredumpSettings::CU_COREDUMP_GENERATION_FLAGS`]: An integer with values to allow granular control the data contained in a coredump specified
21086 /// as a bitwise OR combination of the following values: + [`CUCoredumpGenerationFlags::CU_COREDUMP_DEFAULT_FLAGS`] - if set by itself, coredump generation returns
21087 /// to its default settings of including all memory regions that it is able to access + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_NONRELOCATED_ELF_IMAGES`]
21088 /// - Coredump will not include the data from CUDA source modules that are not relocated at runtime. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_GLOBAL_MEMORY`]
21089 /// - Coredump will not include device-side global data that does not belong to any context. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_SHARED_MEMORY`]
21090 /// - Coredump will not include grid-scale shared memory for the warp that the dumped kernel belonged to. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_LOCAL_MEMORY`]
21091 /// - Coredump will not include local memory from the kernel. + [`CUCoredumpGenerationFlags::CU_COREDUMP_LIGHTWEIGHT_FLAGS`] - Enables all of the above options.
21092 /// Equiavlent to setting the [`CUcoredumpSettings::CU_COREDUMP_LIGHTWEIGHT`] attribute to true. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_ABORT`] - If set, GPU exceptions will
21093 /// not raise an abort() in the host CPU process. Same functional goal as [`CUcoredumpSettings::CU_COREDUMP_TRIGGER_HOST`] but better reflects the default
21094 /// behavior. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_CONSTBANK_MEMORY`] - Coredump will not include constbank memory. + [`CUCoredumpGenerationFlags::CU_COREDUMP_GZIP_COMPRESS`] -
21095 /// The generated coredump will be compressed with gzip, and .gz suffix will be appended to the filename, if it's not a part of
21096 /// it already. + [`CUCoredumpGenerationFlags::CU_COREDUMP_FAULTED_CONTEXTS_ONLY`] - The coredump will only include contexts that have encountered an exception
21097 /// or a trap. + [`CUCoredumpGenerationFlags::CU_COREDUMP_NO_ERRBAR_AT_EXIT`] - By default, when coredumps are requested, the GPU will ensure memory faults and
21098 /// other errors prevent warps from exiting, if possible. This can potentially affect the performance of the application. Setting
21099 /// this flag will disable this functionality, making it possible for faulted warps to exit, but also avoiding the potential performance
21100 /// hit. + [`CUCoredumpGenerationFlags::CU_COREDUMP_LOG_ONLY`] - Setting this flag will disable actual generation of the coredump file, but exception details
21101 /// will still be logged.
21102 ///
21103 /// Note:
21104 ///
21105 /// [`CUcoredumpSettings::CU_COREDUMP_GENERATION_FLAGS`] replaces all previously set coredump flags. Mixing [`CUcoredumpSettings::CU_COREDUMP_GENERATION_FLAGS`] with the deprecated
21106 /// boolean attributes ([`CUcoredumpSettings::CU_COREDUMP_TRIGGER_HOST`], [`CUcoredumpSettings::CU_COREDUMP_LIGHTWEIGHT`]) can result in undefined behavior. To avoid issues,
21107 /// either use only [`CUcoredumpSettings::CU_COREDUMP_GENERATION_FLAGS`] or combine all desired flag bits (including [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_ABORT`]) in a single
21108 /// call.
21109 ///
21110 /// **See also:**
21111 ///
21112 /// [`cuCoredumpGetAttributeGlobal`], [`cuCoredumpGetAttribute`], [`cuCoredumpSetAttributeGlobal`].
21113 ///
21114 /// # Parameters
21115 ///
21116 /// - `attrib`: The enum defining which value to set.
21117 /// - `value`: void\* containing the requested data.
21118 /// - `size`: The size of the memory region value points to.
21119 pub fn cuCoredumpSetAttribute(
21120 attrib: CUcoredumpSettings,
21121 value: *mut ::core::ffi::c_void,
21122 size: *mut size_t,
21123 ) -> CUresult;
21124}
21125unsafe extern "C" {
21126 /// Allows caller to set a coredump attribute value globally.
21127 ///
21128 /// This function should be considered an alternate interface to the CUDA-GDB environment variables defined in this document:
21129 /// <https://docs.nvidia.com/cuda/cuda-gdb/index.html#gpu-coredump>
21130 ///
21131 /// An important design decision to note is that any coredump environment variable values set before CUDA initializes will take
21132 /// permanent precedence over any values set with this function. This decision was made to ensure no change in behavior for any
21133 /// users that may be currently using these variables to get coredumps.
21134 ///
21135 /// \*value shall contain the requested value specified by set. It is up to the caller to ensure that the data type and size of \*value matches the request.
21136 ///
21137 /// If the caller calls this function with \*value equal to NULL, the size of the memory region (in bytes) expected for set will be placed in size.
21138 ///
21139 /// The supported attributes are:
21140 ///
21141 /// * [`CUcoredumpSettings::CU_COREDUMP_ENABLE_ON_EXCEPTION`]: Bool where true means that GPU exceptions from this context will create a coredump at the
21142 /// location specified by [`CUcoredumpSettings::CU_COREDUMP_FILE`]. The default value is false.
21143 /// * [`CUcoredumpSettings::CU_COREDUMP_TRIGGER_HOST`]: Bool where true means that the host CPU will also create a coredump. The default value is true unless
21144 /// set to false globally or or locally. This value is deprecated as of CUDA 12.5 - raise the [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_ABORT`] flag to disable
21145 /// host device abort() if needed.
21146 /// * [`CUcoredumpSettings::CU_COREDUMP_LIGHTWEIGHT`]: Bool where true means that any resulting coredumps will not have a dump of GPU memory or non-reloc
21147 /// ELF images. The default value is false. This attribute is deprecated as of CUDA 12.5, please use [`CUcoredumpSettings::CU_COREDUMP_GENERATION_FLAGS`]
21148 /// instead.
21149 /// * [`CUcoredumpSettings::CU_COREDUMP_ENABLE_USER_TRIGGER`]: Bool where true means that a coredump can be created by writing to the system pipe specified
21150 /// by [`CUcoredumpSettings::CU_COREDUMP_PIPE`]. The default value is false.
21151 /// * [`CUcoredumpSettings::CU_COREDUMP_FILE`]: String of up to 1023 characters that defines the location where any coredumps generated by this context
21152 /// will be written. The default value is core.cuda.HOSTNAME.PID where HOSTNAME is the host name of the machine running the CUDA
21153 /// applications and PID is the process ID of the CUDA application.
21154 /// * [`CUcoredumpSettings::CU_COREDUMP_PIPE`]: String of up to 1023 characters that defines the name of the pipe that will be monitored if user-triggered
21155 /// coredumps are enabled. This value may not be changed after [`CUcoredumpSettings::CU_COREDUMP_ENABLE_USER_TRIGGER`] is set to true. The default value
21156 /// is corepipe.cuda.HOSTNAME.PID where HOSTNAME is the host name of the machine running the CUDA application and PID is the process
21157 /// ID of the CUDA application.
21158 /// * [`CUcoredumpSettings::CU_COREDUMP_GENERATION_FLAGS`]: An integer with values to allow granular control the data contained in a coredump specified
21159 /// as a bitwise OR combination of the following values: + [`CUCoredumpGenerationFlags::CU_COREDUMP_DEFAULT_FLAGS`] - if set by itself, coredump generation returns
21160 /// to its default settings of including all memory regions that it is able to access + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_NONRELOCATED_ELF_IMAGES`]
21161 /// - Coredump will not include the data from CUDA source modules that are not relocated at runtime. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_GLOBAL_MEMORY`]
21162 /// - Coredump will not include device-side global data that does not belong to any context. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_SHARED_MEMORY`]
21163 /// - Coredump will not include grid-scale shared memory for the warp that the dumped kernel belonged to. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_LOCAL_MEMORY`]
21164 /// - Coredump will not include local memory from the kernel. + [`CUCoredumpGenerationFlags::CU_COREDUMP_LIGHTWEIGHT_FLAGS`] - Enables all of the above options.
21165 /// Equiavlent to setting the [`CUcoredumpSettings::CU_COREDUMP_LIGHTWEIGHT`] attribute to true. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_ABORT`] - If set, GPU exceptions will
21166 /// not raise an abort() in the host CPU process. Same functional goal as [`CUcoredumpSettings::CU_COREDUMP_TRIGGER_HOST`] but better reflects the default
21167 /// behavior. + [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_CONSTBANK_MEMORY`] - Coredump will not include constbank memory. + [`CUCoredumpGenerationFlags::CU_COREDUMP_GZIP_COMPRESS`] -
21168 /// The generated coredump will be compressed with gzip, and .gz suffix will be appended to the filename, if it's not a part of
21169 /// it already. + [`CUCoredumpGenerationFlags::CU_COREDUMP_FAULTED_CONTEXTS_ONLY`] - The coredump will only include contexts that have encountered an exception
21170 /// or a trap. + [`CUCoredumpGenerationFlags::CU_COREDUMP_NO_ERRBAR_AT_EXIT`] - By default, when coredumps are requested, the GPU will ensure memory faults and
21171 /// other errors prevent warps from exiting, if possible. This can potentially affect the performance of the application. Setting
21172 /// this flag will disable this functionality, making it possible for faulted warps to exit, but also avoiding the potential performance
21173 /// hit. + [`CUCoredumpGenerationFlags::CU_COREDUMP_LOG_ONLY`] - Setting this flag will disable actual generation of the coredump file, but exception details
21174 /// will still be logged.
21175 ///
21176 /// Note:
21177 ///
21178 /// [`CUcoredumpSettings::CU_COREDUMP_GENERATION_FLAGS`] replaces all previously set coredump flags. Mixing [`CUcoredumpSettings::CU_COREDUMP_GENERATION_FLAGS`] with the deprecated
21179 /// boolean attributes ([`CUcoredumpSettings::CU_COREDUMP_TRIGGER_HOST`], [`CUcoredumpSettings::CU_COREDUMP_LIGHTWEIGHT`]) can result in undefined behavior. To avoid issues,
21180 /// either use only [`CUcoredumpSettings::CU_COREDUMP_GENERATION_FLAGS`] or combine all desired flag bits (including [`CUCoredumpGenerationFlags::CU_COREDUMP_SKIP_ABORT`]) in a single
21181 /// call.
21182 ///
21183 /// **See also:**
21184 ///
21185 /// [`cuCoredumpGetAttribute`], [`cuCoredumpGetAttributeGlobal`], [`cuCoredumpSetAttribute`].
21186 ///
21187 /// # Parameters
21188 ///
21189 /// - `attrib`: The enum defining which value to set.
21190 /// - `value`: void\* containing the requested data.
21191 /// - `size`: The size of the memory region value points to.
21192 pub fn cuCoredumpSetAttributeGlobal(
21193 attrib: CUcoredumpSettings,
21194 value: *mut ::core::ffi::c_void,
21195 size: *mut size_t,
21196 ) -> CUresult;
21197}
21198#[repr(C)]
21199#[derive(Debug, Copy, Clone)]
21200pub struct CUcoredumpCallbackEntry_st {
21201 _unused: [u8; 0],
21202}
21203/// Opaque handle representing a registered coredump status callback. This handle is returned when registering a callback and
21204/// must be provided when deregistering the callback.
21205pub type CUcoredumpCallbackHandle = *mut CUcoredumpCallbackEntry_st;
21206/// Callback function prototype for GPU coredump status notifications. This callback will be invoked when a GPU coredump begins
21207/// or completes, depending on which registration function was used. The callback executes synchronously during the coredump process.
21208pub type CUcoredumpStatusCallback = ::core::option::Option<
21209 unsafe extern "C" fn(
21210 userData: *mut ::core::ffi::c_void,
21211 pid: ::core::ffi::c_int,
21212 dev: CUdevice,
21213 ),
21214>;
21215unsafe extern "C" {
21216 /// Register a callback to be invoked when a GPU coredump begins.
21217 ///
21218 /// This function registers a callback that will be called when a GPU coredump is initiated, before any coredump data is collected.
21219 /// Callbacks are executed in the order they were registered. The same callback function can be registered multiple times with
21220 /// different userData, and each registration will receive a unique handle.
21221 ///
21222 /// Note:
21223 ///
21224 /// Callbacks execute synchronously during the coredump process and will block coredump progress while running.
21225 ///
21226 /// **See also:**
21227 ///
21228 /// [`cuCoredumpDeregisterStartCallback`], [`cuCoredumpRegisterCompleteCallback`].
21229 ///
21230 /// # Parameters
21231 ///
21232 /// - `callback`: The callback function to register.
21233 /// - `userData`: User data pointer to pass to the callback.
21234 /// - `callbackOut`: Location to store the callback handle (optional, may be NULL).
21235 pub fn cuCoredumpRegisterStartCallback(
21236 callback: CUcoredumpStatusCallback,
21237 userData: *mut ::core::ffi::c_void,
21238 callbackOut: *mut CUcoredumpCallbackHandle,
21239 ) -> CUresult;
21240}
21241unsafe extern "C" {
21242 /// Register a callback to be invoked when a GPU coredump completes.
21243 ///
21244 /// This function registers a callback that will be called when a GPU coredump has been fully collected and written to disk. Callbacks
21245 /// are executed in the order they were registered. The same callback function can be registered multiple times with different
21246 /// userData, and each registration will receive a unique handle.
21247 ///
21248 /// Note:
21249 ///
21250 /// Callbacks execute synchronously during the coredump process and will block coredump progress while running.
21251 ///
21252 /// **See also:**
21253 ///
21254 /// [`cuCoredumpDeregisterCompleteCallback`], [`cuCoredumpRegisterStartCallback`].
21255 ///
21256 /// # Parameters
21257 ///
21258 /// - `callback`: The callback function to register.
21259 /// - `userData`: User data pointer to pass to the callback.
21260 /// - `callbackOut`: Location to store the callback handle (optional, may be NULL).
21261 pub fn cuCoredumpRegisterCompleteCallback(
21262 callback: CUcoredumpStatusCallback,
21263 userData: *mut ::core::ffi::c_void,
21264 callbackOut: *mut CUcoredumpCallbackHandle,
21265 ) -> CUresult;
21266}
21267unsafe extern "C" {
21268 /// Deregister a previously registered coredump start callback.
21269 ///
21270 /// This function removes a callback that was registered with [`cuCoredumpRegisterStartCallback`]. The callback handle becomes invalid after this call.
21271 ///
21272 /// Note:
21273 ///
21274 /// It is the caller's responsibility to deregister callbacks before they go out of scope.
21275 ///
21276 /// **See also:**
21277 ///
21278 /// [`cuCoredumpRegisterStartCallback`].
21279 ///
21280 /// # Parameters
21281 ///
21282 /// - `callback`: The callback handle to deregister.
21283 pub fn cuCoredumpDeregisterStartCallback(
21284 callback: CUcoredumpCallbackHandle,
21285 ) -> CUresult;
21286}
21287unsafe extern "C" {
21288 /// Deregister a previously registered coredump complete callback.
21289 ///
21290 /// This function removes a callback that was registered with [`cuCoredumpRegisterCompleteCallback`]. The callback handle becomes invalid after this call.
21291 ///
21292 /// Note:
21293 ///
21294 /// It is the caller's responsibility to deregister callbacks before they go out of scope.
21295 ///
21296 /// **See also:**
21297 ///
21298 /// [`cuCoredumpRegisterCompleteCallback`].
21299 ///
21300 /// # Parameters
21301 ///
21302 /// - `callback`: The callback handle to deregister.
21303 pub fn cuCoredumpDeregisterCompleteCallback(
21304 callback: CUcoredumpCallbackHandle,
21305 ) -> CUresult;
21306}
21307unsafe extern "C" {
21308 pub fn cuGetExportTable(
21309 ppExportTable: *mut *const ::core::ffi::c_void,
21310 pExportTableId: *const CUuuid,
21311 ) -> CUresult;
21312}
21313#[repr(C)]
21314#[derive(Debug, Copy, Clone)]
21315pub struct CUdevResourceDesc_st {
21316 _unused: [u8; 0],
21317}
21318/// An opaque descriptor handle. The descriptor encapsulates multiple created and configured resources. Created via [`cuDevResourceGenerateDesc`].
21319pub type CUdevResourceDesc = *mut CUdevResourceDesc_st;
21320/// Flags for green context creation.
21321#[repr(u32)]
21322#[derive(
21323 Debug,
21324 Copy,
21325 Clone,
21326 Hash,
21327 PartialOrd,
21328 Ord,
21329 PartialEq,
21330 Eq,
21331 TryFromPrimitive,
21332 IntoPrimitive,
21333)]
21334pub enum CUgreenCtxCreate_flags {
21335 CU_GREEN_CTX_NONE = 0,
21336 /// Creates a default stream to use inside the green context.
21337 CU_GREEN_CTX_DEFAULT_STREAM = 1,
21338}
21339/// Flags for a [`CUdevSmResource`] group.
21340#[repr(u32)]
21341#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
21342pub enum CUdevSmResourceGroup_flags {
21343 CU_DEV_SM_RESOURCE_GROUP_DEFAULT = 0,
21344 CU_DEV_SM_RESOURCE_GROUP_BACKFILL = 1,
21345}
21346#[repr(u32)]
21347#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
21348pub enum CUdevSmResourceSplitByCount_flags {
21349 CU_DEV_SM_RESOURCE_SPLIT_IGNORE_SM_COSCHEDULING = 1,
21350 CU_DEV_SM_RESOURCE_SPLIT_MAX_POTENTIAL_CLUSTER_SIZE = 2,
21351}
21352/// Type of resource.
21353#[repr(u32)]
21354#[derive(
21355 Debug,
21356 Copy,
21357 Clone,
21358 Hash,
21359 PartialOrd,
21360 Ord,
21361 PartialEq,
21362 Eq,
21363 TryFromPrimitive,
21364 IntoPrimitive,
21365)]
21366pub enum CUdevResourceType {
21367 CU_DEV_RESOURCE_TYPE_INVALID = 0,
21368 /// Streaming multiprocessors related information.
21369 CU_DEV_RESOURCE_TYPE_SM = 1,
21370 /// Workqueue configuration related information.
21371 CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG = 1000,
21372 /// Pre-existing workqueue related information.
21373 CU_DEV_RESOURCE_TYPE_WORKQUEUE = 10000,
21374}
21375#[repr(C)]
21376#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
21377pub struct CUdevSmResource_st {
21378 pub smCount: ::core::ffi::c_uint,
21379 pub minSmPartitionSize: ::core::ffi::c_uint,
21380 pub smCoscheduledAlignment: ::core::ffi::c_uint,
21381 pub flags: ::core::ffi::c_uint,
21382}
21383/// Data for SM-related resources All parameters in this structure are OUTPUT only. Do not write to any of the fields in this
21384/// structure.
21385pub type CUdevSmResource = CUdevSmResource_st;
21386/// Sharing scope for workqueues.
21387#[repr(u32)]
21388#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
21389pub enum CUdevWorkqueueConfigScope {
21390 /// Use all shared workqueue resources across all contexts. Default driver behavior.
21391 CU_WORKQUEUE_SCOPE_DEVICE_CTX = 0,
21392 /// When possible, use non-overlapping workqueue resources with other balanced green contexts.
21393 CU_WORKQUEUE_SCOPE_GREEN_CTX_BALANCED = 1,
21394}
21395#[repr(C)]
21396#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
21397pub struct CUdevWorkqueueConfigResource_st {
21398 pub device: CUdevice,
21399 pub wqConcurrencyLimit: ::core::ffi::c_uint,
21400 pub sharingScope: CUdevWorkqueueConfigScope,
21401}
21402impl Default for CUdevWorkqueueConfigResource_st {
21403 fn default() -> Self {
21404 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
21405 unsafe {
21406 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
21407 s.assume_init()
21408 }
21409 }
21410}
21411/// Data for workqueue configuration related resources.
21412pub type CUdevWorkqueueConfigResource = CUdevWorkqueueConfigResource_st;
21413#[repr(C)]
21414#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
21415pub struct CUdevWorkqueueResource_st {
21416 pub reserved: [::core::ffi::c_uchar; 40usize],
21417}
21418impl Default for CUdevWorkqueueResource_st {
21419 fn default() -> Self {
21420 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
21421 unsafe {
21422 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
21423 s.assume_init()
21424 }
21425 }
21426}
21427/// Handle to a pre-existing workqueue related resource.
21428pub type CUdevWorkqueueResource = CUdevWorkqueueResource_st;
21429#[repr(C)]
21430#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
21431pub struct CU_DEV_SM_RESOURCE_GROUP_PARAMS_st {
21432 pub smCount: ::core::ffi::c_uint,
21433 pub coscheduledSmCount: ::core::ffi::c_uint,
21434 pub preferredCoscheduledSmCount: ::core::ffi::c_uint,
21435 pub flags: ::core::ffi::c_uint,
21436 pub reserved: [::core::ffi::c_uint; 12usize],
21437}
21438/// Input data for splitting SMs.
21439pub type CU_DEV_SM_RESOURCE_GROUP_PARAMS = CU_DEV_SM_RESOURCE_GROUP_PARAMS_st;
21440#[repr(C)]
21441#[derive(Copy, Clone)]
21442pub struct CUdevResource_st {
21443 pub type_: CUdevResourceType,
21444 pub _internal_padding: [::core::ffi::c_uchar; 92usize],
21445 pub __bindgen_anon_1: CUdevResource_st__bindgen_ty_1,
21446 pub nextResource: *mut CUdevResource_st,
21447}
21448#[repr(C)]
21449#[derive(Copy, Clone)]
21450pub union CUdevResource_st__bindgen_ty_1 {
21451 pub sm: CUdevSmResource,
21452 pub wqConfig: CUdevWorkqueueConfigResource,
21453 pub wq: CUdevWorkqueueResource,
21454 pub _oversize: [::core::ffi::c_uchar; 40usize],
21455}
21456impl Default for CUdevResource_st__bindgen_ty_1 {
21457 fn default() -> Self {
21458 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
21459 unsafe {
21460 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
21461 s.assume_init()
21462 }
21463 }
21464}
21465impl Default for CUdevResource_st {
21466 fn default() -> Self {
21467 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
21468 unsafe {
21469 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
21470 s.assume_init()
21471 }
21472 }
21473}
21474pub type CUdevResource_v1 = CUdevResource_st;
21475/// A tagged union describing different resources identified by the type field. This structure should not be directly modified
21476/// outside of the API that created it.
21477///
21478/// ```text
21479/// struct {
21480/// CUdevResourceType type;
21481/// union {
21482/// CUdevSmResource sm;
21483/// CUdevWorkqueueConfigResource wqConfig;
21484/// CUdevWorkqueueResource wq;
21485/// };
21486/// };
21487/// ```
21488///
21489/// * If type is [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_INVALID`], this resource is not valid and cannot be further accessed.
21490/// * If type is [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_SM`], the [`CUdevSmResource`] structure sm is filled in. For example, sm.smCount will reflect the amount of streaming multiprocessors available in this resource.
21491/// * If type is [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG`], the [`CUdevWorkqueueConfigResource`] structure wqConfig is filled in.
21492/// * If type is [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_WORKQUEUE`], the [`CUdevWorkqueueResource`] structure wq is filled in.
21493pub type CUdevResource = CUdevResource_v1;
21494unsafe extern "C" {
21495 /// Creates a green context with a specified set of resources.
21496 ///
21497 /// This API creates a green context with the resources specified in the descriptor desc and returns it in the handle represented by phCtx. This API will retain the primary context on device dev, which will is released when the green context is destroyed. It is advised to have the primary context active before calling
21498 /// this API to avoid the heavy cost of triggering primary context initialization and deinitialization multiple times.
21499 ///
21500 /// The API does not set the green context current. In order to set it current, you need to explicitly set it current by first
21501 /// converting the green context to a CUcontext using [`cuCtxFromGreenCtx`] and subsequently calling [`cuCtxSetCurrent`] / [`cuCtxPushCurrent_v2`]. It should be noted that a green context can be current to only one thread at a time. There is no internal synchronization
21502 /// to make API calls accessing the same green context from multiple threads work.
21503 ///
21504 /// Note: The API is not supported on 32-bit platforms.
21505 ///
21506 /// The supported flags are:
21507 ///
21508 /// * [`CUgreenCtxCreate_flags::CU_GREEN_CTX_NONE`] : Default behavior.
21509 /// * [`CUgreenCtxCreate_flags::CU_GREEN_CTX_DEFAULT_STREAM`] : Creates a default stream to use inside the green context.
21510 ///
21511 /// **See also:**
21512 ///
21513 /// [`cuGreenCtxDestroy`], [`cuCtxFromGreenCtx`], [`cuCtxSetCurrent`], [`cuCtxPushCurrent_v2`], [`cuDevResourceGenerateDesc`], [`cuDevicePrimaryCtxRetain`], [`cuCtxCreate_v4`].
21514 ///
21515 /// # Parameters
21516 ///
21517 /// - `phCtx`: Pointer for the output handle to the green context.
21518 /// - `desc`: Descriptor generated via [`cuDevResourceGenerateDesc`] which contains the set of resources to be used.
21519 /// - `dev`: Device on which to create the green context.
21520 /// - `flags`: One of the supported green context creation flags.
21521 pub fn cuGreenCtxCreate(
21522 phCtx: *mut CUgreenCtx,
21523 desc: CUdevResourceDesc,
21524 dev: CUdevice,
21525 flags: ::core::ffi::c_uint,
21526 ) -> CUresult;
21527}
21528unsafe extern "C" {
21529 /// Destroys a green context.
21530 ///
21531 /// Destroys the green context, releasing the primary context of the device that this green context was created for. Any resources
21532 /// provisioned for this green context (that were initially available via the resource descriptor) are released as well. The API
21533 /// does not destroy streams created via [`cuGreenCtxStreamCreate`], [`cuStreamCreate`], or [`cuStreamCreateWithPriority`]. Users are expected to destroy these streams explicitly using [`cuStreamDestroy_v2`] to avoid resource leaks. Once the green context is destroyed, any subsequent API calls involving these streams will return
21534 /// [`cudaError_enum::CUDA_ERROR_STREAM_DETACHED`] with the exception of the following APIs:
21535 ///
21536 /// * [`cuStreamDestroy_v2`].
21537 ///
21538 /// Additionally, the API will invalidate all active captures on these streams.
21539 ///
21540 /// **See also:**
21541 ///
21542 /// [`cuGreenCtxCreate`], [`cuCtxDestroy_v2`].
21543 ///
21544 /// # Parameters
21545 ///
21546 /// - `hCtx`: Green context to be destroyed.
21547 pub fn cuGreenCtxDestroy(hCtx: CUgreenCtx) -> CUresult;
21548}
21549unsafe extern "C" {
21550 /// Returns a CUcontext handle for a green context.
21551 ///
21552 /// This API returns in pContext a [`CUcontext`] handle that represents the specified green context hCtx. The returned handle can be passed to CUDA APIs that accept a [`CUcontext`] and will be treated as if it were a primary context, while still honoring the resources and configuration associated with
21553 /// hCtx as applicable.
21554 ///
21555 /// Applications that wish to use a green context with CUDA APIs that require a [`CUcontext`] must use this API to obtain a handle to a [`CUcontext`] representing the green context. Otherwise, passing a green context to such APIs will fail with [`cudaError_enum::CUDA_ERROR_INVALID_CONTEXT`].
21556 ///
21557 /// The [`CUcontext`] returned by [`cuCtxFromGreenCtx`] may be passed to CUDA Driver APIs that accept a [`CUcontext`].
21558 ///
21559 /// * For APIs whose semantics are independent of green context resources, the operation is performed identically to how it would
21560 /// perform with a primary context.
21561 /// * For APIs whose behavior depends on green context resources (for example, kernel launch), the operation is performed using
21562 /// the resources and configuration of the specified green context hCtx.
21563 ///
21564 /// This call does not create a new independent context and does not change the underlying context lifetime. The validity of the
21565 /// returned pContext is tied to hCtx, and no additional destruction or release is required beyond correctly managing hCtx with the green context APIs. Destroying pContext via [`cuCtxDestroy_v2`] is undefined behavior.
21566 ///
21567 /// **See also:**
21568 ///
21569 /// [`cuGreenCtxCreate`].
21570 ///
21571 /// # Parameters
21572 ///
21573 /// - `pContext`: Returned [`CUcontext`] with green context resources.
21574 /// - `hCtx`: Green context to convert.
21575 pub fn cuCtxFromGreenCtx(pContext: *mut CUcontext, hCtx: CUgreenCtx) -> CUresult;
21576}
21577unsafe extern "C" {
21578 /// Get device resources.
21579 ///
21580 /// Get the type resources available to the device. This may often be the starting point for further partitioning or configuring of resources.
21581 ///
21582 /// Note: The API is not supported on 32-bit platforms.
21583 ///
21584 /// **See also:**
21585 ///
21586 /// [`cuDevResourceGenerateDesc`].
21587 ///
21588 /// # Parameters
21589 ///
21590 /// - `device`: Device to get resource for.
21591 /// - `resource`: Output pointer to a [`CUdevResource`] structure.
21592 pub fn cuDeviceGetDevResource(
21593 device: CUdevice,
21594 resource: *mut CUdevResource,
21595 type_: CUdevResourceType,
21596 ) -> CUresult;
21597}
21598unsafe extern "C" {
21599 /// Get context resources.
21600 ///
21601 /// Get the type resources available to the context represented by hCtx
21602 /// Note: The API is not supported on 32-bit platforms.
21603 ///
21604 /// **See also:**
21605 ///
21606 /// [`cuDevResourceGenerateDesc`].
21607 ///
21608 /// # Parameters
21609 ///
21610 /// - `hCtx`: Context to get resource for.
21611 /// - `resource`: Output pointer to a [`CUdevResource`] structure.
21612 pub fn cuCtxGetDevResource(
21613 hCtx: CUcontext,
21614 resource: *mut CUdevResource,
21615 type_: CUdevResourceType,
21616 ) -> CUresult;
21617}
21618unsafe extern "C" {
21619 /// Get green context resources.
21620 ///
21621 /// Get the type resources available to the green context represented by hCtx
21622 ///
21623 /// **See also:**
21624 ///
21625 /// [`cuDevResourceGenerateDesc`].
21626 ///
21627 /// # Parameters
21628 ///
21629 /// - `hCtx`: Green context to get resource for.
21630 /// - `resource`: Output pointer to a [`CUdevResource`] structure.
21631 pub fn cuGreenCtxGetDevResource(
21632 hCtx: CUgreenCtx,
21633 resource: *mut CUdevResource,
21634 type_: CUdevResourceType,
21635 ) -> CUresult;
21636}
21637unsafe extern "C" {
21638 /// Splits [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_SM`] resources.
21639 ///
21640 /// Splits [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_SM`] resources into nbGroups, adhering to the minimum SM count specified in minCount and the usage flags in flags. If result is NULL, the API simulates a split and provides the amount of groups that would be created in nbGroups. Otherwise, nbGroups must point to the amount of elements in result and on return, the API will overwrite nbGroups with the amount actually created. The groups are written to the array in result. nbGroups can be less than the total amount if a smaller number of groups is needed.
21641 ///
21642 /// This API is used to spatially partition the input resource. The input resource needs to come from one of [`cuDeviceGetDevResource`], [`cuCtxGetDevResource`], or [`cuGreenCtxGetDevResource`]. A limitation of the API is that the output results cannot be split again without first creating a descriptor and a green
21643 /// context with that descriptor.
21644 ///
21645 /// When creating the groups, the API will take into account the performance and functional characteristics of the input resource,
21646 /// and guarantee a split that will create a disjoint set of symmetrical partitions. This may lead to fewer groups created than
21647 /// purely dividing the total SM count by the minCount due to cluster requirements or alignment and granularity requirements for the minCount. These requirements can be queried
21648 /// with [`cuDeviceGetDevResource`], [`cuCtxGetDevResource`], and [`cuGreenCtxGetDevResource`] for CU_DEV_RESOURCE_TYPE_SM, using the minSmPartitionSize and smCoscheduledAlignment fields to determine minimum partition size and alignment granularity, respectively.
21649 ///
21650 /// The remainder set does not have the same functional or performance guarantees as the groups in result. Its use should be carefully planned and future partitions of the remainder set are discouraged.
21651 ///
21652 /// The following flags are supported:
21653 ///
21654 /// * CU_DEV_SM_RESOURCE_SPLIT_IGNORE_SM_COSCHEDULING : Lower the minimum SM count and alignment, and treat each SM independent of its hierarchy. This allows more fine grained
21655 /// partitions but at the cost of advanced features (such as large clusters on compute capability 9.0+).
21656 /// * CU_DEV_SM_RESOURCE_SPLIT_MAX_POTENTIAL_CLUSTER_SIZE : Compute Capability 9.0+ only. Attempt to create groups that may allow for maximally sized thread clusters. This can be
21657 /// queried post green context creation using [`cuOccupancyMaxPotentialClusterSize`] and launch configuration (config), return the maximum cluster size in *clusterSize.").
21658 ///
21659 /// A successful API call must either have:
21660 ///
21661 /// * A valid array of result pointers of size passed in nbGroups, with input of type [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_SM`]. Value of minCount must be between 0 and the SM count specified in input. remainder may be NULL.
21662 /// * NULL passed in for result, with a valid integer pointer in nbGroups and input of type [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_SM`]. Value of minCount must be between 0 and the SM count specified in input. remainder may be NULL. This queries the number of groups that would be created by the API.
21663 ///
21664 /// Note: The API is not supported on 32-bit platforms.
21665 ///
21666 /// **See also:**
21667 ///
21668 /// [`cuGreenCtxGetDevResource`], [`cuCtxGetDevResource`], [`cuDeviceGetDevResource`].
21669 ///
21670 /// # Parameters
21671 ///
21672 /// - `result`: Output array of [`CUdevResource`] resources. Can be NULL to query the number of groups.
21673 /// - `nbGroups`: This is a pointer, specifying the number of groups that would be or should be created as described below.
21674 /// - `input`: Input SM resource to be split. Must be a valid [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_SM`] resource.
21675 /// - `remainder`: If the input resource cannot be cleanly split among nbGroups, the remainder is placed in here. Can be ommitted (NULL) if the user does not need the remaining set.
21676 /// - `flags`: Flags specifying how these partitions are used or which constraints to abide by when splitting the input. Zero is valid
21677 /// for default behavior.
21678 /// - `minCount`: Minimum number of SMs required.
21679 pub fn cuDevSmResourceSplitByCount(
21680 result: *mut CUdevResource,
21681 nbGroups: *mut ::core::ffi::c_uint,
21682 input: *const CUdevResource,
21683 remainder: *mut CUdevResource,
21684 flags: ::core::ffi::c_uint,
21685 minCount: ::core::ffi::c_uint,
21686 ) -> CUresult;
21687}
21688unsafe extern "C" {
21689 /// Splits a [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_SM`] resource into structured groups.
21690 ///
21691 /// This API will split a resource of CU_DEV_RESOURCE_TYPE_SM into nbGroups structured device resource groups (the result array), as well as an optional remainder, according to a set of requirements specified in the groupParams array. The term “structured” is a trait that specifies the result has SMs that are co-scheduled together. This co-scheduling can be specified via the coscheduledSmCount field of the groupParams structure, while the smCount will specify how many SMs are required in total for that result. The remainder is always “unstructured”, it does not have
21692 /// any set guarantees with respect to co-scheduling and those properties will need to either be queried via the occupancy set
21693 /// of APIs or further split into structured groups by this API.
21694 ///
21695 /// The API has a discovery mode for use cases where it is difficult to know ahead of time what the SM count should be. Discovery
21696 /// happens when the smCount field of a given groupParams array entry is set to 0 - the smCount will be filled in by the API with the derived SM count according to the provided groupParams fields and constraints. Discovery can be used with both a valid result array and with a NULL result pointer value. The latter is useful in situations where the smCount will end up being zero, which is an invalid value to
21697 /// create a result entry with, but allowed for discovery purposes when the result is NULL.
21698 ///
21699 /// The groupParams array is evaluated from index 0 to nbGroups - 1. For each index in the groupParams array, the API will evaluate which SMs may be a good fit based on constraints and assign those SMs to result. This evaluation order is important to consider when using discovery mode, as it helps discover the remaining SMs.
21700 ///
21701 /// For a valid call:
21702 ///
21703 /// * result should point to a [`CUdevResource`] array of size nbGroups, or alternatively, may be NULL, if the developer wishes for only the groupParams entries to be updated
21704 ///
21705 /// * input should be a valid CU_DEV_RESOURCE_TYPE_SM resource that originates from querying the green context, device context, or device.
21706 ///
21707 /// * The remainder group may be NULL.
21708 ///
21709 /// * There are no API flags at this time, so the value passed in should be 0.
21710 ///
21711 /// * A [`CU_DEV_SM_RESOURCE_GROUP_PARAMS`] array of size nbGroups. Each entry must be zero-initialized.
21712 /// + smCount: must be either 0 or in the range of \[2,inputSmCount\] where inputSmCount is the amount of SMs the input resource has. smCount must be a multiple of 2, as well as a multiple of coscheduledSmCount. When assigning SMs to a group (and if results are expected by having the result parameter set), smCount cannot end up with 0 or a value less than coscheduledSmCount otherwise [`CUresult::CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION`] will be returned.
21713 /// + coscheduledSmCount: allows grouping SMs together in order to be able to launch clusters on Compute Architecture 9.0+. The default value may be
21714 /// queried from the device’s CU_DEV_RESOURCE_TYPE_SM resource (8 on Compute Architecture 9.0+ and 2 otherwise). The maximum is 32 on Compute Architecture 9.0+ and 2 otherwise.
21715 /// + preferredCoscheduledSmCount: Attempts to merge coscheduledSmCount groups into larger groups, in order to make use of preferredClusterDimensions on Compute Architecture 10.0+. The default value is set to coscheduledSmCount.
21716 /// + flags:
21717 /// - [`CUdevSmResourceGroup_flags::CU_DEV_SM_RESOURCE_GROUP_BACKFILL`]: lets smCount be a non-multiple of coscheduledSmCount, filling the difference between SM count and already assigned co-scheduled groupings with other SMs. This lets any resulting
21718 /// group behave similar to the remainder group for example.
21719 ///
21720 /// **Example params and their effect:**
21721 ///
21722 /// A groupParams array element is defined in the following order:
21723 ///
21724 /// ```text
21725 /// { .smCount, .coscheduledSmCount, .preferredCoscheduledSmCount, .flags, \/\* .reserved \*\/ }
21726 /// ```
21727 ///
21728 /// ```text
21729 /// // Example 1
21730 /// // Will discover how many SMs there are, that are co-scheduled in groups of smCoscheduledAlignment.
21731 /// // The rest is placed in the optional remainder.
21732 /// CU_DEV_SM_RESOURCE_GROUP_PARAMS params { 0, 0, 0, 0 };
21733 /// ```
21734 ///
21735 /// ```text
21736 /// // Example 2
21737 /// // Assuming the device has 10+ SMs, the result will have 10 SMs that are co-scheduled in groups of 2 SMs.
21738 /// // The rest is placed in the optional remainder.
21739 /// CU_DEV_SM_RESOURCE_GROUP_PARAMS params { 10, 2, 0, 0 };
21740 /// // Setting the coscheduledSmCount to 2 guarantees that we can always have a valid result
21741 /// // as long as the SM count is less than or equal to the input resource SM count.
21742 /// ```
21743 ///
21744 /// ```text
21745 /// // Example 3
21746 /// // A single piece is split-off, but instead of assigning the rest to the remainder, a second group contains everything else
21747 /// // This assumes the device has 10+ SMs (8 of which are coscheduled in groups of 4),
21748 /// // otherwise the second group could end up with 0 SMs, which is not allowed.
21749 /// CU_DEV_SM_RESOURCE_GROUP_PARAMS params { {8, 4, 0, 0}, {0, 2, 0, CU_DEV_SM_RESOURCE_GROUP_BACKFILL } }
21750 /// ```
21751 ///
21752 /// The difference between a catch-all param group as the last entry and the remainder is in two aspects:
21753 ///
21754 /// * The remainder may be NULL / _TYPE_INVALID (if there are no SMs remaining), while a result group must always be valid.
21755 /// * The remainder does not have a structure, while the result group will always need to adhere to a structure of coscheduledSmCount
21756 /// (even if its just 2), and therefore must always have enough coscheduled SMs to cover that requirement (even with the [`CUdevSmResourceGroup_flags::CU_DEV_SM_RESOURCE_GROUP_BACKFILL`] flag enabled).
21757 ///
21758 /// Splitting an input into N groups, can be accomplished by repeatedly splitting off 1 group and re-splitting the remainder (a
21759 /// bisect operation). However, it's recommended to accomplish this with a single call wherever possible.
21760 ///
21761 /// **See also:**
21762 ///
21763 /// [`cuGreenCtxGetDevResource`], [`cuCtxGetDevResource`], [`cuDeviceGetDevResource`].
21764 ///
21765 /// # Parameters
21766 ///
21767 /// - `result`: Output array of [`CUdevResource`] resources. Can be NULL, alongside an smCount of 0, for discovery purpose.
21768 /// - `nbGroups`: Specifies the number of groups in result and groupParams.
21769 /// - `input`: Input SM resource to be split. Must be a valid [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_SM`] resource.
21770 /// - `remainder`: If splitting the input resource leaves any SMs, the remainder is placed in here.
21771 /// - `flags`: Flags specifying how the API should behave. The value should be 0 for now.
21772 /// - `groupParams`: Description of how the SMs should be split and assigned to the corresponding result entry.
21773 pub fn cuDevSmResourceSplit(
21774 result: *mut CUdevResource,
21775 nbGroups: ::core::ffi::c_uint,
21776 input: *const CUdevResource,
21777 remainder: *mut CUdevResource,
21778 flags: ::core::ffi::c_uint,
21779 groupParams: *mut CU_DEV_SM_RESOURCE_GROUP_PARAMS,
21780 ) -> CUresult;
21781}
21782unsafe extern "C" {
21783 /// Generate a resource descriptor.
21784 ///
21785 /// Generates a single resource descriptor with the set of resources specified in resources. The generated resource descriptor is necessary for the creation of green contexts via the [`cuGreenCtxCreate`] API. Resources of the same type can be passed in, provided they meet the requirements as noted below.
21786 ///
21787 /// A successful API call must have:
21788 ///
21789 /// * A valid output pointer for the phDesc descriptor as well as a valid array of resources pointers, with the array size passed in nbResources. If multiple resources are provided in resources, the device they came from must be the same, otherwise [`CUresult::CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION`] is returned. If multiple
21790 /// resources are provided in resources and they are of type CU_DEV_RESOURCE_TYPE_SM, they must be outputs (whether result or remaining) from the same split API instance and have the same smCoscheduledAlignment values, otherwise [`CUresult::CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION`]
21791 /// is returned.
21792 ///
21793 /// Note: The API is not supported on 32-bit platforms.
21794 ///
21795 /// **See also:**
21796 ///
21797 /// [`cuDevSmResourceSplitByCount`].
21798 ///
21799 /// # Parameters
21800 ///
21801 /// - `phDesc`: Output descriptor.
21802 /// - `resources`: Array of resources to be included in the descriptor.
21803 /// - `nbResources`: Number of resources passed in resources.
21804 pub fn cuDevResourceGenerateDesc(
21805 phDesc: *mut CUdevResourceDesc,
21806 resources: *mut CUdevResource,
21807 nbResources: ::core::ffi::c_uint,
21808 ) -> CUresult;
21809}
21810unsafe extern "C" {
21811 /// Records an event.
21812 ///
21813 /// Captures in hEvent all the activities of the green context of hCtx at the time of this call. hEvent and hCtx must be from the same primary context otherwise [`cudaError_enum::CUDA_ERROR_INVALID_HANDLE`] is returned. Calls such as [`cuEventQuery`] or [`cuGreenCtxWaitEvent`] will then examine or wait for completion of the work that was captured. Uses of hCtx after this call do not modify hEvent.
21814 ///
21815 /// Note:
21816 ///
21817 /// The API will return [`cudaError_enum::CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED`] if the specified green context hCtx has a stream in the capture mode. In such a case, the call will invalidate all the conflicting captures.
21818 ///
21819 /// **See also:**
21820 ///
21821 /// [`cuGreenCtxWaitEvent`], [`cuEventRecord`], [`cuCtxRecordEvent`], [`cuCtxWaitEvent`].
21822 ///
21823 /// # Parameters
21824 ///
21825 /// - `hCtx`: Green context to record event for.
21826 /// - `hEvent`: Event to record.
21827 pub fn cuGreenCtxRecordEvent(hCtx: CUgreenCtx, hEvent: CUevent) -> CUresult;
21828}
21829unsafe extern "C" {
21830 /// Make a green context wait on an event.
21831 ///
21832 /// Makes all future work submitted to green context hCtx wait for all work captured in hEvent. The synchronization will be performed on the device and will not block the calling CPU thread. See [`cuGreenCtxRecordEvent`] or [`cuEventRecord`], for details on what is captured by an event.
21833 ///
21834 /// Note:
21835 ///
21836 /// * hEvent may be from a different context or device than hCtx.
21837 /// * The API will return [`cudaError_enum::CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED`] and invalidate the capture if the specified event hEvent is part of an ongoing capture sequence or if the specified green context hCtx has a stream in the capture mode.
21838 ///
21839 /// **See also:**
21840 ///
21841 /// [`cuGreenCtxRecordEvent`], [`cuStreamWaitEvent`], [`cuCtxRecordEvent`], [`cuCtxWaitEvent`].
21842 ///
21843 /// # Parameters
21844 ///
21845 /// - `hCtx`: Green context to wait.
21846 /// - `hEvent`: Event to wait on.
21847 pub fn cuGreenCtxWaitEvent(hCtx: CUgreenCtx, hEvent: CUevent) -> CUresult;
21848}
21849unsafe extern "C" {
21850 /// Query the green context associated with a stream.
21851 ///
21852 /// Returns the CUDA green context that the stream is associated with, or NULL if the stream is not associated with any green
21853 /// context.
21854 ///
21855 /// The stream handle hStream can refer to any of the following:
21856 ///
21857 /// * a stream created via any of the CUDA driver APIs such as [`cuStreamCreate`], [`cuStreamCreateWithPriority`] and [`cuGreenCtxStreamCreate`], or their runtime API equivalents such as [cudaStreamCreate](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1g6a3c4b819e6a994c26d0c4824a4c80da), [cudaStreamCreateWithFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1gb1e32aff9f59119e4d0a9858991c4ad3) and [cudaStreamCreateWithPriority](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1ge2be9e9858849bf62ba4a8b66d1c3540). If during stream creation the context that was active in the calling thread was obtained with cuCtxFromGreenCtx, that green
21858 /// context is returned in phCtx. Otherwise, \*phCtx is set to NULL instead.
21859 /// * special stream such as the NULL stream or `CU_STREAM_LEGACY`. In that case if context that is active in the calling thread was obtained with cuCtxFromGreenCtx, that green context is
21860 /// returned. Otherwise, \*phCtx is set to NULL instead.
21861 ///
21862 /// Passing an invalid handle will result in undefined behavior.
21863 ///
21864 /// Note:
21865 ///
21866 /// Note that this function may also return error codes from previous, asynchronous launches.
21867 ///
21868 /// **See also:**
21869 ///
21870 /// [`cuStreamDestroy_v2`], [`cuStreamCreate`], [`cuStreamCreateWithPriority`], [`cuStreamGetCtx`], [`cuGreenCtxStreamCreate`], [`cuStreamGetPriority`], [`cuStreamGetFlags`], [`cuStreamGetDevice`], [`cuStreamWaitEvent`], [`cuStreamQuery`], [`cuStreamSynchronize`], [`cuStreamAddCallback`], [cudaStreamCreate](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1g6a3c4b819e6a994c26d0c4824a4c80da), [cudaStreamCreateWithFlags](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1gb1e32aff9f59119e4d0a9858991c4ad3).
21871 ///
21872 /// # Parameters
21873 ///
21874 /// - `hStream`: Handle to the stream to be queried.
21875 /// - `phCtx`: Returned green context associated with the stream.
21876 pub fn cuStreamGetGreenCtx(hStream: CUstream, phCtx: *mut CUgreenCtx) -> CUresult;
21877}
21878unsafe extern "C" {
21879 /// Create a stream for use in the green context.
21880 ///
21881 /// Creates a stream for use in the specified green context greenCtx and returns a handle in phStream. The stream can be destroyed by calling [`cuStreamDestroy_v2`]. Note that the API ignores the context that is current to the calling thread and creates a stream in the specified green
21882 /// context greenCtx.
21883 ///
21884 /// The supported values for flags are:
21885 ///
21886 /// * [`CUstream_flags_enum::CU_STREAM_NON_BLOCKING`]: This must be specified. It indicates that work running in the created stream may run concurrently with work in the default
21887 /// stream, and that the created stream should perform no implicit synchronization with the default stream.
21888 ///
21889 /// Specifying priority affects the scheduling priority of work in the stream. Priorities provide a hint to preferentially run work with higher priority
21890 /// when possible, but do not preempt already-running work or provide any other functional guarantee on execution order. priority follows a convention where lower numbers represent higher priorities. '0' represents default priority. The range of meaningful
21891 /// numerical priorities can be queried using [`cuCtxGetStreamPriorityRange`]. If the specified priority is outside the numerical range returned by [`cuCtxGetStreamPriorityRange`], it will automatically be clamped to the lowest or the highest number in the range.
21892 ///
21893 /// Note:
21894 ///
21895 /// * Note that this function may also return error codes from previous, asynchronous launches.
21896 /// * In the current implementation, only compute kernels launched in priority streams are affected by the stream's priority. Stream
21897 /// priorities have no effect on host-to-device and device-to-host memory operations.
21898 ///
21899 /// **See also:**
21900 ///
21901 /// [`cuStreamDestroy_v2`], [`cuGreenCtxCreate`].
21902 ///
21903 /// # Parameters
21904 ///
21905 /// - `phStream`: Returned newly created stream.
21906 /// - `greenCtx`: Green context for which to create the stream for.
21907 /// - `flags`: Flags for stream creation. [`CUstream_flags::CU_STREAM_NON_BLOCKING`] must be specified.
21908 /// - `priority`: Stream priority. Lower numbers represent higher priorities. See [`cuCtxGetStreamPriorityRange`] for more information about meaningful stream priorities that can be passed.
21909 pub fn cuGreenCtxStreamCreate(
21910 phStream: *mut CUstream,
21911 greenCtx: CUgreenCtx,
21912 flags: ::core::ffi::c_uint,
21913 priority: ::core::ffi::c_int,
21914 ) -> CUresult;
21915}
21916unsafe extern "C" {
21917 /// Returns the unique Id associated with the green context supplied.
21918 ///
21919 /// Returns in greenCtxId the unique Id which is associated with a given green context. The Id is unique for the life of the program for this instance
21920 /// of CUDA. If green context is supplied as NULL and the current context is set to a green context, the Id of the current green
21921 /// context is returned.
21922 ///
21923 /// Note:
21924 ///
21925 /// Note that this function may also return error codes from previous, asynchronous launches.
21926 ///
21927 /// **See also:**
21928 ///
21929 /// [`cuGreenCtxCreate`], [`cuGreenCtxDestroy`], [`cuCtxGetId`].
21930 ///
21931 /// # Parameters
21932 ///
21933 /// - `greenCtx`: Green context for which to obtain the Id.
21934 /// - `greenCtxId`: Pointer to store the Id of the green context.
21935 pub fn cuGreenCtxGetId(
21936 greenCtx: CUgreenCtx,
21937 greenCtxId: *mut ::core::ffi::c_ulonglong,
21938 ) -> CUresult;
21939}
21940unsafe extern "C" {
21941 /// Get stream resources.
21942 ///
21943 /// Get the type resources available to the hStream and store them in resource.
21944 ///
21945 /// Note: The API will return [`cudaError_enum::CUDA_ERROR_INVALID_RESOURCE_TYPE`] is type is [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG`] or [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_WORKQUEUE`].
21946 ///
21947 /// Note:
21948 ///
21949 /// Note that this function may also return error codes from previous, asynchronous launches.
21950 ///
21951 /// **See also:**
21952 ///
21953 /// [`cuGreenCtxCreate`], [`cuGreenCtxStreamCreate`], [`cuStreamCreate`], [`cuDevSmResourceSplitByCount`], [`cuDevResourceGenerateDesc`], [cudaStreamGetDevResource](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__EXECUTION__CONTEXT.html#group__CUDART__EXECUTION__CONTEXT_1g55c60bf05fec3cf837d96520c91b8396).
21954 ///
21955 /// # Parameters
21956 ///
21957 /// - `hStream`: Stream to get resource for.
21958 /// - `resource`: Output pointer to a [`CUdevResource`] structure.
21959 pub fn cuStreamGetDevResource(
21960 hStream: CUstream,
21961 resource: *mut CUdevResource,
21962 type_: CUdevResourceType,
21963 ) -> CUresult;
21964}
21965#[repr(u32)]
21966#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
21967pub enum CUlogLevel_enum {
21968 CU_LOG_LEVEL_ERROR = 0,
21969 CU_LOG_LEVEL_WARNING = 1,
21970}
21971pub use self::CUlogLevel_enum as CUlogLevel;
21972#[repr(C)]
21973#[derive(Debug, Copy, Clone)]
21974pub struct CUlogsCallbackEntry_st {
21975 _unused: [u8; 0],
21976}
21977pub type CUlogsCallbackHandle = *mut CUlogsCallbackEntry_st;
21978pub type CUlogsCallback = ::core::option::Option<
21979 unsafe extern "C" fn(
21980 data: *mut ::core::ffi::c_void,
21981 logLevel: CUlogLevel,
21982 message: *mut ::core::ffi::c_char,
21983 length: size_t,
21984 ),
21985>;
21986pub type CUlogIterator = ::core::ffi::c_uint;
21987unsafe extern "C" {
21988 /// Register a callback function to receive error log messages.
21989 ///
21990 /// # Parameters
21991 ///
21992 /// - `callbackFunc`: The function to register as a callback.
21993 /// - `userData`: A generic pointer to user data. This is passed into the callback function.
21994 /// - `callback_out`: Optional location to store the callback handle after it is registered.
21995 pub fn cuLogsRegisterCallback(
21996 callbackFunc: CUlogsCallback,
21997 userData: *mut ::core::ffi::c_void,
21998 callback_out: *mut CUlogsCallbackHandle,
21999 ) -> CUresult;
22000}
22001unsafe extern "C" {
22002 /// Unregister a log message callback.
22003 ///
22004 /// # Parameters
22005 ///
22006 /// - `callback`: The callback instance to unregister from receiving log messages.
22007 pub fn cuLogsUnregisterCallback(callback: CUlogsCallbackHandle) -> CUresult;
22008}
22009unsafe extern "C" {
22010 /// Sets log iterator to point to the end of log buffer, where the next message would be written.
22011 ///
22012 /// # Parameters
22013 ///
22014 /// - `iterator_out`: Location to store an iterator to the current tail of the logs.
22015 /// - `flags`: Reserved for future use, must be 0.
22016 pub fn cuLogsCurrent(
22017 iterator_out: *mut CUlogIterator,
22018 flags: ::core::ffi::c_uint,
22019 ) -> CUresult;
22020}
22021unsafe extern "C" {
22022 /// Dump accumulated driver logs into a file.
22023 ///
22024 /// Logs generated by the driver are stored in an internal buffer and can be copied out using this API. This API dumps all driver
22025 /// logs starting from iterator into pathToFile provided.
22026 ///
22027 /// Note:
22028 ///
22029 /// * iterator is auto-advancing. Dumping logs will update the value of iterator to receive the next generated log.
22030 /// * The driver reserves limited memory for storing logs. The oldest logs may be overwritten and become unrecoverable. An indication
22031 /// will appear in the destination outupt if the logs have been truncated. Call dump after each failed API to mitigate this risk.
22032 ///
22033 /// # Parameters
22034 ///
22035 /// - `iterator`: Optional auto-advancing iterator specifying the starting log to read. NULL value dumps all logs.
22036 /// - `pathToFile`: Path to output file for dumping logs.
22037 /// - `flags`: Reserved for future use, must be 0.
22038 pub fn cuLogsDumpToFile(
22039 iterator: *mut CUlogIterator,
22040 pathToFile: *const ::core::ffi::c_char,
22041 flags: ::core::ffi::c_uint,
22042 ) -> CUresult;
22043}
22044unsafe extern "C" {
22045 /// Dump accumulated driver logs into a buffer.
22046 ///
22047 /// Logs generated by the driver are stored in an internal buffer and can be copied out using this API. This API dumps driver
22048 /// logs from iterator into buffer up to the size specified in \*size. The driver will always null terminate the buffer but there will not be a null character between log entries, only a newline
22049 /// \n. The driver will then return the actual number of bytes written in \*size, excluding the null terminator. If there are no messages to dump, \*size will be set to 0 and the function will return [`cudaError_enum::CUDA_SUCCESS`]. If the provided buffer is not large enough to hold any messages, \*size will be set to 0 and the function will return [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`].
22050 ///
22051 /// Note:
22052 ///
22053 /// * iterator is auto-advancing. Dumping logs will update the value of iterator to receive the next generated log.
22054 /// * The driver reserves limited memory for storing logs. The maximum size of the buffer is 25600 bytes. The oldest logs may be
22055 /// overwritten and become unrecoverable. An indication will appear in the destination outupt if the logs have been truncated.
22056 /// Call dump after each failed API to mitigate this risk.
22057 /// * If the provided value in \*size is not large enough to hold all buffered messages, a message will be added at the head of the buffer indicating this. The
22058 /// driver then computes the number of messages it is able to store in buffer and writes it out. The final message in buffer will always be the most recent log message as of when the API is called.
22059 ///
22060 /// # Parameters
22061 ///
22062 /// - `iterator`: Optional auto-advancing iterator specifying the starting log to read. NULL value dumps all logs.
22063 /// - `buffer`: Pointer to dump logs.
22064 /// - `size`: See description.
22065 /// - `flags`: Reserved for future use, must be 0.
22066 pub fn cuLogsDumpToMemory(
22067 iterator: *mut CUlogIterator,
22068 buffer: *mut ::core::ffi::c_char,
22069 size: *mut size_t,
22070 flags: ::core::ffi::c_uint,
22071 ) -> CUresult;
22072}
22073unsafe extern "C" {
22074 /// Returns the restore thread ID for a CUDA process.
22075 ///
22076 /// Returns in \*tid the thread ID of the CUDA restore thread for the process specified by pid.
22077 ///
22078 /// # Parameters
22079 ///
22080 /// - `pid`: The process ID of the CUDA process.
22081 /// - `tid`: Returned restore thread ID.
22082 pub fn cuCheckpointProcessGetRestoreThreadId(
22083 pid: ::core::ffi::c_int,
22084 tid: *mut ::core::ffi::c_int,
22085 ) -> CUresult;
22086}
22087unsafe extern "C" {
22088 /// Returns the process state of a CUDA process.
22089 ///
22090 /// Returns in \*state the current state of the CUDA process specified by pid.
22091 ///
22092 /// # Parameters
22093 ///
22094 /// - `pid`: The process ID of the CUDA process.
22095 /// - `state`: Returned CUDA process state.
22096 pub fn cuCheckpointProcessGetState(
22097 pid: ::core::ffi::c_int,
22098 state: *mut CUprocessState,
22099 ) -> CUresult;
22100}
22101unsafe extern "C" {
22102 /// Lock a running CUDA process.
22103 ///
22104 /// Lock the CUDA process specified by pid which will block further CUDA API calls. Process must be in the RUNNING state in order to lock.
22105 ///
22106 /// Upon successful return the process will be in the LOCKED state.
22107 ///
22108 /// If timeoutMs is specified and the timeout is reached the process will be left in the RUNNING state upon return.
22109 ///
22110 /// # Parameters
22111 ///
22112 /// - `pid`: The process ID of the CUDA process.
22113 /// - `args`: Optional lock operation arguments.
22114 pub fn cuCheckpointProcessLock(
22115 pid: ::core::ffi::c_int,
22116 args: *mut CUcheckpointLockArgs,
22117 ) -> CUresult;
22118}
22119unsafe extern "C" {
22120 /// Checkpoint a CUDA process's GPU memory contents.
22121 ///
22122 /// Checkpoints a CUDA process specified by pid that is in the LOCKED state. The GPU memory contents will be brought into host memory and all underlying references will
22123 /// be released. Process must be in the LOCKED state to checkpoint.
22124 ///
22125 /// Upon successful return the process will be in the CHECKPOINTED state.
22126 ///
22127 /// # Parameters
22128 ///
22129 /// - `pid`: The process ID of the CUDA process.
22130 /// - `args`: Optional checkpoint operation arguments.
22131 pub fn cuCheckpointProcessCheckpoint(
22132 pid: ::core::ffi::c_int,
22133 args: *mut CUcheckpointCheckpointArgs,
22134 ) -> CUresult;
22135}
22136unsafe extern "C" {
22137 /// Restore a CUDA process's GPU memory contents from its last checkpoint.
22138 ///
22139 /// Restores a CUDA process specified by pid from its last checkpoint. Process must be in the CHECKPOINTED state to restore.
22140 ///
22141 /// GPU UUID pairs can be specified in args to remap the process old GPUs onto new GPUs. The GPU to restore onto needs to have enough memory and be of the same chip
22142 /// type as the old GPU. If an array of GPU UUID pairs is specified, it must contain every checkpointed GPU.
22143 ///
22144 /// Upon successful return the process will be in the LOCKED state.
22145 ///
22146 /// CUDA process restore requires persistence mode to be enabled or [`cuInit`] has not been called, any function from the driver API will return [`CUresult::CUDA_ERROR_NOT_INITIALIZED`].") to have been called before execution.
22147 ///
22148 /// **See also:**
22149 ///
22150 /// [`cuInit`] has not been called, any function from the driver API will return [`CUresult::CUDA_ERROR_NOT_INITIALIZED`].")
22151 ///
22152 /// # Parameters
22153 ///
22154 /// - `pid`: The process ID of the CUDA process.
22155 /// - `args`: Optional restore operation arguments.
22156 pub fn cuCheckpointProcessRestore(
22157 pid: ::core::ffi::c_int,
22158 args: *mut CUcheckpointRestoreArgs,
22159 ) -> CUresult;
22160}
22161unsafe extern "C" {
22162 /// Unlock a CUDA process to allow CUDA API calls.
22163 ///
22164 /// Unlocks a process specified by pid allowing it to resume making CUDA API calls. Process must be in the LOCKED state.
22165 ///
22166 /// Upon successful return the process will be in the RUNNING state.
22167 ///
22168 /// # Parameters
22169 ///
22170 /// - `pid`: The process ID of the CUDA process.
22171 /// - `args`: Optional unlock operation arguments.
22172 pub fn cuCheckpointProcessUnlock(
22173 pid: ::core::ffi::c_int,
22174 args: *mut CUcheckpointUnlockArgs,
22175 ) -> CUresult;
22176}