/* automatically generated by rust-bindgen 0.72.1 */
/// CUDA API version number.
pub const CUDA_VERSION: u32 = 13040;
/// CUDA IPC handle size.
pub const CU_IPC_HANDLE_SIZE: u32 = 64;
/// Indicates that compute device class supports accelerated features.
pub const CU_COMPUTE_ACCELERATED_TARGET_BASE: u32 = 65536;
/// Indicates that compute device class supports family features.
pub const CU_COMPUTE_FAMILY_TARGET_BASE: u32 = 131072;
/// Conditional node handle flags.
///
/// Default value is applied when graph is launched.
pub const CU_GRAPH_COND_ASSIGN_DEFAULT: u32 = 1;
/// This port activates when the kernel has finished executing.
pub const CU_GRAPH_KERNEL_NODE_PORT_DEFAULT: u32 = 0;
/// This port activates when all blocks of the kernel have performed cudaTriggerProgrammaticLaunchCompletion() or have terminated.
///
/// It must be used with edge type [`CUgraphDependencyType_enum::CU_GRAPH_DEPENDENCY_TYPE_PROGRAMMATIC`]. See also [`CUlaunchAttributeID_enum::CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT`].
pub const CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC: u32 = 1;
/// This port activates when all blocks of the kernel have begun execution.
///
/// See also [`CUlaunchAttributeID_enum::CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT`].
pub const CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER: u32 = 2;
/// If set, host memory is portable between CUDA contexts.
///
/// Flag for [`cuMemHostAlloc`].
pub const CU_MEMHOSTALLOC_PORTABLE: u32 = 1;
/// If set, host memory is mapped into CUDA address space and cuMemHostGetDevicePointer() may be called on the host pointer.
///
/// Flag for [`cuMemHostAlloc`].
pub const CU_MEMHOSTALLOC_DEVICEMAP: u32 = 2;
/// If set, host memory is allocated as write-combined - fast to write, faster to DMA, slow to read except via SSE4 streaming load instruction (MOVNTDQA).
///
/// Flag for [`cuMemHostAlloc`].
pub const CU_MEMHOSTALLOC_WRITECOMBINED: u32 = 4;
/// If set, host memory is portable between CUDA contexts.
///
/// Flag for cuMemHostRegister().
pub const CU_MEMHOSTREGISTER_PORTABLE: u32 = 1;
/// If set, host memory is mapped into CUDA address space and cuMemHostGetDevicePointer() may be called on the host pointer.
///
/// Flag for cuMemHostRegister().
pub const CU_MEMHOSTREGISTER_DEVICEMAP: u32 = 2;
/// If set, the passed memory pointer is treated as pointing to some memory-mapped I/O space, e.g.
///
/// belonging to a third-party 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 to be physically contiguous. It may return [`cudaError_enum::CUDA_ERROR_NOT_PERMITTED`] if run as an unprivileged user, [`cudaError_enum::CUDA_ERROR_NOT_SUPPORTED`] on older Linux kernel versions. On all other platforms, it is not supported and [`cudaError_enum::CUDA_ERROR_NOT_SUPPORTED`] is returned. Flag for cuMemHostRegister().
pub const CU_MEMHOSTREGISTER_IOMEMORY: u32 = 4;
/// If set, the passed memory 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 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 to error with [`cudaError_enum::CUDA_ERROR_NOT_SUPPORTED`].
pub const CU_MEMHOSTREGISTER_READ_ONLY: u32 = 8;
/// Indicates that the layered sparse CUDA array or CUDA mipmapped array has a single mip tail region for all layers.
pub const CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL: u32 = 1;
/// Size of tensor map descriptor.
pub const CU_TENSOR_MAP_NUM_QWORDS: u32 = 16;
/// Indicates that the external memory object is a dedicated resource.
pub const CUDA_EXTERNAL_MEMORY_DEDICATED: u32 = 1;
/// When the `flags` parameter of CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS contains this flag, it indicates that signaling an external semaphore object should skip performing appropriate memory synchronization operations over all the external memory objects that are imported as [`CUexternalMemoryHandleType_enum::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.
pub const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC: u32 = 1;
/// When the `flags` parameter of CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS contains this flag, it indicates that waiting on an external semaphore object should skip performing appropriate memory synchronization operations over all the external memory objects that are imported as [`CUexternalMemoryHandleType_enum::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.
pub const CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC: u32 = 2;
/// When `flags` of [`cuDeviceGetNvSciSyncAttributes`] is set to this, it indicates that application needs signaler specific NvSciSyncAttr to be filled by [`cuDeviceGetNvSciSyncAttributes`].
pub const CUDA_NVSCISYNC_ATTR_SIGNAL: u32 = 1;
/// When `flags` of [`cuDeviceGetNvSciSyncAttributes`] is set to this, it indicates that application needs waiter specific NvSciSyncAttr to be filled by [`cuDeviceGetNvSciSyncAttributes`].
pub const CUDA_NVSCISYNC_ATTR_WAIT: u32 = 2;
/// This flag if set indicates that the memory will be used as a tile pool.
pub const CU_MEM_CREATE_USAGE_TILE_POOL: u32 = 1;
/// This flag, if set, indicates that the memory will be used as a buffer for hardware accelerated decompression.
pub const CU_MEM_CREATE_USAGE_HW_DECOMPRESS: u32 = 2;
/// Setting this flag forces GPUDirect RDMA on a locality-domain-localized allocation to use the PCIe (BAR1) path, allowing the allocation to remain locality-domain localized on platforms where the platform-coherent RDMA path does not support localized allocations.
///
/// Because on some platforms the PCIe bandwidth is limited, using this flag may result in lower RDMA bandwidth than the default RDMA mapping link. Note that this flag does not itself force PCIe to be used, and that this must be done when creating the RDMA export. [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_LOCALIZED_MEMORY_SUPPORTED`] indicates whether this flag is needed to create GPUDirect RDMA capable localized memory allocations. This flag is only valid if gpuDirectRDMACapable is set.
pub const CU_MEM_CREATE_USAGE_GPU_DIRECT_RDMA_OVER_PCIE: u32 = 4;
/// This flag, if set, indicates that the memory will be used as a buffer for hardware accelerated decompression.
pub const CU_MEM_POOL_CREATE_USAGE_HW_DECOMPRESS: u32 = 2;
/// 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.
pub const CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_PRE_LAUNCH_SYNC: u32 = 1;
/// 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.
pub const CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_POST_LAUNCH_SYNC: u32 = 2;
/// 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 specifies the number of layers, not the depth of a 3D array.
pub const CUDA_ARRAY3D_LAYERED: u32 = 1;
/// use [`CUDA_ARRAY3D_LAYERED`].
#[deprecated]
pub const CUDA_ARRAY3D_2DARRAY: u32 = 1;
/// This flag must be set in order to bind a surface reference to the CUDA array.
pub const CUDA_ARRAY3D_SURFACE_LDST: u32 = 2;
/// 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 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.
pub const CUDA_ARRAY3D_CUBEMAP: u32 = 4;
/// This flag must be set in order to perform texture gather operations on a CUDA array.
pub const CUDA_ARRAY3D_TEXTURE_GATHER: u32 = 8;
/// This flag if set indicates that the CUDA array is a DEPTH_TEXTURE.
pub const CUDA_ARRAY3D_DEPTH_TEXTURE: u32 = 16;
/// This flag indicates that the CUDA array may be bound as a color target in an external graphics API.
pub const CUDA_ARRAY3D_COLOR_ATTACHMENT: u32 = 32;
/// This flag if set indicates that the CUDA array or CUDA mipmapped array is a sparse CUDA array or CUDA mipmapped array respectively.
pub const CUDA_ARRAY3D_SPARSE: u32 = 64;
/// This flag if set indicates that the CUDA array or CUDA mipmapped array will allow deferred memory mapping.
pub const CUDA_ARRAY3D_DEFERRED_MAPPING: u32 = 128;
/// This flag indicates that the CUDA array will be used for hardware accelerated video encode/decode operations.
pub const CUDA_ARRAY3D_VIDEO_ENCODE_DECODE: u32 = 256;
/// Override the texref format with a format inferred from the array.
///
/// Flag for [`cuTexRefSetArray`].
pub const CU_TRSA_OVERRIDE_FORMAT: u32 = 1;
/// Read the texture as integers rather than promoting the values to floats in the range \[0,1\].
///
/// Flag for [`cuTexRefSetFlags`] and [`cuTexObjectCreate`].
pub const CU_TRSF_READ_AS_INTEGER: u32 = 1;
/// Use normalized texture coordinates in the range [0,1) instead of [0,dim).
///
/// Flag for [cuTexRefSetFlags()](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TEXREF__DEPRECATED.html#group__cuda__texref__deprecated_1ga554ffd896487533c36810f2e45bb7a28) and [`cuTexObjectCreate`].
pub const CU_TRSF_NORMALIZED_COORDINATES: u32 = 2;
/// Perform sRGB->linear conversion during texture read.
///
/// Flag for [`cuTexRefSetFlags`] and [`cuTexObjectCreate`].
pub const CU_TRSF_SRGB: u32 = 16;
/// Disable any trilinear filtering optimizations.
///
/// Flag for [`cuTexRefSetFlags`] and [`cuTexObjectCreate`].
pub const CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION: u32 = 32;
/// Enable seamless cube map filtering.
///
/// Flag for [`cuTexObjectCreate`].
pub const CU_TRSF_SEAMLESS_CUBEMAP: u32 = 64;
/// Launch with the required block dimension.
pub const CU_LAUNCH_KERNEL_REQUIRED_BLOCK_DIM: u32 = 1;
/// C++ compile time constant for CU_LAUNCH_PARAM_END.
pub const CU_LAUNCH_PARAM_END_AS_INT: u32 = 0;
/// C++ compile time constant for CU_LAUNCH_PARAM_BUFFER_POINTER.
pub const CU_LAUNCH_PARAM_BUFFER_POINTER_AS_INT: u32 = 1;
/// C++ compile time constant for CU_LAUNCH_PARAM_BUFFER_SIZE.
pub const CU_LAUNCH_PARAM_BUFFER_SIZE_AS_INT: u32 = 2;
/// For texture references loaded into the module, use default texunit from texture reference.
pub const CU_PARAM_TR_DEFAULT: i32 = -1;
/// Unsigned C `size_t`, used for byte counts and object sizes in the native ABI.
pub type size_t = ::core::ffi::c_ulong;
/// Unsigned 32-bit integer in the CUDA driver ABI.
pub type cuuint32_t = u32;
/// Unsigned 64-bit integer in the CUDA driver ABI.
pub type cuuint64_t = u64;
/// CUDA device pointer CUdeviceptr is defined as an unsigned integer type whose size matches the size of a pointer on the target platform.
pub type CUdeviceptr_v2 = ::core::ffi::c_ulonglong;
/// CUDA device pointer.
pub type CUdeviceptr = CUdeviceptr_v2;
/// CUDA device.
pub type CUdevice_v1 = ::core::ffi::c_int;
/// CUDA device.
pub type CUdevice = CUdevice_v1;
/// Incomplete native type used by [`CUcontext`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUctx_st {
_unused: [u8; 0],
}
/// A regular context handle.
pub type CUcontext = *mut CUctx_st;
/// Incomplete native type used by [`CUmodule`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUmod_st {
_unused: [u8; 0],
}
/// CUDA module.
pub type CUmodule = *mut CUmod_st;
/// Incomplete native type used by [`CUfunction`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUfunc_st {
_unused: [u8; 0],
}
/// CUDA function.
pub type CUfunction = *mut CUfunc_st;
/// Incomplete native type used by [`CUlibrary`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUlib_st {
_unused: [u8; 0],
}
/// CUDA library.
pub type CUlibrary = *mut CUlib_st;
/// Incomplete native type used by [`CUkernel`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUkern_st {
_unused: [u8; 0],
}
/// CUDA kernel.
pub type CUkernel = *mut CUkern_st;
/// Incomplete native type used by [`CUarray`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUarray_st {
_unused: [u8; 0],
}
/// CUDA array.
pub type CUarray = *mut CUarray_st;
/// Incomplete native type used by [`CUmipmappedArray`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUmipmappedArray_st {
_unused: [u8; 0],
}
/// CUDA mipmapped array.
pub type CUmipmappedArray = *mut CUmipmappedArray_st;
/// Incomplete native type used by [`CUtexref`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUtexref_st {
_unused: [u8; 0],
}
/// CUDA texture reference.
pub type CUtexref = *mut CUtexref_st;
/// Incomplete native type used by [`CUsurfref`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUsurfref_st {
_unused: [u8; 0],
}
/// CUDA surface reference.
pub type CUsurfref = *mut CUsurfref_st;
/// Incomplete CUDA event object. CUDA owns its native representation; use a CUDA event handle to access it.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUevent_st {
_unused: [u8; 0],
}
/// CUDA event.
pub type CUevent = *mut CUevent_st;
/// Incomplete CUDA driver stream type. Use a native stream handle; its layout is owned by the CUDA driver.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUstream_st {
_unused: [u8; 0],
}
/// CUDA stream.
pub type CUstream = *mut CUstream_st;
/// Incomplete native type used by [`CUgraphicsResource`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUgraphicsResource_st {
_unused: [u8; 0],
}
/// CUDA graphics interop resource.
pub type CUgraphicsResource = *mut CUgraphicsResource_st;
/// An opaque value that represents a CUDA texture object.
pub type CUtexObject_v1 = ::core::ffi::c_ulonglong;
/// An opaque value that represents a CUDA texture object.
pub type CUtexObject = CUtexObject_v1;
/// An opaque value that represents a CUDA surface object.
pub type CUsurfObject_v1 = ::core::ffi::c_ulonglong;
/// An opaque value that represents a CUDA surface object.
pub type CUsurfObject = CUsurfObject_v1;
/// Incomplete native type used by [`CUexternalMemory`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUextMemory_st {
_unused: [u8; 0],
}
/// CUDA external memory.
pub type CUexternalMemory = *mut CUextMemory_st;
/// Incomplete native type used by [`CUexternalSemaphore`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUextSemaphore_st {
_unused: [u8; 0],
}
/// CUDA external semaphore.
pub type CUexternalSemaphore = *mut CUextSemaphore_st;
/// Incomplete CUDA graph type. Graph creation and destruction are provided by the CUDA API.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUgraph_st {
_unused: [u8; 0],
}
/// CUDA graph.
pub type CUgraph = *mut CUgraph_st;
/// Incomplete native type used by [`CUgraphNode`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUgraphNode_st {
_unused: [u8; 0],
}
/// CUDA graph node.
pub type CUgraphNode = *mut CUgraphNode_st;
/// Incomplete native type used by [`CUgraphExec`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUgraphExec_st {
_unused: [u8; 0],
}
/// CUDA executable graph.
pub type CUgraphExec = *mut CUgraphExec_st;
/// Incomplete native type used by [`CUmemoryPool`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUmemPoolHandle_st {
_unused: [u8; 0],
}
/// CUDA memory pool.
pub type CUmemoryPool = *mut CUmemPoolHandle_st;
/// Incomplete native type used by [`CUuserObject`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUuserObject_st {
_unused: [u8; 0],
}
/// CUDA user object for graphs.
pub type CUuserObject = *mut CUuserObject_st;
/// CUDA graph conditional handle.
pub type CUgraphConditionalHandle = cuuint64_t;
/// Incomplete native type used by [`CUgraphDeviceNode`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUgraphDeviceUpdatableNode_st {
_unused: [u8; 0],
}
/// CUDA graph device node handle.
pub type CUgraphDeviceNode = *mut CUgraphDeviceUpdatableNode_st;
/// Incomplete native type used by [`CUasyncCallbackHandle`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUasyncCallbackEntry_st {
_unused: [u8; 0],
}
/// CUDA async notification callback handle.
pub type CUasyncCallbackHandle = *mut CUasyncCallbackEntry_st;
/// Incomplete native type used by [`CUgreenCtx`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUgreenCtx_st {
_unused: [u8; 0],
}
/// A green context handle. This handle can be used safely from only one CPU thread at a time. Created via [`cuGreenCtxCreate`].
pub type CUgreenCtx = *mut CUgreenCtx_st;
/// CUDA UUID stored as 16 bytes. The bytes are an identifier, not a null-terminated string.
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUuuid_st {
/// < CUDA definition of UUID.
pub bytes: [::core::ffi::c_char; 16usize],
}
/// CUDA UUID stored as 16 bytes. The bytes are an identifier, not a null-terminated string.
pub type CUuuid = CUuuid_st;
/// Fabric handle - An opaque handle representing a memory allocation that can be exported to processes in same or different nodes. For IPC between processes on different nodes they must be connected via the NVSwitch fabric.
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemFabricHandle_st {
/// Opaque fabric-handle bytes produced by CUDA and passed unchanged when importing the allocation.
pub data: [::core::ffi::c_uchar; 64usize],
}
impl Default for CUmemFabricHandle_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Fabric handle - An opaque handle representing a memory allocation that can be exported to processes in same or different nodes.
///
/// For IPC between processes on different nodes they must be connected via the NVSwitch fabric.
pub type CUmemFabricHandle_v1 = CUmemFabricHandle_st;
/// Fabric handle - An opaque handle representing a memory allocation that can be exported to processes in same or different nodes. For IPC between processes on different nodes they must be connected via the NVSwitch fabric.
pub type CUmemFabricHandle = CUmemFabricHandle_v1;
/// CUDA IPC event handle
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUipcEventHandle_st {
/// Opaque event-handle bytes produced by CUDA and passed unchanged when opening the handle in another process.
pub reserved: [::core::ffi::c_char; 64usize],
}
impl Default for CUipcEventHandle_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// CUDA IPC event handle.
pub type CUipcEventHandle_v1 = CUipcEventHandle_st;
/// CUDA IPC event handle
pub type CUipcEventHandle = CUipcEventHandle_v1;
/// CUDA IPC mem handle
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUipcMemHandle_st {
/// Opaque memory-handle bytes produced by CUDA and passed unchanged when opening the handle in another process.
pub reserved: [::core::ffi::c_char; 64usize],
}
impl Default for CUipcMemHandle_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// CUDA IPC mem handle.
pub type CUipcMemHandle_v1 = CUipcMemHandle_st;
/// CUDA IPC mem handle
pub type CUipcMemHandle = CUipcMemHandle_v1;
impl CUipcMem_flags_enum {
/// Automatically enable peer access between remote devices as needed.
pub const CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS: CUipcMem_flags_enum = CUipcMem_flags_enum(
1,
);
}
/// CUDA Ipc Mem Flags
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUipcMem_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUipcMem_flags_enum as CUipcMem_flags;
impl CUmemAttach_flags_enum {
/// Memory can be accessed by any stream on any device.
pub const CU_MEM_ATTACH_GLOBAL: CUmemAttach_flags_enum = CUmemAttach_flags_enum(1);
/// Memory cannot be accessed by any stream on any device.
pub const CU_MEM_ATTACH_HOST: CUmemAttach_flags_enum = CUmemAttach_flags_enum(2);
/// Memory can only be accessed by a single stream on the associated device.
pub const CU_MEM_ATTACH_SINGLE: CUmemAttach_flags_enum = CUmemAttach_flags_enum(4);
}
/// CUDA Mem Attach Flags
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemAttach_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUmemAttach_flags_enum as CUmemAttach_flags;
impl CUctx_flags_enum {
/// Automatic scheduling.
pub const CU_CTX_SCHED_AUTO: CUctx_flags_enum = CUctx_flags_enum(0);
/// Set spin as default scheduling.
pub const CU_CTX_SCHED_SPIN: CUctx_flags_enum = CUctx_flags_enum(1);
/// Set yield as default scheduling.
pub const CU_CTX_SCHED_YIELD: CUctx_flags_enum = CUctx_flags_enum(2);
/// Set blocking synchronization as default scheduling.
pub const CU_CTX_SCHED_BLOCKING_SYNC: CUctx_flags_enum = CUctx_flags_enum(4);
/// Set blocking synchronization as default scheduling.
pub const CU_CTX_BLOCKING_SYNC: CUctx_flags_enum = CUctx_flags_enum(4);
/// Mask of the context scheduling-policy bits.
pub const CU_CTX_SCHED_MASK: CUctx_flags_enum = CUctx_flags_enum(7);
/// Deprecated: This flag was deprecated as of CUDA 11.0 and it no longer has any effect. All contexts as of CUDA 3.2 behave as though the flag is enabled.
pub const CU_CTX_MAP_HOST: CUctx_flags_enum = CUctx_flags_enum(8);
/// Keep local memory allocation after launch.
pub const CU_CTX_LMEM_RESIZE_TO_MAX: CUctx_flags_enum = CUctx_flags_enum(16);
/// Trigger coredumps from exceptions in this context.
pub const CU_CTX_COREDUMP_ENABLE: CUctx_flags_enum = CUctx_flags_enum(32);
/// Enable user pipe to trigger coredumps in this context.
pub const CU_CTX_USER_COREDUMP_ENABLE: CUctx_flags_enum = CUctx_flags_enum(64);
/// Ensure synchronous memory operations on this context will synchronize.
pub const CU_CTX_SYNC_MEMOPS: CUctx_flags_enum = CUctx_flags_enum(128);
/// Mask of the context flag bits defined by this ABI.
pub const CU_CTX_FLAGS_MASK: CUctx_flags_enum = CUctx_flags_enum(255);
}
/// Context creation flags
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUctx_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUctx_flags_enum as CUctx_flags;
impl CUevent_sched_flags_enum {
/// Automatic scheduling.
pub const CU_EVENT_SCHED_AUTO: CUevent_sched_flags_enum = CUevent_sched_flags_enum(
0,
);
/// Set spin as default scheduling.
pub const CU_EVENT_SCHED_SPIN: CUevent_sched_flags_enum = CUevent_sched_flags_enum(
1,
);
/// Set yield as default scheduling.
pub const CU_EVENT_SCHED_YIELD: CUevent_sched_flags_enum = CUevent_sched_flags_enum(
2,
);
/// Set blocking synchronization as default scheduling.
pub const CU_EVENT_SCHED_BLOCKING_SYNC: CUevent_sched_flags_enum = CUevent_sched_flags_enum(
4,
);
}
/// Event sched flags
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUevent_sched_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUevent_sched_flags_enum as CUevent_sched_flags;
impl CUhostTaskSyncMode_enum {
/// The execution thread will block until new host tasks are ready to run.
pub const CU_HOST_TASK_BLOCKING: CUhostTaskSyncMode_enum = CUhostTaskSyncMode_enum(
0,
);
/// The execution thread will spin wait until new host tasks are ready to run.
pub const CU_HOST_TASK_SPINWAIT: CUhostTaskSyncMode_enum = CUhostTaskSyncMode_enum(
1,
);
}
/// Host task synchronization mode
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUhostTaskSyncMode_enum(pub ::core::ffi::c_uint);
pub use self::CUhostTaskSyncMode_enum as CUhostTaskSyncMode;
impl CUstream_flags_enum {
/// Default stream flag.
pub const CU_STREAM_DEFAULT: CUstream_flags_enum = CUstream_flags_enum(0);
/// Stream does not synchronize with stream 0 (the NULL stream).
pub const CU_STREAM_NON_BLOCKING: CUstream_flags_enum = CUstream_flags_enum(1);
}
/// Stream creation flags
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUstream_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUstream_flags_enum as CUstream_flags;
impl CUevent_flags_enum {
/// Default event flag.
pub const CU_EVENT_DEFAULT: CUevent_flags_enum = CUevent_flags_enum(0);
/// Event uses blocking synchronization.
pub const CU_EVENT_BLOCKING_SYNC: CUevent_flags_enum = CUevent_flags_enum(1);
/// Event will not record timing data.
pub const CU_EVENT_DISABLE_TIMING: CUevent_flags_enum = CUevent_flags_enum(2);
/// Event is suitable for interprocess use.
///
/// [`CUevent_flags::CU_EVENT_DISABLE_TIMING`] must be set.
pub const CU_EVENT_INTERPROCESS: CUevent_flags_enum = CUevent_flags_enum(4);
}
/// Event creation flags
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUevent_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUevent_flags_enum as CUevent_flags;
impl CUevent_record_flags_enum {
/// Default event record flag.
pub const CU_EVENT_RECORD_DEFAULT: CUevent_record_flags_enum = CUevent_record_flags_enum(
0,
);
/// When using stream capture, create an event record node instead of the default behavior.
///
/// This flag is invalid when used outside of capture.
pub const CU_EVENT_RECORD_EXTERNAL: CUevent_record_flags_enum = CUevent_record_flags_enum(
1,
);
}
/// Event record flags
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUevent_record_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUevent_record_flags_enum as CUevent_record_flags;
impl CUevent_wait_flags_enum {
/// Default event wait flag.
pub const CU_EVENT_WAIT_DEFAULT: CUevent_wait_flags_enum = CUevent_wait_flags_enum(
0,
);
/// When using stream capture, create an event wait node instead of the default behavior.
///
/// This flag is invalid when used outside of capture.
pub const CU_EVENT_WAIT_EXTERNAL: CUevent_wait_flags_enum = CUevent_wait_flags_enum(
1,
);
}
/// Event wait flags
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUevent_wait_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUevent_wait_flags_enum as CUevent_wait_flags;
impl CUatomicOperation_enum {
/// Atomic integer addition.
pub const CU_ATOMIC_OPERATION_INTEGER_ADD: CUatomicOperation_enum = CUatomicOperation_enum(
0,
);
/// Atomic integer minimum.
pub const CU_ATOMIC_OPERATION_INTEGER_MIN: CUatomicOperation_enum = CUatomicOperation_enum(
1,
);
/// Atomic integer maximum.
pub const CU_ATOMIC_OPERATION_INTEGER_MAX: CUatomicOperation_enum = CUatomicOperation_enum(
2,
);
/// Atomic integer increment.
pub const CU_ATOMIC_OPERATION_INTEGER_INCREMENT: CUatomicOperation_enum = CUatomicOperation_enum(
3,
);
/// Atomic integer decrement.
pub const CU_ATOMIC_OPERATION_INTEGER_DECREMENT: CUatomicOperation_enum = CUatomicOperation_enum(
4,
);
/// Atomic bitwise AND.
pub const CU_ATOMIC_OPERATION_AND: CUatomicOperation_enum = CUatomicOperation_enum(
5,
);
/// Atomic bitwise OR.
pub const CU_ATOMIC_OPERATION_OR: CUatomicOperation_enum = CUatomicOperation_enum(6);
/// Atomic bitwise exclusive OR.
pub const CU_ATOMIC_OPERATION_XOR: CUatomicOperation_enum = CUatomicOperation_enum(
7,
);
/// Atomic exchange of the stored value.
pub const CU_ATOMIC_OPERATION_EXCHANGE: CUatomicOperation_enum = CUatomicOperation_enum(
8,
);
/// Atomic compare-and-swap.
pub const CU_ATOMIC_OPERATION_CAS: CUatomicOperation_enum = CUatomicOperation_enum(
9,
);
/// Atomic floating-point addition.
pub const CU_ATOMIC_OPERATION_FLOAT_ADD: CUatomicOperation_enum = CUatomicOperation_enum(
10,
);
/// Atomic floating-point minimum.
pub const CU_ATOMIC_OPERATION_FLOAT_MIN: CUatomicOperation_enum = CUatomicOperation_enum(
11,
);
/// Atomic floating-point maximum.
pub const CU_ATOMIC_OPERATION_FLOAT_MAX: CUatomicOperation_enum = CUatomicOperation_enum(
12,
);
/// End marker for the native atomic-operation identifiers.
pub const CU_ATOMIC_OPERATION_MAX: CUatomicOperation_enum = CUatomicOperation_enum(
13,
);
}
/// CUDA-valid Atomic Operations
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUatomicOperation_enum(pub ::core::ffi::c_uint);
pub use self::CUatomicOperation_enum as CUatomicOperation;
impl CUatomicOperationCapability_enum {
/// Supports signed integer operands.
pub const CU_ATOMIC_CAPABILITY_SIGNED: CUatomicOperationCapability_enum = CUatomicOperationCapability_enum(
1,
);
/// Supports unsigned integer operands.
pub const CU_ATOMIC_CAPABILITY_UNSIGNED: CUatomicOperationCapability_enum = CUatomicOperationCapability_enum(
2,
);
/// Supports reduction operations.
pub const CU_ATOMIC_CAPABILITY_REDUCTION: CUatomicOperationCapability_enum = CUatomicOperationCapability_enum(
4,
);
/// Supports 32-bit scalar operands.
pub const CU_ATOMIC_CAPABILITY_SCALAR_32: CUatomicOperationCapability_enum = CUatomicOperationCapability_enum(
8,
);
/// Supports 64-bit scalar operands.
pub const CU_ATOMIC_CAPABILITY_SCALAR_64: CUatomicOperationCapability_enum = CUatomicOperationCapability_enum(
16,
);
/// Supports 128-bit scalar operands.
pub const CU_ATOMIC_CAPABILITY_SCALAR_128: CUatomicOperationCapability_enum = CUatomicOperationCapability_enum(
32,
);
/// Supports vectors of four 32-bit components.
pub const CU_ATOMIC_CAPABILITY_VECTOR_32x4: CUatomicOperationCapability_enum = CUatomicOperationCapability_enum(
64,
);
}
/// CUDA-valid Atomic Operation capabilities
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUatomicOperationCapability_enum(pub ::core::ffi::c_uint);
pub use self::CUatomicOperationCapability_enum as CUatomicOperationCapability;
impl CUstreamWaitValue_flags_enum {
/// Wait until (int32_t)(\*addr - value) >= 0 (or int64_t for 64 bit values).
///
/// Note this is a cyclic comparison which ignores wraparound. (Default behavior.)
pub const CU_STREAM_WAIT_VALUE_GEQ: CUstreamWaitValue_flags_enum = CUstreamWaitValue_flags_enum(
0,
);
/// Wait until \*addr == value.
pub const CU_STREAM_WAIT_VALUE_EQ: CUstreamWaitValue_flags_enum = CUstreamWaitValue_flags_enum(
1,
);
/// Wait until (\*addr & value) != 0.
pub const CU_STREAM_WAIT_VALUE_AND: CUstreamWaitValue_flags_enum = CUstreamWaitValue_flags_enum(
2,
);
/// Wait until ~(\*addr | value) != 0.
///
/// Support for this operation can be queried with [`cuDeviceGetAttribute`] and [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR`].
pub const CU_STREAM_WAIT_VALUE_NOR: CUstreamWaitValue_flags_enum = CUstreamWaitValue_flags_enum(
3,
);
/// Follow the wait operation with a flush of outstanding remote writes.
///
/// This means that, if a remote write operation is guaranteed to have reached the device before the wait can be satisfied, that write is guaranteed to be visible to downstream device work. The device is permitted to reorder remote writes internally. For example, this flag would be required if two remote writes arrive in a defined order, the wait is satisfied by the second write, and downstream work needs to observe the first write. Support for this operation is restricted to selected platforms and can be queried with [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES`].
pub const CU_STREAM_WAIT_VALUE_FLUSH: CUstreamWaitValue_flags_enum = CUstreamWaitValue_flags_enum(
1073741824,
);
}
/// Flags for ::cuStreamWaitValue32 and ::cuStreamWaitValue64
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUstreamWaitValue_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUstreamWaitValue_flags_enum as CUstreamWaitValue_flags;
impl CUstreamWriteValue_flags_enum {
/// Default behavior.
pub const CU_STREAM_WRITE_VALUE_DEFAULT: CUstreamWriteValue_flags_enum = CUstreamWriteValue_flags_enum(
0,
);
/// Permits the write to be reordered with writes which were issued before it, as a performance optimization.
///
/// Normally, cuStreamWriteValue32 will provide a memory fence before the write, which has similar semantics to __threadfence_system() but is scoped to the stream rather than a CUDA thread. This flag is not supported in the v2 API.
pub const CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER: CUstreamWriteValue_flags_enum = CUstreamWriteValue_flags_enum(
1,
);
}
/// Flags for ::cuStreamWriteValue32
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUstreamWriteValue_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUstreamWriteValue_flags_enum as CUstreamWriteValue_flags;
impl CUstreamBatchMemOpType_enum {
/// Represents a cuStreamWaitValue32 operation.
pub const CU_STREAM_MEM_OP_WAIT_VALUE_32: CUstreamBatchMemOpType_enum = CUstreamBatchMemOpType_enum(
1,
);
/// Represents a cuStreamWriteValue32 operation.
pub const CU_STREAM_MEM_OP_WRITE_VALUE_32: CUstreamBatchMemOpType_enum = CUstreamBatchMemOpType_enum(
2,
);
/// Represents a cuStreamWaitValue64 operation.
pub const CU_STREAM_MEM_OP_WAIT_VALUE_64: CUstreamBatchMemOpType_enum = CUstreamBatchMemOpType_enum(
4,
);
/// Represents a cuStreamWriteValue64 operation.
pub const CU_STREAM_MEM_OP_WRITE_VALUE_64: CUstreamBatchMemOpType_enum = CUstreamBatchMemOpType_enum(
5,
);
/// Insert a memory barrier of the specified type.
pub const CU_STREAM_MEM_OP_BARRIER: CUstreamBatchMemOpType_enum = CUstreamBatchMemOpType_enum(
6,
);
/// Perform a atomic reduction.
///
/// See CUstreamBatchMemOpParams::atomicReduction.
pub const CU_STREAM_MEM_OP_ATOMIC_REDUCTION: CUstreamBatchMemOpType_enum = CUstreamBatchMemOpType_enum(
8,
);
/// This has the same effect as [`CUstreamWaitValue_flags_enum::CU_STREAM_WAIT_VALUE_FLUSH`], but as a standalone operation.
pub const CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES: CUstreamBatchMemOpType_enum = CUstreamBatchMemOpType_enum(
3,
);
}
/// Operations for ::cuStreamBatchMemOp
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUstreamBatchMemOpType_enum(pub ::core::ffi::c_uint);
pub use self::CUstreamBatchMemOpType_enum as CUstreamBatchMemOpType;
impl CUstreamMemoryBarrier_flags_enum {
/// System-wide memory barrier.
pub const CU_STREAM_MEMORY_BARRIER_TYPE_SYS: CUstreamMemoryBarrier_flags_enum = CUstreamMemoryBarrier_flags_enum(
0,
);
/// Limit memory barrier scope to the GPU.
pub const CU_STREAM_MEMORY_BARRIER_TYPE_GPU: CUstreamMemoryBarrier_flags_enum = CUstreamMemoryBarrier_flags_enum(
1,
);
}
/// Flags for ::CUstreamBatchMemOpParams::memoryBarrier
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUstreamMemoryBarrier_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUstreamMemoryBarrier_flags_enum as CUstreamMemoryBarrier_flags;
impl CUstreamAtomicReductionOpType_enum {
/// Performs an atomic OR: \*(address) = \*(address) | value.
pub const CU_STREAM_ATOMIC_REDUCTION_OP_OR: CUstreamAtomicReductionOpType_enum = CUstreamAtomicReductionOpType_enum(
6,
);
/// Performs an atomic AND: \*(address) = \*(address) & value.
pub const CU_STREAM_ATOMIC_REDUCTION_OP_AND: CUstreamAtomicReductionOpType_enum = CUstreamAtomicReductionOpType_enum(
5,
);
/// Performs an atomic ADD: \*(address) = \*(address) + value.
pub const CU_STREAM_ATOMIC_REDUCTION_OP_ADD: CUstreamAtomicReductionOpType_enum = CUstreamAtomicReductionOpType_enum(
0,
);
}
/// Atomic reduction operation types for ::CUstreamBatchMemOpParams::atomicReduction::reductionOp
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUstreamAtomicReductionOpType_enum(pub ::core::ffi::c_uint);
pub use self::CUstreamAtomicReductionOpType_enum as CUstreamAtomicReductionOpType;
impl CUstreamAtomicReductionDataType_enum {
/// Unsigned 32-bit scalar reduction operands.
pub const CU_STREAM_ATOMIC_REDUCTION_UNSIGNED_32: CUstreamAtomicReductionDataType_enum = CUstreamAtomicReductionDataType_enum(
14,
);
/// Unsigned 64-bit scalar reduction operands.
pub const CU_STREAM_ATOMIC_REDUCTION_UNSIGNED_64: CUstreamAtomicReductionDataType_enum = CUstreamAtomicReductionDataType_enum(
22,
);
}
/// Atomic reduction data types for ::CUstreamBatchMemOpParams::atomicReduction::dataType
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUstreamAtomicReductionDataType_enum(pub ::core::ffi::c_uint);
pub use self::CUstreamAtomicReductionDataType_enum as CUstreamAtomicReductionDataType;
/// Per-operation parameters for ::cuStreamBatchMemOp
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUstreamBatchMemOpParams_union {
/// Operation. This is the first field of all the union elemets and acts as a TAG to determine which union member is valid.
pub operation: CUstreamBatchMemOpType,
/// Params for ::CU_STREAM_MEM_OP_WAIT_VALUE_32 and ::CU_STREAM_MEM_OP_WAIT_VALUE_64 operations.
pub waitValue: CUstreamBatchMemOpParams_union_CUstreamMemOpWaitValueParams_st,
/// Params for ::CU_STREAM_MEM_OP_WRITE_VALUE_32 and ::CU_STREAM_MEM_OP_WRITE_VALUE_64 operations.
pub writeValue: CUstreamBatchMemOpParams_union_CUstreamMemOpWriteValueParams_st,
/// Params for ::CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES operations.
pub flushRemoteWrites: CUstreamBatchMemOpParams_union_CUstreamMemOpFlushRemoteWritesParams_st,
/// Params for ::CU_STREAM_MEM_OP_BARRIER operations.
pub memoryBarrier: CUstreamBatchMemOpParams_union_CUstreamMemOpMemoryBarrierParams_st,
/// Parameters of a stream-ordered atomic reduction.
pub atomicReduction: CUstreamBatchMemOpParams_union_CUstreamMemOpAtomicReductionParams_st,
/// Storage that fixes the native batch-operation union to six 64-bit words.
pub pad: [cuuint64_t; 6usize],
}
/// Native layout of the `waitValue` member of [`CUstreamBatchMemOpParams_union`].
///
/// Params for ::CU_STREAM_MEM_OP_WAIT_VALUE_32 and ::CU_STREAM_MEM_OP_WAIT_VALUE_64 operations.
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUstreamBatchMemOpParams_union_CUstreamMemOpWaitValueParams_st {
/// Selects [`CUstreamBatchMemOpType_enum::CU_STREAM_MEM_OP_WAIT_VALUE_32`] or [`CUstreamBatchMemOpType_enum::CU_STREAM_MEM_OP_WAIT_VALUE_64`].
pub operation: CUstreamBatchMemOpType,
/// Device address of the memory word used by this stream operation.
pub address: CUdeviceptr,
/// Anonymous native member. See [`CUstreamBatchMemOpParams_union_CUstreamMemOpWaitValueParams_st__bindgen_ty_1`] for its fields.
pub __bindgen_anon_1: CUstreamBatchMemOpParams_union_CUstreamMemOpWaitValueParams_st__bindgen_ty_1,
/// See ::CUstreamWaitValue_flags.
pub flags: ::core::ffi::c_uint,
/// For driver internal use. Initial value is unimportant.
pub alias: CUdeviceptr,
}
/// Anonymous native union in [`CUstreamBatchMemOpParams_union_CUstreamMemOpWaitValueParams_st`]. Its members share the same storage.
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUstreamBatchMemOpParams_union_CUstreamMemOpWaitValueParams_st__bindgen_ty_1 {
/// 32-bit operand compared against memory while the stream waits.
pub value: cuuint32_t,
/// 64-bit operand compared against memory while the stream waits.
pub value64: cuuint64_t,
}
impl Default
for CUstreamBatchMemOpParams_union_CUstreamMemOpWaitValueParams_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUstreamBatchMemOpParams_union_CUstreamMemOpWaitValueParams_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Native layout of the `writeValue` member of [`CUstreamBatchMemOpParams_union`].
///
/// Params for ::CU_STREAM_MEM_OP_WRITE_VALUE_32 and ::CU_STREAM_MEM_OP_WRITE_VALUE_64 operations.
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUstreamBatchMemOpParams_union_CUstreamMemOpWriteValueParams_st {
/// Selects [`CUstreamBatchMemOpType_enum::CU_STREAM_MEM_OP_WRITE_VALUE_32`] or [`CUstreamBatchMemOpType_enum::CU_STREAM_MEM_OP_WRITE_VALUE_64`].
pub operation: CUstreamBatchMemOpType,
/// Device address of the memory word used by this stream operation.
pub address: CUdeviceptr,
/// Anonymous native member. See [`CUstreamBatchMemOpParams_union_CUstreamMemOpWriteValueParams_st__bindgen_ty_1`] for its fields.
pub __bindgen_anon_1: CUstreamBatchMemOpParams_union_CUstreamMemOpWriteValueParams_st__bindgen_ty_1,
/// See ::CUstreamWriteValue_flags.
pub flags: ::core::ffi::c_uint,
/// For driver internal use. Initial value is unimportant.
pub alias: CUdeviceptr,
}
/// Anonymous native union in [`CUstreamBatchMemOpParams_union_CUstreamMemOpWriteValueParams_st`]. Its members share the same storage.
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUstreamBatchMemOpParams_union_CUstreamMemOpWriteValueParams_st__bindgen_ty_1 {
/// 32-bit operand written to memory in stream order.
pub value: cuuint32_t,
/// 64-bit operand written to memory in stream order.
pub value64: cuuint64_t,
}
impl Default
for CUstreamBatchMemOpParams_union_CUstreamMemOpWriteValueParams_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUstreamBatchMemOpParams_union_CUstreamMemOpWriteValueParams_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Native layout of the `flushRemoteWrites` member of [`CUstreamBatchMemOpParams_union`].
///
/// Params for ::CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES operations.
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUstreamBatchMemOpParams_union_CUstreamMemOpFlushRemoteWritesParams_st {
/// Operation tag selecting [`CUstreamBatchMemOpType_enum::CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES`].
pub operation: CUstreamBatchMemOpType,
/// Must be 0.
pub flags: ::core::ffi::c_uint,
}
impl Default for CUstreamBatchMemOpParams_union_CUstreamMemOpFlushRemoteWritesParams_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Native layout of the `memoryBarrier` member of [`CUstreamBatchMemOpParams_union`].
///
/// Params for ::CU_STREAM_MEM_OP_BARRIER operations.
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUstreamBatchMemOpParams_union_CUstreamMemOpMemoryBarrierParams_st {
/// Operation tag selecting [`CUstreamBatchMemOpType_enum::CU_STREAM_MEM_OP_BARRIER`].
pub operation: CUstreamBatchMemOpType,
/// See ::CUstreamMemoryBarrier_flags
pub flags: ::core::ffi::c_uint,
}
impl Default for CUstreamBatchMemOpParams_union_CUstreamMemOpMemoryBarrierParams_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Native layout of the `atomicReduction` member of [`CUstreamBatchMemOpParams_union`].
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUstreamBatchMemOpParams_union_CUstreamMemOpAtomicReductionParams_st {
/// Operation tag selecting [`CUstreamBatchMemOpType_enum::CU_STREAM_MEM_OP_ATOMIC_REDUCTION`].
pub operation: CUstreamBatchMemOpType,
/// Must be 0
pub flags: ::core::ffi::c_uint,
/// See ::CUstreamAtomicReductionOpType
pub reductionOp: CUstreamAtomicReductionOpType,
/// See ::CUstreamAtomicReductionDataType
pub dataType: CUstreamAtomicReductionDataType,
/// The address the atomic operation will be operated on
pub address: CUdeviceptr,
/// The operand value the atomic operation will operate with
pub value: cuuint64_t,
/// For driver internal use. Initial value is unimportant.
pub alias: CUdeviceptr,
}
impl Default for CUstreamBatchMemOpParams_union_CUstreamMemOpAtomicReductionParams_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUstreamBatchMemOpParams_union {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Per-operation parameters for cuStreamBatchMemOp.
pub type CUstreamBatchMemOpParams_v1 = CUstreamBatchMemOpParams_union;
/// Per-operation parameters for ::cuStreamBatchMemOp
pub type CUstreamBatchMemOpParams = CUstreamBatchMemOpParams_v1;
/// Batch memory operation node parameters
///
/// Used in the legacy ::cuGraphAddBatchMemOpNode api. New code should use ::cuGraphAddNode()
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st {
/// CUDA context used for the batch of stream memory operations.
pub ctx: CUcontext,
/// Number of entries in `paramArray`.
pub count: ::core::ffi::c_uint,
/// Array of `count` batch memory-operation descriptions.
pub paramArray: *mut CUstreamBatchMemOpParams,
/// Node behavior flags passed to the native batch-memory-operation API.
pub flags: ::core::ffi::c_uint,
}
impl Default for CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Batch memory operation node parameters.
///
/// Used in the legacy [`cuGraphAddBatchMemOpNode`] api. New code should use cuGraphAddNode().
pub type CUDA_BATCH_MEM_OP_NODE_PARAMS_v1 = CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st;
/// Batch memory operation node parameters
///
/// Used in the legacy ::cuGraphAddBatchMemOpNode api. New code should use ::cuGraphAddNode()
pub type CUDA_BATCH_MEM_OP_NODE_PARAMS = CUDA_BATCH_MEM_OP_NODE_PARAMS_v1;
/// Batch memory operation node parameters
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st {
/// Context to use for the operations.
pub ctx: CUcontext,
/// Number of operations in paramArray.
pub count: ::core::ffi::c_uint,
/// Array of batch memory operations.
pub paramArray: *mut CUstreamBatchMemOpParams,
/// Flags to control the node.
pub flags: ::core::ffi::c_uint,
}
impl Default for CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Batch memory operation node parameters.
pub type CUDA_BATCH_MEM_OP_NODE_PARAMS_v2 = CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st;
impl CUoccupancy_flags_enum {
/// Default behavior.
pub const CU_OCCUPANCY_DEFAULT: CUoccupancy_flags_enum = CUoccupancy_flags_enum(0);
/// Assume global caching is enabled and cannot be automatically turned off.
pub const CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE: CUoccupancy_flags_enum = CUoccupancy_flags_enum(
1,
);
}
/// Occupancy calculator flag
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUoccupancy_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUoccupancy_flags_enum as CUoccupancy_flags;
impl CUstreamUpdateCaptureDependencies_flags_enum {
/// Add new nodes to the dependency set.
pub const CU_STREAM_ADD_CAPTURE_DEPENDENCIES: CUstreamUpdateCaptureDependencies_flags_enum = CUstreamUpdateCaptureDependencies_flags_enum(
0,
);
/// Replace the dependency set with the new nodes.
pub const CU_STREAM_SET_CAPTURE_DEPENDENCIES: CUstreamUpdateCaptureDependencies_flags_enum = CUstreamUpdateCaptureDependencies_flags_enum(
1,
);
}
/// Flags for ::cuStreamUpdateCaptureDependencies
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUstreamUpdateCaptureDependencies_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUstreamUpdateCaptureDependencies_flags_enum as CUstreamUpdateCaptureDependencies_flags;
impl CUasyncNotificationType_enum {
/// Sent when the process has exceeded its device memory budget.
pub const CU_ASYNC_NOTIFICATION_TYPE_OVER_BUDGET: CUasyncNotificationType_enum = CUasyncNotificationType_enum(
1,
);
}
/// Types of async notification that can be sent
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUasyncNotificationType_enum(pub ::core::ffi::c_uint);
pub use self::CUasyncNotificationType_enum as CUasyncNotificationType;
/// Information passed to the user via the async notification callback
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUasyncNotificationInfo_st {
/// The type of notification being sent
pub type_: CUasyncNotificationType,
/// Information about the notification. `type` must be checked in order to interpret this field.
pub info: CUasyncNotificationInfo_st__bindgen_ty_1,
}
/// Native layout of the `info` member of [`CUasyncNotificationInfo_st`].
///
/// Information about the notification. `type` must be checked in order to interpret this field.
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUasyncNotificationInfo_st__bindgen_ty_1 {
/// Information about notifications of type [`CUasyncNotificationType_enum::CU_ASYNC_NOTIFICATION_TYPE_OVER_BUDGET`]
pub overBudget: CUasyncNotificationInfo_st__bindgen_ty_1__bindgen_ty_1,
}
/// Native layout of the `overBudget` member of [`CUasyncNotificationInfo_st__bindgen_ty_1`].
///
/// Information about notifications of type [`CUasyncNotificationType_enum::CU_ASYNC_NOTIFICATION_TYPE_OVER_BUDGET`]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUasyncNotificationInfo_st__bindgen_ty_1__bindgen_ty_1 {
/// The number of bytes that the process has allocated above its device memory budget
pub bytesOverBudget: ::core::ffi::c_ulonglong,
}
impl Default for CUasyncNotificationInfo_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUasyncNotificationInfo_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Information passed to the user via the async notification callback.
pub type CUasyncNotificationInfo = CUasyncNotificationInfo_st;
/// CUDA async notification callback.
pub type CUasyncCallback = ::core::option::Option<
unsafe extern "C" fn(
info: *mut CUasyncNotificationInfo,
userData: *mut ::core::ffi::c_void,
callback: CUasyncCallbackHandle,
),
>;
impl CUarray_format_enum {
/// Unsigned 8-bit integers.
pub const CU_AD_FORMAT_UNSIGNED_INT8: CUarray_format_enum = CUarray_format_enum(1);
/// Unsigned 16-bit integers.
pub const CU_AD_FORMAT_UNSIGNED_INT16: CUarray_format_enum = CUarray_format_enum(2);
/// Unsigned 32-bit integers.
pub const CU_AD_FORMAT_UNSIGNED_INT32: CUarray_format_enum = CUarray_format_enum(3);
/// Signed 8-bit integers.
pub const CU_AD_FORMAT_SIGNED_INT8: CUarray_format_enum = CUarray_format_enum(8);
/// Signed 16-bit integers.
pub const CU_AD_FORMAT_SIGNED_INT16: CUarray_format_enum = CUarray_format_enum(9);
/// Signed 32-bit integers.
pub const CU_AD_FORMAT_SIGNED_INT32: CUarray_format_enum = CUarray_format_enum(10);
/// 16-bit floating point.
pub const CU_AD_FORMAT_HALF: CUarray_format_enum = CUarray_format_enum(16);
/// 32-bit floating point.
pub const CU_AD_FORMAT_FLOAT: CUarray_format_enum = CUarray_format_enum(32);
/// 8-bit YUV planar format, with 4:2:0 sampling.
pub const CU_AD_FORMAT_NV12: CUarray_format_enum = CUarray_format_enum(176);
/// 1 channel unsigned 8-bit normalized integer.
pub const CU_AD_FORMAT_UNORM_INT8X1: CUarray_format_enum = CUarray_format_enum(192);
/// 2 channel unsigned 8-bit normalized integer.
pub const CU_AD_FORMAT_UNORM_INT8X2: CUarray_format_enum = CUarray_format_enum(193);
/// 4 channel unsigned 8-bit normalized integer.
pub const CU_AD_FORMAT_UNORM_INT8X4: CUarray_format_enum = CUarray_format_enum(194);
/// 1 channel unsigned 16-bit normalized integer.
pub const CU_AD_FORMAT_UNORM_INT16X1: CUarray_format_enum = CUarray_format_enum(195);
/// 2 channel unsigned 16-bit normalized integer.
pub const CU_AD_FORMAT_UNORM_INT16X2: CUarray_format_enum = CUarray_format_enum(196);
/// 4 channel unsigned 16-bit normalized integer.
pub const CU_AD_FORMAT_UNORM_INT16X4: CUarray_format_enum = CUarray_format_enum(197);
/// 1 channel signed 8-bit normalized integer.
pub const CU_AD_FORMAT_SNORM_INT8X1: CUarray_format_enum = CUarray_format_enum(198);
/// 2 channel signed 8-bit normalized integer.
pub const CU_AD_FORMAT_SNORM_INT8X2: CUarray_format_enum = CUarray_format_enum(199);
/// 4 channel signed 8-bit normalized integer.
pub const CU_AD_FORMAT_SNORM_INT8X4: CUarray_format_enum = CUarray_format_enum(200);
/// 1 channel signed 16-bit normalized integer.
pub const CU_AD_FORMAT_SNORM_INT16X1: CUarray_format_enum = CUarray_format_enum(201);
/// 2 channel signed 16-bit normalized integer.
pub const CU_AD_FORMAT_SNORM_INT16X2: CUarray_format_enum = CUarray_format_enum(202);
/// 4 channel signed 16-bit normalized integer.
pub const CU_AD_FORMAT_SNORM_INT16X4: CUarray_format_enum = CUarray_format_enum(203);
/// 4 channel unsigned normalized block-compressed (BC1 compression) format.
pub const CU_AD_FORMAT_BC1_UNORM: CUarray_format_enum = CUarray_format_enum(145);
/// 4 channel unsigned normalized block-compressed (BC1 compression) format with sRGB encoding.
pub const CU_AD_FORMAT_BC1_UNORM_SRGB: CUarray_format_enum = CUarray_format_enum(
146,
);
/// 4 channel unsigned normalized block-compressed (BC2 compression) format.
pub const CU_AD_FORMAT_BC2_UNORM: CUarray_format_enum = CUarray_format_enum(147);
/// 4 channel unsigned normalized block-compressed (BC2 compression) format with sRGB encoding.
pub const CU_AD_FORMAT_BC2_UNORM_SRGB: CUarray_format_enum = CUarray_format_enum(
148,
);
/// 4 channel unsigned normalized block-compressed (BC3 compression) format.
pub const CU_AD_FORMAT_BC3_UNORM: CUarray_format_enum = CUarray_format_enum(149);
/// 4 channel unsigned normalized block-compressed (BC3 compression) format with sRGB encoding.
pub const CU_AD_FORMAT_BC3_UNORM_SRGB: CUarray_format_enum = CUarray_format_enum(
150,
);
/// 1 channel unsigned normalized block-compressed (BC4 compression) format.
pub const CU_AD_FORMAT_BC4_UNORM: CUarray_format_enum = CUarray_format_enum(151);
/// 1 channel signed normalized block-compressed (BC4 compression) format.
pub const CU_AD_FORMAT_BC4_SNORM: CUarray_format_enum = CUarray_format_enum(152);
/// 2 channel unsigned normalized block-compressed (BC5 compression) format.
pub const CU_AD_FORMAT_BC5_UNORM: CUarray_format_enum = CUarray_format_enum(153);
/// 2 channel signed normalized block-compressed (BC5 compression) format.
pub const CU_AD_FORMAT_BC5_SNORM: CUarray_format_enum = CUarray_format_enum(154);
/// 3 channel unsigned half-float block-compressed (BC6H compression) format.
pub const CU_AD_FORMAT_BC6H_UF16: CUarray_format_enum = CUarray_format_enum(155);
/// 3 channel signed half-float block-compressed (BC6H compression) format.
pub const CU_AD_FORMAT_BC6H_SF16: CUarray_format_enum = CUarray_format_enum(156);
/// 4 channel unsigned normalized block-compressed (BC7 compression) format.
pub const CU_AD_FORMAT_BC7_UNORM: CUarray_format_enum = CUarray_format_enum(157);
/// 4 channel unsigned normalized block-compressed (BC7 compression) format with sRGB encoding.
pub const CU_AD_FORMAT_BC7_UNORM_SRGB: CUarray_format_enum = CUarray_format_enum(
158,
);
/// 10-bit YUV planar format, with 4:2:0 sampling.
pub const CU_AD_FORMAT_P010: CUarray_format_enum = CUarray_format_enum(159);
/// 16-bit YUV planar format, with 4:2:0 sampling.
pub const CU_AD_FORMAT_P016: CUarray_format_enum = CUarray_format_enum(161);
/// 8-bit YUV planar format, with 4:2:2 sampling.
pub const CU_AD_FORMAT_NV16: CUarray_format_enum = CUarray_format_enum(162);
/// 10-bit YUV planar format, with 4:2:2 sampling.
pub const CU_AD_FORMAT_P210: CUarray_format_enum = CUarray_format_enum(163);
/// 16-bit YUV planar format, with 4:2:2 sampling.
pub const CU_AD_FORMAT_P216: CUarray_format_enum = CUarray_format_enum(164);
/// 2 channel, 8-bit YUV packed planar format, with 4:2:2 sampling.
pub const CU_AD_FORMAT_YUY2: CUarray_format_enum = CUarray_format_enum(165);
/// 2 channel, 10-bit YUV packed planar format, with 4:2:2 sampling.
pub const CU_AD_FORMAT_Y210: CUarray_format_enum = CUarray_format_enum(166);
/// 2 channel, 16-bit YUV packed planar format, with 4:2:2 sampling.
pub const CU_AD_FORMAT_Y216: CUarray_format_enum = CUarray_format_enum(167);
/// 4 channel, 8-bit YUV packed planar format, with 4:4:4 sampling.
pub const CU_AD_FORMAT_AYUV: CUarray_format_enum = CUarray_format_enum(168);
/// 10-bit YUV packed planar format, with 4:4:4 sampling.
pub const CU_AD_FORMAT_Y410: CUarray_format_enum = CUarray_format_enum(169);
/// 4 channel, 12-bit YUV packed planar format, with 4:4:4 sampling.
pub const CU_AD_FORMAT_Y416: CUarray_format_enum = CUarray_format_enum(177);
/// 3 channel 8-bit YUV planar format, with 4:4:4 sampling.
pub const CU_AD_FORMAT_Y444_PLANAR8: CUarray_format_enum = CUarray_format_enum(178);
/// 3 channel 10-bit YUV planar format, with 4:4:4 sampling.
pub const CU_AD_FORMAT_Y444_PLANAR10: CUarray_format_enum = CUarray_format_enum(179);
/// 3 channel 8-bit YUV semi-planar format, with 4:4:4 sampling.
pub const CU_AD_FORMAT_YUV444_8bit_SemiPlanar: CUarray_format_enum = CUarray_format_enum(
180,
);
/// 3 channel 16-bit YUV semi-planar format, with 4:4:4 sampling.
pub const CU_AD_FORMAT_YUV444_16bit_SemiPlanar: CUarray_format_enum = CUarray_format_enum(
181,
);
/// 4 channel unorm R10G10B10A2 RGB format.
pub const CU_AD_FORMAT_UNORM_INT_101010_2: CUarray_format_enum = CUarray_format_enum(
80,
);
/// 4 channel unsigned 8-bit YUV packed format, with 4:2:2 sampling.
pub const CU_AD_FORMAT_UINT8_PACKED_422: CUarray_format_enum = CUarray_format_enum(
81,
);
/// 4 channel unsigned 8-bit YUV packed format, with 4:4:4 sampling.
pub const CU_AD_FORMAT_UINT8_PACKED_444: CUarray_format_enum = CUarray_format_enum(
82,
);
/// 3 channel unsigned 8-bit YUV semi-planar format, with 4:2:0 sampling.
pub const CU_AD_FORMAT_UINT8_SEMIPLANAR_420: CUarray_format_enum = CUarray_format_enum(
83,
);
/// 3 channel unsigned 16-bit YUV semi-planar format, with 4:2:0 sampling.
pub const CU_AD_FORMAT_UINT16_SEMIPLANAR_420: CUarray_format_enum = CUarray_format_enum(
84,
);
/// 3 channel unsigned 8-bit YUV semi-planar format, with 4:2:2 sampling.
pub const CU_AD_FORMAT_UINT8_SEMIPLANAR_422: CUarray_format_enum = CUarray_format_enum(
85,
);
/// 3 channel unsigned 16-bit YUV semi-planar format, with 4:2:2 sampling.
pub const CU_AD_FORMAT_UINT16_SEMIPLANAR_422: CUarray_format_enum = CUarray_format_enum(
86,
);
/// 3 channel unsigned 8-bit YUV semi-planar format, with 4:4:4 sampling.
pub const CU_AD_FORMAT_UINT8_SEMIPLANAR_444: CUarray_format_enum = CUarray_format_enum(
87,
);
/// 3 channel unsigned 16-bit YUV semi-planar format, with 4:4:4 sampling.
pub const CU_AD_FORMAT_UINT16_SEMIPLANAR_444: CUarray_format_enum = CUarray_format_enum(
88,
);
/// 3 channel unsigned 8-bit YUV planar format, with 4:2:0 sampling.
pub const CU_AD_FORMAT_UINT8_PLANAR_420: CUarray_format_enum = CUarray_format_enum(
89,
);
/// 3 channel unsigned 16-bit YUV planar format, with 4:2:0 sampling.
pub const CU_AD_FORMAT_UINT16_PLANAR_420: CUarray_format_enum = CUarray_format_enum(
90,
);
/// 3 channel unsigned 8-bit YUV planar format, with 4:2:2 sampling.
pub const CU_AD_FORMAT_UINT8_PLANAR_422: CUarray_format_enum = CUarray_format_enum(
91,
);
/// 3 channel unsigned 16-bit YUV planar format, with 4:2:2 sampling.
pub const CU_AD_FORMAT_UINT16_PLANAR_422: CUarray_format_enum = CUarray_format_enum(
92,
);
/// 3 channel unsigned 8-bit YUV planar format, with 4:4:4 sampling.
pub const CU_AD_FORMAT_UINT8_PLANAR_444: CUarray_format_enum = CUarray_format_enum(
93,
);
/// 3 channel unsigned 16-bit YUV planar format, with 4:4:4 sampling.
pub const CU_AD_FORMAT_UINT16_PLANAR_444: CUarray_format_enum = CUarray_format_enum(
94,
);
/// Reserved upper-bound sentinel for native array formats.
pub const CU_AD_FORMAT_MAX: CUarray_format_enum = CUarray_format_enum(2147483647);
}
/// Array formats
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUarray_format_enum(pub ::core::ffi::c_uint);
pub use self::CUarray_format_enum as CUarray_format;
impl CUaddress_mode_enum {
/// Wrapping address mode.
pub const CU_TR_ADDRESS_MODE_WRAP: CUaddress_mode_enum = CUaddress_mode_enum(0);
/// Clamp to edge address mode.
pub const CU_TR_ADDRESS_MODE_CLAMP: CUaddress_mode_enum = CUaddress_mode_enum(1);
/// Mirror address mode.
pub const CU_TR_ADDRESS_MODE_MIRROR: CUaddress_mode_enum = CUaddress_mode_enum(2);
/// Border address mode.
pub const CU_TR_ADDRESS_MODE_BORDER: CUaddress_mode_enum = CUaddress_mode_enum(3);
}
/// Texture reference addressing modes
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUaddress_mode_enum(pub ::core::ffi::c_uint);
pub use self::CUaddress_mode_enum as CUaddress_mode;
impl CUfilter_mode_enum {
/// Point filter mode.
pub const CU_TR_FILTER_MODE_POINT: CUfilter_mode_enum = CUfilter_mode_enum(0);
/// Linear filter mode.
pub const CU_TR_FILTER_MODE_LINEAR: CUfilter_mode_enum = CUfilter_mode_enum(1);
}
/// Texture reference filtering modes
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUfilter_mode_enum(pub ::core::ffi::c_uint);
pub use self::CUfilter_mode_enum as CUfilter_mode;
impl CUdevice_attribute_enum {
/// Maximum number of threads per block.
pub const CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK: CUdevice_attribute_enum = CUdevice_attribute_enum(
1,
);
/// Maximum block dimension X.
pub const CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X: CUdevice_attribute_enum = CUdevice_attribute_enum(
2,
);
/// Maximum block dimension Y.
pub const CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y: CUdevice_attribute_enum = CUdevice_attribute_enum(
3,
);
/// Maximum block dimension Z.
pub const CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z: CUdevice_attribute_enum = CUdevice_attribute_enum(
4,
);
/// Maximum grid dimension X.
pub const CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X: CUdevice_attribute_enum = CUdevice_attribute_enum(
5,
);
/// Maximum grid dimension Y.
pub const CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y: CUdevice_attribute_enum = CUdevice_attribute_enum(
6,
);
/// Maximum grid dimension Z.
pub const CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z: CUdevice_attribute_enum = CUdevice_attribute_enum(
7,
);
/// Maximum shared memory available per block in bytes.
pub const CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK: CUdevice_attribute_enum = CUdevice_attribute_enum(
8,
);
/// use [`CUdevice_attribute::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK`].
#[deprecated]
pub const CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK: CUdevice_attribute_enum = CUdevice_attribute_enum(
8,
);
/// Memory available on device for **constant** variables in a CUDA C kernel in bytes.
pub const CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY: CUdevice_attribute_enum = CUdevice_attribute_enum(
9,
);
/// Warp size in threads.
pub const CU_DEVICE_ATTRIBUTE_WARP_SIZE: CUdevice_attribute_enum = CUdevice_attribute_enum(
10,
);
/// Maximum pitch in bytes allowed by memory copies.
pub const CU_DEVICE_ATTRIBUTE_MAX_PITCH: CUdevice_attribute_enum = CUdevice_attribute_enum(
11,
);
/// Maximum number of 32-bit registers available per block.
pub const CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK: CUdevice_attribute_enum = CUdevice_attribute_enum(
12,
);
/// use [`CUdevice_attribute::CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK`].
#[deprecated]
pub const CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK: CUdevice_attribute_enum = CUdevice_attribute_enum(
12,
);
/// Typical clock frequency in kilohertz.
pub const CU_DEVICE_ATTRIBUTE_CLOCK_RATE: CUdevice_attribute_enum = CUdevice_attribute_enum(
13,
);
/// Alignment requirement for textures.
pub const CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT: CUdevice_attribute_enum = CUdevice_attribute_enum(
14,
);
/// Device can possibly copy memory and execute a kernel concurrently.
///
/// Deprecated. Use instead [`CUdevice_attribute::CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT`].
#[deprecated]
pub const CU_DEVICE_ATTRIBUTE_GPU_OVERLAP: CUdevice_attribute_enum = CUdevice_attribute_enum(
15,
);
/// Number of multiprocessors on device.
pub const CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT: CUdevice_attribute_enum = CUdevice_attribute_enum(
16,
);
/// Specifies whether there is a run time limit on kernels.
pub const CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT: CUdevice_attribute_enum = CUdevice_attribute_enum(
17,
);
/// Device is integrated with host memory.
pub const CU_DEVICE_ATTRIBUTE_INTEGRATED: CUdevice_attribute_enum = CUdevice_attribute_enum(
18,
);
/// Device can map host memory into CUDA address space.
pub const CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY: CUdevice_attribute_enum = CUdevice_attribute_enum(
19,
);
/// Compute mode (See [CUcomputemode](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1ga637aab2eadb52e1c1c048b8bad9592d1) for details).
pub const CU_DEVICE_ATTRIBUTE_COMPUTE_MODE: CUdevice_attribute_enum = CUdevice_attribute_enum(
20,
);
/// Maximum 1D texture width.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
21,
);
/// Maximum 2D texture width.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
22,
);
/// Maximum 2D texture height.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT: CUdevice_attribute_enum = CUdevice_attribute_enum(
23,
);
/// Maximum 3D texture width.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
24,
);
/// Maximum 3D texture height.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT: CUdevice_attribute_enum = CUdevice_attribute_enum(
25,
);
/// Maximum 3D texture depth.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
26,
);
/// Maximum 2D layered texture width.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
27,
);
/// Maximum 2D layered texture height.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT: CUdevice_attribute_enum = CUdevice_attribute_enum(
28,
);
/// Maximum layers in a 2D layered texture.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS: CUdevice_attribute_enum = CUdevice_attribute_enum(
29,
);
/// use [`CUdevice_attribute::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH`].
#[deprecated]
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
27,
);
/// use [`CUdevice_attribute::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT`].
#[deprecated]
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT: CUdevice_attribute_enum = CUdevice_attribute_enum(
28,
);
/// use [`CUdevice_attribute::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS`].
#[deprecated]
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES: CUdevice_attribute_enum = CUdevice_attribute_enum(
29,
);
/// Alignment requirement for surfaces.
pub const CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT: CUdevice_attribute_enum = CUdevice_attribute_enum(
30,
);
/// Device can possibly execute multiple kernels concurrently.
pub const CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS: CUdevice_attribute_enum = CUdevice_attribute_enum(
31,
);
/// Device has ECC support enabled.
pub const CU_DEVICE_ATTRIBUTE_ECC_ENABLED: CUdevice_attribute_enum = CUdevice_attribute_enum(
32,
);
/// PCI bus ID of the device.
pub const CU_DEVICE_ATTRIBUTE_PCI_BUS_ID: CUdevice_attribute_enum = CUdevice_attribute_enum(
33,
);
/// PCI device ID of the device.
pub const CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID: CUdevice_attribute_enum = CUdevice_attribute_enum(
34,
);
/// Device is using TCC driver model.
pub const CU_DEVICE_ATTRIBUTE_TCC_DRIVER: CUdevice_attribute_enum = CUdevice_attribute_enum(
35,
);
/// Peak memory clock frequency in kilohertz.
pub const CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE: CUdevice_attribute_enum = CUdevice_attribute_enum(
36,
);
/// Global memory bus width in bits.
pub const CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
37,
);
/// Size of L2 cache in bytes.
pub const CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE: CUdevice_attribute_enum = CUdevice_attribute_enum(
38,
);
/// Maximum resident threads per multiprocessor.
pub const CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR: CUdevice_attribute_enum = CUdevice_attribute_enum(
39,
);
/// Number of asynchronous engines.
pub const CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT: CUdevice_attribute_enum = CUdevice_attribute_enum(
40,
);
/// Device shares a unified address space with the host.
pub const CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING: CUdevice_attribute_enum = CUdevice_attribute_enum(
41,
);
/// Maximum 1D layered texture width.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
42,
);
/// Maximum layers in a 1D layered texture.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS: CUdevice_attribute_enum = CUdevice_attribute_enum(
43,
);
/// do not use.
#[deprecated]
pub const CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER: CUdevice_attribute_enum = CUdevice_attribute_enum(
44,
);
/// Maximum 2D texture width if CUDA_ARRAY3D_TEXTURE_GATHER is set.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
45,
);
/// Maximum 2D texture height if CUDA_ARRAY3D_TEXTURE_GATHER is set.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT: CUdevice_attribute_enum = CUdevice_attribute_enum(
46,
);
/// Alternate maximum 3D texture width.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE: CUdevice_attribute_enum = CUdevice_attribute_enum(
47,
);
/// Alternate maximum 3D texture height.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE: CUdevice_attribute_enum = CUdevice_attribute_enum(
48,
);
/// Alternate maximum 3D texture depth.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE: CUdevice_attribute_enum = CUdevice_attribute_enum(
49,
);
/// PCI domain ID of the device.
pub const CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID: CUdevice_attribute_enum = CUdevice_attribute_enum(
50,
);
/// Pitch alignment requirement for textures.
pub const CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT: CUdevice_attribute_enum = CUdevice_attribute_enum(
51,
);
/// Maximum cubemap texture width/height.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
52,
);
/// Maximum cubemap layered texture width/height.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
53,
);
/// Maximum layers in a cubemap layered texture.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS: CUdevice_attribute_enum = CUdevice_attribute_enum(
54,
);
/// Maximum 1D surface width.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
55,
);
/// Maximum 2D surface width.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
56,
);
/// Maximum 2D surface height.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT: CUdevice_attribute_enum = CUdevice_attribute_enum(
57,
);
/// Maximum 3D surface width.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
58,
);
/// Maximum 3D surface height.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT: CUdevice_attribute_enum = CUdevice_attribute_enum(
59,
);
/// Maximum 3D surface depth.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
60,
);
/// Maximum 1D layered surface width.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
61,
);
/// Maximum layers in a 1D layered surface.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS: CUdevice_attribute_enum = CUdevice_attribute_enum(
62,
);
/// Maximum 2D layered surface width.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
63,
);
/// Maximum 2D layered surface height.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT: CUdevice_attribute_enum = CUdevice_attribute_enum(
64,
);
/// Maximum layers in a 2D layered surface.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS: CUdevice_attribute_enum = CUdevice_attribute_enum(
65,
);
/// Maximum cubemap surface width.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
66,
);
/// Maximum cubemap layered surface width.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
67,
);
/// Maximum layers in a cubemap layered surface.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS: CUdevice_attribute_enum = CUdevice_attribute_enum(
68,
);
/// do not use.
///
/// Use cudaDeviceGetTexture1DLinearMaxWidth() or [`cuDeviceGetTexture1DLinearMaxWidth`] instead.
#[deprecated]
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
69,
);
/// Maximum 2D linear texture width.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
70,
);
/// Maximum 2D linear texture height.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT: CUdevice_attribute_enum = CUdevice_attribute_enum(
71,
);
/// Maximum 2D linear texture pitch in bytes.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH: CUdevice_attribute_enum = CUdevice_attribute_enum(
72,
);
/// Maximum mipmapped 2D texture width.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
73,
);
/// Maximum mipmapped 2D texture height.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT: CUdevice_attribute_enum = CUdevice_attribute_enum(
74,
);
/// Major compute capability version number.
pub const CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR: CUdevice_attribute_enum = CUdevice_attribute_enum(
75,
);
/// Minor compute capability version number.
pub const CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR: CUdevice_attribute_enum = CUdevice_attribute_enum(
76,
);
/// Maximum mipmapped 1D texture width.
pub const CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
77,
);
/// Device supports stream priorities.
pub const CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
78,
);
/// Device supports caching globals in L1.
pub const CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
79,
);
/// Device supports caching locals in L1.
pub const CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
80,
);
/// Maximum shared memory available per multiprocessor in bytes.
pub const CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR: CUdevice_attribute_enum = CUdevice_attribute_enum(
81,
);
/// Maximum number of 32-bit registers available per multiprocessor.
pub const CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR: CUdevice_attribute_enum = CUdevice_attribute_enum(
82,
);
/// Device can allocate managed memory on this system.
pub const CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY: CUdevice_attribute_enum = CUdevice_attribute_enum(
83,
);
/// Device is on a multi-GPU board.
pub const CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD: CUdevice_attribute_enum = CUdevice_attribute_enum(
84,
);
/// Unique id for a group of devices on the same multi-GPU board.
pub const CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID: CUdevice_attribute_enum = CUdevice_attribute_enum(
85,
);
/// Link between the device and the host supports all native atomic operations.
pub const CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
86,
);
/// Ratio of single precision performance (in floating-point operations per second) to double precision performance.
pub const CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO: CUdevice_attribute_enum = CUdevice_attribute_enum(
87,
);
/// Device supports coherently accessing pageable memory without calling cudaHostRegister on it.
pub const CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS: CUdevice_attribute_enum = CUdevice_attribute_enum(
88,
);
/// Device can coherently access managed memory concurrently with the CPU.
pub const CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS: CUdevice_attribute_enum = CUdevice_attribute_enum(
89,
);
/// Device supports compute preemption.
pub const CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
90,
);
/// Device can access host registered memory at the same virtual address as the CPU.
pub const CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM: CUdevice_attribute_enum = CUdevice_attribute_enum(
91,
);
/// along with v1 MemOps API, cuStreamBatchMemOp and related APIs are supported.
#[deprecated]
pub const CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_MEM_OPS_V1: CUdevice_attribute_enum = CUdevice_attribute_enum(
92,
);
/// along with v1 MemOps API, 64-bit operations are supported in cuStreamBatchMemOp and related APIs.
#[deprecated]
pub const CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS_V1: CUdevice_attribute_enum = CUdevice_attribute_enum(
93,
);
/// along with v1 MemOps API, [`CUstreamWaitValue_flags_enum::CU_STREAM_WAIT_VALUE_NOR`] is supported.
#[deprecated]
pub const CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR_V1: CUdevice_attribute_enum = CUdevice_attribute_enum(
94,
);
/// Device supports launching cooperative kernels via [`cuLaunchCooperativeKernel`].
pub const CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH: CUdevice_attribute_enum = CUdevice_attribute_enum(
95,
);
/// [`cuLaunchCooperativeKernelMultiDevice`] is deprecated.
#[deprecated]
pub const CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH: CUdevice_attribute_enum = CUdevice_attribute_enum(
96,
);
/// Maximum optin shared memory per block.
///
/// That is shared memory that is available for dynamic allocation or static allocation (including architecture specific static shared memory) on this device but is not guaranteed to be portable.
pub const CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN: CUdevice_attribute_enum = CUdevice_attribute_enum(
97,
);
/// The [`CUstreamWaitValue_flags_enum::CU_STREAM_WAIT_VALUE_FLUSH`] flag and the [`CUstreamBatchMemOpType_enum::CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES`] MemOp are supported on the device.
///
/// See [Stream Memory Operations](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__MEMOP.html#group__cuda__memop) for additional details.
pub const CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES: CUdevice_attribute_enum = CUdevice_attribute_enum(
98,
);
/// Device supports host memory registration via ::cudaHostRegister.
pub const CU_DEVICE_ATTRIBUTE_HOST_REGISTER_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
99,
);
/// Device accesses pageable memory via the host’s page tables.
pub const CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES: CUdevice_attribute_enum = CUdevice_attribute_enum(
100,
);
/// The host can directly access managed memory on the device without migration.
pub const CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST: CUdevice_attribute_enum = CUdevice_attribute_enum(
101,
);
/// Use [`CUdevice_attribute::CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED`].
#[deprecated]
pub const CU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
102,
);
/// Device supports virtual memory management APIs like [`cuMemAddressReserve`], [`cuMemCreate`], [`cuMemMap`] and related APIs.
pub const CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
102,
);
/// Device supports exporting memory to a posix file descriptor with [`cuMemExportToShareableHandle`], if requested via [`cuMemCreate`].
pub const CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
103,
);
/// Device supports exporting memory to a Win32 NT handle with [`cuMemExportToShareableHandle`], if requested via [`cuMemCreate`].
pub const CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_HANDLE_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
104,
);
/// Device supports exporting memory to a Win32 KMT handle with [`cuMemExportToShareableHandle`], if requested via [`cuMemCreate`].
pub const CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_KMT_HANDLE_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
105,
);
/// Maximum number of blocks per multiprocessor.
pub const CU_DEVICE_ATTRIBUTE_MAX_BLOCKS_PER_MULTIPROCESSOR: CUdevice_attribute_enum = CUdevice_attribute_enum(
106,
);
/// Device supports compression of memory.
pub const CU_DEVICE_ATTRIBUTE_GENERIC_COMPRESSION_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
107,
);
/// Maximum L2 persisting lines capacity setting in bytes.
pub const CU_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE: CUdevice_attribute_enum = CUdevice_attribute_enum(
108,
);
/// Maximum value of [CUaccessPolicyWindow::num_bytes](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUaccessPolicyWindow__v1.html#structcuaccesspolicywindow__v1_1a79ee4c983788bc68605d42aee2701eec).
pub const CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE: CUdevice_attribute_enum = CUdevice_attribute_enum(
109,
);
/// Device supports specifying the GPUDirect RDMA flag with [`cuMemCreate`].
pub const CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_CUDA_VMM_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
110,
);
/// Shared memory reserved by CUDA driver per block in bytes.
pub const CU_DEVICE_ATTRIBUTE_RESERVED_SHARED_MEMORY_PER_BLOCK: CUdevice_attribute_enum = CUdevice_attribute_enum(
111,
);
/// Device supports sparse CUDA arrays and sparse CUDA mipmapped arrays.
pub const CU_DEVICE_ATTRIBUTE_SPARSE_CUDA_ARRAY_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
112,
);
/// Device supports using the cuMemHostRegister flag ::CU_MEMHOSTERGISTER_READ_ONLY to register memory that must be mapped as read-only to the GPU.
pub const CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
113,
);
/// External timeline semaphore interop is supported on the device.
pub const CU_DEVICE_ATTRIBUTE_TIMELINE_SEMAPHORE_INTEROP_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
114,
);
/// Device supports using the [`cuMemAllocAsync`] and ::cuMemPool family of APIs.
pub const CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
115,
);
/// Device supports GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see <https://docs.nvidia.com/cuda/gpudirect-rdma> for more information).
pub const CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
116,
);
/// The returned attribute shall be interpreted as a bitmask, where the individual bits are described by the [CUflushGPUDirectRDMAWritesOptions](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gaf34334d1d6892847a5d05be7ca8db3c6) enum.
pub const CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS: CUdevice_attribute_enum = CUdevice_attribute_enum(
117,
);
/// GPUDirect RDMA writes to the device do not need to be flushed for consumers within the scope indicated by the returned attribute.
///
/// See [CUGPUDirectRDMAWritesOrdering](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1ga8d647023012ffc318ce86814fec05376) for the numerical values returned here.
pub const CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING: CUdevice_attribute_enum = CUdevice_attribute_enum(
118,
);
/// Handle types supported with mempool based IPC.
pub const CU_DEVICE_ATTRIBUTE_MEMPOOL_SUPPORTED_HANDLE_TYPES: CUdevice_attribute_enum = CUdevice_attribute_enum(
119,
);
/// Indicates device supports cluster launch.
pub const CU_DEVICE_ATTRIBUTE_CLUSTER_LAUNCH: CUdevice_attribute_enum = CUdevice_attribute_enum(
120,
);
/// Device supports deferred mapping CUDA arrays and CUDA mipmapped arrays.
pub const CU_DEVICE_ATTRIBUTE_DEFERRED_MAPPING_CUDA_ARRAY_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
121,
);
/// 64-bit operations are supported in cuStreamBatchMemOp and related MemOp APIs.
pub const CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS: CUdevice_attribute_enum = CUdevice_attribute_enum(
122,
);
/// [`CUstreamWaitValue_flags_enum::CU_STREAM_WAIT_VALUE_NOR`] is supported by MemOp APIs.
pub const CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR: CUdevice_attribute_enum = CUdevice_attribute_enum(
123,
);
/// Device supports buffer sharing with dma_buf mechanism.
pub const CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
124,
);
/// Device supports IPC Events.
pub const CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
125,
);
/// Number of memory domains the device supports.
pub const CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT: CUdevice_attribute_enum = CUdevice_attribute_enum(
126,
);
/// Device supports accessing memory using Tensor Map.
pub const CU_DEVICE_ATTRIBUTE_TENSOR_MAP_ACCESS_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
127,
);
/// Device supports exporting memory to a fabric handle with [`cuMemExportToShareableHandle`] or requested with [`cuMemCreate`].
pub const CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_FABRIC_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
128,
);
/// Device supports unified function pointers.
pub const CU_DEVICE_ATTRIBUTE_UNIFIED_FUNCTION_POINTERS: CUdevice_attribute_enum = CUdevice_attribute_enum(
129,
);
/// NUMA configuration of a device: value is of type [CUdeviceNumaConfig](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gabd735e21702c410355167e04d3362eab) enum.
pub const CU_DEVICE_ATTRIBUTE_NUMA_CONFIG: CUdevice_attribute_enum = CUdevice_attribute_enum(
130,
);
/// NUMA node ID of the GPU memory.
pub const CU_DEVICE_ATTRIBUTE_NUMA_ID: CUdevice_attribute_enum = CUdevice_attribute_enum(
131,
);
/// Device supports switch multicast and reduction operations.
pub const CU_DEVICE_ATTRIBUTE_MULTICAST_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
132,
);
/// Indicates if contexts created on this device will be shared via MPS.
pub const CU_DEVICE_ATTRIBUTE_MPS_ENABLED: CUdevice_attribute_enum = CUdevice_attribute_enum(
133,
);
/// NUMA ID of the host node closest to the device.
///
/// Returns -1 when system does not support NUMA.
pub const CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID: CUdevice_attribute_enum = CUdevice_attribute_enum(
134,
);
/// Device supports CIG with D3D12.
pub const CU_DEVICE_ATTRIBUTE_D3D12_CIG_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
135,
);
/// The returned valued shall be interpreted as a bitmask, where the individual bits are described by the [CUmemDecompressAlgorithm](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__MEM.html#group__cuda__mem_1ga6c015495b909c100e19cd4ddafceee91) enum.
pub const CU_DEVICE_ATTRIBUTE_MEM_DECOMPRESS_ALGORITHM_MASK: CUdevice_attribute_enum = CUdevice_attribute_enum(
136,
);
/// The returned valued is the maximum length in bytes of a single decompress operation that is allowed.
pub const CU_DEVICE_ATTRIBUTE_MEM_DECOMPRESS_MAXIMUM_LENGTH: CUdevice_attribute_enum = CUdevice_attribute_enum(
137,
);
/// Device supports CIG with Vulkan.
pub const CU_DEVICE_ATTRIBUTE_VULKAN_CIG_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
138,
);
/// The combined 16-bit PCI device ID and 16-bit PCI vendor ID.
pub const CU_DEVICE_ATTRIBUTE_GPU_PCI_DEVICE_ID: CUdevice_attribute_enum = CUdevice_attribute_enum(
139,
);
/// The combined 16-bit PCI subsystem ID and 16-bit PCI subsystem vendor ID.
pub const CU_DEVICE_ATTRIBUTE_GPU_PCI_SUBSYSTEM_ID: CUdevice_attribute_enum = CUdevice_attribute_enum(
140,
);
/// Device supports HOST_NUMA location with the virtual memory management APIs like [`cuMemCreate`], [`cuMemMap`] and related APIs.
pub const CU_DEVICE_ATTRIBUTE_HOST_NUMA_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
141,
);
/// Device supports HOST_NUMA location with the [`cuMemAllocAsync`] and ::cuMemPool family of APIs.
pub const CU_DEVICE_ATTRIBUTE_HOST_NUMA_MEMORY_POOLS_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
142,
);
/// Device supports HOST_NUMA location IPC between nodes in a multi-node system.
pub const CU_DEVICE_ATTRIBUTE_HOST_NUMA_MULTINODE_IPC_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
143,
);
/// Device suports HOST location with the [`cuMemAllocAsync`] and ::cuMemPool family of APIs.
pub const CU_DEVICE_ATTRIBUTE_HOST_MEMORY_POOLS_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
144,
);
/// Device supports HOST location with the virtual memory management APIs like [`cuMemCreate`], [`cuMemMap`] and related APIs.
pub const CU_DEVICE_ATTRIBUTE_HOST_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
145,
);
/// Device supports page-locked host memory buffer sharing with dma_buf mechanism.
pub const CU_DEVICE_ATTRIBUTE_HOST_ALLOC_DMA_BUF_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
146,
);
/// Link between the device and the host supports only some native atomic operations.
pub const CU_DEVICE_ATTRIBUTE_ONLY_PARTIAL_HOST_NATIVE_ATOMIC_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
147,
);
/// Device supports atomic reduction operations in stream batch memory operations.
pub const CU_DEVICE_ATTRIBUTE_ATOMIC_REDUCTION_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
148,
);
/// Number of locality domains.
pub const CU_DEVICE_ATTRIBUTE_LOCALITY_DOMAIN_COUNT: CUdevice_attribute_enum = CUdevice_attribute_enum(
149,
);
/// Maximum oversized shared memory per block.
pub const CU_DEVICE_ATTRIBUTE_MAX_OVERSIZED_SHARED_MEMORY_PER_BLOCK: CUdevice_attribute_enum = CUdevice_attribute_enum(
150,
);
/// Device supports CIG streams with D3D12.
pub const CU_DEVICE_ATTRIBUTE_D3D12_CIG_STREAMS_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
151,
);
/// Device supports mmap() of dmabuf file descriptors for CUDA device memory allocations.
pub const CU_DEVICE_ATTRIBUTE_DMA_BUF_MMAP_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
152,
);
/// Device supports unicast logical endpoints.
pub const CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_UNICAST_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
153,
);
/// Device supports multicast logical endpoints.
pub const CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_MULTICAST_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
154,
);
/// Device supports counted operations via logical endpoints.
pub const CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_COUNTED_OPS_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
155,
);
/// Device supports unicast logical endpoint access on the owner device.
pub const CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_UNICAST_ACCESS_ON_OWNER_DEVICE_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
156,
);
/// Number of multiprocessors on each locality domain.
pub const CU_DEVICE_ATTRIBUTE_LOCALITY_DOMAIN_MULTIPROCESSOR_COUNT: CUdevice_attribute_enum = CUdevice_attribute_enum(
157,
);
/// Handle types supported with logical endpoint IPC.
pub const CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_SUPPORTED_HANDLE_TYPES: CUdevice_attribute_enum = CUdevice_attribute_enum(
158,
);
/// Device supports GPUDirect RDMA with localized memory using the default RDMA mapping link.
pub const CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_LOCALIZED_MEMORY_SUPPORTED: CUdevice_attribute_enum = CUdevice_attribute_enum(
161,
);
/// End marker for the native device-attribute identifiers.
pub const CU_DEVICE_ATTRIBUTE_MAX: CUdevice_attribute_enum = CUdevice_attribute_enum(
162,
);
}
/// Device properties
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUdevice_attribute_enum(pub ::core::ffi::c_uint);
pub use self::CUdevice_attribute_enum as CUdevice_attribute;
/// Legacy device properties
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUdevprop_st {
/// Maximum number of threads per block
pub maxThreadsPerBlock: ::core::ffi::c_int,
/// Maximum size of each dimension of a block
pub maxThreadsDim: [::core::ffi::c_int; 3usize],
/// Maximum size of each dimension of a grid
pub maxGridSize: [::core::ffi::c_int; 3usize],
/// Shared memory available per block in bytes
pub sharedMemPerBlock: ::core::ffi::c_int,
/// Constant memory available on device in bytes
pub totalConstantMemory: ::core::ffi::c_int,
/// Warp size in threads
pub SIMDWidth: ::core::ffi::c_int,
/// Maximum pitch in bytes allowed by memory copies
pub memPitch: ::core::ffi::c_int,
/// 32-bit registers available per block
pub regsPerBlock: ::core::ffi::c_int,
/// Clock frequency in kilohertz
pub clockRate: ::core::ffi::c_int,
/// Alignment requirement for textures
pub textureAlign: ::core::ffi::c_int,
}
/// Legacy device properties.
pub type CUdevprop_v1 = CUdevprop_st;
/// Legacy device properties
pub type CUdevprop = CUdevprop_v1;
impl CUpointer_attribute_enum {
/// The [`CUcontext`] on which a pointer was allocated or registered.
pub const CU_POINTER_ATTRIBUTE_CONTEXT: CUpointer_attribute_enum = CUpointer_attribute_enum(
1,
);
/// The [CUmemorytype](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1ga8a114cc994ad2e865c44ef3838eaec72) describing the physical location of a pointer.
pub const CU_POINTER_ATTRIBUTE_MEMORY_TYPE: CUpointer_attribute_enum = CUpointer_attribute_enum(
2,
);
/// The address at which a pointer’s memory may be accessed on the device.
pub const CU_POINTER_ATTRIBUTE_DEVICE_POINTER: CUpointer_attribute_enum = CUpointer_attribute_enum(
3,
);
/// The address at which a pointer’s memory may be accessed on the host.
pub const CU_POINTER_ATTRIBUTE_HOST_POINTER: CUpointer_attribute_enum = CUpointer_attribute_enum(
4,
);
/// A pair of tokens for use with the nv-p2p.h Linux kernel interface.
pub const CU_POINTER_ATTRIBUTE_P2P_TOKENS: CUpointer_attribute_enum = CUpointer_attribute_enum(
5,
);
/// Synchronize every synchronous memory operation initiated on this region.
pub const CU_POINTER_ATTRIBUTE_SYNC_MEMOPS: CUpointer_attribute_enum = CUpointer_attribute_enum(
6,
);
/// A process-wide unique ID for an allocated memory region.
pub const CU_POINTER_ATTRIBUTE_BUFFER_ID: CUpointer_attribute_enum = CUpointer_attribute_enum(
7,
);
/// Indicates if the pointer points to managed memory.
pub const CU_POINTER_ATTRIBUTE_IS_MANAGED: CUpointer_attribute_enum = CUpointer_attribute_enum(
8,
);
/// A device ordinal of a device on which a pointer was allocated or registered.
pub const CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL: CUpointer_attribute_enum = CUpointer_attribute_enum(
9,
);
/// 1 if this pointer maps to an allocation that is suitable for ::cudaIpcGetMemHandle, 0 otherwise.
pub const CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE: CUpointer_attribute_enum = CUpointer_attribute_enum(
10,
);
/// Starting address for this requested pointer.
pub const CU_POINTER_ATTRIBUTE_RANGE_START_ADDR: CUpointer_attribute_enum = CUpointer_attribute_enum(
11,
);
/// Size of the address range for this requested pointer.
pub const CU_POINTER_ATTRIBUTE_RANGE_SIZE: CUpointer_attribute_enum = CUpointer_attribute_enum(
12,
);
/// 1 if this pointer is in a valid address range that is mapped to a backing allocation, 0 otherwise.
pub const CU_POINTER_ATTRIBUTE_MAPPED: CUpointer_attribute_enum = CUpointer_attribute_enum(
13,
);
/// Bitmask of allowed [CUmemAllocationHandleType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1ga450a23153d86fce0afe30e25d63caef9) for this allocation.
pub const CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES: CUpointer_attribute_enum = CUpointer_attribute_enum(
14,
);
/// 1 if the memory this pointer is referencing can be used with the GPUDirect RDMA API.
pub const CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE: CUpointer_attribute_enum = CUpointer_attribute_enum(
15,
);
/// Returns the access flags the device associated with the current context has on the corresponding memory referenced by the pointer given.
pub const CU_POINTER_ATTRIBUTE_ACCESS_FLAGS: CUpointer_attribute_enum = CUpointer_attribute_enum(
16,
);
/// Returns the mempool handle for the allocation if it was allocated from a mempool.
///
/// Otherwise returns NULL.
pub const CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE: CUpointer_attribute_enum = CUpointer_attribute_enum(
17,
);
/// Size of the actual underlying mapping that the pointer belongs to.
pub const CU_POINTER_ATTRIBUTE_MAPPING_SIZE: CUpointer_attribute_enum = CUpointer_attribute_enum(
18,
);
/// The start address of the mapping that the pointer belongs to.
pub const CU_POINTER_ATTRIBUTE_MAPPING_BASE_ADDR: CUpointer_attribute_enum = CUpointer_attribute_enum(
19,
);
/// A process-wide unique id corresponding to the physical allocation the pointer belongs to.
pub const CU_POINTER_ATTRIBUTE_MEMORY_BLOCK_ID: CUpointer_attribute_enum = CUpointer_attribute_enum(
20,
);
/// Returns in `*data` a boolean that indicates whether the pointer points to memory that is capable to be used for hardware accelerated decompression.
pub const CU_POINTER_ATTRIBUTE_IS_HW_DECOMPRESS_CAPABLE: CUpointer_attribute_enum = CUpointer_attribute_enum(
21,
);
/// Returns in `*data` an integer representing the locality domain ordinal of the memory allocation, or -1 if the allocation is not localized to a locality domain.
pub const CU_POINTER_ATTRIBUTE_LOCALITY_DOMAIN_ORDINAL: CUpointer_attribute_enum = CUpointer_attribute_enum(
22,
);
}
/// Pointer information
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUpointer_attribute_enum(pub ::core::ffi::c_uint);
pub use self::CUpointer_attribute_enum as CUpointer_attribute;
impl CUfunction_attribute_enum {
/// The maximum number of threads per block, beyond which a launch of the function would fail.
///
/// This number depends on both the function and the device on which the function is currently loaded.
pub const CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK: CUfunction_attribute_enum = CUfunction_attribute_enum(
0,
);
/// The size in bytes of statically-allocated shared memory required by this function.
///
/// This does not include dynamically-allocated shared memory requested by the user at runtime.
pub const CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES: CUfunction_attribute_enum = CUfunction_attribute_enum(
1,
);
/// The size in bytes of user-allocated constant memory required by this function.
pub const CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES: CUfunction_attribute_enum = CUfunction_attribute_enum(
2,
);
/// The size in bytes of local memory used by each thread of this function.
pub const CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES: CUfunction_attribute_enum = CUfunction_attribute_enum(
3,
);
/// The number of registers used by each thread of this function.
pub const CU_FUNC_ATTRIBUTE_NUM_REGS: CUfunction_attribute_enum = CUfunction_attribute_enum(
4,
);
/// The PTX virtual architecture version for which the function was compiled.
///
/// This value is the major PTX version \* 10 + the minor 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 cubins compiled prior to CUDA 3.0.
pub const CU_FUNC_ATTRIBUTE_PTX_VERSION: CUfunction_attribute_enum = CUfunction_attribute_enum(
5,
);
/// The binary architecture version for which the function was compiled.
///
/// This value is the major binary version \* 10 + the minor 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 cubins that do not have a properly-encoded binary architecture version.
pub const CU_FUNC_ATTRIBUTE_BINARY_VERSION: CUfunction_attribute_enum = CUfunction_attribute_enum(
6,
);
/// The attribute to indicate whether the function has been compiled with user specified option “-Xptxas –dlcm=ca” set .
pub const CU_FUNC_ATTRIBUTE_CACHE_MODE_CA: CUfunction_attribute_enum = CUfunction_attribute_enum(
7,
);
/// The maximum size in bytes of dynamically-allocated shared memory that can be used by this function.
///
/// If the user-specified dynamic shared memory size is larger than this value, the launch will fail.
///
/// The default value of this attribute is [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK`] - [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES`], except when [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES`] is greater than [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK`], then the default value of this attribute is 0. The value can be increased to [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN`] - [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES`].
///
/// This attribute is ignored if [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_SHARED_MEMORY_MODE`] or [`CUlaunchAttributeID_enum::CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE`] is set.
///
/// This attribute cannot be used to access oversized shared memory. Oversized shared memory can only be accessed by setting [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_SHARED_MEMORY_MODE`] or [`CUlaunchAttributeID_enum::CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE`].
///
/// See [`cuFuncSetAttribute`], [`cuKernelSetAttribute`].
pub const CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES: CUfunction_attribute_enum = CUfunction_attribute_enum(
8,
);
/// On devices where the L1 cache and shared memory use the same hardware resources, this sets the shared memory carveout preference, in percent of the total shared memory.
///
/// Refer to [`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.
///
/// See [`cuFuncSetAttribute`], [`cuKernelSetAttribute`].
pub const CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT: CUfunction_attribute_enum = CUfunction_attribute_enum(
9,
);
/// If this attribute is set, the kernel must launch with a valid cluster size specified.
///
/// See [`cuFuncSetAttribute`], [`cuKernelSetAttribute`].
pub const CU_FUNC_ATTRIBUTE_CLUSTER_SIZE_MUST_BE_SET: CUfunction_attribute_enum = CUfunction_attribute_enum(
10,
);
/// The required cluster width in blocks.
///
/// The values must either all be 0 or all be positive. The validity of the cluster dimensions is otherwise checked at launch time.
///
/// If the value is set during compile time, it cannot be set at runtime. Setting it at runtime will return [`CUresult::CUDA_ERROR_NOT_PERMITTED`].
///
/// See [`cuFuncSetAttribute`], [`cuKernelSetAttribute`].
pub const CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH: CUfunction_attribute_enum = CUfunction_attribute_enum(
11,
);
/// The required cluster height in blocks.
///
/// The values must either all be 0 or all be positive. The validity of the cluster dimensions is otherwise checked at launch time.
///
/// If the value is set during compile time, it cannot be set at runtime. Setting it at runtime should return [`CUresult::CUDA_ERROR_NOT_PERMITTED`].
///
/// See [`cuFuncSetAttribute`], [`cuKernelSetAttribute`].
pub const CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT: CUfunction_attribute_enum = CUfunction_attribute_enum(
12,
);
/// The required cluster depth in blocks.
///
/// The values must either all be 0 or all be positive. The validity of the cluster dimensions is otherwise checked at launch time.
///
/// If the value is set during compile time, it cannot be set at runtime. Setting it at runtime should return [`CUresult::CUDA_ERROR_NOT_PERMITTED`].
///
/// See [`cuFuncSetAttribute`], [`cuKernelSetAttribute`].
pub const CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH: CUfunction_attribute_enum = CUfunction_attribute_enum(
13,
);
/// Whether the function can be launched with non-portable cluster size.
///
/// 1 is allowed, 0 is disallowed. A non-portable cluster 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 hardware platform.
///
/// CUDA API provides cudaOccupancyMaxActiveClusters to assist with checking whether the desired size can be launched on the current device.
///
/// Portable Cluster Size
///
/// A portable cluster size is guaranteed to be functional on all compute capabilities higher than the target compute capability. The portable cluster size for sm_90 is 8 blocks per cluster. This value may increase for future compute capabilities.
///
/// The specific hardware unit may support higher cluster sizes that’s not guaranteed to be portable.
///
/// See [`cuFuncSetAttribute`], [`cuKernelSetAttribute`].
pub const CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED: CUfunction_attribute_enum = CUfunction_attribute_enum(
14,
);
/// The block scheduling policy of a function.
///
/// The value type is CUclusterSchedulingPolicy / cudaClusterSchedulingPolicy.
///
/// See [`cuFuncSetAttribute`], [`cuKernelSetAttribute`].
pub const CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE: CUfunction_attribute_enum = CUfunction_attribute_enum(
15,
);
/// Whether the function can be updated on device.
///
/// 1 means device node update is supported, 0 is unsupported.
///
/// See [`cuFuncGetAttribute`].
pub const CU_FUNC_ATTRIBUTE_DEVICE_NODE_UPDATE_SUPPORTED: CUfunction_attribute_enum = CUfunction_attribute_enum(
16,
);
/// The shared memory mode of a function.
///
/// The value type is CUsharedMemoryMode / cudaSharedMemoryMode.
///
/// See [`cuFuncSetAttribute`], [`cuKernelSetAttribute`].
pub const CU_FUNC_ATTRIBUTE_SHARED_MEMORY_MODE: CUfunction_attribute_enum = CUfunction_attribute_enum(
17,
);
/// Upper-bound sentinel for CUDA function attribute selectors.
pub const CU_FUNC_ATTRIBUTE_MAX: CUfunction_attribute_enum = CUfunction_attribute_enum(
18,
);
}
/// Function properties
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUfunction_attribute_enum(pub ::core::ffi::c_uint);
pub use self::CUfunction_attribute_enum as CUfunction_attribute;
impl CUfunc_cache_enum {
/// no preference for shared memory or L1 (default).
pub const CU_FUNC_CACHE_PREFER_NONE: CUfunc_cache_enum = CUfunc_cache_enum(0);
/// prefer larger shared memory and smaller L1 cache.
pub const CU_FUNC_CACHE_PREFER_SHARED: CUfunc_cache_enum = CUfunc_cache_enum(1);
/// prefer larger L1 cache and smaller shared memory.
pub const CU_FUNC_CACHE_PREFER_L1: CUfunc_cache_enum = CUfunc_cache_enum(2);
/// prefer equal sized L1 cache and shared memory.
pub const CU_FUNC_CACHE_PREFER_EQUAL: CUfunc_cache_enum = CUfunc_cache_enum(3);
}
/// Function cache configurations
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUfunc_cache_enum(pub ::core::ffi::c_uint);
pub use self::CUfunc_cache_enum as CUfunc_cache;
impl CUsharedconfig_enum {
/// set default shared memory bank size.
pub const CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE: CUsharedconfig_enum = CUsharedconfig_enum(
0,
);
/// set shared memory bank width to four bytes.
pub const CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE: CUsharedconfig_enum = CUsharedconfig_enum(
1,
);
/// set shared memory bank width to eight bytes.
pub const CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE: CUsharedconfig_enum = CUsharedconfig_enum(
2,
);
}
/// Deprecated:
///
/// Shared memory configurations
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUsharedconfig_enum(pub ::core::ffi::c_uint);
pub use self::CUsharedconfig_enum as CUsharedconfig;
impl CUshared_carveout_enum {
/// No preference for shared memory or L1 (default).
pub const CU_SHAREDMEM_CARVEOUT_DEFAULT: CUshared_carveout_enum = CUshared_carveout_enum(
-1,
);
/// Prefer maximum available shared memory, minimum L1 cache.
pub const CU_SHAREDMEM_CARVEOUT_MAX_SHARED: CUshared_carveout_enum = CUshared_carveout_enum(
100,
);
/// Prefer maximum available L1 cache, minimum shared memory.
pub const CU_SHAREDMEM_CARVEOUT_MAX_L1: CUshared_carveout_enum = CUshared_carveout_enum(
0,
);
}
/// Shared memory carveout configurations. These may be passed to ::cuFuncSetAttribute or ::cuKernelSetAttribute
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUshared_carveout_enum(pub ::core::ffi::c_int);
pub use self::CUshared_carveout_enum as CUshared_carveout;
impl CUmemorytype_enum {
/// Host memory.
pub const CU_MEMORYTYPE_HOST: CUmemorytype_enum = CUmemorytype_enum(1);
/// Device memory.
pub const CU_MEMORYTYPE_DEVICE: CUmemorytype_enum = CUmemorytype_enum(2);
/// Array memory.
pub const CU_MEMORYTYPE_ARRAY: CUmemorytype_enum = CUmemorytype_enum(3);
/// Unified device or host memory.
pub const CU_MEMORYTYPE_UNIFIED: CUmemorytype_enum = CUmemorytype_enum(4);
}
/// Memory types
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemorytype_enum(pub ::core::ffi::c_uint);
pub use self::CUmemorytype_enum as CUmemorytype;
impl CUcomputemode_enum {
/// Default compute mode (Multiple contexts allowed per device).
pub const CU_COMPUTEMODE_DEFAULT: CUcomputemode_enum = CUcomputemode_enum(0);
/// Compute-prohibited mode (No contexts can be created on this device at this time).
pub const CU_COMPUTEMODE_PROHIBITED: CUcomputemode_enum = CUcomputemode_enum(2);
/// Compute-exclusive-process mode (Only one context used by a single process can be present on this device at a time).
pub const CU_COMPUTEMODE_EXCLUSIVE_PROCESS: CUcomputemode_enum = CUcomputemode_enum(
3,
);
}
/// Compute Modes
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUcomputemode_enum(pub ::core::ffi::c_uint);
pub use self::CUcomputemode_enum as CUcomputemode;
impl CUmem_advise_enum {
/// Data will mostly be read and only occasionally be written to.
pub const CU_MEM_ADVISE_SET_READ_MOSTLY: CUmem_advise_enum = CUmem_advise_enum(1);
/// Undo the effect of [`CUmem_advise_enum::CU_MEM_ADVISE_SET_READ_MOSTLY`].
pub const CU_MEM_ADVISE_UNSET_READ_MOSTLY: CUmem_advise_enum = CUmem_advise_enum(2);
/// Set the preferred location for the data as the specified device.
pub const CU_MEM_ADVISE_SET_PREFERRED_LOCATION: CUmem_advise_enum = CUmem_advise_enum(
3,
);
/// Clear the preferred location for the data.
pub const CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION: CUmem_advise_enum = CUmem_advise_enum(
4,
);
/// Data will be accessed by the specified device, so prevent page faults as much as possible.
pub const CU_MEM_ADVISE_SET_ACCESSED_BY: CUmem_advise_enum = CUmem_advise_enum(5);
/// Let the Unified Memory subsystem decide on the page faulting policy for the specified device.
pub const CU_MEM_ADVISE_UNSET_ACCESSED_BY: CUmem_advise_enum = CUmem_advise_enum(6);
}
/// Memory advise values
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmem_advise_enum(pub ::core::ffi::c_uint);
pub use self::CUmem_advise_enum as CUmem_advise;
impl CUmem_range_attribute_enum {
/// Whether the range will mostly be read and only occasionally be written to.
pub const CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY: CUmem_range_attribute_enum = CUmem_range_attribute_enum(
1,
);
/// The preferred location of the range.
pub const CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION: CUmem_range_attribute_enum = CUmem_range_attribute_enum(
2,
);
/// Memory range has [`CUmem_advise_enum::CU_MEM_ADVISE_SET_ACCESSED_BY`] set for specified device.
pub const CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY: CUmem_range_attribute_enum = CUmem_range_attribute_enum(
3,
);
/// The last location to which the range was prefetched.
pub const CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION: CUmem_range_attribute_enum = CUmem_range_attribute_enum(
4,
);
/// The preferred location type of the range.
pub const CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE: CUmem_range_attribute_enum = CUmem_range_attribute_enum(
5,
);
/// The preferred location id of the range.
pub const CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID: CUmem_range_attribute_enum = CUmem_range_attribute_enum(
6,
);
/// The last location type to which the range was prefetched.
pub const CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE: CUmem_range_attribute_enum = CUmem_range_attribute_enum(
7,
);
/// The last location id to which the range was prefetched.
pub const CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_ID: CUmem_range_attribute_enum = CUmem_range_attribute_enum(
8,
);
}
/// Attribute queried for a managed-memory address range.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmem_range_attribute_enum(pub ::core::ffi::c_uint);
pub use self::CUmem_range_attribute_enum as CUmem_range_attribute;
impl CUjit_option_enum {
/// Max number of registers that a thread may use.
///
/// Option type: unsigned int
///
/// Applies to: compiler only.
pub const CU_JIT_MAX_REGISTERS: CUjit_option_enum = CUjit_option_enum(0);
/// IN: Specifies minimum number of threads per block to target compilation for
///
/// OUT: Returns the number of threads the compiler actually targeted.
///
/// This restricts the resource utilization of the compiler (e.g. max registers) such that a block with the given number of threads should be able to launch based on register limitations. Note, this option does not currently take into account any other resource limitations, such as shared memory utilization.
///
/// Cannot be combined with
///
/// .
///
/// Option type: unsigned int.
pub const CU_JIT_THREADS_PER_BLOCK: CUjit_option_enum = CUjit_option_enum(1);
/// Overwrites the option value with the total wall clock time, in milliseconds, spent in the compiler and linker
///
/// Option type: float.
pub const CU_JIT_WALL_TIME: CUjit_option_enum = CUjit_option_enum(2);
/// Pointer to a buffer in which to print any log messages that are informational in nature (the buffer size is specified via option [`CUjit_option_enum::CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES`]
///
/// )
///
/// Option type: char \*.
pub const CU_JIT_INFO_LOG_BUFFER: CUjit_option_enum = CUjit_option_enum(3);
/// IN: Log buffer size in bytes.
///
/// Log messages will be capped at this size (including null terminator)
///
/// OUT: Amount of log buffer filled with messages
///
/// Option type: unsigned int
///
/// Applies to: compiler and linker.
pub const CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES: CUjit_option_enum = CUjit_option_enum(
4,
);
/// Pointer to a buffer in which to print any log messages that reflect errors (the buffer size is specified via option [`CUjit_option_enum::CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES`]
///
/// )
///
/// Option type: char \*.
pub const CU_JIT_ERROR_LOG_BUFFER: CUjit_option_enum = CUjit_option_enum(5);
/// IN: Log buffer size in bytes.
///
/// Log messages will be capped at this size (including null terminator)
///
/// OUT: Amount of log buffer filled with messages
///
/// Option type: unsigned int
///
/// Applies to: compiler and linker.
pub const CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES: CUjit_option_enum = CUjit_option_enum(
6,
);
/// Level of optimizations to apply to generated code (0 - 4), with 4 being the default and highest level of optimizations.
///
/// Option type: unsigned int
///
/// Applies to: compiler only.
pub const CU_JIT_OPTIMIZATION_LEVEL: CUjit_option_enum = CUjit_option_enum(7);
/// No option value required.
///
/// Determines the target based on the current attached context (default)
///
/// Option type: No option value needed.
pub const CU_JIT_TARGET_FROM_CUCONTEXT: CUjit_option_enum = CUjit_option_enum(8);
/// Target is chosen based on supplied [CUjit_target](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gae443308cb7ed1d52b85b487305779184).
///
/// Cannot be combined with [`CUjit_option_enum::CU_JIT_THREADS_PER_BLOCK`]
///
/// .
///
/// Option type: unsigned int for enumerated type.
pub const CU_JIT_TARGET: CUjit_option_enum = CUjit_option_enum(9);
/// Specifies choice of fallback strategy if matching cubin is not found.
///
/// Choice is based on supplied [CUjit_fallback](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1ga4a1a92ea65e18b06907b981848c282f2)
///
/// . This option cannot be used with cuLink\* APIs as the linker requires exact matches.
///
/// Option type: unsigned int for enumerated type.
pub const CU_JIT_FALLBACK_STRATEGY: CUjit_option_enum = CUjit_option_enum(10);
/// Specifies whether to create debug information in output (-g) (0: false, default)
///
/// Option type: int.
pub const CU_JIT_GENERATE_DEBUG_INFO: CUjit_option_enum = CUjit_option_enum(11);
/// Generate verbose log messages (0: false, default)
///
/// Option type: int.
pub const CU_JIT_LOG_VERBOSE: CUjit_option_enum = CUjit_option_enum(12);
/// Generate line number information (-lineinfo) (0: false, default)
///
/// Option type: int.
pub const CU_JIT_GENERATE_LINE_INFO: CUjit_option_enum = CUjit_option_enum(13);
/// Specifies whether to enable caching explicitly (-dlcm)
///
/// Choice is based on supplied ::CUjit_cacheMode_enum.
///
/// Option type: unsigned int for enumerated type ::CUjit_cacheMode_enum
///
/// Applies to: compiler only.
pub const CU_JIT_CACHE_MODE: CUjit_option_enum = CUjit_option_enum(14);
/// Deprecated: This jit option is deprecated and should not be used.
pub const CU_JIT_NEW_SM3X_OPT: CUjit_option_enum = CUjit_option_enum(15);
/// This jit option is used for internal purpose only.
pub const CU_JIT_FAST_COMPILE: CUjit_option_enum = CUjit_option_enum(16);
/// Array of device symbol names that will be relocated to the corresponding host addresses stored in [`CUjit_option_enum::CU_JIT_GLOBAL_SYMBOL_ADDRESSES`].
///
/// Must contain [`CUjit_option_enum::CU_JIT_GLOBAL_SYMBOL_COUNT`]
///
/// entries.
///
/// When loading a device module, driver will relocate all encountered unresolved symbols to the host addresses.
///
/// It is only allowed to register symbols that correspond to unresolved global variables.
///
/// It is illegal to register the same device symbol at multiple addresses.
///
/// Option type: const char \*\*
///
/// Applies to: dynamic linker only.
pub const CU_JIT_GLOBAL_SYMBOL_NAMES: CUjit_option_enum = CUjit_option_enum(17);
/// Array of host addresses that will be used to relocate corresponding device symbols stored in [`CUjit_option_enum::CU_JIT_GLOBAL_SYMBOL_NAMES`].
///
/// Must contain [`CUjit_option_enum::CU_JIT_GLOBAL_SYMBOL_COUNT`]
///
/// entries.
///
/// Option type: void \*\*.
pub const CU_JIT_GLOBAL_SYMBOL_ADDRESSES: CUjit_option_enum = CUjit_option_enum(18);
/// Number of entries in [`CUjit_option_enum::CU_JIT_GLOBAL_SYMBOL_NAMES`] and [`CUjit_option_enum::CU_JIT_GLOBAL_SYMBOL_ADDRESSES`] arrays.
///
/// Option type: unsigned int
///
/// Applies to: dynamic linker only.
pub const CU_JIT_GLOBAL_SYMBOL_COUNT: CUjit_option_enum = CUjit_option_enum(19);
/// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
pub const CU_JIT_LTO: CUjit_option_enum = CUjit_option_enum(20);
/// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
pub const CU_JIT_FTZ: CUjit_option_enum = CUjit_option_enum(21);
/// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
pub const CU_JIT_PREC_DIV: CUjit_option_enum = CUjit_option_enum(22);
/// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
pub const CU_JIT_PREC_SQRT: CUjit_option_enum = CUjit_option_enum(23);
/// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
pub const CU_JIT_FMA: CUjit_option_enum = CUjit_option_enum(24);
/// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
pub const CU_JIT_REFERENCED_KERNEL_NAMES: CUjit_option_enum = CUjit_option_enum(25);
/// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
pub const CU_JIT_REFERENCED_KERNEL_COUNT: CUjit_option_enum = CUjit_option_enum(26);
/// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
pub const CU_JIT_REFERENCED_VARIABLE_NAMES: CUjit_option_enum = CUjit_option_enum(
27,
);
/// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
pub const CU_JIT_REFERENCED_VARIABLE_COUNT: CUjit_option_enum = CUjit_option_enum(
28,
);
/// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
pub const CU_JIT_OPTIMIZE_UNUSED_DEVICE_VARIABLES: CUjit_option_enum = CUjit_option_enum(
29,
);
/// Generate position independent code (0: false)
///
/// Option type: int.
pub const CU_JIT_POSITION_INDEPENDENT_CODE: CUjit_option_enum = CUjit_option_enum(
30,
);
/// 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 is ignored when used together with [`CUjit_option_enum::CU_JIT_MAX_REGISTERS`] or [`CUjit_option_enum::CU_JIT_THREADS_PER_BLOCK`]. Optimizations based on this option need [`CUjit_option_enum::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 [`CUjit_option_enum::CU_JIT_OVERRIDE_DIRECTIVE_VALUES`]
///
/// to let this option take precedence over the PTX directive. Option type: unsigned int
///
/// Applies to: compiler only.
pub const CU_JIT_MIN_CTA_PER_SM: CUjit_option_enum = CUjit_option_enum(31);
/// Maximum number threads in a thread block, computed as the product of the maximum extent specifed for each dimension of the block.
///
/// This limit is guaranteed not to be exeeded in any invocation of the kernel. Exceeding the maximum number of threads results in runtime error or kernel launch failure. For kernels already using PTX directive .maxntid, this option will be ignored by default. Use [`CUjit_option_enum::CU_JIT_OVERRIDE_DIRECTIVE_VALUES`]
///
/// to let this option take precedence over the PTX directive. Option type: int
///
/// Applies to: compiler only.
pub const CU_JIT_MAX_THREADS_PER_BLOCK: CUjit_option_enum = CUjit_option_enum(32);
/// This option lets the values specified using [`CUjit_option_enum::CU_JIT_MAX_REGISTERS`], [`CUjit_option_enum::CU_JIT_THREADS_PER_BLOCK`], [`CUjit_option_enum::CU_JIT_MAX_THREADS_PER_BLOCK`] and [`CUjit_option_enum::CU_JIT_MIN_CTA_PER_SM`] take precedence over any PTX directives.
///
/// (0: Disable, default; 1: Enable) Option type: int
///
/// Applies to: compiler only.
pub const CU_JIT_OVERRIDE_DIRECTIVE_VALUES: CUjit_option_enum = CUjit_option_enum(
33,
);
/// This option specifies the maximum number of concurrent threads to use when running compiler optimizations.
///
/// If the specified 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 the underlying machine. Otherwise, if the option is N, then up to N threads will be used. Option type: unsigned int
///
/// Applies to: compiler only.
pub const CU_JIT_SPLIT_COMPILE: CUjit_option_enum = CUjit_option_enum(34);
/// This option specifies the maximum number of concurrent threads to use when compiling device code.
///
/// If the specified 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 the underlying 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 is set. Option type: unsigned int
///
/// Applies to: compiler and linker.
pub const CU_JIT_BINARY_LOADER_THREAD_COUNT: CUjit_option_enum = CUjit_option_enum(
35,
);
/// Upper-bound sentinel for CUDA JIT option selectors.
pub const CU_JIT_NUM_OPTIONS: CUjit_option_enum = CUjit_option_enum(36);
}
/// Online compiler and linker options
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUjit_option_enum(pub ::core::ffi::c_uint);
pub use self::CUjit_option_enum as CUjit_option;
impl CUjit_target_enum {
/// Compute device class 3.0.
pub const CU_TARGET_COMPUTE_30: CUjit_target_enum = CUjit_target_enum(30);
/// Compute device class 3.2.
pub const CU_TARGET_COMPUTE_32: CUjit_target_enum = CUjit_target_enum(32);
/// Compute device class 3.5.
pub const CU_TARGET_COMPUTE_35: CUjit_target_enum = CUjit_target_enum(35);
/// Compute device class 3.7.
pub const CU_TARGET_COMPUTE_37: CUjit_target_enum = CUjit_target_enum(37);
/// Compute device class 5.0.
pub const CU_TARGET_COMPUTE_50: CUjit_target_enum = CUjit_target_enum(50);
/// Compute device class 5.2.
pub const CU_TARGET_COMPUTE_52: CUjit_target_enum = CUjit_target_enum(52);
/// Compute device class 5.3.
pub const CU_TARGET_COMPUTE_53: CUjit_target_enum = CUjit_target_enum(53);
/// Compute device class 6.0.
pub const CU_TARGET_COMPUTE_60: CUjit_target_enum = CUjit_target_enum(60);
/// Compute device class 6.1.
pub const CU_TARGET_COMPUTE_61: CUjit_target_enum = CUjit_target_enum(61);
/// Compute device class 6.2.
pub const CU_TARGET_COMPUTE_62: CUjit_target_enum = CUjit_target_enum(62);
/// Compute device class 7.0.
pub const CU_TARGET_COMPUTE_70: CUjit_target_enum = CUjit_target_enum(70);
/// Compute device class 7.2.
pub const CU_TARGET_COMPUTE_72: CUjit_target_enum = CUjit_target_enum(72);
/// Compute device class 7.5.
pub const CU_TARGET_COMPUTE_75: CUjit_target_enum = CUjit_target_enum(75);
/// Compute device class 8.0.
pub const CU_TARGET_COMPUTE_80: CUjit_target_enum = CUjit_target_enum(80);
/// Compute device class 8.6.
pub const CU_TARGET_COMPUTE_86: CUjit_target_enum = CUjit_target_enum(86);
/// Compute device class 8.7.
pub const CU_TARGET_COMPUTE_87: CUjit_target_enum = CUjit_target_enum(87);
/// Compute device class 8.9.
pub const CU_TARGET_COMPUTE_89: CUjit_target_enum = CUjit_target_enum(89);
/// Compute device class 9.0.
pub const CU_TARGET_COMPUTE_90: CUjit_target_enum = CUjit_target_enum(90);
/// Compute device class 10.0.
pub const CU_TARGET_COMPUTE_100: CUjit_target_enum = CUjit_target_enum(100);
/// Compute device class 11.0.
pub const CU_TARGET_COMPUTE_110: CUjit_target_enum = CUjit_target_enum(110);
/// Compute device class 10.3.
pub const CU_TARGET_COMPUTE_103: CUjit_target_enum = CUjit_target_enum(103);
/// Compute device class 10.7.
pub const CU_TARGET_COMPUTE_107: CUjit_target_enum = CUjit_target_enum(107);
/// Compute device class 12.0.
pub const CU_TARGET_COMPUTE_120: CUjit_target_enum = CUjit_target_enum(120);
/// Compute device class 12.1.
///
/// Compute device class 9.0. with accelerated features.
pub const CU_TARGET_COMPUTE_121: CUjit_target_enum = CUjit_target_enum(121);
/// Compute capability 9.0 target with architecture-specific accelerated features.
pub const CU_TARGET_COMPUTE_90A: CUjit_target_enum = CUjit_target_enum(65626);
/// Compute capability 10.0 target with architecture-specific accelerated features.
pub const CU_TARGET_COMPUTE_100A: CUjit_target_enum = CUjit_target_enum(65636);
/// Compute capability 11.0 target with architecture-specific accelerated features.
pub const CU_TARGET_COMPUTE_110A: CUjit_target_enum = CUjit_target_enum(65646);
/// Compute capability 10.3 target with architecture-specific accelerated features.
pub const CU_TARGET_COMPUTE_103A: CUjit_target_enum = CUjit_target_enum(65639);
/// Compute capability 10.7 target with architecture-specific accelerated features.
pub const CU_TARGET_COMPUTE_107A: CUjit_target_enum = CUjit_target_enum(65643);
/// Compute capability 12.0 target with architecture-specific accelerated features.
pub const CU_TARGET_COMPUTE_120A: CUjit_target_enum = CUjit_target_enum(65656);
/// Compute capability 12.1 target with architecture-specific accelerated features.
pub const CU_TARGET_COMPUTE_121A: CUjit_target_enum = CUjit_target_enum(65657);
/// Compute capability 10.0 target with architecture-family features.
pub const CU_TARGET_COMPUTE_100F: CUjit_target_enum = CUjit_target_enum(131172);
/// Compute capability 11.0 target with architecture-family features.
pub const CU_TARGET_COMPUTE_110F: CUjit_target_enum = CUjit_target_enum(131182);
/// Compute capability 10.3 target with architecture-family features.
pub const CU_TARGET_COMPUTE_103F: CUjit_target_enum = CUjit_target_enum(131175);
/// Compute capability 10.7 target with architecture-family features.
pub const CU_TARGET_COMPUTE_107F: CUjit_target_enum = CUjit_target_enum(131179);
/// Compute capability 12.0 target with architecture-family features.
pub const CU_TARGET_COMPUTE_120F: CUjit_target_enum = CUjit_target_enum(131192);
/// Compute capability 12.1 target with architecture-family features.
pub const CU_TARGET_COMPUTE_121F: CUjit_target_enum = CUjit_target_enum(131193);
}
/// Online compilation targets
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUjit_target_enum(pub ::core::ffi::c_uint);
pub use self::CUjit_target_enum as CUjit_target;
impl CUjit_fallback_enum {
/// Prefer to compile ptx if exact binary match not found.
pub const CU_PREFER_PTX: CUjit_fallback_enum = CUjit_fallback_enum(0);
/// Prefer to fall back to compatible binary code if exact match not found.
pub const CU_PREFER_BINARY: CUjit_fallback_enum = CUjit_fallback_enum(1);
}
/// Cubin matching fallback strategies
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUjit_fallback_enum(pub ::core::ffi::c_uint);
pub use self::CUjit_fallback_enum as CUjit_fallback;
impl CUjit_cacheMode_enum {
/// Compile with no -dlcm flag specified.
pub const CU_JIT_CACHE_OPTION_NONE: CUjit_cacheMode_enum = CUjit_cacheMode_enum(0);
/// Compile with L1 cache disabled.
pub const CU_JIT_CACHE_OPTION_CG: CUjit_cacheMode_enum = CUjit_cacheMode_enum(1);
/// Compile with L1 cache enabled.
pub const CU_JIT_CACHE_OPTION_CA: CUjit_cacheMode_enum = CUjit_cacheMode_enum(2);
}
/// Caching modes for dlcm
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUjit_cacheMode_enum(pub ::core::ffi::c_uint);
pub use self::CUjit_cacheMode_enum as CUjit_cacheMode;
impl CUjitInputType_enum {
/// Compiled device-class-specific device code
///
/// Applicable options: none.
pub const CU_JIT_INPUT_CUBIN: CUjitInputType_enum = CUjitInputType_enum(0);
/// PTX source code
///
/// Applicable options: PTX compiler options.
pub const CU_JIT_INPUT_PTX: CUjitInputType_enum = CUjitInputType_enum(1);
/// Bundle of multiple cubins and/or PTX of some device code
///
/// Applicable options: PTX compiler options,.
pub const CU_JIT_INPUT_FATBINARY: CUjitInputType_enum = CUjitInputType_enum(2);
/// Host object with embedded device code
///
/// Applicable options: PTX compiler options,.
pub const CU_JIT_INPUT_OBJECT: CUjitInputType_enum = CUjitInputType_enum(3);
/// Archive of host objects with embedded device code
///
/// Applicable options: PTX compiler options,.
pub const CU_JIT_INPUT_LIBRARY: CUjitInputType_enum = CUjitInputType_enum(4);
/// Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0.
pub const CU_JIT_INPUT_NVVM: CUjitInputType_enum = CUjitInputType_enum(5);
/// Upper-bound sentinel for CUDA linker input formats.
pub const CU_JIT_NUM_INPUT_TYPES: CUjitInputType_enum = CUjitInputType_enum(6);
}
/// Device code formats
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUjitInputType_enum(pub ::core::ffi::c_uint);
pub use self::CUjitInputType_enum as CUjitInputType;
/// Incomplete native type used by [`CUlinkState`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUlinkState_st {
_unused: [u8; 0],
}
/// Opaque state of a CUDA driver JIT linking session, created by [`cuLinkCreate_v2`] and released by [`cuLinkDestroy`].
pub type CUlinkState = *mut CUlinkState_st;
impl CUgraphicsRegisterFlags_enum {
/// Default registration behavior without additional access hints.
pub const CU_GRAPHICS_REGISTER_FLAGS_NONE: CUgraphicsRegisterFlags_enum = CUgraphicsRegisterFlags_enum(
0,
);
/// Hints that CUDA will only read the registered resource.
pub const CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY: CUgraphicsRegisterFlags_enum = CUgraphicsRegisterFlags_enum(
1,
);
/// Hints that CUDA will overwrite the registered resource without reading its previous contents.
pub const CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD: CUgraphicsRegisterFlags_enum = CUgraphicsRegisterFlags_enum(
2,
);
/// Allows binding the registered image to a CUDA surface for load and store operations.
pub const CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST: CUgraphicsRegisterFlags_enum = CUgraphicsRegisterFlags_enum(
4,
);
/// Allows texture-gather operations on the registered image.
pub const CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER: CUgraphicsRegisterFlags_enum = CUgraphicsRegisterFlags_enum(
8,
);
}
/// Flags to register a graphics resource
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUgraphicsRegisterFlags_enum(pub ::core::ffi::c_uint);
pub use self::CUgraphicsRegisterFlags_enum as CUgraphicsRegisterFlags;
impl CUgraphicsMapResourceFlags_enum {
/// Specifies no hints about how this resource will be used. It is therefore assumed that this resource will be read from and written to by CUDA kernels. This is the default value.
pub const CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE: CUgraphicsMapResourceFlags_enum = CUgraphicsMapResourceFlags_enum(
0,
);
/// Hints that CUDA will only read the mapped resource.
pub const CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY: CUgraphicsMapResourceFlags_enum = CUgraphicsMapResourceFlags_enum(
1,
);
/// Hints that CUDA will overwrite the mapped resource without reading its previous contents.
pub const CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD: CUgraphicsMapResourceFlags_enum = CUgraphicsMapResourceFlags_enum(
2,
);
}
/// Flags for mapping and unmapping interop resources
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUgraphicsMapResourceFlags_enum(pub ::core::ffi::c_uint);
pub use self::CUgraphicsMapResourceFlags_enum as CUgraphicsMapResourceFlags;
impl CUarray_cubemap_face_enum {
/// Positive X face of cubemap.
pub const CU_CUBEMAP_FACE_POSITIVE_X: CUarray_cubemap_face_enum = CUarray_cubemap_face_enum(
0,
);
/// Negative X face of cubemap.
pub const CU_CUBEMAP_FACE_NEGATIVE_X: CUarray_cubemap_face_enum = CUarray_cubemap_face_enum(
1,
);
/// Positive Y face of cubemap.
pub const CU_CUBEMAP_FACE_POSITIVE_Y: CUarray_cubemap_face_enum = CUarray_cubemap_face_enum(
2,
);
/// Negative Y face of cubemap.
pub const CU_CUBEMAP_FACE_NEGATIVE_Y: CUarray_cubemap_face_enum = CUarray_cubemap_face_enum(
3,
);
/// Positive Z face of cubemap.
pub const CU_CUBEMAP_FACE_POSITIVE_Z: CUarray_cubemap_face_enum = CUarray_cubemap_face_enum(
4,
);
/// Negative Z face of cubemap.
pub const CU_CUBEMAP_FACE_NEGATIVE_Z: CUarray_cubemap_face_enum = CUarray_cubemap_face_enum(
5,
);
}
/// Array indices for cube faces
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUarray_cubemap_face_enum(pub ::core::ffi::c_uint);
pub use self::CUarray_cubemap_face_enum as CUarray_cubemap_face;
impl CUlimit_enum {
/// GPU thread stack size.
pub const CU_LIMIT_STACK_SIZE: CUlimit_enum = CUlimit_enum(0);
/// GPU printf FIFO size.
pub const CU_LIMIT_PRINTF_FIFO_SIZE: CUlimit_enum = CUlimit_enum(1);
/// GPU malloc heap size.
pub const CU_LIMIT_MALLOC_HEAP_SIZE: CUlimit_enum = CUlimit_enum(2);
/// GPU device runtime launch synchronize depth.
pub const CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH: CUlimit_enum = CUlimit_enum(3);
/// GPU device runtime pending launch count.
pub const CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT: CUlimit_enum = CUlimit_enum(4);
/// A value between 0 and 128 that indicates the maximum fetch granularity of L2 (in Bytes).
///
/// This is a hint.
pub const CU_LIMIT_MAX_L2_FETCH_GRANULARITY: CUlimit_enum = CUlimit_enum(5);
/// A size in bytes for L2 persisting lines cache size.
pub const CU_LIMIT_PERSISTING_L2_CACHE_SIZE: CUlimit_enum = CUlimit_enum(6);
/// A maximum size in bytes of shared memory available to CUDA kernels on a CIG context.
///
/// Can only be queried, cannot be set.
pub const CU_LIMIT_SHMEM_SIZE: CUlimit_enum = CUlimit_enum(7);
/// A non-zero value indicates this CUDA context is a CIG-enabled context.
///
/// Can only be queried, cannot be set.
pub const CU_LIMIT_CIG_ENABLED: CUlimit_enum = CUlimit_enum(8);
/// 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 more shared memory than available.
pub const CU_LIMIT_CIG_SHMEM_FALLBACK_ENABLED: CUlimit_enum = CUlimit_enum(9);
/// Per-block memory size.
pub const CU_LIMIT_PER_BLOCK_MEMORY_SIZE: CUlimit_enum = CUlimit_enum(10);
/// Reserved upper-bound sentinel for native device limits.
pub const CU_LIMIT_MAX: CUlimit_enum = CUlimit_enum(11);
}
/// Limits
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlimit_enum(pub ::core::ffi::c_uint);
pub use self::CUlimit_enum as CUlimit;
impl CUresourcetype_enum {
/// Array resource.
pub const CU_RESOURCE_TYPE_ARRAY: CUresourcetype_enum = CUresourcetype_enum(0);
/// Mipmapped array resource.
pub const CU_RESOURCE_TYPE_MIPMAPPED_ARRAY: CUresourcetype_enum = CUresourcetype_enum(
1,
);
/// Linear resource.
pub const CU_RESOURCE_TYPE_LINEAR: CUresourcetype_enum = CUresourcetype_enum(2);
/// Pitch 2D resource.
pub const CU_RESOURCE_TYPE_PITCH2D: CUresourcetype_enum = CUresourcetype_enum(3);
}
/// Resource types
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUresourcetype_enum(pub ::core::ffi::c_uint);
pub use self::CUresourcetype_enum as CUresourcetype;
/// CUDA host function.
pub type CUhostFn = ::core::option::Option<
unsafe extern "C" fn(userData: *mut ::core::ffi::c_void),
>;
impl CUaccessProperty_enum {
/// Normal cache persistence.
pub const CU_ACCESS_PROPERTY_NORMAL: CUaccessProperty_enum = CUaccessProperty_enum(
0,
);
/// Streaming access is less likely to persit from cache.
pub const CU_ACCESS_PROPERTY_STREAMING: CUaccessProperty_enum = CUaccessProperty_enum(
1,
);
/// Persisting access is more likely to persist in cache.
pub const CU_ACCESS_PROPERTY_PERSISTING: CUaccessProperty_enum = CUaccessProperty_enum(
2,
);
}
/// Specifies performance hint with ::CUaccessPolicyWindow for hitProp and missProp members.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUaccessProperty_enum(pub ::core::ffi::c_uint);
pub use self::CUaccessProperty_enum as CUaccessProperty;
/// Specifies an access policy for a window, a contiguous extent of memory beginning at base_ptr and ending at base_ptr + num_bytes. num_bytes is limited by CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE. Partition into many segments and assign segments such that: sum of "hit segments" / window == approx. ratio. sum of "miss segments" / window == approx 1-ratio. Segments and ratio specifications are fitted to the capabilities of the architecture. Accesses in a hit segment apply the hitProp access policy. Accesses in a miss segment apply the missProp access policy.
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialOrd, PartialEq)]
pub struct CUaccessPolicyWindow_st {
/// Starting address of the access policy window. CUDA driver may align it.
pub base_ptr: *mut ::core::ffi::c_void,
/// Size in bytes of the window policy. CUDA driver may restrict the maximum size and alignment.
pub num_bytes: size_t,
/// hitRatio specifies percentage of lines assigned hitProp, rest are assigned missProp.
pub hitRatio: f32,
/// ::CUaccessProperty set for hit.
pub hitProp: CUaccessProperty,
/// ::CUaccessProperty set for miss. Must be either NORMAL or STREAMING
pub missProp: CUaccessProperty,
}
impl Default for CUaccessPolicyWindow_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Specifies an access policy for a window, a contiguous extent of memory beginning at base_ptr and ending at base_ptr + num_bytes.
///
/// num_bytes is limited by [`CUdevice_attribute::CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE`]. Partition into many segments and assign segments such that: sum of “hit segments” / window == approx. ratio. sum of “miss segments” / window == approx 1-ratio. Segments and ratio specifications are fitted to the capabilities of the architecture. Accesses in a hit segment apply the hitProp access policy. Accesses in a miss segment apply the missProp access policy.
pub type CUaccessPolicyWindow_v1 = CUaccessPolicyWindow_st;
/// Access policy window.
pub type CUaccessPolicyWindow = CUaccessPolicyWindow_v1;
/// GPU kernel node parameters
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_KERNEL_NODE_PARAMS_st {
/// Kernel to launch
pub func: CUfunction,
/// Width of grid in blocks
pub gridDimX: ::core::ffi::c_uint,
/// Height of grid in blocks
pub gridDimY: ::core::ffi::c_uint,
/// Depth of grid in blocks
pub gridDimZ: ::core::ffi::c_uint,
/// X dimension of each thread block
pub blockDimX: ::core::ffi::c_uint,
/// Y dimension of each thread block
pub blockDimY: ::core::ffi::c_uint,
/// Z dimension of each thread block
pub blockDimZ: ::core::ffi::c_uint,
/// Dynamic shared-memory size per thread block in bytes
pub sharedMemBytes: ::core::ffi::c_uint,
/// Array of pointers to kernel parameters
pub kernelParams: *mut *mut ::core::ffi::c_void,
/// Extra options
pub extra: *mut *mut ::core::ffi::c_void,
}
impl Default for CUDA_KERNEL_NODE_PARAMS_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// GPU kernel node parameters.
pub type CUDA_KERNEL_NODE_PARAMS_v1 = CUDA_KERNEL_NODE_PARAMS_st;
/// GPU kernel node parameters
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_KERNEL_NODE_PARAMS_v2_st {
/// Kernel to launch
pub func: CUfunction,
/// Width of grid in blocks
pub gridDimX: ::core::ffi::c_uint,
/// Height of grid in blocks
pub gridDimY: ::core::ffi::c_uint,
/// Depth of grid in blocks
pub gridDimZ: ::core::ffi::c_uint,
/// X dimension of each thread block
pub blockDimX: ::core::ffi::c_uint,
/// Y dimension of each thread block
pub blockDimY: ::core::ffi::c_uint,
/// Z dimension of each thread block
pub blockDimZ: ::core::ffi::c_uint,
/// Dynamic shared-memory size per thread block in bytes
pub sharedMemBytes: ::core::ffi::c_uint,
/// Array of pointers to kernel parameters
pub kernelParams: *mut *mut ::core::ffi::c_void,
/// Extra options
pub extra: *mut *mut ::core::ffi::c_void,
/// Kernel to launch, will only be referenced if func is NULL
pub kern: CUkernel,
/// Context for the kernel task to run in. The value NULL will indicate the current context should be used by the api. This field is ignored if func is set.
pub ctx: CUcontext,
}
impl Default for CUDA_KERNEL_NODE_PARAMS_v2_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// GPU kernel node parameters.
pub type CUDA_KERNEL_NODE_PARAMS_v2 = CUDA_KERNEL_NODE_PARAMS_v2_st;
/// GPU kernel node parameters
pub type CUDA_KERNEL_NODE_PARAMS = CUDA_KERNEL_NODE_PARAMS_v2;
/// GPU kernel node parameters
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_KERNEL_NODE_PARAMS_v3_st {
/// Kernel to launch
pub func: CUfunction,
/// Width of grid in blocks
pub gridDimX: ::core::ffi::c_uint,
/// Height of grid in blocks
pub gridDimY: ::core::ffi::c_uint,
/// Depth of grid in blocks
pub gridDimZ: ::core::ffi::c_uint,
/// X dimension of each thread block
pub blockDimX: ::core::ffi::c_uint,
/// Y dimension of each thread block
pub blockDimY: ::core::ffi::c_uint,
/// Z dimension of each thread block
pub blockDimZ: ::core::ffi::c_uint,
/// Dynamic shared-memory size per thread block in bytes
pub sharedMemBytes: ::core::ffi::c_uint,
/// Array of pointers to kernel parameters
pub kernelParams: *mut *mut ::core::ffi::c_void,
/// Extra options
pub extra: *mut *mut ::core::ffi::c_void,
/// Kernel to launch, will only be referenced if func is NULL
pub kern: CUkernel,
/// Context for the kernel task to run in. The value NULL will indicate the current context should be used by the api. This field is ignored if func is set.
pub ctx: CUcontext,
}
impl Default for CUDA_KERNEL_NODE_PARAMS_v3_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// GPU kernel node parameters.
pub type CUDA_KERNEL_NODE_PARAMS_v3 = CUDA_KERNEL_NODE_PARAMS_v3_st;
/// Memset node parameters
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_MEMSET_NODE_PARAMS_st {
/// Destination device pointer
pub dst: CUdeviceptr,
/// Pitch of destination device pointer. Unused if height is 1
pub pitch: size_t,
/// Value to be set
pub value: ::core::ffi::c_uint,
/// Size of each element in bytes. Must be 1, 2, or 4.
pub elementSize: ::core::ffi::c_uint,
/// Width of the row in elements
pub width: size_t,
/// Number of rows
pub height: size_t,
}
/// Memset node parameters.
pub type CUDA_MEMSET_NODE_PARAMS_v1 = CUDA_MEMSET_NODE_PARAMS_st;
/// Memset node parameters
pub type CUDA_MEMSET_NODE_PARAMS = CUDA_MEMSET_NODE_PARAMS_v1;
/// Memset node parameters
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_MEMSET_NODE_PARAMS_v2_st {
/// Destination device pointer
pub dst: CUdeviceptr,
/// Pitch of destination device pointer. Unused if height is 1
pub pitch: size_t,
/// Value to be set
pub value: ::core::ffi::c_uint,
/// Size of each element in bytes. Must be 1, 2, or 4.
pub elementSize: ::core::ffi::c_uint,
/// Width of the row in elements
pub width: size_t,
/// Number of rows
pub height: size_t,
/// Context on which to run the node
pub ctx: CUcontext,
}
impl Default for CUDA_MEMSET_NODE_PARAMS_v2_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Memset node parameters.
pub type CUDA_MEMSET_NODE_PARAMS_v2 = CUDA_MEMSET_NODE_PARAMS_v2_st;
/// Host node parameters
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_HOST_NODE_PARAMS_st {
/// The function to call when the node executes
pub fn_: CUhostFn,
/// Argument to pass to the function
pub userData: *mut ::core::ffi::c_void,
}
impl Default for CUDA_HOST_NODE_PARAMS_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Host node parameters.
pub type CUDA_HOST_NODE_PARAMS_v1 = CUDA_HOST_NODE_PARAMS_st;
/// Host node parameters
pub type CUDA_HOST_NODE_PARAMS = CUDA_HOST_NODE_PARAMS_v1;
/// Host node parameters
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUDA_HOST_NODE_PARAMS_v2_st {
/// The function to call when the node executes
pub fn_: CUhostFn,
/// Argument to pass to the function
pub userData: *mut ::core::ffi::c_void,
/// The sync mode to use for the host task
pub syncMode: ::core::ffi::c_uint,
/// Anonymous native member. See [`CUDA_HOST_NODE_PARAMS_v2_st__bindgen_ty_1`] for its fields.
pub __bindgen_anon_1: CUDA_HOST_NODE_PARAMS_v2_st__bindgen_ty_1,
}
/// preferred context to use for the host task
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUDA_HOST_NODE_PARAMS_v2_st__bindgen_ty_1 {
/// Preferred CUDA context for the host task.
pub ctx: CUcontext,
/// Preferred green context for the host task.
pub gCtx: CUgreenCtx,
}
impl Default for CUDA_HOST_NODE_PARAMS_v2_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUDA_HOST_NODE_PARAMS_v2_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Host node parameters.
pub type CUDA_HOST_NODE_PARAMS_v2 = CUDA_HOST_NODE_PARAMS_v2_st;
impl CUgraphConditionalNodeType_enum {
/// 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.
pub const CU_GRAPH_COND_TYPE_IF: CUgraphConditionalNodeType_enum = CUgraphConditionalNodeType_enum(
0,
);
/// Conditional ‘while’ Node.
///
/// Body executed repeatedly while condition value is non-zero.
pub const CU_GRAPH_COND_TYPE_WHILE: CUgraphConditionalNodeType_enum = CUgraphConditionalNodeType_enum(
1,
);
/// Conditional ‘switch’ Node.
///
/// Body\[n\] is executed once, where ‘n’ is the value of the condition. If the condition does not match a body index, no body is launched.
pub const CU_GRAPH_COND_TYPE_SWITCH: CUgraphConditionalNodeType_enum = CUgraphConditionalNodeType_enum(
2,
);
}
/// Conditional node types
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUgraphConditionalNodeType_enum(pub ::core::ffi::c_uint);
pub use self::CUgraphConditionalNodeType_enum as CUgraphConditionalNodeType;
/// Conditional node parameters.
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_CONDITIONAL_NODE_PARAMS {
/// Conditional node handle.
///
/// Handles must be created in advance of creating the node using [`cuGraphConditionalHandleCreate`].
pub handle: CUgraphConditionalHandle,
/// Type of conditional node.
pub type_: CUgraphConditionalNodeType,
/// 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 greater than zero for [`CUgraphConditionalNodeType::CU_GRAPH_COND_TYPE_SWITCH`].
pub size: ::core::ffi::c_uint,
/// CUDA-owned array populated with conditional node child graphs during creation of the node.
///
/// Valid for the lifetime of the conditional node. The contents of the graph(s) are subject to the following constraints:
///
/// These graphs may be populated using graph node creation APIs or [`cuStreamBeginCaptureToGraph`].
///
/// [`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 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. If the condition >= `size`, no body graph is executed.
pub phGraph_out: *mut CUgraph,
/// Context on which to run the node.
///
/// Must match context used to create the handle and all body nodes.
pub ctx: CUcontext,
}
impl Default for CUDA_CONDITIONAL_NODE_PARAMS {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl CUgraphNodeType_enum {
/// GPU kernel node.
pub const CU_GRAPH_NODE_TYPE_KERNEL: CUgraphNodeType_enum = CUgraphNodeType_enum(0);
/// Memcpy node.
pub const CU_GRAPH_NODE_TYPE_MEMCPY: CUgraphNodeType_enum = CUgraphNodeType_enum(1);
/// Memset node.
pub const CU_GRAPH_NODE_TYPE_MEMSET: CUgraphNodeType_enum = CUgraphNodeType_enum(2);
/// Host (executable) node.
pub const CU_GRAPH_NODE_TYPE_HOST: CUgraphNodeType_enum = CUgraphNodeType_enum(3);
/// Node which executes an embedded graph.
pub const CU_GRAPH_NODE_TYPE_GRAPH: CUgraphNodeType_enum = CUgraphNodeType_enum(4);
/// Empty (no-op) node.
pub const CU_GRAPH_NODE_TYPE_EMPTY: CUgraphNodeType_enum = CUgraphNodeType_enum(5);
/// External event wait node.
pub const CU_GRAPH_NODE_TYPE_WAIT_EVENT: CUgraphNodeType_enum = CUgraphNodeType_enum(
6,
);
/// External event record node.
pub const CU_GRAPH_NODE_TYPE_EVENT_RECORD: CUgraphNodeType_enum = CUgraphNodeType_enum(
7,
);
/// External semaphore signal node.
pub const CU_GRAPH_NODE_TYPE_EXT_SEMAS_SIGNAL: CUgraphNodeType_enum = CUgraphNodeType_enum(
8,
);
/// External semaphore wait node.
pub const CU_GRAPH_NODE_TYPE_EXT_SEMAS_WAIT: CUgraphNodeType_enum = CUgraphNodeType_enum(
9,
);
/// Memory Allocation Node.
pub const CU_GRAPH_NODE_TYPE_MEM_ALLOC: CUgraphNodeType_enum = CUgraphNodeType_enum(
10,
);
/// Memory Free Node.
pub const CU_GRAPH_NODE_TYPE_MEM_FREE: CUgraphNodeType_enum = CUgraphNodeType_enum(
11,
);
/// Batch MemOp Node See cuStreamBatchMemOp and [CUstreamBatchMemOpType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gab257b534afdb704b6ebdb99c16a5b292) for what these nodes can do.
pub const CU_GRAPH_NODE_TYPE_BATCH_MEM_OP: CUgraphNodeType_enum = CUgraphNodeType_enum(
12,
);
/// Conditional Node.
pub const CU_GRAPH_NODE_TYPE_CONDITIONAL: CUgraphNodeType_enum = CUgraphNodeType_enum(
13,
);
/// Reserved.
pub const CU_GRAPH_NODE_TYPE_RESERVED_16: CUgraphNodeType_enum = CUgraphNodeType_enum(
16,
);
}
/// Graph node types
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUgraphNodeType_enum(pub ::core::ffi::c_uint);
pub use self::CUgraphNodeType_enum as CUgraphNodeType;
impl CUgraphDependencyType_enum {
/// This is an ordinary dependency.
pub const CU_GRAPH_DEPENDENCY_TYPE_DEFAULT: CUgraphDependencyType_enum = CUgraphDependencyType_enum(
0,
);
/// 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.
pub const CU_GRAPH_DEPENDENCY_TYPE_PROGRAMMATIC: CUgraphDependencyType_enum = CUgraphDependencyType_enum(
1,
);
}
/// Type annotations that can be applied to graph edges as part of ::CUgraphEdgeData.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUgraphDependencyType_enum(pub ::core::ffi::c_uint);
pub use self::CUgraphDependencyType_enum as CUgraphDependencyType;
/// Optional annotation for edges in a CUDA graph. Note, all edges implicitly have annotations and default to a zero-initialized value if not specified. A zero-initialized struct indicates a standard full serialization of two nodes with memory visibility.
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUgraphEdgeData_st {
/// This indicates when the dependency is triggered from the upstream node on the edge. The meaning is specfic to the node type. A value of 0 in all cases means full completion of the upstream node, with memory visibility to the downstream node or portion thereof (indicated by `to_port)`. <br> Only kernel nodes define non-zero ports. A kernel node can use the following output port types: ::CU_GRAPH_KERNEL_NODE_PORT_DEFAULT, ::CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC, or ::CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER.
pub from_port: ::core::ffi::c_uchar,
/// This indicates what portion of the downstream node is dependent on the upstream node or portion thereof (indicated by `from_port)`. The meaning is specific to the node type. A value of 0 in all cases means the entirety of the downstream node is dependent on the upstream work. <br> Currently no node types define non-zero ports. Accordingly, this field must be set to zero.
pub to_port: ::core::ffi::c_uchar,
/// This should be populated with a value from ::CUgraphDependencyType. (It is typed as char due to compiler-specific layout of bitfields.) See ::CUgraphDependencyType.
pub type_: ::core::ffi::c_uchar,
/// These bytes are unused and must be zeroed. This ensures compatibility if additional fields are added in the future.
pub reserved: [::core::ffi::c_uchar; 5usize],
}
/// Optional annotation for edges in a CUDA graph.
///
/// Note, all edges implicitly have annotations and default to a zero-initialized value if not specified. A zero-initialized struct indicates a standard full serialization of two nodes with memory visibility.
pub type CUgraphEdgeData = CUgraphEdgeData_st;
impl CUgraphInstantiateResult_enum {
/// Instantiation succeeded.
pub const CUDA_GRAPH_INSTANTIATE_SUCCESS: CUgraphInstantiateResult_enum = CUgraphInstantiateResult_enum(
0,
);
/// Instantiation failed for an unexpected reason which is described in the return value of the function.
pub const CUDA_GRAPH_INSTANTIATE_ERROR: CUgraphInstantiateResult_enum = CUgraphInstantiateResult_enum(
1,
);
/// Instantiation failed due to invalid structure, such as cycles.
pub const CUDA_GRAPH_INSTANTIATE_INVALID_STRUCTURE: CUgraphInstantiateResult_enum = CUgraphInstantiateResult_enum(
2,
);
/// Instantiation for device launch failed because the graph contained an unsupported operation.
pub const CUDA_GRAPH_INSTANTIATE_NODE_OPERATION_NOT_SUPPORTED: CUgraphInstantiateResult_enum = CUgraphInstantiateResult_enum(
3,
);
/// Instantiation for device launch failed due to the nodes belonging to different contexts.
pub const CUDA_GRAPH_INSTANTIATE_MULTIPLE_CTXS_NOT_SUPPORTED: CUgraphInstantiateResult_enum = CUgraphInstantiateResult_enum(
4,
);
/// One or more conditional handles are not associated with conditional nodes.
pub const CUDA_GRAPH_INSTANTIATE_CONDITIONAL_HANDLE_UNUSED: CUgraphInstantiateResult_enum = CUgraphInstantiateResult_enum(
5,
);
}
/// Graph instantiation results
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUgraphInstantiateResult_enum(pub ::core::ffi::c_uint);
pub use self::CUgraphInstantiateResult_enum as CUgraphInstantiateResult;
/// Graph instantiation parameters
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_GRAPH_INSTANTIATE_PARAMS_st {
/// Instantiation flags
pub flags: cuuint64_t,
/// Upload stream
pub hUploadStream: CUstream,
/// The node which caused instantiation to fail, if any
pub hErrNode_out: CUgraphNode,
/// Whether instantiation was successful. If it failed, the reason why
pub result_out: CUgraphInstantiateResult,
}
impl Default for CUDA_GRAPH_INSTANTIATE_PARAMS_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Graph instantiation parameters.
pub type CUDA_GRAPH_INSTANTIATE_PARAMS = CUDA_GRAPH_INSTANTIATE_PARAMS_st;
impl CUsynchronizationPolicy_enum {
/// Selects the synchronization policy automatically.
pub const CU_SYNC_POLICY_AUTO: CUsynchronizationPolicy_enum = CUsynchronizationPolicy_enum(
1,
);
/// Spins while waiting for completion.
pub const CU_SYNC_POLICY_SPIN: CUsynchronizationPolicy_enum = CUsynchronizationPolicy_enum(
2,
);
/// Yields the waiting thread while waiting for completion.
pub const CU_SYNC_POLICY_YIELD: CUsynchronizationPolicy_enum = CUsynchronizationPolicy_enum(
3,
);
/// Blocks the waiting thread until completion.
pub const CU_SYNC_POLICY_BLOCKING_SYNC: CUsynchronizationPolicy_enum = CUsynchronizationPolicy_enum(
4,
);
}
/// Policy used when synchronizing CUDA work.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUsynchronizationPolicy_enum(pub ::core::ffi::c_uint);
pub use self::CUsynchronizationPolicy_enum as CUsynchronizationPolicy;
impl CUclusterSchedulingPolicy_enum {
/// the default policy.
pub const CU_CLUSTER_SCHEDULING_POLICY_DEFAULT: CUclusterSchedulingPolicy_enum = CUclusterSchedulingPolicy_enum(
0,
);
/// spread the blocks within a cluster to the SMs.
pub const CU_CLUSTER_SCHEDULING_POLICY_SPREAD: CUclusterSchedulingPolicy_enum = CUclusterSchedulingPolicy_enum(
1,
);
/// allow the hardware to load-balance the blocks in a cluster to the SMs.
pub const CU_CLUSTER_SCHEDULING_POLICY_LOAD_BALANCING: CUclusterSchedulingPolicy_enum = CUclusterSchedulingPolicy_enum(
2,
);
/// Spread the blocks within a cluster to the SMs, and prefer placement that prioritizes Distributed Shared Memory locality for Rubin-class GPUs.
///
/// This is a preference only. The driver may ignore this request when the launch is not eligible, when the device does not support the requested placement behavior, or when other launch constraints take precedence.
///
/// This policy is intended for clustered kernels whose performance depends on communication through Distributed Shared Memory among blocks in the same cluster.
pub const CU_CLUSTER_SCHEDULING_POLICY_RUBIN_DSMEM_LOCALITY: CUclusterSchedulingPolicy_enum = CUclusterSchedulingPolicy_enum(
3,
);
}
/// Cluster scheduling policies. These may be passed to ::cuFuncSetAttribute or ::cuKernelSetAttribute
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUclusterSchedulingPolicy_enum(pub ::core::ffi::c_uint);
pub use self::CUclusterSchedulingPolicy_enum as CUclusterSchedulingPolicy;
impl CUlaunchMemSyncDomain_enum {
/// Launch kernels in the default domain.
pub const CU_LAUNCH_MEM_SYNC_DOMAIN_DEFAULT: CUlaunchMemSyncDomain_enum = CUlaunchMemSyncDomain_enum(
0,
);
/// Launch kernels in the remote domain.
pub const CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE: CUlaunchMemSyncDomain_enum = CUlaunchMemSyncDomain_enum(
1,
);
}
/// Memory Synchronization Domain
///
/// A kernel can be launched in a specified memory synchronization domain that affects all memory operations issued by that kernel. A memory barrier issued in one domain will only order memory operations in that domain, thus eliminating latency increase from memory barriers ordering unrelated traffic.
///
/// 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.
///
/// Memory operations done in kernels launched in different domains are considered system-scope distanced. In other words, a GPU scoped memory synchronization is not sufficient for memory order to be observed by kernels in another memory synchronization domain even if they are on the same GPU.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlaunchMemSyncDomain_enum(pub ::core::ffi::c_uint);
pub use self::CUlaunchMemSyncDomain_enum as CUlaunchMemSyncDomain;
/// Memory Synchronization Domain map
///
/// See ::cudaLaunchMemSyncDomain.
///
/// 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_MAP.
///
/// Domain ID range is available through ::CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT.
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlaunchMemSyncDomainMap_st {
/// The default domain ID to use for designated kernels
pub default_: ::core::ffi::c_uchar,
/// The remote domain ID to use for designated kernels
pub remote: ::core::ffi::c_uchar,
}
/// Memory Synchronization Domain map.
///
/// See ::cudaLaunchMemSyncDomain.
///
/// 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](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUlaunchMemSyncDomainMap.html#structculaunchmemsyncdomainmap) for a specific stream / graph node / kernel launch. See [`CUlaunchAttributeID_enum::CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP`].
///
/// Domain ID range is available through [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT`].
pub type CUlaunchMemSyncDomainMap = CUlaunchMemSyncDomainMap_st;
impl CUlaunchAttributePortableClusterMode_enum {
/// The default to use for allowing non-portable cluster size on launch - uses current function attribute for [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED`].
pub const CU_LAUNCH_PORTABLE_CLUSTER_MODE_DEFAULT: CUlaunchAttributePortableClusterMode_enum = CUlaunchAttributePortableClusterMode_enum(
0,
);
/// Specifies that the cluster size requested must be a portable size.
pub const CU_LAUNCH_PORTABLE_CLUSTER_MODE_REQUIRE_PORTABLE: CUlaunchAttributePortableClusterMode_enum = CUlaunchAttributePortableClusterMode_enum(
1,
);
/// Specifies that the cluster size requested may be a non-portable size.
pub const CU_LAUNCH_PORTABLE_CLUSTER_MODE_ALLOW_NON_PORTABLE: CUlaunchAttributePortableClusterMode_enum = CUlaunchAttributePortableClusterMode_enum(
2,
);
}
/// Enum for defining applicability of portable cluster size, used with ::cuLaunchKernelEx
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlaunchAttributePortableClusterMode_enum(pub ::core::ffi::c_uint);
pub use self::CUlaunchAttributePortableClusterMode_enum as CUlaunchAttributePortableClusterMode;
impl CUsharedMemoryMode_enum {
/// The default to use for shared memory on launch - uses current function attribute for [`CUfunction_attribute_enum::CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES`].
pub const CU_SHARED_MEMORY_MODE_DEFAULT: CUsharedMemoryMode_enum = CUsharedMemoryMode_enum(
0,
);
/// Specifies that the dynamic shared size bytes requested must be a portable size within the bounds of [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK`].
pub const CU_SHARED_MEMORY_MODE_REQUIRE_PORTABLE: CUsharedMemoryMode_enum = CUsharedMemoryMode_enum(
1,
);
/// Specifies that the dynamic shared size bytes requested may be a non-portable size but still within the bounds of [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN`].
pub const CU_SHARED_MEMORY_MODE_ALLOW_NON_PORTABLE: CUsharedMemoryMode_enum = CUsharedMemoryMode_enum(
2,
);
/// Specifies that oversized shared memory configurations may be used (with the limitation of only 8kB L1 cache).
pub const CU_SHARED_MEMORY_MODE_ALLOW_OVERSIZED_SHARED_MEMORY: CUsharedMemoryMode_enum = CUsharedMemoryMode_enum(
3,
);
/// Specifies that oversized shared memory configurations may be used (with the limitation of only 8kB L1 cache), and prefer an oversized shared memory configuration.
pub const CU_SHARED_MEMORY_MODE_PREFER_OVERSIZED_SHARED_MEMORY: CUsharedMemoryMode_enum = CUsharedMemoryMode_enum(
4,
);
}
/// Shared memory related attributes for use with ::cuLaunchKernelEx
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUsharedMemoryMode_enum(pub ::core::ffi::c_uint);
pub use self::CUsharedMemoryMode_enum as CUsharedMemoryMode;
impl CUlaunchAttributeID_enum {
/// Ignored entry, for convenient composition.
pub const CU_LAUNCH_ATTRIBUTE_IGNORE: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
0,
);
/// Valid for streams, graph nodes, launches.
///
/// See [CUlaunchAttributeValue::accessPolicyWindow](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/unionCUlaunchAttributeValue.html#unionculaunchattributevalue_1a154aa6110d2610fb68ec60bc9337073b).
pub const CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
1,
);
/// Valid for graph nodes, launches.
///
/// See [CUlaunchAttributeValue::cooperative](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/unionCUlaunchAttributeValue.html#unionculaunchattributevalue_1a3015f3dc785dce3a2c250b852457082a).
pub const CU_LAUNCH_ATTRIBUTE_COOPERATIVE: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
2,
);
/// Valid for streams.
///
/// See [CUlaunchAttributeValue::syncPolicy](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/unionCUlaunchAttributeValue.html#unionculaunchattributevalue_1abfc7b2566d09fbd679636513d5c07cd8).
pub const CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
3,
);
/// Valid for graph nodes, launches.
///
/// See [CUlaunchAttributeValue::clusterDim](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/unionCUlaunchAttributeValue.html#unionculaunchattributevalue_1a70d79310f04581a60df6069b7d7d432a).
pub const CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
4,
);
/// Valid for graph nodes, launches.
///
/// See [CUlaunchAttributeValue::clusterSchedulingPolicyPreference](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/unionCUlaunchAttributeValue.html#unionculaunchattributevalue_1a714fd4571d6ef99a53a20d378eebb2ba).
pub const CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
5,
);
/// Valid for launches.
///
/// Setting [CUlaunchAttributeValue::programmaticStreamSerializationAllowed](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/unionCUlaunchAttributeValue.html#unionculaunchattributevalue_1a21590ca9c3de21690d12d9c7f73917ab) to non-0 signals that the kernel will use programmatic means to resolve its stream dependency, so that the CUDA runtime should opportunistically allow the grid’s execution to overlap with the previous kernel in the stream, if that kernel requests the overlap. The dependent launches can choose to wait on the dependency using the programmatic sync (cudaGridDependencySynchronize() or equivalent PTX instructions).
pub const CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
6,
);
/// Valid for launches.
///
/// Set [CUlaunchAttributeValue::programmaticEvent](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/unionCUlaunchAttributeValue.html#unionculaunchattributevalue_1ae1eb628b29c538c9fb1e5a3d829b0777) to record the event. Event recorded through this launch attribute is guaranteed to only trigger after all block in the associated kernel trigger the event. A block can trigger the event through PTX launchdep.release or CUDA builtin function cudaTriggerProgrammaticLaunchCompletion(). A trigger can also be inserted at the beginning of each block’s execution if triggerAtBlockStart is set to non-0. The dependent launches can choose to wait on the dependency using the programmatic sync (cudaGridDependencySynchronize() 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 for establishing programmatic dependency between device tasks. Note also this type of dependency allows, but does not guarantee, concurrent execution of tasks.
///
/// The event supplied must not be an interprocess or interop event. The event must disable timing (i.e. must be created with the.
pub const CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
7,
);
/// Valid for streams, graph nodes, launches.
///
/// See [CUlaunchAttributeValue::priority](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/unionCUlaunchAttributeValue.html#unionculaunchattributevalue_1a8b3a370124a50866fcdb1c9cb5580e96).
pub const CU_LAUNCH_ATTRIBUTE_PRIORITY: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
8,
);
/// Valid for streams, graph nodes, launches.
///
/// See [CUlaunchAttributeValue::memSyncDomainMap](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/unionCUlaunchAttributeValue.html#unionculaunchattributevalue_1a34552cdc66a0a5373d8515108d9c63d6).
pub const CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
9,
);
/// Valid for streams, graph nodes, launches.
///
/// See [CUlaunchAttributeValue::memSyncDomain](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/unionCUlaunchAttributeValue.html#unionculaunchattributevalue_1a68b8301d88ce5c6e69fc5f08734e55a8).
pub const CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
10,
);
/// Valid for graph nodes, launches.
///
/// Set [CUlaunchAttributeValue::preferredClusterDim](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/unionCUlaunchAttributeValue.html#unionculaunchattributevalue_1ad78976fd10fa7429385d312a34df8c5a) to allow the kernel launch to specify a preferred substitute cluster dimension. Blocks may be grouped according to either the 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 multiple greater than zero of the regular cluster dimensions. The device will attempt - on a best-effort basis - to group thread blocks into preferred clusters over grouping them into regular clusters. When it deems necessary (primarily when the device temporarily runs out of physical resources to launch the larger preferred clusters), the device may switch to launch the regular clusters instead to attempt to utilize as much of the physical device resources as possible.
///
/// Each type of cluster will have its enumeration / coordinate setup as if the grid consists solely of its type of cluster. For example, if the preferred substitute cluster dimensions double the regular cluster dimensions, there might be simultaneously a regular cluster indexed at (1,0,0), and a preferred cluster indexed at (1,0,0). In this example, the preferred substitute cluster (1,0,0) replaces regular clusters (2,0,0) and (3,0,0) and groups their blocks.
pub const CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
11,
);
/// Valid for launches.
///
/// Set [CUlaunchAttributeValue::launchCompletionEvent](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/unionCUlaunchAttributeValue.html#unionculaunchattributevalue_1acbf92a20afbb58ef233b0d9facfb8940)
///
/// to record the event.
///
/// Nominally, the event is triggered once all blocks of the kernel have begun execution. Currently this is a best effort. If a kernel B has a launch completion dependency on a kernel A, B may wait until A is complete. Alternatively, blocks of B may begin before all blocks of A have begun, for example if B can claim execution resources unavailable to A (e.g. they run on different GPUs) or if B is a higher priority than A. Exercise caution if such an ordering inversion could lead to deadlock.
///
/// set except that it is not visible to cudaGridDependencySynchronize() and can be used with compute capability less than 9.0.
///
/// The event supplied must not be an interprocess or interop event. The event must disable timing (i.e. must be created with the.
pub const CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
12,
);
/// Valid for graph nodes, launches.
///
/// This attribute is graphs-only, and passing it to a launch in a non-capturing stream will result in an error.
///
/// ::CUlaunchAttributeValue::deviceUpdatableKernelNode::deviceUpdatable can only be set to 0 or 1. Setting the field to 1 indicates that the corresponding kernel node should be device-updatable. On success, a handle will be returned via ::CUlaunchAttributeValue::deviceUpdatableKernelNode::devNode which can be passed to the various device-side update functions to update the node’s kernel parameters from within another kernel. For more information on the types of device updates that can be made, as well as the relevant limitations thereof, see ::cudaGraphKernelNodeUpdatesApply.
///
/// . Graphs containing one or more device-updatable nodes also do not allow multiple instantiation, and neither the graph nor its instantiated version can be passed to cuGraphExecUpdate.
///
/// If a graph contains device-updatable nodes and updates those nodes from the device from within the graph, the graph must be uploaded with.
pub const CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
13,
);
/// 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/unionCUlaunchAttributeValue.html#unionculaunchattributevalue_1ab4890866538ded7d27e648d399caaff2) to a percentage between 0-100 signals the CUDA driver to set the shared memory carveout preference, in percent of the total shared memory for that kernel launch. This attribute takes precedence over [`CUfunction_attribute_enum::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.
pub const CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
14,
);
/// Valid for streams, graph nodes, launches.
///
/// This attribute is a hint to the CUDA runtime that the launch should attempt to make the kernel maximize its NVLINK utilization.
///
/// When possible to honor this hint, CUDA will assume each block in the grid launch will carry out an even amount of NVLINK traffic, and make a best-effort attempt to adjust the kernel launch based on that assumption.
///
/// This attribute is a hint only. CUDA makes no functional or performance guarantee. Its applicability can be affected by many different factors, including driver version (i.e. CUDA doesn’t guarantee the performance characteristics will be maintained between driver versions or a driver update could alter or regress previously observed perf characteristics.) It also doesn’t guarantee a successful result, i.e. applying the attribute may not improve the performance of either the targeted kernel or the encapsulating application.
///
/// Valid values for CUlaunchAttributeValue::nvlinkUtilCentricScheduling are 0 (disabled) and 1 (enabled).
pub const CU_LAUNCH_ATTRIBUTE_NVLINK_UTIL_CENTRIC_SCHEDULING: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
16,
);
/// Valid for graph nodes, launches.
///
/// This controls whether the kernel launch is allowed to use a non-portable cluster size. Valid values for [CUlaunchAttributeValue::portableClusterSizeMode](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/unionCUlaunchAttributeValue.html#unionculaunchattributevalue_1ab59ceb6906a7de4ce07de5f2269d18b3) are described in [CUlaunchAttributePortableClusterMode](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gaeb6323dd92d20fdf48e4cf68122e77a1). Any other value will return [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`].
pub const CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
17,
);
/// Valid for graph nodes, launches.
///
/// This controls a kernel’s use of non-portable or oversized shared memory configurations.
pub const CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE: CUlaunchAttributeID_enum = CUlaunchAttributeID_enum(
18,
);
}
/// Launch attributes enum; used as id field of ::CUlaunchAttribute
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlaunchAttributeID_enum(pub ::core::ffi::c_uint);
pub use self::CUlaunchAttributeID_enum as CUlaunchAttributeID;
/// Launch attributes union; used as value field of ::CUlaunchAttribute
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUlaunchAttributeValue_union {
/// Pad to 64 bytes
pub pad: [::core::ffi::c_char; 64usize],
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW.
pub accessPolicyWindow: CUaccessPolicyWindow,
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_COOPERATIVE. Nonzero indicates a cooperative kernel (see ::cuLaunchCooperativeKernel).
pub cooperative: ::core::ffi::c_int,
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY. ::CUsynchronizationPolicy for work queued up in this stream
pub syncPolicy: CUsynchronizationPolicy,
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION that represents the desired cluster dimensions for the kernel. Opaque type with the following fields:
/// - `x` - The X dimension of the cluster, in blocks. Must be a divisor of the grid X dimension.
/// - `y` - The Y dimension of the cluster, in blocks. Must be a divisor of the grid Y dimension.
/// - `z` - The Z dimension of the cluster, in blocks. Must be a divisor of the grid Z dimension.
pub clusterDim: CUlaunchAttributeValue_union__bindgen_ty_1,
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE. Cluster scheduling policy preference for the kernel.
pub clusterSchedulingPolicyPreference: CUclusterSchedulingPolicy,
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION.
pub programmaticStreamSerializationAllowed: ::core::ffi::c_int,
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT with the following fields:
/// - [`CUevent`] event - Event to fire when all blocks trigger it.
/// - `Event` record flags, see ::cuEventRecordWithFlags. Does not accept :CU_EVENT_RECORD_EXTERNAL.
/// - `triggerAtBlockStart` - If this is set to non-0, each block launch will automatically trigger the event.
pub programmaticEvent: CUlaunchAttributeValue_union__bindgen_ty_2,
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT with the following fields:
/// - [`CUevent`] event - Event to fire when the last block launches
/// - `int` flags; - Event record flags, see ::cuEventRecordWithFlags. Does not accept ::CU_EVENT_RECORD_EXTERNAL.
pub launchCompletionEvent: CUlaunchAttributeValue_union__bindgen_ty_3,
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_PRIORITY. Execution priority of the kernel.
pub priority: ::core::ffi::c_int,
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. See ::CUlaunchMemSyncDomainMap.
pub memSyncDomainMap: CUlaunchMemSyncDomainMap,
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN. See::CUlaunchMemSyncDomain
pub memSyncDomain: CUlaunchMemSyncDomain,
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION that represents the desired preferred cluster dimensions for the kernel. Opaque type with the following fields:
/// - `x` - The X dimension of the preferred cluster, in blocks. Must be a divisor of the grid X dimension, and must be a multiple of the `x` field of ::CUlaunchAttributeValue::clusterDim.
/// - `y` - The Y dimension of the preferred cluster, in blocks. Must be a divisor of the grid Y dimension, and must be a multiple of the `y` field of ::CUlaunchAttributeValue::clusterDim.
/// - `z` - The Z dimension of the preferred cluster, in blocks. Must be equal to the `z` field of ::CUlaunchAttributeValue::clusterDim.
pub preferredClusterDim: CUlaunchAttributeValue_union__bindgen_ty_4,
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. with the following fields:
/// - `int` deviceUpdatable - Whether or not the resulting kernel node should be device-updatable.
/// - [`CUgraphDeviceNode`] devNode - Returns a handle to pass to the various device-side update functions.
pub deviceUpdatableKernelNode: CUlaunchAttributeValue_union__bindgen_ty_5,
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT.
pub sharedMemCarveout: ::core::ffi::c_uint,
/// Enables NVLink-utilization-centric scheduling when 1; 0 disables it.
pub nvlinkUtilCentricScheduling: ::core::ffi::c_uint,
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE.
pub portableClusterSizeMode: CUlaunchAttributePortableClusterMode,
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE. See ::CUsharedMemoryMode for acceptable values.
pub sharedMemoryMode: CUsharedMemoryMode,
}
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION that represents the desired cluster dimensions for the kernel. Opaque type with the following fields:
/// - `x` - The X dimension of the cluster, in blocks. Must be a divisor of the grid X dimension.
/// - `y` - The Y dimension of the cluster, in blocks. Must be a divisor of the grid Y dimension.
/// - `z` - The Z dimension of the cluster, in blocks. Must be a divisor of the grid Z dimension.
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlaunchAttributeValue_union__bindgen_ty_1 {
/// The X dimension of the cluster, in blocks. Must be a divisor of the grid X dimension.
pub x: ::core::ffi::c_uint,
/// The Y dimension of the cluster, in blocks. Must be a divisor of the grid Y dimension.
pub y: ::core::ffi::c_uint,
/// The Z dimension of the cluster, in blocks. Must be a divisor of the grid Z dimension.
pub z: ::core::ffi::c_uint,
}
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT with the following fields:
/// - [`CUevent`] event - Event to fire when all blocks trigger it.
/// - `Event` record flags, see ::cuEventRecordWithFlags. Does not accept :CU_EVENT_RECORD_EXTERNAL.
/// - `triggerAtBlockStart` - If this is set to non-0, each block launch will automatically trigger the event.
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlaunchAttributeValue_union__bindgen_ty_2 {
/// Event to fire when all blocks trigger it.
pub event: CUevent,
/// `triggerAtBlockStart` - If this is set to non-0, each block launch will automatically trigger the event.
pub flags: ::core::ffi::c_int,
/// Nonzero causes each block launch to trigger the programmatic event automatically.
pub triggerAtBlockStart: ::core::ffi::c_int,
}
impl Default for CUlaunchAttributeValue_union__bindgen_ty_2 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT with the following fields:
/// - [`CUevent`] event - Event to fire when the last block launches
/// - `int` flags; - Event record flags, see ::cuEventRecordWithFlags. Does not accept ::CU_EVENT_RECORD_EXTERNAL.
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlaunchAttributeValue_union__bindgen_ty_3 {
/// Event to fire when the last block launches
pub event: CUevent,
/// Event record flags, see ::cuEventRecordWithFlags. Does not accept ::CU_EVENT_RECORD_EXTERNAL.
pub flags: ::core::ffi::c_int,
}
impl Default for CUlaunchAttributeValue_union__bindgen_ty_3 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION that represents the desired preferred cluster dimensions for the kernel. Opaque type with the following fields:
/// - `x` - The X dimension of the preferred cluster, in blocks. Must be a divisor of the grid X dimension, and must be a multiple of the `x` field of ::CUlaunchAttributeValue::clusterDim.
/// - `y` - The Y dimension of the preferred cluster, in blocks. Must be a divisor of the grid Y dimension, and must be a multiple of the `y` field of ::CUlaunchAttributeValue::clusterDim.
/// - `z` - The Z dimension of the preferred cluster, in blocks. Must be equal to the `z` field of ::CUlaunchAttributeValue::clusterDim.
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlaunchAttributeValue_union__bindgen_ty_4 {
/// The X dimension of the preferred cluster, in blocks. Must be a divisor of the grid X dimension, and must be a multiple of the `x` field of ::CUlaunchAttributeValue::clusterDim.
pub x: ::core::ffi::c_uint,
/// The Y dimension of the preferred cluster, in blocks. Must be a divisor of the grid Y dimension, and must be a multiple of the `y` field of ::CUlaunchAttributeValue::clusterDim.
pub y: ::core::ffi::c_uint,
/// The Z dimension of the preferred cluster, in blocks. Must be equal to the `z` field of ::CUlaunchAttributeValue::clusterDim.
pub z: ::core::ffi::c_uint,
}
/// Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. with the following fields:
/// - `int` deviceUpdatable - Whether or not the resulting kernel node should be device-updatable.
/// - [`CUgraphDeviceNode`] devNode - Returns a handle to pass to the various device-side update functions.
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlaunchAttributeValue_union__bindgen_ty_5 {
/// Whether or not the resulting kernel node should be device-updatable.
pub deviceUpdatable: ::core::ffi::c_int,
/// Returns a handle to pass to the various device-side update functions.
pub devNode: CUgraphDeviceNode,
}
impl Default for CUlaunchAttributeValue_union__bindgen_ty_5 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUlaunchAttributeValue_union {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Launch attributes union; used as value field of ::CUlaunchAttribute
pub type CUlaunchAttributeValue = CUlaunchAttributeValue_union;
/// Launch attribute
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUlaunchAttribute_st {
/// Attribute to set
pub id: CUlaunchAttributeID,
/// Padding that preserves the native alignment of the launch-attribute value.
pub pad: [::core::ffi::c_char; 4usize],
/// Value of the attribute
pub value: CUlaunchAttributeValue,
}
impl Default for CUlaunchAttribute_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Launch attribute.
pub type CUlaunchAttribute = CUlaunchAttribute_st;
/// CUDA extensible launch configuration
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlaunchConfig_st {
/// Width of grid in blocks
pub gridDimX: ::core::ffi::c_uint,
/// Height of grid in blocks
pub gridDimY: ::core::ffi::c_uint,
/// Depth of grid in blocks
pub gridDimZ: ::core::ffi::c_uint,
/// X dimension of each thread block
pub blockDimX: ::core::ffi::c_uint,
/// Y dimension of each thread block
pub blockDimY: ::core::ffi::c_uint,
/// Z dimension of each thread block
pub blockDimZ: ::core::ffi::c_uint,
/// Dynamic shared-memory size per thread block in bytes
pub sharedMemBytes: ::core::ffi::c_uint,
/// Stream identifier
pub hStream: CUstream,
/// List of attributes; nullable if ::CUlaunchConfig::numAttrs == 0
pub attrs: *mut CUlaunchAttribute,
/// Number of attributes populated in ::CUlaunchConfig::attrs
pub numAttrs: ::core::ffi::c_uint,
}
impl Default for CUlaunchConfig_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// CUDA extensible launch configuration.
pub type CUlaunchConfig = CUlaunchConfig_st;
pub use self::CUlaunchAttributeID as CUkernelNodeAttrID;
/// Launch attributes union; used as value field of ::CUlaunchAttribute
pub type CUkernelNodeAttrValue_v1 = CUlaunchAttributeValue;
/// Launch attributes union; used as value field of ::CUlaunchAttribute
pub type CUkernelNodeAttrValue = CUkernelNodeAttrValue_v1;
impl CUstreamCaptureStatus_enum {
/// Stream is not capturing.
pub const CU_STREAM_CAPTURE_STATUS_NONE: CUstreamCaptureStatus_enum = CUstreamCaptureStatus_enum(
0,
);
/// Stream is actively capturing.
pub const CU_STREAM_CAPTURE_STATUS_ACTIVE: CUstreamCaptureStatus_enum = CUstreamCaptureStatus_enum(
1,
);
/// Stream is part of a capture sequence that has been invalidated, but not terminated.
pub const CU_STREAM_CAPTURE_STATUS_INVALIDATED: CUstreamCaptureStatus_enum = CUstreamCaptureStatus_enum(
2,
);
}
/// Possible stream capture statuses returned by ::cuStreamIsCapturing
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUstreamCaptureStatus_enum(pub ::core::ffi::c_uint);
pub use self::CUstreamCaptureStatus_enum as CUstreamCaptureStatus;
impl CUstreamCaptureMode_enum {
/// This is the default mode. If the local thread has an ongoing capture sequence that was not initiated with [`CUstreamCaptureMode_enum::CU_STREAM_CAPTURE_MODE_RELAXED`] at [`cuStreamBeginCapture_v2`], or if any other thread has a concurrent capture sequence initiated with [`CUstreamCaptureMode_enum::CU_STREAM_CAPTURE_MODE_GLOBAL`], this thread is prohibited from potentially unsafe API calls.
pub const CU_STREAM_CAPTURE_MODE_GLOBAL: CUstreamCaptureMode_enum = CUstreamCaptureMode_enum(
0,
);
/// If the local thread has an ongoing capture sequence not initiated with [`CUstreamCaptureMode_enum::CU_STREAM_CAPTURE_MODE_RELAXED`], it is prohibited from potentially unsafe API calls. Concurrent capture sequences in other threads are ignored.
pub const CU_STREAM_CAPTURE_MODE_THREAD_LOCAL: CUstreamCaptureMode_enum = CUstreamCaptureMode_enum(
1,
);
/// The local thread is not prohibited from potentially unsafe API calls. Note that the thread is still prohibited from API calls which necessarily conflict with stream capture, for example, attempting ::cuEventQuery on an event that was last recorded inside a capture sequence.
pub const CU_STREAM_CAPTURE_MODE_RELAXED: CUstreamCaptureMode_enum = CUstreamCaptureMode_enum(
2,
);
}
/// Possible modes for stream capture thread interactions. For more details see ::cuStreamBeginCapture and ::cuThreadExchangeStreamCaptureMode
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUstreamCaptureMode_enum(pub ::core::ffi::c_uint);
pub use self::CUlaunchAttributeID as CUstreamAttrID;
pub use self::CUstreamCaptureMode_enum as CUstreamCaptureMode;
/// Launch attributes union; used as value field of ::CUlaunchAttribute
pub type CUstreamAttrValue_v1 = CUlaunchAttributeValue;
/// Launch attributes union; used as value field of ::CUlaunchAttribute
pub type CUstreamAttrValue = CUstreamAttrValue_v1;
impl CUdriverProcAddress_flags_enum {
/// Default search mode for driver symbols.
pub const CU_GET_PROC_ADDRESS_DEFAULT: CUdriverProcAddress_flags_enum = CUdriverProcAddress_flags_enum(
0,
);
/// Search for legacy versions of driver symbols.
pub const CU_GET_PROC_ADDRESS_LEGACY_STREAM: CUdriverProcAddress_flags_enum = CUdriverProcAddress_flags_enum(
1,
);
/// Search for per-thread versions of driver symbols.
pub const CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM: CUdriverProcAddress_flags_enum = CUdriverProcAddress_flags_enum(
2,
);
}
/// Flags to specify search options. For more details see ::cuGetProcAddress
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUdriverProcAddress_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUdriverProcAddress_flags_enum as CUdriverProcAddress_flags;
impl CUdriverProcAddressQueryResult_enum {
/// Symbol was succesfully found.
pub const CU_GET_PROC_ADDRESS_SUCCESS: CUdriverProcAddressQueryResult_enum = CUdriverProcAddressQueryResult_enum(
0,
);
/// Symbol was not found in search.
pub const CU_GET_PROC_ADDRESS_SYMBOL_NOT_FOUND: CUdriverProcAddressQueryResult_enum = CUdriverProcAddressQueryResult_enum(
1,
);
/// Symbol was found but version supplied was not sufficient.
pub const CU_GET_PROC_ADDRESS_VERSION_NOT_SUFFICIENT: CUdriverProcAddressQueryResult_enum = CUdriverProcAddressQueryResult_enum(
2,
);
}
/// Flags to indicate search status. For more details see ::cuGetProcAddress
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUdriverProcAddressQueryResult_enum(pub ::core::ffi::c_uint);
pub use self::CUdriverProcAddressQueryResult_enum as CUdriverProcAddressQueryResult;
impl CUexecAffinityType_enum {
/// Create a context with limited SMs.
pub const CU_EXEC_AFFINITY_TYPE_SM_COUNT: CUexecAffinityType_enum = CUexecAffinityType_enum(
0,
);
/// Reserved upper-bound sentinel for native execution-affinity parameter kinds.
pub const CU_EXEC_AFFINITY_TYPE_MAX: CUexecAffinityType_enum = CUexecAffinityType_enum(
1,
);
}
/// Execution Affinity Types
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUexecAffinityType_enum(pub ::core::ffi::c_uint);
pub use self::CUexecAffinityType_enum as CUexecAffinityType;
/// Value for ::CU_EXEC_AFFINITY_TYPE_SM_COUNT
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUexecAffinitySmCount_st {
/// The number of SMs the context is limited to use.
pub val: ::core::ffi::c_uint,
}
/// Value for [`CUexecAffinityType_enum::CU_EXEC_AFFINITY_TYPE_SM_COUNT`].
pub type CUexecAffinitySmCount_v1 = CUexecAffinitySmCount_st;
/// Value for ::CU_EXEC_AFFINITY_TYPE_SM_COUNT
pub type CUexecAffinitySmCount = CUexecAffinitySmCount_v1;
/// Execution Affinity Parameters
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUexecAffinityParam_st {
/// Type of execution affinity.
pub type_: CUexecAffinityType,
/// Execution-affinity value interpreted according to `type`.
pub param: CUexecAffinityParam_st__bindgen_ty_1,
}
/// Native layout of the `param` member of [`CUexecAffinityParam_st`].
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUexecAffinityParam_st__bindgen_ty_1 {
/// Value for ::CU_EXEC_AFFINITY_TYPE_SM_COUNT
pub smCount: CUexecAffinitySmCount,
}
impl Default for CUexecAffinityParam_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUexecAffinityParam_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Execution Affinity Parameters.
pub type CUexecAffinityParam_v1 = CUexecAffinityParam_st;
/// Execution Affinity Parameters.
pub type CUexecAffinityParam = CUexecAffinityParam_v1;
impl CUcigDataType_enum {
/// D3D12 Command Queue Handle.
pub const CIG_DATA_TYPE_D3D12_COMMAND_QUEUE: CUcigDataType_enum = CUcigDataType_enum(
1,
);
/// Nvidia specific data blob used for Vulkan and other NV clients.
pub const CIG_DATA_TYPE_NV_BLOB: CUcigDataType_enum = CUcigDataType_enum(2);
}
/// Graphics-client handle representation supplied when creating a CUDA-in-Graphics context.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUcigDataType_enum(pub ::core::ffi::c_uint);
pub use self::CUcigDataType_enum as CUcigDataType;
/// CIG Context Create Params
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUctxCigParam_st {
/// Type of shared data from graphics client (D3D12 or Vulkan).
pub sharedDataType: CUcigDataType,
/// Graphics client data handle (ID3D12CommandQueue or Nvidia specific data blob).
pub sharedData: *mut ::core::ffi::c_void,
}
impl Default for CUctxCigParam_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// CIG Context Create Params.
pub type CUctxCigParam = CUctxCigParam_st;
/// Params for creating CUDA context. Both execAffinityParams and cigParams cannot be non-NULL at the same time. If both are NULL, the context will be created as a regular CUDA context.
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUctxCreateParams_st {
/// Array of execution affinity parameters to limit context resources (e.g., SM count). Only supported Volta+ MPS. Mutually exclusive with cigParams.
pub execAffinityParams: *mut CUexecAffinityParam,
/// Number of elements in execAffinityParams array. Must be 0 if execAffinityParams is NULL.
pub numExecAffinityParams: ::core::ffi::c_int,
/// CIG (CUDA in Graphics) parameters for sharing data from D3D12/Vulkan graphics clients. Mutually exclusive with execAffinityParams.
pub cigParams: *mut CUctxCigParam,
}
impl Default for CUctxCreateParams_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Params for creating CUDA context.
///
/// Both execAffinityParams and cigParams cannot be non-NULL at the same time. If both are NULL, the context will be created as a regular CUDA context.
pub type CUctxCreateParams = CUctxCreateParams_st;
impl CUstreamCigDataType_enum {
/// D3D12 Command List Handle.
pub const STREAM_CIG_DATA_TYPE_D3D12_COMMAND_LIST: CUstreamCigDataType_enum = CUstreamCigDataType_enum(
1,
);
}
/// Graphics-client command-list representation supplied for CUDA-in-Graphics stream capture.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUstreamCigDataType_enum(pub ::core::ffi::c_uint);
pub use self::CUstreamCigDataType_enum as CUstreamCigDataType;
/// CIG Stream Capture Params
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUstreamCigParam_st {
/// Type of shared data from graphics client (D3D12).
pub streamSharedDataType: CUstreamCigDataType,
/// Graphics client data handle (ID3D12CommandList/ID3D12GraphicsCommandList).
pub streamSharedData: *mut ::core::ffi::c_void,
}
impl Default for CUstreamCigParam_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// CIG Stream Capture Params.
pub type CUstreamCigParam = CUstreamCigParam_st;
/// Params for capturing CUDA stream to CIG streamCigParams must be non-NULL.
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUstreamCigCaptureParams_st {
/// CIG (CUDA in Graphics) parameters for sharing command list data from D3D12 graphics clients.
pub streamCigParams: *mut CUstreamCigParam,
}
impl Default for CUstreamCigCaptureParams_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Params for capturing CUDA stream to CIG streamCigParams must be non-NULL.
pub type CUstreamCigCaptureParams = CUstreamCigCaptureParams_st;
impl CUlibraryOption_enum {
/// Supplies the host universal-function and data tables when loading a CUDA library.
pub const CU_LIBRARY_HOST_UNIVERSAL_FUNCTION_AND_DATA_TABLE: CUlibraryOption_enum = CUlibraryOption_enum(
0,
);
/// 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 option with [`cuLibraryLoadFromFile`] is invalid and will return [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`].
pub const CU_LIBRARY_BINARY_IS_PRESERVED: CUlibraryOption_enum = CUlibraryOption_enum(
1,
);
/// Upper-bound sentinel for CUDA library loading option selectors.
pub const CU_LIBRARY_NUM_OPTIONS: CUlibraryOption_enum = CUlibraryOption_enum(2);
}
/// Library options to be specified with ::cuLibraryLoadData() or ::cuLibraryLoadFromFile()
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlibraryOption_enum(pub ::core::ffi::c_uint);
pub use self::CUlibraryOption_enum as CUlibraryOption;
/// Host-side function and data tables supplied through [`CUlibraryOption_enum::CU_LIBRARY_HOST_UNIVERSAL_FUNCTION_AND_DATA_TABLE`].
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlibraryHostUniversalFunctionAndDataTable_st {
/// Address of the host universal-function table.
pub functionTable: *mut ::core::ffi::c_void,
/// Size of the native function-table window.
pub functionWindowSize: size_t,
/// Address of the host universal-data table.
pub dataTable: *mut ::core::ffi::c_void,
/// Size of the native data-table window.
pub dataWindowSize: size_t,
}
impl Default for CUlibraryHostUniversalFunctionAndDataTable_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Host-side function and data tables supplied through [`CUlibraryOption_enum::CU_LIBRARY_HOST_UNIVERSAL_FUNCTION_AND_DATA_TABLE`].
pub type CUlibraryHostUniversalFunctionAndDataTable = CUlibraryHostUniversalFunctionAndDataTable_st;
impl cudaError_enum {
/// The API call returned with no errors.
///
/// In the case of query calls, this also means that the operation being queried is complete (see [`cuEventQuery`] and [`cuStreamQuery`]).
pub const CUDA_SUCCESS: cudaError_enum = cudaError_enum(0);
/// This indicates that one or more of the parameters passed to the API call is not within an acceptable range of values.
pub const CUDA_ERROR_INVALID_VALUE: cudaError_enum = cudaError_enum(1);
/// The API call failed because it was unable to allocate enough memory or other resources to perform the requested operation.
pub const CUDA_ERROR_OUT_OF_MEMORY: cudaError_enum = cudaError_enum(2);
/// This indicates that the CUDA driver has not been initialized with [`cuInit`] or that initialization has failed.
pub const CUDA_ERROR_NOT_INITIALIZED: cudaError_enum = cudaError_enum(3);
/// This indicates that the CUDA driver is in the process of shutting down.
pub const CUDA_ERROR_DEINITIALIZED: cudaError_enum = cudaError_enum(4);
/// This indicates profiler is not initialized for this run.
///
/// This can happen when the application is running with external profiling tools like visual profiler.
pub const CUDA_ERROR_PROFILER_DISABLED: cudaError_enum = cudaError_enum(5);
/// Deprecated: This error return is deprecated as of CUDA 5.0. It is no longer an error to attempt to enable/disable the profiling via ::cuProfilerStart or ::cuProfilerStop without initialization.
pub const CUDA_ERROR_PROFILER_NOT_INITIALIZED: cudaError_enum = cudaError_enum(6);
/// Deprecated: This error return is deprecated as of CUDA 5.0. It is no longer an error to call cuProfilerStart() when profiling is already enabled.
pub const CUDA_ERROR_PROFILER_ALREADY_STARTED: cudaError_enum = cudaError_enum(7);
/// Deprecated: This error return is deprecated as of CUDA 5.0. It is no longer an error to call cuProfilerStop() when profiling is already disabled.
pub const CUDA_ERROR_PROFILER_ALREADY_STOPPED: cudaError_enum = cudaError_enum(8);
/// This indicates that the CUDA driver that the application has loaded is a stub library.
///
/// Applications that run with the stub rather than a real driver loaded will result in CUDA API returning this error.
pub const CUDA_ERROR_STUB_LIBRARY: cudaError_enum = cudaError_enum(34);
/// This indicates that the API call requires a newer CUDA driver than the one currently installed.
///
/// Users should install an updated NVIDIA CUDA driver to allow the API call to succeed.
pub const CUDA_ERROR_CALL_REQUIRES_NEWER_DRIVER: cudaError_enum = cudaError_enum(36);
/// This indicates that requested CUDA device is unavailable at the current time.
///
/// Devices are often unavailable due to use of [`CUcomputemode_enum::CU_COMPUTEMODE_EXCLUSIVE_PROCESS`] or [`CUcomputemode_enum::CU_COMPUTEMODE_PROHIBITED`].
pub const CUDA_ERROR_DEVICE_UNAVAILABLE: cudaError_enum = cudaError_enum(46);
/// The API call failed because of a hardware resource required to bind memory to a multicast object is unavailable.
pub const CUDA_ERROR_MULTICAST_RESOURCE_FULL: cudaError_enum = cudaError_enum(47);
/// This indicates that no CUDA-capable devices were detected by the installed CUDA driver.
pub const CUDA_ERROR_NO_DEVICE: cudaError_enum = cudaError_enum(100);
/// This indicates that the device ordinal supplied by the user does not correspond to a valid CUDA device or that the action requested is invalid for the specified device.
pub const CUDA_ERROR_INVALID_DEVICE: cudaError_enum = cudaError_enum(101);
/// This error indicates that the Grid license is not applied.
pub const CUDA_ERROR_DEVICE_NOT_LICENSED: cudaError_enum = cudaError_enum(102);
/// This indicates that the device kernel image is invalid.
///
/// This can also indicate an invalid CUDA module.
pub const CUDA_ERROR_INVALID_IMAGE: cudaError_enum = cudaError_enum(200);
/// This most frequently indicates that there is no context bound to the current thread.
///
/// This can also be returned if the context passed to an API call is not a valid handle (such as a context that has had cuCtxDestroy() invoked on it). This can also be returned if a user mixes different API versions (i.e. 3010 context with 3020 API calls). 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.
pub const CUDA_ERROR_INVALID_CONTEXT: cudaError_enum = cudaError_enum(201);
/// This indicated that the context being supplied as a parameter to the API call was already the active context.
pub const CUDA_ERROR_CONTEXT_ALREADY_CURRENT: cudaError_enum = cudaError_enum(202);
/// This indicates that a map or register operation has failed.
pub const CUDA_ERROR_MAP_FAILED: cudaError_enum = cudaError_enum(205);
/// This indicates that an unmap or unregister operation has failed.
pub const CUDA_ERROR_UNMAP_FAILED: cudaError_enum = cudaError_enum(206);
/// This indicates that the specified array is currently mapped and thus cannot be destroyed.
pub const CUDA_ERROR_ARRAY_IS_MAPPED: cudaError_enum = cudaError_enum(207);
/// This indicates that the resource is already mapped.
pub const CUDA_ERROR_ALREADY_MAPPED: cudaError_enum = cudaError_enum(208);
/// This indicates that there is no kernel image available that is suitable for the device.
///
/// This can occur when a user specifies code generation options for a particular CUDA source file that do not include the corresponding device configuration.
pub const CUDA_ERROR_NO_BINARY_FOR_GPU: cudaError_enum = cudaError_enum(209);
/// This indicates that a resource has already been acquired.
pub const CUDA_ERROR_ALREADY_ACQUIRED: cudaError_enum = cudaError_enum(210);
/// This indicates that a resource is not mapped.
pub const CUDA_ERROR_NOT_MAPPED: cudaError_enum = cudaError_enum(211);
/// This indicates that a mapped resource is not available for access as an array.
pub const CUDA_ERROR_NOT_MAPPED_AS_ARRAY: cudaError_enum = cudaError_enum(212);
/// This indicates that a mapped resource is not available for access as a pointer.
pub const CUDA_ERROR_NOT_MAPPED_AS_POINTER: cudaError_enum = cudaError_enum(213);
/// This indicates that an uncorrectable ECC error was detected during execution.
pub const CUDA_ERROR_ECC_UNCORRECTABLE: cudaError_enum = cudaError_enum(214);
/// This indicates that the [CUlimit](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gae24c2d4214af24139020f1aecaf32665) passed to the API call is not supported by the active device.
pub const CUDA_ERROR_UNSUPPORTED_LIMIT: cudaError_enum = cudaError_enum(215);
/// 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.
pub const CUDA_ERROR_CONTEXT_ALREADY_IN_USE: cudaError_enum = cudaError_enum(216);
/// This indicates that peer access is not supported across the given devices.
pub const CUDA_ERROR_PEER_ACCESS_UNSUPPORTED: cudaError_enum = cudaError_enum(217);
/// This indicates that a PTX JIT compilation failed.
pub const CUDA_ERROR_INVALID_PTX: cudaError_enum = cudaError_enum(218);
/// This indicates an error with OpenGL or DirectX context.
pub const CUDA_ERROR_INVALID_GRAPHICS_CONTEXT: cudaError_enum = cudaError_enum(219);
/// This indicates that an uncorrectable NVLink error was detected during the execution.
pub const CUDA_ERROR_NVLINK_UNCORRECTABLE: cudaError_enum = cudaError_enum(220);
/// This indicates that the PTX JIT compiler library was not found.
pub const CUDA_ERROR_JIT_COMPILER_NOT_FOUND: cudaError_enum = cudaError_enum(221);
/// This indicates that the provided PTX was compiled with an unsupported toolchain.
pub const CUDA_ERROR_UNSUPPORTED_PTX_VERSION: cudaError_enum = cudaError_enum(222);
/// This indicates that the PTX JIT compilation was disabled.
pub const CUDA_ERROR_JIT_COMPILATION_DISABLED: cudaError_enum = cudaError_enum(223);
/// This indicates that the [CUexecAffinityType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1ga14e6345acf2bda65be91eda77cf03f5c) passed to the API call is not supported by the active device.
pub const CUDA_ERROR_UNSUPPORTED_EXEC_AFFINITY: cudaError_enum = cudaError_enum(224);
/// This indicates that the code to be compiled by the PTX JIT contains unsupported call to cudaDeviceSynchronize.
pub const CUDA_ERROR_UNSUPPORTED_DEVSIDE_SYNC: cudaError_enum = cudaError_enum(225);
/// This indicates that an exception occurred on the device that is now contained by the GPU’s error containment capability.
///
/// Common causes are - a. Certain types of invalid accesses of peer GPU memory over nvlink b. Certain classes of hardware errors This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
pub const CUDA_ERROR_CONTAINED: cudaError_enum = cudaError_enum(226);
/// This indicates that the Loader version is insufficient for fatbin.
pub const CUDA_ERROR_INSUFFICIENT_LOADER_VERSION: cudaError_enum = cudaError_enum(
227,
);
/// This indicates that the device kernel source is invalid.
///
/// This includes compilation/linker errors encountered in device code or user error.
pub const CUDA_ERROR_INVALID_SOURCE: cudaError_enum = cudaError_enum(300);
/// This indicates that the file specified was not found.
pub const CUDA_ERROR_FILE_NOT_FOUND: cudaError_enum = cudaError_enum(301);
/// This indicates that a link to a shared object failed to resolve.
pub const CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND: cudaError_enum = cudaError_enum(
302,
);
/// This indicates that initialization of a shared object failed.
pub const CUDA_ERROR_SHARED_OBJECT_INIT_FAILED: cudaError_enum = cudaError_enum(303);
/// This indicates that an OS call failed.
pub const CUDA_ERROR_OPERATING_SYSTEM: cudaError_enum = cudaError_enum(304);
/// This indicates that a resource handle passed to the API call was not valid.
///
/// Resource handles are opaque types like [`CUstream`] and [`CUevent`].
pub const CUDA_ERROR_INVALID_HANDLE: cudaError_enum = cudaError_enum(400);
/// This indicates that a resource required by the API call is not in a valid state to perform the requested operation.
pub const CUDA_ERROR_ILLEGAL_STATE: cudaError_enum = cudaError_enum(401);
/// This indicates an attempt was made to introspect an object in a way that would discard semantically important information.
///
/// This is either due to the object using funtionality newer than the API version used to introspect it or omission of optional return arguments.
pub const CUDA_ERROR_LOSSY_QUERY: cudaError_enum = cudaError_enum(402);
/// This indicates that a named symbol was not found.
///
/// Examples of symbols are global/constant variable names, driver function names, texture names, and surface names.
pub const CUDA_ERROR_NOT_FOUND: cudaError_enum = cudaError_enum(500);
/// This indicates that asynchronous operations issued previously have not completed yet.
///
/// This result is not actually an error, but must be indicated differently than [`cudaError_enum::CUDA_SUCCESS`] (which indicates completion). Calls that may return this value include [`cuEventQuery`] and [`cuStreamQuery`].
pub const CUDA_ERROR_NOT_READY: cudaError_enum = cudaError_enum(600);
/// While executing a kernel, the device encountered a load or store instruction on an invalid memory address.
///
/// This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
pub const CUDA_ERROR_ILLEGAL_ADDRESS: cudaError_enum = cudaError_enum(700);
/// This indicates that a launch did not occur because it did not have appropriate resources.
///
/// This error usually indicates that the user has attempted to pass too many arguments to the device kernel, or the kernel launch specifies too many threads for 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 equivalent to passing too many arguments and can also result in this error.
pub const CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES: cudaError_enum = cudaError_enum(701);
/// This indicates that the device kernel took too long to execute.
///
/// This can only occur if timeouts are enabled - see the device attribute [`CUdevice_attribute_enum::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. To continue using CUDA, the process must be terminated and relaunched.
pub const CUDA_ERROR_LAUNCH_TIMEOUT: cudaError_enum = cudaError_enum(702);
/// This error indicates a kernel launch that uses an incompatible texturing mode.
pub const CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING: cudaError_enum = cudaError_enum(
703,
);
/// 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.
pub const CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED: cudaError_enum = cudaError_enum(
704,
);
/// This error indicates that [`cuCtxDisablePeerAccess`] is trying to disable peer access which has not been enabled yet via [`cuCtxEnablePeerAccess`].
pub const CUDA_ERROR_PEER_ACCESS_NOT_ENABLED: cudaError_enum = cudaError_enum(705);
/// This error indicates that the primary context for the specified device has already been initialized.
pub const CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE: cudaError_enum = cudaError_enum(708);
/// This error indicates that the context current to the calling thread has been destroyed using cuCtxDestroy, or is a primary context which has not yet been initialized.
pub const CUDA_ERROR_CONTEXT_IS_DESTROYED: cudaError_enum = cudaError_enum(709);
/// A device-side assert triggered during kernel execution.
///
/// The context cannot be used anymore, and must be destroyed. All existing device memory allocations from this context are invalid and must be reconstructed if the program is to continue using CUDA.
pub const CUDA_ERROR_ASSERT: cudaError_enum = cudaError_enum(710);
/// This error indicates that the hardware resources required to enable peer access have been exhausted for one or more of the devices passed to [`cuCtxEnablePeerAccess`].
pub const CUDA_ERROR_TOO_MANY_PEERS: cudaError_enum = cudaError_enum(711);
/// This error indicates that the memory range passed to cuMemHostRegister() has already been registered.
pub const CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED: cudaError_enum = cudaError_enum(
712,
);
/// This error indicates that the pointer passed to [`cuMemHostUnregister`] does not correspond to any currently registered memory region.
pub const CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED: cudaError_enum = cudaError_enum(
713,
);
/// While executing a kernel, the device encountered a stack error.
///
/// This can be due to stack corruption or exceeding the stack size limit. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
pub const CUDA_ERROR_HARDWARE_STACK_ERROR: cudaError_enum = cudaError_enum(714);
/// While executing a kernel, the device encountered an illegal instruction.
///
/// This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
pub const CUDA_ERROR_ILLEGAL_INSTRUCTION: cudaError_enum = cudaError_enum(715);
/// While executing a kernel, the device encountered a load or store instruction on a memory address which is not aligned.
///
/// This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
pub const CUDA_ERROR_MISALIGNED_ADDRESS: cudaError_enum = cudaError_enum(716);
/// While executing a kernel, the device encountered an instruction which can only operate on memory locations in certain address spaces (global, shared, or local), but was supplied a memory address not belonging to an allowed address space.
///
/// This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
pub const CUDA_ERROR_INVALID_ADDRESS_SPACE: cudaError_enum = cudaError_enum(717);
/// While executing a kernel, the device program counter wrapped its address space.
///
/// This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
pub const CUDA_ERROR_INVALID_PC: cudaError_enum = cudaError_enum(718);
/// An exception occurred on the device while executing a kernel.
///
/// Common causes include dereferencing an invalid device pointer and accessing out of bounds shared memory. Less common cases can be system specific - more information about these cases can be found in the system specific user guide. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
pub const CUDA_ERROR_LAUNCH_FAILED: cudaError_enum = cudaError_enum(719);
/// 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 [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT`].
pub const CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE: cudaError_enum = cudaError_enum(
720,
);
/// An exception occurred on the device while exiting a kernel using tensor memory: the tensor memory was not completely deallocated.
///
/// This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
pub const CUDA_ERROR_TENSOR_MEMORY_LEAK: cudaError_enum = cudaError_enum(721);
/// This error indicates that the attempted operation is not permitted.
pub const CUDA_ERROR_NOT_PERMITTED: cudaError_enum = cudaError_enum(800);
/// This error indicates that the attempted operation is not supported on the current system or device.
pub const CUDA_ERROR_NOT_SUPPORTED: cudaError_enum = cudaError_enum(801);
/// This error indicates that the system is not yet ready to start any CUDA work.
///
/// To continue using CUDA, verify the system configuration is in a valid state and all required driver daemons are actively running. More information about this error can be found in the system specific user guide.
pub const CUDA_ERROR_SYSTEM_NOT_READY: cudaError_enum = cudaError_enum(802);
/// This error indicates that there is a mismatch between the versions of the display driver and the CUDA driver.
///
/// Refer to the compatibility documentation for supported versions.
pub const CUDA_ERROR_SYSTEM_DRIVER_MISMATCH: cudaError_enum = cudaError_enum(803);
/// This error indicates that the system was upgraded to run with forward compatibility but the visible hardware detected by CUDA does not support this configuration.
///
/// Refer to the compatibility documentation for the supported hardware matrix or ensure that only supported hardware is visible during initialization via the CUDA_VISIBLE_DEVICES environment variable.
pub const CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE: cudaError_enum = cudaError_enum(
804,
);
/// This error indicates that the MPS client failed to connect to the MPS control daemon or the MPS server.
pub const CUDA_ERROR_MPS_CONNECTION_FAILED: cudaError_enum = cudaError_enum(805);
/// This error indicates that the remote procedural call between the MPS server and the MPS client failed.
pub const CUDA_ERROR_MPS_RPC_FAILURE: cudaError_enum = cudaError_enum(806);
/// This error indicates that the MPS server is not ready to accept new MPS client requests.
///
/// This error can be returned when the MPS server is in the process of recovering from a fatal failure.
pub const CUDA_ERROR_MPS_SERVER_NOT_READY: cudaError_enum = cudaError_enum(807);
/// This error indicates that the hardware resources required to create MPS client have been exhausted.
pub const CUDA_ERROR_MPS_MAX_CLIENTS_REACHED: cudaError_enum = cudaError_enum(808);
/// This error indicates the hardware resources required to support device connections have been exhausted.
pub const CUDA_ERROR_MPS_MAX_CONNECTIONS_REACHED: cudaError_enum = cudaError_enum(
809,
);
/// This error indicates that the MPS client has been terminated by the server.
///
/// To continue using CUDA, the process must be terminated and relaunched.
pub const CUDA_ERROR_MPS_CLIENT_TERMINATED: cudaError_enum = cudaError_enum(810);
/// This error indicates that the module is using CUDA Dynamic Parallelism, but the current configuration, like MPS, does not support it.
pub const CUDA_ERROR_CDP_NOT_SUPPORTED: cudaError_enum = cudaError_enum(811);
/// This error indicates that a module contains an unsupported interaction between different versions of CUDA Dynamic Parallelism.
pub const CUDA_ERROR_CDP_VERSION_MISMATCH: cudaError_enum = cudaError_enum(812);
/// This error indicates that the operation is not permitted when the stream is capturing.
pub const CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED: cudaError_enum = cudaError_enum(
900,
);
/// This error indicates that the current capture sequence on the stream has been invalidated due to a previous error.
pub const CUDA_ERROR_STREAM_CAPTURE_INVALIDATED: cudaError_enum = cudaError_enum(
901,
);
/// This error indicates that the operation would have resulted in a merge of two independent capture sequences.
pub const CUDA_ERROR_STREAM_CAPTURE_MERGE: cudaError_enum = cudaError_enum(902);
/// This error indicates that the capture was not initiated in this stream.
pub const CUDA_ERROR_STREAM_CAPTURE_UNMATCHED: cudaError_enum = cudaError_enum(903);
/// This error indicates that the capture sequence contains a fork that was not joined to the primary stream.
pub const CUDA_ERROR_STREAM_CAPTURE_UNJOINED: cudaError_enum = cudaError_enum(904);
/// This error indicates that a dependency would have been created which crosses the capture sequence boundary.
///
/// Only implicit in-stream ordering dependencies are allowed to cross the boundary.
pub const CUDA_ERROR_STREAM_CAPTURE_ISOLATION: cudaError_enum = cudaError_enum(905);
/// This error indicates a disallowed implicit dependency on a current capture sequence from cudaStreamLegacy.
pub const CUDA_ERROR_STREAM_CAPTURE_IMPLICIT: cudaError_enum = cudaError_enum(906);
/// This error indicates that the operation is not permitted on an event which was last recorded in a capturing stream.
pub const CUDA_ERROR_CAPTURED_EVENT: cudaError_enum = cudaError_enum(907);
/// A stream capture sequence not initiated with the [`CUstreamCaptureMode::CU_STREAM_CAPTURE_MODE_RELAXED`] argument to cuStreamBeginCapture was passed to [`cuStreamEndCapture`] in a different thread.
pub const CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD: cudaError_enum = cudaError_enum(
908,
);
/// This error indicates that the timeout specified for the wait operation has lapsed.
pub const CUDA_ERROR_TIMEOUT: cudaError_enum = cudaError_enum(909);
/// This error indicates that the graph update was not performed because it included changes which violated constraints specific to instantiated graph update.
pub const CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE: cudaError_enum = cudaError_enum(910);
/// 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 asynchronous error from the external device. In case of asynchronous error, it means that if CUDA was waiting for an external device’s signal before consuming shared data, the external device signaled an error indicating that the data is not valid for consumption. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. In case of synchronous error, it means that one or more external devices have encountered an error and cannot complete the operation.
pub const CUDA_ERROR_EXTERNAL_DEVICE: cudaError_enum = cudaError_enum(911);
/// Indicates a kernel launch error due to cluster misconfiguration.
pub const CUDA_ERROR_INVALID_CLUSTER_SIZE: cudaError_enum = cudaError_enum(912);
/// Indiciates a function handle is not loaded when calling an API that requires a loaded function.
pub const CUDA_ERROR_FUNCTION_NOT_LOADED: cudaError_enum = cudaError_enum(913);
/// This error indicates one or more resources passed in are not valid resource types for the operation.
pub const CUDA_ERROR_INVALID_RESOURCE_TYPE: cudaError_enum = cudaError_enum(914);
/// This error indicates one or more resources are insufficient or non-applicable for the operation.
pub const CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION: cudaError_enum = cudaError_enum(
915,
);
/// This error indicates that an error happened during the key rotation sequence.
pub const CUDA_ERROR_KEY_ROTATION: cudaError_enum = cudaError_enum(916);
/// This error indicates that the requested operation is not permitted because the stream is in a detached state.
///
/// This can occur if the green context associated with the stream has been destroyed, limiting the stream’s operational capabilities.
pub const CUDA_ERROR_STREAM_DETACHED: cudaError_enum = cudaError_enum(917);
/// This error indicates that a graph recapture failed and had to be terminated.
pub const CUDA_ERROR_GRAPH_RECAPTURE_FAILURE: cudaError_enum = cudaError_enum(918);
/// The GPU fabric is not ready within the bounded wait while the fabric manager probe is still in progress (or not converging in time).
///
/// Applications may retry after a delay; for the initialization wait budget, see environment variables such as CUDA_FABRIC_INIT_TIMEOUT_MS. The CUDA Runtime uses the same value as ::cudaErrorFabricNotReady.
pub const CUDA_ERROR_FABRIC_NOT_READY: cudaError_enum = cudaError_enum(919);
/// This indicates that an unknown internal error has occurred.
pub const CUDA_ERROR_UNKNOWN: cudaError_enum = cudaError_enum(999);
}
/// Error codes
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct cudaError_enum(pub ::core::ffi::c_uint);
pub use self::cudaError_enum as CUresult;
impl CUdevice_P2PAttribute_enum {
/// A relative value indicating the performance of the link between two devices.
pub const CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK: CUdevice_P2PAttribute_enum = CUdevice_P2PAttribute_enum(
1,
);
/// P2P Access is enable.
pub const CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED: CUdevice_P2PAttribute_enum = CUdevice_P2PAttribute_enum(
2,
);
/// All CUDA-valid atomic operation over the link are supported.
pub const CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED: CUdevice_P2PAttribute_enum = CUdevice_P2PAttribute_enum(
3,
);
/// Deprecated: use CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED instead
pub const CU_DEVICE_P2P_ATTRIBUTE_ACCESS_ACCESS_SUPPORTED: CUdevice_P2PAttribute_enum = CUdevice_P2PAttribute_enum(
4,
);
/// Accessing CUDA arrays over the link supported.
pub const CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED: CUdevice_P2PAttribute_enum = CUdevice_P2PAttribute_enum(
4,
);
/// Only some CUDA-valid atomic operations over the link are supported.
pub const CU_DEVICE_P2P_ATTRIBUTE_ONLY_PARTIAL_NATIVE_ATOMIC_SUPPORTED: CUdevice_P2PAttribute_enum = CUdevice_P2PAttribute_enum(
5,
);
}
/// P2P Attributes
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUdevice_P2PAttribute_enum(pub ::core::ffi::c_uint);
pub use self::CUdevice_P2PAttribute_enum as CUdevice_P2PAttribute;
/// CUDA stream callback.
pub type CUstreamCallback = ::core::option::Option<
unsafe extern "C" fn(
hStream: CUstream,
status: CUresult,
userData: *mut ::core::ffi::c_void,
),
>;
/// Block size to per-block dynamic shared memory mapping for a certain kernel.
pub type CUoccupancyB2DSize = ::core::option::Option<
unsafe extern "C" fn(blockSize: ::core::ffi::c_int) -> size_t,
>;
/// 2D memory copy parameters
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_MEMCPY2D_st {
/// Source X in bytes
pub srcXInBytes: size_t,
/// Source Y
pub srcY: size_t,
/// Source memory type (host, device, array)
pub srcMemoryType: CUmemorytype,
/// Source host pointer
pub srcHost: *const ::core::ffi::c_void,
/// Source device pointer
pub srcDevice: CUdeviceptr,
/// Source array reference
pub srcArray: CUarray,
/// Source pitch (ignored when src is array)
pub srcPitch: size_t,
/// Destination X in bytes
pub dstXInBytes: size_t,
/// Destination Y
pub dstY: size_t,
/// Destination memory type (host, device, array)
pub dstMemoryType: CUmemorytype,
/// Destination host pointer
pub dstHost: *mut ::core::ffi::c_void,
/// Destination device pointer
pub dstDevice: CUdeviceptr,
/// Destination array reference
pub dstArray: CUarray,
/// Destination pitch (ignored when dst is array)
pub dstPitch: size_t,
/// Width of 2D memory copy in bytes
pub WidthInBytes: size_t,
/// Height of 2D memory copy
pub Height: size_t,
}
impl Default for CUDA_MEMCPY2D_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// 2D memory copy parameters.
pub type CUDA_MEMCPY2D_v2 = CUDA_MEMCPY2D_st;
/// 2D memory copy parameters
pub type CUDA_MEMCPY2D = CUDA_MEMCPY2D_v2;
/// 3D memory copy parameters
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_MEMCPY3D_st {
/// Source X in bytes
pub srcXInBytes: size_t,
/// Source Y
pub srcY: size_t,
/// Source Z
pub srcZ: size_t,
/// Source LOD
pub srcLOD: size_t,
/// Source memory type (host, device, array)
pub srcMemoryType: CUmemorytype,
/// Source host pointer
pub srcHost: *const ::core::ffi::c_void,
/// Source device pointer
pub srcDevice: CUdeviceptr,
/// Source array reference
pub srcArray: CUarray,
/// Must be NULL
pub reserved0: *mut ::core::ffi::c_void,
/// Source pitch (ignored when src is array)
pub srcPitch: size_t,
/// Source height (ignored when src is array; may be 0 if Depth==1)
pub srcHeight: size_t,
/// Destination X in bytes
pub dstXInBytes: size_t,
/// Destination Y
pub dstY: size_t,
/// Destination Z
pub dstZ: size_t,
/// Destination LOD
pub dstLOD: size_t,
/// Destination memory type (host, device, array)
pub dstMemoryType: CUmemorytype,
/// Destination host pointer
pub dstHost: *mut ::core::ffi::c_void,
/// Destination device pointer
pub dstDevice: CUdeviceptr,
/// Destination array reference
pub dstArray: CUarray,
/// Must be NULL
pub reserved1: *mut ::core::ffi::c_void,
/// Destination pitch (ignored when dst is array)
pub dstPitch: size_t,
/// Destination height (ignored when dst is array; may be 0 if Depth==1)
pub dstHeight: size_t,
/// Width of 3D memory copy in bytes
pub WidthInBytes: size_t,
/// Height of 3D memory copy
pub Height: size_t,
/// Depth of 3D memory copy
pub Depth: size_t,
}
impl Default for CUDA_MEMCPY3D_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// 3D memory copy parameters.
pub type CUDA_MEMCPY3D_v2 = CUDA_MEMCPY3D_st;
/// 3D memory copy parameters
pub type CUDA_MEMCPY3D = CUDA_MEMCPY3D_v2;
/// 3D memory cross-context copy parameters
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_MEMCPY3D_PEER_st {
/// Source X in bytes
pub srcXInBytes: size_t,
/// Source Y
pub srcY: size_t,
/// Source Z
pub srcZ: size_t,
/// Source LOD
pub srcLOD: size_t,
/// Source memory type (host, device, array)
pub srcMemoryType: CUmemorytype,
/// Source host pointer
pub srcHost: *const ::core::ffi::c_void,
/// Source device pointer
pub srcDevice: CUdeviceptr,
/// Source array reference
pub srcArray: CUarray,
/// Source context (ignored with srcMemoryType is ::CU_MEMORYTYPE_ARRAY)
pub srcContext: CUcontext,
/// Source pitch (ignored when src is array)
pub srcPitch: size_t,
/// Source height (ignored when src is array; may be 0 if Depth==1)
pub srcHeight: size_t,
/// Destination X in bytes
pub dstXInBytes: size_t,
/// Destination Y
pub dstY: size_t,
/// Destination Z
pub dstZ: size_t,
/// Destination LOD
pub dstLOD: size_t,
/// Destination memory type (host, device, array)
pub dstMemoryType: CUmemorytype,
/// Destination host pointer
pub dstHost: *mut ::core::ffi::c_void,
/// Destination device pointer
pub dstDevice: CUdeviceptr,
/// Destination array reference
pub dstArray: CUarray,
/// Destination context (ignored with dstMemoryType is ::CU_MEMORYTYPE_ARRAY)
pub dstContext: CUcontext,
/// Destination pitch (ignored when dst is array)
pub dstPitch: size_t,
/// Destination height (ignored when dst is array; may be 0 if Depth==1)
pub dstHeight: size_t,
/// Width of 3D memory copy in bytes
pub WidthInBytes: size_t,
/// Height of 3D memory copy
pub Height: size_t,
/// Depth of 3D memory copy
pub Depth: size_t,
}
impl Default for CUDA_MEMCPY3D_PEER_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// 3D memory cross-context copy parameters.
pub type CUDA_MEMCPY3D_PEER_v1 = CUDA_MEMCPY3D_PEER_st;
/// 3D memory cross-context copy parameters
pub type CUDA_MEMCPY3D_PEER = CUDA_MEMCPY3D_PEER_v1;
/// Memcpy node parameters
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_MEMCPY_NODE_PARAMS_st {
/// Must be zero
pub flags: ::core::ffi::c_int,
/// Must be zero
pub reserved: ::core::ffi::c_int,
/// Context on which to run the node
pub copyCtx: CUcontext,
/// Parameters for the memory copy
pub copyParams: CUDA_MEMCPY3D,
}
impl Default for CUDA_MEMCPY_NODE_PARAMS_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Memcpy node parameters.
pub type CUDA_MEMCPY_NODE_PARAMS = CUDA_MEMCPY_NODE_PARAMS_st;
/// Array descriptor
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_ARRAY_DESCRIPTOR_st {
/// Width of array
pub Width: size_t,
/// Height of array
pub Height: size_t,
/// Array format
pub Format: CUarray_format,
/// Channels per array element
pub NumChannels: ::core::ffi::c_uint,
}
impl Default for CUDA_ARRAY_DESCRIPTOR_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Array descriptor.
pub type CUDA_ARRAY_DESCRIPTOR_v2 = CUDA_ARRAY_DESCRIPTOR_st;
/// Array descriptor
pub type CUDA_ARRAY_DESCRIPTOR = CUDA_ARRAY_DESCRIPTOR_v2;
/// 3D array descriptor
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_ARRAY3D_DESCRIPTOR_st {
/// Width of 3D array
pub Width: size_t,
/// Height of 3D array
pub Height: size_t,
/// Depth of 3D array
pub Depth: size_t,
/// Array format
pub Format: CUarray_format,
/// Channels per array element
pub NumChannels: ::core::ffi::c_uint,
/// Flags
pub Flags: ::core::ffi::c_uint,
}
impl Default for CUDA_ARRAY3D_DESCRIPTOR_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// 3D array descriptor.
pub type CUDA_ARRAY3D_DESCRIPTOR_v2 = CUDA_ARRAY3D_DESCRIPTOR_st;
/// 3D array descriptor
pub type CUDA_ARRAY3D_DESCRIPTOR = CUDA_ARRAY3D_DESCRIPTOR_v2;
/// CUDA array sparse properties
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_ARRAY_SPARSE_PROPERTIES_st {
/// Width, height, and depth of a sparse array tile in elements.
pub tileExtent: CUDA_ARRAY_SPARSE_PROPERTIES_st__bindgen_ty_1,
/// First mip level at which the mip tail begins.
pub miptailFirstLevel: ::core::ffi::c_uint,
/// Total size of the mip tail.
pub miptailSize: ::core::ffi::c_ulonglong,
/// Flags will either be zero or ::CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL
pub flags: ::core::ffi::c_uint,
/// Reserved storage in the native ABI.
pub reserved: [::core::ffi::c_uint; 4usize],
}
/// Native layout of the `tileExtent` member of [`CUDA_ARRAY_SPARSE_PROPERTIES_st`].
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_ARRAY_SPARSE_PROPERTIES_st__bindgen_ty_1 {
/// Width of sparse tile in elements
pub width: ::core::ffi::c_uint,
/// Height of sparse tile in elements
pub height: ::core::ffi::c_uint,
/// Depth of sparse tile in elements
pub depth: ::core::ffi::c_uint,
}
/// CUDA array sparse properties.
pub type CUDA_ARRAY_SPARSE_PROPERTIES_v1 = CUDA_ARRAY_SPARSE_PROPERTIES_st;
/// CUDA array sparse properties
pub type CUDA_ARRAY_SPARSE_PROPERTIES = CUDA_ARRAY_SPARSE_PROPERTIES_v1;
/// CUDA array memory requirements
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_ARRAY_MEMORY_REQUIREMENTS_st {
/// Total required memory size
pub size: size_t,
/// alignment requirement
pub alignment: size_t,
/// Reserved storage in the native ABI.
pub reserved: [::core::ffi::c_uint; 4usize],
}
/// CUDA array memory requirements.
pub type CUDA_ARRAY_MEMORY_REQUIREMENTS_v1 = CUDA_ARRAY_MEMORY_REQUIREMENTS_st;
/// CUDA array memory requirements
pub type CUDA_ARRAY_MEMORY_REQUIREMENTS = CUDA_ARRAY_MEMORY_REQUIREMENTS_v1;
/// CUDA Resource descriptor
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUDA_RESOURCE_DESC_st {
/// Resource type
pub resType: CUresourcetype,
/// Resource storage description selected by `resType`.
pub res: CUDA_RESOURCE_DESC_st__bindgen_ty_1,
/// Flags (must be zero)
pub flags: ::core::ffi::c_uint,
}
/// Native layout of the `res` member of [`CUDA_RESOURCE_DESC_st`].
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUDA_RESOURCE_DESC_st__bindgen_ty_1 {
/// CUDA array handle used for an array resource.
pub array: CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_1,
/// CUDA mipmapped-array handle used for a mipmapped resource.
pub mipmap: CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_2,
/// Device pointer, element format, and capacity of a linear resource.
pub linear: CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_3,
/// Device pointer, element format, dimensions, and row pitch of a two-dimensional resource.
pub pitch2D: CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_4,
/// Reserved storage in the native ABI.
pub reserved: CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_5,
}
/// Native layout of the `array` member of [`CUDA_RESOURCE_DESC_st__bindgen_ty_1`].
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_1 {
/// CUDA array
pub hArray: CUarray,
}
impl Default for CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Native layout of the `mipmap` member of [`CUDA_RESOURCE_DESC_st__bindgen_ty_1`].
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_2 {
/// CUDA mipmapped array
pub hMipmappedArray: CUmipmappedArray,
}
impl Default for CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_2 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Native layout of the `linear` member of [`CUDA_RESOURCE_DESC_st__bindgen_ty_1`].
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_3 {
/// Device pointer
pub devPtr: CUdeviceptr,
/// Array format
pub format: CUarray_format,
/// Channels per array element
pub numChannels: ::core::ffi::c_uint,
/// Size in bytes
pub sizeInBytes: size_t,
}
impl Default for CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_3 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Native layout of the `pitch2D` member of [`CUDA_RESOURCE_DESC_st__bindgen_ty_1`].
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_4 {
/// Device pointer
pub devPtr: CUdeviceptr,
/// Array format
pub format: CUarray_format,
/// Channels per array element
pub numChannels: ::core::ffi::c_uint,
/// Width of the array in elements
pub width: size_t,
/// Height of the array in elements
pub height: size_t,
/// Pitch between two rows in bytes
pub pitchInBytes: size_t,
}
impl Default for CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_4 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Native layout of the `reserved` member of [`CUDA_RESOURCE_DESC_st__bindgen_ty_1`].
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_5 {
/// Reserved storage in the native ABI.
pub reserved: [::core::ffi::c_int; 32usize],
}
impl Default for CUDA_RESOURCE_DESC_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUDA_RESOURCE_DESC_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// CUDA Resource descriptor.
pub type CUDA_RESOURCE_DESC_v1 = CUDA_RESOURCE_DESC_st;
/// CUDA Resource descriptor
pub type CUDA_RESOURCE_DESC = CUDA_RESOURCE_DESC_v1;
/// Texture descriptor
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialOrd, PartialEq)]
pub struct CUDA_TEXTURE_DESC_st {
/// Address modes
pub addressMode: [CUaddress_mode; 3usize],
/// Filter mode
pub filterMode: CUfilter_mode,
/// Flags
pub flags: ::core::ffi::c_uint,
/// Maximum anisotropy ratio
pub maxAnisotropy: ::core::ffi::c_uint,
/// Mipmap filter mode
pub mipmapFilterMode: CUfilter_mode,
/// Mipmap level bias
pub mipmapLevelBias: f32,
/// Mipmap minimum level clamp
pub minMipmapLevelClamp: f32,
/// Mipmap maximum level clamp
pub maxMipmapLevelClamp: f32,
/// Border Color
pub borderColor: [f32; 4usize],
/// Reserved storage in the native ABI.
pub reserved: [::core::ffi::c_int; 12usize],
}
impl Default for CUDA_TEXTURE_DESC_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Texture descriptor.
pub type CUDA_TEXTURE_DESC_v1 = CUDA_TEXTURE_DESC_st;
/// Texture descriptor
pub type CUDA_TEXTURE_DESC = CUDA_TEXTURE_DESC_v1;
impl CUresourceViewFormat_enum {
/// No resource view format (use underlying resource format).
pub const CU_RES_VIEW_FORMAT_NONE: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
0,
);
/// 1 channel unsigned 8-bit integers.
pub const CU_RES_VIEW_FORMAT_UINT_1X8: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
1,
);
/// 2 channel unsigned 8-bit integers.
pub const CU_RES_VIEW_FORMAT_UINT_2X8: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
2,
);
/// 4 channel unsigned 8-bit integers.
pub const CU_RES_VIEW_FORMAT_UINT_4X8: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
3,
);
/// 1 channel signed 8-bit integers.
pub const CU_RES_VIEW_FORMAT_SINT_1X8: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
4,
);
/// 2 channel signed 8-bit integers.
pub const CU_RES_VIEW_FORMAT_SINT_2X8: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
5,
);
/// 4 channel signed 8-bit integers.
pub const CU_RES_VIEW_FORMAT_SINT_4X8: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
6,
);
/// 1 channel unsigned 16-bit integers.
pub const CU_RES_VIEW_FORMAT_UINT_1X16: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
7,
);
/// 2 channel unsigned 16-bit integers.
pub const CU_RES_VIEW_FORMAT_UINT_2X16: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
8,
);
/// 4 channel unsigned 16-bit integers.
pub const CU_RES_VIEW_FORMAT_UINT_4X16: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
9,
);
/// 1 channel signed 16-bit integers.
pub const CU_RES_VIEW_FORMAT_SINT_1X16: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
10,
);
/// 2 channel signed 16-bit integers.
pub const CU_RES_VIEW_FORMAT_SINT_2X16: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
11,
);
/// 4 channel signed 16-bit integers.
pub const CU_RES_VIEW_FORMAT_SINT_4X16: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
12,
);
/// 1 channel unsigned 32-bit integers.
pub const CU_RES_VIEW_FORMAT_UINT_1X32: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
13,
);
/// 2 channel unsigned 32-bit integers.
pub const CU_RES_VIEW_FORMAT_UINT_2X32: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
14,
);
/// 4 channel unsigned 32-bit integers.
pub const CU_RES_VIEW_FORMAT_UINT_4X32: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
15,
);
/// 1 channel signed 32-bit integers.
pub const CU_RES_VIEW_FORMAT_SINT_1X32: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
16,
);
/// 2 channel signed 32-bit integers.
pub const CU_RES_VIEW_FORMAT_SINT_2X32: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
17,
);
/// 4 channel signed 32-bit integers.
pub const CU_RES_VIEW_FORMAT_SINT_4X32: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
18,
);
/// 1 channel 16-bit floating point.
pub const CU_RES_VIEW_FORMAT_FLOAT_1X16: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
19,
);
/// 2 channel 16-bit floating point.
pub const CU_RES_VIEW_FORMAT_FLOAT_2X16: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
20,
);
/// 4 channel 16-bit floating point.
pub const CU_RES_VIEW_FORMAT_FLOAT_4X16: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
21,
);
/// 1 channel 32-bit floating point.
pub const CU_RES_VIEW_FORMAT_FLOAT_1X32: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
22,
);
/// 2 channel 32-bit floating point.
pub const CU_RES_VIEW_FORMAT_FLOAT_2X32: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
23,
);
/// 4 channel 32-bit floating point.
pub const CU_RES_VIEW_FORMAT_FLOAT_4X32: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
24,
);
/// Block compressed 1.
pub const CU_RES_VIEW_FORMAT_UNSIGNED_BC1: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
25,
);
/// Block compressed 2.
pub const CU_RES_VIEW_FORMAT_UNSIGNED_BC2: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
26,
);
/// Block compressed 3.
pub const CU_RES_VIEW_FORMAT_UNSIGNED_BC3: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
27,
);
/// Block compressed 4 unsigned.
pub const CU_RES_VIEW_FORMAT_UNSIGNED_BC4: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
28,
);
/// Block compressed 4 signed.
pub const CU_RES_VIEW_FORMAT_SIGNED_BC4: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
29,
);
/// Block compressed 5 unsigned.
pub const CU_RES_VIEW_FORMAT_UNSIGNED_BC5: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
30,
);
/// Block compressed 5 signed.
pub const CU_RES_VIEW_FORMAT_SIGNED_BC5: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
31,
);
/// Block compressed 6 unsigned half-float.
pub const CU_RES_VIEW_FORMAT_UNSIGNED_BC6H: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
32,
);
/// Block compressed 6 signed half-float.
pub const CU_RES_VIEW_FORMAT_SIGNED_BC6H: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
33,
);
/// Block compressed 7.
pub const CU_RES_VIEW_FORMAT_UNSIGNED_BC7: CUresourceViewFormat_enum = CUresourceViewFormat_enum(
34,
);
}
/// Resource view format
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUresourceViewFormat_enum(pub ::core::ffi::c_uint);
pub use self::CUresourceViewFormat_enum as CUresourceViewFormat;
/// Resource view descriptor
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_RESOURCE_VIEW_DESC_st {
/// Resource view format
pub format: CUresourceViewFormat,
/// Width of the resource view
pub width: size_t,
/// Height of the resource view
pub height: size_t,
/// Depth of the resource view
pub depth: size_t,
/// First defined mipmap level
pub firstMipmapLevel: ::core::ffi::c_uint,
/// Last defined mipmap level
pub lastMipmapLevel: ::core::ffi::c_uint,
/// First layer index
pub firstLayer: ::core::ffi::c_uint,
/// Last layer index
pub lastLayer: ::core::ffi::c_uint,
/// Reserved storage in the native ABI.
pub reserved: [::core::ffi::c_uint; 16usize],
}
impl Default for CUDA_RESOURCE_VIEW_DESC_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Resource view descriptor.
pub type CUDA_RESOURCE_VIEW_DESC_v1 = CUDA_RESOURCE_VIEW_DESC_st;
/// Resource view descriptor
pub type CUDA_RESOURCE_VIEW_DESC = CUDA_RESOURCE_VIEW_DESC_v1;
/// Tensor map descriptor. Requires compiler support for aligning to 128 bytes.
#[repr(C)]
#[repr(align(128))]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUtensorMap_st {
/// Opaque descriptor storage populated by the CUDA tensor-map encoding APIs.
pub opaque: [cuuint64_t; 16usize],
}
impl Default for CUtensorMap_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Tensor map descriptor.
///
/// Requires compiler support for aligning to 128 bytes.
pub type CUtensorMap = CUtensorMap_st;
impl CUtensorMapDataType_enum {
/// Unsigned 8-bit integer elements.
pub const CU_TENSOR_MAP_DATA_TYPE_UINT8: CUtensorMapDataType_enum = CUtensorMapDataType_enum(
0,
);
/// Unsigned 16-bit integer elements.
pub const CU_TENSOR_MAP_DATA_TYPE_UINT16: CUtensorMapDataType_enum = CUtensorMapDataType_enum(
1,
);
/// Unsigned 32-bit integer elements.
pub const CU_TENSOR_MAP_DATA_TYPE_UINT32: CUtensorMapDataType_enum = CUtensorMapDataType_enum(
2,
);
/// Signed 32-bit integer elements.
pub const CU_TENSOR_MAP_DATA_TYPE_INT32: CUtensorMapDataType_enum = CUtensorMapDataType_enum(
3,
);
/// Unsigned 64-bit integer elements.
pub const CU_TENSOR_MAP_DATA_TYPE_UINT64: CUtensorMapDataType_enum = CUtensorMapDataType_enum(
4,
);
/// Signed 64-bit integer elements.
pub const CU_TENSOR_MAP_DATA_TYPE_INT64: CUtensorMapDataType_enum = CUtensorMapDataType_enum(
5,
);
/// 16-bit floating-point elements.
pub const CU_TENSOR_MAP_DATA_TYPE_FLOAT16: CUtensorMapDataType_enum = CUtensorMapDataType_enum(
6,
);
/// 32-bit floating-point elements.
pub const CU_TENSOR_MAP_DATA_TYPE_FLOAT32: CUtensorMapDataType_enum = CUtensorMapDataType_enum(
7,
);
/// 64-bit floating-point elements.
pub const CU_TENSOR_MAP_DATA_TYPE_FLOAT64: CUtensorMapDataType_enum = CUtensorMapDataType_enum(
8,
);
/// 16-bit brain floating-point elements.
pub const CU_TENSOR_MAP_DATA_TYPE_BFLOAT16: CUtensorMapDataType_enum = CUtensorMapDataType_enum(
9,
);
/// 32-bit floating-point elements with subnormal values flushed to zero.
pub const CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ: CUtensorMapDataType_enum = CUtensorMapDataType_enum(
10,
);
/// TensorFloat-32 elements.
pub const CU_TENSOR_MAP_DATA_TYPE_TFLOAT32: CUtensorMapDataType_enum = CUtensorMapDataType_enum(
11,
);
/// TensorFloat-32 elements with subnormal values flushed to zero.
pub const CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ: CUtensorMapDataType_enum = CUtensorMapDataType_enum(
12,
);
/// Groups of sixteen unsigned 4-bit values packed into eight bytes, with no gaps between groups.
pub const CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B: CUtensorMapDataType_enum = CUtensorMapDataType_enum(
13,
);
/// Groups of sixteen unsigned 4-bit values in 16-byte-aligned storage, with eight padding bytes after each eight-byte packed group.
pub const CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B: CUtensorMapDataType_enum = CUtensorMapDataType_enum(
14,
);
/// Groups of sixteen unsigned 6-bit values in 16-byte-aligned storage, with four padding bytes after each twelve-byte packed group.
pub const CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B: CUtensorMapDataType_enum = CUtensorMapDataType_enum(
15,
);
}
/// Tensor map data type
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUtensorMapDataType_enum(pub ::core::ffi::c_uint);
pub use self::CUtensorMapDataType_enum as CUtensorMapDataType;
impl CUtensorMapInterleave_enum {
/// No channel interleaving.
pub const CU_TENSOR_MAP_INTERLEAVE_NONE: CUtensorMapInterleave_enum = CUtensorMapInterleave_enum(
0,
);
/// Interleaves channels in 16-byte groups, such as eight 16-bit channels per group.
pub const CU_TENSOR_MAP_INTERLEAVE_16B: CUtensorMapInterleave_enum = CUtensorMapInterleave_enum(
1,
);
/// Interleaves channels in 32-byte groups, such as sixteen 16-bit channels per group.
pub const CU_TENSOR_MAP_INTERLEAVE_32B: CUtensorMapInterleave_enum = CUtensorMapInterleave_enum(
2,
);
}
/// Tensor map interleave layout type
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUtensorMapInterleave_enum(pub ::core::ffi::c_uint);
pub use self::CUtensorMapInterleave_enum as CUtensorMapInterleave;
impl CUtensorMapSwizzle_enum {
/// No shared-memory swizzling.
pub const CU_TENSOR_MAP_SWIZZLE_NONE: CUtensorMapSwizzle_enum = CUtensorMapSwizzle_enum(
0,
);
/// Swizzles 16-byte chunks within a 32-byte span.
pub const CU_TENSOR_MAP_SWIZZLE_32B: CUtensorMapSwizzle_enum = CUtensorMapSwizzle_enum(
1,
);
/// Swizzles 16-byte chunks within a 64-byte span.
pub const CU_TENSOR_MAP_SWIZZLE_64B: CUtensorMapSwizzle_enum = CUtensorMapSwizzle_enum(
2,
);
/// Swizzles 16-byte chunks within a 128-byte span.
pub const CU_TENSOR_MAP_SWIZZLE_128B: CUtensorMapSwizzle_enum = CUtensorMapSwizzle_enum(
3,
);
/// Swizzles 32-byte chunks within a 128-byte span.
pub const CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B: CUtensorMapSwizzle_enum = CUtensorMapSwizzle_enum(
4,
);
/// Swizzles 32-byte chunks within a 128-byte span and exchanges the lower and upper eight bytes of each 16-byte unit on alternate rows.
pub const CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B_FLIP_8B: CUtensorMapSwizzle_enum = CUtensorMapSwizzle_enum(
5,
);
/// Swizzles 64-byte chunks within a 128-byte span.
pub const CU_TENSOR_MAP_SWIZZLE_128B_ATOM_64B: CUtensorMapSwizzle_enum = CUtensorMapSwizzle_enum(
6,
);
}
/// Tensor map swizzling mode of shared memory banks
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUtensorMapSwizzle_enum(pub ::core::ffi::c_uint);
pub use self::CUtensorMapSwizzle_enum as CUtensorMapSwizzle;
impl CUtensorMapL2promotion_enum {
/// No L2 fetch-size promotion.
pub const CU_TENSOR_MAP_L2_PROMOTION_NONE: CUtensorMapL2promotion_enum = CUtensorMapL2promotion_enum(
0,
);
/// Fills L2 requests from DRAM at 64-byte granularity.
pub const CU_TENSOR_MAP_L2_PROMOTION_L2_64B: CUtensorMapL2promotion_enum = CUtensorMapL2promotion_enum(
1,
);
/// Fills L2 requests from DRAM at 128-byte granularity.
pub const CU_TENSOR_MAP_L2_PROMOTION_L2_128B: CUtensorMapL2promotion_enum = CUtensorMapL2promotion_enum(
2,
);
/// Fills L2 requests from DRAM at 256-byte granularity.
pub const CU_TENSOR_MAP_L2_PROMOTION_L2_256B: CUtensorMapL2promotion_enum = CUtensorMapL2promotion_enum(
3,
);
}
/// Tensor map L2 promotion type
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUtensorMapL2promotion_enum(pub ::core::ffi::c_uint);
pub use self::CUtensorMapL2promotion_enum as CUtensorMapL2promotion;
impl CUtensorMapFloatOOBfill_enum {
/// Fills out-of-bounds elements with zero.
pub const CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE: CUtensorMapFloatOOBfill_enum = CUtensorMapFloatOOBfill_enum(
0,
);
/// Fills out-of-bounds elements with the special NaN value that requests zero contribution to FMA. Only floating-point tensor data types support this mode.
pub const CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA: CUtensorMapFloatOOBfill_enum = CUtensorMapFloatOOBfill_enum(
1,
);
}
/// Tensor map out-of-bounds fill type
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUtensorMapFloatOOBfill_enum(pub ::core::ffi::c_uint);
pub use self::CUtensorMapFloatOOBfill_enum as CUtensorMapFloatOOBfill;
impl CUtensorMapIm2ColWideMode_enum {
/// Loads along the W dimension using the element count in `pixelsPerColumn`.
pub const CU_TENSOR_MAP_IM2COL_WIDE_MODE_W: CUtensorMapIm2ColWideMode_enum = CUtensorMapIm2ColWideMode_enum(
0,
);
/// Uses native W128 loading along the W dimension; `pixelsPerColumn` is ignored.
pub const CU_TENSOR_MAP_IM2COL_WIDE_MODE_W128: CUtensorMapIm2ColWideMode_enum = CUtensorMapIm2ColWideMode_enum(
1,
);
}
/// Tensor map Im2Col wide mode
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUtensorMapIm2ColWideMode_enum(pub ::core::ffi::c_uint);
pub use self::CUtensorMapIm2ColWideMode_enum as CUtensorMapIm2ColWideMode;
/// GPU Direct v3 tokens
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st {
/// GPUDirect peer-to-peer token identifying the allocation.
pub p2pToken: ::core::ffi::c_ulonglong,
/// Token identifying the CUDA virtual address space for GPUDirect peer access.
pub vaSpaceToken: ::core::ffi::c_uint,
}
/// GPU Direct v3 tokens.
pub type CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1 = CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st;
/// GPU Direct v3 tokens
pub type CUDA_POINTER_ATTRIBUTE_P2P_TOKENS = CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1;
impl CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum {
/// No access, meaning the device cannot access this memory at all, thus must be staged through accessible memory in order to complete certain operations.
pub const CU_POINTER_ATTRIBUTE_ACCESS_FLAG_NONE: CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum = CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum(
0,
);
/// Read-only access, meaning writes to this memory are considered invalid accesses and thus return error in that case.
pub const CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READ: CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum = CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum(
1,
);
/// Read-write access, the device has full read-write access to the memory.
pub const CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READWRITE: CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum = CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum(
3,
);
}
/// Access flags that specify the level of access the current context's device has on the memory referenced.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum(pub ::core::ffi::c_uint);
pub use self::CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum as CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS;
/// Kernel launch parameters
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_LAUNCH_PARAMS_st {
/// Kernel to launch
pub function: CUfunction,
/// Width of grid in blocks
pub gridDimX: ::core::ffi::c_uint,
/// Height of grid in blocks
pub gridDimY: ::core::ffi::c_uint,
/// Depth of grid in blocks
pub gridDimZ: ::core::ffi::c_uint,
/// X dimension of each thread block
pub blockDimX: ::core::ffi::c_uint,
/// Y dimension of each thread block
pub blockDimY: ::core::ffi::c_uint,
/// Z dimension of each thread block
pub blockDimZ: ::core::ffi::c_uint,
/// Dynamic shared-memory size per thread block in bytes
pub sharedMemBytes: ::core::ffi::c_uint,
/// Stream identifier
pub hStream: CUstream,
/// Array of pointers to kernel parameters
pub kernelParams: *mut *mut ::core::ffi::c_void,
}
impl Default for CUDA_LAUNCH_PARAMS_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Kernel launch parameters.
pub type CUDA_LAUNCH_PARAMS_v1 = CUDA_LAUNCH_PARAMS_st;
/// Kernel launch parameters
pub type CUDA_LAUNCH_PARAMS = CUDA_LAUNCH_PARAMS_v1;
impl CUexternalMemoryHandleType_enum {
/// Handle is an opaque file descriptor.
pub const CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD: CUexternalMemoryHandleType_enum = CUexternalMemoryHandleType_enum(
1,
);
/// Handle is an opaque shared NT handle.
pub const CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32: CUexternalMemoryHandleType_enum = CUexternalMemoryHandleType_enum(
2,
);
/// Handle is an opaque, globally shared handle.
pub const CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT: CUexternalMemoryHandleType_enum = CUexternalMemoryHandleType_enum(
3,
);
/// Handle is a D3D12 heap object.
pub const CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP: CUexternalMemoryHandleType_enum = CUexternalMemoryHandleType_enum(
4,
);
/// Handle is a D3D12 committed resource.
pub const CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE: CUexternalMemoryHandleType_enum = CUexternalMemoryHandleType_enum(
5,
);
/// Handle is a shared NT handle to a D3D11 resource.
pub const CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE: CUexternalMemoryHandleType_enum = CUexternalMemoryHandleType_enum(
6,
);
/// Handle is a globally shared handle to a D3D11 resource.
pub const CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT: CUexternalMemoryHandleType_enum = CUexternalMemoryHandleType_enum(
7,
);
/// Handle is an NvSciBuf object.
pub const CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF: CUexternalMemoryHandleType_enum = CUexternalMemoryHandleType_enum(
8,
);
/// Handle is a dma_buf file descriptor.
pub const CU_EXTERNAL_MEMORY_HANDLE_TYPE_DMABUF_FD: CUexternalMemoryHandleType_enum = CUexternalMemoryHandleType_enum(
9,
);
}
/// External memory handle types
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUexternalMemoryHandleType_enum(pub ::core::ffi::c_uint);
pub use self::CUexternalMemoryHandleType_enum as CUexternalMemoryHandleType;
/// External memory handle descriptor
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st {
/// Type of the handle
pub type_: CUexternalMemoryHandleType,
/// Platform-specific external handle representation selected by `type`.
pub handle: CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st__bindgen_ty_1,
/// Size of the memory allocation
pub size: ::core::ffi::c_ulonglong,
/// Flags must either be zero or ::CUDA_EXTERNAL_MEMORY_DEDICATED
pub flags: ::core::ffi::c_uint,
/// Reserved storage in the native ABI.
pub reserved: [::core::ffi::c_uint; 16usize],
}
/// Native layout of the `handle` member of [`CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st`].
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st__bindgen_ty_1 {
/// File descriptor referencing the memory object. Valid when type is ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD
pub fd: ::core::ffi::c_int,
/// Win32 handle referencing the semaphore object. Valid when type is one of the following:
/// - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32
/// - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT
/// - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP
/// - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE
/// - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE
/// - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT Exactly one of 'handle' and 'name' must be non-NULL. If type is one of the following: ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT then 'name' must be NULL.
pub win32: CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st__bindgen_ty_1__bindgen_ty_1,
/// A handle representing an NvSciBuf Object. Valid when type is ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF
pub nvSciBufObject: *const ::core::ffi::c_void,
}
/// Win32 handle referencing the semaphore object. Valid when type is one of the following:
/// - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32
/// - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT
/// - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP
/// - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE
/// - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE
/// - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT Exactly one of 'handle' and 'name' must be non-NULL. If type is one of the following: ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT then 'name' must be NULL.
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st__bindgen_ty_1__bindgen_ty_1 {
/// Valid NT handle. Must be NULL if 'name' is non-NULL
pub handle: *mut ::core::ffi::c_void,
/// Name of a valid memory object. Must be NULL if 'handle' is non-NULL.
pub name: *const ::core::ffi::c_void,
}
impl Default for CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st__bindgen_ty_1__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// External memory handle descriptor.
pub type CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1 = CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st;
/// External memory handle descriptor
pub type CUDA_EXTERNAL_MEMORY_HANDLE_DESC = CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1;
/// External memory buffer descriptor
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st {
/// Offset into the memory object where the buffer's base is
pub offset: ::core::ffi::c_ulonglong,
/// Size of the buffer
pub size: ::core::ffi::c_ulonglong,
/// Flags reserved for future use. Must be zero.
pub flags: ::core::ffi::c_uint,
/// Reserved storage in the native ABI.
pub reserved: [::core::ffi::c_uint; 16usize],
}
/// External memory buffer descriptor.
pub type CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1 = CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st;
/// External memory buffer descriptor
pub type CUDA_EXTERNAL_MEMORY_BUFFER_DESC = CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1;
/// External memory mipmap descriptor
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st {
/// Offset into the memory object where the base level of the mipmap chain is.
pub offset: ::core::ffi::c_ulonglong,
/// Format, dimension and type of base level of the mipmap chain
pub arrayDesc: CUDA_ARRAY3D_DESCRIPTOR,
/// Total number of levels in the mipmap chain
pub numLevels: ::core::ffi::c_uint,
/// Reserved storage in the native ABI.
pub reserved: [::core::ffi::c_uint; 16usize],
}
impl Default for CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// External memory mipmap descriptor.
pub type CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1 = CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st;
/// External memory mipmap descriptor
pub type CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC = CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1;
impl CUexternalSemaphoreHandleType_enum {
/// Handle is an opaque file descriptor.
pub const CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD: CUexternalSemaphoreHandleType_enum = CUexternalSemaphoreHandleType_enum(
1,
);
/// Handle is an opaque shared NT handle.
pub const CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32: CUexternalSemaphoreHandleType_enum = CUexternalSemaphoreHandleType_enum(
2,
);
/// Handle is an opaque, globally shared handle.
pub const CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT: CUexternalSemaphoreHandleType_enum = CUexternalSemaphoreHandleType_enum(
3,
);
/// Handle is a shared NT handle referencing a D3D12 fence object.
pub const CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE: CUexternalSemaphoreHandleType_enum = CUexternalSemaphoreHandleType_enum(
4,
);
/// Handle is a shared NT handle referencing a D3D11 fence object.
pub const CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE: CUexternalSemaphoreHandleType_enum = CUexternalSemaphoreHandleType_enum(
5,
);
/// Opaque handle to NvSciSync Object.
pub const CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC: CUexternalSemaphoreHandleType_enum = CUexternalSemaphoreHandleType_enum(
6,
);
/// Handle is a shared NT handle referencing a D3D11 keyed mutex object.
pub const CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX: CUexternalSemaphoreHandleType_enum = CUexternalSemaphoreHandleType_enum(
7,
);
/// Handle is a globally shared handle referencing a D3D11 keyed mutex object.
pub const CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT: CUexternalSemaphoreHandleType_enum = CUexternalSemaphoreHandleType_enum(
8,
);
/// Handle is an opaque file descriptor referencing a timeline semaphore.
pub const CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD: CUexternalSemaphoreHandleType_enum = CUexternalSemaphoreHandleType_enum(
9,
);
/// Handle is an opaque shared NT handle referencing a timeline semaphore.
pub const CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32: CUexternalSemaphoreHandleType_enum = CUexternalSemaphoreHandleType_enum(
10,
);
}
/// External semaphore handle types
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUexternalSemaphoreHandleType_enum(pub ::core::ffi::c_uint);
pub use self::CUexternalSemaphoreHandleType_enum as CUexternalSemaphoreHandleType;
/// External semaphore handle descriptor
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st {
/// Type of the handle
pub type_: CUexternalSemaphoreHandleType,
/// Platform-specific external handle representation selected by `type`.
pub handle: CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st__bindgen_ty_1,
/// Flags reserved for the future. Must be zero.
pub flags: ::core::ffi::c_uint,
/// Reserved storage in the native ABI.
pub reserved: [::core::ffi::c_uint; 16usize],
}
/// Native layout of the `handle` member of [`CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st`].
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st__bindgen_ty_1 {
/// File descriptor referencing the semaphore object. Valid when type is one of the following:
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD
pub fd: ::core::ffi::c_int,
/// Win32 handle referencing the semaphore object. Valid when type is one of the following:
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 Exactly one of 'handle' and 'name' must be non-NULL. If type is one of the following:
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT then 'name' must be NULL.
pub win32: CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st__bindgen_ty_1__bindgen_ty_1,
/// Valid NvSciSyncObj. Must be non NULL
pub nvSciSyncObj: *const ::core::ffi::c_void,
}
/// Win32 handle referencing the semaphore object. Valid when type is one of the following:
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 Exactly one of 'handle' and 'name' must be non-NULL. If type is one of the following:
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT
/// - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT then 'name' must be NULL.
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st__bindgen_ty_1__bindgen_ty_1 {
/// Valid NT handle. Must be NULL if 'name' is non-NULL
pub handle: *mut ::core::ffi::c_void,
/// Name of a valid synchronization primitive. Must be NULL if 'handle' is non-NULL.
pub name: *const ::core::ffi::c_void,
}
impl Default for CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st__bindgen_ty_1__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// External semaphore handle descriptor.
pub type CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1 = CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st;
/// External semaphore handle descriptor
pub type CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC = CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1;
/// External semaphore signal parameters
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st {
/// Payload for the signal operation, interpreted using the external semaphore's handle type.
pub params: CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1,
/// Only when ::CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS is used to signal a ::CUexternalSemaphore of type ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is ::CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC which indicates that while signaling the ::CUexternalSemaphore, no memory synchronization operations should be performed for any external memory object imported as ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. For all other types of ::CUexternalSemaphore, flags must be zero.
pub flags: ::core::ffi::c_uint,
/// Reserved storage in the native ABI.
pub reserved: [::core::ffi::c_uint; 16usize],
}
/// Native layout of the `params` member of [`CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st`].
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1 {
/// Parameters for fence objects
pub fence: CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1__bindgen_ty_1,
/// NvSciSync fence representation used for an NvSciSync semaphore.
pub nvSciSync: CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1__bindgen_ty_2,
/// Parameters for keyed mutex objects
pub keyedMutex: CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1__bindgen_ty_3,
/// Reserved storage in the native ABI.
pub reserved: [::core::ffi::c_uint; 12usize],
}
/// Parameters for fence objects
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1__bindgen_ty_1 {
/// Value of fence to be signaled
pub value: ::core::ffi::c_ulonglong,
}
/// Native layout of the `nvSciSync` member of [`CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1`].
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1__bindgen_ty_2 {
/// Pointer to NvSciSyncFence. Valid if ::CUexternalSemaphoreHandleType is of type ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC.
pub fence: *mut ::core::ffi::c_void,
/// Reserved storage in the native ABI.
pub reserved: ::core::ffi::c_ulonglong,
}
impl Default for CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1__bindgen_ty_2 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Parameters for keyed mutex objects
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1__bindgen_ty_3 {
/// Value of key to release the mutex with
pub key: ::core::ffi::c_ulonglong,
}
impl Default for CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// External semaphore signal parameters.
pub type CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1 = CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st;
/// External semaphore signal parameters
pub type CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS = CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1;
/// External semaphore wait parameters
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st {
/// Payload for the wait operation, interpreted using the external semaphore's handle type.
pub params: CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1,
/// Only when ::CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS is used to wait on a ::CUexternalSemaphore of type ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is ::CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC which indicates that while waiting for the ::CUexternalSemaphore, no memory synchronization operations should be performed for any external memory object imported as ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. For all other types of ::CUexternalSemaphore, flags must be zero.
pub flags: ::core::ffi::c_uint,
/// Reserved storage in the native ABI.
pub reserved: [::core::ffi::c_uint; 16usize],
}
/// Native layout of the `params` member of [`CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st`].
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1 {
/// Parameters for fence objects
pub fence: CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1__bindgen_ty_1,
/// Pointer to NvSciSyncFence. Valid if CUexternalSemaphoreHandleType is of type CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC.
pub nvSciSync: CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1__bindgen_ty_2,
/// Parameters for keyed mutex objects
pub keyedMutex: CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1__bindgen_ty_3,
/// Reserved storage in the native ABI.
pub reserved: [::core::ffi::c_uint; 10usize],
}
/// Parameters for fence objects
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1__bindgen_ty_1 {
/// Value of fence to be waited on
pub value: ::core::ffi::c_ulonglong,
}
/// Pointer to NvSciSyncFence. Valid if CUexternalSemaphoreHandleType is of type CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC.
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1__bindgen_ty_2 {
/// Pointer to the NvSciSync fence used by this semaphore operation.
pub fence: *mut ::core::ffi::c_void,
/// Reserved storage in the native ABI.
pub reserved: ::core::ffi::c_ulonglong,
}
impl Default for CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1__bindgen_ty_2 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Parameters for keyed mutex objects
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1__bindgen_ty_3 {
/// Value of key to acquire the mutex with
pub key: ::core::ffi::c_ulonglong,
/// Timeout in milliseconds to wait to acquire the mutex
pub timeoutMs: ::core::ffi::c_uint,
}
impl Default for CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// External semaphore wait parameters.
pub type CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1 = CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st;
/// External semaphore wait parameters
pub type CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS = CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1;
/// Semaphore signal node parameters
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st {
/// Array of external semaphore handles.
pub extSemArray: *mut CUexternalSemaphore,
/// Array of external semaphore signal parameters.
pub paramsArray: *const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS,
/// Number of handles and parameters supplied in extSemArray and paramsArray.
pub numExtSems: ::core::ffi::c_uint,
}
impl Default for CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Semaphore signal node parameters.
pub type CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1 = CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st;
/// Semaphore signal node parameters
pub type CUDA_EXT_SEM_SIGNAL_NODE_PARAMS = CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1;
/// Semaphore signal node parameters
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st {
/// Array of external semaphore handles.
pub extSemArray: *mut CUexternalSemaphore,
/// Array of external semaphore signal parameters.
pub paramsArray: *const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS,
/// Number of handles and parameters supplied in extSemArray and paramsArray.
pub numExtSems: ::core::ffi::c_uint,
/// Anonymous native member. See [`CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st__bindgen_ty_1`] for its fields.
pub __bindgen_anon_1: CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st__bindgen_ty_1,
}
/// preferred context to use for the semaphore signal task
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st__bindgen_ty_1 {
/// Preferred CUDA context for the external semaphore signal task.
pub ctx: CUcontext,
/// Preferred green context for the external semaphore signal task.
pub gCtx: CUgreenCtx,
}
impl Default for CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Semaphore signal node parameters.
pub type CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2 = CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st;
/// Semaphore wait node parameters
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_EXT_SEM_WAIT_NODE_PARAMS_st {
/// Array of external semaphore handles.
pub extSemArray: *mut CUexternalSemaphore,
/// Array of external semaphore wait parameters.
pub paramsArray: *const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS,
/// Number of handles and parameters supplied in extSemArray and paramsArray.
pub numExtSems: ::core::ffi::c_uint,
}
impl Default for CUDA_EXT_SEM_WAIT_NODE_PARAMS_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Semaphore wait node parameters.
pub type CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1 = CUDA_EXT_SEM_WAIT_NODE_PARAMS_st;
/// Semaphore wait node parameters
pub type CUDA_EXT_SEM_WAIT_NODE_PARAMS = CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1;
/// Semaphore wait node parameters
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st {
/// Array of external semaphore handles.
pub extSemArray: *mut CUexternalSemaphore,
/// Array of external semaphore wait parameters.
pub paramsArray: *const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS,
/// Number of handles and parameters supplied in extSemArray and paramsArray.
pub numExtSems: ::core::ffi::c_uint,
/// Anonymous native member. See [`CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st__bindgen_ty_1`] for its fields.
pub __bindgen_anon_1: CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st__bindgen_ty_1,
}
/// preferred context to use for the semaphore wait task
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st__bindgen_ty_1 {
/// Preferred CUDA context for the external semaphore wait task.
pub ctx: CUcontext,
/// Preferred green context for the external semaphore wait task.
pub gCtx: CUgreenCtx,
}
impl Default for CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Semaphore wait node parameters.
pub type CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2 = CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st;
/// Opaque handle to a CUDA virtual-memory allocation. The handle identifies an allocation, not a device address; mappings are established separately with [`cuMemMap`].
pub type CUmemGenericAllocationHandle_v1 = ::core::ffi::c_ulonglong;
/// Opaque handle to a CUDA virtual-memory allocation. The handle identifies an allocation, not a device address; mappings are established separately with [`cuMemMap`].
pub type CUmemGenericAllocationHandle = CUmemGenericAllocationHandle_v1;
impl CUmemAllocationHandleType_enum {
/// Does not allow any export mechanism.
///
/// >.
pub const CU_MEM_HANDLE_TYPE_NONE: CUmemAllocationHandleType_enum = CUmemAllocationHandleType_enum(
0,
);
/// Allows a file descriptor to be used for exporting.
///
/// Permitted only on POSIX systems. (int).
pub const CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR: CUmemAllocationHandleType_enum = CUmemAllocationHandleType_enum(
1,
);
/// Allows a Win32 NT handle to be used for exporting.
///
/// (HANDLE).
pub const CU_MEM_HANDLE_TYPE_WIN32: CUmemAllocationHandleType_enum = CUmemAllocationHandleType_enum(
2,
);
/// Allows a Win32 KMT handle to be used for exporting.
///
/// (D3DKMT_HANDLE).
pub const CU_MEM_HANDLE_TYPE_WIN32_KMT: CUmemAllocationHandleType_enum = CUmemAllocationHandleType_enum(
4,
);
/// Allows a fabric handle to be used for exporting.
///
/// (CUmemFabricHandle).
pub const CU_MEM_HANDLE_TYPE_FABRIC: CUmemAllocationHandleType_enum = CUmemAllocationHandleType_enum(
8,
);
/// Reserved upper-bound sentinel for native allocation handle types.
pub const CU_MEM_HANDLE_TYPE_MAX: CUmemAllocationHandleType_enum = CUmemAllocationHandleType_enum(
2147483647,
);
}
/// Flags for specifying particular handle types
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemAllocationHandleType_enum(pub ::core::ffi::c_uint);
pub use self::CUmemAllocationHandleType_enum as CUmemAllocationHandleType;
impl CUmemAccess_flags_enum {
/// Default, make the address range not accessible.
pub const CU_MEM_ACCESS_FLAGS_PROT_NONE: CUmemAccess_flags_enum = CUmemAccess_flags_enum(
0,
);
/// Make the address range read accessible.
pub const CU_MEM_ACCESS_FLAGS_PROT_READ: CUmemAccess_flags_enum = CUmemAccess_flags_enum(
1,
);
/// Make the address range read-write accessible.
pub const CU_MEM_ACCESS_FLAGS_PROT_READWRITE: CUmemAccess_flags_enum = CUmemAccess_flags_enum(
3,
);
/// Reserved upper-bound sentinel for native memory access protections.
pub const CU_MEM_ACCESS_FLAGS_PROT_MAX: CUmemAccess_flags_enum = CUmemAccess_flags_enum(
2147483647,
);
}
/// Specifies the memory protection flags for mapping.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemAccess_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUmemAccess_flags_enum as CUmemAccess_flags;
impl CUmemLocationType_enum {
/// No valid native memory location is selected.
pub const CU_MEM_LOCATION_TYPE_INVALID: CUmemLocationType_enum = CUmemLocationType_enum(
0,
);
/// Location is unspecified.
///
/// This is used when creating a managed memory pool to indicate no preferred location for the pool.
pub const CU_MEM_LOCATION_TYPE_NONE: CUmemLocationType_enum = CUmemLocationType_enum(
0,
);
/// Location is a device location, thus id is a device ordinal.
pub const CU_MEM_LOCATION_TYPE_DEVICE: CUmemLocationType_enum = CUmemLocationType_enum(
1,
);
/// Location is host, id is ignored.
pub const CU_MEM_LOCATION_TYPE_HOST: CUmemLocationType_enum = CUmemLocationType_enum(
2,
);
/// Location is a host NUMA node, thus id is a host NUMA node id.
pub const CU_MEM_LOCATION_TYPE_HOST_NUMA: CUmemLocationType_enum = CUmemLocationType_enum(
3,
);
/// Location is a host NUMA node of the current thread, id is ignored.
pub const CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT: CUmemLocationType_enum = CUmemLocationType_enum(
4,
);
/// Location is not visible but device is accessible, id is always CU_DEVICE_INVALID.
pub const CU_MEM_LOCATION_TYPE_INVISIBLE: CUmemLocationType_enum = CUmemLocationType_enum(
5,
);
/// Location is a portion of device memory, specified by the locality domain ID.
pub const CU_MEM_LOCATION_TYPE_DEVICE_LOCALITY_DOMAIN: CUmemLocationType_enum = CUmemLocationType_enum(
6,
);
/// Reserved upper-bound sentinel for native memory location types.
pub const CU_MEM_LOCATION_TYPE_MAX: CUmemLocationType_enum = CUmemLocationType_enum(
2147483647,
);
}
/// Specifies the type of location
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemLocationType_enum(pub ::core::ffi::c_uint);
pub use self::CUmemLocationType_enum as CUmemLocationType;
impl CUmemAllocationType_enum {
/// No valid native memory allocation type is selected.
pub const CU_MEM_ALLOCATION_TYPE_INVALID: CUmemAllocationType_enum = CUmemAllocationType_enum(
0,
);
/// This allocation type is ‘pinned’, i.e.
///
/// cannot migrate from its current location while the application is actively using it.
pub const CU_MEM_ALLOCATION_TYPE_PINNED: CUmemAllocationType_enum = CUmemAllocationType_enum(
1,
);
/// This allocation type is managed memory.
pub const CU_MEM_ALLOCATION_TYPE_MANAGED: CUmemAllocationType_enum = CUmemAllocationType_enum(
2,
);
/// ABI sentinel that forces a 32-bit C allocation-type enum representation.
pub const CU_MEM_ALLOCATION_TYPE_MAX: CUmemAllocationType_enum = CUmemAllocationType_enum(
2147483647,
);
}
/// Defines the allocation types available
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemAllocationType_enum(pub ::core::ffi::c_uint);
pub use self::CUmemAllocationType_enum as CUmemAllocationType;
impl CUmemAllocationGranularity_flags_enum {
/// Minimum required granularity for allocation.
pub const CU_MEM_ALLOC_GRANULARITY_MINIMUM: CUmemAllocationGranularity_flags_enum = CUmemAllocationGranularity_flags_enum(
0,
);
/// Recommended granularity for allocation for best performance.
pub const CU_MEM_ALLOC_GRANULARITY_RECOMMENDED: CUmemAllocationGranularity_flags_enum = CUmemAllocationGranularity_flags_enum(
1,
);
}
/// Flag for requesting different optimal and required granularities for an allocation.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemAllocationGranularity_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUmemAllocationGranularity_flags_enum as CUmemAllocationGranularity_flags;
impl CUmemRangeHandleType_enum {
/// Exports a memory-range handle as a DMA-BUF file descriptor.
pub const CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD: CUmemRangeHandleType_enum = CUmemRangeHandleType_enum(
1,
);
/// Reserved upper-bound sentinel for native memory-range handle types.
pub const CU_MEM_RANGE_HANDLE_TYPE_MAX: CUmemRangeHandleType_enum = CUmemRangeHandleType_enum(
2147483647,
);
}
/// Specifies the handle type for address range
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemRangeHandleType_enum(pub ::core::ffi::c_uint);
pub use self::CUmemRangeHandleType_enum as CUmemRangeHandleType;
impl CUmemRangeFlags_enum {
/// Indicates that DMA_BUF handle should be mapped via PCIe BAR1.
pub const CU_MEM_RANGE_FLAG_DMA_BUF_MAPPING_TYPE_PCIE: CUmemRangeFlags_enum = CUmemRangeFlags_enum(
1,
);
}
/// Flag for requesting handle type for address range.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemRangeFlags_enum(pub ::core::ffi::c_uint);
pub use self::CUmemRangeFlags_enum as CUmemRangeFlags;
impl CUarraySparseSubresourceType_enum {
/// Selects a sparse mip level for array mapping.
pub const CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL: CUarraySparseSubresourceType_enum = CUarraySparseSubresourceType_enum(
0,
);
/// Selects a packed mip tail for array mapping.
pub const CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL: CUarraySparseSubresourceType_enum = CUarraySparseSubresourceType_enum(
1,
);
}
/// Sparse subresource types
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUarraySparseSubresourceType_enum(pub ::core::ffi::c_uint);
pub use self::CUarraySparseSubresourceType_enum as CUarraySparseSubresourceType;
impl CUmemOperationType_enum {
/// Maps the selected sparse-array subresource to an allocation.
pub const CU_MEM_OPERATION_TYPE_MAP: CUmemOperationType_enum = CUmemOperationType_enum(
1,
);
/// Removes the mapping of the selected sparse-array subresource.
pub const CU_MEM_OPERATION_TYPE_UNMAP: CUmemOperationType_enum = CUmemOperationType_enum(
2,
);
}
/// Memory operation types
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemOperationType_enum(pub ::core::ffi::c_uint);
pub use self::CUmemOperationType_enum as CUmemOperationType;
impl CUmemHandleType_enum {
/// Uses a generic CUDA allocation handle in an array-mapping operation.
pub const CU_MEM_HANDLE_TYPE_GENERIC: CUmemHandleType_enum = CUmemHandleType_enum(0);
}
/// Memory handle types
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemHandleType_enum(pub ::core::ffi::c_uint);
pub use self::CUmemHandleType_enum as CUmemHandleType;
/// Specifies the CUDA array or CUDA mipmapped array memory mapping information
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUarrayMapInfo_st {
/// Resource type
pub resourceType: CUresourcetype,
/// Array or mipmapped-array resource selected by `resourceType`.
pub resource: CUarrayMapInfo_st__bindgen_ty_1,
/// Sparse subresource type
pub subresourceType: CUarraySparseSubresourceType,
/// Sparse mip-level or mip-tail region selected by `subresourceType`.
pub subresource: CUarrayMapInfo_st__bindgen_ty_2,
/// Memory operation type
pub memOperationType: CUmemOperationType,
/// Memory handle type
pub memHandleType: CUmemHandleType,
/// Memory handle representation selected by `memHandleType`.
pub memHandle: CUarrayMapInfo_st__bindgen_ty_3,
/// Offset within the memory
pub offset: ::core::ffi::c_ulonglong,
/// Device ordinal bit mask
pub deviceBitMask: ::core::ffi::c_uint,
/// flags for future use, must be zero now.
pub flags: ::core::ffi::c_uint,
/// Reserved for future use, must be zero now.
pub reserved: [::core::ffi::c_uint; 2usize],
}
/// Native layout of the `resource` member of [`CUarrayMapInfo_st`].
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUarrayMapInfo_st__bindgen_ty_1 {
/// Mipmapped array containing the sparse resource.
pub mipmap: CUmipmappedArray,
/// CUDA array containing the sparse resource.
pub array: CUarray,
}
impl Default for CUarrayMapInfo_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Native layout of the `subresource` member of [`CUarrayMapInfo_st`].
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUarrayMapInfo_st__bindgen_ty_2 {
/// Sparse mip-level coordinates and extents.
pub sparseLevel: CUarrayMapInfo_st__bindgen_ty_2__bindgen_ty_1,
/// Offset, size, and layer selecting a packed mip tail.
pub miptail: CUarrayMapInfo_st__bindgen_ty_2__bindgen_ty_2,
}
/// Native layout of the `sparseLevel` member of [`CUarrayMapInfo_st__bindgen_ty_2`].
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUarrayMapInfo_st__bindgen_ty_2__bindgen_ty_1 {
/// For CUDA mipmapped arrays must a valid mipmap level. For CUDA arrays must be zero
pub level: ::core::ffi::c_uint,
/// For CUDA layered arrays must be a valid layer index. Otherwise, must be zero
pub layer: ::core::ffi::c_uint,
/// Starting X offset in elements
pub offsetX: ::core::ffi::c_uint,
/// Starting Y offset in elements
pub offsetY: ::core::ffi::c_uint,
/// Starting Z offset in elements
pub offsetZ: ::core::ffi::c_uint,
/// Width in elements
pub extentWidth: ::core::ffi::c_uint,
/// Height in elements
pub extentHeight: ::core::ffi::c_uint,
/// Depth in elements
pub extentDepth: ::core::ffi::c_uint,
}
/// Native layout of the `miptail` member of [`CUarrayMapInfo_st__bindgen_ty_2`].
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUarrayMapInfo_st__bindgen_ty_2__bindgen_ty_2 {
/// For CUDA layered arrays must be a valid layer index. Otherwise, must be zero
pub layer: ::core::ffi::c_uint,
/// Offset within mip tail
pub offset: ::core::ffi::c_ulonglong,
/// Extent in bytes
pub size: ::core::ffi::c_ulonglong,
}
impl Default for CUarrayMapInfo_st__bindgen_ty_2 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Native layout of the `memHandle` member of [`CUarrayMapInfo_st`].
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUarrayMapInfo_st__bindgen_ty_3 {
/// Generic allocation handle used as backing memory for the mapping.
pub memHandle: CUmemGenericAllocationHandle,
}
impl Default for CUarrayMapInfo_st__bindgen_ty_3 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUarrayMapInfo_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Specifies the CUDA array or CUDA mipmapped array memory mapping information.
pub type CUarrayMapInfo_v1 = CUarrayMapInfo_st;
/// Specifies the CUDA array or CUDA mipmapped array memory mapping information
pub type CUarrayMapInfo = CUarrayMapInfo_v1;
/// Specifies a memory location.
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUmemLocation_st {
/// Specifies the location type, which modifies the meaning of id.
pub type_: CUmemLocationType,
/// Anonymous native member. See [`CUmemLocation_st__bindgen_ty_1`] for its fields.
pub __bindgen_anon_1: CUmemLocation_st__bindgen_ty_1,
}
/// Anonymous native union in [`CUmemLocation_st`]. Its members share the same storage.
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUmemLocation_st__bindgen_ty_1 {
/// Identifier for CUmemLocationType::CU_MEM_LOCATION_TYPE_DEVICE, CUmemLocationType::CU_MEM_LOCATION_TYPE_HOST, CUmemLocationType::CU_MEM_LOCATION_TYPE_HOST_NUMA.
pub id: ::core::ffi::c_int,
/// Identifier for CUmemLocationType::CU_MEM_LOCATION_TYPE_DEVICE_LOCALITY_DOMAIN.
pub localized: CUmemLocation_st__bindgen_ty_1__bindgen_ty_1,
}
/// Native layout of the `localized` member of [`CUmemLocation_st__bindgen_ty_1`].
///
/// Identifier for CUmemLocationType::CU_MEM_LOCATION_TYPE_DEVICE_LOCALITY_DOMAIN.
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemLocation_st__bindgen_ty_1__bindgen_ty_1 {
/// Device ID
pub deviceId: ::core::ffi::c_uchar,
/// Locality domain ID
pub localityDomainId: ::core::ffi::c_uchar,
}
impl Default for CUmemLocation_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUmemLocation_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Specifies a memory location.
pub type CUmemLocation_v1 = CUmemLocation_st;
/// Specifies a memory location.
pub type CUmemLocation = CUmemLocation_v1;
impl CUmemAllocationCompType_enum {
/// Allocating non-compressible memory.
pub const CU_MEM_ALLOCATION_COMP_NONE: CUmemAllocationCompType_enum = CUmemAllocationCompType_enum(
0,
);
/// Allocating compressible memory.
pub const CU_MEM_ALLOCATION_COMP_GENERIC: CUmemAllocationCompType_enum = CUmemAllocationCompType_enum(
1,
);
}
/// Specifies compression attribute for an allocation.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemAllocationCompType_enum(pub ::core::ffi::c_uint);
pub use self::CUmemAllocationCompType_enum as CUmemAllocationCompType;
/// Specifies the allocation properties for a allocation.
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUmemAllocationProp_st {
/// Allocation type
pub type_: CUmemAllocationType,
/// requested ::CUmemAllocationHandleType
pub requestedHandleTypes: CUmemAllocationHandleType,
/// Location of allocation
pub location: CUmemLocation,
/// Windows-specific POBJECT_ATTRIBUTES required when ::CU_MEM_HANDLE_TYPE_WIN32 is specified. This object attributes structure includes security attributes that define the scope of which exported allocations may be transferred to other processes. In all other cases, this field is required to be zero.
pub win32HandleMetaData: *mut ::core::ffi::c_void,
/// Native allocation options for compression, GPUDirect RDMA, and allocation usage.
pub allocFlags: CUmemAllocationProp_st__bindgen_ty_1,
}
/// Native layout of the `allocFlags` member of [`CUmemAllocationProp_st`].
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemAllocationProp_st__bindgen_ty_1 {
/// Allocation hint for requesting compressible memory. On devices that support Compute Data Compression, compressible memory can be used to accelerate accesses to data with unstructured sparsity and other compressible data patterns. Applications are expected to query allocation property of the handle obtained with ::cuMemCreate using ::cuMemGetAllocationPropertiesFromHandle to validate if the obtained allocation is compressible or not. Note that compressed memory may not be mappable on all devices.
pub compressionType: ::core::ffi::c_uchar,
/// Allocation hint for requesting GPUDirect RDMA capable memory. On devices with attribute ::CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_CUDA_VMM_SUPPORTED set, this flag indicates that the memory will be used for GPUDirect RDMA. On platforms where the default RDMA path does not support localized allocations, this flag has the following effects:
/// - For MPS clients using MLOPart/locality domains, this flag has the effect of disabling localization for the allocation. This allows the allocation to be used for GPUDirect RDMA with the default RDMA path.
/// - For allocations that are localized using CUDA locality domain APIs, using this flag will return an error. To use GPUDirect RDMA with localized allocations on platforms where the default RDMA path does not support localized allocations, allocations must explicitly opt-in to using the PCIe (BAR1) path by setting the flag CU_MEM_CREATE_USAGE_GPU_DIRECT_RDMA_OVER_PCIE.
pub gpuDirectRDMACapable: ::core::ffi::c_uchar,
/// Bitmask indicating intended usage for this allocation
pub usage: ::core::ffi::c_ushort,
/// Reserved storage in the native ABI.
pub reserved: [::core::ffi::c_uchar; 4usize],
}
impl Default for CUmemAllocationProp_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Specifies the allocation properties for a allocation.
pub type CUmemAllocationProp_v1 = CUmemAllocationProp_st;
/// Specifies the allocation properties for a allocation.
pub type CUmemAllocationProp = CUmemAllocationProp_v1;
impl CUmulticastGranularity_flags_enum {
/// Minimum required granularity.
pub const CU_MULTICAST_GRANULARITY_MINIMUM: CUmulticastGranularity_flags_enum = CUmulticastGranularity_flags_enum(
0,
);
/// Recommended granularity for best performance.
pub const CU_MULTICAST_GRANULARITY_RECOMMENDED: CUmulticastGranularity_flags_enum = CUmulticastGranularity_flags_enum(
1,
);
}
/// Flags for querying different granularities for a multicast object
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmulticastGranularity_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUmulticastGranularity_flags_enum as CUmulticastGranularity_flags;
/// Specifies the properties for a multicast object.
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmulticastObjectProp_st {
/// The number of devices in the multicast team that will bind memory to this object
pub numDevices: ::core::ffi::c_uint,
/// The maximum amount of memory that can be bound to this multicast object per device
pub size: size_t,
/// Bitmask of exportable handle types (see ::CUmemAllocationHandleType) for this object
pub handleTypes: ::core::ffi::c_ulonglong,
/// Flags for future use, must be zero now
pub flags: ::core::ffi::c_ulonglong,
}
/// Specifies the properties for a multicast object.
pub type CUmulticastObjectProp_v1 = CUmulticastObjectProp_st;
/// Specifies the properties for a multicast object.
pub type CUmulticastObjectProp = CUmulticastObjectProp_v1;
/// Memory access descriptor
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUmemAccessDesc_st {
/// Location on which the request is to change it's accessibility
pub location: CUmemLocation,
/// ::CUmemProt accessibility flags to set on the request
pub flags: CUmemAccess_flags,
}
impl Default for CUmemAccessDesc_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Memory access descriptor.
pub type CUmemAccessDesc_v1 = CUmemAccessDesc_st;
/// Memory access descriptor
pub type CUmemAccessDesc = CUmemAccessDesc_v1;
impl CUgraphExecUpdateResult_enum {
/// The update succeeded.
pub const CU_GRAPH_EXEC_UPDATE_SUCCESS: CUgraphExecUpdateResult_enum = CUgraphExecUpdateResult_enum(
0,
);
/// The update failed for an unexpected reason which is described in the return value of the function.
pub const CU_GRAPH_EXEC_UPDATE_ERROR: CUgraphExecUpdateResult_enum = CUgraphExecUpdateResult_enum(
1,
);
/// The update failed because the topology changed.
pub const CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED: CUgraphExecUpdateResult_enum = CUgraphExecUpdateResult_enum(
2,
);
/// The update failed because a node type changed.
pub const CU_GRAPH_EXEC_UPDATE_ERROR_NODE_TYPE_CHANGED: CUgraphExecUpdateResult_enum = CUgraphExecUpdateResult_enum(
3,
);
/// The update failed because the function of a kernel node changed (CUDA driver < 11.2).
pub const CU_GRAPH_EXEC_UPDATE_ERROR_FUNCTION_CHANGED: CUgraphExecUpdateResult_enum = CUgraphExecUpdateResult_enum(
4,
);
/// The update failed because the parameters changed in a way that is not supported.
pub const CU_GRAPH_EXEC_UPDATE_ERROR_PARAMETERS_CHANGED: CUgraphExecUpdateResult_enum = CUgraphExecUpdateResult_enum(
5,
);
/// The update failed because something about the node is not supported.
pub const CU_GRAPH_EXEC_UPDATE_ERROR_NOT_SUPPORTED: CUgraphExecUpdateResult_enum = CUgraphExecUpdateResult_enum(
6,
);
/// The update failed because the function of a kernel node changed in an unsupported way.
pub const CU_GRAPH_EXEC_UPDATE_ERROR_UNSUPPORTED_FUNCTION_CHANGE: CUgraphExecUpdateResult_enum = CUgraphExecUpdateResult_enum(
7,
);
/// The update failed because the node attributes changed in a way that is not supported.
pub const CU_GRAPH_EXEC_UPDATE_ERROR_ATTRIBUTES_CHANGED: CUgraphExecUpdateResult_enum = CUgraphExecUpdateResult_enum(
8,
);
}
/// CUDA Graph Update error types
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUgraphExecUpdateResult_enum(pub ::core::ffi::c_uint);
pub use self::CUgraphExecUpdateResult_enum as CUgraphExecUpdateResult;
/// Result information returned by cuGraphExecUpdate
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUgraphExecUpdateResultInfo_st {
/// Gives more specific detail when a cuda graph update fails.
pub result: CUgraphExecUpdateResult,
/// The "to node" of the error edge when the topologies do not match. The error node when the error is associated with a specific node. NULL when the error is generic.
pub errorNode: CUgraphNode,
/// The from node of error edge when the topologies do not match. Otherwise NULL.
pub errorFromNode: CUgraphNode,
}
impl Default for CUgraphExecUpdateResultInfo_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Result information returned by cuGraphExecUpdate.
pub type CUgraphExecUpdateResultInfo_v1 = CUgraphExecUpdateResultInfo_st;
/// Result information returned by cuGraphExecUpdate
pub type CUgraphExecUpdateResultInfo = CUgraphExecUpdateResultInfo_v1;
impl CUmemPool_attribute_enum {
/// (value type = int) Allow cuMemAllocAsync to use memory asynchronously freed in another streams as long as a stream ordering dependency of the allocating stream on the free action exists.
///
/// CUDA events and null stream interactions can create the required stream ordered dependencies. (default enabled).
pub const CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES: CUmemPool_attribute_enum = CUmemPool_attribute_enum(
1,
);
/// (value type = int) Allow reuse of already completed frees when there is no dependency between the free and allocation.
///
/// (default enabled).
pub const CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC: CUmemPool_attribute_enum = CUmemPool_attribute_enum(
2,
);
/// (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 by cuMemFreeAsync (default enabled).
pub const CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES: CUmemPool_attribute_enum = CUmemPool_attribute_enum(
3,
);
/// (value type = cuuint64_t) Amount of reserved memory in bytes to hold onto before trying to release memory back to the OS.
///
/// When more than the release threshold bytes of memory are held by the memory pool, the allocator will try to release memory back to the OS on the next call to stream, event or context synchronize. (default 0).
pub const CU_MEMPOOL_ATTR_RELEASE_THRESHOLD: CUmemPool_attribute_enum = CUmemPool_attribute_enum(
4,
);
/// (value type = cuuint64_t) Amount of backing memory currently allocated for the mempool.
pub const CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT: CUmemPool_attribute_enum = CUmemPool_attribute_enum(
5,
);
/// (value type = cuuint64_t) High watermark of backing memory allocated for the mempool since the last time it was reset.
///
/// High watermark can only be reset to zero.
pub const CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH: CUmemPool_attribute_enum = CUmemPool_attribute_enum(
6,
);
/// (value type = cuuint64_t) Amount of memory from the pool that is currently in use by the application.
pub const CU_MEMPOOL_ATTR_USED_MEM_CURRENT: CUmemPool_attribute_enum = CUmemPool_attribute_enum(
7,
);
/// (value type = cuuint64_t) High watermark of the amount of memory from the pool that was in use by the application since the last time it was reset.
///
/// High watermark can only be reset to zero.
pub const CU_MEMPOOL_ATTR_USED_MEM_HIGH: CUmemPool_attribute_enum = CUmemPool_attribute_enum(
8,
);
/// (value type = CUmemAllocationType) The allocation type of the mempool.
pub const CU_MEMPOOL_ATTR_ALLOCATION_TYPE: CUmemPool_attribute_enum = CUmemPool_attribute_enum(
9,
);
/// (value type = CUmemAllocationHandleType) Available export handle types for the mempool.
///
/// For imported pools this value is always [`CUmemAllocationHandleType::CU_MEM_HANDLE_TYPE_NONE`] as an imported pool cannot be re-exported.
pub const CU_MEMPOOL_ATTR_EXPORT_HANDLE_TYPES: CUmemPool_attribute_enum = CUmemPool_attribute_enum(
10,
);
/// (value type = int) The location id for the mempool.
///
/// If the location type for this pool is [`CUmemLocationType::CU_MEM_LOCATION_TYPE_INVISIBLE`] then ID will be CU_DEVICE_INVALID.
pub const CU_MEMPOOL_ATTR_LOCATION_ID: CUmemPool_attribute_enum = CUmemPool_attribute_enum(
11,
);
/// (value type = CUmemLocationType) The location type for the mempool.
///
/// For imported memory pools where the device is not directly visible to the importing process or pools imported via fabric handles across nodes this will be [`CUmemLocationType::CU_MEM_LOCATION_TYPE_INVISIBLE`].
pub const CU_MEMPOOL_ATTR_LOCATION_TYPE: CUmemPool_attribute_enum = CUmemPool_attribute_enum(
12,
);
/// (value type = cuuint64_t) Maximum size of the pool in bytes, this value may be higher than what was initially passed to cuMemPoolCreate due to alignment requirements.
///
/// A value of 0 indicates no maximum size. For [`CUmemAllocationType::CU_MEM_ALLOCATION_TYPE_MANAGED`] and IPC imported pools this value will be system dependent.
pub const CU_MEMPOOL_ATTR_MAX_POOL_SIZE: CUmemPool_attribute_enum = CUmemPool_attribute_enum(
13,
);
/// (value type = int) Indicates whether the pool has hardware compresssion enabled.
pub const CU_MEMPOOL_ATTR_HW_DECOMPRESS_ENABLED: CUmemPool_attribute_enum = CUmemPool_attribute_enum(
14,
);
/// (value type = int) The locality domain ID for the mempool, if the mempool is localized to a locality domain.
///
/// A value of -1 indicates that the mempool is not localized.
///
/// Note: On devices with a single locality domain, mempools created with [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE_LOCALITY_DOMAIN`] and localityDomainId 0 are equivalent to full-device mempools created with [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE`]. The value of this attribute will be -1 for such mempools.
pub const CU_MEMPOOL_ATTR_LOCALITY_DOMAIN_ID: CUmemPool_attribute_enum = CUmemPool_attribute_enum(
15,
);
}
/// CUDA memory pool attributes
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemPool_attribute_enum(pub ::core::ffi::c_uint);
pub use self::CUmemPool_attribute_enum as CUmemPool_attribute;
/// Specifies the properties of allocations made from the pool.
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUmemPoolProps_st {
/// Allocation type. Currently must be specified as CU_MEM_ALLOCATION_TYPE_PINNED
pub allocType: CUmemAllocationType,
/// Handle types that will be supported by allocations from the pool.
pub handleTypes: CUmemAllocationHandleType,
/// Location where allocations should reside.
pub location: CUmemLocation,
/// Windows-specific LPSECURITYATTRIBUTES required when ::CU_MEM_HANDLE_TYPE_WIN32 is specified. This security attribute defines the scope of which exported allocations may be transferred to other processes. In all other cases, this field is required to be zero.
pub win32SecurityAttributes: *mut ::core::ffi::c_void,
/// Maximum pool size. When set to 0, defaults to a system dependent value.
pub maxSize: size_t,
/// Bitmask indicating intended usage for the pool.
pub usage: ::core::ffi::c_ushort,
/// Allocation hint for requesting GPUDirect RDMA capable memory. On devices that support GPUDirect RDMA, this flag indicates that the memory will be used for GPUDirect RDMA. On platforms where the default RDMA path does not support localized allocations, this flag has the following effects:
/// - For MPS clients using MLOPart/locality domains, this flag has the effect of disabling localization for the pool. This allows the pool to be used for GPUDirect RDMA with the default RDMA path.
/// - For pools that are localized using CUDA locality domain APIs, using this flag will have no effect, but attempting to export the localized memory without forcing PCIe will return an error. To use GPUDirect RDMA with localized pools on platforms where the default RDMA path does not support localized allocations, handles must be acquired with the flag ::CU_MEM_RANGE_FLAG_DMA_BUF_MAPPING_TYPE_PCIE. Note that CUDA memory pools are only compatible with dma_buf mappings.
pub gpuDirectRDMACapable: ::core::ffi::c_uchar,
/// reserved for future use, must be 0
pub reserved: [::core::ffi::c_uchar; 53usize],
}
impl Default for CUmemPoolProps_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Specifies the properties of allocations made from the pool.
pub type CUmemPoolProps_v1 = CUmemPoolProps_st;
/// Specifies the properties of allocations made from the pool.
pub type CUmemPoolProps = CUmemPoolProps_v1;
/// Opaque data for exporting a pool allocation
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemPoolPtrExportData_st {
/// Reserved storage in the native ABI.
pub reserved: [::core::ffi::c_uchar; 64usize],
}
impl Default for CUmemPoolPtrExportData_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Opaque data for exporting a pool allocation.
pub type CUmemPoolPtrExportData_v1 = CUmemPoolPtrExportData_st;
/// Opaque data for exporting a pool allocation
pub type CUmemPoolPtrExportData = CUmemPoolPtrExportData_v1;
impl CUmemcpyFlags_enum {
/// Uses the default behavior for the copy operation.
pub const CU_MEMCPY_FLAG_DEFAULT: CUmemcpyFlags_enum = CUmemcpyFlags_enum(0);
/// Hint to the driver to try and overlap the copy with compute work on the SMs.
pub const CU_MEMCPY_FLAG_PREFER_OVERLAP_WITH_COMPUTE: CUmemcpyFlags_enum = CUmemcpyFlags_enum(
1,
);
}
/// Flags to specify for copies within a batch. For more details see ::cuMemcpyBatchAsync.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemcpyFlags_enum(pub ::core::ffi::c_uint);
pub use self::CUmemcpyFlags_enum as CUmemcpyFlags;
impl CUmemcpySrcAccessOrder_enum {
/// Default invalid.
pub const CU_MEMCPY_SRC_ACCESS_ORDER_INVALID: CUmemcpySrcAccessOrder_enum = CUmemcpySrcAccessOrder_enum(
0,
);
/// Indicates that access to the source pointer must be in stream order.
pub const CU_MEMCPY_SRC_ACCESS_ORDER_STREAM: CUmemcpySrcAccessOrder_enum = CUmemcpySrcAccessOrder_enum(
1,
);
/// Indicates that access to the source pointer can be out of stream order and all accesses must be complete before the API call returns.
///
/// This flag is suited for ephemeral sources (ex., stack variables) when it’s known that no prior operations in the stream can be accessing the memory and also that the lifetime of the memory is limited to the scope that the source variable was declared in. Specifying this flag allows the driver to optimize the copy and removes the need for the user to synchronize the stream after the API call.
pub const CU_MEMCPY_SRC_ACCESS_ORDER_DURING_API_CALL: CUmemcpySrcAccessOrder_enum = CUmemcpySrcAccessOrder_enum(
2,
);
/// Indicates that access to the source pointer can be out of stream order and the accesses can happen even after the API call returns.
///
/// This flag is suited for host pointers allocated outside CUDA (ex., via malloc) when it’s known that no prior operations in the stream can be accessing the memory. Specifying this flag allows the driver to optimize the copy on certain platforms.
pub const CU_MEMCPY_SRC_ACCESS_ORDER_ANY: CUmemcpySrcAccessOrder_enum = CUmemcpySrcAccessOrder_enum(
3,
);
/// ABI sentinel that forces a 32-bit C source-access-order enum representation.
pub const CU_MEMCPY_SRC_ACCESS_ORDER_MAX: CUmemcpySrcAccessOrder_enum = CUmemcpySrcAccessOrder_enum(
2147483647,
);
}
/// These flags allow applications to convey the source access ordering CUDA must maintain. The destination will always be accessed in stream order.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemcpySrcAccessOrder_enum(pub ::core::ffi::c_uint);
pub use self::CUmemcpySrcAccessOrder_enum as CUmemcpySrcAccessOrder;
/// Attributes specific to copies within a batch. For more details on usage see ::cuMemcpyBatchAsync.
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUmemcpyAttributes_st {
/// Source access ordering to be observed for copies with this attribute.
pub srcAccessOrder: CUmemcpySrcAccessOrder,
/// Hint location for the source operand. Ignored when the pointers are not managed memory or memory allocated outside CUDA.
pub srcLocHint: CUmemLocation,
/// Hint location for the destination operand. Ignored when the pointers are not managed memory or memory allocated outside CUDA.
pub dstLocHint: CUmemLocation,
/// Additional flags for copies with this attribute. See ::CUmemcpyFlags
pub flags: ::core::ffi::c_uint,
}
impl Default for CUmemcpyAttributes_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Attributes specific to copies within a batch.
///
/// For more details on usage see cuMemcpyBatchAsync.
pub type CUmemcpyAttributes_v1 = CUmemcpyAttributes_st;
/// Attributes specific to copies within a batch. For more details on usage see ::cuMemcpyBatchAsync.
pub type CUmemcpyAttributes = CUmemcpyAttributes_v1;
impl CUmemcpy3DOperandType_enum {
/// Memcpy operand is a valid pointer.
pub const CU_MEMCPY_OPERAND_TYPE_POINTER: CUmemcpy3DOperandType_enum = CUmemcpy3DOperandType_enum(
1,
);
/// Memcpy operand is a CUarray.
pub const CU_MEMCPY_OPERAND_TYPE_ARRAY: CUmemcpy3DOperandType_enum = CUmemcpy3DOperandType_enum(
2,
);
/// Reserved upper-bound sentinel for native three-dimensional copy operand types.
pub const CU_MEMCPY_OPERAND_TYPE_MAX: CUmemcpy3DOperandType_enum = CUmemcpy3DOperandType_enum(
2147483647,
);
}
/// These flags allow applications to convey the operand type for individual copies specified in ::cuMemcpy3DBatchAsync.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemcpy3DOperandType_enum(pub ::core::ffi::c_uint);
pub use self::CUmemcpy3DOperandType_enum as CUmemcpy3DOperandType;
/// Struct representing a 3D offset
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUoffset3D_st {
/// Offset along the x axis in elements.
pub x: size_t,
/// Offset along the y axis in elements.
pub y: size_t,
/// Offset along the z axis in elements.
pub z: size_t,
}
/// Struct representing a 3D offset.
pub type CUoffset3D_v1 = CUoffset3D_st;
/// Struct representing a 3D offset
pub type CUoffset3D = CUoffset3D_v1;
/// Struct representing width/height/depth of a CUarray in elements
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUextent3D_st {
/// Copy extent along the x axis in elements.
pub width: size_t,
/// Copy extent along the y axis in elements.
pub height: size_t,
/// Copy extent along the z axis in elements.
pub depth: size_t,
}
/// Struct representing width/height/depth of a CUarray in elements.
pub type CUextent3D_v1 = CUextent3D_st;
/// Struct representing width/height/depth of a CUarray in elements
pub type CUextent3D = CUextent3D_v1;
/// Struct representing an operand for copy with ::cuMemcpy3DBatchAsync
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUmemcpy3DOperand_st {
/// Selects a pointer-backed or array-backed copy operand.
pub type_: CUmemcpy3DOperandType,
/// Operand storage and layout selected by `type`.
pub op: CUmemcpy3DOperand_st__bindgen_ty_1,
}
/// Native layout of the `op` member of [`CUmemcpy3DOperand_st`].
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUmemcpy3DOperand_st__bindgen_ty_1 {
/// Struct representing an operand when ::CUmemcpy3DOperand::type is ::CU_MEMCPY_OPERAND_TYPE_POINTER
pub ptr: CUmemcpy3DOperand_st__bindgen_ty_1__bindgen_ty_1,
/// Struct representing an operand when ::CUmemcpy3DOperand::type is ::CU_MEMCPY_OPERAND_TYPE_ARRAY
pub array: CUmemcpy3DOperand_st__bindgen_ty_1__bindgen_ty_2,
}
/// Struct representing an operand when ::CUmemcpy3DOperand::type is ::CU_MEMCPY_OPERAND_TYPE_POINTER
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUmemcpy3DOperand_st__bindgen_ty_1__bindgen_ty_1 {
/// Device address used as the pointer-backed copy operand.
pub ptr: CUdeviceptr,
/// Length of each row in elements.
pub rowLength: size_t,
/// Height of each layer in elements.
pub layerHeight: size_t,
/// Hint location for the operand. Ignored when the pointers are not managed memory or memory allocated outside CUDA.
pub locHint: CUmemLocation,
}
impl Default for CUmemcpy3DOperand_st__bindgen_ty_1__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Struct representing an operand when ::CUmemcpy3DOperand::type is ::CU_MEMCPY_OPERAND_TYPE_ARRAY
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemcpy3DOperand_st__bindgen_ty_1__bindgen_ty_2 {
/// referenced array
pub array: CUarray,
/// offset into the array in elements
pub offset: CUoffset3D,
}
impl Default for CUmemcpy3DOperand_st__bindgen_ty_1__bindgen_ty_2 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUmemcpy3DOperand_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUmemcpy3DOperand_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Struct representing an operand for copy with cuMemcpy3DBatchAsync.
pub type CUmemcpy3DOperand_v1 = CUmemcpy3DOperand_st;
/// Struct representing an operand for copy with ::cuMemcpy3DBatchAsync
pub type CUmemcpy3DOperand = CUmemcpy3DOperand_v1;
/// One source, destination, extent, and access-order specification in a batched three-dimensional copy.
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUDA_MEMCPY3D_BATCH_OP_st {
/// Source memcpy operand.
pub src: CUmemcpy3DOperand,
/// Destination memcpy operand.
pub dst: CUmemcpy3DOperand,
/// Extents of the memcpy between src and dst. The width, height and depth components must not be 0.
pub extent: CUextent3D,
/// Source access ordering to be observed for copy from src to dst.
pub srcAccessOrder: CUmemcpySrcAccessOrder,
/// Additional flags for copies with this attribute. See ::CUmemcpyFlags
pub flags: ::core::ffi::c_uint,
}
impl Default for CUDA_MEMCPY3D_BATCH_OP_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// One source, destination, extent, and access-order specification in a batched three-dimensional copy.
pub type CUDA_MEMCPY3D_BATCH_OP_v1 = CUDA_MEMCPY3D_BATCH_OP_st;
/// One source, destination, extent, and access-order specification in a batched three-dimensional copy.
pub type CUDA_MEMCPY3D_BATCH_OP = CUDA_MEMCPY3D_BATCH_OP_v1;
/// Memory allocation node parameters
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUDA_MEM_ALLOC_NODE_PARAMS_v1_st {
/// in: location where the allocation should reside (specified in ::location). ::handleTypes must be ::CU_MEM_HANDLE_TYPE_NONE. IPC is not supported.
pub poolProps: CUmemPoolProps,
/// in: array of memory access descriptors. Used to describe peer GPU access
pub accessDescs: *const CUmemAccessDesc,
/// in: number of memory access descriptors. Must not exceed the number of GPUs.
pub accessDescCount: size_t,
/// in: size in bytes of the requested allocation
pub bytesize: size_t,
/// out: address of the allocation returned by CUDA
pub dptr: CUdeviceptr,
}
impl Default for CUDA_MEM_ALLOC_NODE_PARAMS_v1_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Memory allocation node parameters.
pub type CUDA_MEM_ALLOC_NODE_PARAMS_v1 = CUDA_MEM_ALLOC_NODE_PARAMS_v1_st;
/// Memory allocation node parameters
pub type CUDA_MEM_ALLOC_NODE_PARAMS = CUDA_MEM_ALLOC_NODE_PARAMS_v1;
/// Memory allocation node parameters
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUDA_MEM_ALLOC_NODE_PARAMS_v2_st {
/// in: location where the allocation should reside (specified in ::location). ::handleTypes must be ::CU_MEM_HANDLE_TYPE_NONE. IPC is not supported.
pub poolProps: CUmemPoolProps,
/// in: array of memory access descriptors. Used to describe peer GPU access
pub accessDescs: *const CUmemAccessDesc,
/// in: number of memory access descriptors. Must not exceed the number of GPUs.
pub accessDescCount: size_t,
/// in: size in bytes of the requested allocation
pub bytesize: size_t,
/// out: address of the allocation returned by CUDA
pub dptr: CUdeviceptr,
}
impl Default for CUDA_MEM_ALLOC_NODE_PARAMS_v2_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Memory allocation node parameters.
pub type CUDA_MEM_ALLOC_NODE_PARAMS_v2 = CUDA_MEM_ALLOC_NODE_PARAMS_v2_st;
/// Memory free node parameters
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_MEM_FREE_NODE_PARAMS_st {
/// in: the pointer to free
pub dptr: CUdeviceptr,
}
/// Memory free node parameters.
pub type CUDA_MEM_FREE_NODE_PARAMS = CUDA_MEM_FREE_NODE_PARAMS_st;
impl CUgraphMem_attribute_enum {
/// (value type = cuuint64_t) Amount of memory, in bytes, currently associated with graphs.
pub const CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT: CUgraphMem_attribute_enum = CUgraphMem_attribute_enum(
0,
);
/// (value type = cuuint64_t) High watermark of memory, in bytes, associated with graphs since the last time it was reset.
///
/// High watermark can only be reset to zero.
pub const CU_GRAPH_MEM_ATTR_USED_MEM_HIGH: CUgraphMem_attribute_enum = CUgraphMem_attribute_enum(
1,
);
/// (value type = cuuint64_t) Amount of memory, in bytes, currently allocated for use by the CUDA graphs asynchronous allocator.
pub const CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT: CUgraphMem_attribute_enum = CUgraphMem_attribute_enum(
2,
);
/// (value type = cuuint64_t) High watermark of memory, in bytes, currently allocated for use by the CUDA graphs asynchronous allocator.
pub const CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH: CUgraphMem_attribute_enum = CUgraphMem_attribute_enum(
3,
);
}
/// Device-level accounting and limits for memory allocated by CUDA graphs.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUgraphMem_attribute_enum(pub ::core::ffi::c_uint);
pub use self::CUgraphMem_attribute_enum as CUgraphMem_attribute;
impl CUgraphChildGraphNodeOwnership_enum {
/// Default behavior for a child graph node.
///
/// Child graph is cloned into the parent and memory allocation/free nodes can’t be present in the child graph.
pub const CU_GRAPH_CHILD_GRAPH_OWNERSHIP_CLONE: CUgraphChildGraphNodeOwnership_enum = CUgraphChildGraphNodeOwnership_enum(
0,
);
/// 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 parent is destroyed.
///
/// The following restrictions apply to child graphs after they have been moved: Cannot be independently instantiated or destroyed; Cannot be added as a child graph of a separate parent graph; Cannot be used as an argument to cuGraphExecUpdate; Cannot have additional memory allocation or free nodes added.
pub const CU_GRAPH_CHILD_GRAPH_OWNERSHIP_MOVE: CUgraphChildGraphNodeOwnership_enum = CUgraphChildGraphNodeOwnership_enum(
1,
);
/// Invalid ownership flag.
///
/// Set when params are queried to prevent accidentally reusing the driver-owned graph object.
pub const CU_GRAPH_CHILD_GRAPH_OWNERSHIP_INVALID: CUgraphChildGraphNodeOwnership_enum = CUgraphChildGraphNodeOwnership_enum(
-1,
);
}
/// Child graph node ownership
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUgraphChildGraphNodeOwnership_enum(pub ::core::ffi::c_int);
pub use self::CUgraphChildGraphNodeOwnership_enum as CUgraphChildGraphNodeOwnership;
/// Child graph node parameters
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_CHILD_GRAPH_NODE_PARAMS_st {
/// The child graph to clone into the node for node creation, or a handle to the graph owned by the node for node query. The graph must not contain conditional nodes. Graphs containing memory allocation or memory free nodes must set the ownership to be moved to the parent.
pub graph: CUgraph,
/// The ownership relationship of the child graph node.
pub ownership: CUgraphChildGraphNodeOwnership,
}
impl Default for CUDA_CHILD_GRAPH_NODE_PARAMS_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Child graph node parameters.
pub type CUDA_CHILD_GRAPH_NODE_PARAMS = CUDA_CHILD_GRAPH_NODE_PARAMS_st;
/// Event record node parameters
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUDA_EVENT_RECORD_NODE_PARAMS_st {
/// The event to record when the node executes
pub event: CUevent,
/// Anonymous native member. See [`CUDA_EVENT_RECORD_NODE_PARAMS_st__bindgen_ty_1`] for its fields.
pub __bindgen_anon_1: CUDA_EVENT_RECORD_NODE_PARAMS_st__bindgen_ty_1,
}
/// preferred context to use for the event record
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUDA_EVENT_RECORD_NODE_PARAMS_st__bindgen_ty_1 {
/// Preferred CUDA context for the event record.
pub ctx: CUcontext,
/// Preferred green context for the event record.
pub gCtx: CUgreenCtx,
}
impl Default for CUDA_EVENT_RECORD_NODE_PARAMS_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUDA_EVENT_RECORD_NODE_PARAMS_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Event record node parameters.
pub type CUDA_EVENT_RECORD_NODE_PARAMS = CUDA_EVENT_RECORD_NODE_PARAMS_st;
/// Event wait node parameters
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUDA_EVENT_WAIT_NODE_PARAMS_st {
/// The event to wait on from the node
pub event: CUevent,
}
impl Default for CUDA_EVENT_WAIT_NODE_PARAMS_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Event wait node parameters.
pub type CUDA_EVENT_WAIT_NODE_PARAMS = CUDA_EVENT_WAIT_NODE_PARAMS_st;
/// Graph node parameters. See ::cuGraphAddNode.
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUgraphNodeParams_st {
/// Type of the node
pub type_: CUgraphNodeType,
/// Reserved. Must be zero.
pub reserved0: [::core::ffi::c_int; 3usize],
/// Anonymous native member. See [`CUgraphNodeParams_st__bindgen_ty_1`] for its fields.
pub __bindgen_anon_1: CUgraphNodeParams_st__bindgen_ty_1,
/// Reserved bytes. Must be zero.
pub reserved2: ::core::ffi::c_longlong,
}
/// Anonymous native union in [`CUgraphNodeParams_st`]. Its members share the same storage.
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUgraphNodeParams_st__bindgen_ty_1 {
/// Padding. Unused bytes must be zero.
pub reserved1: [::core::ffi::c_longlong; 29usize],
/// Kernel node parameters.
pub kernel: CUDA_KERNEL_NODE_PARAMS_v3,
/// Memcpy node parameters.
pub memcpy: CUDA_MEMCPY_NODE_PARAMS,
/// Memset node parameters.
pub memset: CUDA_MEMSET_NODE_PARAMS_v2,
/// Host node parameters.
pub host: CUDA_HOST_NODE_PARAMS_v2,
/// Child graph node parameters.
pub graph: CUDA_CHILD_GRAPH_NODE_PARAMS,
/// Event wait node parameters.
pub eventWait: CUDA_EVENT_WAIT_NODE_PARAMS,
/// Event record node parameters.
pub eventRecord: CUDA_EVENT_RECORD_NODE_PARAMS,
/// External semaphore signal node parameters.
pub extSemSignal: CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2,
/// External semaphore wait node parameters.
pub extSemWait: CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2,
/// Memory allocation node parameters.
pub alloc: CUDA_MEM_ALLOC_NODE_PARAMS_v2,
/// Memory free node parameters.
pub free: CUDA_MEM_FREE_NODE_PARAMS,
/// MemOp node parameters.
pub memOp: CUDA_BATCH_MEM_OP_NODE_PARAMS_v2,
/// Conditional node parameters.
pub conditional: CUDA_CONDITIONAL_NODE_PARAMS,
/// Padding as bytes
pub asBytes: [::core::ffi::c_char; 232usize],
}
impl Default for CUgraphNodeParams_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUgraphNodeParams_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Graph node parameters.
///
/// See cuGraphAddNode.
pub type CUgraphNodeParams = CUgraphNodeParams_st;
impl CUflushGPUDirectRDMAWritesOptions_enum {
/// [`cuFlushGPUDirectRDMAWrites`] and its CUDA Runtime API counterpart are supported on the device.
pub const CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_HOST: CUflushGPUDirectRDMAWritesOptions_enum = CUflushGPUDirectRDMAWritesOptions_enum(
1,
);
/// The [`CUstreamWaitValue_flags_enum::CU_STREAM_WAIT_VALUE_FLUSH`] flag and the [`CUstreamBatchMemOpType_enum::CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES`] MemOp are supported on the device.
pub const CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_MEMOPS: CUflushGPUDirectRDMAWritesOptions_enum = CUflushGPUDirectRDMAWritesOptions_enum(
2,
);
}
/// Bitmasks for ::CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUflushGPUDirectRDMAWritesOptions_enum(pub ::core::ffi::c_uint);
pub use self::CUflushGPUDirectRDMAWritesOptions_enum as CUflushGPUDirectRDMAWritesOptions;
impl CUGPUDirectRDMAWritesOrdering_enum {
/// The device does not natively support ordering of remote writes.
///
/// [`cuFlushGPUDirectRDMAWrites`] can be leveraged if supported.
pub const CU_GPU_DIRECT_RDMA_WRITES_ORDERING_NONE: CUGPUDirectRDMAWritesOrdering_enum = CUGPUDirectRDMAWritesOrdering_enum(
0,
);
/// Natively, the device can consistently consume remote writes, although other CUDA devices may not.
pub const CU_GPU_DIRECT_RDMA_WRITES_ORDERING_OWNER: CUGPUDirectRDMAWritesOrdering_enum = CUGPUDirectRDMAWritesOrdering_enum(
100,
);
/// Any CUDA device in the system can consistently consume remote writes to this device.
pub const CU_GPU_DIRECT_RDMA_WRITES_ORDERING_ALL_DEVICES: CUGPUDirectRDMAWritesOrdering_enum = CUGPUDirectRDMAWritesOrdering_enum(
200,
);
}
/// Platform native ordering for GPUDirect RDMA writes
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUGPUDirectRDMAWritesOrdering_enum(pub ::core::ffi::c_uint);
pub use self::CUGPUDirectRDMAWritesOrdering_enum as CUGPUDirectRDMAWritesOrdering;
impl CUflushGPUDirectRDMAWritesScope_enum {
/// Blocks until remote writes are visible to the CUDA device context owning the data.
pub const CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_OWNER: CUflushGPUDirectRDMAWritesScope_enum = CUflushGPUDirectRDMAWritesScope_enum(
100,
);
/// Blocks until remote writes are visible to all CUDA device contexts.
pub const CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_ALL_DEVICES: CUflushGPUDirectRDMAWritesScope_enum = CUflushGPUDirectRDMAWritesScope_enum(
200,
);
}
/// The scopes for ::cuFlushGPUDirectRDMAWrites
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUflushGPUDirectRDMAWritesScope_enum(pub ::core::ffi::c_uint);
pub use self::CUflushGPUDirectRDMAWritesScope_enum as CUflushGPUDirectRDMAWritesScope;
impl CUflushGPUDirectRDMAWritesTarget_enum {
/// Sets the target for [`cuFlushGPUDirectRDMAWrites`] to the currently active CUDA device context.
pub const CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TARGET_CURRENT_CTX: CUflushGPUDirectRDMAWritesTarget_enum = CUflushGPUDirectRDMAWritesTarget_enum(
0,
);
}
/// The targets for ::cuFlushGPUDirectRDMAWrites
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUflushGPUDirectRDMAWritesTarget_enum(pub ::core::ffi::c_uint);
pub use self::CUflushGPUDirectRDMAWritesTarget_enum as CUflushGPUDirectRDMAWritesTarget;
impl CUgraphDebugDot_flags_enum {
/// Output all debug data as if every debug flag is enabled.
pub const CU_GRAPH_DEBUG_DOT_FLAGS_VERBOSE: CUgraphDebugDot_flags_enum = CUgraphDebugDot_flags_enum(
1,
);
/// Use CUDA Runtime structures for output.
pub const CU_GRAPH_DEBUG_DOT_FLAGS_RUNTIME_TYPES: CUgraphDebugDot_flags_enum = CUgraphDebugDot_flags_enum(
2,
);
/// Adds CUDA_KERNEL_NODE_PARAMS values to output.
pub const CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_PARAMS: CUgraphDebugDot_flags_enum = CUgraphDebugDot_flags_enum(
4,
);
/// Adds CUDA_MEMCPY3D values to output.
pub const CU_GRAPH_DEBUG_DOT_FLAGS_MEMCPY_NODE_PARAMS: CUgraphDebugDot_flags_enum = CUgraphDebugDot_flags_enum(
8,
);
/// Adds CUDA_MEMSET_NODE_PARAMS values to output.
pub const CU_GRAPH_DEBUG_DOT_FLAGS_MEMSET_NODE_PARAMS: CUgraphDebugDot_flags_enum = CUgraphDebugDot_flags_enum(
16,
);
/// Adds CUDA_HOST_NODE_PARAMS values to output.
pub const CU_GRAPH_DEBUG_DOT_FLAGS_HOST_NODE_PARAMS: CUgraphDebugDot_flags_enum = CUgraphDebugDot_flags_enum(
32,
);
/// Adds CUevent handle from record and wait nodes to output.
pub const CU_GRAPH_DEBUG_DOT_FLAGS_EVENT_NODE_PARAMS: CUgraphDebugDot_flags_enum = CUgraphDebugDot_flags_enum(
64,
);
/// Adds CUDA_EXT_SEM_SIGNAL_NODE_PARAMS values to output.
pub const CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_SIGNAL_NODE_PARAMS: CUgraphDebugDot_flags_enum = CUgraphDebugDot_flags_enum(
128,
);
/// Adds CUDA_EXT_SEM_WAIT_NODE_PARAMS values to output.
pub const CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_WAIT_NODE_PARAMS: CUgraphDebugDot_flags_enum = CUgraphDebugDot_flags_enum(
256,
);
/// Adds CUkernelNodeAttrValue values to output.
pub const CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_ATTRIBUTES: CUgraphDebugDot_flags_enum = CUgraphDebugDot_flags_enum(
512,
);
/// Adds node handles and every kernel function handle to output.
pub const CU_GRAPH_DEBUG_DOT_FLAGS_HANDLES: CUgraphDebugDot_flags_enum = CUgraphDebugDot_flags_enum(
1024,
);
/// Adds memory alloc node parameters to output.
pub const CU_GRAPH_DEBUG_DOT_FLAGS_MEM_ALLOC_NODE_PARAMS: CUgraphDebugDot_flags_enum = CUgraphDebugDot_flags_enum(
2048,
);
/// Adds memory free node parameters to output.
pub const CU_GRAPH_DEBUG_DOT_FLAGS_MEM_FREE_NODE_PARAMS: CUgraphDebugDot_flags_enum = CUgraphDebugDot_flags_enum(
4096,
);
/// Adds batch mem op node parameters to output.
pub const CU_GRAPH_DEBUG_DOT_FLAGS_BATCH_MEM_OP_NODE_PARAMS: CUgraphDebugDot_flags_enum = CUgraphDebugDot_flags_enum(
8192,
);
/// Adds edge numbering information.
pub const CU_GRAPH_DEBUG_DOT_FLAGS_EXTRA_TOPO_INFO: CUgraphDebugDot_flags_enum = CUgraphDebugDot_flags_enum(
16384,
);
/// Adds conditional node parameters to output.
pub const CU_GRAPH_DEBUG_DOT_FLAGS_CONDITIONAL_NODE_PARAMS: CUgraphDebugDot_flags_enum = CUgraphDebugDot_flags_enum(
32768,
);
}
/// The additional write options for ::cuGraphDebugDotPrint
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUgraphDebugDot_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUgraphDebugDot_flags_enum as CUgraphDebugDot_flags;
impl CUuserObject_flags_enum {
/// Indicates the destructor execution is not synchronized by any CUDA handle.
pub const CU_USER_OBJECT_NO_DESTRUCTOR_SYNC: CUuserObject_flags_enum = CUuserObject_flags_enum(
1,
);
}
/// Flags for user objects for graphs
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUuserObject_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUuserObject_flags_enum as CUuserObject_flags;
impl CUuserObjectRetain_flags_enum {
/// Transfer references from the caller rather than creating new references.
pub const CU_GRAPH_USER_OBJECT_MOVE: CUuserObjectRetain_flags_enum = CUuserObjectRetain_flags_enum(
1,
);
}
/// Flags for retaining user object references for graphs
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUuserObjectRetain_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUuserObjectRetain_flags_enum as CUuserObjectRetain_flags;
impl CUgraphInstantiate_flags_enum {
/// Automatically free memory allocated in a graph before relaunching.
pub const CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH: CUgraphInstantiate_flags_enum = CUgraphInstantiate_flags_enum(
1,
);
/// Automatically upload the graph after instantiation.
///
/// Only supported by [`cuGraphInstantiateWithParams`]. The upload will be performed using the stream provided in `instantiateParams`.
pub const CUDA_GRAPH_INSTANTIATE_FLAG_UPLOAD: CUgraphInstantiate_flags_enum = CUgraphInstantiate_flags_enum(
2,
);
/// Instantiate the graph to be launchable from the device.
///
/// This flag can only be used on platforms which support unified addressing. This flag cannot be used in conjunction with [`CUgraphInstantiate_flags::CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH`].
pub const CUDA_GRAPH_INSTANTIATE_FLAG_DEVICE_LAUNCH: CUgraphInstantiate_flags_enum = CUgraphInstantiate_flags_enum(
4,
);
/// Run the graph using the per-node priority attributes rather than the priority of the stream it is launched into.
pub const CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY: CUgraphInstantiate_flags_enum = CUgraphInstantiate_flags_enum(
8,
);
}
/// Flags for instantiating a graph
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUgraphInstantiate_flags_enum(pub ::core::ffi::c_uint);
pub use self::CUgraphInstantiate_flags_enum as CUgraphInstantiate_flags;
impl CUdeviceNumaConfig_enum {
/// The GPU is not a NUMA node.
pub const CU_DEVICE_NUMA_CONFIG_NONE: CUdeviceNumaConfig_enum = CUdeviceNumaConfig_enum(
0,
);
/// The GPU is a NUMA node, [`CUdevice_attribute::CU_DEVICE_ATTRIBUTE_NUMA_ID`] contains its NUMA ID.
pub const CU_DEVICE_NUMA_CONFIG_NUMA_NODE: CUdeviceNumaConfig_enum = CUdeviceNumaConfig_enum(
1,
);
}
/// CUDA device NUMA configuration
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUdeviceNumaConfig_enum(pub ::core::ffi::c_uint);
pub use self::CUdeviceNumaConfig_enum as CUdeviceNumaConfig;
impl CUprocessState_enum {
/// Default process state.
pub const CU_PROCESS_STATE_RUNNING: CUprocessState_enum = CUprocessState_enum(0);
/// CUDA API locks are taken so further CUDA API calls will block.
pub const CU_PROCESS_STATE_LOCKED: CUprocessState_enum = CUprocessState_enum(1);
/// Application memory contents have been checkpointed and underlying allocations and device handles have been released.
pub const CU_PROCESS_STATE_CHECKPOINTED: CUprocessState_enum = CUprocessState_enum(
2,
);
/// Application entered an uncorrectable error during the checkpoint/restore process.
pub const CU_PROCESS_STATE_FAILED: CUprocessState_enum = CUprocessState_enum(3);
/// Application memory contents are being checkpointed.
pub const CU_PROCESS_STATE_CHECKPOINTING: CUprocessState_enum = CUprocessState_enum(
4,
);
/// Application memory contents are being restored.
pub const CU_PROCESS_STATE_RESTORING: CUprocessState_enum = CUprocessState_enum(5);
}
/// CUDA Process States
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUprocessState_enum(pub ::core::ffi::c_uint);
pub use self::CUprocessState_enum as CUprocessState;
/// Per-GPU data for zero-copy mapped device memory used with CUDA checkpoint/restore on custom storage
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUcheckpointCustomStoragePerDeviceData_st {
/// Zero-copy mapped device memory pointer for the user to copy to/from
pub devPtr: CUdeviceptr,
/// Size of mapped memory
pub size: size_t,
/// Stream the user may use for the copy; the CUDA driver synchronizes on this stream before completing checkpoint or restore
pub stream: CUstream,
}
impl Default for CUcheckpointCustomStoragePerDeviceData_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Per-GPU data for zero-copy mapped device memory used with CUDA checkpoint/restore on custom storage.
pub type CUcheckpointCustomStoragePerDeviceData = CUcheckpointCustomStoragePerDeviceData_st;
/// Incomplete native type used by [`CUcheckpointOperationHandle`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUIcheckpointOperation_st {
_unused: [u8; 0],
}
/// Handle for a CUDA custom storage checkpoint or restore operation awaiting completion.
pub type CUcheckpointOperationHandle = *mut CUIcheckpointOperation_st;
/// Output from CUDA custom storage checkpoint/restore: per-GPU device pointers and a handle to complete the operation
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUcheckpointCustomStorageInfo_st {
/// Handle returned that is needed to complete checkpoint or restore
pub handle: CUcheckpointOperationHandle,
/// Returned pointer to array of per-device data, one per device. User should set to NULL
pub perDeviceData: *mut CUcheckpointCustomStoragePerDeviceData,
/// Number of devices (and elements in `perDeviceData` array)
pub deviceCount: ::core::ffi::c_uint,
}
impl Default for CUcheckpointCustomStorageInfo_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Output from CUDA custom storage checkpoint/restore: per-GPU device pointers and a handle to complete the operation.
pub type CUcheckpointCustomStorageInfo = CUcheckpointCustomStorageInfo_st;
/// CUDA checkpoint optional lock arguments
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUcheckpointLockArgs_st {
/// Timeout in milliseconds to attempt to lock the process, 0 indicates no timeout
pub timeoutMs: ::core::ffi::c_uint,
/// Reserved for future use, must be zero
pub reserved0: ::core::ffi::c_uint,
/// Reserved for future use, must be zeroed
pub reserved1: [cuuint64_t; 7usize],
}
/// CUDA checkpoint optional lock arguments.
pub type CUcheckpointLockArgs = CUcheckpointLockArgs_st;
/// CUDA checkpoint optional checkpoint arguments
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUcheckpointCheckpointArgs_st {
/// Optional custom storage; if NULL, GPU memory is checkpointed to host
pub customStorageInfo_out: *mut *mut CUcheckpointCustomStorageInfo,
/// Reserved for future use, must be zeroed
pub reserved: [::core::ffi::c_char; 56usize],
}
impl Default for CUcheckpointCheckpointArgs_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// CUDA checkpoint optional checkpoint arguments.
pub type CUcheckpointCheckpointArgs = CUcheckpointCheckpointArgs_st;
/// CUDA checkpoint GPU UUID pairs for device remapping during restore
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUcheckpointGpuPair_st {
/// UUID of the GPU that was checkpointed
pub oldUuid: CUuuid,
/// UUID of the GPU to restore onto
pub newUuid: CUuuid,
}
/// CUDA checkpoint GPU UUID pairs for device remapping during restore.
pub type CUcheckpointGpuPair = CUcheckpointGpuPair_st;
/// CUDA checkpoint optional restore arguments
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUcheckpointRestoreArgs_st {
/// Pointer to array of gpu pairs that indicate how to remap GPUs during restore
pub gpuPairs: *mut CUcheckpointGpuPair,
/// Number of gpu pairs to remap
pub gpuPairsCount: ::core::ffi::c_uint,
/// Padding to align the following fields
pub padding0: ::core::ffi::c_uint,
/// Optional custom storage; if NULL, GPU memory is restored from host
pub customStorageInfo_out: *mut *mut CUcheckpointCustomStorageInfo,
/// Reserved for future use, must be zeroed; includes alignment before `customStorageInfo`
pub reserved: [::core::ffi::c_char; 40usize],
}
impl Default for CUcheckpointRestoreArgs_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// CUDA checkpoint optional restore arguments.
pub type CUcheckpointRestoreArgs = CUcheckpointRestoreArgs_st;
/// CUDA checkpoint optional unlock arguments
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUcheckpointUnlockArgs_st {
/// Reserved for future use, must be zeroed
pub reserved: [cuuint64_t; 8usize],
}
/// CUDA checkpoint optional unlock arguments.
pub type CUcheckpointUnlockArgs = CUcheckpointUnlockArgs_st;
singe_loader::functions! { crate::DRIVER;
/// Gets the string description of an error code.
///
/// 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.
///
/// # Parameters
///
/// - `error`: Error code to convert to string.
/// - `pStr`: Address of the string pointer.
pub fn cuGetErrorString(
error: CUresult,
pStr: *mut *const ::core::ffi::c_char,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets the string representation of an error code enum name.
///
/// 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.
///
/// # Parameters
///
/// - `error`: Error code to convert to string.
/// - `pStr`: Address of the string pointer.
pub fn cuGetErrorName(
error: CUresult,
pStr: *mut *const ::core::ffi::c_char,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Initialize the CUDA driver API Initializes the driver API and must be called before any other function from the driver API 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 [`cudaError_enum::CUDA_ERROR_NOT_INITIALIZED`].
///
/// Note: cuInit preloads various libraries needed for JIT compilation. To opt-out of this behavior, set the environment variable CUDA_FORCE_PRELOAD_LIBRARIES=0. CUDA will lazily load JIT libraries as needed. To disable JIT entirely, set the environment variable CUDA_DISABLE_JIT=1.
///
/// # Parameters
///
/// - `Flags`: - Initialization flag for CUDA.
pub fn cuInit(Flags: ::core::ffi::c_uint) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the latest CUDA version supported by driver.
///
/// 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 would be represented by 9020.
///
/// This function automatically returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] if `driverVersion` is NULL.
///
/// # Parameters
///
/// - `driverVersion`: - Returns the CUDA driver version
pub fn cuDriverGetVersion(driverVersion: *mut ::core::ffi::c_int) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a handle to a compute device.
///
/// Returns in `*device` a device handle given an ordinal in the range **[0, [cuDeviceGetCount()](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__DEVICE.html#group__cuda__device_1ga52b5ce05cb8c5fb6831b2c0ff2887c74)-1]**.
///
/// # Parameters
///
/// - `device`: Returned device handle.
/// - `ordinal`: Device number to get handle for.
pub fn cuDeviceGet(device: *mut CUdevice, ordinal: ::core::ffi::c_int) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the number of compute-capable devices.
///
/// 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 no such device, [`cuDeviceGetCount`] returns 0.
///
/// # Parameters
///
/// - `count`: - Returned number of compute-capable devices
pub fn cuDeviceGetCount(count: *mut ::core::ffi::c_int) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns an identifier string for the device.
///
/// 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.
///
/// # Parameters
///
/// - `name`: Returned identifier string for the device.
/// - `len`: Maximum length of string to store in `name`.
/// - `dev`: Device to get identifier string for.
pub fn cuDeviceGetName(
name: *mut ::core::ffi::c_char,
len: ::core::ffi::c_int,
dev: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Return an UUID for the device
///
/// 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.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_DEVICE
///
///
///
/// See also: ::cuDeviceGetAttribute, ::cuDeviceGetCount, ::cuDeviceGetName, ::cuDeviceGetLuid, ::cuDeviceGet, ::cuDeviceTotalMem, ::cudaGetDeviceProperties
///
/// # Parameters
///
/// - `uuid`: - Returned UUID
/// - `dev`: - Device to get identifier string for
pub fn cuDeviceGetUuid_v2(uuid: *mut CUuuid, dev: CUdevice) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Return an LUID and device node mask for the device.
///
/// Return identifying information (`luid` and `deviceNodeMask`) to allow matching device with graphics APIs.
///
/// # Parameters
///
/// - `luid`: Returned LUID.
/// - `deviceNodeMask`: Returned device node mask.
/// - `dev`: Device to get identifier string for.
pub fn cuDeviceGetLuid(
luid: *mut ::core::ffi::c_char,
deviceNodeMask: *mut ::core::ffi::c_uint,
dev: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the total amount of memory on the device
///
/// Returns in `*bytes` the total amount of memory available on the device `dev` in bytes.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_DEVICE
///
///
///
/// See also: ::cuDeviceGetAttribute, ::cuDeviceGetCount, ::cuDeviceGetName, ::cuDeviceGetUuid, ::cuDeviceGet, ::cuDeviceGetExecAffinitySupport, ::cudaMemGetInfo
///
/// # Parameters
///
/// - `bytes`: - Returned memory available on device in bytes
/// - `dev`: - Device handle
pub fn cuDeviceTotalMem_v2(bytes: *mut size_t, dev: CUdevice) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the maximum number of elements allocatable in a 1D linear texture for a given texture element size.
///
/// Returns in `maxWidthInElements` the maximum number of texture elements allocatable in a 1D linear texture for given `format` and `numChannels`.
///
/// # Parameters
///
/// - `maxWidthInElements`: Returned maximum number of texture elements allocatable for given `format` and `numChannels`.
/// - `format`: Texture format.
/// - `numChannels`: Number of channels per texture element.
/// - `dev`: Device handle.
pub fn cuDeviceGetTexture1DLinearMaxWidth(
maxWidthInElements: *mut size_t,
format: CUarray_format,
numChannels: ::core::ffi::c_uint,
dev: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns information about the device.
///
/// Returns in `*pi` the integer value of the attribute `attrib` on device `dev`.
///
/// # Parameters
///
/// - `pi`: Returned device attribute value.
/// - `attrib`: Device attribute to query.
/// - `dev`: Device handle.
pub fn cuDeviceGetAttribute(
pi: *mut ::core::ffi::c_int,
attrib: CUdevice_attribute,
dev: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Queries details about atomic operations supported between the device and host.
///
/// 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`.
///
/// For each [CUatomicOperation](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gafd7012de0abfe50cee089f3f00d6dcf3) in `*operations`, the corresponding result in `*capabilities` will be a bitmask indicating which of [CUatomicOperationCapability](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gaf8fbc0f84fd6461c5611b3935b26e22c) the link supports natively.
///
/// Returns [`cudaError_enum::CUDA_ERROR_INVALID_DEVICE`] if `dev` is not valid.
///
/// 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.
///
/// # Parameters
///
/// - `capabilities`: Returned capability details of each requested operation.
/// - `operations`: Requested operations.
/// - `count`: Count of requested operations and size of capabilities.
/// - `dev`: Device handle.
pub fn cuDeviceGetHostAtomicCapabilities(
capabilities: *mut ::core::ffi::c_uint,
operations: *const CUatomicOperation,
count: ::core::ffi::c_uint,
dev: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Return NvSciSync attributes that this device can support.
///
/// 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.
///
/// If NvSciSyncAttrKey_RequiredPerm field in `nvSciSyncAttrList` is already set this API will return [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`].
///
/// The applications should set `nvSciSyncAttrList` to a valid NvSciSyncAttrList failing which this API will return [`cudaError_enum::CUDA_ERROR_INVALID_HANDLE`].
///
/// The `flags` controls how applications intends to use the NvSciSync created from the `nvSciSyncAttrList`. The valid flags are:
///
/// 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 specific attributes in the same `nvSciSyncAttrList`.
///
/// Note that this API updates the input `nvSciSyncAttrList` with values equivalent to the following public attribute key-values: NvSciSyncAttrKey_RequiredPerm is set to
///
/// [`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`].
///
/// # Parameters
///
/// - `nvSciSyncAttrList`: Return NvSciSync attributes supported.
/// - `dev`: Valid CUDA Device to get NvSciSync attributes for.
/// - `flags`: flags describing NvSciSync usage.
pub fn cuDeviceGetNvSciSyncAttributes(
nvSciSyncAttrList: *mut ::core::ffi::c_void,
dev: CUdevice,
flags: ::core::ffi::c_int,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the current memory pool of a device.
///
/// 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 memory pool.
pub fn cuDeviceSetMemPool(dev: CUdevice, pool: CUmemoryPool) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets the current mempool for a device.
///
/// 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 have been set with [`cuDeviceSetMemPool`].
pub fn cuDeviceGetMemPool(pool: *mut CUmemoryPool, dev: CUdevice) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the default mempool of a device.
///
/// The default mempool of a device contains device memory from that device.
pub fn cuDeviceGetDefaultMemPool(
pool_out: *mut CUmemoryPool,
dev: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns information about the execution affinity support of the device.
///
/// Returns in `*pi` whether execution affinity type `type` is supported by device `dev`. The supported types are.
///
/// # Parameters
///
/// - `pi`: 1 if the execution affinity type `type` is supported by the device, or 0 if not.
/// - `type_`: Execution affinity type to query.
/// - `dev`: Device handle.
pub fn cuDeviceGetExecAffinitySupport(
pi: *mut ::core::ffi::c_int,
type_: CUexecAffinityType,
dev: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Blocks until remote writes are visible to the specified scope.
///
/// Blocks until GPUDirect RDMA writes to the target context via mappings created through APIs like nvidia_p2p_get_pages (see <https://docs.nvidia.com/cuda/gpudirect-rdma> for more information), are visible to the specified scope.
///
/// 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 between the two enums, with smaller scopes having smaller values.
///
/// 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 report both RDMA writes ordering and RDMA write scope as ALL_DEVICES and a call to cuFlushGPUDirectRDMA will be a no-op, but when these multiple paths are used simultaneously, it is the user’s responsibility to ensure ordering by using mechanisms outside the scope of CUDA.
///
/// Users may query support for this API via ::CU_DEVICE_ATTRIBUTE_FLUSH_FLUSH_GPU_DIRECT_RDMA_OPTIONS.
///
/// # Parameters
///
/// - `target`: The target of the operation, see [CUflushGPUDirectRDMAWritesTarget](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1ga01251451232c43bc5c7cb067ed2c28ef).
/// - `scope`: The scope of the operation, see [CUflushGPUDirectRDMAWritesScope](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1ga9eafc4def87e0f6600f905e756ec99d1).
pub fn cuFlushGPUDirectRDMAWrites(
target: CUflushGPUDirectRDMAWritesTarget,
scope: CUflushGPUDirectRDMAWritesScope,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns properties for a selected device.
///
/// Returns in `*prop` the properties of device `dev`. The CUdevprop structure is defined as.
///
/// # Parameters
///
/// - `prop`: Returned properties of device.
/// - `dev`: Device to get properties for.
#[deprecated]
pub fn cuDeviceGetProperties(prop: *mut CUdevprop, dev: CUdevice) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the compute capability of the device.
///
/// Returns in `*major` and `*minor` the major and minor revision numbers that define the compute capability of the device `dev`.
///
/// # Parameters
///
/// - `major`: Major revision number.
/// - `minor`: Minor revision number.
/// - `dev`: Device handle.
#[deprecated]
pub fn cuDeviceComputeCapability(
major: *mut ::core::ffi::c_int,
minor: *mut ::core::ffi::c_int,
dev: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Retain the primary context on the GPU.
///
/// Retains the primary context on the device. Once the user successfully retains the primary context, the primary context will be active and available to the user until the user releases it with cuDevicePrimaryCtxRelease() or resets it with cuDevicePrimaryCtxReset(). Unlike cuCtxCreate() the newly retained context is not pushed onto the stack.
///
/// 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 for *nvidia-smi* can be obtained by passing a -h option to it.
///
/// Please note that the primary context always supports pinned allocations. Other flags can be specified by cuDevicePrimaryCtxSetFlags().
///
/// # Parameters
///
/// - `pctx`: Returned context handle of the new context.
/// - `dev`: Device for which primary context is requested.
pub fn cuDevicePrimaryCtxRetain(pctx: *mut CUcontext, dev: CUdevice) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Release the primary context on the GPU
///
/// Releases the primary context interop on the device. A retained context should always be released once the user is done using it. The context is automatically reset once the last reference to it is released. This behavior is different when the primary context was retained by the CUDA runtime from CUDA 4.0 and earlier. In this case, the primary context remains always active.
///
/// Releasing a primary context that has not been previously retained will fail with ::CUDA_ERROR_INVALID_CONTEXT.
///
/// Please note that unlike ::cuCtxDestroy() this method does not pop the context from stack in any circumstances.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_DEVICE, ::CUDA_ERROR_INVALID_CONTEXT
///
///
///
/// See also: ::cuDevicePrimaryCtxRetain, ::cuCtxDestroy, ::cuCtxGetApiVersion, ::cuCtxGetCacheConfig, ::cuCtxGetDevice, ::cuCtxGetFlags, ::cuCtxGetLimit, ::cuCtxPopCurrent, ::cuCtxPushCurrent, ::cuCtxSetCacheConfig, ::cuCtxSetLimit, ::cuCtxSynchronize
///
/// # Parameters
///
/// - `dev`: - Device which primary context is released
pub fn cuDevicePrimaryCtxRelease_v2(dev: CUdevice) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Set flags for the primary context
///
/// Sets the flags for the primary context on the device overwriting perviously set ones.
///
/// 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 the OS scheduler when waiting for results from the GPU. Only one of the scheduling flags can be set when creating a context.
///
/// - ::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, but may lower the performance of CPU threads if they are performing work in parallel with the CUDA thread.
///
/// - ::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 GPU, but can increase the performance of CPU threads performing work in parallel with the GPU.
///
/// - ::CU_CTX_SCHED_BLOCKING_SYNC: Instruct CUDA to block the CPU thread on a synchronization primitive when waiting for the GPU to finish work.
///
/// - ::CU_CTX_BLOCKING_SYNC: Instruct CUDA to block the CPU thread on a synchronization primitive when waiting for the GPU to finish work. <br> <b>Deprecated:</b> This flag was deprecated as of CUDA 4.0 and was replaced with ::CU_CTX_SCHED_BLOCKING_SYNC.
///
/// - ::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 processors in the system *P.* If *C* > *P,* then CUDA will yield to other OS threads when waiting for the GPU (::CU_CTX_SCHED_YIELD), otherwise CUDA will not yield while waiting for results and actively spin on the processor (::CU_CTX_SCHED_SPIN). Additionally, on Tegra devices, ::CU_CTX_SCHED_AUTO uses a heuristic based on the power profile of the platform and may choose ::CU_CTX_SCHED_BLOCKING_SYNC for low-powered devices.
///
/// - ::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 allocations when launching many kernels with high local memory usage at the cost of potentially increased memory usage. <br> <b>Deprecated:</b> This flag is deprecated and the behavior enabled by this flag is now the default and cannot be disabled.
///
/// - ::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 raises an exception during execution. These environment variables are described in the CUDA-GDB user guide under the "GPU core dump support" section. The initial settings will be taken from the global settings at the time of context creation. The other settings that control coredump output can be modified by calling ::cuCoredumpSetAttribute from the created context after it becomes current.
///
/// - ::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 to a certain pipe that is present in the OS space. These environment variables are described in the CUDA-GDB user guide under 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 ::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 control coredump output can be modified by calling ::cuCoredumpSetAttribute from the created context after it becomes current.
///
/// - ::CU_CTX_SYNC_MEMOPS: Ensures that synchronous memory operations initiated on this context will always synchronize. See further documentation in the section titled "API Synchronization behavior" to learn more about cases when synchronous memory operations can exhibit asynchronous behavior.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_DEVICE, ::CUDA_ERROR_INVALID_VALUE,
///
///
///
/// See also: ::cuDevicePrimaryCtxRetain, ::cuDevicePrimaryCtxGetState, ::cuCtxCreate, ::cuCtxGetFlags, ::cuCtxSetFlags, ::cudaSetDeviceFlags
///
/// # Parameters
///
/// - `dev`: - Device for which the primary context flags are set
/// - `flags`: - New flags for the device
pub fn cuDevicePrimaryCtxSetFlags_v2(
dev: CUdevice,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Get the state of the primary context.
///
/// Returns in `*flags` the flags for the primary context of `dev`, and in `*active` whether it is active. See cuDevicePrimaryCtxSetFlags for flag values.
///
/// # Parameters
///
/// - `dev`: Device to get primary context flags for.
/// - `flags`: Pointer to store flags.
/// - `active`: Pointer to store context state; 0 = inactive, 1 = active.
pub fn cuDevicePrimaryCtxGetState(
dev: CUdevice,
flags: *mut ::core::ffi::c_uint,
active: *mut ::core::ffi::c_int,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Destroy all allocations and reset all state on the primary context
///
/// Explicitly destroys and cleans up all resources associated with the current device in the current process.
///
/// Note that it is responsibility of the calling function to ensure that no other module in the process is using the device any more. For that reason it is recommended to use ::cuDevicePrimaryCtxRelease() in most cases. However it is safe for other modules to call ::cuDevicePrimaryCtxRelease() even after resetting the device. Resetting the primary context does not release it, an application that has retained the primary context should explicitly release its usage.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_DEVICE, ::CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE
///
///
///
/// See also: ::cuDevicePrimaryCtxRetain, ::cuDevicePrimaryCtxRelease, ::cuCtxGetApiVersion, ::cuCtxGetCacheConfig, ::cuCtxGetDevice, ::cuCtxGetFlags, ::cuCtxGetLimit, ::cuCtxPopCurrent, ::cuCtxPushCurrent, ::cuCtxSetCacheConfig, ::cuCtxSetLimit, ::cuCtxSynchronize, ::cudaDeviceReset
///
/// # Parameters
///
/// - `dev`: - Device for which primary context is destroyed
pub fn cuDevicePrimaryCtxReset_v2(dev: CUdevice) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Create a CUDA context
///
/// 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() must call ::cuCtxDestroy() when done using the context. If a context is already current to the thread, it is supplanted by the newly created context and may be restored by a subsequent call to ::cuCtxPopCurrent().
///
/// A regular CUDA context can be created by setting `ctxCreateParams` to NULL.
///
/// A CUDA context can be created with execution affinity. The type and the amount of execution resource the context can use is 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. The supported execution affinity types are:
/// - ::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 execution affinity of the context via ::cuCtxGetExecAffinity after context creation. Currently, this attribute is only supported under Volta+ MPS.
///
/// 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 ::CU_DEVICE_ATTRIBUTE_D3D12_CIG_SUPPORTED. `sharedData` is a ID3D12CommandQueue handle. Support for Vulkan graphics client can be determined using ::cuDeviceGetAttribute() with ::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 both `execAffinityParams` and `cigParams` are NULL, the context will be created as a regular CUDA context.
///
/// 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 the OS scheduler when waiting for results from the GPU. Only one of the scheduling flags can be set when creating a context.
///
/// - ::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, but may lower the performance of CPU threads if they are performing work in parallel with the CUDA thread.
///
/// - ::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 GPU, but can increase the performance of CPU threads performing work in parallel with the GPU.
///
/// - ::CU_CTX_SCHED_BLOCKING_SYNC: Instruct CUDA to block the CPU thread on a synchronization primitive when waiting for the GPU to finish work.
///
/// - ::CU_CTX_BLOCKING_SYNC: Instruct CUDA to block the CPU thread on a synchronization primitive when waiting for the GPU to finish work. <br> <b>Deprecated:</b> This flag was deprecated as of CUDA 4.0 and was replaced with ::CU_CTX_SCHED_BLOCKING_SYNC.
///
/// - ::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 processors in the system *P.* If *C* > *P,* then CUDA will yield to other OS threads when waiting for the GPU (::CU_CTX_SCHED_YIELD), otherwise CUDA will not yield while waiting for results and actively spin on the processor (::CU_CTX_SCHED_SPIN). Additionally, on Tegra devices, ::CU_CTX_SCHED_AUTO uses a heuristic based on the power profile of the platform and may choose ::CU_CTX_SCHED_BLOCKING_SYNC for low-powered devices.
///
/// - ::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 accessible to the GPU.
///
/// - ::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 allocations when launching many kernels with high local memory usage at the cost of potentially increased memory usage. <br> <b>Deprecated:</b> This flag is deprecated and the behavior enabled by this flag is now the default and cannot be disabled. Instead, the per-thread stack size can be controlled with ::cuCtxSetLimit().
///
/// - ::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 raises an exception during execution. These environment variables are described in the CUDA-GDB user guide under the "GPU core dump support" section. The initial attributes will be taken from the global attributes at the time of context creation. 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 Graphics) mode.
///
/// - ::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 to a certain pipe that is present in the OS space. These environment variables are described in the CUDA-GDB user guide under 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 ::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 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 ::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.
///
/// - ::CU_CTX_SYNC_MEMOPS: Ensures that synchronous memory operations initiated on this context will always synchronize. See further documentation in the section titled "API Synchronization behavior" to learn more about cases when synchronous memory operations can exhibit asynchronous behavior.
///
/// Context creation will fail with ::CUDA_ERROR_UNKNOWN if the compute mode of the device is ::CU_COMPUTEMODE_PROHIBITED. The function ::cuDeviceGetAttribute() can be used with ::CU_DEVICE_ATTRIBUTE_COMPUTE_MODE to determine the compute mode of the device. The <i>nvidia-smi</i> tool can be used to set the compute mode for * devices. Documentation for <i>nvidia-smi</i> can be obtained by passing a -h option to it.
///
/// Context creation will fail with ::CUDA_ERROR_INVALID_VALUE if invalid parameter was passed by client to create the CUDA context.
///
/// Context creation in CIG mode will fail with ::CUDA_ERROR_NOT_SUPPORTED if CIG is not supported by the device or the driver.
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_DEVICE, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_NOT_SUPPORTED, ::CUDA_ERROR_OUT_OF_MEMORY, ::CUDA_ERROR_UNKNOWN
///
///
///
/// See also: ::cuCtxDestroy, ::cuCtxGetApiVersion, ::cuCtxGetCacheConfig, ::cuCtxGetDevice, ::cuCtxGetFlags, ::cuCtxGetLimit, ::cuCtxPopCurrent, ::cuCtxPushCurrent, ::cuCtxSetCacheConfig, ::cuCtxSetLimit, ::cuCoredumpSetAttributeGlobal, ::cuCoredumpSetAttribute, ::cuCtxSynchronize ::cuCtxGetExecAffinity,
///
/// # Parameters
///
/// - `pctx`: - Returned context handle of the new context
/// - `ctxCreateParams`: - Context creation parameters. Can be NULL to create a regular CUDA context. See ::CUctxCreateParams for details.
/// - `flags`: - Context creation flags
/// - `dev`: - Device to create context on
pub fn cuCtxCreate_v4(
pctx: *mut CUcontext,
ctxCreateParams: *mut CUctxCreateParams,
flags: ::core::ffi::c_uint,
dev: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Destroy a CUDA context
///
/// 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 that no API call issues using `ctx` while ::cuCtxDestroy() is executing.
///
/// Destroys and cleans up all resources associated with the context. It is the caller's responsibility to ensure that the context or its resources are not accessed or passed in subsequent API calls and doing so will result in undefined behavior. These 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(), ::cuMemAllocHost(), ::cuMemAllocManaged() and ::cuMemAllocPitch().
///
/// If `ctx` is current to the calling thread then `ctx` will also be popped from the current thread's context stack (as though ::cuCtxPopCurrent() 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 ::CUDA_ERROR_CONTEXT_IS_DESTROYED.
///
///
///
/// Note: ::cuCtxDestroy() 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.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
///
///
/// See also: ::cuCtxCreate, ::cuCtxGetApiVersion, ::cuCtxGetCacheConfig, ::cuCtxGetDevice, ::cuCtxGetFlags, ::cuCtxGetLimit, ::cuCtxPopCurrent, ::cuCtxPushCurrent, ::cuCtxSetCacheConfig, ::cuCtxSetLimit, ::cuCtxSynchronize
///
/// # Parameters
///
/// - `ctx`: - Context to destroy
pub fn cuCtxDestroy_v2(ctx: CUcontext) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Pushes a context on the current CPU thread
///
/// 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 functions that operate on the current context are affected.
///
/// The previous current context may be made current again by calling ::cuCtxDestroy() or ::cuCtxPopCurrent().
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
///
///
/// See also: ::cuCtxCreate, ::cuCtxDestroy, ::cuCtxGetApiVersion, ::cuCtxGetCacheConfig, ::cuCtxGetDevice, ::cuCtxGetFlags, ::cuCtxGetLimit, ::cuCtxPopCurrent, ::cuCtxSetCacheConfig, ::cuCtxSetLimit, ::cuCtxSynchronize
///
/// # Parameters
///
/// - `ctx`: - Context to push
pub fn cuCtxPushCurrent_v2(ctx: CUcontext) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Pops the current CUDA context from the current CPU thread.
///
/// 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().
///
/// If a context was current to the CPU thread before ::cuCtxCreate() or ::cuCtxPushCurrent() was called, this function makes that context current to the CPU thread again.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT
///
///
///
/// See also: ::cuCtxCreate, ::cuCtxDestroy, ::cuCtxGetApiVersion, ::cuCtxGetCacheConfig, ::cuCtxGetDevice, ::cuCtxGetFlags, ::cuCtxGetLimit, ::cuCtxPushCurrent, ::cuCtxSetCacheConfig, ::cuCtxSetLimit, ::cuCtxSynchronize
///
/// # Parameters
///
/// - `pctx`: - Returned popped context handle
pub fn cuCtxPopCurrent_v2(pctx: *mut CUcontext) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Binds the specified CUDA context to the calling CPU thread.
///
/// 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.
///
/// 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 calling CPU thread’s CUDA context stack is empty).
///
/// # Parameters
///
/// - `ctx`: - Context to bind to the calling CPU thread
pub fn cuCtxSetCurrent(ctx: CUcontext) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the CUDA context bound to the calling CPU thread.
///
/// 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.
///
/// # Parameters
///
/// - `pctx`: - Returned context handle
pub fn cuCtxGetCurrent(pctx: *mut CUcontext) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the device handle for the current context.
///
/// Returns in `*device` the handle of the current context’s device.
///
/// # Parameters
///
/// - `device`: - Returned device handle for the current context
pub fn cuCtxGetDevice(device: *mut CUdevice) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the device handle for the specified context.
///
/// 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 device.
///
/// # Parameters
///
/// - `device`: Returned device handle for the specified context.
/// - `ctx`: Context for which to obtain the device.
pub fn cuCtxGetDevice_v2(device: *mut CUdevice, ctx: CUcontext) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the flags for the current context.
///
/// Returns in `*flags` the flags of the current context. See cuCtxCreate for flag values.
///
/// # Parameters
///
/// - `flags`: - Pointer to store flags of current context
pub fn cuCtxGetFlags(flags: *mut ::core::ffi::c_uint) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the flags for the current context.
///
/// Sets the flags for the current context overwriting previously set ones. See cuDevicePrimaryCtxSetFlags for flag values.
///
/// # Parameters
///
/// - `flags`: - Flags to set on the current context
pub fn cuCtxSetFlags(flags: ::core::ffi::c_uint) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the unique Id associated with the context supplied.
///
/// 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 CUDA. If context is supplied as NULL and there is one current, the Id of the current context is returned.
///
/// # Parameters
///
/// - `ctx`: Context for which to obtain the Id.
/// - `ctxId`: Pointer to store the Id of the context.
pub fn cuCtxGetId(ctx: CUcontext, ctxId: *mut ::core::ffi::c_ulonglong) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Block for the current context’s tasks to complete.
///
/// Blocks until the current context has completed all preceding requested tasks. If the current context is the primary context, 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.
pub fn cuCtxSynchronize() -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Block for the specified context’s tasks to complete.
///
/// Blocks until the specified context has completed all preceding requested tasks. If the specified context is the primary context, green contexts that have been created will also be synchronized. The API 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.
///
/// If the specified context is NULL, the API will operate on the current context.
///
/// # Parameters
///
/// - `ctx`: - Context to synchronize
pub fn cuCtxSynchronize_v2(ctx: CUcontext) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Set resource limits.
///
/// 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 value to meet h/w requirements (this could be clamping to minimum or maximum values, rounding up to nearest element size, etc). The application can use [`cuCtxGetLimit`] to find out exactly what the limit has been set to.
///
/// Setting each [CUlimit](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gae24c2d4214af24139020f1aecaf32665) has its own specific restrictions, so each is discussed here.
///
/// # Parameters
///
/// - `limit`: Limit to set.
/// - `value`: Size of limit.
pub fn cuCtxSetLimit(limit: CUlimit, value: size_t) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns resource limits.
///
/// Returns in `*pvalue` the current size of `limit`. The supported [CUlimit](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gae24c2d4214af24139020f1aecaf32665) values are.
///
/// # Parameters
///
/// - `pvalue`: Returned size of limit.
/// - `limit`: Limit to query.
pub fn cuCtxGetLimit(pvalue: *mut size_t, limit: CUlimit) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the preferred cache configuration for the current context.
///
/// 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 if possible, but it is free to choose a different configuration if required to execute functions.
///
/// 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.
///
/// The supported cache configurations are.
///
/// # Parameters
///
/// - `pconfig`: - Returned cache configuration
pub fn cuCtxGetCacheConfig(pconfig: *mut CUfunc_cache) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the preferred cache configuration for the current context.
///
/// 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 if possible, but it is free to choose a different configuration if required to execute the function. Any function preference 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.
///
/// This setting does nothing on devices where the size of the L1 cache and shared memory are fixed.
///
/// Launching a kernel with a different preference than the most recent preference setting may insert a device-side synchronization point.
///
/// The supported cache configurations are.
///
/// # Parameters
///
/// - `config`: - Requested cache configuration
pub fn cuCtxSetCacheConfig(config: CUfunc_cache) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets the context’s API version.
///
/// 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 to a specific API version. If `ctx` is NULL, returns the API version used to create the currently bound context.
///
/// Note that new API versions are only introduced when context capabilities are changed that break binary compatibility, so the API version and driver version may be different. For example, it is valid for the API version to be 3020 while the driver version is 4020.
///
/// # Parameters
///
/// - `ctx`: Context to check.
/// - `version`: Pointer to version.
pub fn cuCtxGetApiVersion(
ctx: CUcontext,
version: *mut ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns numerical values that correspond to the least and greatest stream priorities.
///
/// Returns in `*leastPriority` and `*greatestPriority` the numerical values that correspond to the least and greatest stream priorities respectively. Stream priorities follow a 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 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.
///
/// This function will return ‘0’ in both `*leastPriority` and `*greatestPriority` if the current context’s device does not support stream priorities (see [`cuDeviceGetAttribute`]).
///
/// # Parameters
///
/// - `leastPriority`: Pointer to an int in which the numerical value for least stream priority is returned.
/// - `greatestPriority`: Pointer to an int in which the numerical value for greatest stream priority is returned.
pub fn cuCtxGetStreamPriorityRange(
leastPriority: *mut ::core::ffi::c_int,
greatestPriority: *mut ::core::ffi::c_int,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Resets all persisting lines in cache to normal status.
///
/// [`cuCtxResetPersistingL2Cache`] Resets all persisting lines in cache to normal status. Takes effect on function return.
pub fn cuCtxResetPersistingL2Cache() -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the execution affinity setting for the current context.
///
/// Returns in `*pExecAffinity` the current value of `type`. The supported [CUexecAffinityType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1ga14e6345acf2bda65be91eda77cf03f5c) values are.
///
/// # Parameters
///
/// - `pExecAffinity`: Returned execution affinity.
/// - `type_`: Execution affinity type to query.
pub fn cuCtxGetExecAffinity(
pExecAffinity: *mut CUexecAffinityParam,
type_: CUexecAffinityType,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Records an event.
///
/// 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.
///
/// # Parameters
///
/// - `hCtx`: Context to record event for.
/// - `hEvent`: Event to record.
pub fn cuCtxRecordEvent(hCtx: CUcontext, hEvent: CUevent) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Make a context wait on an event.
///
/// 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`.
///
/// # Parameters
///
/// - `hCtx`: Context to wait.
/// - `hEvent`: Event to wait on.
pub fn cuCtxWaitEvent(hCtx: CUcontext, hEvent: CUevent) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Increment a context’s usage-count.
///
/// Note that
///
/// 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.
///
/// Currently, the `flags` parameter must be 0.
///
/// # Parameters
///
/// - `pctx`: Returned context handle of the current context.
/// - `flags`: Context attach flags (must be 0).
#[deprecated]
pub fn cuCtxAttach(pctx: *mut CUcontext, flags: ::core::ffi::c_uint) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Decrement a context’s usage-count.
///
/// Note that
///
/// 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() or [`cuCtxAttach`], and must be current to the calling thread.
///
/// # Parameters
///
/// - `ctx`: - Context to destroy
#[deprecated]
pub fn cuCtxDetach(ctx: CUcontext) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the current shared memory configuration for the current context.
///
/// This function will return in `pConfig` the current size of shared memory banks in the current context. On devices with configurable shared memory banks, [`cuCtxSetSharedMemConfig`] can be used to change this setting, so that all subsequent kernel launches will by default use the new bank size. When [`cuCtxGetSharedMemConfig`] is called on devices without configurable shared memory, it will return the fixed bank size of the hardware.
///
/// The returned bank configurations can be either.
///
/// # Parameters
///
/// - `pConfig`: - returned shared memory configuration
#[deprecated]
pub fn cuCtxGetSharedMemConfig(pConfig: *mut CUsharedconfig) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the shared memory configuration for the current context.
///
/// On devices with configurable shared memory banks, this function will set the context’s shared memory bank size which is used for subsequent kernel launches.
///
/// Changed the shared memory configuration between launches may insert a device side synchronization point between those launches.
///
/// Changing the shared memory bank size will not increase shared memory usage or affect occupancy of kernels, but may have major effects on performance. Larger bank sizes will allow for greater potential bandwidth to shared memory, but will change what kinds of accesses to shared memory will result in bank conflicts.
///
/// This function will do nothing on devices with fixed shared memory bank size.
///
/// The supported bank configurations are.
///
/// # Parameters
///
/// - `config`: - requested shared memory configuration
#[deprecated]
pub fn cuCtxSetSharedMemConfig(config: CUsharedconfig) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Loads a compute module.
///
/// 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 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.
///
/// # Parameters
///
/// - `module`: Returned module.
/// - `fname`: Filename of module to load.
pub fn cuModuleLoad(
module: *mut CUmodule,
fname: *const ::core::ffi::c_char,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Load a module’s data.
///
/// 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.
///
/// # Parameters
///
/// - `module`: Returned module.
/// - `image`: Module data to load.
pub fn cuModuleLoadData(
module: *mut CUmodule,
image: *const ::core::ffi::c_void,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Load a module’s data with options.
///
/// 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.
///
/// # Parameters
///
/// - `module`: Returned module.
/// - `image`: Module data to load.
/// - `numOptions`: Number of options.
/// - `options`: Options for JIT.
/// - `optionValues`: Option values for JIT.
pub fn cuModuleLoadDataEx(
module: *mut CUmodule,
image: *const ::core::ffi::c_void,
numOptions: ::core::ffi::c_uint,
options: *mut CUjit_option,
optionValues: *mut *mut ::core::ffi::c_void,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Load a module’s data.
///
/// 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` files, all representing the same device code, but compiled and optimized for different architectures.
///
/// Prior to CUDA 4.0, there was no documented API for constructing and using fat binary objects by programmers. Starting with 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.
///
/// # Parameters
///
/// - `module`: Returned module.
/// - `fatCubin`: Fat binary to load.
pub fn cuModuleLoadFatBinary(
module: *mut CUmodule,
fatCubin: *const ::core::ffi::c_void,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Unloads a module.
///
/// 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`].
///
/// # Parameters
///
/// - `hmod`: - Module to unload
pub fn cuModuleUnload(hmod: CUmodule) -> CUresult;
}
impl CUmoduleLoadingMode_enum {
/// Lazy Kernel Loading is not enabled.
pub const CU_MODULE_EAGER_LOADING: CUmoduleLoadingMode_enum = CUmoduleLoadingMode_enum(
1,
);
/// Lazy Kernel Loading is enabled.
pub const CU_MODULE_LAZY_LOADING: CUmoduleLoadingMode_enum = CUmoduleLoadingMode_enum(
2,
);
}
/// CUDA Lazy Loading status
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmoduleLoadingMode_enum(pub ::core::ffi::c_uint);
pub use self::CUmoduleLoadingMode_enum as CUmoduleLoadingMode;
singe_loader::functions! { crate::DRIVER;
/// Query lazy loading mode.
///
/// Returns lazy loading mode Module loading mode is controlled by CUDA_MODULE_LOADING env variable.
///
/// # Parameters
///
/// - `mode`: - Returns the lazy loading mode
pub fn cuModuleGetLoadingMode(mode: *mut CUmoduleLoadingMode) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a function handle.
///
/// 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`].
///
/// # Parameters
///
/// - `hfunc`: Returned function handle.
/// - `hmod`: Module to retrieve function from.
/// - `name`: Name of function to retrieve.
pub fn cuModuleGetFunction(
hfunc: *mut CUfunction,
hmod: CUmodule,
name: *const ::core::ffi::c_char,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the number of functions within a module.
///
/// Returns in `count` the number of functions in `mod`.
///
/// # Parameters
///
/// - `count`: Number of functions found within the module.
/// - `mod_`: Module to query.
pub fn cuModuleGetFunctionCount(
count: *mut ::core::ffi::c_uint,
mod_: CUmodule,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the function handles within a module.
///
/// 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 can be queried using ::cuFunctionIsLoaded. CUDA APIs may load the function automatically when called with partially loaded function handle which may incur additional latency. Alternatively, ::cuFunctionLoad can be used to explicitly load a function. The returned function handles become invalid when the module is unloaded.
///
/// # Parameters
///
/// - `functions`: Buffer where the function handles are returned to.
/// - `numFunctions`: Maximum number of function handles may be returned to the buffer.
/// - `mod_`: Module to query from.
pub fn cuModuleEnumerateFunctions(
functions: *mut CUfunction,
numFunctions: ::core::ffi::c_uint,
mod_: CUmodule,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a global pointer from a module
///
/// 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() returns ::CUDA_ERROR_NOT_FOUND. One of the parameters `dptr` or `bytes` (not both) can be NULL in which case it is ignored.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_NOT_FOUND
///
///
///
/// See also: ::cuModuleGetFunction, ::cuModuleGetTexRef, ::cuModuleLoad, ::cuModuleLoadData, ::cuModuleLoadDataEx, ::cuModuleLoadFatBinary, ::cuModuleUnload, ::cudaGetSymbolAddress, ::cudaGetSymbolSize
///
/// # Parameters
///
/// - `dptr`: - Returned global device pointer
/// - `bytes`: - Returned global size in bytes
/// - `hmod`: - Module to retrieve global from
/// - `name`: - Name of global to retrieve
pub fn cuModuleGetGlobal_v2(
dptr: *mut CUdeviceptr,
bytes: *mut size_t,
hmod: CUmodule,
name: *const ::core::ffi::c_char,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates a pending JIT linker invocation.
///
/// 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.
///
/// Both linker and compiler options may be specified. Compiler options will be applied to inputs to this linker action which must be compiled from PTX. The options ::CU_JIT_WALL_TIME, ::CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES, and ::CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES will accumulate data until the CUlinkState is destroyed.
///
/// The data passed in via ::cuLinkAddData and ::cuLinkAddFile 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.
///
/// `optionValues` must remain valid for the life of the CUlinkState if output options are used. No other references to inputs are maintained after this call returns.
///
///
///
/// Note: For LTO-IR input, only LTO-IR compiled with toolkits prior to CUDA 12.0 will be accepted
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_OUT_OF_MEMORY, ::CUDA_ERROR_JIT_COMPILER_NOT_FOUND
///
///
///
/// See also: ::cuLinkAddData, ::cuLinkAddFile, ::cuLinkComplete, ::cuLinkDestroy
///
/// # Parameters
///
/// - `numOptions`: Size of options arrays
/// - `options`: Array of linker and compiler options
/// - `optionValues`: Array of option values, each cast to void *
/// - `stateOut`: On success, this will contain a CUlinkState to specify and complete this action
pub fn cuLinkCreate_v2(
numOptions: ::core::ffi::c_uint,
options: *mut CUjit_option,
optionValues: *mut *mut ::core::ffi::c_void,
stateOut: *mut CUlinkState,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Add an input to a pending linker invocation
///
/// Ownership of `data` is retained by the caller. No reference is retained to any inputs after this call returns.
///
/// This method accepts only compiler options, which are used if the data must be compiled from PTX, and does not accept any of ::CU_JIT_WALL_TIME, ::CU_JIT_INFO_LOG_BUFFER, ::CU_JIT_ERROR_LOG_BUFFER, ::CU_JIT_TARGET_FROM_CUCONTEXT, or ::CU_JIT_TARGET.
///
///
///
/// Note: For LTO-IR input, only LTO-IR compiled with toolkits prior to CUDA 12.0 will be accepted
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_HANDLE, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_IMAGE, ::CUDA_ERROR_INVALID_PTX, ::CUDA_ERROR_UNSUPPORTED_PTX_VERSION, ::CUDA_ERROR_OUT_OF_MEMORY, ::CUDA_ERROR_NO_BINARY_FOR_GPU
///
///
///
/// See also: ::cuLinkCreate, ::cuLinkAddFile, ::cuLinkComplete, ::cuLinkDestroy
///
/// # Parameters
///
/// - `state`: A pending linker action.
/// - `type_`: The type of the input data.
/// - `data`: The input data. PTX must be NULL-terminated.
/// - `size`: The length of the input data.
/// - `name`: An optional name for this input in log messages.
/// - `numOptions`: Size of options.
/// - `options`: Options to be applied only for this input (overrides options from ::cuLinkCreate).
/// - `optionValues`: Array of option values, each cast to void *.
pub fn cuLinkAddData_v2(
state: CUlinkState,
type_: CUjitInputType,
data: *mut ::core::ffi::c_void,
size: size_t,
name: *const ::core::ffi::c_char,
numOptions: ::core::ffi::c_uint,
options: *mut CUjit_option,
optionValues: *mut *mut ::core::ffi::c_void,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Add a file input to a pending linker invocation
///
/// No reference is retained to any inputs after this call returns.
///
/// This method accepts only compiler options, which are used if the input must be compiled from PTX, and does not accept any of ::CU_JIT_WALL_TIME, ::CU_JIT_INFO_LOG_BUFFER, ::CU_JIT_ERROR_LOG_BUFFER, ::CU_JIT_TARGET_FROM_CUCONTEXT, or ::CU_JIT_TARGET.
///
/// This method is equivalent to invoking ::cuLinkAddData on the contents of the file.
///
///
///
/// Note: For LTO-IR input, only LTO-IR compiled with toolkits prior to CUDA 12.0 will be accepted
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_FILE_NOT_FOUND ::CUDA_ERROR_INVALID_HANDLE, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_IMAGE, ::CUDA_ERROR_INVALID_PTX, ::CUDA_ERROR_UNSUPPORTED_PTX_VERSION, ::CUDA_ERROR_OUT_OF_MEMORY, ::CUDA_ERROR_NO_BINARY_FOR_GPU
///
///
///
/// See also: ::cuLinkCreate, ::cuLinkAddData, ::cuLinkComplete, ::cuLinkDestroy
///
/// # Parameters
///
/// - `state`: A pending linker action
/// - `type_`: The type of the input data
/// - `path`: Path to the input file
/// - `numOptions`: Size of options
/// - `options`: Options to be applied only for this input (overrides options from ::cuLinkCreate)
/// - `optionValues`: Array of option values, each cast to void *
pub fn cuLinkAddFile_v2(
state: CUlinkState,
type_: CUjitInputType,
path: *const ::core::ffi::c_char,
numOptions: ::core::ffi::c_uint,
options: *mut CUjit_option,
optionValues: *mut *mut ::core::ffi::c_void,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Complete a pending linker invocation.
///
/// 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`.
///
/// # Parameters
///
/// - `state`: A pending linker invocation.
/// - `cubinOut`: On success, this will point to the output image.
/// - `sizeOut`: Optional parameter to receive the size of the generated image.
pub fn cuLinkComplete(
state: CUlinkState,
cubinOut: *mut *mut ::core::ffi::c_void,
sizeOut: *mut size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Destroys state for a JIT linker invocation.
///
/// # Parameters
///
/// - `state`: State object for the linker invocation
pub fn cuLinkDestroy(state: CUlinkState) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a handle to a texture reference.
///
/// Returns in `*pTexRef` the handle of the texture reference of name `name` in the module `hmod`. If no texture reference of that name exists, [`cuModuleGetTexRef`] returns [`cudaError_enum::CUDA_ERROR_NOT_FOUND`]. This texture reference handle should not be destroyed, since it will be destroyed when the module is unloaded.
///
/// # Parameters
///
/// - `pTexRef`: Returned texture reference.
/// - `hmod`: Module to retrieve texture reference from.
/// - `name`: Name of texture reference to retrieve.
#[deprecated]
pub fn cuModuleGetTexRef(
pTexRef: *mut CUtexref,
hmod: CUmodule,
name: *const ::core::ffi::c_char,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a handle to a surface reference.
///
/// Returns in `*pSurfRef` the handle of the surface reference of name `name` in the module `hmod`. If no surface reference of that name exists, [`cuModuleGetSurfRef`] returns [`cudaError_enum::CUDA_ERROR_NOT_FOUND`].
///
/// # Parameters
///
/// - `pSurfRef`: Returned surface reference.
/// - `hmod`: Module to retrieve surface reference from.
/// - `name`: Name of surface reference to retrieve.
#[deprecated]
pub fn cuModuleGetSurfRef(
pSurfRef: *mut CUsurfref,
hmod: CUmodule,
name: *const ::core::ffi::c_char,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Load a library with specified code and options.
///
/// Takes a pointer `code` and loads the corresponding library `library` based on the application defined library loading mode:
///
/// These environment variables are described in the CUDA programming guide under the “CUDA environment variables” section.
///
/// 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.
///
/// 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`.
///
/// 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`.
///
/// # Parameters
///
/// - `library`: Returned library.
/// - `code`: Code to load.
/// - `jitOptions`: Options for JIT.
/// - `jitOptionsValues`: Option values for JIT.
/// - `numJitOptions`: Number of options.
/// - `libraryOptions`: Options for loading.
/// - `libraryOptionValues`: Option values for loading.
/// - `numLibraryOptions`: Number of options for loading.
pub fn cuLibraryLoadData(
library: *mut CUlibrary,
code: *const ::core::ffi::c_void,
jitOptions: *mut CUjit_option,
jitOptionsValues: *mut *mut ::core::ffi::c_void,
numJitOptions: ::core::ffi::c_uint,
libraryOptions: *mut CUlibraryOption,
libraryOptionValues: *mut *mut ::core::ffi::c_void,
numLibraryOptions: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Load a library with specified file and options.
///
/// Takes a pointer `code` and loads the corresponding library `library` based on the application defined library loading mode:
///
/// These environment variables are described in the CUDA programming guide under the “CUDA environment variables” section.
///
/// 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.
///
/// 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`.
///
/// 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`.
///
/// # Parameters
///
/// - `library`: Returned library.
/// - `fileName`: File to load from.
/// - `jitOptions`: Options for JIT.
/// - `jitOptionsValues`: Option values for JIT.
/// - `numJitOptions`: Number of options.
/// - `libraryOptions`: Options for loading.
/// - `libraryOptionValues`: Option values for loading.
/// - `numLibraryOptions`: Number of options for loading.
pub fn cuLibraryLoadFromFile(
library: *mut CUlibrary,
fileName: *const ::core::ffi::c_char,
jitOptions: *mut CUjit_option,
jitOptionsValues: *mut *mut ::core::ffi::c_void,
numJitOptions: ::core::ffi::c_uint,
libraryOptions: *mut CUlibraryOption,
libraryOptionValues: *mut *mut ::core::ffi::c_void,
numLibraryOptions: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Unloads a library.
///
/// Unloads the library specified with `library`.
///
/// # Parameters
///
/// - `library`: - Library to unload
pub fn cuLibraryUnload(library: CUlibrary) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a kernel handle.
///
/// 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`].
///
/// # Parameters
///
/// - `pKernel`: Returned kernel handle.
/// - `library`: Library to retrieve kernel from.
/// - `name`: Name of kernel to retrieve.
pub fn cuLibraryGetKernel(
pKernel: *mut CUkernel,
library: CUlibrary,
name: *const ::core::ffi::c_char,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the number of kernels within a library.
///
/// Returns in `count` the number of kernels in `lib`.
///
/// # Parameters
///
/// - `count`: Number of kernels found within the library.
/// - `lib`: Library to query.
pub fn cuLibraryGetKernelCount(
count: *mut ::core::ffi::c_uint,
lib: CUlibrary,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Retrieve the kernel handles within a library.
///
/// Returns in `kernels` a maximum number of `numKernels` kernel handles within `lib`. The returned kernel handle becomes invalid when the library is unloaded.
///
/// # Parameters
///
/// - `kernels`: Buffer where the kernel handles are returned to.
/// - `numKernels`: Maximum number of kernel handles may be returned to the buffer.
/// - `lib`: Library to query from.
pub fn cuLibraryEnumerateKernels(
kernels: *mut CUkernel,
numKernels: ::core::ffi::c_uint,
lib: CUlibrary,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a module handle.
///
/// 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`].
///
/// # Parameters
///
/// - `pMod`: Returned module handle.
/// - `library`: Library to retrieve module from.
pub fn cuLibraryGetModule(pMod: *mut CUmodule, library: CUlibrary) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a function handle.
///
/// 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`].
///
/// # Parameters
///
/// - `pFunc`: Returned function handle.
/// - `kernel`: Kernel to retrieve function for the requested context.
pub fn cuKernelGetFunction(pFunc: *mut CUfunction, kernel: CUkernel) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a library handle.
///
/// Returns in `pLib` the handle of the library for the requested kernel `kernel`.
///
/// # Parameters
///
/// - `pLib`: Returned library handle.
/// - `kernel`: Kernel to retrieve library handle.
pub fn cuKernelGetLibrary(pLib: *mut CUlibrary, kernel: CUkernel) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a global device pointer.
///
/// 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.
///
/// # Parameters
///
/// - `dptr`: Returned global device pointer for the requested context.
/// - `bytes`: Returned global size in bytes.
/// - `library`: Library to retrieve global from.
/// - `name`: Name of global to retrieve.
pub fn cuLibraryGetGlobal(
dptr: *mut CUdeviceptr,
bytes: *mut size_t,
library: CUlibrary,
name: *const ::core::ffi::c_char,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a pointer to managed memory.
///
/// 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.
///
/// # Parameters
///
/// - `dptr`: Returned pointer to the managed memory.
/// - `bytes`: Returned memory size in bytes.
/// - `library`: Library to retrieve managed memory from.
/// - `name`: Name of managed memory to retrieve.
pub fn cuLibraryGetManaged(
dptr: *mut CUdeviceptr,
bytes: *mut size_t,
library: CUlibrary,
name: *const ::core::ffi::c_char,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a pointer to a unified function.
///
/// 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`].
///
/// # Parameters
///
/// - `fptr`: Returned pointer to a unified function.
/// - `library`: Library to retrieve function pointer memory from.
/// - `symbol`: Name of function pointer to retrieve.
pub fn cuLibraryGetUnifiedFunction(
fptr: *mut *mut ::core::ffi::c_void,
library: CUlibrary,
symbol: *const ::core::ffi::c_char,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns information about a kernel.
///
/// Returns in `*pi` the integer value of the attribute `attrib` for the kernel `kernel` for the requested device `dev`. The supported attributes are.
///
/// # Parameters
///
/// - `pi`: Returned attribute value.
/// - `attrib`: Attribute requested.
/// - `kernel`: Kernel to query attribute of.
/// - `dev`: Device to query attribute of.
pub fn cuKernelGetAttribute(
pi: *mut ::core::ffi::c_int,
attrib: CUfunction_attribute,
kernel: CUkernel,
dev: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets information about a kernel.
///
/// 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 will return an error. Not all attributes can have values set. Attempting to set a value on a read-only attribute will result in an error ([`CUresult::CUDA_ERROR_INVALID_VALUE`])
///
/// 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.
///
/// Supported attributes are.
///
/// # Parameters
///
/// - `attrib`: Attribute requested.
/// - `val`: Value to set.
/// - `kernel`: Kernel to set attribute of.
/// - `dev`: Device to set attribute of.
pub fn cuKernelSetAttribute(
attrib: CUfunction_attribute,
val: ::core::ffi::c_int,
kernel: CUkernel,
dev: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the preferred cache configuration for a device kernel.
///
/// 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 configuration if required to execute `kernel`. Any context-wide preference set via [`cuCtxSetCacheConfig`] will be overridden by this per-kernel setting.
///
/// 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.
///
/// This setting does nothing on devices where the size of the L1 cache and shared memory are fixed.
///
/// Launching a kernel with a different preference than the most recent preference setting may insert a device-side synchronization point.
///
/// The supported cache configurations are.
///
/// # Parameters
///
/// - `kernel`: Kernel to configure cache for.
/// - `config`: Requested cache configuration.
/// - `dev`: Device to set attribute of.
pub fn cuKernelSetCacheConfig(
kernel: CUkernel,
config: CUfunc_cache,
dev: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the function name for a [`CUkernel`] handle.
///
/// 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. If the library is unloaded or reloaded, one must call the API again to get the updated name. This API may return a mangled 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.
///
/// # Parameters
///
/// - `name`: The returned name of the function.
/// - `hfunc`: The function handle to retrieve the name for.
pub fn cuKernelGetName(
name: *mut *const ::core::ffi::c_char,
hfunc: CUkernel,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the offset and size of a kernel parameter in the device-side parameter layout.
///
/// 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 can be used to update kernel node parameters from the device via ::cudaGraphKernelNodeSetParam() and ::cudaGraphKernelNodeUpdatesApply(). `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.
///
/// # Parameters
///
/// - `kernel`: The kernel to query.
/// - `paramIndex`: The parameter index to query.
/// - `paramOffset`: Returns the offset into the device-side parameter layout at which the parameter resides.
/// - `paramSize`: Optionally returns the size of the parameter in the device-side parameter layout.
pub fn cuKernelGetParamInfo(
kernel: CUkernel,
paramIndex: size_t,
paramOffset: *mut size_t,
paramSize: *mut size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the number of parameters used by the kernel.
///
/// Queries the number of kernel parameters used by `kernel` and returns it in `paramCount`.
///
/// # Parameters
///
/// - `kernel`: The kernel to query.
/// - `paramCount`: Returns the number of parameters used by the function.
pub fn cuKernelGetParamCount(kernel: CUkernel, paramCount: *mut size_t) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets free and total memory
///
/// Returns in `*total` the total amount of memory available to the 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 the memory that the OS reports as free. In a multi-tenet situation, free estimate returned is prone to race condition where a new allocation/free done by a different process or a different thread in the same process between the time when free memory was estimated and reported, will result in deviation in free value reported and actual free memory.
///
/// The integrated GPU on Tegra shares memory with CPU and other component of the SoC. The free and total values returned by the API excludes the SWAP memory space maintained by the OS on some platforms. The OS may move some of the memory pages into swap area as the GPU or CPU allocate or access memory. See Tegra app note on how to calculate total and free memory on Tegra.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaMemGetInfo
///
/// # Parameters
///
/// - `free`: - Returned free memory in bytes
/// - `total`: - Returned total memory in bytes
pub fn cuMemGetInfo_v2(free: *mut size_t, total: *mut size_t) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Allocates device memory
///
/// 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. If `bytesize` is 0, ::cuMemAlloc() returns ::CUDA_ERROR_INVALID_VALUE.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_OUT_OF_MEMORY ::CUDA_ERROR_EXTERNAL_DEVICE
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaMalloc
///
/// # Parameters
///
/// - `dptr`: - Returned device pointer
/// - `bytesize`: - Requested allocation size in bytes
pub fn cuMemAlloc_v2(dptr: *mut CUdeviceptr, bytesize: size_t) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Allocates pitched device memory
///
/// 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 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 pitch returned in `*pPitch` by ::cuMemAllocPitch() is the width in bytes of the allocation. The intended usage of pitch is as a separate parameter of the allocation, used to compute addresses within the 2D array. Given the row and column of an array element of type **T,** the address is computed as:
///
///
///
/// ```text
/// T* pElement = (T*)((char*)BaseAddress + Row * Pitch) + Column;
/// ```
///
/// The pitch returned by ::cuMemAllocPitch() is guaranteed to work with ::cuMemcpy2D() under all circumstances. For allocations of 2D arrays, it is recommended that programmers consider performing pitch allocations using ::cuMemAllocPitch(). Due to alignment restrictions in the hardware, this is especially true if the application will be performing 2D memory copies between different regions of device memory (whether linear memory or CUDA arrays).
///
/// The byte alignment of the pitch returned by ::cuMemAllocPitch() is guaranteed to match or exceed the alignment requirement for texture binding with ::cuTexRefSetAddress2D().
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_OUT_OF_MEMORY
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaMallocPitch
///
/// # Parameters
///
/// - `dptr`: - Returned device pointer
/// - `pPitch`: - Returned pitch of allocation in bytes
/// - `WidthInBytes`: - Requested allocation width in bytes
/// - `Height`: - Requested allocation height in rows
/// - `ElementSizeBytes`: - Size of largest reads/writes for range
pub fn cuMemAllocPitch_v2(
dptr: *mut CUdeviceptr,
pPitch: *mut size_t,
WidthInBytes: size_t,
Height: size_t,
ElementSizeBytes: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Frees device memory
///
/// 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(), ::cuMemAllocPitch(), ::cuMemAllocManaged(), ::cuMemAllocAsync(), ::cuMemAllocFromPoolAsync()
///
/// 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. 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.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemAllocManaged, ::cuMemAllocAsync, ::cuMemAllocFromPoolAsync, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemFreeAsync, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaFree
///
/// # Parameters
///
/// - `dptr`: - Pointer to memory to free
pub fn cuMemFree_v2(dptr: CUdeviceptr) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Get information on memory allocations
///
/// 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.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_NOT_FOUND, ::CUDA_ERROR_INVALID_VALUE
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32
///
/// # Parameters
///
/// - `pbase`: - Returned base address
/// - `psize`: - Returned size of device memory allocation
/// - `dptr`: - Device pointer to query
pub fn cuMemGetAddressRange_v2(
pbase: *mut CUdeviceptr,
psize: *mut size_t,
dptr: CUdeviceptr,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Allocates page-locked host memory
///
/// Allocates `bytesize` bytes of host memory that is page-locked and accessible to the device. The driver tracks the virtual memory ranges allocated 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 memory obtained with functions such as ::malloc().
///
/// On systems where ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES is true, ::cuMemAllocHost may not page-lock the allocated memory.
///
/// Page-locking excessive amounts of memory with ::cuMemAllocHost() may degrade system performance, since it reduces the amount of memory available to the system for paging. As a result, this function is best used sparingly to allocate staging areas for data exchange between host and device.
///
/// Note all host memory allocated using ::cuMemAllocHost() will automatically be immediately accessible to all contexts on all devices which support unified addressing (as may be queried using ::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 pointer `*pp`. See `CUDA_UNIFIED` for additional details.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_OUT_OF_MEMORY ::CUDA_ERROR_EXTERNAL_DEVICE
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaMallocHost
///
/// # Parameters
///
/// - `pp`: - Returned pointer to host memory
/// - `bytesize`: - Requested allocation size in bytes
pub fn cuMemAllocHost_v2(
pp: *mut *mut ::core::ffi::c_void,
bytesize: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Frees page-locked host memory.
///
/// Frees the memory space pointed to by `p`, which must have been returned by a previous call to cuMemAllocHost().
///
/// # Parameters
///
/// - `p`: - Pointer to memory to free
pub fn cuMemFreeHost(p: *mut ::core::ffi::c_void) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Allocates page-locked host memory.
///
/// Allocates `bytesize` bytes of host memory that is page-locked and accessible to the device. The driver tracks the virtual memory ranges allocated with this function and automatically accelerates calls to functions such as cuMemcpyHtoD(). Since the memory can be accessed directly by the device, it can be read or written with much higher bandwidth than pageable memory obtained with functions such as ::malloc().
///
/// 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.
///
/// Page-locking excessive amounts of memory may degrade system performance, since it reduces the amount of memory available to the system for paging. As a result, this function is best used sparingly to allocate staging areas for data exchange between host and device.
///
/// The `Flags` parameter enables different options to be specified that affect the allocation, as follows.
///
/// All of these flags are orthogonal to one another: a developer may allocate memory that is portable, mapped and/or write-combined with no restrictions.
///
/// 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() because the memory may be mapped into other CUDA contexts via the [`CU_MEMHOSTALLOC_PORTABLE`] flag.
///
/// The memory allocated by this function must be freed with [`cuMemFreeHost`].
///
/// 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 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 host pointer `*pp`. If the flag [`CU_MEMHOSTALLOC_WRITECOMBINED`] is specified, then the function cuMemHostGetDevicePointer() must be used to query the device pointer, even if the context supports unified addressing. See [Unified Addressing](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__UNIFIED.html#group__cuda__unified) for additional details.
///
/// # Parameters
///
/// - `pp`: Returned pointer to host memory.
/// - `bytesize`: Requested allocation size in bytes.
/// - `Flags`: Flags for allocation request.
pub fn cuMemHostAlloc(
pp: *mut *mut ::core::ffi::c_void,
bytesize: size_t,
Flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Passes back device pointer of mapped pinned memory
///
/// Passes back the device pointer `pdptr` corresponding to the mapped, pinned host buffer `p` allocated by ::cuMemHostAlloc.
///
/// ::cuMemHostGetDevicePointer() 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 mapped pinned memory.
///
/// For devices that have a non-zero value for the device attribute ::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() 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 the device attribute, the device pointer returned by ::cuMemHostGetDevicePointer() 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() 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 to access the memory using either pointer on devices that have a non-zero value for the device attribute. Note however that such devices should access the memory using only one of the two pointers and not both.
///
/// `Flags` provides for future releases. For now, it must be set to 0.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaHostGetDevicePointer
///
/// # Parameters
///
/// - `pdptr`: - Returned device pointer
/// - `p`: - Host pointer
/// - `Flags`: - Options (must be 0)
pub fn cuMemHostGetDevicePointer_v2(
pdptr: *mut CUdeviceptr,
p: *mut ::core::ffi::c_void,
Flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Passes back flags that were used for a pinned allocation.
///
/// Passes back the flags `pFlags` that were specified when allocating the pinned host buffer `p` allocated by [`cuMemHostAlloc`].
///
/// [`cuMemHostGetFlags`] will fail if the pointer does not reside in an allocation performed by cuMemAllocHost() or [`cuMemHostAlloc`].
///
/// # Parameters
///
/// - `pFlags`: Returned flags word.
/// - `p`: Host pointer.
pub fn cuMemHostGetFlags(
pFlags: *mut ::core::ffi::c_uint,
p: *mut ::core::ffi::c_void,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Allocates memory that will be automatically managed by the Unified Memory system.
///
/// 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 must obey the Unified Memory programming model.
///
/// `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.
///
/// 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 until all work in the stream has completed.
///
/// Memory allocated with [`cuMemAllocManaged`] should be released with cuMemFree.
///
/// 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 order to make room for other allocations.
///
/// 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 memory can migrate to any processor’s memory at any time. The Unified Memory driver will employ heuristics to maintain data locality and prevent excessive page faults to the extent possible. The application can also guide the driver about memory usage patterns via cuMemAdvise. The application can also explicitly migrate memory to a desired processor’s memory via cuMemPrefetchAsync.
///
/// 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 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 driver does not migrate memory among such GPUs.
///
/// 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 [`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.
///
/// # Parameters
///
/// - `dptr`: Returned device pointer.
/// - `bytesize`: Requested allocation size in bytes.
/// - `flags`: Must be one of [`CUmemAttach_flags_enum::CU_MEM_ATTACH_GLOBAL`] or [`CUmemAttach_flags_enum::CU_MEM_ATTACH_HOST`].
pub fn cuMemAllocManaged(
dptr: *mut CUdeviceptr,
bytesize: size_t,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Registers a callback function to receive async notifications.
///
/// Registers `callbackFunc` to receive async notifications.
///
/// The `userData`
///
/// parameter is passed to the callback function at async notification time.
///
/// Likewise,
///
/// The callback function being registered should be designed to return quickly (~10ms).
///
/// Any long running tasks should be queued for execution on an application thread.
///
/// 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.
///
/// Returns in `*callback` a handle representing the registered callback instance.
///
/// # Parameters
///
/// - `device`: The device on which to register the callback.
/// - `callbackFunc`: The function to register as a callback.
/// - `userData`: A generic pointer to user data. This is passed into the callback function.
/// - `callback`: A handle representing the registered callback instance.
pub fn cuDeviceRegisterAsyncNotification(
device: CUdevice,
callbackFunc: CUasyncCallback,
userData: *mut ::core::ffi::c_void,
callback: *mut CUasyncCallbackHandle,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Unregisters an async notification callback.
///
/// Unregisters `callback` so that the corresponding callback function will stop receiving async notifications.
///
/// # Parameters
///
/// - `device`: The device from which to remove `callback`.
/// - `callback`: The callback instance to unregister from receiving async notifications.
pub fn cuDeviceUnregisterAsyncNotification(
device: CUdevice,
callback: CUasyncCallbackHandle,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a handle to a compute device.
///
/// Returns in `*device` a device handle given a PCI bus ID string.
///
/// where `domain`, `bus`, `device`, and `function` are all hexadecimal values.
///
/// # Parameters
///
/// - `dev`: Returned device handle.
/// - `pciBusId`: String in one of the following forms.
pub fn cuDeviceGetByPCIBusId(
dev: *mut CUdevice,
pciBusId: *const ::core::ffi::c_char,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a PCI Bus Id string for the device.
///
/// 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.
///
/// where `domain`, `bus`, `device`, and `function` are all hexadecimal values. pciBusId should be large enough to store 13 characters including the NULL-terminator.
///
/// # Parameters
///
/// - `pciBusId`: Returned identifier string for the device in the following format.
/// - `len`: Maximum length of string to store in `name`.
/// - `dev`: Device to get identifier string for.
pub fn cuDeviceGetPCIBusId(
pciBusId: *mut ::core::ffi::c_char,
len: ::core::ffi::c_int,
dev: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets an interprocess handle for a previously allocated event.
///
/// 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.
///
/// 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 will result in undefined behavior.
///
/// IPC functionality is restricted to devices with support for unified addressing on Linux and Windows operating systems. IPC functionality on Windows is supported for compatibility purposes but not recommended as it comes with performance cost. Users can test their device for IPC functionality by calling [`cuDeviceGetAttribute`] with [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED`].
///
/// # Parameters
///
/// - `pHandle`: Pointer to a user allocated CUipcEventHandle in which to return the opaque event handle.
/// - `event`: Event allocated with [`CUevent_flags_enum::CU_EVENT_INTERPROCESS`] and [`CUevent_flags_enum::CU_EVENT_DISABLE_TIMING`] flags.
pub fn cuIpcGetEventHandle(
pHandle: *mut CUipcEventHandle,
event: CUevent,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Opens an interprocess event handle for use in the current process.
///
/// 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.
///
/// Performing operations on the imported event after the exported event has been freed with cuEventDestroy will result in undefined behavior.
///
/// IPC functionality is restricted to devices with support for unified addressing on Linux and Windows operating systems. IPC functionality on Windows is supported for compatibility purposes but not recommended as it comes with performance cost. Users can test their device for IPC functionality by calling ::cuapiDeviceGetAttribute with [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED`].
///
/// # Parameters
///
/// - `phEvent`: Returns the imported event.
/// - `handle`: Interprocess handle to open.
pub fn cuIpcOpenEventHandle(
phEvent: *mut CUevent,
handle: CUipcEventHandle,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets an interprocess memory handle for an existing device memory allocation.
///
/// Takes a pointer to the base of an existing device memory allocation created with cuMemAlloc and exports it for use in another process. This is a lightweight operation and may be called multiple times on an allocation without adverse effects.
///
/// If a region of memory is freed with cuMemFree and a subsequent call to cuMemAlloc returns memory with the same device address, [`cuIpcGetMemHandle`] will return a unique handle for the new memory.
///
/// IPC functionality is restricted to devices with support for unified addressing on Linux and Windows operating systems. IPC functionality on Windows is supported for compatibility purposes but not recommended as it comes with performance cost. Users can test their device for IPC functionality by calling ::cuapiDeviceGetAttribute with [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED`].
///
/// # Parameters
///
/// - `pHandle`: Pointer to user allocated CUipcMemHandle to return the handle in.
/// - `dptr`: Base pointer to previously allocated device memory.
pub fn cuIpcGetMemHandle(
pHandle: *mut CUipcMemHandle,
dptr: CUdeviceptr,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Opens an interprocess memory handle exported from another process and returns a device pointer usable in the local process.
///
/// Maps memory exported from another process with ::cuIpcGetMemHandle into the current device address space. For contexts on different devices ::cuIpcOpenMemHandle can attempt to enable peer access between the devices as if the user called ::cuCtxEnablePeerAccess. This behavior is controlled by the ::CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS flag. ::cuDeviceCanAccessPeer can determine if a mapping is possible.
///
/// 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.
///
/// If the memory handle has already been opened by the current context, the reference count on the handle is incremented by 1 and the existing device pointer is returned.
///
/// Memory returned from ::cuIpcOpenMemHandle must be freed with ::cuIpcCloseMemHandle.
///
/// Calling ::cuMemFree on an exported memory region before calling ::cuIpcCloseMemHandle in the importing context will result in undefined behavior.
///
/// IPC functionality is restricted to devices with support for unified addressing on Linux and Windows operating systems. IPC functionality on Windows is supported for compatibility purposes but not recommended as it comes with performance cost. Users can test their device for IPC functionality by calling ::cuapiDeviceGetAttribute with ::CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_MAP_FAILED, ::CUDA_ERROR_INVALID_HANDLE, ::CUDA_ERROR_TOO_MANY_PEERS, ::CUDA_ERROR_INVALID_VALUE
///
///
///
/// Note: No guarantees are made about the address returned in `*pdptr`. In particular, multiple processes may not receive the same address for the same `handle`.
///
///
///
/// See also: ::cuMemAlloc, ::cuMemFree, ::cuIpcGetEventHandle, ::cuIpcOpenEventHandle, ::cuIpcGetMemHandle, ::cuIpcCloseMemHandle, ::cuCtxEnablePeerAccess, ::cuDeviceCanAccessPeer, ::cudaIpcOpenMemHandle
///
/// # Parameters
///
/// - `pdptr`: - Returned device pointer
/// - `handle`: - ::CUipcMemHandle to open
/// - `Flags`: - Flags for this operation. Must be specified as ::CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS
pub fn cuIpcOpenMemHandle_v2(
pdptr: *mut CUdeviceptr,
handle: CUipcMemHandle,
Flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Attempts to close memory mapped with cuIpcOpenMemHandle.
///
/// Decrements the reference count of the memory returned by cuIpcOpenMemHandle by 1. When the reference count reaches 0, this API unmaps the memory. The original allocation in the exporting process as well as imported mappings in other processes will be unaffected.
///
/// Any resources used to enable peer access will be freed if this is the last mapping using them.
///
/// IPC functionality is restricted to devices with support for unified addressing on Linux and Windows operating systems. IPC functionality on Windows is supported for compatibility purposes but not recommended as it comes with performance cost. Users can test their device for IPC functionality by calling ::cuapiDeviceGetAttribute with [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED`].
///
/// # Parameters
///
/// - `dptr`: - Device pointer returned by ::cuIpcOpenMemHandle
pub fn cuIpcCloseMemHandle(dptr: CUdeviceptr) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Registers an existing host memory range for use by CUDA
///
/// 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(). Since the memory can be accessed directly by the device, it can be read or written with much higher bandwidth than pageable memory that has not been registered. Page-locking excessive amounts of memory may degrade system performance, since it reduces the amount of memory available to the system for paging. As a result, this function is best used sparingly to register staging areas for data exchange between host and device.
///
/// On systems where ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES is true, ::cuMemHostRegister will not page-lock the memory range specified by `ptr` but only populate unpopulated pages.
///
/// The `Flags` parameter enables different options to be specified that affect the allocation, as follows.
///
/// - ::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 the allocation.
///
/// - ::CU_MEMHOSTREGISTER_DEVICEMAP: Maps the allocation into the CUDA address space. The device pointer to the memory may be obtained by calling ::cuMemHostGetDevicePointer().
///
/// - ::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.
///
/// - ::CU_MEMHOSTREGISTER_READ_ONLY: The pointer is treated as pointing to memory that is considered read-only by the device. On platforms 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 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 to error with CUDA_ERROR_NOT_SUPPORTED.
///
/// All of these flags are orthogonal to one another: a developer may page-lock memory that is portable or mapped with no restrictions.
///
/// 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() because the memory may be mapped into other CUDA contexts via the ::CU_MEMHOSTREGISTER_PORTABLE flag.
///
/// For devices that have a non-zero value for the device attribute ::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() 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 the device attribute, the device pointer returned by ::cuMemHostGetDevicePointer() 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() 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 to access the memory using either pointer on devices that have a non-zero value for the device attribute. Note however that such devices should access the memory using only of the two pointers and not both.
///
/// The memory page-locked by this function must be unregistered with ::cuMemHostUnregister().
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_OUT_OF_MEMORY, ::CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED, ::CUDA_ERROR_NOT_PERMITTED, ::CUDA_ERROR_NOT_SUPPORTED ::CUDA_ERROR_EXTERNAL_DEVICE
///
///
///
/// See also: ::cuMemHostUnregister, ::cuMemHostGetFlags, ::cuMemHostGetDevicePointer, ::cudaHostRegister
///
/// # Parameters
///
/// - `p`: - Host pointer to memory to page-lock
/// - `bytesize`: - Size in bytes of the address range to page-lock
/// - `Flags`: - Flags for allocation request
pub fn cuMemHostRegister_v2(
p: *mut ::core::ffi::c_void,
bytesize: size_t,
Flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Unregisters a memory range that was registered with cuMemHostRegister.
///
/// Unmaps the memory range whose base address is specified by `p`, and makes it pageable again.
///
/// The base address must be the same one specified to cuMemHostRegister().
///
/// # Parameters
///
/// - `p`: - Host pointer to memory to unregister
pub fn cuMemHostUnregister(p: *mut ::core::ffi::c_void) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory.
///
/// 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, device to device, or device to host) from the pointer values. This function is only allowed in contexts which support unified addressing.
///
/// # Parameters
///
/// - `dst`: Destination unified virtual address space pointer.
/// - `src`: Source unified virtual address space pointer.
/// - `ByteCount`: Size of memory copy in bytes.
pub fn cuMemcpy(dst: CUdeviceptr, src: CUdeviceptr, ByteCount: size_t) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies device memory between two contexts.
///
/// 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.
///
/// # Parameters
///
/// - `dstDevice`: Destination device pointer.
/// - `dstContext`: Destination context.
/// - `srcDevice`: Source device pointer.
/// - `srcContext`: Source context.
/// - `ByteCount`: Size of memory copy in bytes.
pub fn cuMemcpyPeer(
dstDevice: CUdeviceptr,
dstContext: CUcontext,
srcDevice: CUdeviceptr,
srcContext: CUcontext,
ByteCount: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory from Host to Device
///
/// 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.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _sync
///
/// Note: _memcpy
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaMemcpy, ::cudaMemcpyToSymbol
///
/// # Parameters
///
/// - `dstDevice`: - Destination device pointer
/// - `srcHost`: - Source host pointer
/// - `ByteCount`: - Size of memory copy in bytes
pub fn cuMemcpyHtoD_v2(
dstDevice: CUdeviceptr,
srcHost: *const ::core::ffi::c_void,
ByteCount: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory from Device to Host
///
/// 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.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _sync
///
/// Note: _memcpy
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaMemcpy, ::cudaMemcpyFromSymbol
///
/// # Parameters
///
/// - `dstHost`: - Destination host pointer
/// - `srcDevice`: - Source device pointer
/// - `ByteCount`: - Size of memory copy in bytes
pub fn cuMemcpyDtoH_v2(
dstHost: *mut ::core::ffi::c_void,
srcDevice: CUdeviceptr,
ByteCount: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory from Device to Device
///
/// 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.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _sync
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaMemcpy, ::cudaMemcpyToSymbol, ::cudaMemcpyFromSymbol
///
/// # Parameters
///
/// - `dstDevice`: - Destination device pointer
/// - `srcDevice`: - Source device pointer
/// - `ByteCount`: - Size of memory copy in bytes
pub fn cuMemcpyDtoD_v2(
dstDevice: CUdeviceptr,
srcDevice: CUdeviceptr,
ByteCount: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory from Device to Array
///
/// 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.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _sync
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaMemcpyToArray
///
/// # Parameters
///
/// - `dstArray`: - Destination array
/// - `dstOffset`: - Offset in bytes of destination array
/// - `srcDevice`: - Source device pointer
/// - `ByteCount`: - Size of memory copy in bytes
pub fn cuMemcpyDtoA_v2(
dstArray: CUarray,
dstOffset: size_t,
srcDevice: CUdeviceptr,
ByteCount: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory from Array to Device
///
/// 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.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _sync
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaMemcpyFromArray
///
/// # Parameters
///
/// - `dstDevice`: - Destination device pointer
/// - `srcArray`: - Source array
/// - `srcOffset`: - Offset in bytes of source array
/// - `ByteCount`: - Size of memory copy in bytes
pub fn cuMemcpyAtoD_v2(
dstDevice: CUdeviceptr,
srcArray: CUarray,
srcOffset: size_t,
ByteCount: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory from Host to Array
///
/// 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.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _sync
///
/// Note: _memcpy
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaMemcpyToArray
///
/// # Parameters
///
/// - `dstArray`: - Destination array
/// - `dstOffset`: - Offset in bytes of destination array
/// - `srcHost`: - Source host pointer
/// - `ByteCount`: - Size of memory copy in bytes
pub fn cuMemcpyHtoA_v2(
dstArray: CUarray,
dstOffset: size_t,
srcHost: *const ::core::ffi::c_void,
ByteCount: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory from Array to Host
///
/// 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.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _sync
///
/// Note: _memcpy
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaMemcpyFromArray
///
/// # Parameters
///
/// - `dstHost`: - Destination device pointer
/// - `srcArray`: - Source array
/// - `srcOffset`: - Offset in bytes of source array
/// - `ByteCount`: - Size of memory copy in bytes
pub fn cuMemcpyAtoH_v2(
dstHost: *mut ::core::ffi::c_void,
srcArray: CUarray,
srcOffset: size_t,
ByteCount: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory from Array to Array
///
/// 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 must be the same size; and count must be evenly divisible by that size.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _sync
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaMemcpyArrayToArray
///
/// # Parameters
///
/// - `dstArray`: - Destination array
/// - `dstOffset`: - Offset in bytes of destination array
/// - `srcArray`: - Source array
/// - `srcOffset`: - Offset in bytes of source array
/// - `ByteCount`: - Size of memory copy in bytes
pub fn cuMemcpyAtoA_v2(
dstArray: CUarray,
dstOffset: size_t,
srcArray: CUarray,
srcOffset: size_t,
ByteCount: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory for 2D arrays
///
/// Perform a 2D memory copy according to the parameters specified in `pCopy`. The ::CUDA_MEMCPY2D structure is defined as:
///
///
///
///
///
/// ```text
/// typedef struct CUDA_MEMCPY2D_st {
/// unsigned int srcXInBytes, srcY;
/// CUmemorytype srcMemoryType;
/// const void *srcHost;
/// CUdeviceptr srcDevice;
/// CUarray srcArray;
/// unsigned int srcPitch;
///
/// unsigned int dstXInBytes, dstY;
/// CUmemorytype dstMemoryType;
/// void *dstHost;
/// CUdeviceptr dstDevice;
/// CUarray dstArray;
/// unsigned int dstPitch;
///
/// unsigned int WidthInBytes;
/// unsigned int Height;
/// } CUDA_MEMCPY2D;
/// ```
///
/// where:
/// - ::srcMemoryType and ::dstMemoryType specify the type of memory of the source and destination, respectively; ::CUmemorytype_enum is defined as:
///
///
///
///
///
/// ```text
/// typedef enum CUmemorytype_enum {
/// CU_MEMORYTYPE_HOST = 0x01,
/// CU_MEMORYTYPE_DEVICE = 0x02,
/// CU_MEMORYTYPE_ARRAY = 0x03,
/// CU_MEMORYTYPE_UNIFIED = 0x04
/// } CUmemorytype;
/// ```
///
///
///
/// If ::srcMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::srcDevice and ::srcPitch specify the (unified virtual address space) base address of the source data and the bytes per row to apply. ::srcArray is ignored. This value may be used only if unified addressing is supported in the calling context.
///
///
///
/// If ::srcMemoryType is ::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.
///
///
///
/// If ::srcMemoryType is ::CU_MEMORYTYPE_DEVICE, ::srcDevice and ::srcPitch specify the (device) base address of the source data and the bytes per row to apply. ::srcArray is ignored.
///
///
///
/// If ::srcMemoryType is ::CU_MEMORYTYPE_ARRAY, ::srcArray specifies the handle of the source data. ::srcHost, ::srcDevice and ::srcPitch are ignored.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_HOST, ::dstHost and ::dstPitch specify the (host) base address of the destination data and the bytes per row to apply. ::dstArray is ignored.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::dstDevice and ::dstPitch specify the (unified virtual address space) base address of the source data and the bytes per row to apply. ::dstArray is ignored. This value may be used only if unified addressing is supported in the calling context.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_DEVICE, ::dstDevice and ::dstPitch specify the (device) base address of the destination data and the bytes per row to apply. ::dstArray is ignored.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_ARRAY, ::dstArray specifies the handle of the destination data. ::dstHost, ::dstDevice and ::dstPitch are ignored.
///
/// - ::srcXInBytes and ::srcY specify the base address of the source data for the copy.
///
///
///
/// For host pointers, the starting address is
///
///
///
/// ```text
/// void* Start = (void*)((char*)srcHost+srcY*srcPitch + srcXInBytes);
/// ```
///
///
///
/// For device pointers, the starting address is
///
///
///
/// ```text
/// CUdeviceptr Start = srcDevice+srcY*srcPitch+srcXInBytes;
/// ```
///
///
///
/// For CUDA arrays, ::srcXInBytes must be evenly divisible by the array element size.
///
/// - ::dstXInBytes and ::dstY specify the base address of the destination data for the copy.
///
///
///
/// For host pointers, the base address is
///
///
///
/// ```text
/// void* dstStart = (void*)((char*)dstHost+dstY*dstPitch + dstXInBytes);
/// ```
///
///
///
/// For device pointers, the starting address is
///
///
///
/// ```text
/// CUdeviceptr dstStart = dstDevice+dstY*dstPitch+dstXInBytes;
/// ```
///
///
///
/// For CUDA arrays, ::dstXInBytes must be evenly divisible by the array element size.
///
/// - ::WidthInBytes and ::Height specify the width (in bytes) and height of the 2D copy being performed.
/// - If specified, ::srcPitch must be greater than or equal to ::WidthInBytes + ::srcXInBytes, and ::dstPitch must be greater than or equal to ::WidthInBytes + dstXInBytes.
///
///
///
/// ::cuMemcpy2D() returns an error if any pitch is greater than the maximum allowed (::CU_DEVICE_ATTRIBUTE_MAX_PITCH). ::cuMemAllocPitch() passes back pitches that always work with ::cuMemcpy2D(). On intra-device memory copies (device to device, CUDA array to device, CUDA array to CUDA array), ::cuMemcpy2D() may fail for pitches not computed by ::cuMemAllocPitch(). ::cuMemcpy2DUnaligned() does not have this restriction, but may run significantly slower in the cases where ::cuMemcpy2D() would have returned an error code.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _sync
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaMemcpy2D, ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray
///
/// # Parameters
///
/// - `pCopy`: - Parameters for the memory copy
pub fn cuMemcpy2D_v2(pCopy: *const CUDA_MEMCPY2D) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory for 2D arrays
///
/// Perform a 2D memory copy according to the parameters specified in `pCopy`. The ::CUDA_MEMCPY2D structure is defined as:
///
///
///
///
///
/// ```text
/// typedef struct CUDA_MEMCPY2D_st {
/// unsigned int srcXInBytes, srcY;
/// CUmemorytype srcMemoryType;
/// const void *srcHost;
/// CUdeviceptr srcDevice;
/// CUarray srcArray;
/// unsigned int srcPitch;
/// unsigned int dstXInBytes, dstY;
/// CUmemorytype dstMemoryType;
/// void *dstHost;
/// CUdeviceptr dstDevice;
/// CUarray dstArray;
/// unsigned int dstPitch;
/// unsigned int WidthInBytes;
/// unsigned int Height;
/// } CUDA_MEMCPY2D;
/// ```
///
/// where:
/// - ::srcMemoryType and ::dstMemoryType specify the type of memory of the source and destination, respectively; ::CUmemorytype_enum is defined as:
///
///
///
///
///
/// ```text
/// typedef enum CUmemorytype_enum {
/// CU_MEMORYTYPE_HOST = 0x01,
/// CU_MEMORYTYPE_DEVICE = 0x02,
/// CU_MEMORYTYPE_ARRAY = 0x03,
/// CU_MEMORYTYPE_UNIFIED = 0x04
/// } CUmemorytype;
/// ```
///
///
///
/// If ::srcMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::srcDevice and ::srcPitch specify the (unified virtual address space) base address of the source data and the bytes per row to apply. ::srcArray is ignored. This value may be used only if unified addressing is supported in the calling context.
///
///
///
/// If ::srcMemoryType is ::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.
///
///
///
/// If ::srcMemoryType is ::CU_MEMORYTYPE_DEVICE, ::srcDevice and ::srcPitch specify the (device) base address of the source data and the bytes per row to apply. ::srcArray is ignored.
///
///
///
/// If ::srcMemoryType is ::CU_MEMORYTYPE_ARRAY, ::srcArray specifies the handle of the source data. ::srcHost, ::srcDevice and ::srcPitch are ignored.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::dstDevice and ::dstPitch specify the (unified virtual address space) base address of the source data and the bytes per row to apply. ::dstArray is ignored. This value may be used only if unified addressing is supported in the calling context.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_HOST, ::dstHost and ::dstPitch specify the (host) base address of the destination data and the bytes per row to apply. ::dstArray is ignored.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_DEVICE, ::dstDevice and ::dstPitch specify the (device) base address of the destination data and the bytes per row to apply. ::dstArray is ignored.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_ARRAY, ::dstArray specifies the handle of the destination data. ::dstHost, ::dstDevice and ::dstPitch are ignored.
///
/// - ::srcXInBytes and ::srcY specify the base address of the source data for the copy.
///
///
///
/// For host pointers, the starting address is
///
///
///
/// ```text
/// void* Start = (void*)((char*)srcHost+srcY*srcPitch + srcXInBytes);
/// ```
///
///
///
/// For device pointers, the starting address is
///
///
///
/// ```text
/// CUdeviceptr Start = srcDevice+srcY*srcPitch+srcXInBytes;
/// ```
///
///
///
/// For CUDA arrays, ::srcXInBytes must be evenly divisible by the array element size.
///
/// - ::dstXInBytes and ::dstY specify the base address of the destination data for the copy.
///
///
///
/// For host pointers, the base address is
///
///
///
/// ```text
/// void* dstStart = (void*)((char*)dstHost+dstY*dstPitch + dstXInBytes);
/// ```
///
///
///
/// For device pointers, the starting address is
///
///
///
/// ```text
/// CUdeviceptr dstStart = dstDevice+dstY*dstPitch+dstXInBytes;
/// ```
///
///
///
/// For CUDA arrays, ::dstXInBytes must be evenly divisible by the array element size.
///
/// - ::WidthInBytes and ::Height specify the width (in bytes) and height of the 2D copy being performed.
/// - If specified, ::srcPitch must be greater than or equal to ::WidthInBytes + ::srcXInBytes, and ::dstPitch must be greater than or equal to ::WidthInBytes + dstXInBytes.
///
///
///
/// ::cuMemcpy2D() returns an error if any pitch is greater than the maximum allowed (::CU_DEVICE_ATTRIBUTE_MAX_PITCH). ::cuMemAllocPitch() passes back pitches that always work with ::cuMemcpy2D(). On intra-device memory copies (device to device, CUDA array to device, CUDA array to CUDA array), ::cuMemcpy2D() may fail for pitches not computed by ::cuMemAllocPitch(). ::cuMemcpy2DUnaligned() does not have this restriction, but may run significantly slower in the cases where ::cuMemcpy2D() would have returned an error code.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _sync
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaMemcpy2D, ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray
///
/// # Parameters
///
/// - `pCopy`: - Parameters for the memory copy
pub fn cuMemcpy2DUnaligned_v2(pCopy: *const CUDA_MEMCPY2D) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory for 3D arrays
///
/// Perform a 3D memory copy according to the parameters specified in `pCopy`. The ::CUDA_MEMCPY3D structure is defined as:
///
///
///
///
///
/// ```text
/// typedef struct CUDA_MEMCPY3D_st {
///
/// unsigned int srcXInBytes, srcY, srcZ;
/// unsigned int srcLOD;
/// CUmemorytype srcMemoryType;
/// const void *srcHost;
/// CUdeviceptr srcDevice;
/// CUarray srcArray;
/// unsigned int srcPitch; // ignored when src is array
/// unsigned int srcHeight; // ignored when src is array; may be 0 if Depth==1
///
/// unsigned int dstXInBytes, dstY, dstZ;
/// unsigned int dstLOD;
/// CUmemorytype dstMemoryType;
/// void *dstHost;
/// CUdeviceptr dstDevice;
/// CUarray dstArray;
/// unsigned int dstPitch; // ignored when dst is array
/// unsigned int dstHeight; // ignored when dst is array; may be 0 if Depth==1
///
/// unsigned int WidthInBytes;
/// unsigned int Height;
/// unsigned int Depth;
/// } CUDA_MEMCPY3D;
/// ```
///
/// where:
/// - ::srcMemoryType and ::dstMemoryType specify the type of memory of the source and destination, respectively; ::CUmemorytype_enum is defined as:
///
///
///
///
///
/// ```text
/// typedef enum CUmemorytype_enum {
/// CU_MEMORYTYPE_HOST = 0x01,
/// CU_MEMORYTYPE_DEVICE = 0x02,
/// CU_MEMORYTYPE_ARRAY = 0x03,
/// CU_MEMORYTYPE_UNIFIED = 0x04
/// } CUmemorytype;
/// ```
///
///
///
/// If ::srcMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::srcDevice and ::srcPitch specify the (unified virtual address space) base address of the source data and the bytes per row to apply. ::srcArray is ignored. This value may be used only if unified addressing is supported in the calling context.
///
///
///
/// If ::srcMemoryType is ::CU_MEMORYTYPE_HOST, ::srcHost, ::srcPitch and ::srcHeight specify the (host) base address of the source data, the bytes per row, and the height of each 2D slice of the 3D array. ::srcArray is ignored.
///
///
///
/// If ::srcMemoryType is ::CU_MEMORYTYPE_DEVICE, ::srcDevice, ::srcPitch and ::srcHeight specify the (device) base address of the source data, the bytes per row, and the height of each 2D slice of the 3D array. ::srcArray is ignored.
///
///
///
/// If ::srcMemoryType is ::CU_MEMORYTYPE_ARRAY, ::srcArray specifies the handle of the source data. ::srcHost, ::srcDevice, ::srcPitch and ::srcHeight are ignored.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::dstDevice and ::dstPitch specify the (unified virtual address space) base address of the source data and the bytes per row to apply. ::dstArray is ignored. This value may be used only if unified addressing is supported in the calling context.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_HOST, ::dstHost and ::dstPitch specify the (host) base address of the destination data, the bytes per row, and the height of each 2D slice of the 3D array. ::dstArray is ignored.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_DEVICE, ::dstDevice and ::dstPitch specify the (device) base address of the destination data, the bytes per row, and the height of each 2D slice of the 3D array. ::dstArray is ignored.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_ARRAY, ::dstArray specifies the handle of the destination data. ::dstHost, ::dstDevice, ::dstPitch and ::dstHeight are ignored.
///
/// - ::srcXInBytes, ::srcY and ::srcZ specify the base address of the source data for the copy.
///
///
///
/// For host pointers, the starting address is
///
///
///
/// ```text
/// void* Start = (void*)((char*)srcHost+(srcZ*srcHeight+srcY)*srcPitch + srcXInBytes);
/// ```
///
///
///
/// For device pointers, the starting address is
///
///
///
/// ```text
/// CUdeviceptr Start = srcDevice+(srcZ*srcHeight+srcY)*srcPitch+srcXInBytes;
/// ```
///
///
///
/// For CUDA arrays, ::srcXInBytes must be evenly divisible by the array element size.
///
/// - dstXInBytes, ::dstY and ::dstZ specify the base address of the destination data for the copy.
///
///
///
/// For host pointers, the base address is
///
///
///
/// ```text
/// void* dstStart = (void*)((char*)dstHost+(dstZ*dstHeight+dstY)*dstPitch + dstXInBytes);
/// ```
///
///
///
/// For device pointers, the starting address is
///
///
///
/// ```text
/// CUdeviceptr dstStart = dstDevice+(dstZ*dstHeight+dstY)*dstPitch+dstXInBytes;
/// ```
///
///
///
/// For CUDA arrays, ::dstXInBytes must be evenly divisible by the array element size.
///
/// - ::WidthInBytes, ::Height and ::Depth specify the width (in bytes), height and depth of the 3D copy being performed.
/// - If specified, ::srcPitch must be greater than or equal to ::WidthInBytes + ::srcXInBytes, and ::dstPitch must be greater than or equal to ::WidthInBytes + dstXInBytes.
/// - If specified, ::srcHeight must be greater than or equal to ::Height + ::srcY, and ::dstHeight must be greater than or equal to ::Height + ::dstY.
///
///
///
/// ::cuMemcpy3D() returns an error if any pitch is greater than the maximum allowed (::CU_DEVICE_ATTRIBUTE_MAX_PITCH).
///
/// The ::srcLOD and ::dstLOD members of the ::CUDA_MEMCPY3D structure must be set to 0.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _sync
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaMemcpy3D
///
/// # Parameters
///
/// - `pCopy`: - Parameters for the memory copy
pub fn cuMemcpy3D_v2(pCopy: *const CUDA_MEMCPY3D) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory between contexts.
///
/// 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.
///
/// # Parameters
///
/// - `pCopy`: - Parameters for the memory copy
pub fn cuMemcpy3DPeer(pCopy: *const CUDA_MEMCPY3D_PEER) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory asynchronously.
///
/// 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, device to device, or device to host) from the pointer values. This function is only allowed in contexts which support unified addressing.
///
/// # Parameters
///
/// - `dst`: Destination unified virtual address space pointer.
/// - `src`: Source unified virtual address space pointer.
/// - `ByteCount`: Size of memory copy in bytes.
/// - `hStream`: Stream identifier.
pub fn cuMemcpyAsync(
dst: CUdeviceptr,
src: CUdeviceptr,
ByteCount: size_t,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies device memory between two contexts asynchronously.
///
/// 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.
///
/// # Parameters
///
/// - `dstDevice`: Destination device pointer.
/// - `dstContext`: Destination context.
/// - `srcDevice`: Source device pointer.
/// - `srcContext`: Source context.
/// - `ByteCount`: Size of memory copy in bytes.
/// - `hStream`: Stream identifier.
pub fn cuMemcpyPeerAsync(
dstDevice: CUdeviceptr,
dstContext: CUcontext,
srcDevice: CUdeviceptr,
srcContext: CUcontext,
ByteCount: size_t,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory from Host to Device
///
/// 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.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_HANDLE
///
/// Note: _async
///
/// Note: _null_stream
///
/// Note: _memcpy
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, ::cuMemsetD32, ::cuMemsetD32Async, ::cudaMemcpyAsync, ::cudaMemcpyToSymbolAsync
///
/// # Parameters
///
/// - `dstDevice`: - Destination device pointer
/// - `srcHost`: - Source host pointer
/// - `ByteCount`: - Size of memory copy in bytes
/// - `hStream`: - Stream identifier
pub fn cuMemcpyHtoDAsync_v2(
dstDevice: CUdeviceptr,
srcHost: *const ::core::ffi::c_void,
ByteCount: size_t,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory from Device to Host
///
/// 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.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_HANDLE
///
/// Note: _async
///
/// Note: _null_stream
///
/// Note: _memcpy
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, ::cuMemsetD32, ::cuMemsetD32Async, ::cudaMemcpyAsync, ::cudaMemcpyFromSymbolAsync
///
/// # Parameters
///
/// - `dstHost`: - Destination host pointer
/// - `srcDevice`: - Source device pointer
/// - `ByteCount`: - Size of memory copy in bytes
/// - `hStream`: - Stream identifier
pub fn cuMemcpyDtoHAsync_v2(
dstHost: *mut ::core::ffi::c_void,
srcDevice: CUdeviceptr,
ByteCount: size_t,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory from Device to Device
///
/// 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.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_HANDLE
///
/// Note: _async
///
/// Note: _null_stream
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, ::cuMemsetD32, ::cuMemsetD32Async, ::cudaMemcpyAsync, ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync
///
/// # Parameters
///
/// - `dstDevice`: - Destination device pointer
/// - `srcDevice`: - Source device pointer
/// - `ByteCount`: - Size of memory copy in bytes
/// - `hStream`: - Stream identifier
pub fn cuMemcpyDtoDAsync_v2(
dstDevice: CUdeviceptr,
srcDevice: CUdeviceptr,
ByteCount: size_t,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory from Host to Array
///
/// 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.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_HANDLE
///
/// Note: _async
///
/// Note: _null_stream
///
/// Note: _memcpy
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, ::cuMemsetD32, ::cuMemsetD32Async, ::cudaMemcpyToArrayAsync
///
/// # Parameters
///
/// - `dstArray`: - Destination array
/// - `dstOffset`: - Offset in bytes of destination array
/// - `srcHost`: - Source host pointer
/// - `ByteCount`: - Size of memory copy in bytes
/// - `hStream`: - Stream identifier
pub fn cuMemcpyHtoAAsync_v2(
dstArray: CUarray,
dstOffset: size_t,
srcHost: *const ::core::ffi::c_void,
ByteCount: size_t,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory from Array to Host
///
/// 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.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_HANDLE
///
/// Note: _async
///
/// Note: _null_stream
///
/// Note: _memcpy
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, ::cuMemsetD32, ::cuMemsetD32Async, ::cudaMemcpyFromArrayAsync
///
/// # Parameters
///
/// - `dstHost`: - Destination pointer
/// - `srcArray`: - Source array
/// - `srcOffset`: - Offset in bytes of source array
/// - `ByteCount`: - Size of memory copy in bytes
/// - `hStream`: - Stream identifier
pub fn cuMemcpyAtoHAsync_v2(
dstHost: *mut ::core::ffi::c_void,
srcArray: CUarray,
srcOffset: size_t,
ByteCount: size_t,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory for 2D arrays
///
/// Perform a 2D memory copy according to the parameters specified in `pCopy`. The ::CUDA_MEMCPY2D structure is defined as:
///
///
///
///
///
/// ```text
/// typedef struct CUDA_MEMCPY2D_st {
/// unsigned int srcXInBytes, srcY;
/// CUmemorytype srcMemoryType;
/// const void *srcHost;
/// CUdeviceptr srcDevice;
/// CUarray srcArray;
/// unsigned int srcPitch;
/// unsigned int dstXInBytes, dstY;
/// CUmemorytype dstMemoryType;
/// void *dstHost;
/// CUdeviceptr dstDevice;
/// CUarray dstArray;
/// unsigned int dstPitch;
/// unsigned int WidthInBytes;
/// unsigned int Height;
/// } CUDA_MEMCPY2D;
/// ```
///
/// where:
/// - ::srcMemoryType and ::dstMemoryType specify the type of memory of the source and destination, respectively; ::CUmemorytype_enum is defined as:
///
///
///
///
///
/// ```text
/// typedef enum CUmemorytype_enum {
/// CU_MEMORYTYPE_HOST = 0x01,
/// CU_MEMORYTYPE_DEVICE = 0x02,
/// CU_MEMORYTYPE_ARRAY = 0x03,
/// CU_MEMORYTYPE_UNIFIED = 0x04
/// } CUmemorytype;
/// ```
///
///
///
/// If ::srcMemoryType is ::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.
///
///
///
/// If ::srcMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::srcDevice and ::srcPitch specify the (unified virtual address space) base address of the source data and the bytes per row to apply. ::srcArray is ignored. This value may be used only if unified addressing is supported in the calling context.
///
///
///
/// If ::srcMemoryType is ::CU_MEMORYTYPE_DEVICE, ::srcDevice and ::srcPitch specify the (device) base address of the source data and the bytes per row to apply. ::srcArray is ignored.
///
///
///
/// If ::srcMemoryType is ::CU_MEMORYTYPE_ARRAY, ::srcArray specifies the handle of the source data. ::srcHost, ::srcDevice and ::srcPitch are ignored.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::dstDevice and ::dstPitch specify the (unified virtual address space) base address of the source data and the bytes per row to apply. ::dstArray is ignored. This value may be used only if unified addressing is supported in the calling context.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_HOST, ::dstHost and ::dstPitch specify the (host) base address of the destination data and the bytes per row to apply. ::dstArray is ignored.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_DEVICE, ::dstDevice and ::dstPitch specify the (device) base address of the destination data and the bytes per row to apply. ::dstArray is ignored.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_ARRAY, ::dstArray specifies the handle of the destination data. ::dstHost, ::dstDevice and ::dstPitch are ignored.
///
/// - ::srcXInBytes and ::srcY specify the base address of the source data for the copy.
///
///
///
/// For host pointers, the starting address is
///
///
///
/// ```text
/// void* Start = (void*)((char*)srcHost+srcY*srcPitch + srcXInBytes);
/// ```
///
///
///
/// For device pointers, the starting address is
///
///
///
/// ```text
/// CUdeviceptr Start = srcDevice+srcY*srcPitch+srcXInBytes;
/// ```
///
///
///
/// For CUDA arrays, ::srcXInBytes must be evenly divisible by the array element size.
///
/// - ::dstXInBytes and ::dstY specify the base address of the destination data for the copy.
///
///
///
/// For host pointers, the base address is
///
///
///
/// ```text
/// void* dstStart = (void*)((char*)dstHost+dstY*dstPitch + dstXInBytes);
/// ```
///
///
///
/// For device pointers, the starting address is
///
///
///
/// ```text
/// CUdeviceptr dstStart = dstDevice+dstY*dstPitch+dstXInBytes;
/// ```
///
///
///
/// For CUDA arrays, ::dstXInBytes must be evenly divisible by the array element size.
///
/// - ::WidthInBytes and ::Height specify the width (in bytes) and height of the 2D copy being performed.
/// - If specified, ::srcPitch must be greater than or equal to ::WidthInBytes + ::srcXInBytes, and ::dstPitch must be greater than or equal to ::WidthInBytes + dstXInBytes.
/// - If specified, ::srcPitch must be greater than or equal to ::WidthInBytes + ::srcXInBytes, and ::dstPitch must be greater than or equal to ::WidthInBytes + dstXInBytes.
/// - If specified, ::srcHeight must be greater than or equal to ::Height + ::srcY, and ::dstHeight must be greater than or equal to ::Height + ::dstY.
///
///
///
/// ::cuMemcpy2DAsync() returns an error if any pitch is greater than the maximum allowed (::CU_DEVICE_ATTRIBUTE_MAX_PITCH). ::cuMemAllocPitch() passes back pitches that always work with ::cuMemcpy2D(). On intra-device memory copies (device to device, CUDA array to device, CUDA array to CUDA array), ::cuMemcpy2DAsync() may fail for pitches not computed by ::cuMemAllocPitch().
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_HANDLE
///
/// Note: _async
///
/// Note: _null_stream
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, ::cuMemsetD32, ::cuMemsetD32Async, ::cudaMemcpy2DAsync, ::cudaMemcpy2DToArrayAsync, ::cudaMemcpy2DFromArrayAsync
///
/// # Parameters
///
/// - `pCopy`: - Parameters for the memory copy
/// - `hStream`: - Stream identifier
pub fn cuMemcpy2DAsync_v2(
pCopy: *const CUDA_MEMCPY2D,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory for 3D arrays
///
/// Perform a 3D memory copy according to the parameters specified in `pCopy`. The ::CUDA_MEMCPY3D structure is defined as:
///
///
///
///
///
/// ```text
/// typedef struct CUDA_MEMCPY3D_st {
///
/// unsigned int srcXInBytes, srcY, srcZ;
/// unsigned int srcLOD;
/// CUmemorytype srcMemoryType;
/// const void *srcHost;
/// CUdeviceptr srcDevice;
/// CUarray srcArray;
/// unsigned int srcPitch; // ignored when src is array
/// unsigned int srcHeight; // ignored when src is array; may be 0 if Depth==1
///
/// unsigned int dstXInBytes, dstY, dstZ;
/// unsigned int dstLOD;
/// CUmemorytype dstMemoryType;
/// void *dstHost;
/// CUdeviceptr dstDevice;
/// CUarray dstArray;
/// unsigned int dstPitch; // ignored when dst is array
/// unsigned int dstHeight; // ignored when dst is array; may be 0 if Depth==1
///
/// unsigned int WidthInBytes;
/// unsigned int Height;
/// unsigned int Depth;
/// } CUDA_MEMCPY3D;
/// ```
///
/// where:
/// - ::srcMemoryType and ::dstMemoryType specify the type of memory of the source and destination, respectively; ::CUmemorytype_enum is defined as:
///
///
///
///
///
/// ```text
/// typedef enum CUmemorytype_enum {
/// CU_MEMORYTYPE_HOST = 0x01,
/// CU_MEMORYTYPE_DEVICE = 0x02,
/// CU_MEMORYTYPE_ARRAY = 0x03,
/// CU_MEMORYTYPE_UNIFIED = 0x04
/// } CUmemorytype;
/// ```
///
///
///
/// If ::srcMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::srcDevice and ::srcPitch specify the (unified virtual address space) base address of the source data and the bytes per row to apply. ::srcArray is ignored. This value may be used only if unified addressing is supported in the calling context.
///
///
///
/// If ::srcMemoryType is ::CU_MEMORYTYPE_HOST, ::srcHost, ::srcPitch and ::srcHeight specify the (host) base address of the source data, the bytes per row, and the height of each 2D slice of the 3D array. ::srcArray is ignored.
///
///
///
/// If ::srcMemoryType is ::CU_MEMORYTYPE_DEVICE, ::srcDevice, ::srcPitch and ::srcHeight specify the (device) base address of the source data, the bytes per row, and the height of each 2D slice of the 3D array. ::srcArray is ignored.
///
///
///
/// If ::srcMemoryType is ::CU_MEMORYTYPE_ARRAY, ::srcArray specifies the handle of the source data. ::srcHost, ::srcDevice, ::srcPitch and ::srcHeight are ignored.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::dstDevice and ::dstPitch specify the (unified virtual address space) base address of the source data and the bytes per row to apply. ::dstArray is ignored. This value may be used only if unified addressing is supported in the calling context.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_HOST, ::dstHost and ::dstPitch specify the (host) base address of the destination data, the bytes per row, and the height of each 2D slice of the 3D array. ::dstArray is ignored.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_DEVICE, ::dstDevice and ::dstPitch specify the (device) base address of the destination data, the bytes per row, and the height of each 2D slice of the 3D array. ::dstArray is ignored.
///
///
///
/// If ::dstMemoryType is ::CU_MEMORYTYPE_ARRAY, ::dstArray specifies the handle of the destination data. ::dstHost, ::dstDevice, ::dstPitch and ::dstHeight are ignored.
///
/// - ::srcXInBytes, ::srcY and ::srcZ specify the base address of the source data for the copy.
///
///
///
/// For host pointers, the starting address is
///
///
///
/// ```text
/// void* Start = (void*)((char*)srcHost+(srcZ*srcHeight+srcY)*srcPitch + srcXInBytes);
/// ```
///
///
///
/// For device pointers, the starting address is
///
///
///
/// ```text
/// CUdeviceptr Start = srcDevice+(srcZ*srcHeight+srcY)*srcPitch+srcXInBytes;
/// ```
///
///
///
/// For CUDA arrays, ::srcXInBytes must be evenly divisible by the array element size.
///
/// - dstXInBytes, ::dstY and ::dstZ specify the base address of the destination data for the copy.
///
///
///
/// For host pointers, the base address is
///
///
///
/// ```text
/// void* dstStart = (void*)((char*)dstHost+(dstZ*dstHeight+dstY)*dstPitch + dstXInBytes);
/// ```
///
///
///
/// For device pointers, the starting address is
///
///
///
/// ```text
/// CUdeviceptr dstStart = dstDevice+(dstZ*dstHeight+dstY)*dstPitch+dstXInBytes;
/// ```
///
///
///
/// For CUDA arrays, ::dstXInBytes must be evenly divisible by the array element size.
///
/// - ::WidthInBytes, ::Height and ::Depth specify the width (in bytes), height and depth of the 3D copy being performed.
/// - If specified, ::srcPitch must be greater than or equal to ::WidthInBytes + ::srcXInBytes, and ::dstPitch must be greater than or equal to ::WidthInBytes + dstXInBytes.
/// - If specified, ::srcHeight must be greater than or equal to ::Height + ::srcY, and ::dstHeight must be greater than or equal to ::Height + ::dstY.
///
///
///
/// ::cuMemcpy3DAsync() returns an error if any pitch is greater than the maximum allowed (::CU_DEVICE_ATTRIBUTE_MAX_PITCH).
///
/// The ::srcLOD and ::dstLOD members of the ::CUDA_MEMCPY3D structure must be set to 0.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_HANDLE
///
/// Note: _async
///
/// Note: _null_stream
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, ::cuMemsetD32, ::cuMemsetD32Async, ::cudaMemcpy3DAsync
///
/// # Parameters
///
/// - `pCopy`: - Parameters for the memory copy
/// - `hStream`: - Stream identifier
pub fn cuMemcpy3DAsync_v2(
pCopy: *const CUDA_MEMCPY3D,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies memory between contexts asynchronously.
///
/// 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.
///
/// # Parameters
///
/// - `pCopy`: Parameters for the memory copy.
/// - `hStream`: Stream identifier.
pub fn cuMemcpy3DPeerAsync(
pCopy: *const CUDA_MEMCPY3D_PEER,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Performs a batch of memory copies asynchronously.
///
/// Performs a batch of memory copies. The batch as a whole executes in stream order but copies within a batch are not guaranteed to execute in any specific order. This API only supports pointer-to-pointer copies. For copies involving CUDA arrays, please see ::cuMemcpy3DBatchAsync.
///
/// 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 in undefined behavior.
///
/// 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 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`.
///
/// The ::CUmemcpyAttributes::srcAccessOrder indicates the source access ordering to be observed for copies associated with the attribute. If the source access order is set to ::CU_MEMCPY_SRC_ACCESS_ORDER_STREAM, then the source will be accessed in stream order. If the source access order is set to ::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 API call returns. This flag is suited for ephemeral sources (ex., stack variables) when it's known that no prior operations in the stream can be accessing the memory and also that the lifetime of the memory is limited to the scope that the source variable was declared in. Specifying this flag allows the driver to optimize the copy and removes the need for the user to synchronize the stream after the API call. If the source access order is set to ::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 API call returns. This flag is suited for host pointers allocated outside CUDA (ex., via malloc) when it's known that no prior operations in the stream can be accessing the memory. Specifying this flag allows the driver to optimize the copy on certain platforms. Each memcpy operation in the batch must have a valid ::CUmemcpyAttributes corresponding to it including the appropriate srcAccessOrder setting, otherwise the API will return ::CUDA_ERROR_INVALID_VALUE.
///
/// The ::CUmemcpyAttributes::srcLocHint and ::CUmemcpyAttributes::dstLocHint allows applications to specify hint locations for operands of a copy when the operand doesn't have a fixed location. That is, these hints are only applicable for managed memory pointers on devices where ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS is true or system-allocated pageable memory on devices where ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS is true. For other cases, these hints are ignored.
///
/// The ::CUmemcpyAttributes::flags field can be used to specify certain flags for copies. Setting the ::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 and can be ignored depending on the platform and other parameters of the copy.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _async
///
/// Note: _memcpy
///
/// # Parameters
///
/// - `dsts`: - Array of destination pointers.
/// - `srcs`: - Array of memcpy source pointers.
/// - `sizes`: - Array of sizes for memcpy operations.
/// - `count`: - Size of `dsts`, `srcs` and `sizes` arrays
/// - `attrs`: - Array of memcpy attributes.
/// - `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\] - 1. Also attrs\[numAttrs-1\] will apply to copies starting from attrsIdxs\[numAttrs-1\] through count - 1.
/// - `numAttrs`: - Size of `attrs` and `attrsIdxs` arrays.
/// - `hStream`: - The stream to enqueue the operations in. Must not be legacy NULL stream.
pub fn cuMemcpyBatchAsync_v2(
dsts: *mut CUdeviceptr,
srcs: *mut CUdeviceptr,
sizes: *mut size_t,
count: size_t,
attrs: *mut CUmemcpyAttributes,
attrsIdxs: *mut size_t,
numAttrs: size_t,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Performs a batch of 3D memory copies asynchronously.
///
/// Performs a batch of memory copies. The batch as a whole executes in stream order but copies within a batch are not guaranteed to execute in any specific order. Note that this means specifying any dependent copies within a batch will result in undefined behavior.
///
/// 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 for the copy as specified in ::CUDA_MEMCPY3D_BATCH_OP::src and ::CUDA_MEMCPY3D_BATCH_OP::dst respectively. The source and destination 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. The width, height and depth of a copy are specified in elements and must not be zero. For pointer-to-pointer copies, the element size is considered to be 1. For pointer to CUDA array or vice versa copies, the element size is determined by the CUDA array. For CUDA array to CUDA array copies, the element size of the two CUDA arrays must match.
///
/// For a given operand, if ::CUmemcpy3DOperand::type is specified as ::CU_MEMCPY_OPERAND_TYPE_POINTER, then ::CUmemcpy3DOperand::op::ptr will be used. The ::CUmemcpy3DOperand::op::ptr::ptr field must contain the pointer where the copy should begin. The ::CUmemcpy3DOperand::op::ptr::rowLength field specifies the length of each row in elements and must either 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 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 in ::CUDA_MEMCPY3D_BATCH_OP::extent::height. When either of these values is zero, that aspect of the operand is considered to be tightly packed according to the copy extent. For managed memory pointers on devices where ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS is true or system-allocated pageable memory on devices where ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS is true, the ::CUmemcpy3DOperand::op::ptr::locHint field can be used to hint the location of the operand.
///
/// If an operand's type is specified as ::CU_MEMCPY_OPERAND_TYPE_ARRAY, then ::CUmemcpy3DOperand::op::array will be used. The ::CUmemcpy3DOperand::op::array::array field specifies the CUDA array and ::CUmemcpy3DOperand::op::array::offset specifies the 3D offset into that array where the copy begins.
///
/// The ::CUmemcpyAttributes::srcAccessOrder indicates the source access ordering to be observed for copies associated with the attribute. If the source access order is set to ::CU_MEMCPY_SRC_ACCESS_ORDER_STREAM, then the source will be accessed in stream order. If the source access order is set to ::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 API call returns. This flag is suited for ephemeral sources (ex., stack variables) when it's known that no prior operations in the stream can be accessing the memory and also that the lifetime of the memory is limited to the scope that the source variable was declared in. Specifying this flag allows the driver to optimize the copy and removes the need for the user to synchronize the stream after the API call. If the source access order is set to ::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 API call returns. This flag is suited for host pointers allocated outside CUDA (ex., via malloc) when it's known that no prior operations in the stream can be accessing the memory. Specifying this flag allows the driver to optimize the copy on certain platforms. Each memcopy operation in `opList` must have a valid srcAccessOrder setting, otherwise this API will return ::CUDA_ERROR_INVALID_VALUE.
///
/// The ::CUmemcpyAttributes::flags field can be used to specify certain flags for copies. Setting the ::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 and can be ignored depending on the platform and other parameters of the copy.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _async
///
/// Note: _memcpy
///
/// # Parameters
///
/// - `numOps`: - Total number of memcpy operations.
/// - `opList`: - Array of size `numOps` containing the actual memcpy operations.
/// - `flags`: - Flags for future use, must be zero now.
/// - `hStream`: - The stream to enqueue the operations in. Must not be default NULL stream.
pub fn cuMemcpy3DBatchAsync_v2(
numOps: size_t,
opList: *mut CUDA_MEMCPY3D_BATCH_OP,
flags: ::core::ffi::c_ulonglong,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Performs asynchronous memory copy operation with the specified attributes.
///
/// 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.
///
/// For more information regarding the attributes, please refer to CUmemcpyAttributes and it’s usage desciption in::cuMemcpyBatchAsync.
///
/// # Parameters
///
/// - `dst`: Destination device pointer.
/// - `src`: Source device pointer.
/// - `size`: Number of bytes to copy.
/// - `attr`: Attributes for the copy.
/// - `hStream`: Stream to enqueue the operation in.
pub fn cuMemcpyWithAttributesAsync(
dst: CUdeviceptr,
src: CUdeviceptr,
size: size_t,
attr: *mut CUmemcpyAttributes,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Performs 3D memory copy with attributes asynchronously.
///
/// Performs the copy operation specified in `op`. `flags` specifies the flags for the copy and `hStream` specifies the stream to enqueue the operation in.
///
/// For more information regarding the operation, please refer to CUDA_MEMCPY3D_BATCH_OP and it’s usage desciption in::cuMemcpy3DBatchAsync.
///
/// # Parameters
///
/// - `op`: Operation to perform.
/// - `flags`: Flags for the copy, must be zero now.
/// - `hStream`: Stream to enqueue the operation in.
pub fn cuMemcpy3DWithAttributesAsync(
op: *mut CUDA_MEMCPY3D_BATCH_OP,
flags: ::core::ffi::c_ulonglong,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Initializes device memory
///
/// Sets the memory range of `N` 8-bit values to the specified value `uc`.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _memset
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, ::cuMemsetD32, ::cuMemsetD32Async, ::cudaMemset
///
/// # Parameters
///
/// - `dstDevice`: - Destination device pointer
/// - `uc`: - Value to set
/// - `N`: - Number of elements
pub fn cuMemsetD8_v2(
dstDevice: CUdeviceptr,
uc: ::core::ffi::c_uchar,
N: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Initializes device memory
///
/// Sets the memory range of `N` 16-bit values to the specified value `us`. The `dstDevice` pointer must be two byte aligned.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _memset
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16Async, ::cuMemsetD32, ::cuMemsetD32Async, ::cudaMemset
///
/// # Parameters
///
/// - `dstDevice`: - Destination device pointer
/// - `us`: - Value to set
/// - `N`: - Number of elements
pub fn cuMemsetD16_v2(
dstDevice: CUdeviceptr,
us: ::core::ffi::c_ushort,
N: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Initializes device memory
///
/// Sets the memory range of `N` 32-bit values to the specified value `ui`. The `dstDevice` pointer must be four byte aligned.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _memset
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, ::cuMemsetD32Async, ::cudaMemset
///
/// # Parameters
///
/// - `dstDevice`: - Destination device pointer
/// - `ui`: - Value to set
/// - `N`: - Number of elements
pub fn cuMemsetD32_v2(
dstDevice: CUdeviceptr,
ui: ::core::ffi::c_uint,
N: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Initializes device memory
///
/// 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 back by ::cuMemAllocPitch().
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _memset
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8Async, ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, ::cuMemsetD32, ::cuMemsetD32Async, ::cudaMemset2D
///
/// # Parameters
///
/// - `dstDevice`: - Destination device pointer
/// - `dstPitch`: - Pitch of destination device pointer(Unused if `Height` is 1)
/// - `uc`: - Value to set
/// - `Width`: - Width of row
/// - `Height`: - Number of rows
pub fn cuMemsetD2D8_v2(
dstDevice: CUdeviceptr,
dstPitch: size_t,
uc: ::core::ffi::c_uchar,
Width: size_t,
Height: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Initializes device memory
///
/// 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().
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _memset
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, ::cuMemsetD32, ::cuMemsetD32Async, ::cudaMemset2D
///
/// # Parameters
///
/// - `dstDevice`: - Destination device pointer
/// - `dstPitch`: - Pitch of destination device pointer(Unused if `Height` is 1)
/// - `us`: - Value to set
/// - `Width`: - Width of row
/// - `Height`: - Number of rows
pub fn cuMemsetD2D16_v2(
dstDevice: CUdeviceptr,
dstPitch: size_t,
us: ::core::ffi::c_ushort,
Width: size_t,
Height: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Initializes device memory
///
/// 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().
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _memset
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32Async, ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, ::cuMemsetD32, ::cuMemsetD32Async, ::cudaMemset2D
///
/// # Parameters
///
/// - `dstDevice`: - Destination device pointer
/// - `dstPitch`: - Pitch of destination device pointer(Unused if `Height` is 1)
/// - `ui`: - Value to set
/// - `Width`: - Width of row
/// - `Height`: - Number of rows
pub fn cuMemsetD2D32_v2(
dstDevice: CUdeviceptr,
dstPitch: size_t,
ui: ::core::ffi::c_uint,
Width: size_t,
Height: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets device memory.
///
/// Sets the memory range of `N` 8-bit values to the specified value `uc`.
///
/// # Parameters
///
/// - `dstDevice`: Destination device pointer.
/// - `uc`: Value to set.
/// - `N`: Number of elements.
/// - `hStream`: Stream identifier.
pub fn cuMemsetD8Async(
dstDevice: CUdeviceptr,
uc: ::core::ffi::c_uchar,
N: size_t,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets device memory.
///
/// Sets the memory range of `N` 16-bit values to the specified value `us`. The `dstDevice` pointer must be two byte aligned.
///
/// # Parameters
///
/// - `dstDevice`: Destination device pointer.
/// - `us`: Value to set.
/// - `N`: Number of elements.
/// - `hStream`: Stream identifier.
pub fn cuMemsetD16Async(
dstDevice: CUdeviceptr,
us: ::core::ffi::c_ushort,
N: size_t,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets device memory.
///
/// Sets the memory range of `N` 32-bit values to the specified value `ui`. The `dstDevice` pointer must be four byte aligned.
///
/// # Parameters
///
/// - `dstDevice`: Destination device pointer.
/// - `ui`: Value to set.
/// - `N`: Number of elements.
/// - `hStream`: Stream identifier.
pub fn cuMemsetD32Async(
dstDevice: CUdeviceptr,
ui: ::core::ffi::c_uint,
N: size_t,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets device memory.
///
/// 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 back by cuMemAllocPitch().
///
/// # Parameters
///
/// - `dstDevice`: Destination device pointer.
/// - `dstPitch`: Pitch of destination device pointer(Unused if `Height` is 1).
/// - `uc`: Value to set.
/// - `Width`: Width of row.
/// - `Height`: Number of rows.
/// - `hStream`: Stream identifier.
pub fn cuMemsetD2D8Async(
dstDevice: CUdeviceptr,
dstPitch: size_t,
uc: ::core::ffi::c_uchar,
Width: size_t,
Height: size_t,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets device memory.
///
/// 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().
///
/// # Parameters
///
/// - `dstDevice`: Destination device pointer.
/// - `dstPitch`: Pitch of destination device pointer(Unused if `Height` is 1).
/// - `us`: Value to set.
/// - `Width`: Width of row.
/// - `Height`: Number of rows.
/// - `hStream`: Stream identifier.
pub fn cuMemsetD2D16Async(
dstDevice: CUdeviceptr,
dstPitch: size_t,
us: ::core::ffi::c_ushort,
Width: size_t,
Height: size_t,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets device memory.
///
/// 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().
///
/// # Parameters
///
/// - `dstDevice`: Destination device pointer.
/// - `dstPitch`: Pitch of destination device pointer(Unused if `Height` is 1).
/// - `ui`: Value to set.
/// - `Width`: Width of row.
/// - `Height`: Number of rows.
/// - `hStream`: Stream identifier.
pub fn cuMemsetD2D32Async(
dstDevice: CUdeviceptr,
dstPitch: size_t,
ui: ::core::ffi::c_uint,
Width: size_t,
Height: size_t,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates a 1D or 2D CUDA array
///
/// 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:
///
///
///
///
///
/// ```text
/// typedef struct {
/// unsigned int Width;
/// unsigned int Height;
/// CUarray_format Format;
/// unsigned int NumChannels;
/// } CUDA_ARRAY_DESCRIPTOR;
/// ```
///
/// where:
///
/// - `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 otherwise;
/// - ::Format specifies the format of the elements; ::CUarray_format is defined as:
///
///
///
/// ```text
/// typedef enum CUarray_format_enum {
/// CU_AD_FORMAT_UNSIGNED_INT8 = 0x01,
/// CU_AD_FORMAT_UNSIGNED_INT16 = 0x02,
/// CU_AD_FORMAT_UNSIGNED_INT32 = 0x03,
/// CU_AD_FORMAT_SIGNED_INT8 = 0x08,
/// CU_AD_FORMAT_SIGNED_INT16 = 0x09,
/// CU_AD_FORMAT_SIGNED_INT32 = 0x0a,
/// CU_AD_FORMAT_HALF = 0x10,
/// CU_AD_FORMAT_FLOAT = 0x20,
/// CU_AD_FORMAT_NV12 = 0xb0,
/// CU_AD_FORMAT_UNORM_INT8X1 = 0xc0,
/// CU_AD_FORMAT_UNORM_INT8X2 = 0xc1,
/// CU_AD_FORMAT_UNORM_INT8X4 = 0xc2,
/// CU_AD_FORMAT_UNORM_INT16X1 = 0xc3,
/// CU_AD_FORMAT_UNORM_INT16X2 = 0xc4,
/// CU_AD_FORMAT_UNORM_INT16X4 = 0xc5,
/// CU_AD_FORMAT_SNORM_INT8X1 = 0xc6,
/// CU_AD_FORMAT_SNORM_INT8X2 = 0xc7,
/// CU_AD_FORMAT_SNORM_INT8X4 = 0xc8,
/// CU_AD_FORMAT_SNORM_INT16X1 = 0xc9,
/// CU_AD_FORMAT_SNORM_INT16X2 = 0xca,
/// CU_AD_FORMAT_SNORM_INT16X4 = 0xcb,
/// CU_AD_FORMAT_BC1_UNORM = 0x91,
/// CU_AD_FORMAT_BC1_UNORM_SRGB = 0x92,
/// CU_AD_FORMAT_BC2_UNORM = 0x93,
/// CU_AD_FORMAT_BC2_UNORM_SRGB = 0x94,
/// CU_AD_FORMAT_BC3_UNORM = 0x95,
/// CU_AD_FORMAT_BC3_UNORM_SRGB = 0x96,
/// CU_AD_FORMAT_BC4_UNORM = 0x97,
/// CU_AD_FORMAT_BC4_SNORM = 0x98,
/// CU_AD_FORMAT_BC5_UNORM = 0x99,
/// CU_AD_FORMAT_BC5_SNORM = 0x9a,
/// CU_AD_FORMAT_BC6H_UF16 = 0x9b,
/// CU_AD_FORMAT_BC6H_SF16 = 0x9c,
/// CU_AD_FORMAT_BC7_UNORM = 0x9d,
/// CU_AD_FORMAT_BC7_UNORM_SRGB = 0x9e,
/// CU_AD_FORMAT_P010 = 0x9f,
/// CU_AD_FORMAT_P016 = 0xa1,
/// CU_AD_FORMAT_NV16 = 0xa2,
/// CU_AD_FORMAT_P210 = 0xa3,
/// CU_AD_FORMAT_P216 = 0xa4,
/// CU_AD_FORMAT_YUY2 = 0xa5,
/// CU_AD_FORMAT_Y210 = 0xa6,
/// CU_AD_FORMAT_Y216 = 0xa7,
/// CU_AD_FORMAT_AYUV = 0xa8,
/// CU_AD_FORMAT_Y410 = 0xa9,
/// CU_AD_FORMAT_Y416 = 0xb1,
/// CU_AD_FORMAT_Y444_PLANAR8 = 0xb2,
/// CU_AD_FORMAT_Y444_PLANAR10 = 0xb3,
/// CU_AD_FORMAT_YUV444_8bit_SemiPlanar = 0xb4,
/// CU_AD_FORMAT_YUV444_16bit_SemiPlanar = 0xb5,
/// CU_AD_FORMAT_UNORM_INT_101010_2 = 0x50,
/// CU_AD_FORMAT_UINT8_PACKED_422 = 0x51,
/// CU_AD_FORMAT_UINT8_PACKED_444 = 0x52,
/// CU_AD_FORMAT_UINT8_SEMIPLANAR_420 = 0x53,
/// CU_AD_FORMAT_UINT16_SEMIPLANAR_420 = 0x54,
/// CU_AD_FORMAT_UINT8_SEMIPLANAR_422 = 0x55,
/// CU_AD_FORMAT_UINT16_SEMIPLANAR_422 = 0x56,
/// CU_AD_FORMAT_UINT8_SEMIPLANAR_444 = 0x57,
/// CU_AD_FORMAT_UINT16_SEMIPLANAR_444 = 0x58,
/// CU_AD_FORMAT_UINT8_PLANAR_420 = 0x59,
/// CU_AD_FORMAT_UINT16_PLANAR_420 = 0x5a,
/// CU_AD_FORMAT_UINT8_PLANAR_422 = 0x5b,
/// CU_AD_FORMAT_UINT16_PLANAR_422 = 0x5c,
/// CU_AD_FORMAT_UINT8_PLANAR_444 = 0x5d,
/// CU_AD_FORMAT_UINT16_PLANAR_444 = 0x5e,
/// } CUarray_format;
/// ```
///
/// - `NumChannels` specifies the number of packed components per CUDA array element; it may be 1, 2, or 4;
///
/// Here are examples of CUDA array descriptions:
///
/// Description for a CUDA array of 2048 floats:
///
///
///
/// ```text
/// CUDA_ARRAY_DESCRIPTOR desc;
/// desc.Format = CU_AD_FORMAT_FLOAT;
/// desc.NumChannels = 1;
/// desc.Width = 2048;
/// desc.Height = 1;
/// ```
///
/// Description for a 64 x 64 CUDA array of floats:
///
///
///
/// ```text
/// CUDA_ARRAY_DESCRIPTOR desc;
/// desc.Format = CU_AD_FORMAT_FLOAT;
/// desc.NumChannels = 1;
/// desc.Width = 64;
/// desc.Height = 64;
/// ```
///
/// Description for a `width` x `height` CUDA array of 64-bit, 4x16-bit float16's:
///
///
///
/// ```text
/// CUDA_ARRAY_DESCRIPTOR desc;
/// desc.Format = CU_AD_FORMAT_HALF;
/// desc.NumChannels = 4;
/// desc.Width = width;
/// desc.Height = height;
/// ```
///
/// Description for a `width` x `height` CUDA array of 16-bit elements, each of which is two 8-bit unsigned chars:
///
///
///
/// ```text
/// CUDA_ARRAY_DESCRIPTOR arrayDesc;
/// desc.Format = CU_AD_FORMAT_UNSIGNED_INT8;
/// desc.NumChannels = 2;
/// desc.Width = width;
/// desc.Height = height;
/// ```
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_OUT_OF_MEMORY, ::CUDA_ERROR_UNKNOWN
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaMallocArray
///
/// # Parameters
///
/// - `pHandle`: - Returned array
/// - `pAllocateArray`: - Array descriptor
pub fn cuArrayCreate_v2(
pHandle: *mut CUarray,
pAllocateArray: *const CUDA_ARRAY_DESCRIPTOR,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Get a 1D or 2D CUDA array descriptor
///
/// 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 or other purposes.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_HANDLE
///
///
///
/// See also: ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaArrayGetInfo
///
/// # Parameters
///
/// - `pArrayDescriptor`: - Returned array descriptor
/// - `hArray`: - Array to get descriptor of
pub fn cuArrayGetDescriptor_v2(
pArrayDescriptor: *mut CUDA_ARRAY_DESCRIPTOR,
hArray: CUarray,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the layout properties of a sparse CUDA array.
///
/// Returns the layout properties of a sparse CUDA array in `sparseProperties` If the CUDA array is not allocated with flag [`CUDA_ARRAY3D_SPARSE`] [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] will be returned.
///
/// If the returned value in [CUDA_ARRAY_SPARSE_PROPERTIES::flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structcuda__array__sparse__properties__v1_1a0e842bb64091fa47809112c700cb5f0a) contains [`CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL`], then [CUDA_ARRAY_SPARSE_PROPERTIES::miptailSize](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structcuda__array__sparse__properties__v1_1a895ecb42681678271b0edba05bf1dcd9) 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structcuda__array__sparse__properties__v1_1aedd0cca8fad1fcbb1789d537edd7e6b6) is always zero. Note that the `array` must have been allocated using cuArrayCreate or cuArray3DCreate. 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.
///
/// # Parameters
///
/// - `sparseProperties`: Pointer to CUDA_ARRAY_SPARSE_PROPERTIES.
/// - `array`: CUDA array to get the sparse properties of.
pub fn cuArrayGetSparseProperties(
sparseProperties: *mut CUDA_ARRAY_SPARSE_PROPERTIES,
array: CUarray,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the layout properties of a sparse CUDA mipmapped array.
///
/// Returns the sparse array layout properties in `sparseProperties` If the CUDA mipmapped array is not allocated with flag [`CUDA_ARRAY3D_SPARSE`] [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] will be returned.
///
/// For non-layered CUDA mipmapped arrays, [CUDA_ARRAY_SPARSE_PROPERTIES::miptailSize](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structcuda__array__sparse__properties__v1_1a895ecb42681678271b0edba05bf1dcd9) returns the size of the mip tail region. The mip tail region includes all mip levels whose width, height or depth is less than that of the tile. For layered CUDA mipmapped arrays, if [CUDA_ARRAY_SPARSE_PROPERTIES::flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structcuda__array__sparse__properties__v1_1a0e842bb64091fa47809112c700cb5f0a) contains [`CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL`], then [CUDA_ARRAY_SPARSE_PROPERTIES::miptailSize](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structcuda__array__sparse__properties__v1_1a895ecb42681678271b0edba05bf1dcd9) specifies the size of the mip tail of all layers combined. Otherwise, [CUDA_ARRAY_SPARSE_PROPERTIES::miptailSize](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structcuda__array__sparse__properties__v1_1a895ecb42681678271b0edba05bf1dcd9) specifies mip tail size per layer. The returned value of [CUDA_ARRAY_SPARSE_PROPERTIES::miptailFirstLevel](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structcuda__array__sparse__properties__v1_1aedd0cca8fad1fcbb1789d537edd7e6b6) is valid only if [CUDA_ARRAY_SPARSE_PROPERTIES::miptailSize](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structcuda__array__sparse__properties__v1_1a895ecb42681678271b0edba05bf1dcd9) is non-zero.
///
/// # Parameters
///
/// - `sparseProperties`: Pointer to CUDA_ARRAY_SPARSE_PROPERTIES.
/// - `mipmap`: CUDA mipmapped array to get the sparse properties of.
pub fn cuMipmappedArrayGetSparseProperties(
sparseProperties: *mut CUDA_ARRAY_SPARSE_PROPERTIES,
mipmap: CUmipmappedArray,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the memory requirements of a CUDA array.
///
/// Returns the memory requirements of a CUDA array in `memoryRequirements` If the CUDA array is not allocated with flag [`CUDA_ARRAY3D_DEFERRED_MAPPING`] [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] will be returned.
///
/// The returned value in [CUDA_ARRAY_MEMORY_REQUIREMENTS::size](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__ARRAY__MEMORY__REQUIREMENTS__v1.html#structcuda__array__memory__requirements__v1_1a7a2851735a1d2c11af797f01b1d4969e) represents the total size of the CUDA array. The returned value in [CUDA_ARRAY_MEMORY_REQUIREMENTS::alignment](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__ARRAY__MEMORY__REQUIREMENTS__v1.html#structcuda__array__memory__requirements__v1_1a35c6c8106451b6313d1dffe9a28af755) represents the alignment necessary for mapping the CUDA array.
///
/// # Parameters
///
/// - `memoryRequirements`: Pointer to CUDA_ARRAY_MEMORY_REQUIREMENTS.
/// - `array`: CUDA array to get the memory requirements of.
/// - `device`: Device to get the memory requirements for.
pub fn cuArrayGetMemoryRequirements(
memoryRequirements: *mut CUDA_ARRAY_MEMORY_REQUIREMENTS,
array: CUarray,
device: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the memory requirements of a CUDA mipmapped array.
///
/// 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`] [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] will be returned.
///
/// The returned value in [CUDA_ARRAY_MEMORY_REQUIREMENTS::size](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__ARRAY__MEMORY__REQUIREMENTS__v1.html#structcuda__array__memory__requirements__v1_1a7a2851735a1d2c11af797f01b1d4969e) represents the total size of the CUDA mipmapped array. The returned value in [CUDA_ARRAY_MEMORY_REQUIREMENTS::alignment](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__ARRAY__MEMORY__REQUIREMENTS__v1.html#structcuda__array__memory__requirements__v1_1a35c6c8106451b6313d1dffe9a28af755)
///
/// represents the alignment necessary for mapping the CUDA mipmapped
///
/// array.
///
/// # Parameters
///
/// - `memoryRequirements`: Pointer to CUDA_ARRAY_MEMORY_REQUIREMENTS.
/// - `mipmap`: CUDA mipmapped array to get the memory requirements of.
/// - `device`: Device to get the memory requirements for.
pub fn cuMipmappedArrayGetMemoryRequirements(
memoryRequirements: *mut CUDA_ARRAY_MEMORY_REQUIREMENTS,
mipmap: CUmipmappedArray,
device: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets a CUDA array plane from a CUDA array.
///
/// Returns in `pPlaneArray` a CUDA array that represents a single format plane of the CUDA array `hArray`.
///
/// 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.
///
/// 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.
///
/// # Parameters
///
/// - `pPlaneArray`: Returned CUDA array referenced by the `planeIdx`.
/// - `hArray`: Multiplanar CUDA array.
/// - `planeIdx`: Plane index.
pub fn cuArrayGetPlane(
pPlaneArray: *mut CUarray,
hArray: CUarray,
planeIdx: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Destroys a CUDA array.
///
/// Destroys the CUDA array `hArray`.
///
/// # Parameters
///
/// - `hArray`: - Array to destroy
pub fn cuArrayDestroy(hArray: CUarray) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates a 3D CUDA array
///
/// 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:
///
///
///
///
///
/// ```text
/// typedef struct {
/// unsigned int Width;
/// unsigned int Height;
/// unsigned int Depth;
/// CUarray_format Format;
/// unsigned int NumChannels;
/// unsigned int Flags;
/// } CUDA_ARRAY3D_DESCRIPTOR;
/// ```
///
/// where:
///
/// - `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:
/// - A 1D array is allocated if `Height` and `Depth` extents are both zero.
/// - A 2D array is allocated if only `Depth` extent is zero.
/// - A 3D array is allocated if all three extents are non-zero.
/// - 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.
/// - 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.
/// - 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. The order of the six layers in memory is the same as that listed in ::CUarray_cubemap_face.
/// - 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 of cubemaps. The first six layers represent the first cubemap, the next six layers form the second cubemap, and so on.
///
/// - ::Format specifies the format of the elements; ::CUarray_format is defined as:
///
///
///
/// ```text
/// typedef enum CUarray_format_enum {
/// CU_AD_FORMAT_UNSIGNED_INT8 = 0x01,
/// CU_AD_FORMAT_UNSIGNED_INT16 = 0x02,
/// CU_AD_FORMAT_UNSIGNED_INT32 = 0x03,
/// CU_AD_FORMAT_SIGNED_INT8 = 0x08,
/// CU_AD_FORMAT_SIGNED_INT16 = 0x09,
/// CU_AD_FORMAT_SIGNED_INT32 = 0x0a,
/// CU_AD_FORMAT_HALF = 0x10,
/// CU_AD_FORMAT_FLOAT = 0x20,
/// CU_AD_FORMAT_NV12 = 0xb0,
/// CU_AD_FORMAT_UNORM_INT8X1 = 0xc0,
/// CU_AD_FORMAT_UNORM_INT8X2 = 0xc1,
/// CU_AD_FORMAT_UNORM_INT8X4 = 0xc2,
/// CU_AD_FORMAT_UNORM_INT16X1 = 0xc3,
/// CU_AD_FORMAT_UNORM_INT16X2 = 0xc4,
/// CU_AD_FORMAT_UNORM_INT16X4 = 0xc5,
/// CU_AD_FORMAT_SNORM_INT8X1 = 0xc6,
/// CU_AD_FORMAT_SNORM_INT8X2 = 0xc7,
/// CU_AD_FORMAT_SNORM_INT8X4 = 0xc8,
/// CU_AD_FORMAT_SNORM_INT16X1 = 0xc9,
/// CU_AD_FORMAT_SNORM_INT16X2 = 0xca,
/// CU_AD_FORMAT_SNORM_INT16X4 = 0xcb,
/// CU_AD_FORMAT_BC1_UNORM = 0x91,
/// CU_AD_FORMAT_BC1_UNORM_SRGB = 0x92,
/// CU_AD_FORMAT_BC2_UNORM = 0x93,
/// CU_AD_FORMAT_BC2_UNORM_SRGB = 0x94,
/// CU_AD_FORMAT_BC3_UNORM = 0x95,
/// CU_AD_FORMAT_BC3_UNORM_SRGB = 0x96,
/// CU_AD_FORMAT_BC4_UNORM = 0x97,
/// CU_AD_FORMAT_BC4_SNORM = 0x98,
/// CU_AD_FORMAT_BC5_UNORM = 0x99,
/// CU_AD_FORMAT_BC5_SNORM = 0x9a,
/// CU_AD_FORMAT_BC6H_UF16 = 0x9b,
/// CU_AD_FORMAT_BC6H_SF16 = 0x9c,
/// CU_AD_FORMAT_BC7_UNORM = 0x9d,
/// CU_AD_FORMAT_BC7_UNORM_SRGB = 0x9e,
/// CU_AD_FORMAT_P010 = 0x9f,
/// CU_AD_FORMAT_P016 = 0xa1,
/// CU_AD_FORMAT_NV16 = 0xa2,
/// CU_AD_FORMAT_P210 = 0xa3,
/// CU_AD_FORMAT_P216 = 0xa4,
/// CU_AD_FORMAT_YUY2 = 0xa5,
/// CU_AD_FORMAT_Y210 = 0xa6,
/// CU_AD_FORMAT_Y216 = 0xa7,
/// CU_AD_FORMAT_AYUV = 0xa8,
/// CU_AD_FORMAT_Y410 = 0xa9,
/// CU_AD_FORMAT_Y416 = 0xb1,
/// CU_AD_FORMAT_Y444_PLANAR8 = 0xb2,
/// CU_AD_FORMAT_Y444_PLANAR10 = 0xb3,
/// CU_AD_FORMAT_YUV444_8bit_SemiPlanar = 0xb4,
/// CU_AD_FORMAT_YUV444_16bit_SemiPlanar = 0xb5,
/// CU_AD_FORMAT_UNORM_INT_101010_2 = 0x50,
/// } CUarray_format;
/// ```
///
/// - `NumChannels` specifies the number of packed components per CUDA array element; it may be 1, 2, or 4;
///
/// - ::Flags may be set to
/// - ::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.
/// - ::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.
/// - ::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.
/// - ::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.
///
/// `Width`, `Height` and `Depth` must meet certain size requirements as listed in the following table. All values are specified in elements. Note that for brevity's sake, the full name of the device attribute is not specified. For ex., TEXTURE1D_WIDTH refers to the device attribute ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH.
///
/// 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 ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH and ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT respectively, in that case.
///
/// <table> <tr><td><b>CUDA array type</b></td> <td><b>Valid extents that must always be met<br>{(width range in elements), (height range), (depth range)}</b></td> <td><b>Valid extents with CUDA_ARRAY3D_SURFACE_LDST set<br> {(width range in elements), (height range), (depth range)}</b></td></tr> <tr><td>1D</td> <td><small>{ (1,TEXTURE1D_WIDTH), 0, 0 }</small></td> <td><small>{ (1,SURFACE1D_WIDTH), 0, 0 }</small></td></tr> <tr><td>2D</td> <td><small>{ (1,TEXTURE2D_WIDTH), (1,TEXTURE2D_HEIGHT), 0 }</small></td> <td><small>{ (1,SURFACE2D_WIDTH), (1,SURFACE2D_HEIGHT), 0 }</small></td></tr> <tr><td>3D</td> <td><small>{ (1,TEXTURE3D_WIDTH), (1,TEXTURE3D_HEIGHT), (1,TEXTURE3D_DEPTH) } <br>OR<br>{ (1,TEXTURE3D_WIDTH_ALTERNATE), (1,TEXTURE3D_HEIGHT_ALTERNATE), (1,TEXTURE3D_DEPTH_ALTERNATE) }</small></td> <td><small>{ (1,SURFACE3D_WIDTH), (1,SURFACE3D_HEIGHT), (1,SURFACE3D_DEPTH) }</small></td></tr> <tr><td>1D Layered</td> <td><small>{ (1,TEXTURE1D_LAYERED_WIDTH), 0, (1,TEXTURE1D_LAYERED_LAYERS) }</small></td> <td><small>{ (1,SURFACE1D_LAYERED_WIDTH), 0, (1,SURFACE1D_LAYERED_LAYERS) }</small></td></tr> <tr><td>2D Layered</td> <td><small>{ (1,TEXTURE2D_LAYERED_WIDTH), (1,TEXTURE2D_LAYERED_HEIGHT), (1,TEXTURE2D_LAYERED_LAYERS) }</small></td> <td><small>{ (1,SURFACE2D_LAYERED_WIDTH), (1,SURFACE2D_LAYERED_HEIGHT), (1,SURFACE2D_LAYERED_LAYERS) }</small></td></tr> <tr><td>Cubemap</td> <td><small>{ (1,TEXTURECUBEMAP_WIDTH), (1,TEXTURECUBEMAP_WIDTH), 6 }</small></td> <td><small>{ (1,SURFACECUBEMAP_WIDTH), (1,SURFACECUBEMAP_WIDTH), 6 }</small></td></tr> <tr><td>Cubemap Layered</td> <td><small>{ (1,TEXTURECUBEMAP_LAYERED_WIDTH), (1,TEXTURECUBEMAP_LAYERED_WIDTH), (1,TEXTURECUBEMAP_LAYERED_LAYERS) }</small></td> <td><small>{ (1,SURFACECUBEMAP_LAYERED_WIDTH), (1,SURFACECUBEMAP_LAYERED_WIDTH), (1,SURFACECUBEMAP_LAYERED_LAYERS) }</small></td></tr> </table>
///
/// Here are examples of CUDA array descriptions:
///
/// Description for a CUDA array of 2048 floats:
///
///
///
/// ```text
/// CUDA_ARRAY3D_DESCRIPTOR desc;
/// desc.Format = CU_AD_FORMAT_FLOAT;
/// desc.NumChannels = 1;
/// desc.Width = 2048;
/// desc.Height = 0;
/// desc.Depth = 0;
/// ```
///
/// Description for a 64 x 64 CUDA array of floats:
///
///
///
/// ```text
/// CUDA_ARRAY3D_DESCRIPTOR desc;
/// desc.Format = CU_AD_FORMAT_FLOAT;
/// desc.NumChannels = 1;
/// desc.Width = 64;
/// desc.Height = 64;
/// desc.Depth = 0;
/// ```
///
/// Description for a `width` x `height` x `depth` CUDA array of 64-bit, 4x16-bit float16's:
///
///
///
/// ```text
/// CUDA_ARRAY3D_DESCRIPTOR desc;
/// desc.Format = CU_AD_FORMAT_HALF;
/// desc.NumChannels = 4;
/// desc.Width = width;
/// desc.Height = height;
/// desc.Depth = depth;
/// ```
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_OUT_OF_MEMORY, ::CUDA_ERROR_UNKNOWN
///
///
///
/// See also: ::cuArray3DGetDescriptor, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaMalloc3DArray
///
/// # Parameters
///
/// - `pHandle`: - Returned array
/// - `pAllocateArray`: - 3D array descriptor
pub fn cuArray3DCreate_v2(
pHandle: *mut CUarray,
pAllocateArray: *const CUDA_ARRAY3D_DESCRIPTOR,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Get a 3D CUDA array descriptor
///
/// 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 or other purposes.
///
/// 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.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_HANDLE, ::CUDA_ERROR_CONTEXT_IS_DESTROYED
///
///
///
/// See also: ::cuArray3DCreate, ::cuArrayCreate, ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, ::cudaArrayGetInfo
///
/// # Parameters
///
/// - `pArrayDescriptor`: - Returned 3D array descriptor
/// - `hArray`: - 3D array to get descriptor of
pub fn cuArray3DGetDescriptor_v2(
pArrayDescriptor: *mut CUDA_ARRAY3D_DESCRIPTOR,
hArray: CUarray,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates a CUDA mipmapped array.
///
/// 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, depth)))\].
///
/// The CUDA_ARRAY3D_DESCRIPTOR is defined as:
///
/// `Width`, `Height` and `Depth` must meet certain size requirements as listed in the following table. All values are specified in elements. Note that for brevity’s sake, the full name of the device attribute is not specified. For ex., TEXTURE1D_MIPMAPPED_WIDTH refers to the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH`].
///
/// # Parameters
///
/// - `pHandle`: Returned mipmapped array.
/// - `pMipmappedArrayDesc`: mipmapped array descriptor.
/// - `numMipmapLevels`: Number of mipmap levels.
pub fn cuMipmappedArrayCreate(
pHandle: *mut CUmipmappedArray,
pMipmappedArrayDesc: *const CUDA_ARRAY3D_DESCRIPTOR,
numMipmapLevels: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets a mipmap level of a CUDA mipmapped array.
///
/// Returns in `*pLevelArray` a CUDA array that represents a single mipmap level of the CUDA mipmapped array `hMipmappedArray`.
///
/// If `level` is greater than the maximum number of levels in this mipmapped array, [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] is returned.
///
/// # Parameters
///
/// - `pLevelArray`: Returned mipmap level CUDA array.
/// - `hMipmappedArray`: CUDA mipmapped array.
/// - `level`: Mipmap level.
pub fn cuMipmappedArrayGetLevel(
pLevelArray: *mut CUarray,
hMipmappedArray: CUmipmappedArray,
level: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Destroys a CUDA mipmapped array.
///
/// Destroys the CUDA mipmapped array `hMipmappedArray`.
///
/// # Parameters
///
/// - `hMipmappedArray`: - Mipmapped array to destroy
pub fn cuMipmappedArrayDestroy(hMipmappedArray: CUmipmappedArray) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Retrieve handle for an address range.
///
/// Get a handle of the specified type to an address range. When requesting CUmemRangeHandleType::CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD, address range obtained by a prior call to either cuMemAlloc 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 or [`cuMemHostAlloc`] is supported if the [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_HOST_ALLOC_DMA_BUF_SUPPORTED`] device attribute returns true.
///
/// As of CUDA 13.0, querying support for address range obtained by calling cuMemAllocHost or [`cuMemHostAlloc`] using the [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED`] device attribute is deprecated.
///
/// Users must ensure the `dptr` and `size` are aligned to the host page size.
///
/// The `handle` will be interpreted as a pointer to an integer to store the dma_buf file descriptor. Users must ensure the entire address 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 properties. Users are also expected to retrieve a new handle every time the underlying physical allocation(s) corresponding to a previously queried VA range are changed.
///
/// 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.
///
/// 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 dmabuf file descriptor may be passed as the file descriptor argument to the mmap() system call.
///
/// For device memory on x86 systems the mapping will be a write combined mapping. On coherent ARM platforms these mappings will be regular cached memory. On all other platforms these mappings will be uncached.
///
/// # Parameters
///
/// - `handle`: Pointer to the location where the returned handle will be stored.
/// - `dptr`: Pointer to a valid CUDA device allocation. Must be aligned to host page size.
/// - `size`: Length of the address range. Must be aligned to host page size.
/// - `handleType`: Type of handle requested (defines type and size of the `handle` output parameter).
/// - `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.
pub fn cuMemGetHandleForAddressRange(
handle: *mut ::core::ffi::c_void,
dptr: CUdeviceptr,
size: size_t,
handleType: CUmemRangeHandleType,
flags: ::core::ffi::c_ulonglong,
) -> CUresult;
}
impl CUmemDecompressAlgorithm_enum {
/// Decompression is unsupported.
pub const CU_MEM_DECOMPRESS_UNSUPPORTED: CUmemDecompressAlgorithm_enum = CUmemDecompressAlgorithm_enum(
0,
);
/// Deflate is supported.
pub const CU_MEM_DECOMPRESS_ALGORITHM_DEFLATE: CUmemDecompressAlgorithm_enum = CUmemDecompressAlgorithm_enum(
1,
);
/// Snappy is supported.
pub const CU_MEM_DECOMPRESS_ALGORITHM_SNAPPY: CUmemDecompressAlgorithm_enum = CUmemDecompressAlgorithm_enum(
2,
);
/// LZ4 is supported.
pub const CU_MEM_DECOMPRESS_ALGORITHM_LZ4: CUmemDecompressAlgorithm_enum = CUmemDecompressAlgorithm_enum(
4,
);
}
/// Bitmasks for CU_DEVICE_ATTRIBUTE_MEM_DECOMPRESS_ALGORITHM_MASK.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemDecompressAlgorithm_enum(pub ::core::ffi::c_uint);
pub use self::CUmemDecompressAlgorithm_enum as CUmemDecompressAlgorithm;
/// Structure describing the parameters that compose a single decompression operation.
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUmemDecompressParams_st {
/// The number of bytes to be read and decompressed from ::CUmemDecompressParams_st.src.
pub srcNumBytes: size_t,
/// The number of bytes that the decompression operation will be expected to write to ::CUmemDecompressParams_st.dst. This value is optional; if present, it may be used by the CUDA driver as a heuristic for scheduling the individual decompression operations.
pub dstNumBytes: size_t,
/// After the decompression operation has completed, the actual number of bytes written to ::CUmemDecompressParams.dst will be recorded as a 32-bit unsigned integer in the memory at this address.
pub dstActBytes: *mut cuuint32_t,
/// Pointer to a buffer of at least ::CUmemDecompressParams_st.srcNumBytes compressed bytes.
pub src: *const ::core::ffi::c_void,
/// Pointer to a buffer where the decompressed data will be written. The number of bytes written to this location will be recorded in the memory pointed to by ::CUmemDecompressParams_st.dstActBytes
pub dst: *mut ::core::ffi::c_void,
/// The decompression algorithm to use.
pub algo: CUmemDecompressAlgorithm,
/// These bytes are unused and must be zeroed. This ensures compatibility if additional fields are added in the future.
pub padding: [::core::ffi::c_uchar; 20usize],
}
impl Default for CUmemDecompressParams_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Structure describing the parameters that compose a single decompression operation.
pub type CUmemDecompressParams = CUmemDecompressParams_st;
singe_loader::functions! { crate::DRIVER;
/// Submit a batch of `count` independent decompression operations.
///
/// 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 CPU. To the work completion tracking mechanisms in the CUDA driver, the batch will be considered a single unit of work and processed according to stream semantics, i.e., it is not possible to query the completion of individual decompression operations within a batch.
///
/// The memory pointed to by each of [CUmemDecompressParams.src](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmemDecompressParams.html#structcumemdecompressparams_1a4d390c15ec5ed068f0912e42077ae0e0), [CUmemDecompressParams.dst](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmemDecompressParams.html#structcumemdecompressparams_1a39077e823122cfcfab6aeca53093c88c), and [CUmemDecompressParams.dstActBytes](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmemDecompressParams.html#structcumemdecompressparams_1adf7e9b52dd81aa6c0ed689eeab86d1a7), must be capable of usage with the hardware decompress feature. That is, for each of said pointers, the pointer attribute [`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 following CUDA memory allocators.
///
/// # Parameters
///
/// - `paramsArray`: The array of structures describing the independent decompression operations.
/// - `count`: The number of entries in `paramsArray` array.
/// - `flags`: Must be 0.
/// - `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 operation. May be `NULL`, in which case, no index will be recorded in the event of error.
/// - `stream`: The stream where the work will be enqueued.
pub fn cuMemBatchDecompressAsync(
paramsArray: *mut CUmemDecompressParams,
count: size_t,
flags: ::core::ffi::c_uint,
errorIndex: *mut size_t,
stream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Allocate an address range reservation.
///
/// 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 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 the driver treats it as a hint about where to place the reservation.
///
/// # Parameters
///
/// - `ptr`: Resulting pointer to start of virtual address range allocated.
/// - `size`: Size of the reserved virtual address range requested.
/// - `alignment`: Alignment of the reserved virtual address range requested.
/// - `addr`: Hint address for the start of the address range.
/// - `flags`: Currently unused, must be zero.
pub fn cuMemAddressReserve(
ptr: *mut CUdeviceptr,
size: size_t,
alignment: size_t,
addr: CUdeviceptr,
flags: ::core::ffi::c_ulonglong,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Free an address range reservation.
///
/// Frees a virtual address range reserved by cuMemAddressReserve. The size must match what was given to memAddressReserve and the ptr given must match what was returned from memAddressReserve.
///
/// # Parameters
///
/// - `ptr`: Starting address of the virtual address range to free.
/// - `size`: Size of the virtual address region to free.
pub fn cuMemAddressFree(ptr: CUdeviceptr, size: size_t) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Create a CUDA memory handle representing a memory allocation of a given size described by the given properties.
///
/// 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmemAllocationProp__v1.html#structcumemallocationprop__v1_1a542262ad88e1d00f02b306c641270168) 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](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmemAllocationProp__v1.html#structcumemallocationprop__v1_1a574c7287583cd07f23efc94d444087b1) 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmemAllocationProp__v1.html#structcumemallocationprop__v1_1ae2e852e72e5d2053b771fbac49495efd) 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](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmemAllocationProp__v1.html#structcumemallocationprop__v1_1a574c7287583cd07f23efc94d444087b1) 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 must be set to 0. Specifying [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT`] as the [CUmemLocation::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmemLocation__v1.html#structcumemlocation__v1_1aa34fc29f2a55d501f00f912d92152d1b) will result in [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`]. Specifying [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE_LOCALITY_DOMAIN`] as the [CUmemLocation::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmemLocation__v1.html#structcumemlocation__v1_1aa34fc29f2a55d501f00f912d92152d1b) will localize the allocation to the specified locality domain. ::CUmemAllocationProp::CUmemLocation::localized.deviceId must specify the device ID. ::CUmemAllocationProp::CUmemLocation::localized.localityDomainId must specify the locality domain ID. The locality domain ID must be a valid locality domain ID for the specified device. See also [`cuDeviceGetAttribute`] with the attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_LOCALITY_DOMAIN_COUNT`].
///
/// 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 under /proc/devices (2) have at least one IMEX channel file accessible by the user launching the application.
///
/// When exporter and importer CUDA processes have been granted access to the same IMEX channel, they can securely share memory.
///
/// The IMEX channel security model works on a per user basis. Which means all processes under a user can share memory if the user has access to a valid IMEX channel. When multi-user isolation is desired, a separate IMEX channel is required for each user.
///
/// These channel files exist in /dev/nvidia-caps-imex-channels/channel\* and can be created using standard OS native calls like mknod on Linux. For example: To create channel0 with the major number from /proc/devices users can execute the following command: `mknod /dev/nvidia-caps-imex-channels/channel0 c <major number> 0`
///
/// If [CUmemAllocationProp::allocFlags::usage](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmemAllocationProp__v1.html#structcumemallocationprop__v1_1affdae8fc56d42a203bb8a7629df3ac51) 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 arrays. (see [`cuMemMapArrayAsync`]).
///
/// # Parameters
///
/// - `handle`: Value of handle returned. All operations on this allocation are to be performed using this handle.
/// - `size`: Size of the allocation requested.
/// - `prop`: Properties of the allocation to create.
/// - `flags`: flags for future use, must be zero now.
pub fn cuMemCreate(
handle: *mut CUmemGenericAllocationHandle,
size: size_t,
prop: *const CUmemAllocationProp,
flags: ::core::ffi::c_ulonglong,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Release a memory handle representing a memory allocation which was previously allocated through cuMemCreate.
///
/// Frees the memory that was allocated on a device through cuMemCreate.
///
/// The memory allocation will be freed when all outstanding mappings to the memory are unmapped and when all outstanding references to the handle (including it’s shareable counterparts) are also released. The generic memory handle can be freed when there are still outstanding mappings made with this handle. Each time a recipient process imports a shareable handle, it needs to pair it with [`cuMemRelease`] for the handle to be freed. If `handle` is not a valid handle the behavior is undefined.
///
/// # Parameters
///
/// - `handle`: Value of handle which was returned previously by cuMemCreate.
pub fn cuMemRelease(handle: CUmemGenericAllocationHandle) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Maps an allocation handle to a reserved virtual address range.
///
/// 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.
///
/// When `handle` represents a multicast object, this call may fail if the devices added via [`cuMulticastAddDevice`] do not belong to the same clique.
///
/// When `handle` represents a multicast object, this call may return [`CUresult::CUDA_ERROR_ILLEGAL_STATE`] if the system configuration is in an illegal state. In such cases, to continue using multicast, verify that the system configuration is in a valid state and all required driver daemons are running properly.
///
/// Please note calling [`cuMemMap`] does not make the address accessible, the caller needs to update accessibility of a contiguous mapped VA range by calling [`cuMemSetAccess`].
///
/// 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`].
///
/// [`cuMemMap`] can only create mappings on VA range reservations that are not currently mapped.
///
/// # Parameters
///
/// - `ptr`: Address where memory will be mapped.
/// - `size`: Size of the memory mapping.
/// - `offset`: - Offset into the memory represented by
/// - `handle` from which to start mapping
/// - Note: currently must be zero.
/// - `handle`: Handle to a shareable memory.
/// - `flags`: flags for future use, must be zero now.
pub fn cuMemMap(
ptr: CUdeviceptr,
size: size_t,
offset: size_t,
handle: CUmemGenericAllocationHandle,
flags: ::core::ffi::c_ulonglong,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Maps or unmaps subregions of sparse CUDA arrays and sparse CUDA mipmapped arrays.
///
/// Performs map or unmap operations on subregions of sparse CUDA arrays and sparse CUDA mipmapped arrays. Each operation is specified by a CUarrayMapInfo entry in the `mapInfoList` array of size `count`. The structure CUarrayMapInfo is defined as follow:
///
/// where [CUarrayMapInfo::resourceType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1a8cf3c7ba97c834ab8b0fcfb50fec578c) specifies the type of resource to be operated on. If [CUarrayMapInfo::resourceType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1a8cf3c7ba97c834ab8b0fcfb50fec578c) 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, 2D layered or 3D CUDA array and must have been allocated using cuArrayCreate or cuArray3DCreate 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1a8cf3c7ba97c834ab8b0fcfb50fec578c) 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 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`].
///
/// [CUarrayMapInfo::subresourceType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1a7a2fe272bd8e44af2386f1c20c3d3c68) specifies the type of subresource within the resource. ::CUarraySparseSubresourceType_enum is defined as:
///
/// where ::CUarraySparseSubresourceType::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL indicates a sparse-miplevel which spans at least one tile in every dimension. The remaining miplevels which are too small to span at least one tile in any dimension constitute the mip tail region as indicated by ::CUarraySparseSubresourceType::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL subresource type.
///
/// If [CUarrayMapInfo::subresourceType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1a7a2fe272bd8e44af2386f1c20c3d3c68) is set to ::CUarraySparseSubresourceType::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL then CUarrayMapInfo::subresource::sparseLevel struct must contain valid array subregion offsets and extents. The [CUarrayMapInfo::subresource::sparseLevel::offsetX](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1aefe372bb107f7bc89cfcca0a857b33d3), [CUarrayMapInfo::subresource::sparseLevel::offsetY](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1a98a37a828dc2814543c410c01e93b6dd) and [CUarrayMapInfo::subresource::sparseLevel::offsetZ](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1ad5dd8de9c3bd4c486a951c2784eb1c56) must specify valid X, Y and Z offsets respectively. The [CUarrayMapInfo::subresource::sparseLevel::extentWidth](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1a50dd4e7049b30f74a5edfd393824f7f8), [CUarrayMapInfo::subresource::sparseLevel::extentHeight](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1acee9af385a8d55412462af044e2014f2) and [CUarrayMapInfo::subresource::sparseLevel::extentDepth](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1aace61d37825a0eabdd76649628e38e56) must specify valid width, height and depth extents respectively. These offsets and extents must be aligned to the corresponding tile dimension. For CUDA mipmapped arrays [CUarrayMapInfo::subresource::sparseLevel::level](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1aa8236fa42f04cd67abd14cb1ef0fca86) must specify a valid mip level index. Otherwise, must be zero. For layered CUDA arrays and layered CUDA mipmapped arrays [CUarrayMapInfo::subresource::sparseLevel::layer](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1a843b7856a03e69ad18eec27ccb40b222) must specify a valid layer index. Otherwise, must be zero. [CUarrayMapInfo::subresource::sparseLevel::offsetZ](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1ad5dd8de9c3bd4c486a951c2784eb1c56) must be zero and [CUarrayMapInfo::subresource::sparseLevel::extentDepth](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1aace61d37825a0eabdd76649628e38e56) 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`]
///
/// If [CUarrayMapInfo::subresourceType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1a7a2fe272bd8e44af2386f1c20c3d3c68) is set to ::CUarraySparseSubresourceType::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL then CUarrayMapInfo::subresource::miptail struct must contain valid mip tail offset in [CUarrayMapInfo::subresource::miptail::offset](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1a4aee5e358272af897aeaf8b44fd15bdb) and size in [CUarrayMapInfo::subresource::miptail::size](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1abb22d0785912f6bd26802bbd6c31a7ec). Both, mip tail offset and mip tail size must be aligned to the tile size. For layered CUDA mipmapped arrays which don’t have the flag [`CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL`] set in [CUDA_ARRAY_SPARSE_PROPERTIES::flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__ARRAY__SPARSE__PROPERTIES__v1.html#structcuda__array__sparse__properties__v1_1a0e842bb64091fa47809112c700cb5f0a) as returned by [`cuMipmappedArrayGetSparseProperties`], [CUarrayMapInfo::subresource::miptail::layer](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1a843b7856a03e69ad18eec27ccb40b222) must specify a valid layer index. Otherwise, must be zero.
///
/// 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1a7a2fe272bd8e44af2386f1c20c3d3c68) and the contents of CUarrayMapInfo::subresource will be ignored.
///
/// [CUarrayMapInfo::memOperationType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1add139e9655407264f2aeb812cec0f19e) specifies the type of operation. [CUmemOperationType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gae7469bd2e035fc9c937e84490fdcd349) is defined as:
///
/// If [CUarrayMapInfo::memOperationType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1add139e9655407264f2aeb812cec0f19e) is set to ::CUmemOperationType::CU_MEM_OPERATION_TYPE_UNMAP then an unmapping operation is performed. CUarrayMapInfo::memHandle must be NULL.
///
/// [CUarrayMapInfo::deviceBitMask](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1af2d14f719018cc1daa786f7fd0652c2c) specifies the list of devices that must map or unmap physical memory. Currently, this mask must have exactly one bit set, and the corresponding device must match the device associated with the stream. If [CUarrayMapInfo::memOperationType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1add139e9655407264f2aeb812cec0f19e) is set to ::CUmemOperationType::CU_MEM_OPERATION_TYPE_MAP, the device must also match the device associated with the tile pool memory allocation as specified by CUarrayMapInfo::memHandle.
///
/// [CUarrayMapInfo::flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1a2e36982c16390693a56807d0b8e6380f) and [CUarrayMapInfo::reserved](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUarrayMapInfo__v1.html#structcuarraymapinfo__v1_1acf7014dc4a157928de12563d0181ceba)[] are unused and must be set to zero.
///
/// # Parameters
///
/// - `mapInfoList`: List of CUarrayMapInfo.
/// - `count`: Count of CUarrayMapInfo in `mapInfoList`.
/// - `hStream`: Stream identifier for the stream to use for map or unmap operations.
pub fn cuMemMapArrayAsync(
mapInfoList: *mut CUarrayMapInfo,
count: ::core::ffi::c_uint,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Unmap the backing memory of a given address range.
///
/// 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.
///
/// 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.
///
/// # Parameters
///
/// - `ptr`: Starting address for the virtual address range to unmap.
/// - `size`: Size of the virtual address range to unmap.
pub fn cuMemUnmap(ptr: CUdeviceptr, size: size_t) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Set the access flags for each location specified in `desc` for the given virtual address range.
///
/// 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 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 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.
///
/// # Parameters
///
/// - `ptr`: Starting address for the virtual address range.
/// - `size`: Length of the virtual address range.
/// - `desc`: - Array of ::CUmemAccessDesc that describe how to change the
/// - mapping for each location specified
/// - `count`: Number of CUmemAccessDesc in `desc`.
pub fn cuMemSetAccess(
ptr: CUdeviceptr,
size: size_t,
desc: *const CUmemAccessDesc,
count: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Get the access `flags` set for the given `location` and `ptr`.
///
/// # Parameters
///
/// - `flags`: Flags set for this location.
/// - `location`: Location in which to check the flags for.
/// - `ptr`: Address in which to check the access flags for.
pub fn cuMemGetAccess(
flags: *mut ::core::ffi::c_ulonglong,
location: *const CUmemLocation,
ptr: CUdeviceptr,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Exports an allocation to a requested shareable handle type.
///
/// Given a CUDA memory handle, create a shareable memory allocation handle that can be used to share the memory with other processes. 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`
///
/// Once all shareable handles are closed and the allocation is released, the allocated memory referenced will be released back to the OS and uses of the CUDA handle afterward will lead to undefined behavior.
///
/// This API can also be used in conjunction with other APIs (e.g. Vulkan, OpenGL) that support importing memory from the shareable type.
///
/// # Parameters
///
/// - `shareableHandle`: Pointer to the location in which to store the requested handle type.
/// - `handle`: CUDA handle for the memory allocation.
/// - `handleType`: Type of shareable handle requested (defines type and size of the `shareableHandle` output parameter).
/// - `flags`: Reserved, must be zero.
pub fn cuMemExportToShareableHandle(
shareableHandle: *mut ::core::ffi::c_void,
handle: CUmemGenericAllocationHandle,
handleType: CUmemAllocationHandleType,
flags: ::core::ffi::c_ulonglong,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Imports an allocation from a requested shareable handle type.
///
/// If the current process cannot support the memory described by this shareable handle, this API will error as [`cudaError_enum::CUDA_ERROR_NOT_SUPPORTED`].
///
/// 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 as [`cudaError_enum::CUDA_ERROR_NOT_PERMITTED`].
///
/// # Parameters
///
/// - `handle`: CUDA Memory handle for the memory allocation.
/// - `osHandle`: Shareable Handle representing the memory allocation that is to be imported.
/// - `shHandleType`: handle type of the exported handle [CUmemAllocationHandleType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1ga450a23153d86fce0afe30e25d63caef9).
pub fn cuMemImportFromShareableHandle(
handle: *mut CUmemGenericAllocationHandle,
osHandle: *mut ::core::ffi::c_void,
shHandleType: CUmemAllocationHandleType,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Calculates either the minimal or recommended granularity.
///
/// Calculates either the minimal or recommended granularity for a given allocation specification and returns it in granularity. This granularity can be used as a multiple for alignment, size, or address mapping.
///
/// # Parameters
///
/// - `granularity`: Returned granularity.
/// - `prop`: Property for which to determine the granularity for.
/// - `option`: Determines which granularity to return.
pub fn cuMemGetAllocationGranularity(
granularity: *mut size_t,
prop: *const CUmemAllocationProp,
option: CUmemAllocationGranularity_flags,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Retrieve the contents of the property structure defining properties for this handle.
///
/// # Parameters
///
/// - `prop`: Pointer to a properties structure which will hold the information about this handle.
/// - `handle`: Handle which to perform the query on.
pub fn cuMemGetAllocationPropertiesFromHandle(
prop: *mut CUmemAllocationProp,
handle: CUmemGenericAllocationHandle,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Given an address `addr`, returns the allocation handle of the backing memory allocation.
///
/// The handle is guaranteed to be the same handle value used to map the memory. If the address requested is not mapped, the function will fail. The returned handle must be released with corresponding number of calls to [`cuMemRelease`].
///
/// # Parameters
///
/// - `handle`: CUDA Memory handle for the backing memory allocation.
/// - `addr`: Memory address to query, that has been mapped previously.
pub fn cuMemRetainAllocationHandle(
handle: *mut CUmemGenericAllocationHandle,
addr: *mut ::core::ffi::c_void,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Frees memory with stream ordered semantics.
///
/// 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 from any subsequent work launched on the GPU or querying its pointer attributes results in undefined behavior.
///
/// # Parameters
///
/// - `dptr`: memory to free.
/// - `hStream`: The stream establishing the stream ordering contract.
pub fn cuMemFreeAsync(dptr: CUdeviceptr, hStream: CUstream) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Allocates memory with stream ordered semantics.
///
/// 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 operation completes. The allocation comes from the memory pool current to the stream’s device.
///
/// # Parameters
///
/// - `dptr`: Returned device pointer.
/// - `bytesize`: Number of bytes to allocate.
/// - `hStream`: The stream establishing the stream ordering contract and the memory pool to allocate from.
pub fn cuMemAllocAsync(
dptr: *mut CUdeviceptr,
bytesize: size_t,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Tries to release memory back to the OS.
///
/// Releases memory back to the OS until the pool contains fewer than minBytesToKeep reserved bytes, or there is no more memory that the allocator can safely release. The allocator cannot release OS allocations that back outstanding asynchronous allocations. The OS allocations may happen at different granularity from the user allocations.
///
/// # Parameters
///
/// - `pool`: The memory pool to trim.
/// - `minBytesToKeep`: If the pool has less than minBytesToKeep reserved, the TrimTo operation is a no-op. Otherwise the pool will be guaranteed to have at least minBytesToKeep bytes reserved after the operation.
pub fn cuMemPoolTrimTo(pool: CUmemoryPool, minBytesToKeep: size_t) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets attributes of a memory pool.
///
/// Supported attributes are.
///
/// # Parameters
///
/// - `pool`: The memory pool to modify.
/// - `attr`: The attribute to modify.
/// - `value`: Pointer to the value to assign.
pub fn cuMemPoolSetAttribute(
pool: CUmemoryPool,
attr: CUmemPool_attribute,
value: *mut ::core::ffi::c_void,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets attributes of a memory pool.
///
/// Supported attributes are:
///
/// The following properties can be also be queried on imported and default pools.
///
/// # Parameters
///
/// - `pool`: The memory pool to get attributes of.
/// - `attr`: The attribute to get.
/// - `value`: Retrieved value.
pub fn cuMemPoolGetAttribute(
pool: CUmemoryPool,
attr: CUmemPool_attribute,
value: *mut ::core::ffi::c_void,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Controls visibility of pools between devices.
///
/// # Parameters
///
/// - `pool`: The pool being modified.
/// - `map`: Array of access descriptors. Each descriptor instructs the access to enable for a single gpu.
/// - `count`: Number of descriptors in the map array.
pub fn cuMemPoolSetAccess(
pool: CUmemoryPool,
map: *const CUmemAccessDesc,
count: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the accessibility of a pool from a device.
///
/// Returns the accessibility of the pool’s memory from the specified location.
///
/// # Parameters
///
/// - `flags`: the accessibility of the pool from the specified location.
/// - `memPool`: the pool being queried.
/// - `location`: the location accessing the pool.
pub fn cuMemPoolGetAccess(
flags: *mut CUmemAccess_flags,
memPool: CUmemoryPool,
location: *mut CUmemLocation,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates a memory pool.
///
/// 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.
///
/// To create a memory pool for HOST memory not targeting a specific NUMA node, applications must set set ::CUmemPoolProps::CUmemLocation::type 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmemPoolProps__v1.html#structcumempoolprops__v1_1a69e75d604b122dbd39a8e3e3eacbe660) 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 [`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`]. To create a memory pool targeting a specific device locality domain, applications must set ::CUmemPoolProps::CUmemLocation::type to [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE_LOCALITY_DOMAIN`], ::CUmemPoolProps::CUmemLocation::localized.deviceId must specify the device ID, and ::CUmemPoolProps::CUmemLocation::localized.localityDomainId must specify the locality domain ID. The locality domain ID must be a valid locality domain ID for the specified device. See also [`cuDeviceGetAttribute`] with the attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_LOCALITY_DOMAIN_COUNT`].
///
/// 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 a non-zero value for [CUmemPoolProps::maxSize](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmemPoolProps__v1.html#structcumempoolprops__v1_1a0f9278cc88653f1eee70ab6a7a2ad7f3). If set to 0, the maximum size of the pool will default to a system dependent value.
///
/// 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 under /proc/devices (2) have at least one IMEX channel file accessible by the user launching the application.
///
/// When exporter and importer CUDA processes have been granted access to the same IMEX channel, they can securely share memory.
///
/// The IMEX channel security model works on a per user basis. Which means all processes under a user can share memory if the user has access to a valid IMEX channel. When multi-user isolation is desired, a separate IMEX channel is required for each user.
///
/// These channel files exist in /dev/nvidia-caps-imex-channels/channel\* and can be created using standard OS native calls like mknod on Linux. For example: To create channel0 with the major number from /proc/devices users can execute the following command: `mknod /dev/nvidia-caps-imex-channels/channel0 c <major number> 0`
///
/// To create a managed memory pool, applications must set ::CUmemPoolProps::CUmemAllocationType to [`CUmemAllocationType::CU_MEM_ALLOCATION_TYPE_MANAGED`]. ::CUmemPoolProps::CUmemAllocationHandleType must also be set to [`CUmemAllocationHandleType::CU_MEM_HANDLE_TYPE_NONE`] since IPC is not supported. For managed memory pools, ::CUmemPoolProps::CUmemLocation 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`] to indicate no preferred location. [CUmemPoolProps::maxSize](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmemPoolProps__v1.html#structcumempoolprops__v1_1a0f9278cc88653f1eee70ab6a7a2ad7f3) must be set to zero for managed memory pools. [CUmemPoolProps::usage](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmemPoolProps__v1.html#structcumempoolprops__v1_1a81dcd809a228c4346f8e732bb8e9070b) should be zero as decompress for managed memory is not supported. For managed memory pools, all devices on the system must have non-zero ::concurrentManagedAccess. If not, this call returns [`CUresult::CUDA_ERROR_NOT_SUPPORTED`].
pub fn cuMemPoolCreate(
pool: *mut CUmemoryPool,
poolProps: *const CUmemPoolProps,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Destroys the specified memory pool.
///
/// 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 once there are no more outstanding allocations.
///
/// Destroying the current mempool of a device sets the default mempool of that device as the current mempool for that device.
pub fn cuMemPoolDestroy(pool: CUmemoryPool) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the default memory pool for a given location and allocation type.
///
/// The memory location can be of one of [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE`], [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST`], [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`], or [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE_LOCALITY_DOMAIN`]. 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 [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_NONE`] to indicate no preferred location for the managed memory pool. [`CUmemAllocationType_enum::CU_MEM_ALLOCATION_TYPE_MANAGED`] can not be used with [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE_LOCALITY_DOMAIN`].
pub fn cuMemGetDefaultMemPool(
pool_out: *mut CUmemoryPool,
location: *mut CUmemLocation,
type_: CUmemAllocationType,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets the current memory pool for a memory location and of a particular allocation type.
///
/// 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`], [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_HOST_NUMA`], or [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE_LOCALITY_DOMAIN`]. 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 [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_NONE`] to indicate no preferred location for the managed memory pool. [`CUmemAllocationType_enum::CU_MEM_ALLOCATION_TYPE_MANAGED`] can not be used with [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE_LOCALITY_DOMAIN`]. In all other cases, the call returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`]
///
/// 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 for a device. Otherwise the returned pool must have been set with [`cuDeviceSetMemPool`].
pub fn cuMemGetMemPool(
pool: *mut CUmemoryPool,
location: *mut CUmemLocation,
type_: CUmemAllocationType,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the current memory pool for a memory location and allocation type.
///
/// 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`], [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_DEVICE_LOCALITY_DOMAIN`]. 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 [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_NONE`] to indicate no preferred location for the managed memory pool. In all other cases, the call returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`].
///
/// When a memory pool is set as the current memory pool, the location parameter should be the same as the location of the pool. 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`].
pub fn cuMemSetMemPool(
location: *mut CUmemLocation,
type_: CUmemAllocationType,
pool: CUmemoryPool,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Allocates memory from a specified pool with stream ordered semantics.
///
/// 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 operation completes. The allocation comes from the specified memory pool.
///
/// # Parameters
///
/// - `dptr`: Returned device pointer.
/// - `bytesize`: Number of bytes to allocate.
/// - `pool`: The pool to allocate from.
/// - `hStream`: The stream establishing the stream ordering semantic.
pub fn cuMemAllocFromPoolAsync(
dptr: *mut CUdeviceptr,
bytesize: size_t,
pool: CUmemoryPool,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Exports a memory pool to the requested handle type.
///
/// Given an IPC capable mempool, create an OS handle to share the pool with another process. A recipient process can convert 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 type.
///
/// # Parameters
///
/// - `handle_out`: Returned OS handle.
/// - `pool`: pool to export.
/// - `handleType`: the type of handle to create.
/// - `flags`: must be 0.
pub fn cuMemPoolExportToShareableHandle(
handle_out: *mut ::core::ffi::c_void,
pool: CUmemoryPool,
handleType: CUmemAllocationHandleType,
flags: ::core::ffi::c_ulonglong,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// imports a memory pool from a shared handle.
///
/// Specific allocations can be imported from the imported pool with cuMemPoolImportPointer.
///
/// 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 as [`cudaError_enum::CUDA_ERROR_NOT_PERMITTED`].
///
/// # Parameters
///
/// - `pool_out`: Returned memory pool.
/// - `handle`: OS handle of the pool to open.
/// - `handleType`: The type of handle being imported.
/// - `flags`: must be 0.
pub fn cuMemPoolImportFromShareableHandle(
pool_out: *mut CUmemoryPool,
handle: *mut ::core::ffi::c_void,
handleType: CUmemAllocationHandleType,
flags: ::core::ffi::c_ulonglong,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Export data to share a memory pool allocation between processes.
///
/// Constructs `shareData_out` for sharing a specific allocation from an already shared memory pool. The recipient process can import the allocation with the [`cuMemPoolImportPointer`] api. The data is not a handle and may be shared through any IPC mechanism.
///
/// # Parameters
///
/// - `shareData_out`: Returned export data.
/// - `ptr`: pointer to memory being exported.
pub fn cuMemPoolExportPointer(
shareData_out: *mut CUmemPoolPtrExportData,
ptr: CUdeviceptr,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Import a memory pool allocation from another process.
///
/// Returns in `ptr_out` a pointer to the imported memory. The imported memory must not be accessed before the allocation operation completes in the exporting process. The imported memory must be freed from all importing processes before being freed in the exporting process. The pointer may be freed with cuMemFree or cuMemFreeAsync. If cuMemFreeAsync is used, the free must be completed on the importing process before the free operation on the exporting process.
///
/// # Parameters
///
/// - `ptr_out`: pointer to imported memory.
/// - `pool`: pool from which to import.
/// - `shareData`: data specifying the memory to import.
pub fn cuMemPoolImportPointer(
ptr_out: *mut CUdeviceptr,
pool: CUmemoryPool,
shareData: *mut CUmemPoolPtrExportData,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Create a generic allocation handle representing a multicast object described by the given properties.
///
/// This creates a multicast object as described by `prop`. The number of participating devices is specified by [CUmulticastObjectProp::numDevices](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmulticastObjectProp__v1.html#structcumulticastobjectprop__v1_1ae5d44c9262847a6c74e4ae37acdc7478). 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 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmulticastObjectProp__v1.html#structcumulticastobjectprop__v1_1aa45dfd715e2e442fcc7e43f5ce2f8a46). 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`].
///
/// After all participating devices have been added, multicast objects can also be mapped to a device’s virtual address space 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmulticastObjectProp__v1.html#structcumulticastobjectprop__v1_1a705cc17eda91d960e96982f2fda52d55). Multicast objects can be released using the virtual memory management API [`cuMemRelease`].
///
/// # Parameters
///
/// - `mcHandle`: Value of handle returned.
/// - `prop`: Properties of the multicast object to create.
pub fn cuMulticastCreate(
mcHandle: *mut CUmemGenericAllocationHandle,
prop: *const CUmulticastObjectProp,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Associate a device to a multicast object.
///
/// 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUmulticastObjectProp__v1.html#structcumulticastobjectprop__v1_1ae5d44c9262847a6c74e4ae37acdc7478) during [`cuMulticastCreate`]. The association of the device to the multicast object is permanent during the life time of the multicast object. All devices 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 address range can be mapped to the multicast object. A call to [`cuMemMap`] will block until all devices have been added.
///
/// This call may fail with [`cudaError_enum::CUDA_ERROR_INVALID_DEVICE`] if the device specified by `dev` does not belong to the same clique as the other devices previously added to this multicast object.
///
/// # Parameters
///
/// - `mcHandle`: Handle representing a multicast object.
/// - `dev`: Device that will be associated to the multicast object.
pub fn cuMulticastAddDevice(
mcHandle: CUmemGenericAllocationHandle,
dev: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Bind a memory allocation represented by a handle to a multicast object.
///
/// 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 by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_RECOMMENDED`].
///
/// 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.
///
/// On systems with Rubin+ (SM_107+) GPUs, `memOffset` may be aligned to 256 instead of the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`] or [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_RECOMMENDED`]. In such a case the `size` + `memOffset` cannot be larger than the size of the allocated memory. Similarly the `size` + `mcOffset` + the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`] cannot be larger than the size of the than the size of the multicast object. The next available mcOffset for the next bind will be mcOffset + size + the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`].
///
/// Also note that the ability to accept a `memOffset` that is not aligned to the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`] or [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_RECOMMENDED`] is limited by HW resources and may result in error [`cudaError_enum::CUDA_ERROR_MULTICAST_RESOURCE_FULL`]
///
/// 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 call will return [`CUresult::CUDA_ERROR_OUT_OF_MEMORY`] if there are insufficient resources required to perform the bind. This call may also return [`CUresult::CUDA_ERROR_SYSTEM_NOT_READY`] if the necessary system software is not initialized or running.
///
/// This call may fail if the devices added via [`cuMulticastAddDevice`] do not belong to the same clique.
///
/// This call may return [`CUresult::CUDA_ERROR_ILLEGAL_STATE`] if the system configuration is in an illegal state. In such cases, to continue using multicast, verify that the system configuration is in a valid state and all required driver daemons are running properly.
///
/// # Parameters
///
/// - `mcHandle`: Handle representing a multicast object.
/// - `mcOffset`: Offset into the multicast object for attachment.
/// - `memHandle`: Handle representing a memory allocation.
/// - `memOffset`: Offset into the memory for attachment.
/// - `size`: Size of the memory that will be bound to the multicast object.
/// - `flags`: Flags for future use, must be zero for now.
pub fn cuMulticastBindMem(
mcHandle: CUmemGenericAllocationHandle,
mcOffset: size_t,
memHandle: CUmemGenericAllocationHandle,
memOffset: size_t,
size: size_t,
flags: ::core::ffi::c_ulonglong,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Bind a memory allocation represented by a handle to a multicast object.
///
/// 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 by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_RECOMMENDED`].
///
/// 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.
///
/// On systems with Rubin+ (SM_107+) GPUs, `memOffset` may be aligned to 256 instead of the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`] or [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_RECOMMENDED`]. In such a case the `size` + `memOffset` cannot be larger than the size of the allocated memory. Similarly the `size` + `mcOffset` + the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`] cannot be larger than the size of the than the size of the multicast object. The next available mcOffset for the next bind will be mcOffset + size + the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`].
///
/// Also note that the ability to accept a `memOffset` that is not aligned to the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`] or [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_RECOMMENDED`] is limited by HW resources and may result in error [`cudaError_enum::CUDA_ERROR_MULTICAST_RESOURCE_FULL`]
///
/// 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 call will return [`CUresult::CUDA_ERROR_OUT_OF_MEMORY`] if there are insufficient resources required to perform the bind. This call may also return [`CUresult::CUDA_ERROR_SYSTEM_NOT_READY`] if the necessary system software is not initialized or running.
///
/// This call may fail if the devices added via [`cuMulticastAddDevice`] do not belong to the same clique.
///
/// This call may return [`CUresult::CUDA_ERROR_ILLEGAL_STATE`] if the system configuration is in an illegal state. In such cases, to continue using multicast, verify that the system configuration is in a valid state and all required driver daemons are running properly.
///
/// # Parameters
///
/// - `mcHandle`: Handle representing a multicast object.
/// - `dev`: The device that for which the multicast memory binding will be applicable.
/// - `mcOffset`: Offset into the multicast object for attachment.
/// - `memHandle`: Handle representing a memory allocation.
/// - `memOffset`: Offset into the memory for attachment.
/// - `size`: Size of the memory that will be bound to the multicast object.
/// - `flags`: Flags for future use, must be zero for now.
pub fn cuMulticastBindMem_v2(
mcHandle: CUmemGenericAllocationHandle,
dev: CUdevice,
mcOffset: size_t,
memHandle: CUmemGenericAllocationHandle,
memOffset: size_t,
size: size_t,
flags: ::core::ffi::c_ulonglong,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Bind a memory allocation represented by a virtual address to a multicast object.
///
/// 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. 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`].
///
/// 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.
///
/// On systems with Rubin+ (SM_107+) GPUs, `memptr` may be aligned to 256 instead of the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`] or [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_RECOMMENDED`]. In such a case the `size` + `memptr` cannot be larger than the size of the allocated memory. Similarly the `size` + `mcOffset` + the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`] cannot be larger than the size of the than the size of the multicast object. The next available mcOffset for the next bind will be mcOffset + size + the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`]
///
/// Also note that the ability to accept a `memptr` that is not aligned to the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`] or [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_RECOMMENDED`] is limited by HW resources and may result in error [`cudaError_enum::CUDA_ERROR_MULTICAST_RESOURCE_FULL`]
///
/// 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 call will return [`CUresult::CUDA_ERROR_OUT_OF_MEMORY`] if there are insufficient resources required to perform the bind. This call may also return [`CUresult::CUDA_ERROR_SYSTEM_NOT_READY`] if the necessary system software is not initialized or running.
///
/// This call may fail if the devices added via [`cuMulticastAddDevice`] do not belong to the same clique.
///
/// This call may return [`CUresult::CUDA_ERROR_ILLEGAL_STATE`] if the system configuration is in an illegal state. In such cases, to continue using multicast, verify that the system configuration is in a valid state and all required driver daemons are running properly.
///
/// # Parameters
///
/// - `mcHandle`: Handle representing a multicast object.
/// - `mcOffset`: Offset into multicast va range for attachment.
/// - `memptr`: Virtual address of the memory allocation.
/// - `size`: Size of memory that will be bound to the multicast object.
/// - `flags`: Flags for future use, must be zero now.
pub fn cuMulticastBindAddr(
mcHandle: CUmemGenericAllocationHandle,
mcOffset: size_t,
memptr: CUdeviceptr,
size: size_t,
flags: ::core::ffi::c_ulonglong,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Bind a memory allocation represented by a virtual address to a multicast object.
///
/// 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. 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`].
///
/// 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.
///
/// On systems with Rubin+ (SM_107+) GPUs, `memptr` may be aligned to 256 instead of the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`] or [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_RECOMMENDED`]. In such a case the `size` + `memptr` cannot be larger than the size of the allocated memory. Similarly the `size` + `mcOffset` + the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`] cannot be larger than the size of the than the size of the multicast object. The next available mcOffset for the next bind will be mcOffset + size + the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`]
///
/// Also note that the ability to accept a `memptr` that is not aligned to the value returned by [`cuMulticastGetGranularity`] with the flag [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_MINIMUM`] or [`CUmulticastGranularity_flags_enum::CU_MULTICAST_GRANULARITY_RECOMMENDED`] is limited by HW resources and may result in error [`cudaError_enum::CUDA_ERROR_MULTICAST_RESOURCE_FULL`]
///
/// 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 call will return [`CUresult::CUDA_ERROR_OUT_OF_MEMORY`] if there are insufficient resources required to perform the bind. This call may also return [`CUresult::CUDA_ERROR_SYSTEM_NOT_READY`] if the necessary system software is not initialized or running.
///
/// This call may fail if the devices added via [`cuMulticastAddDevice`] do not belong to the same clique.
///
/// This call may return [`CUresult::CUDA_ERROR_ILLEGAL_STATE`] if the system configuration is in an illegal state. In such cases, to continue using multicast, verify that the system configuration is in a valid state and all required driver daemons are running properly.
///
/// # Parameters
///
/// - `mcHandle`: Handle representing a multicast object.
/// - `dev`: The device that for which the multicast memory binding will be applicable.
/// - `mcOffset`: Offset into multicast va range for attachment.
/// - `memptr`: Virtual address of the memory allocation.
/// - `size`: Size of memory that will be bound to the multicast object.
/// - `flags`: Flags for future use, must be zero now.
pub fn cuMulticastBindAddr_v2(
mcHandle: CUmemGenericAllocationHandle,
dev: CUdevice,
mcOffset: size_t,
memptr: CUdeviceptr,
size: size_t,
flags: ::core::ffi::c_ulonglong,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Unbind any memory allocations bound to a multicast object at a given offset and upto a given size.
///
/// 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.
///
/// # Parameters
///
/// - `mcHandle`: Handle representing a multicast object.
/// - `dev`: Device that hosts the memory allocation.
/// - `mcOffset`: Offset into the multicast object.
/// - `size`: Desired size to unbind.
pub fn cuMulticastUnbind(
mcHandle: CUmemGenericAllocationHandle,
dev: CUdevice,
mcOffset: size_t,
size: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Calculates either the minimal or recommended granularity for multicast object.
///
/// Calculates either the minimal or recommended granularity for a given set of multicast object properties and returns it in granularity. This granularity can be used as a multiple for size, bind offsets and address mappings of the multicast object.
///
/// # Parameters
///
/// - `granularity`: Returned granularity.
/// - `prop`: Properties of the multicast object.
/// - `option`: Determines which granularity to return.
pub fn cuMulticastGetGranularity(
granularity: *mut size_t,
prop: *const CUmulticastObjectProp,
option: CUmulticastGranularity_flags,
) -> CUresult;
}
impl CUcliqueType_enum {
/// Unicast pointer clique.
pub const CU_CLIQUE_TYPE_UNICAST_POINTER: CUcliqueType_enum = CUcliqueType_enum(0);
/// Multicast pointer clique.
pub const CU_CLIQUE_TYPE_MULTICAST_POINTER: CUcliqueType_enum = CUcliqueType_enum(1);
/// Unicast logical endpoint clique.
pub const CU_CLIQUE_TYPE_UNICAST_LOGICAL_ENDPOINT: CUcliqueType_enum = CUcliqueType_enum(
2,
);
/// Multicast logical endpoint clique.
pub const CU_CLIQUE_TYPE_MULTICAST_LOGICAL_ENDPOINT: CUcliqueType_enum = CUcliqueType_enum(
3,
);
}
/// Fabric clique types
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUcliqueType_enum(pub ::core::ffi::c_uint);
pub use self::CUcliqueType_enum as CUcliqueType;
/// Fabric clique information
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUcliqueInfo_st {
/// Type of the fabric clique
pub type_: CUcliqueType,
/// ID of the fabric clique
pub id: ::core::ffi::c_uint,
}
impl Default for CUcliqueInfo_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Fabric clique information.
pub type CUcliqueInfo = CUcliqueInfo_st;
singe_loader::functions! { crate::DRIVER;
/// Retrieves the fabric cluster UUID.
///
/// Retrieves the fabric cluster UUID for the given device.
///
/// # Parameters
///
/// - `uuid`: Fabric cluster UUID.
/// - `dev`: Device for which the fabric cluster UUID is requested.
pub fn cuDeviceGetFabricClusterUuid(uuid: *mut CUuuid, dev: CUdevice) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Retrieves the number of fabric cliques.
///
/// Retrieves the number of fabric cliques that the device is part of.
///
/// # Parameters
///
/// - `count`: Number of fabric cliques that the device is part of.
/// - `dev`: Device for which the number of fabric cliques is requested.
pub fn cuDeviceGetCliqueCount(count: *mut size_t, dev: CUdevice) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Retrieves fabric clique information.
///
/// Returns the fabric clique information for the cliques that the device is a part of. User must specify the size of the `cliqueInfo` array in `count`. The same parameter `count` will return the actual number of entries updated in the `cliqueInfo` array.
///
/// # Parameters
///
/// - `cliqueInfo`: Array to store the fabric clique information.
/// - `count`: Input: Size of the `cliqueInfo` array. Output: Number of entries updated in the `cliqueInfo` array.
/// - `dev`: Device for which the clique information is requested.
pub fn cuDeviceGetCliqueInfo(
cliqueInfo: *mut CUcliqueInfo,
count: *mut size_t,
dev: CUdevice,
) -> CUresult;
}
/// An ID that represents a logical endpoint.
pub type CUlogicalEndpointId = cuuint32_t;
impl CUlogicalEndpointIpcHandleType_enum {
/// Does not request an IPC handle for the logical endpoint.
pub const CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_NONE: CUlogicalEndpointIpcHandleType_enum = CUlogicalEndpointIpcHandleType_enum(
0,
);
/// Uses a fabric handle to share the logical endpoint.
pub const CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_FABRIC: CUlogicalEndpointIpcHandleType_enum = CUlogicalEndpointIpcHandleType_enum(
1,
);
}
/// IPC handle types that can be requested/queried for a given logical endpoint
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlogicalEndpointIpcHandleType_enum(pub ::core::ffi::c_uint);
pub use self::CUlogicalEndpointIpcHandleType_enum as CUlogicalEndpointIpcHandleType;
/// Fabric handle for a logical endpoint
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlogicalEndpointFabricHandle_st {
/// Opaque bytes of the fabric handle used to share a logical endpoint.
pub data: [::core::ffi::c_uchar; 64usize],
}
impl Default for CUlogicalEndpointFabricHandle_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Fabric handle for a logical endpoint.
pub type CUlogicalEndpointFabricHandle = CUlogicalEndpointFabricHandle_st;
impl CUlogicalEndpointType_enum {
/// No valid logical endpoint type is selected.
pub const CU_LOGICAL_ENDPOINT_TYPE_INVALID: CUlogicalEndpointType_enum = CUlogicalEndpointType_enum(
0,
);
/// Selects one device as the destination logical endpoint.
pub const CU_LOGICAL_ENDPOINT_TYPE_UNICAST: CUlogicalEndpointType_enum = CUlogicalEndpointType_enum(
1,
);
/// Selects a multicast group as the destination logical endpoint.
pub const CU_LOGICAL_ENDPOINT_TYPE_MULTICAST: CUlogicalEndpointType_enum = CUlogicalEndpointType_enum(
2,
);
}
/// Logical endpoint type
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlogicalEndpointType_enum(pub ::core::ffi::c_uint);
pub use self::CUlogicalEndpointType_enum as CUlogicalEndpointType;
impl CUlogicalEndpointFlag_enum {
/// Default flag for logical endpoint construction.
pub const CU_LOGICAL_ENDPOINT_FLAG_NONE: CUlogicalEndpointFlag_enum = CUlogicalEndpointFlag_enum(
0,
);
/// Indicate the programmer’s intention to use counted operations with the logical endpoint.
pub const CU_LOGICAL_ENDPOINT_FLAG_COUNTED_OPS: CUlogicalEndpointFlag_enum = CUlogicalEndpointFlag_enum(
1,
);
}
/// Flags for ::CUlogicalEndpointProp
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlogicalEndpointFlag_enum(pub ::core::ffi::c_uint);
pub use self::CUlogicalEndpointFlag_enum as CUlogicalEndpointFlag;
/// Properties of a logical endpoint construction
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUlogicalEndpointProp_struct {
/// Type of the logical endpoint defined in ::CUlogicalEndpointType
pub type_: CUlogicalEndpointType,
/// Anonymous native member. See [`CUlogicalEndpointProp_struct__bindgen_ty_1`] for its fields.
pub __bindgen_anon_1: CUlogicalEndpointProp_struct__bindgen_ty_1,
/// Size of the logical endpoint
pub size: ::core::ffi::c_ulonglong,
/// A bitmask of IPC handle types defined in ::CUlogicalEndpointIpcHandleType
pub ipcHandleTypes: ::core::ffi::c_uint,
/// A bitmask of flags defined in ::CUlogicalEndpointFlag
pub flags: ::core::ffi::c_uint,
}
/// Anonymous native union in [`CUlogicalEndpointProp_struct`]. Its members share the same storage.
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUlogicalEndpointProp_struct__bindgen_ty_1 {
/// Owner-device properties for a unicast logical endpoint.
pub unicast: CUlogicalEndpointProp_struct__bindgen_ty_1__bindgen_ty_1,
/// Multicast-object properties for a multicast logical endpoint.
pub multicast: CUlogicalEndpointProp_struct__bindgen_ty_1__bindgen_ty_2,
}
/// Native layout of the `unicast` member of [`CUlogicalEndpointProp_struct__bindgen_ty_1`].
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlogicalEndpointProp_struct__bindgen_ty_1__bindgen_ty_1 {
/// Owner device of the unicast logical endpoint
pub device: CUdevice,
}
/// Native layout of the `multicast` member of [`CUlogicalEndpointProp_struct__bindgen_ty_1`].
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlogicalEndpointProp_struct__bindgen_ty_1__bindgen_ty_2 {
/// Number of devices in the multicast logical endpoint team
pub numDevices: ::core::ffi::c_uint,
}
impl Default for CUlogicalEndpointProp_struct__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUlogicalEndpointProp_struct {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Properties of a logical endpoint construction.
pub type CUlogicalEndpointProp = CUlogicalEndpointProp_struct;
singe_loader::functions! { crate::DRIVER;
/// Reserves a range of logical endpoint ids.
///
/// Reserves a range of logical endpoint ids starting at `*baseLeId` and extending for `count`. The reserved ids can be used to create or import logical endpoints via [`cuLogicalEndpointCreate`] or [`cuLogicalEndpointImport`] respectively.
///
/// # Parameters
///
/// - `baseLeId`: If [`cuLogicalEndpointIdReserve`] returns [`CUresult::CUDA_SUCCESS`], \*baseLeId contains the base logical endpoint id of the reserved logical endpoint id range.
/// - `count`: The number of logical endpoint ids to reserve.
pub fn cuLogicalEndpointIdReserve(
baseLeId: *mut CUlogicalEndpointId,
count: cuuint32_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Releases a range of logical endpoint ids.
///
/// Releases up to `count` logical endpoint ids starting at `baseLeId`. The range of ids represented by [`baseLeId`, `baseLeId` + `count`) must all be previously reserved. All logical endpoints in the range must be destroyed before they can be released.
///
/// # Parameters
///
/// - `baseLeId`: First logical endpoint id to be released back to the system.
/// - `count`: Number of logical endpoint ids to release back to the system.
pub fn cuLogicalEndpointIdRelease(
baseLeId: CUlogicalEndpointId,
count: cuuint32_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates a logical endpoint with the requested properties and associates it with the logical endpoint id.
///
/// This creates a logical endpoint as described by `prop`. The number of participating devices is determined by the [CUlogicalEndpointProp::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUlogicalEndpointProp.html#structculogicalendpointprop_1ad1eeea7a8e5f814385197b3c4125680e). If the type is [`CUlogicalEndpointType::CU_LOGICAL_ENDPOINT_TYPE_UNICAST`] then ::CUlogicalEndpointProp::unicast::device specifies the owner device of the unicast logical endpoint. If the type is [`CUlogicalEndpointType::CU_LOGICAL_ENDPOINT_TYPE_MULTICAST`] then ::CUlogicalEndpointProp::multicast::numDevices specifies the number of devices in the multicast logical endpoint team.
///
/// Devices can be added to a multicast logical endpoint via [`cuLogicalEndpointAddDevice`]. After all the participating devices have been added, a call to [`cuLogicalEndpointQuery`] must be made to ensure that the logical endpoint is ready for memory binding and access.
///
/// A unicast logical endpoint does not have a notion of adding devices via [`cuLogicalEndpointAddDevice`]. However, a call to [`cuLogicalEndpointQuery`] must still be made to ensure that the logical endpoint is ready for memory binding and access.
///
/// Memory is bound to the logical endpoint via either [`cuLogicalEndpointBindAddr`] or [`cuLogicalEndpointBindMem`], and can be unbound via [`cuLogicalEndpointUnbind`]. The total amount of memory that can be bound per device is specified by [CUlogicalEndpointProp::size](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUlogicalEndpointProp.html#structculogicalendpointprop_1a3b553dde52f259ef1f08cdad07e4f82d). This size must be a multiple of the value for `bindAlignment` as returned by [`cuLogicalEndpointGetLimits`]. The maximum size for the logical endpoint cannot exceed the value for `maxSize` as returned by [`cuLogicalEndpointGetLimits`]. The bind alignment and maximum size depend on the properties of the logical endpoint.
///
/// # Parameters
///
/// - `leId`: Logical endpoint id that will be associated with the newly created logical endpoint.
/// - `prop`: Properties of the logical endpoint to create.
pub fn cuLogicalEndpointCreate(
leId: CUlogicalEndpointId,
prop: *const CUlogicalEndpointProp,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Associates a device to a multicast logical endpoint.
///
/// Associates a device to a logical endpoint. The type of the logical endpoint must be [`CUlogicalEndpointType::CU_LOGICAL_ENDPOINT_TYPE_MULTICAST`]. The added device will be a part of the multicast team of size specified by CUlogicalEndpointProp::multicast::numDevices during [`cuLogicalEndpointCreate`]. The association of the device to the multicast logical endpoint is permanent during the life time of the multicast logical endpoint. All devices must be added to the multicast logical endpoint before any memory can be bound to any device in the team. A multicast logical endpoint will not be ready for use until all devices have been added. User can query whether the logical endpoint is ready for use via [`cuLogicalEndpointQuery`].
///
/// This call may fail with [`cudaError_enum::CUDA_ERROR_INVALID_DEVICE`] if the device specified by `dev` does not belong to the same clique as the other devices previously added to this multicast logical endpoint.
///
/// # Parameters
///
/// - `leId`: Logical endpoint id representing a multicast logical endpoint.
/// - `dev`: Device that will be associated with the multicast logical endpoint.
pub fn cuLogicalEndpointAddDevice(
leId: CUlogicalEndpointId,
dev: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Removes the association of the logical endpoint from the logical endpoint id.
///
/// Removes the association between the logical endpoint id and the logical endpoint resources. Any memory bound by this process to any device associated with the logical endpoint will be unbound. If this was the last reference to the logical endpoint, all associated resources will be destroyed.
///
/// # Parameters
///
/// - `leId`: Logical endpoint id of the logical endpoint to be destroyed.
pub fn cuLogicalEndpointDestroy(leId: CUlogicalEndpointId) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Bind a memory allocation represented by a virtual address to a logical endpoint.
///
/// Binds the memory allocation specified by its mapped address `ptr` to a logical endpoint represented by `leId` at the offset `offset`. The memory must have been allocated via [`cuMemCreate`] or ::cudaMallocAsync. The intended `size` of the bind, the `offset` in the logical endpoint range and `ptr` must be multiples of the value for `bindAlignment` as returned by [`cuLogicalEndpointGetLimits`].
///
/// The `size` cannot be larger than the size of the allocated memory. Similarly the `size` + `offset` cannot be larger than the total size of the logical endpoint.
///
/// 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.
///
/// For multicast endpoints, the device named by `dev` must have been added to the multicast team via [`cuLogicalEndpointAddDevice`].
///
/// For unicast endpoints the device named by `dev` must be the owner device specified during [`cuLogicalEndpointCreate`] via ::CUlogicalEndpointProp::unicast::device.
///
/// Externally shareable as well as imported multicast endpoints can be bound only to externally shareable memory. Imported unicast endpoints cannot be bound to any memory.
///
/// This call will return [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] if [`cuLogicalEndpointQuery`] has not been called for the logical endpoint to ensure that the endpoint is ready for memory binding.
///
/// Note that this call will return [`cudaError_enum::CUDA_ERROR_OUT_OF_MEMORY`] if there are insufficient resources required to perform the bind. This call may also return [`cudaError_enum::CUDA_ERROR_SYSTEM_NOT_READY`] if the necessary system software is not initialized or running. This call may return [`cudaError_enum::CUDA_ERROR_ILLEGAL_STATE`] if the system configuration is in an illegal state. In such cases, to continue using logical endpoints, verify that the system configuration is in a valid state and all required driver daemons are running properly.
///
/// # Parameters
///
/// - `leId`: Logical endpoint to which memory will be associated.
/// - `dev`: Device on which the memory will be bound to the logical endpoint.
/// - `offset`: Offset into the logical endpoint space.
/// - `ptr`: Virtual address of the memory allocation.
/// - `size`: Size of memory that will be bound to the logical endpoint.
/// - `flags`: Flags for future use, must be zero for now.
pub fn cuLogicalEndpointBindAddr(
leId: CUlogicalEndpointId,
dev: CUdevice,
offset: cuuint64_t,
ptr: *mut ::core::ffi::c_void,
size: cuuint64_t,
flags: ::core::ffi::c_ulonglong,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Binds memory object represented by a handle to the logical endpoint.
///
/// Binds the memory allocation specified by `memHandle` to a logical endpoint represented by `leId` at the offset `offset`. The memory must have been allocated via [`cuMemCreate`]. The intended `size` of the bind, the offset in the logical endpoint range `offset` and the offset in the memory handle `memOffset` must be multiples of the value for `bindAlignment` as returned by [`cuLogicalEndpointGetLimits`].
///
/// The `size` + `memOffset` cannot be larger than the size of the allocated memory. Similarly the `size` + `offset` cannot be larger than the total size of the logical endpoint.
///
/// 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.
///
/// For multicast endpoints, the device named by `dev` must have been added to the multicast team via [`cuLogicalEndpointAddDevice`].
///
/// For unicast endpoints the device named by `dev` must be the owner device specified during [`cuLogicalEndpointCreate`] via ::CUlogicalEndpointProp::unicast::device.
///
/// Externally shareable as well as imported multicast endpoints can be bound only to externally shareable memory. Imported unicast endpoints cannot be bound to any memory.
///
/// This call will return [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] if [`cuLogicalEndpointQuery`] has not been called for the logical endpoint to ensure that the endpoint is ready for memory binding.
///
/// Note that this call will return [`cudaError_enum::CUDA_ERROR_OUT_OF_MEMORY`] if there are insufficient resources required to perform the bind. This call may also return [`cudaError_enum::CUDA_ERROR_SYSTEM_NOT_READY`] if the necessary system software is not initialized or running. This call may return [`cudaError_enum::CUDA_ERROR_ILLEGAL_STATE`] if the system configuration is in an illegal state. In such cases, to continue using logical endpoints, verify that the system configuration is in a valid state and all required driver daemons are running properly.
///
/// # Parameters
///
/// - `leId`: Logical endpoint to which memory will be associated.
/// - `dev`: Device on which the memory will be bound to the logical endpoint.
/// - `offset`: Offset into the logical endpoint space.
/// - `memHandle`: Handle representing a memory allocation.
/// - `memOffset`: Offset into the memory for the attachment.
/// - `size`: Size of memory that will be bound to the logical endpoint.
/// - `flags`: Flags for future use, must be zero for now.
pub fn cuLogicalEndpointBindMem(
leId: CUlogicalEndpointId,
dev: CUdevice,
offset: cuuint64_t,
memHandle: CUmemGenericAllocationHandle,
memOffset: cuuint64_t,
size: cuuint64_t,
flags: ::core::ffi::c_ulonglong,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Unbinds any binding at offset from the logical endpoint.
///
/// Unbinds any memory allocations bound to the logical endpoint on `dev` at `offset` and up to the given `size`. The intended `size` of the unbind and the offset in the logical endpoint range `offset` must be multiples of the value for `bindAlignment` as returned by [`cuLogicalEndpointGetLimits`].
///
/// # Parameters
///
/// - `leId`: Logical endpoint id representing a logical endpoint.
/// - `dev`: Device on which the memory is bound to the logical endpoint.
/// - `offset`: Offset into the logical endpoint.
/// - `size`: Desired size to unbind.
pub fn cuLogicalEndpointUnbind(
leId: CUlogicalEndpointId,
dev: CUdevice,
offset: cuuint64_t,
size: cuuint64_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Exports a logical endpoint associated with leId to an IPC handle.
///
/// Given a logical endpoint id `leId`, create a shareable handle `handle` that can be used to share the logical endpoint with other processes. The recipient process can convert the shareable handle back into a logical endpoint id using [`cuLogicalEndpointImport`]. The implementation of what this `handle` is and how it can be transfered is defined by the requested handle type in `handletype`.
///
/// # Parameters
///
/// - `handle`: Pointer to the location in which to store the requested handle type.
/// - `leId`: Logical endpoint id of logical endpoint.
/// - `handleType`: Type of shareable handle requested. Defines type and size of the handle output parameter.
pub fn cuLogicalEndpointExport(
handle: *mut ::core::ffi::c_void,
leId: CUlogicalEndpointId,
handleType: CUlogicalEndpointIpcHandleType,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Imports a logical endpoint from the given IPC handle and associates it with a logical endpoint id.
///
/// Imports a logical endpoint from the given IPC `handle` and associates it with the logical endpoint id specified by `leId`.
///
/// If the current process cannot support the logical endpoint described by the shareable handle, this API will error as [`cudaError_enum::CUDA_ERROR_NOT_SUPPORTED`]. If `handle` is of type [`CUlogicalEndpointIpcHandleType::CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_FABRIC`] and the importer process does not have access permissions, then [`cudaError_enum::CUDA_ERROR_NOT_PERMITTED`] will be returned.
///
/// # Parameters
///
/// - `leId`: Logical endpoint id that will be used to access the exported logical endpoint.
/// - `handle`: Shareable handle representing the logical endpoint that is to be imported.
/// - `handleType`: Handle type of the exported handle.
pub fn cuLogicalEndpointImport(
leId: CUlogicalEndpointId,
handle: *const ::core::ffi::c_void,
handleType: CUlogicalEndpointIpcHandleType,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Calculates the minimum alignment and the maximum size for the given logical endpoint properties.
///
/// The `bindAlignment` can be used as a multiple for size and bind offset values. The `maxSize` is the maximum size of the logical endpoint. If `maxSize` is less than [CUlogicalEndpointProp](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUlogicalEndpointProp.html#structculogicalendpointprop):size the user must adjust the request to the smaller value.
///
/// # Parameters
///
/// - `bindAlignment`: Minimum alignment granularity of the proposed logical endpoint.
/// - `maxSize`: Maximum size of the logical endpoint.
/// - `prop`: Properties of the logical endpoint.
pub fn cuLogicalEndpointGetLimits(
bindAlignment: *mut cuuint64_t,
maxSize: *mut cuuint64_t,
prop: *const CUlogicalEndpointProp,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Determines if all logical endpoints in the range have been successfully constructed.
///
/// Queries the driver to determine if all logical endpoints in the given range starting at `leId` and extending for `count` have been successfully constructed.
///
/// Provides a mechanism to ensure that it is safe to begin using a logical endpoint ID. Using a logical endpoint ID before verifying that it is fully constructed can result in undefined behavior.
///
/// This is not a blocking API, it returns immediately with a `queryStatus` of 0 if any logical endpoint ID in the given range is not fully constructed, and a non-zero value otherwise.
///
/// Construction of a multicast logical endpoint may fail here if the devices added via [`cuLogicalEndpointAddDevice`] do not belong to the same clique.
///
/// This API may return [`cudaError_enum::CUDA_ERROR_ILLEGAL_STATE`] if no devices are found on which this logical endpoint can be accessed.
///
/// # Parameters
///
/// - `leId`: First logical endpoint ID to be queried.
/// - `count`: Number of logical endpoints IDs to be queried.
/// - `queryStatus`: Status of the logical endpoints. Returns 0 if any logical endpoint in the given range is not fully constructed, and non-zero if all logical endpoints in the given range are fully constructed.
pub fn cuLogicalEndpointQuery(
leId: CUlogicalEndpointId,
count: cuuint32_t,
queryStatus: *mut ::core::ffi::c_int,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns information about a pointer.
///
/// The supported attributes are:
///
/// Note that for most allocations in the unified virtual address space the host and device pointer for accessing the allocation will be the same. The exceptions to this are.
///
/// # Parameters
///
/// - `data`: Returned pointer attribute value.
/// - `attribute`: Pointer attribute to query.
/// - `ptr`: Pointer.
pub fn cuPointerGetAttribute(
data: *mut ::core::ffi::c_void,
attribute: CUpointer_attribute,
ptr: CUdeviceptr,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Prefetches memory to the specified destination location
///
/// 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.
///
/// Specifying ::CU_MEM_LOCATION_TYPE_DEVICE for ::CUmemLocation::type will prefetch memory to GPU specified by device ordinal ::CUmemLocation::id which must have non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. Additionally, `hStream` must be associated with a device that has a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. Specifying ::CU_MEM_LOCATION_TYPE_HOST as ::CUmemLocation::type will prefetch data to host memory. Applications can request prefetching memory to a specific host NUMA node by specifying ::CU_MEM_LOCATION_TYPE_HOST_NUMA for ::CUmemLocation::type and a valid host NUMA node id in ::CUmemLocation::id Users can also request prefetching memory to the host NUMA node closest to the current thread's CPU by specifying ::CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT for ::CUmemLocation::type. Note when ::CUmemLocation::type is etiher ::CU_MEM_LOCATION_TYPE_HOST OR ::CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT, ::CUmemLocation::id will be ignored. Prefetching to ::CU_MEM_LOCATION_TYPE_DEVICE_LOCALITY_DOMAIN locations is not supported.
///
/// The start address and end address of the memory range will be rounded down and rounded up respectively to be aligned to CPU page size before the prefetch operation is enqueued in the stream.
///
/// If no physical memory has been allocated for this region, then this memory region will be populated and mapped on the destination device. If there's insufficient memory to prefetch the desired region, the Unified Memory driver may evict pages from other ::cuMemAllocManaged allocations to host memory in order to make room. Device memory allocated using ::cuMemAlloc or ::cuArrayCreate will not be evicted.
///
/// By default, any mappings to the previous location of the migrated pages are removed and mappings for the new location are only setup on the destination location. The exact behavior however also depends on the settings applied to this memory range via ::cuMemAdvise as described below:
///
/// If ::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. If however the destination location is a host NUMA node, then any pages of that subset that are already in another host NUMA node will be transferred to the destination.
///
/// If ::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.
///
/// If ::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 to refer to the new location if establishing such a mapping is possible. Otherwise, those mappings are cleared.
///
/// Note that this API is not required for functionality and only serves to improve performance by allowing the application to migrate data to a suitable location before it is accessed. Memory accesses to this range are always coherent and are allowed even when the data is actively being migrated.
///
/// Note that this function is asynchronous with respect to the host and all work on other devices.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_DEVICE, ::CUDA_ERROR_NOT_SUPPORTED,
///
/// Note: _async
///
/// Note: _null_stream
///
///
///
/// See also: ::cuMemcpy, ::cuMemcpyPeer, ::cuMemcpyAsync, ::cuMemcpy3DPeerAsync, ::cuMemAdvise, ::cudaMemPrefetchAsync
///
/// # Parameters
///
/// - `devPtr`: - Pointer to be prefetched
/// - `count`: - Size in bytes
/// - `location`: - Location to prefetch to
/// - `flags`: - flags for future use, must be zero now.
/// - `hStream`: - Stream to enqueue prefetch operation
pub fn cuMemPrefetchAsync_v2(
devPtr: CUdeviceptr,
count: size_t,
location: CUmemLocation,
flags: ::core::ffi::c_uint,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Advise about the usage of a given memory range
///
/// 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 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 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 returned.
///
/// The `advice` parameter can take the following values:
/// - ::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 processor to this region will create a read-only copy of at least the accessed pages in that processor's memory. Additionally, if ::cuMemPrefetchAsync is called on this region, it will create a read-only copy of the data on the destination processor. If the target location for ::cuMemPrefetchAsync 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 host NUMA node. If any processor writes to this region, all copies of the corresponding page will be invalidated except for the one where the write occurred. If the writing processor is the CPU and the preferred location of the page is a host NUMA 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 CPU or a GPU that has a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. Also, if a context is created on a device that does not have the device attribute ::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 pageable memory, then the accessing device must have a non-zero value for the device attribute ::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 the device attribute ::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.
///
/// - ::CU_MEM_ADVISE_UNSET_READ_MOSTLY: Undoes the effect of ::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 copies of the data will be collapsed into a single copy. The location for the collapsed copy will be the preferred location if the page has a preferred location and one of the read-duplicated copies was resident at that location. Otherwise, the location chosen is arbitrary. Note: The `location` argument is ignored for this advice.
///
/// - ::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 is ::CU_MEM_LOCATION_TYPE_HOST, ::CUmemLocation::id is ignored and the preferred location is set to be host memory. To set the preferred location to a specific host NUMA node, applications must set ::CUmemLocation::type to ::CU_MEM_LOCATION_TYPE_HOST_NUMA and ::CUmemLocation::id must specify the NUMA ID of the host NUMA node. If ::CUmemLocation::type is set to ::CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT, ::CUmemLocation::id will be ignored and the the host NUMA node closest to the calling thread's CPU will be used as the preferred location. If ::CUmemLocation::type is a ::CU_MEM_LOCATION_TYPE_DEVICE, then ::CUmemLocation::id must be a valid device ordinal and the device must have a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. A ::CUmemLocation::type of ::CU_MEM_LOCATION_TYPE_DEVICE_LOCALITY_DOMAIN is unsupported. Setting the preferred location does not cause data to migrate to that location immediately. Instead, it guides the migration policy when a fault occurs on that memory region. If the data is already in its preferred location and the faulting processor can establish a mapping without requiring the data to be migrated, then data migration will be avoided. On the other hand, if the data is not in its preferred location or if a direct mapping cannot be established, then it will be migrated to the processor accessing it. It is important to note that setting the preferred location does not prevent data prefetching done using ::cuMemPrefetchAsync. Having a preferred location can override the page thrash detection and resolution logic in the Unified Memory driver. Normally, if a page is detected to be constantly thrashing between for example host and device memory, the page may eventually be pinned to host memory by the Unified Memory driver. But if the preferred location is set as device memory, then the page will continue to thrash indefinitely. If ::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 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 ::CU_MEM_ADVISE_SET_READ_MOSTLY. If the memory region refers to valid system-allocated pageable memory, and ::CUmemLocation::type is CU_MEM_LOCATION_TYPE_DEVICE then ::CUmemLocation::id must be a valid device that has a non-zero alue for the device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS.
///
/// - ::CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION: Undoes the effect of ::CU_MEM_ADVISE_SET_PREFERRED_LOCATION and changes the preferred location to none. The `location` argument is ignored for this advice.
///
/// - ::CU_MEM_ADVISE_SET_ACCESSED_BY: This advice implies that the data will be accessed by processor `location`. The ::CUmemLocation::type must be either ::CU_MEM_LOCATION_TYPE_DEVICE with ::CUmemLocation::id representing a valid device ordinal or ::CU_MEM_LOCATION_TYPE_HOST and ::CUmemLocation::id will be ignored. All other location types are invalid. If ::CUmemLocation::id is a GPU, then the device attribute ::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, it causes the data to always be mapped in the specified processor's page tables, as long as the location of the data permits a mapping to be established. If the data gets migrated for any reason, the mappings are updated accordingly. This advice is recommended in scenarios where data locality is not important, but avoiding faults is. Consider for example a system containing multiple GPUs with peer-to-peer access enabled, where the data located on one GPU is occasionally accessed by peer GPUs. In such scenarios, migrating data over to the other GPUs is not as important because the accesses are infrequent and the overhead of migration may be too high. But preventing faults can still help improve performance, and so having a mapping set up in advance is useful. Note that on CPU access of this data, the data may be migrated to host memory because the CPU typically cannot access device memory directly. Any GPU that had the ::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 ::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 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 ::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 is ::CU_MEM_LOCATION_TYPE_DEVICE then device in ::CUmemLocation::id must have a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS. Additionally, if ::CUmemLocation::id has a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES, then this call has no effect.
///
/// - ::CU_MEM_ADVISE_UNSET_ACCESSED_BY: Undoes the effect of ::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 pageable memory, and ::CUmemLocation::type is ::CU_MEM_LOCATION_TYPE_DEVICE then device in ::CUmemLocation::id must have a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS. Additionally, if ::CUmemLocation::id has a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES, then this call has no effect.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_DEVICE, ::CUDA_ERROR_NOT_SUPPORTED
///
/// Note: _async
///
/// Note: _null_stream
///
///
///
/// See also: ::cuMemcpy, ::cuMemcpyPeer, ::cuMemcpyAsync, ::cuMemcpy3DPeerAsync, ::cuMemPrefetchAsync, ::cudaMemAdvise
///
/// # Parameters
///
/// - `devPtr`: - Pointer to memory to set the advice for
/// - `count`: - Size in bytes of the memory range
/// - `advice`: - Advice to be applied for the specified memory range
/// - `location`: - location to apply the advice for
pub fn cuMemAdvise_v2(
devPtr: CUdeviceptr,
count: size_t,
advice: CUmem_advise,
location: CUmemLocation,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Performs a batch of memory prefetches asynchronously.
///
/// Performs a batch of memory prefetches. The batch as a whole executes in stream order but operations within a batch are not guaranteed 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.
///
/// The semantics of the individual prefetch operations are as described in cuMemPrefetchAsync.
///
/// 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 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 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`.
///
/// # Parameters
///
/// - `dptrs`: Array of pointers to be prefetched.
/// - `sizes`: Array of sizes for memory prefetch operations.
/// - `count`: Size of `dptrs` and `sizes` arrays.
/// - `prefetchLocs`: Array of locations to prefetch to.
/// - `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 prefetchLocIdxs\[k+1\] - 1. Also prefetchLocs\[numPrefetchLocs - 1\] will apply to prefetches starting from prefetchLocIdxs\[numPrefetchLocs - 1\] through count - 1.
/// - `numPrefetchLocs`: Size of `prefetchLocs` and `prefetchLocIdxs` arrays.
/// - `flags`: Flags reserved for future use. Must be zero.
/// - `hStream`: The stream to enqueue the operations in. Must not be legacy NULL stream.
pub fn cuMemPrefetchBatchAsync(
dptrs: *mut CUdeviceptr,
sizes: *mut size_t,
count: size_t,
prefetchLocs: *mut CUmemLocation,
prefetchLocIdxs: *mut size_t,
numPrefetchLocs: size_t,
flags: ::core::ffi::c_ulonglong,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Performs a batch of memory discards asynchronously.
///
/// Performs a batch of memory discards. The batch as a whole executes in stream order but operations within a batch are not guaranteed 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.
///
/// Discarding a memory range informs the driver that the contents of that range are no longer useful. Discarding memory ranges allows the driver to optimize certain data migrations and can also help reduce memory pressure. This operation can be undone on any part of the range by either writing to it or prefetching it via cuMemPrefetchAsync or cuMemPrefetchBatchAsync. Reading from a discarded range, without a subsequent write or prefetch to that part of the range, will return an indeterminate value. Note that any reads, writes or prefetches to any part of the memory range that occur simultaneously with the discard operation result in undefined behavior.
///
/// 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 for [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`].
///
/// # Parameters
///
/// - `dptrs`: Array of pointers to be discarded.
/// - `sizes`: Array of sizes for memory discard operations.
/// - `count`: Size of `dptrs` and `sizes` arrays.
/// - `flags`: Flags reserved for future use. Must be zero.
/// - `hStream`: The stream to enqueue the operations in. Must not be legacy NULL stream.
pub fn cuMemDiscardBatchAsync(
dptrs: *mut CUdeviceptr,
sizes: *mut size_t,
count: size_t,
flags: ::core::ffi::c_ulonglong,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Performs a batch of memory discards and prefetches asynchronously.
///
/// Performs a batch of memory discards followed by prefetches. The batch as a whole executes in stream order but operations within a batch are not guaranteed 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.
///
/// 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 combined discard+prefetch operation result in undefined behavior.
///
/// 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 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 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 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`.
///
/// # Parameters
///
/// - `dptrs`: Array of pointers to be discarded.
/// - `sizes`: Array of sizes for memory discard operations.
/// - `count`: Size of `dptrs` and `sizes` arrays.
/// - `prefetchLocs`: Array of locations to prefetch to.
/// - `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\] through prefetchLocIdxs\[k+1\] - 1. Also prefetchLocs\[numPrefetchLocs - 1\] will apply to copies starting from prefetchLocIdxs\[numPrefetchLocs - 1\] through count - 1.
/// - `numPrefetchLocs`: Size of `prefetchLocs` and `prefetchLocIdxs` arrays.
/// - `flags`: Flags reserved for future use. Must be zero.
/// - `hStream`: The stream to enqueue the operations in. Must not be legacy NULL stream.
pub fn cuMemDiscardAndPrefetchBatchAsync(
dptrs: *mut CUdeviceptr,
sizes: *mut size_t,
count: size_t,
prefetchLocs: *mut CUmemLocation,
prefetchLocIdxs: *mut size_t,
numPrefetchLocs: size_t,
flags: ::core::ffi::c_ulonglong,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets residency information for a memory address range.
///
/// Retrieves memory location information for the specified address range starting at `ptr` with size `size`. The API summarizes the location information with a granularity specified by `summaryGranularity`. For each summary region, the API determines the most common location by sampling memory at intervals defined by `samplingGranularity` within that region.
///
/// The location information is returned in the `location_out` array, with one entry per summary region. The total number of locations returned will be ceil(size/summaryGranularity). The user is expected to allocate the `location_out` array with sufficient memory.
///
/// For example, with an address range of 1GB, a `summaryGranularity` of 128MB, and a `samplingGranularity` of 2MB, the function will:
///
/// When the memory is not resident on any processor, the call returns [`cudaError_enum::CUDA_SUCCESS`] and the returned location type for that interval is [`CUmemLocationType_enum::CU_MEM_LOCATION_TYPE_NONE`].
///
/// The memory range must refer to one of the following:
///
/// All devices on the system must have non-zero value of device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`]. If not, this call returns [`cudaError_enum::CUDA_ERROR_NOT_SUPPORTED`].
///
/// # Parameters
///
/// - `ptr`: Starting address of the memory range to query.
/// - `size`: Size in bytes of the memory range to query.
/// - `summaryGranularity`: Granularity in bytes at which to summarize location information.
/// - `samplingGranularity`: Granularity in bytes at which to sample memory within each summary region.
/// - `location_out`: Array to store location information, one entry per summary region.
pub fn cuMemGetLocationInfo(
ptr: CUdeviceptr,
size: size_t,
summaryGranularity: size_t,
samplingGranularity: size_t,
location_out: *mut CUmemLocation,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Query an attribute of a given memory range.
///
/// 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.
///
/// The `attribute` parameter can take the following values.
///
/// # Parameters
///
/// - `data`: A pointers to a memory location where the result of each attribute query will be written to.
/// - `dataSize`: Array containing the size of data.
/// - `attribute`: The attribute to query.
/// - `devPtr`: Start of the range to query.
/// - `count`: Size of the range to query.
pub fn cuMemRangeGetAttribute(
data: *mut ::core::ffi::c_void,
dataSize: size_t,
attribute: CUmem_range_attribute,
devPtr: CUdeviceptr,
count: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Query attributes of a given memory range.
///
/// 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`.
///
/// The list of supported attributes are given below. Please refer to [`cuMemRangeGetAttribute`] for attribute descriptions and restrictions.
///
/// # Parameters
///
/// - `data`: A two-dimensional array containing pointers to memory locations where the result of each attribute query will be written to.
/// - `dataSizes`: Array containing the sizes of each result.
/// - `attributes`: An array of attributes to query (numAttributes and the number of attributes in this array should match).
/// - `numAttributes`: Number of attributes to query.
/// - `devPtr`: Start of the range to query.
/// - `count`: Size of the range to query.
pub fn cuMemRangeGetAttributes(
data: *mut *mut ::core::ffi::c_void,
dataSizes: *mut size_t,
attributes: *mut CUmem_range_attribute,
numAttributes: size_t,
devPtr: CUdeviceptr,
count: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Set attributes on a previously allocated memory region.
///
/// The supported attributes are.
///
/// # Parameters
///
/// - `value`: Pointer to memory containing the value to be set.
/// - `attribute`: Pointer attribute to set.
/// - `ptr`: Pointer to a memory region allocated using CUDA memory allocation APIs.
pub fn cuPointerSetAttribute(
value: *const ::core::ffi::c_void,
attribute: CUpointer_attribute,
ptr: CUdeviceptr,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns information about a pointer.
///
/// The supported attributes are (refer to [`cuPointerGetAttribute`] for attribute descriptions and restrictions):
///
/// 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.
///
/// 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.
///
/// # Parameters
///
/// - `numAttributes`: Number of attributes to query.
/// - `attributes`: An array of attributes to query (numAttributes and the number of attributes in this array should match).
/// - `data`: A two-dimensional array containing pointers to memory locations where the result of each attribute query will be written to.
/// - `ptr`: Pointer to query.
pub fn cuPointerGetAttributes(
numAttributes: ::core::ffi::c_uint,
attributes: *mut CUpointer_attribute,
data: *mut *mut ::core::ffi::c_void,
ptr: CUdeviceptr,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Create a stream.
///
/// Creates a stream and returns a handle in `phStream`. The `Flags` argument determines behaviors of the stream.
///
/// Valid values for `Flags` are.
///
/// # Parameters
///
/// - `phStream`: Returned newly created stream.
/// - `Flags`: Parameters for stream creation.
pub fn cuStreamCreate(
phStream: *mut CUstream,
Flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Create a stream with the given priority.
///
/// 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 priority 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 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.
///
/// # Parameters
///
/// - `phStream`: Returned newly created stream.
/// - `flags`: Flags for stream creation. See [`cuStreamCreate`] for a list of valid flags.
/// - `priority`: Stream priority. Lower numbers represent higher priorities. See [`cuCtxGetStreamPriorityRange`] for more information about meaningful stream priorities that can be passed.
pub fn cuStreamCreateWithPriority(
phStream: *mut CUstream,
flags: ::core::ffi::c_uint,
priority: ::core::ffi::c_int,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Begins capture to CIG on a stream.
///
/// Support for CIG streams with D3D12 can be determined using [`cuDeviceGetAttribute`] with [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_D3D12_CIG_STREAMS_SUPPORTED`].
///
/// 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 into a graphics API command list/command buffer. All kernel launches and memory copy/memory set operations on the CIG stream will be recorded. When the command list is executed by the graphics API, all the stream’s operations will execute in order along with other graphics API commands in the command list.
///
/// 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 the stream is not already in CIG capture mode.
///
/// 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.
///
/// 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 launched on the stream. The command list provided must belong to the graphics API device that the CIG context was created with, otherwise the behavior will be undefined.
///
/// The stream object may not be destroyed until its associated command list has finished executing on the GPU. The command list/command buffer used for capture may not be submitted for execution before a call to cuStreamEndCaptureToCig is made on the associated stream.
///
/// Graphics resources to be accessed by work recorded on the CIG stream must use UAV barriers on the command list prior to recording work that accesses them on the stream.
///
/// Resubmission of the same recorded command list is not allowed. Further more, care must be taken for the order of execution of the recorded CUDA work with regards to other CUDA work submitted under the same CIG context. Out-of-order execution can lead to device hangs or exceptions.
///
/// CIG capture mode operates similarly to [`cuStreamBeginCapture_v2`] 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 streams whether directly or indirectly via a recorded graph launch: [`cuLaunchHostFunc`] [`cuStreamAddCallback`] [`cuStreamSynchronize`] cuStreamWaitValue32 cuStreamWaitValue64 cuStreamBatchMemOp cuStreamBeginCapture [`cuStreamBeginCaptureToGraph`] [`cuMemAllocAsync`] [`cuMemFreeAsync`].
///
/// # Parameters
///
/// - `hStream`: Stream in which to initiate capture to CIG.
/// - `streamCigCaptureParams`: CIG capture parameters.
pub fn cuStreamBeginCaptureToCig(
hStream: CUstream,
streamCigCaptureParams: *mut CUstreamCigCaptureParams,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Ends CIG capture on a stream.
///
/// 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 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 of the command list is fully done on the GPU. This requirements extends also to all streams dependent on the CIG stream (e.g. via event waits).
///
/// # Parameters
///
/// - `hStream`: - Stream to end CIG capture
pub fn cuStreamEndCaptureToCig(hStream: CUstream) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Query the priority of a given stream.
///
/// 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.
///
/// # Parameters
///
/// - `hStream`: Handle to the stream to be queried.
/// - `priority`: Pointer to a signed integer in which the stream’s priority is returned.
pub fn cuStreamGetPriority(
hStream: CUstream,
priority: *mut ::core::ffi::c_int,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the device handle of the stream.
///
/// Returns in `*device` the device handle of the stream.
///
/// # Parameters
///
/// - `hStream`: Handle to the stream to be queried.
/// - `device`: Returns the device to which a stream belongs.
pub fn cuStreamGetDevice(hStream: CUstream, device: *mut CUdevice) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Query the flags of a given stream.
///
/// Query the flags of a stream created using [`cuStreamCreate`], [`cuStreamCreateWithPriority`] or [`cuGreenCtxStreamCreate`] and return the flags in `flags`.
///
/// # Parameters
///
/// - `hStream`: Handle to the stream to be queried.
/// - `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.
pub fn cuStreamGetFlags(
hStream: CUstream,
flags: *mut ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the unique Id associated with the stream handle supplied.
///
/// Returns in `streamId` the unique Id which is associated with the given stream handle. The Id is unique for the life of the program.
///
/// The stream handle `hStream` can refer to any of the following.
///
/// # Parameters
///
/// - `hStream`: Handle to the stream to be queried.
/// - `streamId`: Pointer to store the Id of the stream.
pub fn cuStreamGetId(
hStream: CUstream,
streamId: *mut ::core::ffi::c_ulonglong,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Query the context associated with a stream.
///
/// Returns the CUDA context that the stream is associated with.
///
/// 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.
///
/// The stream handle `hStream` can refer to any of the following.
///
/// # Parameters
///
/// - `hStream`: Handle to the stream to be queried.
/// - `pctx`: Returned context associated with the stream.
pub fn cuStreamGetCtx(hStream: CUstream, pctx: *mut CUcontext) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Query the contexts associated with a stream.
///
/// Returns the contexts that the stream is associated with.
///
/// 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`.
///
/// If the stream is associated with a regular context, the API returns the regular context in `pCtx` and NULL in `pGreenCtx`.
///
/// The stream handle `hStream` can refer to any of the following.
///
/// # Parameters
///
/// - `hStream`: Handle to the stream to be queried.
/// - `pCtx`: Returned regular context associated with the stream.
/// - `pGreenCtx`: Returned green context if the stream is associated with a green context or NULL if not.
pub fn cuStreamGetCtx_v2(
hStream: CUstream,
pCtx: *mut CUcontext,
pGreenCtx: *mut CUgreenCtx,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Make a compute stream wait on an event.
///
/// 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. `hEvent` may be from a different context or device than `hStream`.
///
/// flags include.
///
/// # Parameters
///
/// - `hStream`: Stream to wait.
/// - `hEvent`: Event to wait on (may not be NULL).
/// - `Flags`: See ::CUevent_capture_flags.
pub fn cuStreamWaitEvent(
hStream: CUstream,
hEvent: CUevent,
Flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Add a callback to a compute stream.
///
/// Adds a callback to be called on the host after all currently enqueued items in the stream have completed. For each cuStreamAddCallback call, the callback will be executed exactly once. The callback will block later work in the stream until it is finished.
///
/// 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](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gac6c391505e117393cc2558fff6bfc2e9).
///
/// 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 mandated to run earlier. Callbacks without a mandated order (in independent streams) execute in undefined order and may be serialized.
///
/// For the purposes of Unified Memory, callback execution makes a number of guarantees.
///
/// # Parameters
///
/// - `hStream`: Stream to add callback to.
/// - `callback`: The function to call once preceding stream operations are complete.
/// - `userData`: User specified data to be passed to the callback function.
/// - `flags`: Reserved for future use, must be 0.
pub fn cuStreamAddCallback(
hStream: CUstream,
callback: CUstreamCallback,
userData: *mut ::core::ffi::c_void,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Begins graph capture on a stream
///
/// 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 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 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.
///
/// If `mode` is not ::CU_STREAM_CAPTURE_MODE_RELAXED, ::cuStreamEndCapture must be called on this stream from the same thread.
///
///
///
///
///
/// Note: Kernels captured using this API must not use texture and surface references. Reading or writing through any texture or surface reference is undefined behavior. This restriction does not apply to texture and surface objects.
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_VALUE
///
///
///
/// See also: ::cuStreamCreate, ::cuStreamIsCapturing, ::cuStreamEndCapture, ::cuThreadExchangeStreamCaptureMode
///
/// # Parameters
///
/// - `hStream`: - Stream in which to initiate capture
/// - `mode`: - Controls the interaction of this capture sequence with other API calls that are potentially unsafe. For more details see ::cuThreadExchangeStreamCaptureMode.
pub fn cuStreamBeginCapture_v2(
hStream: CUstream,
mode: CUstreamCaptureMode,
) -> CUresult;
}
impl CUgraphRecaptureStatus_enum {
/// Node is eligible for update in an instantiated graph.
pub const CU_GRAPH_RECAPTURE_ELIGIBLE_FOR_UPDATE: CUgraphRecaptureStatus_enum = CUgraphRecaptureStatus_enum(
0,
);
/// Parameter changes in the node cannot be applied to an instantiated graph.
pub const CU_GRAPH_RECAPTURE_INELIGIBLE_FOR_UPDATE: CUgraphRecaptureStatus_enum = CUgraphRecaptureStatus_enum(
1,
);
/// Error while attempting to recapture the node.
///
/// The recapture will be ended regardless of the return value from the callback.
pub const CU_GRAPH_RECAPTURE_ERROR: CUgraphRecaptureStatus_enum = CUgraphRecaptureStatus_enum(
2,
);
}
/// Whether a recaptured node can update an existing executable graph, or encountered an error.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUgraphRecaptureStatus_enum(pub ::core::ffi::c_uint);
pub use self::CUgraphRecaptureStatus_enum as CUgraphRecaptureStatus;
/// Callback function invoked when node parameter mismatches are detected while recapturing to an existing graph.
///
/// Parameter struct pointers are only valid within the callback.
pub type CUgraphRecaptureCallback = ::core::option::Option<
unsafe extern "C" fn(
data: *mut ::core::ffi::c_void,
node: CUgraphNode,
originalParams: *const CUgraphNodeParams,
recaptureParams: *const CUgraphNodeParams,
status: CUgraphRecaptureStatus,
) -> CUresult,
>;
singe_loader::functions! { crate::DRIVER;
/// Begin graph capture on a stream to an existing graph.
///
/// 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 for:
///
/// 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`].
///
/// If the recapture fails for any reason, the `graph` will be in an undefined state and should be destroyed.
///
/// See cuStreamBeginCapture for additional detail on beginning the capture.
///
/// # Parameters
///
/// - `hStream`: Stream in which to initiate capture.
/// - `mode`: Controls the interaction of this capture sequence with other API calls that are potentially unsafe. For more details see [`cuThreadExchangeStreamCaptureMode`].
/// - `hGraph`: Existing CUDA graph to be captured into.
/// - `callbackFunc`: Function that will be called for all parameter mismatches from the original graph.
/// - `userData`: A generic pointer to user data that is passed into the callback function.
pub fn cuStreamBeginRecaptureToGraph(
hStream: CUstream,
mode: CUstreamCaptureMode,
hGraph: CUgraph,
callbackFunc: CUgraphRecaptureCallback,
userData: *mut ::core::ffi::c_void,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Begins graph capture on a stream to an existing graph.
///
/// 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 be executed, but will instead be captured into `hGraph`. The graph will not be instantiable until the user calls [`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 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.
///
/// If `mode` is not [`CUstreamCaptureMode::CU_STREAM_CAPTURE_MODE_RELAXED`], [`cuStreamEndCapture`] must be called on this stream from the same thread.
///
/// # Parameters
///
/// - `hStream`: Stream in which to initiate capture.
/// - `hGraph`: Graph to capture into.
/// - `dependencies`: Dependencies of the first node captured in the stream. Can be NULL if numDependencies is 0.
/// - `dependencyData`: Optional array of data associated with each dependency.
/// - `numDependencies`: Number of dependencies.
/// - `mode`: Controls the interaction of this capture sequence with other API calls that are potentially unsafe. For more details see [`cuThreadExchangeStreamCaptureMode`].
pub fn cuStreamBeginCaptureToGraph(
hStream: CUstream,
hGraph: CUgraph,
dependencies: *const CUgraphNode,
dependencyData: *const CUgraphEdgeData,
numDependencies: size_t,
mode: CUstreamCaptureMode,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Swaps the stream capture interaction mode for a thread.
///
/// 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 are encouraged to use this API in a push-pop fashion:
///
/// During stream capture (see cuStreamBeginCapture), some actions, such as a call to ::cudaMalloc, may be unsafe. In the case of ::cudaMalloc, the operation is not enqueued asynchronously to a stream, and is not observed by stream capture. Therefore, if the sequence of operations captured via cuStreamBeginCapture depended on the allocation being replayed whenever the graph is launched, the captured graph would be invalid.
///
/// Therefore, stream capture places restrictions on API calls that can be made within or concurrently to a cuStreamBeginCapture-[`cuStreamEndCapture`] sequence. This behavior can be controlled via this API and flags to cuStreamBeginCapture.
///
/// A thread’s mode is one of the following.
///
/// # Parameters
///
/// - `mode`: - Pointer to mode value to swap with the current mode
pub fn cuThreadExchangeStreamCaptureMode(mode: *mut CUstreamCaptureMode) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Ends capture on a stream, returning the captured graph.
///
/// End capture on `hStream`, returning the captured graph via `phGraph`. Capture must have been initiated on `hStream` via a call to cuStreamBeginCapture. If capture was invalidated, due to a violation of the rules of stream capture, then a NULL graph will be returned.
///
/// If the `mode` argument to cuStreamBeginCapture was not [`CUstreamCaptureMode::CU_STREAM_CAPTURE_MODE_RELAXED`], this call must be from the same thread as cuStreamBeginCapture.
///
/// # Parameters
///
/// - `hStream`: Stream to query.
/// - `phGraph`: The captured graph.
pub fn cuStreamEndCapture(hStream: CUstream, phGraph: *mut CUgraph) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a stream’s capture status.
///
/// Return the capture status of `hStream` via `captureStatus`. After a successful call, `*captureStatus` will contain one of the following:
///
/// Note that, if this is called on [CU_STREAM_LEGACY](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gaa53e8210837f039dd6434a3a4c3324aa) (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.
///
/// When a blocking stream is capturing, the legacy stream is in an unusable state until the blocking stream capture is terminated. The legacy stream is not supported for stream capture, but attempted use would have an implicit dependency on the capturing stream(s).
///
/// # Parameters
///
/// - `hStream`: Stream to query.
/// - `captureStatus`: Returns the stream’s capture status.
pub fn cuStreamIsCapturing(
hStream: CUstream,
captureStatus: *mut CUstreamCaptureStatus,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Query a stream's capture state
///
/// Query stream state related to stream capture.
///
/// If called on ::CU_STREAM_LEGACY (the "null stream") while a stream not created with ::CU_STREAM_NON_BLOCKING is capturing, returns ::CUDA_ERROR_STREAM_CAPTURE_IMPLICIT.
///
/// Valid data (other than capture status) is returned only if both of the following are true:
/// - the call returns CUDA_SUCCESS
/// - the returned capture status is ::CU_STREAM_CAPTURE_STATUS_ACTIVE
///
/// 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 ::CUDA_ERROR_LOSSY_QUERY.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_STREAM_CAPTURE_IMPLICIT, ::CUDA_ERROR_LOSSY_QUERY
///
/// Note: _graph_thread_safety
///
///
///
/// See also: ::cuStreamBeginCapture, ::cuStreamIsCapturing, ::cuStreamUpdateCaptureDependencies
///
/// # Parameters
///
/// - `hStream`: - The stream to query
/// - `captureStatus_out`: - Location to return the capture status of the stream; required
/// - `id_out`: - Optional location to return an id for the capture sequence, which is unique over the lifetime of the process
/// - `graph_out`: - Optional location to return the graph being captured into. All operations other than destroy and node removal are permitted on the graph while the capture sequence is in progress. This API does not transfer ownership of the graph, which is transferred 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 from the original stream at ::cuStreamEndCapture due to direct actions on the graph do not trigger ::CUDA_ERROR_STREAM_CAPTURE_UNJOINED.
/// - `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 set of nodes, absent operations such as event wait which modify this set. The array pointer is valid until the next API call which operates on the stream or until the capture is terminated. The node handles may be copied out and are valid until they or the graph is destroyed. The driver-owned array may also be passed directly to APIs that operate on the graph (not the stream) without copying.
/// - `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.
/// - `numDependencies_out`: - Optional location to store the size of the array returned in dependencies_out.
pub fn cuStreamGetCaptureInfo_v3(
hStream: CUstream,
captureStatus_out: *mut CUstreamCaptureStatus,
id_out: *mut cuuint64_t,
graph_out: *mut CUgraph,
dependencies_out: *mut *const CUgraphNode,
edgeData_out: *mut *const CUgraphEdgeData,
numDependencies_out: *mut size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Update the set of dependencies in a capturing stream
///
/// Modifies the dependency set of a capturing stream. The dependency set is the set of nodes that the next captured node in the stream will depend on along with the edge data for those dependencies.
///
/// Valid flags are ::CU_STREAM_ADD_CAPTURE_DEPENDENCIES and ::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 to ::CU_STREAM_ADD_CAPTURE_DEPENDENCIES.
///
/// Nodes that are removed from the dependency set via this API do not result in ::CUDA_ERROR_STREAM_CAPTURE_UNJOINED if they are unreachable from the stream at ::cuStreamEndCapture.
///
/// Returns ::CUDA_ERROR_ILLEGAL_STATE if the stream is not capturing.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_ILLEGAL_STATE
///
///
///
/// See also: ::cuStreamBeginCapture, ::cuStreamGetCaptureInfo
///
/// # Parameters
///
/// - `hStream`: - The stream to update
/// - `dependencies`: - The set of dependencies to add
/// - `dependencyData`: - Optional array of data associated with each dependency.
/// - `numDependencies`: - The size of the dependencies array
/// - `flags`: - See above
pub fn cuStreamUpdateCaptureDependencies_v2(
hStream: CUstream,
dependencies: *mut CUgraphNode,
dependencyData: *const CUgraphEdgeData,
numDependencies: size_t,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Attach memory to a stream asynchronously.
///
/// 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 in stream has completed. Any previous association is automatically replaced.
///
/// `dptr` must point to one of the following types of memories:
///
/// 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 changed. Currently, it is not possible to change stream association for a portion of a managed allocation.
///
/// For pageable host allocations, `length` must be non-zero.
///
/// The stream association is specified using `flags` which must be one of [CUmemAttach_flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1ga17c5d5f9b585aa2d6f121847d1a78f4c). 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 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 stream. An error will be returned in this case.
///
/// When memory is associated with a single stream, the Unified Memory system will allow CPU access to this memory region so long as all operations in `hStream` have completed, regardless of whether other streams are active. In effect, this constrains exclusive ownership of the managed memory region by an active GPU to per-stream activity instead of whole-GPU activity.
///
/// Accessing memory on the device from streams that are not associated with it will produce undefined results. No error checking is performed by the Unified Memory system to ensure that kernels launched into other streams do not access this region.
///
/// 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 be changed appropriately for all kernels which follow a stream-association change.
///
/// If `hStream` is destroyed while data is associated with it, the association is removed and the association reverts to the default visibility 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 until all work in the stream has completed.
///
/// # Parameters
///
/// - `hStream`: Stream in which to enqueue the attach operation.
/// - `dptr`: Pointer to memory (must be a pointer to managed memory or to a valid host-accessible region of system-allocated pageable memory).
/// - `length`: Length of memory.
/// - `flags`: Must be one of [CUmemAttach_flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1ga17c5d5f9b585aa2d6f121847d1a78f4c).
pub fn cuStreamAttachMemAsync(
hStream: CUstream,
dptr: CUdeviceptr,
length: size_t,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Determine status of a compute stream.
///
/// 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.
///
/// For the purposes of Unified Memory, a return value of [`cudaError_enum::CUDA_SUCCESS`] is equivalent to having called [`cuStreamSynchronize`].
///
/// # Parameters
///
/// - `hStream`: - Stream to query status of
pub fn cuStreamQuery(hStream: CUstream) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Wait until a stream’s tasks are completed.
///
/// 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.
///
/// # Parameters
///
/// - `hStream`: - Stream to wait for
pub fn cuStreamSynchronize(hStream: CUstream) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Destroys a stream
///
/// Destroys the stream specified by `hStream`.
///
/// In case the device is still doing work in the stream `hStream` when ::cuStreamDestroy() 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`.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_HANDLE ::CUDA_ERROR_EXTERNAL_DEVICE
///
///
///
/// See also: ::cuStreamCreate, ::cuStreamWaitEvent, ::cuStreamQuery, ::cuStreamSynchronize, ::cuStreamAddCallback, ::cudaStreamDestroy
///
/// # Parameters
///
/// - `hStream`: - Stream to destroy
pub fn cuStreamDestroy_v2(hStream: CUstream) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies attributes from source stream to destination stream.
///
/// Copies attributes from source stream `src` to destination stream `dst`. Both streams must have the same context.
///
/// # Parameters
///
/// - `dst`: Destination stream.
/// - `src`: Source stream For list of attributes see CUstreamAttrID.
pub fn cuStreamCopyAttributes(dst: CUstream, src: CUstream) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Queries stream attribute.
///
/// Queries attribute `attr` from `hStream` and stores it in corresponding member of `value_out`.
pub fn cuStreamGetAttribute(
hStream: CUstream,
attr: CUstreamAttrID,
value_out: *mut CUstreamAttrValue,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets stream attribute.
///
/// 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 work.
pub fn cuStreamSetAttribute(
hStream: CUstream,
attr: CUstreamAttrID,
value: *const CUstreamAttrValue,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates an event.
///
/// Creates an event \*phEvent for the current context with the flags specified via `Flags`. Valid flags include.
///
/// # Parameters
///
/// - `phEvent`: Returns newly created event.
/// - `Flags`: Event creation flags.
pub fn cuEventCreate(phEvent: *mut CUevent, Flags: ::core::ffi::c_uint) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Records an event.
///
/// 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.
///
/// [`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`].
///
/// # Parameters
///
/// - `hEvent`: Event to record.
/// - `hStream`: Stream to record event for.
pub fn cuEventRecord(hEvent: CUevent, hStream: CUstream) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Records an event.
///
/// 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.
///
/// [`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`].
///
/// flags include.
///
/// # Parameters
///
/// - `hEvent`: Event to record.
/// - `hStream`: Stream to record event for.
/// - `flags`: See ::CUevent_capture_flags.
pub fn cuEventRecordWithFlags(
hEvent: CUevent,
hStream: CUstream,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Queries an event’s status.
///
/// Queries the status of all work currently captured by `hEvent`. See [`cuEventRecord`] for details on what is captured by an event.
///
/// 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.
///
/// For the purposes of Unified Memory, a return value of [`cudaError_enum::CUDA_SUCCESS`] is equivalent to having called [`cuEventSynchronize`].
///
/// # Parameters
///
/// - `hEvent`: - Event to query
pub fn cuEventQuery(hEvent: CUevent) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Waits for an event to complete.
///
/// Waits until the completion of all work currently captured in `hEvent`. See [`cuEventRecord`] for details on what is captured by an event.
///
/// 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.
///
/// # Parameters
///
/// - `hEvent`: - Event to wait for
pub fn cuEventSynchronize(hEvent: CUevent) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Destroys an event
///
/// Destroys the event specified by `hEvent`.
///
/// An event may be destroyed before it is complete (i.e., while ::cuEventQuery() would return ::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 asynchronously at completion.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_HANDLE
///
///
///
/// See also: ::cuEventCreate, ::cuEventRecord, ::cuEventQuery, ::cuEventSynchronize, ::cuEventElapsedTime, ::cudaEventDestroy
///
/// # Parameters
///
/// - `hEvent`: - Event to destroy
pub fn cuEventDestroy_v2(hEvent: CUevent) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Computes the elapsed time between two events
///
/// Computes the elapsed time between two events (in milliseconds with a resolution of around 0.5 microseconds). Note this API is not guaranteed to return the latest errors for pending work. As such this API is intended to serve as an elapsed time calculation only and any polling for completion on the events to be compared should be done with ::cuEventQuery instead.
///
/// If either event was last recorded in a non-NULL stream, the resulting time may be greater than expected (even if both used 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 events. Any number of other different stream operations could execute in between the two measured events, thus altering the timing in a significant way.
///
/// If ::cuEventRecord() has not been called on either event then ::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 ::CUDA_ERROR_NOT_READY on at least one of the events), ::CUDA_ERROR_NOT_READY is returned. If either event was created with the ::CU_EVENT_DISABLE_TIMING flag, then this function will return ::CUDA_ERROR_INVALID_HANDLE.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_HANDLE, ::CUDA_ERROR_NOT_READY, ::CUDA_ERROR_UNKNOWN
///
///
///
/// See also: ::cuEventCreate, ::cuEventRecord, ::cuEventQuery, ::cuEventSynchronize, ::cuEventDestroy, ::cudaEventElapsedTime
///
/// # Parameters
///
/// - `pMilliseconds`: - Time between `hStart` and `hEnd` in ms
/// - `hStart`: - Starting event
/// - `hEnd`: - Ending event
pub fn cuEventElapsedTime_v2(
pMilliseconds: *mut f32,
hStart: CUevent,
hEnd: CUevent,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Imports an external memory object.
///
/// Imports an externally allocated memory object and returns a handle to that in `extMem_out`.
///
/// The properties of the handle being imported must be described in `memHandleDesc`. The CUDA_EXTERNAL_MEMORY_HANDLE_DESC structure is defined as follows:
///
/// where [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ad4e3663348d28278d066980b422ab70e) specifies the type of handle being imported. [CUexternalMemoryHandleType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gabca0bdde9a33c47058b5c97f21e2edd8) is defined as:
///
/// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ad4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD`], then [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::fd](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1a2e9d6e106e308d36e9cc29116d9959ec) must be a valid file descriptor referencing a memory object. Ownership of the file descriptor is transferred to the CUDA driver when the handle is imported successfully. Performing any operations on the file descriptor after it is imported results in undefined behavior.
///
/// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ad4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32`], then exactly one of [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1a362b8ca729aa8b9256845d710b6e9cb5) and [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ae624f58523f45aeb074e67f552cad52b) must not be NULL. If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1a362b8ca729aa8b9256845d710b6e9cb5) is not NULL, then it must represent a valid shared NT handle that references a memory object. Ownership of this handle is not transferred to CUDA after the import operation, so the application must release the handle using the appropriate system call. If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ae624f58523f45aeb074e67f552cad52b) is not NULL, then it must point to a NULL-terminated array of UTF-16 characters that refers to a memory object.
///
/// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ad4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT`], then [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1a362b8ca729aa8b9256845d710b6e9cb5) must be non-NULL and [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ae624f58523f45aeb074e67f552cad52b) must be NULL. The handle specified must be a globally shared KMT handle. This handle does not hold a reference to the underlying object, and thus will be invalid when all references to the memory object are destroyed.
///
/// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ad4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP`], then exactly one of [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1a362b8ca729aa8b9256845d710b6e9cb5) and [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ae624f58523f45aeb074e67f552cad52b) must not be NULL. If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1a362b8ca729aa8b9256845d710b6e9cb5) is not NULL, then it must represent a valid shared NT handle that is returned by ID3D12Device::CreateSharedHandle when referring to a ID3D12Heap object. This handle holds a reference to the underlying object. If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ae624f58523f45aeb074e67f552cad52b) is not NULL, then it must point to a NULL-terminated array of UTF-16 characters that refers to a ID3D12Heap object.
///
/// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ad4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE`], then exactly one of [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1a362b8ca729aa8b9256845d710b6e9cb5) and [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ae624f58523f45aeb074e67f552cad52b) must not be NULL. If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1a362b8ca729aa8b9256845d710b6e9cb5) is not NULL, then it must represent a valid shared NT handle that is returned by ID3D12Device::CreateSharedHandle when referring to a ID3D12Resource object. This handle holds a reference to the underlying object. If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ae624f58523f45aeb074e67f552cad52b) is not NULL, then it must point to a NULL-terminated array of UTF-16 characters that refers to a ID3D12Resource object.
///
/// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ad4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE`], then [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1a362b8ca729aa8b9256845d710b6e9cb5) must represent a valid shared NT handle that is returned by IDXGIResource1::CreateSharedHandle when referring to a ID3D11Resource object. If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ae624f58523f45aeb074e67f552cad52b) is not NULL, then it must point to a NULL-terminated array of UTF-16 characters that refers to a ID3D11Resource object.
///
/// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ad4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT`], then [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1a362b8ca729aa8b9256845d710b6e9cb5) must represent a valid shared KMT handle that is returned by IDXGIResource::GetSharedHandle when referring to a ID3D11Resource object and [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ae624f58523f45aeb074e67f552cad52b) must be NULL.
///
/// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ad4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF`], then [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::nvSciBufObject](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1a8090da2b272e5d8624edcfb145c59eca) must be non-NULL and reference a valid NvSciBuf object. If 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.
///
/// If [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ad4e3663348d28278d066980b422ab70e) is [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_DMABUF_FD`], then [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::fd](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1a2e9d6e106e308d36e9cc29116d9959ec) must be a valid file descriptor referencing a dma_buf object and [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1a44d7c253f6b6f34e46b8726496e425c9) must be zero. Importing a dma_buf object is supported only on Tegra platform starting with Thor series. Mapping an imported dma_buf object as CUDA mipmapped array using [`cuExternalMemoryGetMappedMipmappedArray`] is not supported.
///
/// The size of the memory object must be specified in [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::size](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1a36570cee9bbfa12b3f34d0d1d98029ce).
///
/// Specifying the flag [`CUDA_EXTERNAL_MEMORY_DEDICATED`] in [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1a44d7c253f6b6f34e46b8726496e425c9) indicates that the resource is a dedicated resource. The definition of what a dedicated resource is outside the scope of this extension. This flag must be set if [CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__HANDLE__DESC__v1.html#structcuda__external__memory__handle__desc__v1_1ad4e3663348d28278d066980b422ab70e) 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`].
///
/// # Parameters
///
/// - `extMem_out`: Returned handle to an external memory object.
/// - `memHandleDesc`: Memory import handle descriptor.
pub fn cuImportExternalMemory(
extMem_out: *mut CUexternalMemory,
memHandleDesc: *const CUDA_EXTERNAL_MEMORY_HANDLE_DESC,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Maps a buffer onto an imported memory object.
///
/// Maps a buffer onto an imported memory object and returns a device pointer in `devPtr`.
///
/// The properties of the buffer being mapped must be described in `bufferDesc`. The CUDA_EXTERNAL_MEMORY_BUFFER_DESC structure is defined as follows:
///
/// where [CUDA_EXTERNAL_MEMORY_BUFFER_DESC::offset](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__BUFFER__DESC__v1.html#structcuda__external__memory__buffer__desc__v1_1a734130661fb389658d29d10ed6cf41cd) 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__BUFFER__DESC__v1.html#structcuda__external__memory__buffer__desc__v1_1ab736c75bec5e1461f565e95500c8227f) is the size of the buffer. [CUDA_EXTERNAL_MEMORY_BUFFER_DESC::flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__BUFFER__DESC__v1.html#structcuda__external__memory__buffer__desc__v1_1a86aad4fc1ddac67d953daddec0a5c94a) must be zero.
///
/// The offset and size have to be suitably aligned to match the requirements of the external API. Mapping two buffers whose ranges overlap may or may not result in the same virtual address being returned for the overlapped portion. In such cases, the application must ensure that all accesses to that region from the GPU are volatile. Otherwise writes made via one address are not guaranteed to be visible via the other address, even if they’re issued by the same thread. It is recommended that applications map the combined range instead of mapping separate buffers and then apply the appropriate offsets to the returned pointer to derive the individual buffers.
///
/// The returned pointer `devPtr` must be freed using cuMemFree.
///
/// # Parameters
///
/// - `devPtr`: Returned device pointer to buffer.
/// - `extMem`: Handle to external memory object.
/// - `bufferDesc`: Buffer descriptor.
pub fn cuExternalMemoryGetMappedBuffer(
devPtr: *mut CUdeviceptr,
extMem: CUexternalMemory,
bufferDesc: *const CUDA_EXTERNAL_MEMORY_BUFFER_DESC,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Maps a CUDA mipmapped array onto an external memory object.
///
/// Maps a CUDA mipmapped array onto an external object and returns a handle to it in `mipmap`.
///
/// 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:
///
/// where [CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC::offset](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__MIPMAPPED__ARRAY__DESC__v1.html#structcuda__external__memory__mipmapped__array__desc__v1_1ac4a2c246eab269279434d8153d6e15aa) 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__MIPMAPPED__ARRAY__DESC__v1.html#structcuda__external__memory__mipmapped__array__desc__v1_1a7c3e0998380d9922a9fcddadeecd186d) describes the format, dimensions and type of the base level of the mipmap chain. For further details on these parameters, 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__MIPMAPPED__ARRAY__DESC__v1.html#structcuda__external__memory__mipmapped__array__desc__v1_1a938185e3178ee0fb5920ac104035b321) specifies the total number of levels in the mipmap chain.
///
/// 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__MEMORY__MIPMAPPED__ARRAY__DESC__v1.html#structcuda__external__memory__mipmapped__array__desc__v1_1a938185e3178ee0fb5920ac104035b321) must be equal to 1.
///
/// Mapping `extMem` imported from a handle of type [`CUexternalMemoryHandleType_enum::CU_EXTERNAL_MEMORY_HANDLE_TYPE_DMABUF_FD`], is not supported.
///
/// The returned CUDA mipmapped array must be freed using [`cuMipmappedArrayDestroy`].
///
/// # Parameters
///
/// - `mipmap`: Returned CUDA mipmapped array.
/// - `extMem`: Handle to external memory object.
/// - `mipmapDesc`: CUDA array descriptor.
pub fn cuExternalMemoryGetMappedMipmappedArray(
mipmap: *mut CUmipmappedArray,
extMem: CUexternalMemory,
mipmapDesc: *const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Destroys an external memory object.
///
/// Destroys the specified external memory object. Any existing buffers and CUDA mipmapped arrays mapped onto this object must no longer be used and must be explicitly freed using cuMemFree and [`cuMipmappedArrayDestroy`] respectively.
///
/// # Parameters
///
/// - `extMem`: - External memory object to be destroyed
pub fn cuDestroyExternalMemory(extMem: CUexternalMemory) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Imports an external semaphore.
///
/// Imports an externally allocated synchronization object and returns a handle to that in `extSem_out`.
///
/// The properties of the handle being imported must be described in `semHandleDesc`. The CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC is defined as follows:
///
/// where [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1acf32b96f55beec6f904b2455effed87d) specifies the type of handle being imported. [CUexternalSemaphoreHandleType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gafecb27c44dbd154273d24d35896a2920) is defined as:
///
/// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1acf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD`], then [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::fd](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a90b7304a1421d26bb064bf4e0b66b3ce) must be a valid file descriptor referencing a synchronization object. Ownership of the file descriptor is transferred to the CUDA driver when the handle is imported successfully. Performing any operations on the file descriptor after it is imported results in undefined behavior.
///
/// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1acf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32`], then exactly one of [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a460e285314871e0bcccada6ddf78bdd5) and [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a156f86d10677dbd7a943969cb9b3f7ea) must not be NULL. If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a460e285314871e0bcccada6ddf78bdd5) is not NULL, then it must represent a valid shared NT handle that references a synchronization object. Ownership of this handle is not transferred to CUDA after the import operation, so the application must release the handle using the appropriate system call. If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a156f86d10677dbd7a943969cb9b3f7ea) is not NULL, then it must name a valid synchronization object.
///
/// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1acf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT`], then [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a460e285314871e0bcccada6ddf78bdd5) must be non-NULL and [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a156f86d10677dbd7a943969cb9b3f7ea) must be NULL. The handle specified must be a globally shared KMT handle. This handle does not hold a reference to the underlying object, and thus will be invalid when all references to the synchronization object are destroyed.
///
/// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1acf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE`], then exactly one of [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a460e285314871e0bcccada6ddf78bdd5) and [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a156f86d10677dbd7a943969cb9b3f7ea) must not be NULL. If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a460e285314871e0bcccada6ddf78bdd5) is not NULL, then it must represent a valid shared NT handle that is returned by ID3D12Device::CreateSharedHandle when referring to a ID3D12Fence object. This handle holds a reference to the underlying object. If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a156f86d10677dbd7a943969cb9b3f7ea) is not NULL, then it must name a valid synchronization object that refers to a valid ID3D12Fence object.
///
/// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1acf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE`], then [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a460e285314871e0bcccada6ddf78bdd5) represents a valid shared NT handle that is returned by ID3D11Fence::CreateSharedHandle. If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a156f86d10677dbd7a943969cb9b3f7ea) is not NULL, then it must name a valid synchronization object that refers to a valid ID3D11Fence object.
///
/// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1acf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC`], then [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::nvSciSyncObj](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1ab723f8210fdb7fe17b51cd9019ce109d) represents a valid NvSciSyncObj.
///
/// [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX`], then [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a460e285314871e0bcccada6ddf78bdd5) represents a valid shared NT handle that is returned by IDXGIResource1::CreateSharedHandle when referring to a IDXGIKeyedMutex object. If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a156f86d10677dbd7a943969cb9b3f7ea) is not NULL, then it must name a valid synchronization object that refers to a valid IDXGIKeyedMutex object.
///
/// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1acf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT`], then [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a460e285314871e0bcccada6ddf78bdd5) represents a valid shared KMT handle that is returned by IDXGIResource::GetSharedHandle when referring to a IDXGIKeyedMutex object and [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a156f86d10677dbd7a943969cb9b3f7ea) must be NULL.
///
/// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1acf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD`], then [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::fd](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a90b7304a1421d26bb064bf4e0b66b3ce) must be a valid file descriptor referencing a synchronization object. Ownership of the file descriptor is transferred to the CUDA driver when the handle is imported successfully. Performing any operations on the file descriptor after it is imported results in undefined behavior.
///
/// If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1acf32b96f55beec6f904b2455effed87d) is [`CUexternalSemaphoreHandleType_enum::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32`], then exactly one of [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a460e285314871e0bcccada6ddf78bdd5) and [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a156f86d10677dbd7a943969cb9b3f7ea) must not be NULL. If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a460e285314871e0bcccada6ddf78bdd5) is not NULL, then it must represent a valid shared NT handle that references a synchronization object. Ownership of this handle is not transferred to CUDA after the import operation, so the application must release the handle using the appropriate system call. If [CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__HANDLE__DESC__v1.html#structcuda__external__semaphore__handle__desc__v1_1a156f86d10677dbd7a943969cb9b3f7ea) is not NULL, then it must name a valid synchronization object.
///
/// # Parameters
///
/// - `extSem_out`: Returned handle to an external semaphore.
/// - `semHandleDesc`: Semaphore import handle descriptor.
pub fn cuImportExternalSemaphore(
extSem_out: *mut CUexternalSemaphore,
semHandleDesc: *const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Signals a set of external semaphore objects.
///
/// Enqueues a signal operation on a set of externally allocated semaphore object in the specified stream. The operations will be executed when all prior operations in the stream complete.
///
/// The exact semantics of signaling a semaphore depends on the type of the object.
///
/// 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.
///
/// 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](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__SIGNAL__PARAMS__v1.html#structcuda__external__semaphore__signal__params__v1_1acc09a37125bfd6f700e12983a22738e6).
///
/// 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](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__SIGNAL__PARAMS__v1.html#structcuda__external__semaphore__signal__params__v1_1aeeaaad5a8fe7b0313c18aa4cc0ee2560) to a value that can be used by subsequent waiters 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](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__SIGNAL__PARAMS__v1.html#structcuda__external__semaphore__signal__params__v1_1aeeaaad5a8fe7b0313c18aa4cc0ee2560). By default, signaling such an external semaphore object causes appropriate memory synchronization operations to be performed over all 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. 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 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 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 key set to true. Deterministic fences allow users to enqueue a wait over the semaphore object even before corresponding signal is enqueued. For such a semaphore object, CUDA guarantees that each signal operation will increment the fence value by ‘1’. Users are expected to track count of signals enqueued on the semaphore object and insert waits accordingly. When such a semaphore object is signaled from multiple streams, due to concurrent stream execution, it is possible that the order in which the semaphore gets signaled is indeterministic. This could lead to waiters of the semaphore getting unblocked incorrectly. Users are expected to handle such situations, either by not using the same semaphore object with deterministic fence support enabled in different streams or by adding explicit dependency amongst such streams so that the semaphore is signaled in order. NvSciSyncFence associated 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 key set to true. Timestamps are emitted asynchronously by the GPU and CUDA saves the GPU timestamp in the corresponding NvSciSyncFence at the time of signal on GPU. Users are expected to convert GPU clocks to CPU clocks using appropriate scaling functions. Users are expected to wait for the completion of the fence before extracting timestamp using appropriate NvSciSync APIs. Users are expected to ensure that there is only one outstanding timestamp enabled fence per CUDA-NvSciSync object at any point of time, failing which leads to undefined behavior. Extracting the timestamp before the corresponding fence is signalled could lead to undefined behavior. Timestamp extracted via appropriate NvSciSync API would be in microseconds.
///
/// 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.
///
/// # Parameters
///
/// - `extSemArray`: Set of external semaphores to be signaled.
/// - `paramsArray`: Array of semaphore parameters.
/// - `numExtSems`: Number of semaphores to signal.
/// - `stream`: Stream to enqueue the signal operations in.
pub fn cuSignalExternalSemaphoresAsync(
extSemArray: *const CUexternalSemaphore,
paramsArray: *const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS,
numExtSems: ::core::ffi::c_uint,
stream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Waits on a set of external semaphore objects.
///
/// Enqueues a wait operation on a set of externally allocated semaphore object in the specified stream. The operations will be executed when all prior operations in the stream complete.
///
/// The exact semantics of waiting on a semaphore depends on the type of the object.
///
/// 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 to the unsignaled state. Therefore for every signal operation, there can only be one wait operation.
///
/// 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](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__WAIT__PARAMS__v1.html#structcuda__external__semaphore__wait__params__v1_1a88ca51398134e22437eedca531fcb420).
///
/// 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](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__SIGNAL__PARAMS__v1.html#structcuda__external__semaphore__signal__params__v1_1aeeaaad5a8fe7b0313c18aa4cc0ee2560) is signaled by the signaler of the NvSciSyncObj that was associated with this semaphore object. By default, waiting on such an external semaphore object causes appropriate memory synchronization operations to be performed over all 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. 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 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`].
///
/// 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](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__WAIT__PARAMS__v1.html#structcuda__external__semaphore__wait__params__v1_1a642d788e3027cd2677096b86b79f80ca) or until the timeout specified by [CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS::params::keyedmutex::timeoutMs](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__EXTERNAL__SEMAPHORE__WAIT__PARAMS__v1.html#structcuda__external__semaphore__wait__params__v1_1a3cb25740325fda8d63d4cfeed7f52844) has lapsed. The timeout interval can either be a finite value specified in milliseconds or an infinite value. In case an infinite value is specified the timeout never elapses. The windows INFINITE macro must be used to specify infinite timeout.
///
/// # Parameters
///
/// - `extSemArray`: External semaphores to be waited on.
/// - `paramsArray`: Array of semaphore parameters.
/// - `numExtSems`: Number of semaphores to wait on.
/// - `stream`: Stream to enqueue the wait operations in.
pub fn cuWaitExternalSemaphoresAsync(
extSemArray: *const CUexternalSemaphore,
paramsArray: *const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS,
numExtSems: ::core::ffi::c_uint,
stream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Destroys an external semaphore.
///
/// Destroys an external semaphore object and releases any references to the underlying resource. Any outstanding signals or waits must have completed before the semaphore is destroyed.
///
/// # Parameters
///
/// - `extSem`: - External semaphore to be destroyed
pub fn cuDestroyExternalSemaphore(extSem: CUexternalSemaphore) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Wait on a memory location
///
/// Enqueues a synchronization of the stream on the given memory location. Work ordered after the operation will block until the given condition on the memory is satisfied. By default, the condition is to wait for (int32_t)(*addr - value) >= 0, a cyclic greater-or-equal. Other condition types can be specified via `flags`.
///
/// If the memory was registered via ::cuMemHostRegister(), the device pointer should be obtained with ::cuMemHostGetDevicePointer(). This function cannot be used with managed memory (::cuMemAllocManaged).
///
/// Support for CU_STREAM_WAIT_VALUE_NOR can be queried with ::cuDeviceGetAttribute() and ::CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR_V2.
///
///
///
/// Note: Warning: Improper use of this API may deadlock the application. Synchronization ordering established through this API is not visible to CUDA. CUDA tasks that are (even indirectly) ordered by this API should also have that order expressed with CUDA-visible dependencies such as events. This ensures that the scheduler does not serialize them in an improper order.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_NOT_SUPPORTED
///
///
///
/// See also: ::cuStreamWaitValue64, ::cuStreamWriteValue32, ::cuStreamWriteValue64, ::cuStreamBatchMemOp, ::cuMemHostRegister, ::cuStreamWaitEvent
///
/// # Parameters
///
/// - `stream`: The stream to synchronize on the memory location.
/// - `addr`: The memory location to wait on.
/// - `value`: The value to compare with the memory location.
/// - `flags`: See ::CUstreamWaitValue_flags.
pub fn cuStreamWaitValue32_v2(
stream: CUstream,
addr: CUdeviceptr,
value: cuuint32_t,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Wait on a memory location
///
/// Enqueues a synchronization of the stream on the given memory location. Work ordered after the operation will block until the given condition on the memory is satisfied. By default, the condition is to wait for (int64_t)(*addr - value) >= 0, a cyclic greater-or-equal. Other condition types can be specified via `flags`.
///
/// If the memory was registered via ::cuMemHostRegister(), the device pointer should be obtained with ::cuMemHostGetDevicePointer().
///
/// Support for this can be queried with ::cuDeviceGetAttribute() and ::CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS.
///
///
///
/// Note: Warning: Improper use of this API may deadlock the application. Synchronization ordering established through this API is not visible to CUDA. CUDA tasks that are (even indirectly) ordered by this API should also have that order expressed with CUDA-visible dependencies such as events. This ensures that the scheduler does not serialize them in an improper order.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_NOT_SUPPORTED
///
///
///
/// See also: ::cuStreamWaitValue32, ::cuStreamWriteValue32, ::cuStreamWriteValue64, ::cuStreamBatchMemOp, ::cuMemHostRegister, ::cuStreamWaitEvent
///
/// # Parameters
///
/// - `stream`: The stream to synchronize on the memory location.
/// - `addr`: The memory location to wait on.
/// - `value`: The value to compare with the memory location.
/// - `flags`: See ::CUstreamWaitValue_flags.
pub fn cuStreamWaitValue64_v2(
stream: CUstream,
addr: CUdeviceptr,
value: cuuint64_t,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Write a value to memory
///
/// Write a value to memory.
///
/// If the memory was registered via ::cuMemHostRegister(), the device pointer should be obtained with ::cuMemHostGetDevicePointer(). This function cannot be used with managed memory (::cuMemAllocManaged).
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_NOT_SUPPORTED
///
///
///
/// See also: ::cuStreamWriteValue64, ::cuStreamWaitValue32, ::cuStreamWaitValue64, ::cuStreamBatchMemOp, ::cuMemHostRegister, ::cuEventRecord
///
/// # Parameters
///
/// - `stream`: The stream to do the write in.
/// - `addr`: The device address to write to.
/// - `value`: The value to write.
/// - `flags`: See ::CUstreamWriteValue_flags.
pub fn cuStreamWriteValue32_v2(
stream: CUstream,
addr: CUdeviceptr,
value: cuuint32_t,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Write a value to memory
///
/// Write a value to memory.
///
/// If the memory was registered via ::cuMemHostRegister(), the device pointer should be obtained with ::cuMemHostGetDevicePointer().
///
/// Support for this can be queried with ::cuDeviceGetAttribute() and ::CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_NOT_SUPPORTED
///
///
///
/// See also: ::cuStreamWriteValue32, ::cuStreamWaitValue32, ::cuStreamWaitValue64, ::cuStreamBatchMemOp, ::cuMemHostRegister, ::cuEventRecord
///
/// # Parameters
///
/// - `stream`: The stream to do the write in.
/// - `addr`: The device address to write to.
/// - `value`: The value to write.
/// - `flags`: See ::CUstreamWriteValue_flags.
pub fn cuStreamWriteValue64_v2(
stream: CUstream,
addr: CUdeviceptr,
value: cuuint64_t,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Batch operations to synchronize the stream via memory operations
///
/// This is a batch version of ::cuStreamWaitValue32() and ::cuStreamWriteValue32(). Batching operations may avoid some performance overhead in both the API call and the device execution versus adding them to the stream in separate API calls. The operations are enqueued in the order they appear in the array.
///
/// See ::CUstreamBatchMemOpType for the full set of supported operations, and ::cuStreamWaitValue32(), ::cuStreamWaitValue64(), ::cuStreamWriteValue32(), and ::cuStreamWriteValue64() for details of specific operations.
///
/// See related APIs for details on querying support for specific operations.
///
///
///
/// Note: Warning: Improper use of this API may deadlock the application. Synchronization ordering established through this API is not visible to CUDA. CUDA tasks that are (even indirectly) ordered by this API should also have that order expressed with CUDA-visible dependencies such as events. This ensures that the scheduler does not serialize them in an improper order.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_NOT_SUPPORTED
///
///
///
/// See also: ::cuStreamWaitValue32, ::cuStreamWaitValue64, ::cuStreamWriteValue32, ::cuStreamWriteValue64, ::cuMemHostRegister
///
/// # Parameters
///
/// - `stream`: The stream to enqueue the operations in.
/// - `count`: The number of operations in the array. Must be less than 256.
/// - `paramArray`: The types and parameters of the individual operations.
/// - `flags`: Reserved for future expansion; must be 0.
pub fn cuStreamBatchMemOp_v2(
stream: CUstream,
count: ::core::ffi::c_uint,
paramArray: *mut CUstreamBatchMemOpParams,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns information about a function.
///
/// Returns in `*pi` the integer value of the attribute `attrib` on the kernel given by `hfunc`. The supported attributes are:
///
/// 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 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.
///
/// # Parameters
///
/// - `pi`: Returned attribute value.
/// - `attrib`: Attribute requested.
/// - `hfunc`: Function to query attribute of.
pub fn cuFuncGetAttribute(
pi: *mut ::core::ffi::c_int,
attrib: CUfunction_attribute,
hfunc: CUfunction,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets information about a function.
///
/// 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 will return an error. Not all attributes can have values set. Attempting to set a value on a read-only attribute will result in an error ([`CUresult::CUDA_ERROR_INVALID_VALUE`])
///
/// Supported attributes for the cuFuncSetAttribute call are.
///
/// # Parameters
///
/// - `hfunc`: Function to query attribute of.
/// - `attrib`: Attribute requested.
/// - `value`: The value to set.
pub fn cuFuncSetAttribute(
hfunc: CUfunction,
attrib: CUfunction_attribute,
value: ::core::ffi::c_int,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the preferred cache configuration for a device function.
///
/// 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 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.
///
/// This setting does nothing on devices where the size of the L1 cache and shared memory are fixed.
///
/// Launching a kernel with a different preference than the most recent preference setting may insert a device-side synchronization point.
///
/// The supported cache configurations are.
///
/// # Parameters
///
/// - `hfunc`: Kernel to configure cache for.
/// - `config`: Requested cache configuration.
pub fn cuFuncSetCacheConfig(hfunc: CUfunction, config: CUfunc_cache) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a module handle.
///
/// 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 is explicitly unloaded.
///
/// The CUDA runtime manages its own modules loaded into the primary context. If the handle returned by this API refers to a module loaded by the CUDA runtime, calling [`cuModuleUnload`] on that module will result in undefined behavior.
///
/// # Parameters
///
/// - `hmod`: Returned module handle.
/// - `hfunc`: Function to retrieve module for.
pub fn cuFuncGetModule(hmod: *mut CUmodule, hfunc: CUfunction) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the function name for a [`CUfunction`] handle.
///
/// 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 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 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.
///
/// # Parameters
///
/// - `name`: The returned name of the function.
/// - `hfunc`: The function handle to retrieve the name for.
pub fn cuFuncGetName(
name: *mut *const ::core::ffi::c_char,
hfunc: CUfunction,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the offset and size of a kernel parameter in the device-side parameter layout.
///
/// 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 can be used to update kernel node parameters from the device via ::cudaGraphKernelNodeSetParam() and ::cudaGraphKernelNodeUpdatesApply(). `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.
///
/// # Parameters
///
/// - `func`: The function to query.
/// - `paramIndex`: The parameter index to query.
/// - `paramOffset`: Returns the offset into the device-side parameter layout at which the parameter resides.
/// - `paramSize`: Optionally returns the size of the parameter in the device-side parameter layout.
pub fn cuFuncGetParamInfo(
func: CUfunction,
paramIndex: size_t,
paramOffset: *mut size_t,
paramSize: *mut size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the number of parameters used by the function.
///
/// Queries the number of kernel parameters used by `func` and returns it in `paramCount`.
///
/// # Parameters
///
/// - `func`: The function to query.
/// - `paramCount`: Returns the number of parameters used by the function.
pub fn cuFuncGetParamCount(func: CUfunction, paramCount: *mut size_t) -> CUresult;
}
impl CUfunctionLoadingState_enum {
/// The function has not yet been loaded onto the device.
pub const CU_FUNCTION_LOADING_STATE_UNLOADED: CUfunctionLoadingState_enum = CUfunctionLoadingState_enum(
0,
);
/// The function is loaded onto the device.
pub const CU_FUNCTION_LOADING_STATE_LOADED: CUfunctionLoadingState_enum = CUfunctionLoadingState_enum(
1,
);
/// End marker for native function-loading states.
pub const CU_FUNCTION_LOADING_STATE_MAX: CUfunctionLoadingState_enum = CUfunctionLoadingState_enum(
2,
);
}
/// Whether the native code for a CUDA function has been loaded onto the device.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUfunctionLoadingState_enum(pub ::core::ffi::c_uint);
pub use self::CUfunctionLoadingState_enum as CUfunctionLoadingState;
singe_loader::functions! { crate::DRIVER;
/// Returns if the function is loaded.
///
/// Returns in `state` the loading state of `function`.
///
/// # Parameters
///
/// - `state`: returned loading state.
/// - `function`: the function to check.
pub fn cuFuncIsLoaded(
state: *mut CUfunctionLoadingState,
function: CUfunction,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Loads a function.
///
/// Finalizes function loading for `function`. Calling this API with a fully loaded function has no effect.
///
/// # Parameters
///
/// - `function`: - the function to load
pub fn cuFuncLoad(function: CUfunction) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Launches a CUDA function [`CUfunction`] or a CUDA kernel [`CUkernel`].
///
/// 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.
///
/// `sharedMemBytes` sets the amount of dynamic shared memory that will be available to each thread block.
///
/// Kernel parameters to `f` can be specified in one of two ways:
///
/// 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 and their offsets and sizes do not need to be specified as that information is retrieved directly from the kernel’s image.
///
/// 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 the buffer. Here is an example of using the `extra` parameter in this manner:
///
/// 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 by the corresponding value. The list must be terminated with either NULL or [CU_LAUNCH_PARAM_END](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gad5c11cff5adfa5a69d66829399653532).
///
/// 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).
///
/// Calling [`cuLaunchKernel`] invalidates the persistent function state set through the following deprecated APIs: [`cuFuncSetBlockShape`], [`cuFuncSetSharedSize`], [`cuParamSetSize`], [`cuParamSeti`], [`cuParamSetf`], [`cuParamSetv`].
///
/// 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, or have no kernel parameters. If either of these conditions is not met, then [`cuLaunchKernel`] will return [`cudaError_enum::CUDA_ERROR_INVALID_IMAGE`].
///
/// 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.
///
/// # Parameters
///
/// - `f`: Function [`CUfunction`] or Kernel [`CUkernel`] to launch.
/// - `gridDimX`: Width of grid in blocks.
/// - `gridDimY`: Height of grid in blocks.
/// - `gridDimZ`: Depth of grid in blocks.
/// - `blockDimX`: X dimension of each thread block.
/// - `blockDimY`: Y dimension of each thread block.
/// - `blockDimZ`: Z dimension of each thread block.
/// - `sharedMemBytes`: Dynamic shared-memory size per thread block in bytes.
/// - `hStream`: Stream identifier.
/// - `kernelParams`: Array of pointers to kernel parameters.
/// - `extra`: Extra options.
pub fn cuLaunchKernel(
f: CUfunction,
gridDimX: ::core::ffi::c_uint,
gridDimY: ::core::ffi::c_uint,
gridDimZ: ::core::ffi::c_uint,
blockDimX: ::core::ffi::c_uint,
blockDimY: ::core::ffi::c_uint,
blockDimZ: ::core::ffi::c_uint,
sharedMemBytes: ::core::ffi::c_uint,
hStream: CUstream,
kernelParams: *mut *mut ::core::ffi::c_void,
extra: *mut *mut ::core::ffi::c_void,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Launches a CUDA function [`CUfunction`] or a CUDA kernel [`CUkernel`] with launch-time configuration.
///
/// Invokes the function [`CUfunction`] or the kernel [`CUkernel`] `f` with the specified launch-time configuration `config`.
///
/// The [CUlaunchConfig](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUlaunchConfig.html#structculaunchconfig) structure is defined as:
///
/// where:
///
/// Launch-time configuration is specified by adding entries to [CUlaunchConfig::attrs](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUlaunchConfig.html#structculaunchconfig_1a89bd86e2a9d67c421d5ad9650e57f375). Each entry is an attribute ID and a corresponding attribute value.
///
/// The [CUlaunchAttribute](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUlaunchAttribute.html#structculaunchattribute) structure is defined as:
///
/// An example of using the `config` parameter:
///
/// The [CUlaunchAttributeID](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1ga6f6565b334be6bb3134868e10bbdd331) enum is defined as:
///
/// and the corresponding [CUlaunchAttributeValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/unionCUlaunchAttributeValue.html#unionculaunchattributevalue) union as :
///
/// 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`].
///
/// 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 to opportunistically allow the grid’s execution to overlap with the previous kernel in the stream, if that kernel requests the overlap.
///
/// [`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 after all block in the associated kernel trigger the event. A block can trigger the event through PTX launchdep.release or CUDA builtin function cudaTriggerProgrammaticLaunchCompletion(). A trigger can also be inserted at the beginning of each block’s execution if triggerAtBlockStart is set to non-0. 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 for establishing programmatic dependency between device tasks. The event supplied must not be an interprocess or interop event. The event must disable timing (i.e. created with [`CUevent_flags_enum::CU_EVENT_DISABLE_TIMING`] flag set).
///
/// [`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 execution. Currently this is a best effort. If a kernel B has a launch completion dependency on a kernel A, B may wait until A is complete. Alternatively, blocks of B may begin before all blocks of A have begun, for example:
///
/// Exercise caution if such an ordering inversion could lead to deadlock. The event supplied must not be an interprocess or interop event. The event must disable timing (i.e. must be created with the [`CUevent_flags_enum::CU_EVENT_DISABLE_TIMING`] flag set).
///
/// 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, 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.
///
/// On success, a handle will be returned via ::CUlaunchAttributeValue::deviceUpdatableKernelNode::devNode which can be passed to the various device-side update functions to update the node’s kernel parameters from within another kernel. For more information on the types of device updates that can be made, as well as the relevant limitations thereof, see ::cudaGraphKernelNodeUpdatesApply.
///
/// Kernel nodes which are device-updatable have additional restrictions compared to regular kernel nodes. Firstly, device-updatable 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 result in an error. Graphs containing one or more device-updatable node also do not allow multiple instantiation.
///
/// [`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 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 multiple greater than zero of the regular cluster dimensions. The device will attempt - on a best-effort basis - to group thread blocks into preferred clusters over grouping them into regular clusters. When it deems necessary (primarily when the device temporarily runs out of physical resources to launch the larger preferred clusters), the device may switch to launch the regular clusters instead to attempt to utilize as much of the physical device resources as possible.
///
/// Each type of cluster will have its enumeration / coordinate setup as if the grid consists solely of its type of cluster. For example, if the preferred substitute cluster dimensions double the regular cluster dimensions, there might be simultaneously a regular cluster indexed at (1,0,0), and a preferred cluster indexed at (1,0,0). In this example, the preferred substitute cluster (1,0,0) replaces regular clusters (2,0,0) and (3,0,0) and groups their blocks.
///
/// This attribute will only take effect when a regular cluster dimension has been specified. The preferred substitute The preferred substitute cluster dimension must be an integer multiple greater than zero of the regular cluster dimension and must divide the grid. It must also be no more than `maxBlocksPerCluster`, if it is set in the kernel’s `__launch_bounds__`. Otherwise it must be less than the maximum value the driver can support. Otherwise, setting this attribute to a value physically unable to fit on any particular device is permitted.
///
/// The effect of other attributes is consistent with their effect when set via persistent APIs.
///
/// See [`cuStreamSetAttribute`] for
///
/// See [`cuFuncSetAttribute`] for
///
/// Kernel parameters to `f` can be specified in the same ways that they can be using [`cuLaunchKernel`].
///
/// 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUlaunchConfig.html#structculaunchconfig_1a8bbdd01ea0d4d380fad9e8be14fb928b) or the current context in case of NULL stream.
///
/// # Parameters
///
/// - `config`: Config to launch.
/// - `f`: Function [`CUfunction`] or Kernel [`CUkernel`] to launch.
/// - `kernelParams`: Array of pointers to kernel parameters.
/// - `extra`: Extra options.
pub fn cuLaunchKernelEx(
config: *const CUlaunchConfig,
f: CUfunction,
kernelParams: *mut *mut ::core::ffi::c_void,
extra: *mut *mut ::core::ffi::c_void,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Launches a CUDA function [`CUfunction`] or a CUDA kernel [`CUkernel`] where thread blocks can cooperate and synchronize as they execute.
///
/// 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.
///
/// `sharedMemBytes` sets the amount of dynamic shared memory that will be available to each thread block.
///
/// 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`].
///
/// 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`].
///
/// The kernel cannot make use of CUDA dynamic parallelism.
///
/// 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 and their offsets and sizes do not need to be specified as that information is retrieved directly from the kernel’s image.
///
/// Calling [`cuLaunchCooperativeKernel`] sets persistent function state that is the same as function state set through [`cuLaunchKernel`] API
///
/// When the kernel `f` is launched via [`cuLaunchCooperativeKernel`], the previous block shape, shared size and parameter info associated with `f` is overwritten.
///
/// 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, or have no kernel parameters. If either of these conditions is not met, then [`cuLaunchCooperativeKernel`] will return [`cudaError_enum::CUDA_ERROR_INVALID_IMAGE`].
///
/// 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.
///
/// # Parameters
///
/// - `f`: Function [`CUfunction`] or Kernel [`CUkernel`] to launch.
/// - `gridDimX`: Width of grid in blocks.
/// - `gridDimY`: Height of grid in blocks.
/// - `gridDimZ`: Depth of grid in blocks.
/// - `blockDimX`: X dimension of each thread block.
/// - `blockDimY`: Y dimension of each thread block.
/// - `blockDimZ`: Z dimension of each thread block.
/// - `sharedMemBytes`: Dynamic shared-memory size per thread block in bytes.
/// - `hStream`: Stream identifier.
/// - `kernelParams`: Array of pointers to kernel parameters.
pub fn cuLaunchCooperativeKernel(
f: CUfunction,
gridDimX: ::core::ffi::c_uint,
gridDimY: ::core::ffi::c_uint,
gridDimZ: ::core::ffi::c_uint,
blockDimX: ::core::ffi::c_uint,
blockDimY: ::core::ffi::c_uint,
blockDimZ: ::core::ffi::c_uint,
sharedMemBytes: ::core::ffi::c_uint,
hStream: CUstream,
kernelParams: *mut *mut ::core::ffi::c_void,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Enqueues a host function call in a stream.
///
/// Enqueues a host function to run in a stream. The function will be called after currently enqueued work and will block work added after it.
///
/// 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 not mandated to run earlier. Host functions without a mandated order (such as in independent streams) execute in undefined order and may be serialized.
///
/// For the purposes of Unified Memory, execution makes a number of guarantees:
///
/// Note that, in contrast to [`cuStreamAddCallback`], the function will not be called in the event of an error in the CUDA context.
///
/// # Parameters
///
/// - `hStream`: Stream to enqueue function call in.
/// - `fn_`: The function to call once preceding stream operations are complete.
/// - `userData`: User-specified data to be passed to the function.
pub fn cuLaunchHostFunc(
hStream: CUstream,
fn_: CUhostFn,
userData: *mut ::core::ffi::c_void,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Enqueues a host function call in a stream.
///
/// Enqueues a host function to run in a stream. The function will be called after currently enqueued work and will block work added after it.
///
/// 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 not mandated to run earlier. Host functions without a mandated order (such as in independent streams) execute in undefined order and may be serialized.
///
/// For the purposes of Unified Memory, execution makes a number of guarantees:
///
/// Note that, in contrast to [`cuStreamAddCallback`], the function will not be called in the event of an error in the CUDA context.
///
/// # Parameters
///
/// - `hStream`: Stream to enqueue function call in.
/// - `fn_`: The function to call once preceding stream operations are complete.
/// - `userData`: User-specified data to be passed to the function.
/// - `syncMode`: Synchronization mode for the host function.
pub fn cuLaunchHostFunc_v2(
hStream: CUstream,
fn_: CUhostFn,
userData: *mut ::core::ffi::c_void,
syncMode: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the block-dimensions for the function.
///
/// Specifies the `x`, `y`, and `z` dimensions of the thread blocks that are created when the kernel given by `hfunc` is launched.
///
/// # Parameters
///
/// - `hfunc`: Kernel to specify dimensions of.
/// - `x`: X dimension.
/// - `y`: Y dimension.
/// - `z`: Z dimension.
#[deprecated]
pub fn cuFuncSetBlockShape(
hfunc: CUfunction,
x: ::core::ffi::c_int,
y: ::core::ffi::c_int,
z: ::core::ffi::c_int,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the dynamic shared-memory size for the function.
///
/// Sets through `bytes` the amount of dynamic shared memory that will be available to each thread block when the kernel given by `hfunc` is launched.
///
/// # Parameters
///
/// - `hfunc`: Kernel to specify dynamic shared-memory size for.
/// - `bytes`: Dynamic shared-memory size per thread in bytes.
#[deprecated]
pub fn cuFuncSetSharedSize(
hfunc: CUfunction,
bytes: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the parameter size for the function.
///
/// Sets through `numbytes` the total size in bytes needed by the function parameters of the kernel corresponding to `hfunc`.
///
/// # Parameters
///
/// - `hfunc`: Kernel to set parameter size for.
/// - `numbytes`: Size of parameter list in bytes.
#[deprecated]
pub fn cuParamSetSize(hfunc: CUfunction, numbytes: ::core::ffi::c_uint) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Adds an integer parameter to the function’s argument list.
///
/// Sets an integer parameter that will be specified the next time the kernel corresponding to `hfunc` will be invoked. `offset` is a byte offset.
///
/// # Parameters
///
/// - `hfunc`: Kernel to add parameter to.
/// - `offset`: Offset to add parameter to argument list.
/// - `value`: Value of parameter.
#[deprecated]
pub fn cuParamSeti(
hfunc: CUfunction,
offset: ::core::ffi::c_int,
value: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Adds a floating-point parameter to the function’s argument list.
///
/// Sets a floating-point parameter that will be specified the next time the kernel corresponding to `hfunc` will be invoked. `offset` is a byte offset.
///
/// # Parameters
///
/// - `hfunc`: Kernel to add parameter to.
/// - `offset`: Offset to add parameter to argument list.
/// - `value`: Value of parameter.
#[deprecated]
pub fn cuParamSetf(
hfunc: CUfunction,
offset: ::core::ffi::c_int,
value: f32,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Adds arbitrary data to the function’s argument list.
///
/// Copies an arbitrary amount of data (specified in `numbytes`) from `ptr` into the parameter space of the kernel corresponding to `hfunc`. `offset` is a byte offset.
///
/// # Parameters
///
/// - `hfunc`: Kernel to add data to.
/// - `offset`: Offset to add data to argument list.
/// - `ptr`: Pointer to arbitrary data.
/// - `numbytes`: Size of data to copy in bytes.
#[deprecated]
pub fn cuParamSetv(
hfunc: CUfunction,
offset: ::core::ffi::c_int,
ptr: *mut ::core::ffi::c_void,
numbytes: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Launches a CUDA function.
///
/// Invokes the kernel `f` on a 1 x 1 x 1 grid of blocks. The block contains the number of threads specified by a previous call to [`cuFuncSetBlockShape`].
///
/// 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.
///
/// Launching a function via [`cuLaunchKernel`] invalidates the function’s block shape, dynamic shared memory size, and parameter information. After launching via cuLaunchKernel, this state must be re-initialized prior to calling this function. Failure to do so results in undefined behavior.
///
/// # Parameters
///
/// - `f`: - Kernel to launch
#[deprecated]
pub fn cuLaunch(f: CUfunction) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Launches a CUDA function.
///
/// Invokes the kernel `f` on a `grid_width` x `grid_height` grid of blocks. Each block contains the number of threads specified by a previous call to [`cuFuncSetBlockShape`].
///
/// 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.
///
/// Launching a function via [`cuLaunchKernel`] invalidates the function’s block shape, dynamic shared memory size, and parameter information. After launching via cuLaunchKernel, this state must be re-initialized prior to calling this function. Failure to do so results in undefined behavior.
///
/// # Parameters
///
/// - `f`: Kernel to launch.
/// - `grid_width`: Width of grid in blocks.
/// - `grid_height`: Height of grid in blocks.
#[deprecated]
pub fn cuLaunchGrid(
f: CUfunction,
grid_width: ::core::ffi::c_int,
grid_height: ::core::ffi::c_int,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Launches a CUDA function.
///
/// Invokes the kernel `f` on a `grid_width` x `grid_height` grid of blocks. Each block contains the number of threads specified by a previous call to [`cuFuncSetBlockShape`].
///
/// 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.
///
/// Launching a function via [`cuLaunchKernel`] invalidates the function’s block shape, dynamic shared memory size, and parameter information. After launching via cuLaunchKernel, this state must be re-initialized prior to calling this function. Failure to do so results in undefined behavior.
///
/// # Parameters
///
/// - `f`: Kernel to launch.
/// - `grid_width`: Width of grid in blocks.
/// - `grid_height`: Height of grid in blocks.
/// - `hStream`: Stream identifier.
#[deprecated]
pub fn cuLaunchGridAsync(
f: CUfunction,
grid_width: ::core::ffi::c_int,
grid_height: ::core::ffi::c_int,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Launches CUDA functions on multiple devices where thread blocks can cooperate and synchronize as they execute.
///
/// 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 can cooperate and synchronize as they execute. The size of the array is specified by `numDevices`.
///
/// No two kernels can be launched on the same device. All the devices targeted by this multi-device launch must be identical. All devices must have a non-zero value for the device attribute [`CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH`].
///
/// All kernels launched must be identical with respect to the compiled code. Note that any **device**, **constant** or **managed** variables present in the module that owns the kernel launched on each device, are independently instantiated on every device. It is the application’s responsibility to ensure these variables are initialized and used appropriately.
///
/// The size of the grids as specified in blocks, the size of the blocks themselves and the amount of shared memory used by each thread block must also match across all launched kernels.
///
/// The streams used to launch these kernels must have been created via either [`cuStreamCreate`] or [`cuStreamCreateWithPriority`]. The NULL stream or [CU_STREAM_LEGACY](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gaa53e8210837f039dd6434a3a4c3324aa) or [CU_STREAM_PER_THREAD](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1ga02e40b82600f62c42ed29abb150f857c) cannot be used.
///
/// The total number of blocks launched per kernel 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`]. Since the total number of blocks launched per device has to match across all devices, the maximum number of blocks that can be launched per device will be limited by the device with the least number of multiprocessors.
///
/// The kernels cannot make use of CUDA dynamic parallelism.
///
/// The CUDA_LAUNCH_PARAMS structure is defined as:
///
/// By default, the kernel won’t begin execution on any GPU until all prior work in all the specified streams has completed. This 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 before it begins execution.
///
/// Similarly, by default, any subsequent work pushed in any of the specified streams will not begin execution until the kernels 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 on the GPU corresponding to that stream to complete before it begins execution.
///
/// 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`.
///
/// 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__LAUNCH__PARAMS__v1.html#structcuda__launch__params__v1_1aad25005328ba7debf0f5bd2d39a5363c) in `launchParamsList` is overwritten.
///
/// 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 information, or have no kernel parameters. If either of these conditions is not met, then [`cuLaunchCooperativeKernelMultiDevice`] will return [`cudaError_enum::CUDA_ERROR_INVALID_IMAGE`].
///
/// # Parameters
///
/// - `launchParamsList`: List of launch parameters, one per device.
/// - `numDevices`: Size of the `launchParamsList` array.
/// - `flags`: Flags to control launch behavior.
#[deprecated]
pub fn cuLaunchCooperativeKernelMultiDevice(
launchParamsList: *mut CUDA_LAUNCH_PARAMS,
numDevices: ::core::ffi::c_uint,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Adds a texture-reference to the function’s argument list.
///
/// Makes the CUDA array or linear memory bound to the texture reference `hTexRef` available to a device program as a texture. In this version of CUDA, the texture-reference must be obtained via [`cuModuleGetTexRef`] and the `texunit` parameter must be set to [`CU_PARAM_TR_DEFAULT`].
///
/// # Parameters
///
/// - `hfunc`: Kernel to add texture-reference to.
/// - `texunit`: Texture unit (must be [`CU_PARAM_TR_DEFAULT`]).
/// - `hTexRef`: Texture-reference to add to argument list.
#[deprecated]
pub fn cuParamSetTexRef(
hfunc: CUfunction,
texunit: ::core::ffi::c_int,
hTexRef: CUtexref,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the shared memory configuration for a device function.
///
/// On devices with configurable shared memory banks, this function will force all subsequent launches of the specified device function to have the given shared memory bank size configuration. On any given launch of the function, the shared memory configuration of the device will be temporarily changed if needed to suit the function’s preferred configuration. Changes in shared memory configuration between subsequent launches of functions, may introduce a device side synchronization point.
///
/// Any per-function setting of shared memory bank size set via [`cuFuncSetSharedMemConfig`] will override the context wide setting set with [`cuCtxSetSharedMemConfig`].
///
/// Changing the shared memory bank size will not increase shared memory usage or affect occupancy of kernels, but may have major effects on performance. Larger bank sizes will allow for greater potential bandwidth to shared memory, but will change what kinds of accesses to shared memory will result in bank conflicts.
///
/// This function will do nothing on devices with fixed shared memory bank size.
///
/// The supported bank configurations are.
///
/// # Parameters
///
/// - `hfunc`: kernel to be given a shared memory config.
/// - `config`: requested shared memory configuration.
#[deprecated]
pub fn cuFuncSetSharedMemConfig(
hfunc: CUfunction,
config: CUsharedconfig,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates a graph.
///
/// Creates an empty graph, which is returned via `phGraph`.
///
/// # Parameters
///
/// - `phGraph`: Returns newly created graph.
/// - `flags`: Graph creation flags, must be 0.
pub fn cuGraphCreate(phGraph: *mut CUgraph, flags: ::core::ffi::c_uint) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates a kernel execution node and adds it to a graph
///
/// 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`.
///
/// The CUDA_KERNEL_NODE_PARAMS structure is defined as:
///
///
///
///
///
/// ```text
/// typedef struct CUDA_KERNEL_NODE_PARAMS_st {
/// CUfunction func;
/// unsigned int gridDimX;
/// unsigned int gridDimY;
/// unsigned int gridDimZ;
/// unsigned int blockDimX;
/// unsigned int blockDimY;
/// unsigned int blockDimZ;
/// unsigned int sharedMemBytes;
/// void **kernelParams;
/// void **extra;
/// CUkernel kern;
/// CUcontext ctx;
/// } CUDA_KERNEL_NODE_PARAMS;
/// ```
///
/// 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.
///
/// `sharedMemBytes` sets the amount of dynamic shared memory that will be available to each thread block.
///
/// Kernel parameters to `func` can be specified in one of two ways:
///
/// 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 their offsets and sizes do not need to be specified as that information is retrieved directly from the kernel's image.
///
/// 2) Kernel parameters for non-cooperative kernels can also be packaged by the application into a single buffer that is passed in via `extra`. This places the burden on the application of knowing each kernel parameter's size and alignment/padding within the buffer. 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 by the corresponding value. The list must be terminated with either NULL or CU_LAUNCH_PARAM_END.
///
/// - ::CU_LAUNCH_PARAM_END, which indicates the end of the `extra` array;
/// - ::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`;
/// - ::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;
///
/// The error ::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). ::CUDA_ERROR_INVALID_VALUE will be returned if `extra` is used for a cooperative kernel.
///
/// The `kernelParams` or `extra` array, as well as the argument values it points to, are copied during this call.
///
///
///
/// Note: Kernels launched using graphs must not use texture and surface references. Reading or writing through any texture or surface reference is undefined behavior. This restriction does not apply to texture and surface objects.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _graph_thread_safety
///
///
///
/// See also: ::cuGraphAddNode, ::cuLaunchKernel, ::cuLaunchCooperativeKernel, ::cuGraphKernelNodeGetParams, ::cuGraphKernelNodeSetParams, ::cuGraphCreate, ::cuGraphDestroyNode, ::cuGraphAddChildGraphNode, ::cuGraphAddEmptyNode, ::cuGraphAddHostNode, ::cuGraphAddMemcpyNode, ::cuGraphAddMemsetNode
///
/// # Parameters
///
/// - `phGraphNode`: - Returns newly created node
/// - `hGraph`: - Graph to which to add the node
/// - `dependencies`: - Dependencies of the node
/// - `numDependencies`: - Number of dependencies
/// - `nodeParams`: - Parameters for the GPU execution node
pub fn cuGraphAddKernelNode_v2(
phGraphNode: *mut CUgraphNode,
hGraph: CUgraph,
dependencies: *const CUgraphNode,
numDependencies: size_t,
nodeParams: *const CUDA_KERNEL_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a kernel node's parameters
///
/// 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 or its parameters are modified, and should not be modified directly. Use ::cuGraphKernelNodeSetParams to update the parameters of this node.
///
/// The params will contain either `kernelParams` or `extra`, according to which of these was most recently set on the node.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _graph_thread_safety
///
///
///
/// See also: ::cuGraphNodeGetParams, ::cuLaunchKernel, ::cuGraphAddKernelNode, ::cuGraphKernelNodeSetParams
///
/// # Parameters
///
/// - `hNode`: - Node to get the parameters for
/// - `nodeParams`: - Pointer to return the parameters
pub fn cuGraphKernelNodeGetParams_v2(
hNode: CUgraphNode,
nodeParams: *mut CUDA_KERNEL_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets a kernel node's parameters
///
/// Sets the parameters of kernel node `hNode` to `nodeParams`.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_HANDLE, ::CUDA_ERROR_OUT_OF_MEMORY
///
/// Note: _graph_thread_safety
///
///
///
/// See also: ::cuGraphNodeSetParams, ::cuLaunchKernel, ::cuGraphAddKernelNode, ::cuGraphKernelNodeGetParams
///
/// # Parameters
///
/// - `hNode`: - Node to set the parameters for
/// - `nodeParams`: - Parameters to copy
pub fn cuGraphKernelNodeSetParams_v2(
hNode: CUgraphNode,
nodeParams: *const CUDA_KERNEL_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates a memcpy node and adds it to a graph.
///
/// 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`.
///
/// When the graph is launched, the node will perform the memcpy described by `copyParams`. See cuMemcpy3D() for a description of the structure and its restrictions.
///
/// Memcpy nodes have some additional restrictions with regards to managed memory, if the system contains at least one device 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 on which memory type is specified.
///
/// # Parameters
///
/// - `phGraphNode`: Returns newly created node.
/// - `hGraph`: Graph to which to add the node.
/// - `dependencies`: Dependencies of the node.
/// - `numDependencies`: Number of dependencies.
/// - `copyParams`: Parameters for the memory copy.
/// - `ctx`: Context on which to run the node.
pub fn cuGraphAddMemcpyNode(
phGraphNode: *mut CUgraphNode,
hGraph: CUgraph,
dependencies: *const CUgraphNode,
numDependencies: size_t,
copyParams: *const CUDA_MEMCPY3D,
ctx: CUcontext,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a memcpy node’s parameters.
///
/// Returns the parameters of memcpy node `hNode` in `nodeParams`.
///
/// # Parameters
///
/// - `hNode`: Node to get the parameters for.
/// - `nodeParams`: Pointer to return the parameters.
pub fn cuGraphMemcpyNodeGetParams(
hNode: CUgraphNode,
nodeParams: *mut CUDA_MEMCPY3D,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets a memcpy node’s parameters.
///
/// Sets the parameters of memcpy node `hNode` to `nodeParams`.
///
/// # Parameters
///
/// - `hNode`: Node to set the parameters for.
/// - `nodeParams`: Parameters to copy.
pub fn cuGraphMemcpyNodeSetParams(
hNode: CUgraphNode,
nodeParams: *const CUDA_MEMCPY3D,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates a memset node and adds it to a graph.
///
/// 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`.
///
/// The element size must be 1, 2, or 4 bytes. When the graph is launched, the node will perform the memset described by `memsetParams`.
///
/// # Parameters
///
/// - `phGraphNode`: Returns newly created node.
/// - `hGraph`: Graph to which to add the node.
/// - `dependencies`: Dependencies of the node.
/// - `numDependencies`: Number of dependencies.
/// - `memsetParams`: Parameters for the memory set.
/// - `ctx`: Context on which to run the node.
pub fn cuGraphAddMemsetNode(
phGraphNode: *mut CUgraphNode,
hGraph: CUgraph,
dependencies: *const CUgraphNode,
numDependencies: size_t,
memsetParams: *const CUDA_MEMSET_NODE_PARAMS,
ctx: CUcontext,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a memset node’s parameters.
///
/// Returns the parameters of memset node `hNode` in `nodeParams`.
///
/// # Parameters
///
/// - `hNode`: Node to get the parameters for.
/// - `nodeParams`: Pointer to return the parameters.
pub fn cuGraphMemsetNodeGetParams(
hNode: CUgraphNode,
nodeParams: *mut CUDA_MEMSET_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets a memset node’s parameters.
///
/// Sets the parameters of memset node `hNode` to `nodeParams`.
///
/// # Parameters
///
/// - `hNode`: Node to set the parameters for.
/// - `nodeParams`: Parameters to copy.
pub fn cuGraphMemsetNodeSetParams(
hNode: CUgraphNode,
nodeParams: *const CUDA_MEMSET_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates a host execution node and adds it to a graph.
///
/// 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`.
///
/// When the graph is launched, the node will invoke the specified CPU function. Host nodes are not supported under MPS with pre-Volta GPUs.
///
/// # Parameters
///
/// - `phGraphNode`: Returns newly created node.
/// - `hGraph`: Graph to which to add the node.
/// - `dependencies`: Dependencies of the node.
/// - `numDependencies`: Number of dependencies.
/// - `nodeParams`: Parameters for the host node.
pub fn cuGraphAddHostNode(
phGraphNode: *mut CUgraphNode,
hGraph: CUgraph,
dependencies: *const CUgraphNode,
numDependencies: size_t,
nodeParams: *const CUDA_HOST_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a host node’s parameters.
///
/// Returns the parameters of host node `hNode` in `nodeParams`.
///
/// # Parameters
///
/// - `hNode`: Node to get the parameters for.
/// - `nodeParams`: Pointer to return the parameters.
pub fn cuGraphHostNodeGetParams(
hNode: CUgraphNode,
nodeParams: *mut CUDA_HOST_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets a host node’s parameters.
///
/// Sets the parameters of host node `hNode` to `nodeParams`.
///
/// # Parameters
///
/// - `hNode`: Node to set the parameters for.
/// - `nodeParams`: Parameters to copy.
pub fn cuGraphHostNodeSetParams(
hNode: CUgraphNode,
nodeParams: *const CUDA_HOST_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates a child graph node and adds it to a graph.
///
/// 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`.
///
/// If `childGraph` contains allocation nodes, free nodes, or conditional nodes, this call will return an error.
///
/// The node executes an embedded child graph. The child graph is cloned in this call.
///
/// # Parameters
///
/// - `phGraphNode`: Returns newly created node.
/// - `hGraph`: Graph to which to add the node.
/// - `dependencies`: Dependencies of the node.
/// - `numDependencies`: Number of dependencies.
/// - `childGraph`: The graph to clone into this node.
pub fn cuGraphAddChildGraphNode(
phGraphNode: *mut CUgraphNode,
hGraph: CUgraph,
dependencies: *const CUgraphNode,
numDependencies: size_t,
childGraph: CUgraph,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets a handle to the embedded graph of a child graph node.
///
/// 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 reflected in the node, and the node retains ownership of the graph.
///
/// Allocation and free nodes cannot be added to the returned graph. Attempting to do so will return an error.
///
/// # Parameters
///
/// - `hNode`: Node to get the embedded graph for.
/// - `phGraph`: Location to store a handle to the graph.
pub fn cuGraphChildGraphNodeGetGraph(
hNode: CUgraphNode,
phGraph: *mut CUgraph,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates an empty node and adds it to a graph.
///
/// 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`.
///
/// An empty node performs no operation during execution, but can be used for transitive ordering. For example, a phased execution graph with 2 groups of n nodes with a barrier between them can be represented using an empty node and 2\*n dependency edges, rather than no empty node and n^2 dependency edges.
///
/// # Parameters
///
/// - `phGraphNode`: Returns newly created node.
/// - `hGraph`: Graph to which to add the node.
/// - `dependencies`: Dependencies of the node.
/// - `numDependencies`: Number of dependencies.
pub fn cuGraphAddEmptyNode(
phGraphNode: *mut CUgraphNode,
hGraph: CUgraph,
dependencies: *const CUgraphNode,
numDependencies: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates an event record node and adds it to a graph.
///
/// 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`.
///
/// Each launch of the graph will record `event` to capture execution of the node’s dependencies.
///
/// # Parameters
///
/// - `phGraphNode`: Returns newly created node.
/// - `hGraph`: Graph to which to add the node.
/// - `dependencies`: Dependencies of the node.
/// - `numDependencies`: Number of dependencies.
/// - `event`: Event for the node.
pub fn cuGraphAddEventRecordNode(
phGraphNode: *mut CUgraphNode,
hGraph: CUgraph,
dependencies: *const CUgraphNode,
numDependencies: size_t,
event: CUevent,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the event associated with an event record node.
///
/// Returns the event of event record node `hNode` in `event_out`.
///
/// # Parameters
///
/// - `hNode`: Node to get the event for.
/// - `event_out`: Pointer to return the event.
pub fn cuGraphEventRecordNodeGetEvent(
hNode: CUgraphNode,
event_out: *mut CUevent,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets an event record node’s event.
///
/// Sets the event of event record node `hNode` to `event`.
///
/// # Parameters
///
/// - `hNode`: Node to set the event for.
/// - `event`: Event to use.
pub fn cuGraphEventRecordNodeSetEvent(
hNode: CUgraphNode,
event: CUevent,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates an event wait node and adds it to a graph.
///
/// 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`.
///
/// 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.
///
/// # Parameters
///
/// - `phGraphNode`: Returns newly created node.
/// - `hGraph`: Graph to which to add the node.
/// - `dependencies`: Dependencies of the node.
/// - `numDependencies`: Number of dependencies.
/// - `event`: Event for the node.
pub fn cuGraphAddEventWaitNode(
phGraphNode: *mut CUgraphNode,
hGraph: CUgraph,
dependencies: *const CUgraphNode,
numDependencies: size_t,
event: CUevent,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the event associated with an event wait node.
///
/// Returns the event of event wait node `hNode` in `event_out`.
///
/// # Parameters
///
/// - `hNode`: Node to get the event for.
/// - `event_out`: Pointer to return the event.
pub fn cuGraphEventWaitNodeGetEvent(
hNode: CUgraphNode,
event_out: *mut CUevent,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets an event wait node’s event.
///
/// Sets the event of event wait node `hNode` to `event`.
///
/// # Parameters
///
/// - `hNode`: Node to set the event for.
/// - `event`: Event to use.
pub fn cuGraphEventWaitNodeSetEvent(hNode: CUgraphNode, event: CUevent) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates an external semaphore signal node and adds it to a graph.
///
/// 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`.
///
/// Performs a signal operation on a set of externally allocated semaphore objects when the node is launched. The operation(s) will occur after all of the node’s dependencies have completed.
///
/// # Parameters
///
/// - `phGraphNode`: Returns newly created node.
/// - `hGraph`: Graph to which to add the node.
/// - `dependencies`: Dependencies of the node.
/// - `numDependencies`: Number of dependencies.
/// - `nodeParams`: Parameters for the node.
pub fn cuGraphAddExternalSemaphoresSignalNode(
phGraphNode: *mut CUgraphNode,
hGraph: CUgraph,
dependencies: *const CUgraphNode,
numDependencies: size_t,
nodeParams: *const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns an external semaphore signal node’s parameters.
///
/// 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 not be modified directly. Use [`cuGraphExternalSemaphoresSignalNodeSetParams`] to update the parameters of this node.
///
/// # Parameters
///
/// - `hNode`: Node to get the parameters for.
/// - `params_out`: Pointer to return the parameters.
pub fn cuGraphExternalSemaphoresSignalNodeGetParams(
hNode: CUgraphNode,
params_out: *mut CUDA_EXT_SEM_SIGNAL_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets an external semaphore signal node’s parameters.
///
/// Sets the parameters of an external semaphore signal node `hNode` to `nodeParams`.
///
/// # Parameters
///
/// - `hNode`: Node to set the parameters for.
/// - `nodeParams`: Parameters to copy.
pub fn cuGraphExternalSemaphoresSignalNodeSetParams(
hNode: CUgraphNode,
nodeParams: *const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates an external semaphore wait node and adds it to a graph.
///
/// 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`.
///
/// Performs a wait operation on a set of externally allocated semaphore objects when the node is launched. The node’s dependencies will not be launched until the wait operation has completed.
///
/// # Parameters
///
/// - `phGraphNode`: Returns newly created node.
/// - `hGraph`: Graph to which to add the node.
/// - `dependencies`: Dependencies of the node.
/// - `numDependencies`: Number of dependencies.
/// - `nodeParams`: Parameters for the node.
pub fn cuGraphAddExternalSemaphoresWaitNode(
phGraphNode: *mut CUgraphNode,
hGraph: CUgraph,
dependencies: *const CUgraphNode,
numDependencies: size_t,
nodeParams: *const CUDA_EXT_SEM_WAIT_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns an external semaphore wait node’s parameters.
///
/// 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 not be modified directly. Use [`cuGraphExternalSemaphoresSignalNodeSetParams`] to update the parameters of this node.
///
/// # Parameters
///
/// - `hNode`: Node to get the parameters for.
/// - `params_out`: Pointer to return the parameters.
pub fn cuGraphExternalSemaphoresWaitNodeGetParams(
hNode: CUgraphNode,
params_out: *mut CUDA_EXT_SEM_WAIT_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets an external semaphore wait node’s parameters.
///
/// Sets the parameters of an external semaphore wait node `hNode` to `nodeParams`.
///
/// # Parameters
///
/// - `hNode`: Node to set the parameters for.
/// - `nodeParams`: Parameters to copy.
pub fn cuGraphExternalSemaphoresWaitNodeSetParams(
hNode: CUgraphNode,
nodeParams: *const CUDA_EXT_SEM_WAIT_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates a batch memory operation node and adds it to a graph.
///
/// 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`.
///
/// When the node is added, the paramArray inside `nodeParams` is copied and therefore it can be freed after the call returns.
///
/// # Parameters
///
/// - `phGraphNode`: Returns newly created node.
/// - `hGraph`: Graph to which to add the node.
/// - `dependencies`: Dependencies of the node.
/// - `numDependencies`: Number of dependencies.
/// - `nodeParams`: Parameters for the node.
pub fn cuGraphAddBatchMemOpNode(
phGraphNode: *mut CUgraphNode,
hGraph: CUgraph,
dependencies: *const CUgraphNode,
numDependencies: size_t,
nodeParams: *const CUDA_BATCH_MEM_OP_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a batch mem op node’s parameters.
///
/// 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 be modified directly. Use [`cuGraphBatchMemOpNodeSetParams`] to update the parameters of this node.
///
/// # Parameters
///
/// - `hNode`: Node to get the parameters for.
/// - `nodeParams_out`: Pointer to return the parameters.
pub fn cuGraphBatchMemOpNodeGetParams(
hNode: CUgraphNode,
nodeParams_out: *mut CUDA_BATCH_MEM_OP_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets a batch mem op node’s parameters.
///
/// Sets the parameters of batch mem op node `hNode` to `nodeParams`.
///
/// The paramArray inside `nodeParams` is copied and therefore it can be freed after the call returns.
///
/// # Parameters
///
/// - `hNode`: Node to set the parameters for.
/// - `nodeParams`: Parameters to copy.
pub fn cuGraphBatchMemOpNodeSetParams(
hNode: CUgraphNode,
nodeParams: *const CUDA_BATCH_MEM_OP_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the parameters for a batch mem op node in the given graphExec.
///
/// 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.
///
/// The following fields on operations may be modified on an executable graph:
///
/// op.waitValue.address op.waitValue.value\[64\] op.waitValue.flags bits corresponding to wait type (i.e. [`CUstreamWaitValue_flags::CU_STREAM_WAIT_VALUE_FLUSH`] bit cannot be modified) op.writeValue.address op.writeValue.value\[64\]
///
/// Other fields, such as the context, count or type of operations, and other types of operations such as membars, may not be modified.
///
/// `hNode` must not have been removed from the original graph.
///
/// 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.
///
/// The paramArray inside `nodeParams` is copied and therefore it can be freed after the call returns.
///
/// # Parameters
///
/// - `hGraphExec`: The executable graph in which to set the specified node.
/// - `hNode`: Batch mem op node from the graph from which graphExec was instantiated.
/// - `nodeParams`: Updated Parameters to set.
pub fn cuGraphExecBatchMemOpNodeSetParams(
hGraphExec: CUgraphExec,
hNode: CUgraphNode,
nodeParams: *const CUDA_BATCH_MEM_OP_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates an allocation node and adds it to a graph.
///
/// 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`.
///
/// 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.
///
/// 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 be freed outside the owning graph, and they can only be freed once in the owning graph.
///
/// 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 after the allocation node, but also by stream operations ordered after the graph’s execution but before the allocation is freed.
///
/// Allocations which are not freed in the same graph can be freed by:
///
/// It is not possible to free an allocation in both the owning graph and another graph. If the allocation is freed in the same graph, a free node cannot be added to another graph. If the allocation is freed in another graph, a free node can no longer be added to the owning graph.
///
/// The following restrictions apply to graphs which contain allocation and/or memory free nodes.
///
/// # Parameters
///
/// - `phGraphNode`: Returns newly created node.
/// - `hGraph`: Graph to which to add the node.
/// - `dependencies`: Dependencies of the node.
/// - `numDependencies`: Number of dependencies.
/// - `nodeParams`: Parameters for the node.
pub fn cuGraphAddMemAllocNode(
phGraphNode: *mut CUgraphNode,
hGraph: CUgraph,
dependencies: *const CUgraphNode,
numDependencies: size_t,
nodeParams: *mut CUDA_MEM_ALLOC_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a memory alloc node’s parameters.
///
/// 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.
///
/// # Parameters
///
/// - `hNode`: Node to get the parameters for.
/// - `params_out`: Pointer to return the parameters.
pub fn cuGraphMemAllocNodeGetParams(
hNode: CUgraphNode,
params_out: *mut CUDA_MEM_ALLOC_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates a memory free node and adds it to a graph.
///
/// 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`.
///
/// [`cuGraphAddMemFreeNode`] will return [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] if the user attempts to free:
///
/// The following restrictions apply to graphs which contain allocation and/or memory free nodes.
///
/// # Parameters
///
/// - `phGraphNode`: Returns newly created node.
/// - `hGraph`: Graph to which to add the node.
/// - `dependencies`: Dependencies of the node.
/// - `numDependencies`: Number of dependencies.
/// - `dptr`: Address of memory to free.
pub fn cuGraphAddMemFreeNode(
phGraphNode: *mut CUgraphNode,
hGraph: CUgraph,
dependencies: *const CUgraphNode,
numDependencies: size_t,
dptr: CUdeviceptr,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a memory free node’s parameters.
///
/// Returns the address of a memory free node `hNode` in `dptr_out`.
///
/// # Parameters
///
/// - `hNode`: Node to get the parameters for.
/// - `dptr_out`: Pointer to return the device address.
pub fn cuGraphMemFreeNodeGetParams(
hNode: CUgraphNode,
dptr_out: *mut CUdeviceptr,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Free unused memory that was cached on the specified device for use with graphs back to the OS.
///
/// Blocks which are not in use by a graph that is either currently executing or scheduled to execute are freed back to the operating system.
///
/// # Parameters
///
/// - `device`: - The device for which cached memory should be freed.
pub fn cuDeviceGraphMemTrim(device: CUdevice) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Query asynchronous allocation attributes related to graphs.
///
/// Valid attributes are.
///
/// # Parameters
///
/// - `device`: Specifies the scope of the query.
/// - `attr`: attribute to get.
/// - `value`: retrieved value.
pub fn cuDeviceGetGraphMemAttribute(
device: CUdevice,
attr: CUgraphMem_attribute,
value: *mut ::core::ffi::c_void,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Set asynchronous allocation attributes related to graphs.
///
/// Valid attributes are.
///
/// # Parameters
///
/// - `device`: Specifies the scope of the query.
/// - `attr`: attribute to get.
/// - `value`: pointer to value to set.
pub fn cuDeviceSetGraphMemAttribute(
device: CUdevice,
attr: CUgraphMem_attribute,
value: *mut ::core::ffi::c_void,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Clones a graph.
///
/// 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 clone.
///
/// Child graph nodes in the original graph are recursively copied into the clone.
///
/// # Parameters
///
/// - `phGraphClone`: Returns newly created cloned graph.
/// - `originalGraph`: Graph to clone.
pub fn cuGraphClone(phGraphClone: *mut CUgraph, originalGraph: CUgraph) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Finds a cloned version of a node.
///
/// This function returns the node in `hClonedGraph` corresponding to `hOriginalNode` in the original graph.
///
/// `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`.
///
/// # Parameters
///
/// - `phNode`: Returns handle to the cloned node.
/// - `hOriginalNode`: Handle to the original node.
/// - `hClonedGraph`: Cloned graph to query.
pub fn cuGraphNodeFindInClone(
phNode: *mut CUgraphNode,
hOriginalNode: CUgraphNode,
hClonedGraph: CUgraph,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a node’s type.
///
/// Returns the node type of `hNode` in `type`.
///
/// # Parameters
///
/// - `hNode`: Node to query.
/// - `type_`: Pointer to return the node type.
pub fn cuGraphNodeGetType(
hNode: CUgraphNode,
type_: *mut CUgraphNodeType,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the graph that contains a given graph node.
///
/// Returns the graph that contains `hNode` in `*phGraph`. If `hNode` is in a child graph, the child graph it is in is returned.
///
/// # Parameters
///
/// - `hNode`: Node to query.
pub fn cuGraphNodeGetContainingGraph(
hNode: CUgraphNode,
phGraph: *mut CUgraph,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the local node id of a given graph node.
///
/// 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.
///
/// # Parameters
///
/// - `hNode`: Node to query.
/// - `nodeId`: Pointer to return the nodeId.
pub fn cuGraphNodeGetLocalId(
hNode: CUgraphNode,
nodeId: *mut ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns an id used by tools to identify a given node.
///
/// # Parameters
///
/// - `hNode`: Node to query.
pub fn cuGraphNodeGetToolsId(
hNode: CUgraphNode,
toolsNodeId: *mut ::core::ffi::c_ulonglong,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the id of a given graph.
///
/// Returns the id of `hGraph` in `*graphId`. The value in `*graphId` will match that referenced by [`cuGraphDebugDotPrint`].
///
/// # Parameters
///
/// - `hGraph`: Graph to query.
pub fn cuGraphGetId(hGraph: CUgraph, graphId: *mut ::core::ffi::c_uint) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the id of a given graph exec.
///
/// Returns the id of `hGraphExec` in `*graphId`. The value in `*graphId` will match that referenced by [`cuGraphDebugDotPrint`].
///
/// # Parameters
///
/// - `hGraphExec`: Graph to query.
pub fn cuGraphExecGetId(
hGraphExec: CUgraphExec,
graphId: *mut ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a graph’s nodes.
///
/// 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`.
///
/// # Parameters
///
/// - `hGraph`: Graph to query.
/// - `nodes`: Pointer to return the nodes.
/// - `numNodes`: See description.
pub fn cuGraphGetNodes(
hGraph: CUgraph,
nodes: *mut CUgraphNode,
numNodes: *mut size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a graph’s root nodes.
///
/// 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`.
///
/// # Parameters
///
/// - `hGraph`: Graph to query.
/// - `rootNodes`: Pointer to return the root nodes.
/// - `numRootNodes`: See description.
pub fn cuGraphGetRootNodes(
hGraph: CUgraph,
rootNodes: *mut CUgraphNode,
numRootNodes: *mut size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a graph's dependency edges
///
/// 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 ::CUDA_ERROR_LOSSY_QUERY. If `edgeData` is non-NULL then `from` and `to` must be as well.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_LOSSY_QUERY, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _graph_thread_safety
///
///
///
/// See also: ::cuGraphGetNodes, ::cuGraphGetRootNodes, ::cuGraphAddDependencies, ::cuGraphRemoveDependencies, ::cuGraphNodeGetDependencies, ::cuGraphNodeGetDependentNodes
///
/// # Parameters
///
/// - `hGraph`: - Graph to get the edges from
/// - `from`: - Location to return edge endpoints
/// - `to`: - Location to return edge endpoints
/// - `edgeData`: - Optional location to return edge data
/// - `numEdges`: - See description
pub fn cuGraphGetEdges_v2(
hGraph: CUgraph,
from: *mut CUgraphNode,
to: *mut CUgraphNode,
edgeData: *mut CUgraphEdgeData,
numEdges: *mut size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a node's dependencies
///
/// 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`.
///
/// Note that if an edge has non-zero (non-default) edge data and `edgeData` is NULL, this API will return ::CUDA_ERROR_LOSSY_QUERY. If `edgeData` is non-NULL, then `dependencies` must be as well.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_LOSSY_QUERY, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _graph_thread_safety
///
///
///
/// See also: ::cuGraphNodeGetDependentNodes, ::cuGraphGetNodes, ::cuGraphGetRootNodes, ::cuGraphGetEdges, ::cuGraphAddDependencies, ::cuGraphRemoveDependencies
///
/// # Parameters
///
/// - `hNode`: - Node to query
/// - `dependencies`: - Pointer to return the dependencies
/// - `edgeData`: - Optional array to return edge data for each dependency
/// - `numDependencies`: - See description
pub fn cuGraphNodeGetDependencies_v2(
hNode: CUgraphNode,
dependencies: *mut CUgraphNode,
edgeData: *mut CUgraphEdgeData,
numDependencies: *mut size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a node's dependent nodes
///
/// 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`.
///
/// Note that if an edge has non-zero (non-default) edge data and `edgeData` is NULL, this API will return ::CUDA_ERROR_LOSSY_QUERY. If `edgeData` is non-NULL, then `dependentNodes` must be as well.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_LOSSY_QUERY, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _graph_thread_safety
///
///
///
/// See also: ::cuGraphNodeGetDependencies, ::cuGraphGetNodes, ::cuGraphGetRootNodes, ::cuGraphGetEdges, ::cuGraphAddDependencies, ::cuGraphRemoveDependencies
///
/// # Parameters
///
/// - `hNode`: - Node to query
/// - `dependentNodes`: - Pointer to return the dependent nodes
/// - `edgeData`: - Optional pointer to return edge data for dependent nodes
/// - `numDependentNodes`: - See description
pub fn cuGraphNodeGetDependentNodes_v2(
hNode: CUgraphNode,
dependentNodes: *mut CUgraphNode,
edgeData: *mut CUgraphEdgeData,
numDependentNodes: *mut size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Adds dependency edges to a graph
///
/// 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`.
///
/// If `numDependencies` is 0, elements in `from` and `to` will be ignored. Specifying an existing dependency will return an error.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _graph_thread_safety
///
///
///
/// See also: ::cuGraphRemoveDependencies, ::cuGraphGetEdges, ::cuGraphNodeGetDependencies, ::cuGraphNodeGetDependentNodes
///
/// # Parameters
///
/// - `hGraph`: - Graph to which dependencies are added
/// - `from`: - Array of nodes that provide the dependencies
/// - `to`: - Array of dependent nodes
/// - `edgeData`: - Optional array of edge data. If NULL, default (zeroed) edge data is assumed.
/// - `numDependencies`: - Number of dependencies to be added
pub fn cuGraphAddDependencies_v2(
hGraph: CUgraph,
from: *const CUgraphNode,
to: *const CUgraphNode,
edgeData: *const CUgraphEdgeData,
numDependencies: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Removes dependency edges from a graph
///
/// 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`.
///
/// 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.
///
/// Dependencies cannot be removed from graphs which contain allocation or free nodes. Any attempt to do so will return an error.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _graph_thread_safety
///
///
///
/// See also: ::cuGraphAddDependencies, ::cuGraphGetEdges, ::cuGraphNodeGetDependencies, ::cuGraphNodeGetDependentNodes
///
/// # Parameters
///
/// - `hGraph`: - Graph from which to remove dependencies
/// - `from`: - Array of nodes that provide the dependencies
/// - `to`: - Array of dependent nodes
/// - `edgeData`: - Optional array of edge data. If NULL, edge data is assumed to be default (zeroed).
/// - `numDependencies`: - Number of dependencies to be removed
pub fn cuGraphRemoveDependencies_v2(
hGraph: CUgraph,
from: *const CUgraphNode,
to: *const CUgraphNode,
edgeData: *const CUgraphEdgeData,
numDependencies: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Remove a node from the graph.
///
/// Removes `hNode` from its graph. This operation also severs any dependencies of other nodes on `hNode` and vice versa.
///
/// Nodes which belong to a graph which contains allocation or free nodes cannot be destroyed. Any attempt to do so will return an error.
///
/// # Parameters
///
/// - `hNode`: - Node to remove
pub fn cuGraphDestroyNode(hNode: CUgraphNode) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates an executable graph from a graph
///
/// Instantiates `hGraph` as an executable graph. The graph is validated for any structural constraints or intra-node constraints which were not previously validated. If instantiation is successful, a handle to the instantiated graph is returned in `phGraphExec`.
///
/// The `flags` parameter controls the behavior of instantiation and subsequent graph launches. Valid flags are:
///
/// - ::CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH, which configures a graph containing memory allocation nodes to automatically free any unfreed memory allocations before the graph is relaunched.
///
/// - ::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 be used to launch the graph from both the host and device. This flag can only be used on platforms which support unified addressing. This flag cannot be used in conjunction with ::CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH.
///
/// - ::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 during execution. Note that priorities are only available on kernel nodes, and are copied from stream priority during stream capture.
///
/// 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 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.
///
/// If `hGraph` contains kernels which call device-side cudaGraphLaunch() from multiple contexts, this will result in an error.
///
/// Graphs instantiated for launch on the device have additional restrictions which do not apply to host graphs:
///
/// - The graph's nodes must reside on a single context.
/// - The graph can only contain kernel nodes, memcpy nodes, memset nodes, and child graph nodes.
/// - The graph cannot be empty and must contain at least one kernel, memcpy, or memset node. Operation-specific restrictions are outlined below.
/// - Kernel nodes:
/// - Use of CUDA Dynamic Parallelism is not permitted.
/// - Cooperative launches are permitted as long as MPS is not in use.
/// - Memcpy nodes:
/// - Only copies involving device memory and/or pinned device-mapped host memory are permitted.
/// - Copies involving CUDA arrays are not permitted.
/// - Both operands must be accessible from the current context, and the current context must match the context of other nodes in the graph.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_VALUE
///
/// Note: _graph_thread_safety
///
///
///
/// See also: ::cuGraphInstantiate, ::cuGraphCreate, ::cuGraphUpload, ::cuGraphLaunch, ::cuGraphExecDestroy
///
/// # Parameters
///
/// - `phGraphExec`: - Returns instantiated graph
/// - `hGraph`: - Graph to instantiate
/// - `flags`: - Flags to control instantiation. See ::CUgraphInstantiate_flags.
pub fn cuGraphInstantiateWithFlags(
phGraphExec: *mut CUgraphExec,
hGraph: CUgraph,
flags: ::core::ffi::c_ulonglong,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates an executable graph from a graph.
///
/// 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. If instantiation is successful, a handle to the instantiated graph is returned in `phGraphExec`.
///
/// `instantiateParams` controls the behavior of instantiation and subsequent graph launches, as well as returning more detailed information in the event of an error. [CUDA_GRAPH_INSTANTIATE_PARAMS](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__GRAPH__INSTANTIATE__PARAMS.html#structcuda__graph__instantiate__params) is defined as:
///
/// The `flags` field controls the behavior of instantiation and subsequent graph launches. Valid flags are:
///
/// 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 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.
///
/// If `hGraph` contains kernels which call device-side cudaGraphLaunch() from multiple contexts, this will result in an error.
///
/// Graphs instantiated for launch on the device have additional restrictions which do not apply to host graphs:
///
/// 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:
///
/// If instantiation is successful, `result_out` will be set to [`CUgraphInstantiateResult_enum::CUDA_GRAPH_INSTANTIATE_SUCCESS`], and `hErrNode_out` will be set to NULL.
///
/// # Parameters
///
/// - `phGraphExec`: Returns instantiated graph.
/// - `hGraph`: Graph to instantiate.
/// - `instantiateParams`: Instantiation parameters.
pub fn cuGraphInstantiateWithParams(
phGraphExec: *mut CUgraphExec,
hGraph: CUgraph,
instantiateParams: *mut CUDA_GRAPH_INSTANTIATE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Query the instantiation flags of an executable graph.
///
/// 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.
///
/// # Parameters
///
/// - `hGraphExec`: The executable graph to query.
/// - `flags`: Returns the instantiation flags.
pub fn cuGraphExecGetFlags(
hGraphExec: CUgraphExec,
flags: *mut cuuint64_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the parameters for a kernel node in the given graphExec
///
/// 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.
///
/// `hNode` must not have been removed from the original graph. All `nodeParams` fields may change, but the following restrictions apply to `func` updates:
///
/// - The owning context of the function cannot change.
/// - A node whose function originally did not use CUDA dynamic parallelism cannot be updated to a function which uses CDP
/// - A node whose function originally did not make device-side update calls cannot be updated to a function which makes device-side update calls.
/// - If `hGraphExec` was not instantiated for device launch, a node whose function originally did not use device-side cudaGraphLaunch() cannot be updated to a function which uses device-side cudaGraphLaunch() unless the node resides on the same context as nodes which contained such calls at instantiate-time. If no such calls were present at instantiation, these updates cannot be performed at all.
///
/// 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.
///
/// 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 it is being updated from the device will result in undefined behavior.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_VALUE,
///
/// Note: _graph_thread_safety
///
///
///
/// See also: ::cuGraphExecNodeSetParams, ::cuGraphAddKernelNode, ::cuGraphKernelNodeSetParams, ::cuGraphExecMemcpyNodeSetParams, ::cuGraphExecMemsetNodeSetParams, ::cuGraphExecHostNodeSetParams, ::cuGraphExecChildGraphNodeSetParams, ::cuGraphExecEventRecordNodeSetEvent, ::cuGraphExecEventWaitNodeSetEvent, ::cuGraphExecExternalSemaphoresSignalNodeSetParams, ::cuGraphExecExternalSemaphoresWaitNodeSetParams, ::cuGraphExecUpdate, ::cuGraphInstantiate
///
/// # Parameters
///
/// - `hGraphExec`: - The executable graph in which to set the specified node
/// - `hNode`: - kernel node from the graph from which graphExec was instantiated
/// - `nodeParams`: - Updated Parameters to set
pub fn cuGraphExecKernelNodeSetParams_v2(
hGraphExec: CUgraphExec,
hNode: CUgraphNode,
nodeParams: *const CUDA_KERNEL_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the parameters for a memcpy node in the given graphExec.
///
/// 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.
///
/// 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 operands and the memory operands in `copyParams` must be 1-dimensional. Zero-length operations are not supported.
///
/// 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.
///
/// Returns [`CUresult::CUDA_ERROR_INVALID_VALUE`] if the memory operands’ mappings changed or either the original or new memory operands are multidimensional.
///
/// # Parameters
///
/// - `hGraphExec`: The executable graph in which to set the specified node.
/// - `hNode`: Memcpy node from the graph which was used to instantiate graphExec.
/// - `copyParams`: The updated parameters to set.
/// - `ctx`: Context on which to run the node.
pub fn cuGraphExecMemcpyNodeSetParams(
hGraphExec: CUgraphExec,
hNode: CUgraphNode,
copyParams: *const CUDA_MEMCPY3D,
ctx: CUcontext,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the parameters for a memset node in the given graphExec.
///
/// 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.
///
/// Zero sized operations are not supported.
///
/// The new destination pointer in memsetParams must be to the same kind of allocation as the original destination pointer and have the same context association and device mapping as the original destination pointer.
///
/// Both the value and pointer address may be updated.
///
/// Changing other aspects of the memset (width, height, element size or pitch) may cause the update to be rejected. Specifically, for 2d memsets, all dimension changes are rejected. For 1d memsets, changes in height are explicitly rejected and other changes are opportunistically allowed if the resulting work maps onto the work resources already allocated for the node.
///
/// 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.
///
/// # Parameters
///
/// - `hGraphExec`: The executable graph in which to set the specified node.
/// - `hNode`: Memset node from the graph which was used to instantiate graphExec.
/// - `memsetParams`: The updated parameters to set.
/// - `ctx`: Context on which to run the node.
pub fn cuGraphExecMemsetNodeSetParams(
hGraphExec: CUgraphExec,
hNode: CUgraphNode,
memsetParams: *const CUDA_MEMSET_NODE_PARAMS,
ctx: CUcontext,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the parameters for a host node in the given graphExec.
///
/// 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.
///
/// 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.
///
/// # Parameters
///
/// - `hGraphExec`: The executable graph in which to set the specified node.
/// - `hNode`: Host node from the graph which was used to instantiate graphExec.
/// - `nodeParams`: The updated parameters to set.
pub fn cuGraphExecHostNodeSetParams(
hGraphExec: CUgraphExec,
hNode: CUgraphNode,
nodeParams: *const CUDA_HOST_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Updates node parameters in the child graph node in the given graphExec.
///
/// 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.
///
/// 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.
///
/// The topology of `childGraph`, as well as the node insertion order, must match that of the graph contained in `hNode`. See cuGraphExecUpdate() for a list of restrictions on what can be updated in an instantiated graph. The update is recursive, so child graph nodes contained within the top level child graph will also be updated.
///
/// # Parameters
///
/// - `hGraphExec`: The executable graph in which to set the specified node.
/// - `hNode`: Host node from the graph which was used to instantiate graphExec.
/// - `childGraph`: The graph supplying the updated parameters.
pub fn cuGraphExecChildGraphNodeSetParams(
hGraphExec: CUgraphExec,
hNode: CUgraphNode,
childGraph: CUgraph,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the event for an event record node in the given graphExec.
///
/// 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.
///
/// 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.
///
/// # Parameters
///
/// - `hGraphExec`: The executable graph in which to set the specified node.
/// - `hNode`: event record node from the graph from which graphExec was instantiated.
/// - `event`: Updated event to use.
pub fn cuGraphExecEventRecordNodeSetEvent(
hGraphExec: CUgraphExec,
hNode: CUgraphNode,
event: CUevent,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the event for an event wait node in the given graphExec.
///
/// 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.
///
/// 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.
///
/// # Parameters
///
/// - `hGraphExec`: The executable graph in which to set the specified node.
/// - `hNode`: event wait node from the graph from which graphExec was instantiated.
/// - `event`: Updated event to use.
pub fn cuGraphExecEventWaitNodeSetEvent(
hGraphExec: CUgraphExec,
hNode: CUgraphNode,
event: CUevent,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the parameters for an external semaphore signal node in the given graphExec.
///
/// 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.
///
/// `hNode` must not have been removed from the original graph.
///
/// 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.
///
/// Changing `nodeParams->numExtSems` is not supported.
///
/// # Parameters
///
/// - `hGraphExec`: The executable graph in which to set the specified node.
/// - `hNode`: semaphore signal node from the graph from which graphExec was instantiated.
/// - `nodeParams`: Updated Parameters to set.
pub fn cuGraphExecExternalSemaphoresSignalNodeSetParams(
hGraphExec: CUgraphExec,
hNode: CUgraphNode,
nodeParams: *const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the parameters for an external semaphore wait node in the given graphExec.
///
/// 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.
///
/// `hNode` must not have been removed from the original graph.
///
/// 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.
///
/// Changing `nodeParams->numExtSems` is not supported.
///
/// # Parameters
///
/// - `hGraphExec`: The executable graph in which to set the specified node.
/// - `hNode`: semaphore wait node from the graph from which graphExec was instantiated.
/// - `nodeParams`: Updated Parameters to set.
pub fn cuGraphExecExternalSemaphoresWaitNodeSetParams(
hGraphExec: CUgraphExec,
hNode: CUgraphNode,
nodeParams: *const CUDA_EXT_SEM_WAIT_NODE_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Enables or disables the specified node in the given graphExec.
///
/// Sets `hNode` to be either enabled or disabled. Disabled nodes are functionally equivalent to empty nodes until they are reenabled. Existing node parameters are not affected by disabling/enabling the node.
///
/// 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.
///
/// 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.
///
/// 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 it is being updated from the device will result in undefined behavior.
///
/// # Parameters
///
/// - `hGraphExec`: The executable graph in which to set the specified node.
/// - `hNode`: Node from the graph from which graphExec was instantiated.
/// - `isEnabled`: Node is enabled if != 0, otherwise the node is disabled.
pub fn cuGraphNodeSetEnabled(
hGraphExec: CUgraphExec,
hNode: CUgraphNode,
isEnabled: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Query whether a node in the given graphExec is enabled.
///
/// Sets isEnabled to 1 if `hNode` is enabled, or 0 if `hNode` is disabled.
///
/// 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.
///
/// # Parameters
///
/// - `hGraphExec`: The executable graph in which to set the specified node.
/// - `hNode`: Node from the graph from which graphExec was instantiated.
/// - `isEnabled`: Location to return the enabled status of the node.
pub fn cuGraphNodeGetEnabled(
hGraphExec: CUgraphExec,
hNode: CUgraphNode,
isEnabled: *mut ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Uploads an executable graph in a stream.
///
/// 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`.
///
/// # Parameters
///
/// - `hGraphExec`: Executable graph to upload.
/// - `hStream`: Stream in which to upload the graph.
pub fn cuGraphUpload(hGraphExec: CUgraphExec, hStream: CUstream) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Launches an executable graph in a stream.
///
/// 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.
///
/// 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`].
///
/// # Parameters
///
/// - `hGraphExec`: Executable graph to launch.
/// - `hStream`: Stream in which to launch the graph.
pub fn cuGraphLaunch(hGraphExec: CUgraphExec, hStream: CUstream) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Destroys an executable graph.
///
/// 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 asynchronously on completion.
///
/// # Parameters
///
/// - `hGraphExec`: - Executable graph to destroy
pub fn cuGraphExecDestroy(hGraphExec: CUgraphExec) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Destroys a graph.
///
/// Destroys the graph specified by `hGraph`, as well as all of its nodes.
///
/// # Parameters
///
/// - `hGraph`: - Graph to destroy
pub fn cuGraphDestroy(hGraph: CUgraph) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Check whether an executable graph can be updated with a graph and perform the update if possible
///
/// Updates the node parameters in the instantiated graph specified by `hGraphExec` with the node parameters in a topologically identical graph specified by `hGraph`.
///
/// Limitations:
///
/// - Kernel nodes:
/// - The owning context of the function cannot change.
/// - A node whose function originally did not use CUDA dynamic parallelism cannot be updated to a function which uses CDP.
/// - A node whose function originally did not make device-side update calls cannot be updated to a function which makes device-side update calls.
/// - A cooperative node cannot be updated to a non-cooperative node, and vice-versa.
/// - If the graph was instantiated with CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY, the priority attribute cannot change. Equality is checked on the originally requested priority values, before they are clamped to the device's supported range.
/// - If `hGraphExec` was not instantiated for device launch, a node whose function originally did not use device-side cudaGraphLaunch() cannot be updated to a function which uses device-side cudaGraphLaunch() unless the node resides on the same context as nodes which contained such calls at instantiate-time. If no such calls were present at instantiation, these updates cannot be performed at all.
/// - Neither `hGraph` nor `hGraphExec` may contain device-updatable kernel nodes.
/// - Memset and memcpy nodes:
/// - The CUDA device(s) to which the operand(s) was allocated/mapped cannot change.
/// - The source/destination memory must be allocated from the same contexts as the original source/destination memory.
/// - For 2d memsets, only address and assigned value may be updated.
/// - For 1d memsets, updating dimensions is also allowed, but may fail if the resulting operation doesn't map onto the work resources already allocated for the node.
/// - Additional memcpy node restrictions:
/// - Changing either the source or destination memory type(i.e. CU_MEMORYTYPE_DEVICE, CU_MEMORYTYPE_ARRAY, etc.) is not supported.
/// - External semaphore wait nodes and record nodes:
/// - Changing the number of semaphores is not supported.
/// - Conditional nodes:
/// - Changing node parameters is not supported.
/// - Changing parameters of nodes within the conditional body graph is subject to the rules above.
/// - Conditional handle flags and default values are updated as part of the graph update.
///
/// Note: The API may add further restrictions in future releases. The return code should always be checked.
///
/// cuGraphExecUpdate sets the result member of `resultInfo` to CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED under the following conditions:
/// - The count of nodes directly in `hGraphExec` and `hGraph` differ, in which case resultInfo->errorNode is set to NULL.
/// - `hGraph` has more exit nodes than `hGraph`, in which case resultInfo->errorNode is set to one of the exit nodes in hGraph.
/// - 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`.
/// - 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 a dependency does not match when the nodes are already paired based on other edges examined in the graph.
///
/// cuGraphExecUpdate sets the result member of `resultInfo` to:
/// - CU_GRAPH_EXEC_UPDATE_ERROR if passed an invalid value.
/// - CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED if the graph topology changed
/// - 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`.
/// - CU_GRAPH_EXEC_UPDATE_ERROR_UNSUPPORTED_FUNCTION_CHANGE if the function changed in an unsupported way(see note above), in which case `hErrorNode_out` is set to the node from `hGraph`
/// - CU_GRAPH_EXEC_UPDATE_ERROR_PARAMETERS_CHANGED if any parameters to a node changed in a way that is not supported, in which case `hErrorNode_out` is set to the node from `hGraph`.
/// - CU_GRAPH_EXEC_UPDATE_ERROR_ATTRIBUTES_CHANGED if any attributes of a node changed in a way that is not supported, in which case `hErrorNode_out` is set to the node from `hGraph`.
/// - CU_GRAPH_EXEC_UPDATE_ERROR_NOT_SUPPORTED if something about a node is unsupported, like the node's type or configuration, in which case `hErrorNode_out` is set to the node from `hGraph`
///
/// If the update fails for a reason not listed above, the result member of `resultInfo` will be set to CU_GRAPH_EXEC_UPDATE_ERROR. If the update succeeds, the result member will be set to CU_GRAPH_EXEC_UPDATE_SUCCESS.
///
/// cuGraphExecUpdate returns CUDA_SUCCESS when the updated was performed successfully. It returns CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE if the graph update was not performed because it included changes which violated constraints specific to instantiated graph update.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE,
///
/// Note: _graph_thread_safety
///
///
///
/// See also: ::cuGraphInstantiate
///
/// # Parameters
///
/// - `hGraphExec`: The instantiated graph to be updated
/// - `hGraph`: The graph containing the updated parameters
/// - `resultInfo`: the error info structure
pub fn cuGraphExecUpdate_v2(
hGraphExec: CUgraphExec,
hGraph: CUgraph,
resultInfo: *mut CUgraphExecUpdateResultInfo,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Copies attributes from source node to destination node.
///
/// Copies attributes from source node `src` to destination node `dst`. Both node must have the same context.
///
/// # Parameters
///
/// - `dst`: Destination node.
/// - `src`: Source node For list of attributes see CUkernelNodeAttrID.
pub fn cuGraphKernelNodeCopyAttributes(
dst: CUgraphNode,
src: CUgraphNode,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Queries node attribute.
///
/// Queries attribute `attr` from node `hNode` and stores it in corresponding member of `value_out`.
pub fn cuGraphKernelNodeGetAttribute(
hNode: CUgraphNode,
attr: CUkernelNodeAttrID,
value_out: *mut CUkernelNodeAttrValue,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets node attribute.
///
/// Sets attribute `attr` on node `hNode` from corresponding attribute of `value`.
pub fn cuGraphKernelNodeSetAttribute(
hNode: CUgraphNode,
attr: CUkernelNodeAttrID,
value: *const CUkernelNodeAttrValue,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Write a DOT file describing graph structure.
///
/// 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 and memcpy direction. `flags` can be specified to write more detailed information about each node type such as parameter values, kernel attributes, node and function handles.
///
/// # Parameters
///
/// - `hGraph`: The graph to create a DOT file from.
/// - `path`: The path to write the DOT file to.
/// - `flags`: Flags from CUgraphDebugDot_flags for specifying which additional node information to write.
pub fn cuGraphDebugDotPrint(
hGraph: CUgraph,
path: *const ::core::ffi::c_char,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Create a user object.
///
/// Create a user object with the specified destructor callback and initial reference count. The initial references are owned by the caller.
///
/// Destructor callbacks cannot make CUDA API calls and should avoid blocking behavior, as they are executed by a shared internal thread. Another thread may be signaled to perform such actions, if it does not block forward progress of tasks scheduled through CUDA.
///
/// See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects.
///
/// # Parameters
///
/// - `object_out`: Location to return the user object handle.
/// - `ptr`: The pointer to pass to the destroy function.
/// - `destroy`: Callback to free the user object when it is no longer in use.
/// - `initialRefcount`: The initial refcount to create the object with, typically 1. The initial references are owned by the calling thread.
/// - `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 synchronization of the callback should signal its completion manually.
pub fn cuUserObjectCreate(
object_out: *mut CUuserObject,
ptr: *mut ::core::ffi::c_void,
destroy: CUhostFn,
initialRefcount: ::core::ffi::c_uint,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Retain a reference to a user object.
///
/// Retains new references to a user object. The new references are owned by the caller.
///
/// See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects.
///
/// # Parameters
///
/// - `object`: The object to retain.
/// - `count`: The number of references to retain, typically 1. Must be nonzero and not larger than INT_MAX.
pub fn cuUserObjectRetain(
object: CUuserObject,
count: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Release a reference to a user object.
///
/// Releases user object references owned by the caller. The object’s destructor is invoked if the reference count reaches zero.
///
/// It is undefined behavior to release references not owned by the caller, or to use a user object handle after all references are released.
///
/// See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects.
///
/// # Parameters
///
/// - `object`: The object to release.
/// - `count`: The number of references to release, typically 1. Must be nonzero and not larger than INT_MAX.
pub fn cuUserObjectRelease(
object: CUuserObject,
count: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Retain a reference to a user object from a graph.
///
/// Creates or moves user object references that will be owned by a CUDA graph.
///
/// See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects.
///
/// # Parameters
///
/// - `graph`: The graph to associate the reference with.
/// - `object`: The user object to retain a reference for.
/// - `count`: The number of references to add to the graph, typically 1. Must be nonzero and not larger than INT_MAX.
/// - `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.
pub fn cuGraphRetainUserObject(
graph: CUgraph,
object: CUuserObject,
count: ::core::ffi::c_uint,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Release a user object reference from a graph.
///
/// Releases user object references owned by a graph.
///
/// See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects.
///
/// # Parameters
///
/// - `graph`: The graph that will release the reference.
/// - `object`: The user object to release a reference for.
/// - `count`: The number of references to release, typically 1. Must be nonzero and not larger than INT_MAX.
pub fn cuGraphReleaseUserObject(
graph: CUgraph,
object: CUuserObject,
count: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Adds a node of arbitrary type to a graph
///
/// 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.
///
/// `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 to ensure all bytes are initialized.
///
/// Note that for some node types, `nodeParams` may contain "out parameters" which are modified during the call, such as `nodeParams->alloc.dptr`.
///
/// A handle to the new node will be returned in `phGraphNode`.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_NOT_SUPPORTED
///
/// Note: _graph_thread_safety
///
///
///
/// See also: ::cuGraphCreate, ::cuGraphNodeSetParams, ::cuGraphExecNodeSetParams
///
/// # Parameters
///
/// - `phGraphNode`: - Returns newly created node
/// - `hGraph`: - Graph to which to add the node
/// - `dependencies`: - Dependencies of the node
/// - `dependencyData`: - Optional edge data for the dependencies. If NULL, the data is assumed to be default (zeroed) for all dependencies.
/// - `numDependencies`: - Number of dependencies
/// - `nodeParams`: - Specification of the node
pub fn cuGraphAddNode_v2(
phGraphNode: *mut CUgraphNode,
hGraph: CUgraph,
dependencies: *const CUgraphNode,
dependencyData: *const CUgraphEdgeData,
numDependencies: size_t,
nodeParams: *mut CUgraphNodeParams,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Adds a node of arbitrary type to a graph.
///
/// 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.
///
/// `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 to ensure all bytes are initialized.
///
/// Note that for some node types, `nodeParams` may contain “out parameters” which are modified during the call, such as `nodeParams->alloc.dptr`.
///
/// For kernel nodes, if both the kernel node’s [`CUfunction`] and ctx are non-NULL, the underlying device context of ctx must match the device context that the [`CUfunction`] was loaded into; otherwise the call returns [`cudaError_enum::CUDA_ERROR_INVALID_CONTEXT`].
///
/// A handle to the new node will be returned in `phGraphNode`.
///
/// # Parameters
///
/// - `phGraphNode`: Returns newly created node.
/// - `hGraph`: Graph to which to add the node.
/// - `dependencies`: Dependencies of the node.
/// - `dependencyData`: Optional edge data for the dependencies. If NULL, the data is assumed to be default (zeroed) for all dependencies.
/// - `numDependencies`: Number of dependencies.
/// - `nodeParams`: Specification of the node.
pub fn cuGraphAddNode_v3(
phGraphNode: *mut CUgraphNode,
hGraph: CUgraph,
dependencies: *const CUgraphNode,
dependencyData: *const CUgraphEdgeData,
numDependencies: size_t,
nodeParams: *mut CUgraphNodeParams,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Update a graph node’s parameters.
///
/// 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.
///
/// Modifying parameters is not supported for node types [`CUgraphNodeType::CU_GRAPH_NODE_TYPE_MEM_ALLOC`] and [`CUgraphNodeType::CU_GRAPH_NODE_TYPE_MEM_FREE`].
///
/// # Parameters
///
/// - `hNode`: Node to set the parameters for.
/// - `nodeParams`: Parameters to copy.
pub fn cuGraphNodeSetParams(
hNode: CUgraphNode,
nodeParams: *mut CUgraphNodeParams,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Update a graph node’s parameters.
///
/// 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.
///
/// Modifying parameters is not supported for node types [`CUgraphNodeType::CU_GRAPH_NODE_TYPE_MEM_ALLOC`] and [`CUgraphNodeType::CU_GRAPH_NODE_TYPE_MEM_FREE`].
///
/// For kernel nodes, if both the kernel node’s [`CUfunction`] and ctx are non-NULL, the underlying device context of ctx must match the device context that the [`CUfunction`] was loaded into; otherwise the call returns [`cudaError_enum::CUDA_ERROR_INVALID_CONTEXT`].
///
/// # Parameters
///
/// - `hNode`: Node to set the parameters for.
/// - `nodeParams`: Parameters to copy.
pub fn cuGraphNodeSetParams_v2(
hNode: CUgraphNode,
nodeParams: *mut CUgraphNodeParams,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Return a graph node’s parameters.
///
/// Returns the parameters of graph node `hNode` in `*nodeParams`.
///
/// 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 pointed to from `*nodeParams` must not be modified.
///
/// The returned parameters are a description of the node, but may not be identical to the struct provided at creation and may not be suitable for direct creation of identical nodes. This is because parameters may be partially unspecified and filled in by the driver at creation, may reference non-copyable handles, or may describe ownership semantics or other parameters that govern behavior of node creation but are not part of the final functional descriptor.
///
/// # Parameters
///
/// - `hNode`: Node to get the parameters for.
/// - `nodeParams`: Pointer to return the parameters.
pub fn cuGraphNodeGetParams(
hNode: CUgraphNode,
nodeParams: *mut CUgraphNodeParams,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Update a graph node’s parameters in an instantiated graph.
///
/// 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.
///
/// 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.
///
/// Allowed changes to parameters on executable graphs are as follows.
///
/// # Parameters
///
/// - `hGraphExec`: The executable graph in which to update the specified node.
/// - `hNode`: Corresponding node from the graph from which graphExec was instantiated.
/// - `nodeParams`: Updated Parameters to set.
pub fn cuGraphExecNodeSetParams(
hGraphExec: CUgraphExec,
hNode: CUgraphNode,
nodeParams: *mut CUgraphNodeParams,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Create a conditional handle.
///
/// Creates a conditional handle associated with `hGraph`.
///
/// The conditional handle must be associated with a conditional node in this graph or one of its children.
///
/// Handles not associated with a conditional node may cause graph instantiation to fail.
///
/// Handles can only be set from the context with which they are associated.
///
/// # Parameters
///
/// - `pHandle_out`: Pointer used to return the handle to the caller.
/// - `hGraph`: Graph which will contain the conditional node using this handle.
/// - `ctx`: Context for the handle and associated conditional node.
/// - `defaultLaunchValue`: Optional initial value for the conditional variable. Applied at the beginning of each graph execution if CU_GRAPH_COND_ASSIGN_DEFAULT is set in `flags`.
/// - `flags`: Currently must be CU_GRAPH_COND_ASSIGN_DEFAULT or 0.
pub fn cuGraphConditionalHandleCreate(
pHandle_out: *mut CUgraphConditionalHandle,
hGraph: CUgraph,
ctx: CUcontext,
defaultLaunchValue: ::core::ffi::c_uint,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns occupancy of a function.
///
/// Returns in `*numBlocks` the number of the maximum active blocks per streaming multiprocessor.
///
/// 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.
///
/// # Parameters
///
/// - `numBlocks`: Returned occupancy.
/// - `func`: Kernel for which occupancy is calculated.
/// - `blockSize`: Block size the kernel is intended to be launched with.
/// - `dynamicSMemSize`: Per-block dynamic shared memory usage intended, in bytes.
pub fn cuOccupancyMaxActiveBlocksPerMultiprocessor(
numBlocks: *mut ::core::ffi::c_int,
func: CUfunction,
blockSize: ::core::ffi::c_int,
dynamicSMemSize: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns occupancy of a function.
///
/// Returns in `*numBlocks` the number of the maximum active blocks per streaming multiprocessor.
///
/// The `Flags` parameter controls how special cases are handled. The valid flags are:
///
/// 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.
///
/// # Parameters
///
/// - `numBlocks`: Returned occupancy.
/// - `func`: Kernel for which occupancy is calculated.
/// - `blockSize`: Block size the kernel is intended to be launched with.
/// - `dynamicSMemSize`: Per-block dynamic shared memory usage intended, in bytes.
/// - `flags`: Requested behavior for the occupancy calculator.
pub fn cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
numBlocks: *mut ::core::ffi::c_int,
func: CUfunction,
blockSize: ::core::ffi::c_int,
dynamicSMemSize: size_t,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Suggest a launch configuration with reasonable occupancy.
///
/// Returns in `*blockSize` a reasonable block size that can achieve the maximum occupancy (or, the maximum number of active warps with the fewest blocks per multiprocessor), and in `*minGridSize` the minimum grid size to achieve the maximum occupancy.
///
/// If `blockSizeLimit` is 0, the configurator will use the maximum block size permitted by the device / function instead.
///
/// If per-block dynamic shared memory allocation is not needed, the user should leave both `blockSizeToDynamicSMemSize` and `dynamicSMemSize` as 0.
///
/// If per-block dynamic shared memory allocation is needed, then if the dynamic shared memory size is constant regardless of block size, the size should be passed through `dynamicSMemSize`, and `blockSizeToDynamicSMemSize` should be NULL.
///
/// Otherwise, if the per-block dynamic shared memory size varies with different block sizes, the user needs to provide a unary function through `blockSizeToDynamicSMemSize` that computes the dynamic shared memory needed by `func` for any given block size. `dynamicSMemSize` is ignored. An example signature is:
///
/// 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.
///
/// # Parameters
///
/// - `minGridSize`: Returned minimum grid size needed to achieve the maximum occupancy.
/// - `blockSize`: Returned maximum block size that can achieve the maximum occupancy.
/// - `func`: Kernel for which launch configuration is calculated.
/// - `blockSizeToDynamicSMemSize`: A function that calculates how much per-block dynamic shared memory `func` uses based on the block size.
/// - `dynamicSMemSize`: Dynamic shared memory usage intended, in bytes.
/// - `blockSizeLimit`: The maximum block size `func` is designed to handle.
pub fn cuOccupancyMaxPotentialBlockSize(
minGridSize: *mut ::core::ffi::c_int,
blockSize: *mut ::core::ffi::c_int,
func: CUfunction,
blockSizeToDynamicSMemSize: CUoccupancyB2DSize,
dynamicSMemSize: size_t,
blockSizeLimit: ::core::ffi::c_int,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Suggest a launch configuration with reasonable occupancy.
///
/// An extended version of [`cuOccupancyMaxPotentialBlockSize`]. In addition to arguments passed to [`cuOccupancyMaxPotentialBlockSize`], [`cuOccupancyMaxPotentialBlockSizeWithFlags`] also takes a `Flags` parameter.
///
/// The `Flags` parameter controls how special cases are handled. The valid flags are:
///
/// 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.
///
/// # Parameters
///
/// - `minGridSize`: Returned minimum grid size needed to achieve the maximum occupancy.
/// - `blockSize`: Returned maximum block size that can achieve the maximum occupancy.
/// - `func`: Kernel for which launch configuration is calculated.
/// - `blockSizeToDynamicSMemSize`: A function that calculates how much per-block dynamic shared memory `func` uses based on the block size.
/// - `dynamicSMemSize`: Dynamic shared memory usage intended, in bytes.
/// - `blockSizeLimit`: The maximum block size `func` is designed to handle.
/// - `flags`: Options.
pub fn cuOccupancyMaxPotentialBlockSizeWithFlags(
minGridSize: *mut ::core::ffi::c_int,
blockSize: *mut ::core::ffi::c_int,
func: CUfunction,
blockSizeToDynamicSMemSize: CUoccupancyB2DSize,
dynamicSMemSize: size_t,
blockSizeLimit: ::core::ffi::c_int,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns dynamic shared memory available per block when launching `numBlocks` blocks on SM.
///
/// Returns in `*dynamicSmemSize` the maximum size of dynamic shared memory to allow `numBlocks` blocks per SM.
///
/// 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.
///
/// # Parameters
///
/// - `dynamicSmemSize`: Returned maximum dynamic shared memory.
/// - `func`: Kernel function for which occupancy is calculated.
/// - `numBlocks`: Number of blocks to fit on SM.
/// - `blockSize`: Size of the blocks.
pub fn cuOccupancyAvailableDynamicSMemPerBlock(
dynamicSmemSize: *mut size_t,
func: CUfunction,
numBlocks: ::core::ffi::c_int,
blockSize: ::core::ffi::c_int,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Given the kernel function (`func`) and launch configuration (`config`), return the maximum cluster size in `*clusterSize`.
///
/// The cluster dimensions in `config` are ignored. If func has a required cluster size set (see ::cudaFuncGetAttributes / [`cuFuncGetAttribute`]),`*clusterSize` will reflect the required cluster size.
///
/// By default this function will always return a value that’s portable on future hardware. A higher value may be returned if the kernel function allows non-portable cluster sizes.
///
/// This function will respect the compile time launch bounds.
///
/// 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.
///
/// # Parameters
///
/// - `clusterSize`: Returned maximum cluster size that can be launched for the given kernel function and launch configuration.
/// - `func`: Kernel function for which maximum cluster size is calculated.
/// - `config`: Launch configuration for the given kernel function.
pub fn cuOccupancyMaxPotentialClusterSize(
clusterSize: *mut ::core::ffi::c_int,
func: CUfunction,
config: *const CUlaunchConfig,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// 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`.
///
/// If the function has required cluster size already set (see ::cudaFuncGetAttributes / [`cuFuncGetAttribute`]), the cluster size from config must either be unspecified or match the required size. Without required sizes, the cluster size must be specified in config, else the function will return an error.
///
/// Note that various attributes of the kernel function may affect occupancy calculation. Runtime environment may affect how the hardware schedules the clusters, so the calculated occupancy is not guaranteed to be achievable.
///
/// 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.
///
/// # Parameters
///
/// - `numClusters`: Returned maximum number of clusters that could co-exist on the target device.
/// - `func`: Kernel function for which maximum number of clusters are calculated.
/// - `config`: Launch configuration for the given kernel function.
pub fn cuOccupancyMaxActiveClusters(
numClusters: *mut ::core::ffi::c_int,
func: CUfunction,
config: *const CUlaunchConfig,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Binds an array as a texture reference.
///
/// Binds the CUDA array `hArray` to the texture reference `hTexRef`. Any previous address or CUDA array state associated with the texture reference is superseded by this function. `Flags` must be set to [`CU_TRSA_OVERRIDE_FORMAT`]. Any CUDA array previously bound to `hTexRef` is unbound.
///
/// # Parameters
///
/// - `hTexRef`: Texture reference to bind.
/// - `hArray`: Array to bind.
/// - `Flags`: Options (must be [`CU_TRSA_OVERRIDE_FORMAT`]).
#[deprecated]
pub fn cuTexRefSetArray(
hTexRef: CUtexref,
hArray: CUarray,
Flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Binds a mipmapped array to a texture reference.
///
/// Binds the CUDA mipmapped array `hMipmappedArray` to the texture reference `hTexRef`. Any previous address or CUDA array state associated with the texture reference is superseded by this function. `Flags` must be set to [`CU_TRSA_OVERRIDE_FORMAT`]. Any CUDA array previously bound to `hTexRef` is unbound.
///
/// # Parameters
///
/// - `hTexRef`: Texture reference to bind.
/// - `hMipmappedArray`: Mipmapped array to bind.
/// - `Flags`: Options (must be [`CU_TRSA_OVERRIDE_FORMAT`]).
#[deprecated]
pub fn cuTexRefSetMipmappedArray(
hTexRef: CUtexref,
hMipmappedArray: CUmipmappedArray,
Flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Binds an address as a texture reference
///
///
///
/// Deprecated:
///
/// Binds a linear address range to the texture reference `hTexRef`. Any previous address or CUDA array state associated with the texture reference is superseded by this function. Any memory previously bound to `hTexRef` is unbound.
///
/// Since the hardware enforces an alignment requirement on texture base addresses, ::cuTexRefSetAddress() 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 size and passed to kernels that read from the texture so they can be applied to the ::tex1Dfetch() function.
///
/// If the device memory pointer was returned from ::cuMemAlloc(), the offset is guaranteed to be 0 and NULL may be passed as the `ByteOffset` parameter.
///
/// The total number of elements (or texels) in the linear address range cannot exceed ::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().
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
///
///
/// See also: ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, ::cuTexRefSetFilterMode, ::cuTexRefSetFlags, ::cuTexRefSetFormat, ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat
///
/// # Parameters
///
/// - `ByteOffset`: - Returned byte offset
/// - `hTexRef`: - Texture reference to bind
/// - `dptr`: - Device pointer to bind
/// - `bytes`: - Size of memory to bind in bytes
#[deprecated]
pub fn cuTexRefSetAddress_v2(
ByteOffset: *mut size_t,
hTexRef: CUtexref,
dptr: CUdeviceptr,
bytes: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Binds an address as a 2D texture reference
///
///
///
/// Deprecated:
///
/// Binds a linear address range to the texture reference `hTexRef`. Any previous address or CUDA array state associated with the texture reference is superseded by this function. Any memory previously bound to `hTexRef` is unbound.
///
/// Using a ::tex2D() function inside a kernel requires a call to either ::cuTexRefSetArray() to bind the corresponding texture reference to an array, or ::cuTexRefSetAddress2D() to bind the texture reference to linear memory.
///
/// Function calls to ::cuTexRefSetFormat() cannot follow calls to ::cuTexRefSetAddress2D() for the same texture reference.
///
/// It is required that `dptr` be aligned to the appropriate hardware-specific texture alignment. You can query this value using the device attribute ::CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT. If an unaligned `dptr` is supplied, ::CUDA_ERROR_INVALID_VALUE is returned.
///
/// `Pitch` has to be aligned to the hardware-specific texture pitch alignment. This value can be queried using the device attribute ::CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT. If an unaligned `Pitch` is supplied, ::CUDA_ERROR_INVALID_VALUE is returned.
///
/// Width and Height, which are specified in elements (or texels), cannot exceed ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH and ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT respectively. `Pitch`, which is specified in bytes, cannot exceed ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
///
///
/// See also: ::cuTexRefSetAddress, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, ::cuTexRefSetFilterMode, ::cuTexRefSetFlags, ::cuTexRefSetFormat, ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat
///
/// # Parameters
///
/// - `hTexRef`: - Texture reference to bind
/// - `desc`: - Descriptor of CUDA array
/// - `dptr`: - Device pointer to bind
/// - `Pitch`: - Line pitch in bytes
#[deprecated]
pub fn cuTexRefSetAddress2D_v3(
hTexRef: CUtexref,
desc: *const CUDA_ARRAY_DESCRIPTOR,
dptr: CUdeviceptr,
Pitch: size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the format for a texture reference.
///
/// Specifies the format of the data to be read by the texture reference `hTexRef`. `fmt` and `NumPackedComponents` are exactly analogous to the ::Format and ::NumChannels members of the CUDA_ARRAY_DESCRIPTOR structure: They specify the format of each component and the number of components per array element.
///
/// # Parameters
///
/// - `hTexRef`: Texture reference.
/// - `fmt`: Format to set.
/// - `NumPackedComponents`: Number of components per array element.
#[deprecated]
pub fn cuTexRefSetFormat(
hTexRef: CUtexref,
fmt: CUarray_format,
NumPackedComponents: ::core::ffi::c_int,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the addressing mode for a texture reference.
///
/// Specifies the addressing mode `am` for the given dimension `dim` of the texture reference `hTexRef`. If `dim` is zero, the addressing mode is applied to the first parameter of the functions used to fetch from the texture; if `dim` is 1, the second, and so on. [CUaddress_mode](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gac925457ee7128d6251071f6ff7608887) is defined as:
///
/// 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`].
///
/// # Parameters
///
/// - `hTexRef`: Texture reference.
/// - `dim`: Dimension.
/// - `am`: Addressing mode to set.
#[deprecated]
pub fn cuTexRefSetAddressMode(
hTexRef: CUtexref,
dim: ::core::ffi::c_int,
am: CUaddress_mode,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the filtering mode for a texture reference.
///
/// Specifies the filtering mode `fm` to be used when reading memory through the texture reference `hTexRef`. ::CUfilter_mode_enum is defined as:
///
/// Note that this call has no effect if `hTexRef` is bound to linear memory.
///
/// # Parameters
///
/// - `hTexRef`: Texture reference.
/// - `fm`: Filtering mode to set.
#[deprecated]
pub fn cuTexRefSetFilterMode(hTexRef: CUtexref, fm: CUfilter_mode) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the mipmap filtering mode for a texture reference.
///
/// Specifies the mipmap filtering mode `fm` to be used when reading memory through the texture reference `hTexRef`. ::CUfilter_mode_enum is defined as:
///
/// Note that this call has no effect if `hTexRef` is not bound to a mipmapped array.
///
/// # Parameters
///
/// - `hTexRef`: Texture reference.
/// - `fm`: Filtering mode to set.
#[deprecated]
pub fn cuTexRefSetMipmapFilterMode(hTexRef: CUtexref, fm: CUfilter_mode) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the mipmap level bias for a texture reference.
///
/// Specifies the mipmap level bias `bias` to be added to the specified mipmap level when reading memory through the texture reference `hTexRef`.
///
/// Note that this call has no effect if `hTexRef` is not bound to a mipmapped array.
///
/// # Parameters
///
/// - `hTexRef`: Texture reference.
/// - `bias`: Mipmap level bias.
#[deprecated]
pub fn cuTexRefSetMipmapLevelBias(hTexRef: CUtexref, bias: f32) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the mipmap min/max mipmap level clamps for a texture reference.
///
/// Specifies the min/max mipmap level clamps, `minMipmapLevelClamp` and `maxMipmapLevelClamp` respectively, to be used when reading memory through the texture reference `hTexRef`.
///
/// Note that this call has no effect if `hTexRef` is not bound to a mipmapped array.
///
/// # Parameters
///
/// - `hTexRef`: Texture reference.
/// - `minMipmapLevelClamp`: Mipmap min level clamp.
/// - `maxMipmapLevelClamp`: Mipmap max level clamp.
#[deprecated]
pub fn cuTexRefSetMipmapLevelClamp(
hTexRef: CUtexref,
minMipmapLevelClamp: f32,
maxMipmapLevelClamp: f32,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the maximum anisotropy for a texture reference.
///
/// Specifies the maximum anisotropy `maxAniso` to be used when reading memory through the texture reference `hTexRef`.
///
/// Note that this call has no effect if `hTexRef` is bound to linear memory.
///
/// # Parameters
///
/// - `hTexRef`: Texture reference.
/// - `maxAniso`: Maximum anisotropy.
#[deprecated]
pub fn cuTexRefSetMaxAnisotropy(
hTexRef: CUtexref,
maxAniso: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the border color for a texture reference.
///
/// Specifies the value of the RGBA color via the `pBorderColor` to the texture reference `hTexRef`. The color value supports only float type and holds color components in the following sequence: pBorderColor\[0\] holds ‘R’ component pBorderColor\[1\] holds ‘G’ component pBorderColor\[2\] holds ‘B’ component pBorderColor\[3\] holds ‘A’ component
///
/// 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.
///
/// # Parameters
///
/// - `hTexRef`: Texture reference.
/// - `pBorderColor`: RGBA color.
#[deprecated]
pub fn cuTexRefSetBorderColor(hTexRef: CUtexref, pBorderColor: *mut f32) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the flags for a texture reference.
///
/// Specifies optional flags via `Flags` to specify the behavior of data returned through the texture reference `hTexRef`. The valid flags are.
///
/// # Parameters
///
/// - `hTexRef`: Texture reference.
/// - `Flags`: Optional flags to set.
#[deprecated]
pub fn cuTexRefSetFlags(hTexRef: CUtexref, Flags: ::core::ffi::c_uint) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets the address associated with a texture reference
///
///
///
/// Deprecated:
///
/// Returns in `*pdptr` the base address bound to the texture reference `hTexRef`, or returns ::CUDA_ERROR_INVALID_VALUE if the texture reference is not bound to any device memory range.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE
///
///
///
/// See also: ::cuTexRefSetAddress, ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, ::cuTexRefSetFilterMode, ::cuTexRefSetFlags, ::cuTexRefSetFormat, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat
///
/// # Parameters
///
/// - `pdptr`: - Returned device address
/// - `hTexRef`: - Texture reference
#[deprecated]
pub fn cuTexRefGetAddress_v2(pdptr: *mut CUdeviceptr, hTexRef: CUtexref) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets the array bound to a texture reference.
///
/// Returns in `*phArray` the CUDA array bound to the texture reference `hTexRef`, or returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] if the texture reference is not bound to any CUDA array.
///
/// # Parameters
///
/// - `phArray`: Returned array.
/// - `hTexRef`: Texture reference.
#[deprecated]
pub fn cuTexRefGetArray(phArray: *mut CUarray, hTexRef: CUtexref) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets the mipmapped array bound to a texture reference.
///
/// Returns in `*phMipmappedArray` the CUDA mipmapped array bound to the texture reference `hTexRef`, or returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] if the texture reference is not bound to any CUDA mipmapped array.
///
/// # Parameters
///
/// - `phMipmappedArray`: Returned mipmapped array.
/// - `hTexRef`: Texture reference.
#[deprecated]
pub fn cuTexRefGetMipmappedArray(
phMipmappedArray: *mut CUmipmappedArray,
hTexRef: CUtexref,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets the addressing mode used by a texture reference.
///
/// Returns in `*pam` the addressing mode corresponding to the dimension `dim` of the texture reference `hTexRef`. Currently, the only valid value for `dim` are 0 and 1.
///
/// # Parameters
///
/// - `pam`: Returned addressing mode.
/// - `hTexRef`: Texture reference.
/// - `dim`: Dimension.
#[deprecated]
pub fn cuTexRefGetAddressMode(
pam: *mut CUaddress_mode,
hTexRef: CUtexref,
dim: ::core::ffi::c_int,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets the filter-mode used by a texture reference.
///
/// Returns in `*pfm` the filtering mode of the texture reference `hTexRef`.
///
/// # Parameters
///
/// - `pfm`: Returned filtering mode.
/// - `hTexRef`: Texture reference.
#[deprecated]
pub fn cuTexRefGetFilterMode(pfm: *mut CUfilter_mode, hTexRef: CUtexref) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets the format used by a texture reference.
///
/// Returns in `*pFormat` and `*pNumChannels` the format and number of components of the CUDA array bound to the texture reference `hTexRef`. If `pFormat` or `pNumChannels` is NULL, it will be ignored.
///
/// # Parameters
///
/// - `pFormat`: Returned format.
/// - `pNumChannels`: Returned number of components.
/// - `hTexRef`: Texture reference.
#[deprecated]
pub fn cuTexRefGetFormat(
pFormat: *mut CUarray_format,
pNumChannels: *mut ::core::ffi::c_int,
hTexRef: CUtexref,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets the mipmap filtering mode for a texture reference.
///
/// Returns the mipmap filtering mode in `pfm` that’s used when reading memory through the texture reference `hTexRef`.
///
/// # Parameters
///
/// - `pfm`: Returned mipmap filtering mode.
/// - `hTexRef`: Texture reference.
#[deprecated]
pub fn cuTexRefGetMipmapFilterMode(
pfm: *mut CUfilter_mode,
hTexRef: CUtexref,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets the mipmap level bias for a texture reference.
///
/// Returns the mipmap level bias in `pBias` that’s added to the specified mipmap level when reading memory through the texture reference `hTexRef`.
///
/// # Parameters
///
/// - `pbias`: Returned mipmap level bias.
/// - `hTexRef`: Texture reference.
#[deprecated]
pub fn cuTexRefGetMipmapLevelBias(pbias: *mut f32, hTexRef: CUtexref) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets the min/max mipmap level clamps for a texture reference.
///
/// Returns the min/max mipmap level clamps in `pminMipmapLevelClamp` and `pmaxMipmapLevelClamp` that’s used when reading memory through the texture reference `hTexRef`.
///
/// # Parameters
///
/// - `pminMipmapLevelClamp`: Returned mipmap min level clamp.
/// - `pmaxMipmapLevelClamp`: Returned mipmap max level clamp.
/// - `hTexRef`: Texture reference.
#[deprecated]
pub fn cuTexRefGetMipmapLevelClamp(
pminMipmapLevelClamp: *mut f32,
pmaxMipmapLevelClamp: *mut f32,
hTexRef: CUtexref,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets the maximum anisotropy for a texture reference.
///
/// Returns the maximum anisotropy in `pmaxAniso` that’s used when reading memory through the texture reference `hTexRef`.
///
/// # Parameters
///
/// - `pmaxAniso`: Returned maximum anisotropy.
/// - `hTexRef`: Texture reference.
#[deprecated]
pub fn cuTexRefGetMaxAnisotropy(
pmaxAniso: *mut ::core::ffi::c_int,
hTexRef: CUtexref,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets the border color used by a texture reference.
///
/// Returns in `pBorderColor`, values of the RGBA color used by the texture reference `hTexRef`. The color value is of type float and holds color components in the following sequence: pBorderColor\[0\] holds ‘R’ component pBorderColor\[1\] holds ‘G’ component pBorderColor\[2\] holds ‘B’ component pBorderColor\[3\] holds ‘A’ component.
///
/// # Parameters
///
/// - `pBorderColor`: Returned Type and Value of RGBA color.
/// - `hTexRef`: Texture reference.
#[deprecated]
pub fn cuTexRefGetBorderColor(pBorderColor: *mut f32, hTexRef: CUtexref) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Gets the flags used by a texture reference.
///
/// Returns in `*pFlags` the flags of the texture reference `hTexRef`.
///
/// # Parameters
///
/// - `pFlags`: Returned flags.
/// - `hTexRef`: Texture reference.
#[deprecated]
pub fn cuTexRefGetFlags(
pFlags: *mut ::core::ffi::c_uint,
hTexRef: CUtexref,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates a texture reference.
///
/// Creates a texture reference and returns its handle in `*pTexRef`. Once created, the application must call [`cuTexRefSetArray`] or cuTexRefSetAddress() to associate the reference with allocated memory. Other texture reference functions are used to specify the format and interpretation (addressing, filtering, etc.) to be used when the memory is read through this texture reference.
///
/// # Parameters
///
/// - `pTexRef`: - Returned texture reference
#[deprecated]
pub fn cuTexRefCreate(pTexRef: *mut CUtexref) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Destroys a texture reference.
///
/// Destroys the texture reference specified by `hTexRef`.
///
/// # Parameters
///
/// - `hTexRef`: - Texture reference to destroy
#[deprecated]
pub fn cuTexRefDestroy(hTexRef: CUtexref) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets the CUDA array for a surface reference.
///
/// Sets the CUDA array `hArray` to be read and written by the surface reference `hSurfRef`. Any previous CUDA array state associated with the surface reference is superseded by this function. `Flags` must be set to 0. The [`CUDA_ARRAY3D_SURFACE_LDST`] flag must have been set for the CUDA array. Any CUDA array previously bound to `hSurfRef` is unbound.
///
/// # Parameters
///
/// - `hSurfRef`: Surface reference handle.
/// - `hArray`: CUDA array handle.
/// - `Flags`: set to 0.
#[deprecated]
pub fn cuSurfRefSetArray(
hSurfRef: CUsurfref,
hArray: CUarray,
Flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Passes back the CUDA array bound to a surface reference.
///
/// Returns in `*phArray` the CUDA array bound to the surface reference `hSurfRef`, or returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] if the surface reference is not bound to any CUDA array.
///
/// # Parameters
///
/// - `phArray`: Surface reference handle.
/// - `hSurfRef`: Surface reference handle.
#[deprecated]
pub fn cuSurfRefGetArray(phArray: *mut CUarray, hSurfRef: CUsurfref) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates a texture object.
///
/// 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.
///
/// Texture objects are only supported on devices of compute capability 3.0 or higher. Additionally, a texture object is an opaque value, and, as such, should only be accessed through CUDA API calls.
///
/// The CUDA_RESOURCE_DESC structure is defined as:
///
/// The CUDA_TEXTURE_DESC struct is defined as
///
/// The CUDA_RESOURCE_VIEW_DESC struct is defined as.
///
/// # Parameters
///
/// - `pTexObject`: Texture object to create.
/// - `pResDesc`: Resource descriptor.
/// - `pTexDesc`: Texture descriptor.
/// - `pResViewDesc`: Resource view descriptor.
pub fn cuTexObjectCreate(
pTexObject: *mut CUtexObject,
pResDesc: *const CUDA_RESOURCE_DESC,
pTexDesc: *const CUDA_TEXTURE_DESC,
pResViewDesc: *const CUDA_RESOURCE_VIEW_DESC,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Destroys a texture object.
///
/// Destroys the texture object specified by `texObject`.
///
/// # Parameters
///
/// - `texObject`: - Texture object to destroy
pub fn cuTexObjectDestroy(texObject: CUtexObject) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a texture object’s resource descriptor.
///
/// Returns the resource descriptor for the texture object specified by `texObject`.
///
/// # Parameters
///
/// - `pResDesc`: Resource descriptor.
/// - `texObject`: Texture object.
pub fn cuTexObjectGetResourceDesc(
pResDesc: *mut CUDA_RESOURCE_DESC,
texObject: CUtexObject,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a texture object’s texture descriptor.
///
/// Returns the texture descriptor for the texture object specified by `texObject`.
///
/// # Parameters
///
/// - `pTexDesc`: Texture descriptor.
/// - `texObject`: Texture object.
pub fn cuTexObjectGetTextureDesc(
pTexDesc: *mut CUDA_TEXTURE_DESC,
texObject: CUtexObject,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a texture object’s resource view descriptor.
///
/// 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.
///
/// # Parameters
///
/// - `pResViewDesc`: Resource view descriptor.
/// - `texObject`: Texture object.
pub fn cuTexObjectGetResourceViewDesc(
pResViewDesc: *mut CUDA_RESOURCE_VIEW_DESC,
texObject: CUtexObject,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Creates a surface object.
///
/// 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__RESOURCE__DESC__v1.html#structcuda__resource__desc__v1_1afe341889f4a57165e7acc0efcfc38b64) must be [`CUresourcetype_enum::CU_RESOURCE_TYPE_ARRAY`] and [CUDA_RESOURCE_DESC::res::array::hArray](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__RESOURCE__DESC__v1.html#structcuda__resource__desc__v1_1ae6a102dea60961fe2cb7beb001798ca0) must be set to a valid CUDA array handle. [CUDA_RESOURCE_DESC::flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUDA__RESOURCE__DESC__v1.html#structcuda__resource__desc__v1_1a857d9251dec54700bd8cd071accc3bdf) must be set to zero.
///
/// Surface objects are only supported on devices of compute capability 3.0 or higher. Additionally, a surface object is an opaque value, and, as such, should only be accessed through CUDA API calls.
///
/// # Parameters
///
/// - `pSurfObject`: Surface object to create.
/// - `pResDesc`: Resource descriptor.
pub fn cuSurfObjectCreate(
pSurfObject: *mut CUsurfObject,
pResDesc: *const CUDA_RESOURCE_DESC,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Destroys a surface object.
///
/// Destroys the surface object specified by `surfObject`.
///
/// # Parameters
///
/// - `surfObject`: - Surface object to destroy
pub fn cuSurfObjectDestroy(surfObject: CUsurfObject) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a surface object’s resource descriptor.
///
/// Returns the resource descriptor for the surface object specified by `surfObject`.
///
/// # Parameters
///
/// - `pResDesc`: Resource descriptor.
/// - `surfObject`: Surface object.
pub fn cuSurfObjectGetResourceDesc(
pResDesc: *mut CUDA_RESOURCE_DESC,
surfObject: CUsurfObject,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Create a tensor map descriptor object representing tiled memory region.
///
/// Creates a descriptor for Tensor Memory Access (TMA) object specified by the parameters describing a tiled region and returns it in `tensorMap`.
///
/// Tensor map objects are only supported on devices of compute capability 9.0 or higher. Additionally, a tensor map object is an opaque value, and, as such, should only be accessed through CUDA APIs and PTX.
///
/// The parameters passed are bound to the following requirements:
///
/// `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 the packed data types:
///
/// `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 met:
///
/// `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:
///
/// `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 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\].
///
/// # Parameters
///
/// - `tensorMap`: Tensor map object to create.
/// - `tensorDataType`: Tensor data type.
/// - `tensorRank`: Dimensionality of tensor.
/// - `globalAddress`: Starting address of memory region described by tensor.
/// - `globalDim`: Array containing tensor size (number of elements) along each of the `tensorRank` dimensions.
/// - `globalStrides`: Array containing stride size (in bytes) along each of the `tensorRank` - 1 dimensions.
/// - `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.
/// - `elementStrides`: Array containing traversal stride in each of the `tensorRank` dimensions.
/// - `interleave`: Type of interleaved layout the tensor addresses.
/// - `swizzle`: Bank swizzling pattern inside shared memory.
/// - `l2Promotion`: L2 promotion size.
/// - `oobFill`: Indicate whether zero or special NaN constant must be used to fill out-of-bound elements.
pub fn cuTensorMapEncodeTiled(
tensorMap: *mut CUtensorMap,
tensorDataType: CUtensorMapDataType,
tensorRank: cuuint32_t,
globalAddress: *mut ::core::ffi::c_void,
globalDim: *const cuuint64_t,
globalStrides: *const cuuint64_t,
boxDim: *const cuuint32_t,
elementStrides: *const cuuint32_t,
interleave: CUtensorMapInterleave,
swizzle: CUtensorMapSwizzle,
l2Promotion: CUtensorMapL2promotion,
oobFill: CUtensorMapFloatOOBfill,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Create a tensor map descriptor object representing im2col memory region.
///
/// Creates a descriptor for Tensor Memory Access (TMA) object specified by the parameters describing a im2col memory layout and returns it in `tensorMap`.
///
/// Tensor map objects are only supported on devices of compute capability 9.0 or higher. Additionally, a tensor map object is an opaque value, and, as such, should only be accessed through CUDA APIs and PTX.
///
/// The parameters passed are bound to the following requirements.
///
/// # Parameters
///
/// - `tensorMap`: Tensor map object to create.
/// - `tensorDataType`: Tensor data type.
/// - `tensorRank`: Dimensionality of tensor; must be at least 3.
/// - `globalAddress`: Starting address of memory region described by tensor.
/// - `globalDim`: Array containing tensor size (number of elements) along each of the `tensorRank` dimensions.
/// - `globalStrides`: Array containing stride size (in bytes) along each of the `tensorRank` - 1 dimensions.
/// - `pixelBoxLowerCorner`: Array containing DHW dimensions of lower box corner.
/// - `pixelBoxUpperCorner`: Array containing DHW dimensions of upper box corner.
/// - `channelsPerPixel`: Number of channels per pixel.
/// - `pixelsPerColumn`: Number of pixels per column.
/// - `elementStrides`: Array containing traversal stride in each of the `tensorRank` dimensions.
/// - `interleave`: Type of interleaved layout the tensor addresses.
/// - `swizzle`: Bank swizzling pattern inside shared memory.
/// - `l2Promotion`: L2 promotion size.
/// - `oobFill`: Indicate whether zero or special NaN constant will be used to fill out-of-bound elements.
pub fn cuTensorMapEncodeIm2col(
tensorMap: *mut CUtensorMap,
tensorDataType: CUtensorMapDataType,
tensorRank: cuuint32_t,
globalAddress: *mut ::core::ffi::c_void,
globalDim: *const cuuint64_t,
globalStrides: *const cuuint64_t,
pixelBoxLowerCorner: *const ::core::ffi::c_int,
pixelBoxUpperCorner: *const ::core::ffi::c_int,
channelsPerPixel: cuuint32_t,
pixelsPerColumn: cuuint32_t,
elementStrides: *const cuuint32_t,
interleave: CUtensorMapInterleave,
swizzle: CUtensorMapSwizzle,
l2Promotion: CUtensorMapL2promotion,
oobFill: CUtensorMapFloatOOBfill,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Create a tensor map descriptor object representing im2col memory region, but where the elements are exclusively loaded along the W dimension.
///
/// Creates a descriptor for Tensor Memory Access (TMA) object specified by the parameters describing a im2col memory layout and 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.
///
/// This API is only supported on devices of compute capability 10.0 or higher. Additionally, a tensor map object is an opaque value, and, as such, should only be accessed through CUDA APIs and PTX.
///
/// The parameters passed are bound to the following requirements:
///
/// `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 the packed data types:
///
/// `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 met:
///
/// `pixelBoxLowerCornerWidth` specifies the coordinate offset W of the bounding box from left corner. The offset must be within range \[-32768, 32767\].
///
/// 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.
///
/// Additionally, ::CU_TENSOR_MAP_SWIZZLE_96B is supported only when `mode` is [`CUtensorMapIm2ColWideMode::CU_TENSOR_MAP_IM2COL_WIDE_MODE_W`].
///
/// # Parameters
///
/// - `tensorMap`: Tensor map object to create.
/// - `tensorDataType`: Tensor data type.
/// - `tensorRank`: Dimensionality of tensor; must be at least 3.
/// - `globalAddress`: Starting address of memory region described by tensor.
/// - `globalDim`: Array containing tensor size (number of elements) along each of the `tensorRank` dimensions.
/// - `globalStrides`: Array containing stride size (in bytes) along each of the `tensorRank` - 1 dimensions.
/// - `pixelBoxLowerCornerWidth`: Width offset of left box corner.
/// - `pixelBoxUpperCornerWidth`: Width offset of right box corner.
/// - `channelsPerPixel`: Number of channels per pixel.
/// - `pixelsPerColumn`: Number of pixels per column.
/// - `elementStrides`: Array containing traversal stride in each of the `tensorRank` dimensions.
/// - `interleave`: Type of interleaved layout the tensor addresses.
/// - `mode`: W or W128 mode.
/// - `swizzle`: Bank swizzling pattern inside shared memory.
/// - `l2Promotion`: L2 promotion size.
/// - `oobFill`: Indicate whether zero or special NaN constant will be used to fill out-of-bound elements.
pub fn cuTensorMapEncodeIm2colWide(
tensorMap: *mut CUtensorMap,
tensorDataType: CUtensorMapDataType,
tensorRank: cuuint32_t,
globalAddress: *mut ::core::ffi::c_void,
globalDim: *const cuuint64_t,
globalStrides: *const cuuint64_t,
pixelBoxLowerCornerWidth: ::core::ffi::c_int,
pixelBoxUpperCornerWidth: ::core::ffi::c_int,
channelsPerPixel: cuuint32_t,
pixelsPerColumn: cuuint32_t,
elementStrides: *const cuuint32_t,
interleave: CUtensorMapInterleave,
mode: CUtensorMapIm2ColWideMode,
swizzle: CUtensorMapSwizzle,
l2Promotion: CUtensorMapL2promotion,
oobFill: CUtensorMapFloatOOBfill,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Modify an existing tensor map descriptor with an updated global address.
///
/// Modifies the descriptor for Tensor Memory Access (TMA) object passed in `tensorMap` with an updated `globalAddress`.
///
/// Tensor map objects are only supported on devices of compute capability 9.0 or higher. Additionally, a tensor map object is an opaque value, and, as such, should only be accessed through CUDA API calls.
///
/// # Parameters
///
/// - `tensorMap`: Tensor map object to modify.
/// - `globalAddress`: Starting address of memory region described by tensor, must follow previous alignment requirements.
pub fn cuTensorMapReplaceAddress(
tensorMap: *mut CUtensorMap,
globalAddress: *mut ::core::ffi::c_void,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Queries if a device may directly access a peer device’s memory.
///
/// 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`].
///
/// # Parameters
///
/// - `canAccessPeer`: Returned access capability.
/// - `dev`: Device from which allocations on `peerDev` are to be directly accessed.
/// - `peerDev`: Device on which the allocations to be directly accessed by `dev` reside.
pub fn cuDeviceCanAccessPeer(
canAccessPeer: *mut ::core::ffi::c_int,
dev: CUdevice,
peerDev: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Enables direct access to memory allocations in a peer context.
///
/// 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/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__UNIFIED.html#group__cuda__unified) for additional details.
///
/// 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.
///
/// Note that there are both device-wide and system-wide limitations per system configuration, as noted in the CUDA Programming Guide under the section “Peer-to-Peer Memory Access”.
///
/// Returns [`cudaError_enum::CUDA_ERROR_PEER_ACCESS_UNSUPPORTED`] if [`cuDeviceCanAccessPeer`] indicates that the [CUdevice](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1ga41ca2a24a242b36ef2ca77330b5fb72a) of the current context cannot directly access memory from the [CUdevice](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1ga41ca2a24a242b36ef2ca77330b5fb72a) of `peerContext`.
///
/// Returns [`cudaError_enum::CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED`] if direct access of `peerContext` from the current context has already been enabled.
///
/// 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.
///
/// 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`.
///
/// Returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] if `Flags` is not 0.
///
/// # Parameters
///
/// - `peerContext`: Peer context to enable direct access to from the current context.
/// - `Flags`: Reserved for future use and must be set to 0.
pub fn cuCtxEnablePeerAccess(
peerContext: CUcontext,
Flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Disables direct access to memory allocations in a peer context and unregisters any registered allocations.
///
/// Returns [`cudaError_enum::CUDA_ERROR_PEER_ACCESS_NOT_ENABLED`] if direct peer access has not yet been enabled from `peerContext` to the current context.
///
/// Returns [`cudaError_enum::CUDA_ERROR_INVALID_CONTEXT`] if there is no current context, or if `peerContext` is not a valid context.
///
/// # Parameters
///
/// - `peerContext`: - Peer context to disable direct access to
pub fn cuCtxDisablePeerAccess(peerContext: CUcontext) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Queries attributes of the link between two devices.
///
/// Returns in `*value` the value of the requested attribute `attrib` of the link between `srcDevice` and `dstDevice`. The supported attributes are:
///
/// Returns [`cudaError_enum::CUDA_ERROR_INVALID_DEVICE`] if `srcDevice` or `dstDevice` are not valid or if they represent the same device.
///
/// Returns [`cudaError_enum::CUDA_ERROR_INVALID_VALUE`] if `attrib` is not valid or if `value` is a null pointer.
///
/// # Parameters
///
/// - `value`: Returned value of the requested attribute.
/// - `attrib`: The requested attribute of the link between `srcDevice` and `dstDevice`.
/// - `srcDevice`: The source device of the target link.
/// - `dstDevice`: The destination device of the target link.
pub fn cuDeviceGetP2PAttribute(
value: *mut ::core::ffi::c_int,
attrib: CUdevice_P2PAttribute,
srcDevice: CUdevice,
dstDevice: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Queries details about atomic operations supported between two devices.
///
/// 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`.
///
/// For each [CUatomicOperation](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gafd7012de0abfe50cee089f3f00d6dcf3) in `*operations`, the corresponding result in `*capabilities` will be a bitmask indicating which of [CUatomicOperationCapability](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1gaf8fbc0f84fd6461c5611b3935b26e22c) the link supports natively.
///
/// Returns [`cudaError_enum::CUDA_ERROR_INVALID_DEVICE`] if `srcDevice` or `dstDevice` are not valid or if they represent the same device.
///
/// 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.
///
/// # Parameters
///
/// - `capabilities`: Returned capability details of each requested operation.
/// - `operations`: Requested operations.
/// - `count`: Count of requested operations and size of capabilities.
/// - `srcDevice`: The source device of the target link.
/// - `dstDevice`: The destination device of the target link.
pub fn cuDeviceGetP2PAtomicCapabilities(
capabilities: *mut ::core::ffi::c_uint,
operations: *const CUatomicOperation,
count: ::core::ffi::c_uint,
srcDevice: CUdevice,
dstDevice: CUdevice,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Unregisters a graphics resource for access by CUDA.
///
/// Unregisters the graphics resource `resource` so it is not accessible by CUDA unless registered again.
///
/// If `resource` is invalid then [`cudaError_enum::CUDA_ERROR_INVALID_HANDLE`] is returned.
///
/// # Parameters
///
/// - `resource`: - Resource to unregister
pub fn cuGraphicsUnregisterResource(resource: CUgraphicsResource) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Get an array through which to access a subresource of a mapped graphics resource.
///
/// 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.
///
/// 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.
///
/// # Parameters
///
/// - `pArray`: Returned array through which a subresource of `resource` may be accessed.
/// - `resource`: Mapped resource to access.
/// - `arrayIndex`: Array index for array textures or cubemap face index as defined by [CUarray_cubemap_face](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/group__CUDA__TYPES.html#group__cuda__types_1ga012fda14b50e7db8798a340627c4c330) for cubemap textures for the subresource to access.
/// - `mipLevel`: Mipmap level for the subresource to access.
pub fn cuGraphicsSubResourceGetMappedArray(
pArray: *mut CUarray,
resource: CUgraphicsResource,
arrayIndex: ::core::ffi::c_uint,
mipLevel: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Get a mipmapped array through which to access a mapped graphics resource.
///
/// 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.
///
/// 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.
///
/// # Parameters
///
/// - `pMipmappedArray`: Returned mipmapped array through which `resource` may be accessed.
/// - `resource`: Mapped resource to access.
pub fn cuGraphicsResourceGetMappedMipmappedArray(
pMipmappedArray: *mut CUmipmappedArray,
resource: CUgraphicsResource,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Get a device pointer through which to access a mapped graphics resource.
///
/// 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.
///
/// If `resource` is not a buffer then it cannot be accessed via a pointer and ::CUDA_ERROR_NOT_MAPPED_AS_POINTER is returned. If `resource` is not mapped then ::CUDA_ERROR_NOT_MAPPED is returned. *
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_HANDLE, ::CUDA_ERROR_NOT_MAPPED, ::CUDA_ERROR_NOT_MAPPED_AS_POINTER
///
///
///
/// See also: ::cuGraphicsMapResources, ::cuGraphicsSubResourceGetMappedArray, ::cudaGraphicsResourceGetMappedPointer
///
/// # Parameters
///
/// - `pDevPtr`: - Returned pointer through which `resource` may be accessed
/// - `pSize`: - Returned size of the buffer accessible starting at `*pPointer`
/// - `resource`: - Mapped resource to access
pub fn cuGraphicsResourceGetMappedPointer_v2(
pDevPtr: *mut CUdeviceptr,
pSize: *mut size_t,
resource: CUgraphicsResource,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Set usage flags for mapping a graphics resource
///
/// Set `flags` for mapping the graphics resource `resource`.
///
/// Changes to `flags` will take effect the next time `resource` is mapped. The `flags` argument may be any of the following:
///
/// - ::CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE: Specifies no hints about how this resource will be used. It is therefore assumed that this resource will be read from and written to by CUDA kernels. This is the default value.
/// - ::CU_GRAPHICS_MAP_RESOURCE_FLAGS_READONLY: Specifies that CUDA kernels which access this resource will not write to this resource.
/// - ::CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITEDISCARD: Specifies that CUDA kernels which access this resource will not read from this resource and will write over the entire contents of the resource, so none of the data previously stored in the resource will be preserved.
///
/// If `resource` is presently mapped for access by CUDA then ::CUDA_ERROR_ALREADY_MAPPED is returned. If `flags` is not one of the above values then ::CUDA_ERROR_INVALID_VALUE is returned.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_INVALID_HANDLE, ::CUDA_ERROR_ALREADY_MAPPED
///
///
///
/// See also: ::cuGraphicsMapResources, ::cudaGraphicsResourceSetMapFlags
///
/// # Parameters
///
/// - `resource`: - Registered resource to set flags for
/// - `flags`: - Parameters for resource mapping
pub fn cuGraphicsResourceSetMapFlags_v2(
resource: CUgraphicsResource,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Map graphics resources for access by CUDA.
///
/// Maps the `count` graphics resources in `resources` for access by CUDA.
///
/// 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 undefined.
///
/// This function provides the synchronization guarantee that any graphics calls issued before [`cuGraphicsMapResources`] will complete before any subsequent CUDA work issued in `stream` begins.
///
/// 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.
///
/// # Parameters
///
/// - `count`: Number of resources to map.
/// - `resources`: Resources to map for CUDA usage.
/// - `hStream`: Stream with which to synchronize.
pub fn cuGraphicsMapResources(
count: ::core::ffi::c_uint,
resources: *mut CUgraphicsResource,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Unmap graphics resources.
///
/// Unmaps the `count` graphics resources in `resources`.
///
/// Once unmapped, the resources in `resources` may not be accessed by CUDA until they are mapped again.
///
/// This function provides the synchronization guarantee that any CUDA work issued in `stream` before [`cuGraphicsUnmapResources`] will complete before any subsequently issued graphics work begins.
///
/// 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.
///
/// # Parameters
///
/// - `count`: Number of resources to unmap.
/// - `resources`: Resources to unmap.
/// - `hStream`: Stream with which to synchronize.
pub fn cuGraphicsUnmapResources(
count: ::core::ffi::c_uint,
resources: *mut CUgraphicsResource,
hStream: CUstream,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the requested driver API function pointer
///
/// Returns in `**pfn` the address of the CUDA driver function for the requested CUDA version and flags.
///
/// The CUDA version is specified as (1000 * major + 10 * minor), so CUDA 11.2 should be specified as 11020. For a requested driver symbol, if the specified CUDA version is greater than or equal to the CUDA version in which the driver symbol was introduced, this API will return the function pointer to the corresponding versioned function. If the specified CUDA version is greater than the driver version, the API will return ::CUDA_ERROR_INVALID_VALUE.
///
/// The pointer returned by the API should be cast to a function pointer matching the requested driver function's definition in the API header file. The function pointer typedef can be picked up from the corresponding typedefs header file. For example, cudaTypedefs.h consists of function pointer typedefs for driver APIs defined in cuda.h.
///
/// The API will return ::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 specified `cudaVersion` or if the driver symbol is invalid.
///
/// It will also set the optional `symbolStatus` to one of the values in ::CUdriverProcAddressQueryResult with the following meanings:
/// - ::CU_GET_PROC_ADDRESS_SUCCESS - The requested symbol was succesfully found based on input arguments and `pfn` is valid
/// - ::CU_GET_PROC_ADDRESS_SYMBOL_NOT_FOUND - The requested symbol was not found
/// - ::CU_GET_PROC_ADDRESS_VERSION_NOT_SUFFICIENT - The requested symbol was found but is not supported by cudaVersion specified
///
/// The requested flags can be:
/// - ::CU_GET_PROC_ADDRESS_DEFAULT: This is the default mode. This is equivalent to ::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 is defined; ::CU_GET_PROC_ADDRESS_LEGACY_STREAM otherwise.
/// - ::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 per-thread versions.
/// - ::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 versions. If a per-thread version is not found, the API will return the legacy version of the driver function.
///
///
///
///
///
/// # Return value
///
/// ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_NOT_SUPPORTED
///
/// Note: _version_mixing
///
///
///
/// See also: ::cudaGetDriverEntryPointByVersion
///
/// # Parameters
///
/// - `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.
/// - `pfn`: - Location to return the function pointer to the requested driver function
/// - `cudaVersion`: - The CUDA version to look for the requested driver symbol
/// - `flags`: - Flags to specify search options.
/// - `symbolStatus`: - Optional location to store the status of the search for `symbol` based on `cudaVersion`. See ::CUdriverProcAddressQueryResult for possible values.
pub fn cuGetProcAddress_v2(
symbol: *const ::core::ffi::c_char,
pfn: *mut *mut ::core::ffi::c_void,
cudaVersion: ::core::ffi::c_int,
flags: cuuint64_t,
symbolStatus: *mut CUdriverProcAddressQueryResult,
) -> CUresult;
}
impl CUcoredumpSettings_enum {
/// Bool where ::true means that GPU exceptions from this context will create a coredump at the location specified by ::CU_COREDUMP_FILE. The default value is ::false unless set to ::true globally or locally, or the CU_CTX_USER_COREDUMP_ENABLE flag was set during context creation.
pub const CU_COREDUMP_ENABLE_ON_EXCEPTION: CUcoredumpSettings_enum = CUcoredumpSettings_enum(
1,
);
/// Bool where ::true means that the host CPU will also create a coredump. The default value is ::true unless set to ::false globally or or locally. This value is deprecated as of CUDA 12.5 - raise the ::CU_COREDUMP_SKIP_ABORT flag to disable host device abort() if needed.
pub const CU_COREDUMP_TRIGGER_HOST: CUcoredumpSettings_enum = CUcoredumpSettings_enum(
2,
);
/// Bool where ::true means that any resulting coredumps will not have a dump of GPU memory or non-reloc ELF images. The default value is ::false unless set to ::true globally or locally. This attribute is deprecated as of CUDA 12.5, please use ::CU_COREDUMP_GENERATION_FLAGS instead.
pub const CU_COREDUMP_LIGHTWEIGHT: CUcoredumpSettings_enum = CUcoredumpSettings_enum(
3,
);
/// Bool where ::true means that a coredump can be created by writing to the system pipe specified by ::CU_COREDUMP_PIPE. The default value is ::false unless set to ::true globally or locally.
pub const CU_COREDUMP_ENABLE_USER_TRIGGER: CUcoredumpSettings_enum = CUcoredumpSettings_enum(
4,
);
/// String of up to 1023 characters that defines the location where any coredumps generated by this context will be written. The default value is ::core.cuda.HOSTNAME.PID where ::HOSTNAME is the host name of the machine running the CUDA applications and ::PID is the process ID of the CUDA application.
pub const CU_COREDUMP_FILE: CUcoredumpSettings_enum = CUcoredumpSettings_enum(5);
/// String of up to 1023 characters that defines the name of the pipe that will be monitored if user-triggered coredumps are enabled. The default value is ::corepipe.cuda.HOSTNAME.PID where ::HOSTNAME is the host name of the machine running the CUDA application and ::PID is the process ID of the CUDA application.
pub const CU_COREDUMP_PIPE: CUcoredumpSettings_enum = CUcoredumpSettings_enum(6);
/// An integer with values to allow granular control the data contained in a coredump specified as a bitwise OR combination of the following values:
pub const CU_COREDUMP_GENERATION_FLAGS: CUcoredumpSettings_enum = CUcoredumpSettings_enum(
7,
);
/// End marker for native GPU coredump setting identifiers.
pub const CU_COREDUMP_MAX: CUcoredumpSettings_enum = CUcoredumpSettings_enum(8);
}
/// Flags for choosing a coredump attribute to get/set
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUcoredumpSettings_enum(pub ::core::ffi::c_uint);
pub use self::CUcoredumpSettings_enum as CUcoredumpSettings;
impl CUCoredumpGenerationFlags {
/// if set by itself, coredump generation returns to its default settings of including all memory regions that it is able to access
pub const CU_COREDUMP_DEFAULT_FLAGS: CUCoredumpGenerationFlags = CUCoredumpGenerationFlags(
0,
);
/// Coredump will not include the data from CUDA source modules that are not relocated at runtime.
pub const CU_COREDUMP_SKIP_NONRELOCATED_ELF_IMAGES: CUCoredumpGenerationFlags = CUCoredumpGenerationFlags(
1,
);
/// Coredump will not include device-side global data that does not belong to any context.
pub const CU_COREDUMP_SKIP_GLOBAL_MEMORY: CUCoredumpGenerationFlags = CUCoredumpGenerationFlags(
2,
);
/// Coredump will not include grid-scale shared memory for the warp that the dumped kernel belonged to.
pub const CU_COREDUMP_SKIP_SHARED_MEMORY: CUCoredumpGenerationFlags = CUCoredumpGenerationFlags(
4,
);
/// Coredump will not include local memory from the kernel.
pub const CU_COREDUMP_SKIP_LOCAL_MEMORY: CUCoredumpGenerationFlags = CUCoredumpGenerationFlags(
8,
);
/// If set, GPU exceptions will not raise an abort() in the host CPU process. Same functional goal as ::CU_COREDUMP_TRIGGER_HOST but better reflects the default behavior.
pub const CU_COREDUMP_SKIP_ABORT: CUCoredumpGenerationFlags = CUCoredumpGenerationFlags(
16,
);
/// Coredump will not include constbank memory.
pub const CU_COREDUMP_SKIP_CONSTBANK_MEMORY: CUCoredumpGenerationFlags = CUCoredumpGenerationFlags(
32,
);
/// The generated coredump will be compressed with gzip, and .gz suffix will be appended to the filename, if it's not a part of it already.
pub const CU_COREDUMP_GZIP_COMPRESS: CUCoredumpGenerationFlags = CUCoredumpGenerationFlags(
64,
);
/// The coredump will only include contexts that have encountered an exception or a trap.
pub const CU_COREDUMP_FAULTED_CONTEXTS_ONLY: CUCoredumpGenerationFlags = CUCoredumpGenerationFlags(
128,
);
/// By default, when coredumps are requested, the GPU will ensure memory faults and other errors prevent warps from exiting, if possible. This can potentially affect the performance of the application. Setting this flag will disable this functionality, making it possible for faulted warps to exit, but also avoiding the potential performance hit.
pub const CU_COREDUMP_NO_ERRBAR_AT_EXIT: CUCoredumpGenerationFlags = CUCoredumpGenerationFlags(
1073741824,
);
/// Setting this flag will disable actual generation of the coredump file, but exception details will still be logged.
pub const CU_COREDUMP_LOG_ONLY: CUCoredumpGenerationFlags = CUCoredumpGenerationFlags(
-2147483648,
);
/// Enables all of the above options. Equiavlent to setting the ::CU_COREDUMP_LIGHTWEIGHT attribute to ::true.
pub const CU_COREDUMP_LIGHTWEIGHT_FLAGS: CUCoredumpGenerationFlags = CUCoredumpGenerationFlags(
47,
);
}
/// Flags for controlling coredump contents.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUCoredumpGenerationFlags(pub ::core::ffi::c_int);
singe_loader::functions! { crate::DRIVER;
/// Allows caller to fetch a coredump attribute value for the current context.
///
/// 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.
///
/// 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`.
///
/// The supported attributes are.
///
/// # Parameters
///
/// - `attrib`: The enum defining which value to fetch.
/// - `value`: void\* containing the requested data.
/// - `size`: The size of the memory region `value` points to.
pub fn cuCoredumpGetAttribute(
attrib: CUcoredumpSettings,
value: *mut ::core::ffi::c_void,
size: *mut size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Allows caller to fetch a coredump attribute value for the entire application.
///
/// 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.
///
/// 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`.
///
/// The supported attributes are.
///
/// # Parameters
///
/// - `attrib`: The enum defining which value to fetch.
/// - `value`: void\* containing the requested data.
/// - `size`: The size of the memory region `value` points to.
pub fn cuCoredumpGetAttributeGlobal(
attrib: CUcoredumpSettings,
value: *mut ::core::ffi::c_void,
size: *mut size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Allows caller to set a coredump attribute value for the current context.
///
/// This function should be considered an alternate interface to the CUDA-GDB environment variables defined in this document: <https://docs.nvidia.com/cuda/cuda-gdb/index.html#gpu-coredump>
///
/// An important design decision to note is that any coredump environment variable values set before CUDA initializes will take permanent precedence over any values set with this function. This decision was made to ensure no change in behavior for any users that may be currently using these variables to get coredumps.
///
/// `*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.
///
/// 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`.
///
/// /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.
///
/// /note [`CUcoredumpSettings::CU_COREDUMP_ENABLE_USER_TRIGGER`] and [`CUcoredumpSettings::CU_COREDUMP_PIPE`] cannot be set on a per-context basis.
///
/// The supported attributes are.
///
/// # Parameters
///
/// - `attrib`: The enum defining which value to set.
/// - `value`: void\* containing the requested data.
/// - `size`: The size of the memory region `value` points to.
pub fn cuCoredumpSetAttribute(
attrib: CUcoredumpSettings,
value: *mut ::core::ffi::c_void,
size: *mut size_t,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Allows caller to set a coredump attribute value globally.
///
/// This function should be considered an alternate interface to the CUDA-GDB environment variables defined in this document: <https://docs.nvidia.com/cuda/cuda-gdb/index.html#gpu-coredump>
///
/// An important design decision to note is that any coredump environment variable values set before CUDA initializes will take permanent precedence over any values set with this function. This decision was made to ensure no change in behavior for any users that may be currently using these variables to get coredumps.
///
/// `*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.
///
/// 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`.
///
/// The supported attributes are.
///
/// # Parameters
///
/// - `attrib`: The enum defining which value to set.
/// - `value`: void\* containing the requested data.
/// - `size`: The size of the memory region `value` points to.
pub fn cuCoredumpSetAttributeGlobal(
attrib: CUcoredumpSettings,
value: *mut ::core::ffi::c_void,
size: *mut size_t,
) -> CUresult;
}
/// Incomplete native type used by [`CUcoredumpCallbackHandle`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUcoredumpCallbackEntry_st {
_unused: [u8; 0],
}
/// Opaque handle representing a registered coredump status callback.
///
/// This handle is returned when registering a callback and must be provided when deregistering the callback.
pub type CUcoredumpCallbackHandle = *mut CUcoredumpCallbackEntry_st;
/// Callback function prototype for GPU coredump status notifications.
///
/// This callback will be invoked when a GPU coredump begins or completes, depending on which registration function was used. The callback executes synchronously during the coredump process.
pub type CUcoredumpStatusCallback = ::core::option::Option<
unsafe extern "C" fn(
userData: *mut ::core::ffi::c_void,
pid: ::core::ffi::c_int,
dev: CUdevice,
),
>;
singe_loader::functions! { crate::DRIVER;
/// Register a callback to be invoked when a GPU coredump begins.
///
/// This function registers a callback that will be called when a GPU coredump is initiated, before any coredump data is collected. Callbacks are executed in the order they were registered. The same callback function can be registered multiple times with different userData, and each registration will receive a unique handle.
///
/// # Parameters
///
/// - `callback`: The callback function to register.
/// - `userData`: User data pointer to pass to the callback.
/// - `callbackOut`: Location to store the callback handle (optional, may be NULL).
pub fn cuCoredumpRegisterStartCallback(
callback: CUcoredumpStatusCallback,
userData: *mut ::core::ffi::c_void,
callbackOut: *mut CUcoredumpCallbackHandle,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Register a callback to be invoked when a GPU coredump completes.
///
/// This function registers a callback that will be called when a GPU coredump has been fully collected and written to disk. Callbacks are executed in the order they were registered. The same callback function can be registered multiple times with different userData, and each registration will receive a unique handle.
///
/// # Parameters
///
/// - `callback`: The callback function to register.
/// - `userData`: User data pointer to pass to the callback.
/// - `callbackOut`: Location to store the callback handle (optional, may be NULL).
pub fn cuCoredumpRegisterCompleteCallback(
callback: CUcoredumpStatusCallback,
userData: *mut ::core::ffi::c_void,
callbackOut: *mut CUcoredumpCallbackHandle,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Deregister a previously registered coredump start callback.
///
/// This function removes a callback that was registered with [`cuCoredumpRegisterStartCallback`]. The callback handle becomes invalid after this call.
///
/// # Parameters
///
/// - `callback`: - The callback handle to deregister
pub fn cuCoredumpDeregisterStartCallback(
callback: CUcoredumpCallbackHandle,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Deregister a previously registered coredump complete callback.
///
/// This function removes a callback that was registered with [`cuCoredumpRegisterCompleteCallback`]. The callback handle becomes invalid after this call.
///
/// # Parameters
///
/// - `callback`: - The callback handle to deregister
pub fn cuCoredumpDeregisterCompleteCallback(
callback: CUcoredumpCallbackHandle,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Retrieves a driver export table identified by `pExportTableId` and writes its address to `ppExportTable`. The table layout is defined by the interface associated with that identifier. Returns a CUDA driver status code.
pub fn cuGetExportTable(
ppExportTable: *mut *const ::core::ffi::c_void,
pExportTableId: *const CUuuid,
) -> CUresult;
}
/// Incomplete native type used by [`CUdevResourceDesc`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUdevResourceDesc_st {
_unused: [u8; 0],
}
/// An opaque descriptor handle. The descriptor encapsulates multiple created and configured resources. Created via [`cuDevResourceGenerateDesc`].
pub type CUdevResourceDesc = *mut CUdevResourceDesc_st;
impl CUgreenCtxCreate_flags {
/// Default behavior.
pub const CU_GREEN_CTX_NONE: CUgreenCtxCreate_flags = CUgreenCtxCreate_flags(0);
/// Creates a default stream to use inside the green context.
pub const CU_GREEN_CTX_DEFAULT_STREAM: CUgreenCtxCreate_flags = CUgreenCtxCreate_flags(
1,
);
}
/// Flags for green context creation.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUgreenCtxCreate_flags(pub ::core::ffi::c_uint);
impl CUdevSmResourceGroup_flags {
/// Uses the default SM-resource grouping policy.
pub const CU_DEV_SM_RESOURCE_GROUP_DEFAULT: CUdevSmResourceGroup_flags = CUdevSmResourceGroup_flags(
0,
);
/// Treats constraints as a hint, ignoring them if necessary to reach the requested `smCount`. 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 group behave similar to the `remainder` group for example. When used with [`CUdevSmResourceGroup_flags::CU_DEV_SM_RESOURCE_GROUP_LOCALITY_DOMAIN_ID`], backfill fills up to the requested `smCount` using the target locality domain first, then SMs not attributed to any locality domain, then SMs from other locality domains. If no SMs can be found in the requested locality domain, CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION is returned.
pub const CU_DEV_SM_RESOURCE_GROUP_BACKFILL: CUdevSmResourceGroup_flags = CUdevSmResourceGroup_flags(
1,
);
/// The SMs must be located on a specific locality domain, specified by localityDomainId.
pub const CU_DEV_SM_RESOURCE_GROUP_LOCALITY_DOMAIN_ID: CUdevSmResourceGroup_flags = CUdevSmResourceGroup_flags(
2,
);
}
/// Flags for a [CUdevSmResource](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUdevSmResource.html#structcudevsmresource) group.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUdevSmResourceGroup_flags(pub ::core::ffi::c_uint);
impl CUdevSmResourceSplitByCount_flags {
/// Lower the minimum SM count and alignment, and treat each SM independent of its hierarchy. This allows more fine grained partitions but at the cost of advanced features (such as large clusters on compute capability 9.0+).
pub const CU_DEV_SM_RESOURCE_SPLIT_IGNORE_SM_COSCHEDULING: CUdevSmResourceSplitByCount_flags = CUdevSmResourceSplitByCount_flags(
1,
);
/// Compute Capability 9.0+ only. Attempt to create groups that may allow for maximally sized thread clusters. This can be queried post green context creation using ::cuOccupancyMaxPotentialClusterSize.
pub const CU_DEV_SM_RESOURCE_SPLIT_MAX_POTENTIAL_CLUSTER_SIZE: CUdevSmResourceSplitByCount_flags = CUdevSmResourceSplitByCount_flags(
2,
);
}
/// Flags controlling SM-resource partition granularity and supported thread-block cluster sizes.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUdevSmResourceSplitByCount_flags(pub ::core::ffi::c_uint);
impl CUdevResourceType {
/// No valid device resource kind is selected.
pub const CU_DEV_RESOURCE_TYPE_INVALID: CUdevResourceType = CUdevResourceType(0);
/// Streaming multiprocessors related information.
pub const CU_DEV_RESOURCE_TYPE_SM: CUdevResourceType = CUdevResourceType(1);
/// Workqueue configuration related information.
pub const CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG: CUdevResourceType = CUdevResourceType(
1000,
);
/// Pre-existing workqueue related information.
pub const CU_DEV_RESOURCE_TYPE_WORKQUEUE: CUdevResourceType = CUdevResourceType(
10000,
);
}
/// Type of resource.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUdevResourceType(pub ::core::ffi::c_uint);
/// Data for SM-related resources All parameters in this structure are OUTPUT only. Do not write to any of the fields in this structure.
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUdevSmResource_st {
/// The amount of streaming multiprocessors available in this resource.
pub smCount: ::core::ffi::c_uint,
/// The minimum number of streaming multiprocessors required to partition this resource.
pub minSmPartitionSize: ::core::ffi::c_uint,
/// The number of streaming multiprocessors in this resource that are guaranteed to be co-scheduled on the same GPU processing cluster. smCount will be a multiple of this value, unless the backfill flag is set.
pub smCoscheduledAlignment: ::core::ffi::c_uint,
/// The flags set on this SM resource. For possible values see ::CUdevSmResourceGroup_flags.
pub flags: ::core::ffi::c_uint,
/// Locality domain that the SM must be located on. Only valid if CU_DEV_SM_RESOURCE_GROUP_LOCALITY_DOMAIN_ID is set in flags. If the backfill flag is set, SMs may be assigned from other locality domains.
pub localityDomainId: ::core::ffi::c_uint,
}
/// Data for SM-related resources All parameters in this structure are OUTPUT only. Do not write to any of the fields in this structure.
pub type CUdevSmResource = CUdevSmResource_st;
impl CUdevWorkqueueConfigScope {
/// Use all shared workqueue resources across all contexts.
///
/// Default driver behavior.
pub const CU_WORKQUEUE_SCOPE_DEVICE_CTX: CUdevWorkqueueConfigScope = CUdevWorkqueueConfigScope(
0,
);
/// When possible, use non-overlapping workqueue resources with other balanced green contexts.
pub const CU_WORKQUEUE_SCOPE_GREEN_CTX_BALANCED: CUdevWorkqueueConfigScope = CUdevWorkqueueConfigScope(
1,
);
}
/// Sharing scope for workqueues.
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUdevWorkqueueConfigScope(pub ::core::ffi::c_uint);
/// Data for workqueue configuration related resources
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUdevWorkqueueConfigResource_st {
/// The device on which the workqueue resources are available
pub device: CUdevice,
/// The expected maximum number of concurrent stream-ordered workloads
pub wqConcurrencyLimit: ::core::ffi::c_uint,
/// The sharing scope for the workqueue resources
pub sharingScope: CUdevWorkqueueConfigScope,
}
impl Default for CUdevWorkqueueConfigResource_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Data for workqueue configuration related resources.
pub type CUdevWorkqueueConfigResource = CUdevWorkqueueConfigResource_st;
/// Handle to a pre-existing workqueue related resource
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUdevWorkqueueResource_st {
/// Reserved for future use
pub reserved: [::core::ffi::c_uchar; 40usize],
}
impl Default for CUdevWorkqueueResource_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// Handle to a pre-existing workqueue related resource.
pub type CUdevWorkqueueResource = CUdevWorkqueueResource_st;
/// Input data for splitting SMs
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CU_DEV_SM_RESOURCE_GROUP_PARAMS_st {
/// The amount of SMs available in this resource.
pub smCount: ::core::ffi::c_uint,
/// The amount of co-scheduled SMs grouped together for locality purposes.
pub coscheduledSmCount: ::core::ffi::c_uint,
/// When possible, combine co-scheduled groups together into larger groups of this size.
pub preferredCoscheduledSmCount: ::core::ffi::c_uint,
/// The flags set on this SM resource group. For possible values see ::CUdevSmResourceGroup_flags.
pub flags: ::core::ffi::c_uint,
/// Locality domain that the SM must be located on. Only valid if CU_DEV_SM_RESOURCE_GROUP_LOCALITY_DOMAIN_ID is set in flags
pub localityDomainId: ::core::ffi::c_uint,
/// Reserved storage in the native ABI.
pub reserved: [::core::ffi::c_uint; 11usize],
}
/// Input data for splitting SMs.
pub type CU_DEV_SM_RESOURCE_GROUP_PARAMS = CU_DEV_SM_RESOURCE_GROUP_PARAMS_st;
/// A tagged union describing different resources identified by the type field. This structure should not be directly modified outside of the API that created it.
///
///
///
/// ```text
/// struct {
/// CUdevResourceType type;
/// union {
/// CUdevSmResource sm;
/// CUdevWorkqueueConfigResource wqConfig;
/// CUdevWorkqueueResource wq;
/// };
/// };
/// ```
///
/// - If `type` is [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_INVALID`], this resoure is not valid and cannot be further accessed.
/// - 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.
/// - If `type` is [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG`], the ::CUdevWorkqueueConfigResource structure `wqConfig` is filled in.
/// - If `type` is [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_WORKQUEUE`], the ::CUdevWorkqueueResource structure `wq` is filled in.
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CUdevResource_st {
/// Type of resource, dictates which union field was last set.
pub type_: CUdevResourceType,
/// Internal padding in the native ABI layout.
pub _internal_padding: [::core::ffi::c_uchar; 92usize],
/// Anonymous native member. See [`CUdevResource_st__bindgen_ty_1`] for its fields.
pub __bindgen_anon_1: CUdevResource_st__bindgen_ty_1,
/// Link to another resource in a native device-resource chain.
pub nextResource: *mut CUdevResource_st,
}
/// Anonymous native union in [`CUdevResource_st`]. Its members share the same storage.
#[repr(C)]
#[derive(Copy, Clone)]
pub union CUdevResource_st__bindgen_ty_1 {
/// Resource corresponding to CU_DEV_RESOURCE_TYPE_SM `type`.
pub sm: CUdevSmResource,
/// Resource corresponding to CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG `type`.
pub wqConfig: CUdevWorkqueueConfigResource,
/// Resource corresponding to CU_DEV_RESOURCE_TYPE_WORKQUEUE `type`.
pub wq: CUdevWorkqueueResource,
/// Storage that fixes the native union's ABI size.
pub _oversize: [::core::ffi::c_uchar; 40usize],
}
impl Default for CUdevResource_st__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for CUdevResource_st {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
/// A tagged union describing different resources identified by the type field. This structure should not be directly modified outside of the API that created it.
///
///
///
/// ```text
/// struct {
/// CUdevResourceType type;
/// union {
/// CUdevSmResource sm;
/// CUdevWorkqueueConfigResource wqConfig;
/// CUdevWorkqueueResource wq;
/// };
/// };
/// ```
///
/// - If `type` is [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_INVALID`], this resoure is not valid and cannot be further accessed.
/// - 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.
/// - If `type` is [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG`], the ::CUdevWorkqueueConfigResource structure `wqConfig` is filled in.
/// - If `type` is [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_WORKQUEUE`], the ::CUdevWorkqueueResource structure `wq` is filled in.
pub type CUdevResource_v1 = CUdevResource_st;
/// A tagged union describing different resources identified by the type field. This structure should not be directly modified outside of the API that created it.
pub type CUdevResource = CUdevResource_v1;
singe_loader::functions! { crate::DRIVER;
/// Creates a green context with a specified set of resources.
///
/// 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 this API to avoid the heavy cost of triggering primary context initialization and deinitialization multiple times.
///
/// The API does not set the green context current. In order to set it current, you need to explicitly set it current by first converting the green context to a CUcontext using [`cuCtxFromGreenCtx`] and subsequently calling [`cuCtxSetCurrent`] / cuCtxPushCurrent. It should be noted that a green context can be current to only one thread at a time. There is no internal synchronization to make API calls accessing the same green context from multiple threads work.
///
/// Note: The API is not supported on 32-bit platforms.
///
/// The supported flags are.
///
/// # Parameters
///
/// - `phCtx`: Pointer for the output handle to the green context.
/// - `desc`: Descriptor generated via [`cuDevResourceGenerateDesc`] which contains the set of resources to be used.
/// - `dev`: Device on which to create the green context.
/// - `flags`: One of the supported green context creation flags.
pub fn cuGreenCtxCreate(
phCtx: *mut CUgreenCtx,
desc: CUdevResourceDesc,
dev: CUdevice,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Destroys a green context.
///
/// Destroys the green context, releasing the primary context of the device that this green context was created for. Any resources provisioned for this green context (that were initially available via the resource descriptor) are released as well. The API does not destroy streams created via [`cuGreenCtxStreamCreate`], [`cuStreamCreate`], or [`cuStreamCreateWithPriority`]. Users are expected to destroy these streams explicitly using cuStreamDestroy to avoid resource leaks. Once the green context is destroyed, any subsequent API calls involving these streams will return [`cudaError_enum::CUDA_ERROR_STREAM_DETACHED`] with the exception of the following APIs:
///
/// Additionally, the API will invalidate all active captures on these streams.
///
/// # Parameters
///
/// - `hCtx`: - Green context to be destroyed
pub fn cuGreenCtxDestroy(hCtx: CUgreenCtx) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns a [`CUcontext`] handle for a green context.
///
/// 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 `hCtx` as applicable.
///
/// 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`].
///
/// The [`CUcontext`] returned by [`cuCtxFromGreenCtx`] may be passed to CUDA Driver APIs that accept a [`CUcontext`].
///
/// This call does not create a new independent context and does not change the underlying context lifetime. The validity of the 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 is undefined behavior.
///
/// # Parameters
///
/// - `pContext`: Returned [`CUcontext`] with green context resources.
/// - `hCtx`: Green context to convert.
pub fn cuCtxFromGreenCtx(pContext: *mut CUcontext, hCtx: CUgreenCtx) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Get device resources.
///
/// Get the `type` resources available to the `device`. This may often be the starting point for further partitioning or configuring of resources.
///
/// Note: The API is not supported on 32-bit platforms.
///
/// # Parameters
///
/// - `device`: Device to get resource for.
/// - `resource`: Output pointer to a [CUdevResource](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUdevResource.html#structcudevresource) structure.
/// - `type_`: Type of resource to retrieve.
pub fn cuDeviceGetDevResource(
device: CUdevice,
resource: *mut CUdevResource,
type_: CUdevResourceType,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Get context resources.
///
/// Get the `type` resources available to the context represented by `hCtx`
/// Note: The API is not supported on 32-bit platforms.
///
/// # Parameters
///
/// - `hCtx`: Context to get resource for.
/// - `resource`: Output pointer to a [CUdevResource](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUdevResource.html#structcudevresource) structure.
/// - `type_`: Type of resource to retrieve.
pub fn cuCtxGetDevResource(
hCtx: CUcontext,
resource: *mut CUdevResource,
type_: CUdevResourceType,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Get green context resources.
///
/// Get the `type` resources available to the green context represented by `hCtx`.
///
/// # Parameters
///
/// - `hCtx`: Green context to get resource for.
/// - `resource`: Output pointer to a [CUdevResource](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUdevResource.html#structcudevresource) structure.
/// - `type_`: Type of resource to retrieve.
pub fn cuGreenCtxGetDevResource(
hCtx: CUgreenCtx,
resource: *mut CUdevResource,
type_: CUdevResourceType,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Splits [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_SM`] resources.
///
/// 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.
///
/// 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 context with that descriptor.
///
/// When creating the groups, the API will take into account the performance and functional characteristics of the input resource, and guarantee a split that will create a disjoint set of symmetrical partitions. This may lead to fewer groups created than 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 with [`cuDeviceGetDevResource`], [`cuCtxGetDevResource`], and [`cuGreenCtxGetDevResource`] for [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_SM`], using the `minSmPartitionSize` and `smCoscheduledAlignment` fields to determine minimum partition size and alignment granularity, respectively.
///
/// 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.
///
/// The following flags are supported:
///
/// A successful API call must either have:
///
/// Note: The API is not supported on 32-bit platforms.
///
/// # Parameters
///
/// - `result`: Output array of `CUdevResource` resources. Can be NULL to query the number of groups.
/// - `nbGroups`: This is a pointer, specifying the number of groups that would be or should be created as described below.
/// - `input`: Input SM resource to be split. Must be a valid [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_SM`] resource.
/// - `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.
/// - `flags`: Flags specifying how these partitions are used or which constraints to abide by when splitting the input. Zero is valid for default behavior.
/// - `minCount`: Minimum number of SMs required.
pub fn cuDevSmResourceSplitByCount(
result: *mut CUdevResource,
nbGroups: *mut ::core::ffi::c_uint,
input: *const CUdevResource,
remainder: *mut CUdevResource,
flags: ::core::ffi::c_uint,
minCount: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Splits a [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_SM`] resource into structured groups.
///
/// This API will split a resource of [`CUdevResourceType::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 any set guarantees with respect to co-scheduling and those properties will need to either be queried via the occupancy set of APIs or further split into structured groups by this API.
///
/// 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 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 create a result entry with, but allowed for discovery purposes when the `result` is NULL.
///
/// 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.
///
/// For a valid call:
///
/// **Example params and their effect:**
///
/// A groupParams array element is defined in the following order:
///
/// The difference between a catch-all param group as the last entry and the remainder is in two aspects:
///
/// Splitting an input into N groups, can be accomplished by repeatedly splitting off 1 group and re-splitting the remainder (a bisect operation). However, it’s recommended to accomplish this with a single call wherever possible.
///
/// # Parameters
///
/// - `result`: Output array of `CUdevResource` resources. Can be NULL, alongside an smCount of 0, for discovery purpose.
/// - `nbGroups`: Specifies the number of groups in `result` and `groupParams`.
/// - `input`: Input SM resource to be split. Must be a valid [`CUdevResourceType::CU_DEV_RESOURCE_TYPE_SM`] resource.
/// - `remainder`: If splitting the input resource leaves any SMs, the remainder is placed in here.
/// - `flags`: Flags specifying how the API should behave. The value should be 0 for now.
/// - `groupParams`: Description of how the SMs should be split and assigned to the corresponding result entry.
pub fn cuDevSmResourceSplit(
result: *mut CUdevResource,
nbGroups: ::core::ffi::c_uint,
input: *const CUdevResource,
remainder: *mut CUdevResource,
flags: ::core::ffi::c_uint,
groupParams: *mut CU_DEV_SM_RESOURCE_GROUP_PARAMS,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Generate a resource descriptor.
///
/// 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.
///
/// A successful API call must have:
///
/// The output descriptor `phDesc` will remain valid for the lifetime of the process.
///
/// Note: The API is not supported on 32-bit platforms.
///
/// # Parameters
///
/// - `phDesc`: Output descriptor.
/// - `resources`: Array of resources to be included in the descriptor.
/// - `nbResources`: Number of resources passed in `resources`.
pub fn cuDevResourceGenerateDesc(
phDesc: *mut CUdevResourceDesc,
resources: *mut CUdevResource,
nbResources: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Records an event.
///
/// 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`.
///
/// # Parameters
///
/// - `hCtx`: Green context to record event for.
/// - `hEvent`: Event to record.
pub fn cuGreenCtxRecordEvent(hCtx: CUgreenCtx, hEvent: CUevent) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Make a green context wait on an event.
///
/// 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.
///
/// # Parameters
///
/// - `hCtx`: Green context to wait.
/// - `hEvent`: Event to wait on.
pub fn cuGreenCtxWaitEvent(hCtx: CUgreenCtx, hEvent: CUevent) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Query the green context associated with a stream.
///
/// Returns the CUDA green context that the stream is associated with, or NULL if the stream is not associated with any green context.
///
/// The stream handle `hStream` can refer to any of the following.
///
/// # Parameters
///
/// - `hStream`: Handle to the stream to be queried.
/// - `phCtx`: Returned green context associated with the stream.
pub fn cuStreamGetGreenCtx(hStream: CUstream, phCtx: *mut CUgreenCtx) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Create a stream for use in the green context.
///
/// 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(). Note that the API ignores the context that is current to the calling thread and creates a stream in the specified green context `greenCtx`.
///
/// The supported values for `flags` are:
///
/// Specifying `priority` affects the scheduling priority of work in the stream. Priorities provide a hint to preferentially run work with higher priority 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 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.
///
/// # Parameters
///
/// - `phStream`: Returned newly created stream.
/// - `greenCtx`: Green context for which to create the stream for.
/// - `flags`: Flags for stream creation. [`CUstream_flags::CU_STREAM_NON_BLOCKING`] must be specified.
/// - `priority`: Stream priority. Lower numbers represent higher priorities. See [`cuCtxGetStreamPriorityRange`] for more information about meaningful stream priorities that can be passed.
pub fn cuGreenCtxStreamCreate(
phStream: *mut CUstream,
greenCtx: CUgreenCtx,
flags: ::core::ffi::c_uint,
priority: ::core::ffi::c_int,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the unique Id associated with the green context supplied.
///
/// 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 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 context is returned.
///
/// # Parameters
///
/// - `greenCtx`: Green context for which to obtain the Id.
/// - `greenCtxId`: Pointer to store the Id of the green context.
pub fn cuGreenCtxGetId(
greenCtx: CUgreenCtx,
greenCtxId: *mut ::core::ffi::c_ulonglong,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Get stream resources.
///
/// Get the `type` resources available to the `hStream` and store them in `resource`.
///
/// 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`].
///
/// # Parameters
///
/// - `hStream`: Stream to get resource for.
/// - `resource`: Output pointer to a [CUdevResource](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUdevResource.html#structcudevresource) structure.
/// - `type_`: Type of resource to retrieve.
pub fn cuStreamGetDevResource(
hStream: CUstream,
resource: *mut CUdevResource,
type_: CUdevResourceType,
) -> CUresult;
}
impl CUlogLevel_enum {
/// A CUDA driver error message.
pub const CU_LOG_LEVEL_ERROR: CUlogLevel_enum = CUlogLevel_enum(0);
/// A CUDA driver warning message.
pub const CU_LOG_LEVEL_WARNING: CUlogLevel_enum = CUlogLevel_enum(1);
}
/// ___MANBRIEF___ error log management functions for the low-level CUDA API (___CURRENT_FILE___) ___ENDMANBRIEF___
///
/// This section describes the error log management functions of the low-level CUDA driver application programming interface.
///
/// @{
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct CUlogLevel_enum(pub ::core::ffi::c_uint);
pub use self::CUlogLevel_enum as CUlogLevel;
/// Incomplete native type used by [`CUlogsCallbackHandle`] handles. The native API owns its layout.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUlogsCallbackEntry_st {
_unused: [u8; 0],
}
/// Opaque registration handle returned by the CUDA driver logging callback API.
pub type CUlogsCallbackHandle = *mut CUlogsCallbackEntry_st;
/// ___MANBRIEF___ error log management functions for the low-level CUDA API (___CURRENT_FILE___) ___ENDMANBRIEF___
///
/// This section describes the error log management functions of the low-level CUDA driver application programming interface.
///
/// @{
pub type CUlogsCallback = ::core::option::Option<
unsafe extern "C" fn(
data: *mut ::core::ffi::c_void,
logLevel: CUlogLevel,
message: *mut ::core::ffi::c_char,
length: size_t,
),
>;
/// Native cursor used to iterate through CUDA driver log messages.
pub type CUlogIterator = ::core::ffi::c_uint;
singe_loader::functions! { crate::DRIVER;
/// Register a callback function to receive error log messages.
///
/// # Parameters
///
/// - `callbackFunc`: The function to register as a callback.
/// - `userData`: A generic pointer to user data. This is passed into the callback function.
/// - `callback_out`: Optional location to store the callback handle after it is registered.
pub fn cuLogsRegisterCallback(
callbackFunc: CUlogsCallback,
userData: *mut ::core::ffi::c_void,
callback_out: *mut CUlogsCallbackHandle,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Unregister a log message callback.
///
/// # Parameters
///
/// - `callback`: - The callback instance to unregister from receiving log messages
pub fn cuLogsUnregisterCallback(callback: CUlogsCallbackHandle) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Sets log iterator to point to the end of log buffer, where the next message would be written.
///
/// # Parameters
///
/// - `iterator_out`: Location to store an iterator to the current tail of the logs.
/// - `flags`: Reserved for future use, must be 0.
pub fn cuLogsCurrent(
iterator_out: *mut CUlogIterator,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Dump accumulated driver logs into a file.
///
/// Logs generated by the driver are stored in an internal buffer and can be copied out using this API. This API dumps all driver logs starting from `iterator` into `pathToFile` provided.
///
/// # Parameters
///
/// - `iterator`: Optional auto-advancing iterator specifying the starting log to read. NULL value dumps all logs.
/// - `pathToFile`: Path to output file for dumping logs.
/// - `flags`: Reserved for future use, must be 0.
pub fn cuLogsDumpToFile(
iterator: *mut CUlogIterator,
pathToFile: *const ::core::ffi::c_char,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Dump accumulated driver logs into a buffer.
///
/// Logs generated by the driver are stored in an internal buffer and can be copied out using this API. This API dumps driver 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 \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`].
///
/// # Parameters
///
/// - `iterator`: Optional auto-advancing iterator specifying the starting log to read. NULL value dumps all logs.
/// - `buffer`: Pointer to dump logs.
/// - `size`: See description.
/// - `flags`: Reserved for future use, must be 0.
pub fn cuLogsDumpToMemory(
iterator: *mut CUlogIterator,
buffer: *mut ::core::ffi::c_char,
size: *mut size_t,
flags: ::core::ffi::c_uint,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the restore thread ID for a CUDA process.
///
/// Returns in `*tid` the thread ID of the CUDA restore thread for the process specified by `pid`.
///
/// # Parameters
///
/// - `pid`: The process ID of the CUDA process.
/// - `tid`: Returned restore thread ID.
pub fn cuCheckpointProcessGetRestoreThreadId(
pid: ::core::ffi::c_int,
tid: *mut ::core::ffi::c_int,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Returns the process state of a CUDA process.
///
/// Returns in `*state` the current state of the CUDA process specified by `pid`.
///
/// # Parameters
///
/// - `pid`: The process ID of the CUDA process.
/// - `state`: Returned CUDA process state.
pub fn cuCheckpointProcessGetState(
pid: ::core::ffi::c_int,
state: *mut CUprocessState,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Lock a running CUDA process.
///
/// 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.
///
/// Upon successful return the process will be in the LOCKED state.
///
/// If timeoutMs is specified and the timeout is reached the process will be left in the RUNNING state upon return.
///
/// # Parameters
///
/// - `pid`: The process ID of the CUDA process.
/// - `args`: Optional lock operation arguments.
pub fn cuCheckpointProcessLock(
pid: ::core::ffi::c_int,
args: *mut CUcheckpointLockArgs,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Checkpoint a CUDA process’s GPU memory contents.
///
/// Checkpoints a CUDA process specified by `pid`. The GPU memory contents will be brought into host memory or mapped onto the calling process’s GPUs for user-defined behavior. Underlying GPU references are released when checkpointing completes. The process must be in the [`CUprocessState_enum::CU_PROCESS_STATE_LOCKED`] state to checkpoint.
///
/// When [CUcheckpointCheckpointArgs::customStorageInfo_out](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUcheckpointCheckpointArgs.html#structcucheckpointcheckpointargs_1ac3c629ce05a8d1e251f4bda72050f183) is not NULL, all the GPU memory allocated by the process with `pid` will be mapped onto the calling process’s GPUs so the application can copy the memory to custom storage. Upon return of this call, the pointer referenced by [CUcheckpointCheckpointArgs::customStorageInfo_out](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUcheckpointCheckpointArgs.html#structcucheckpointcheckpointargs_1ac3c629ce05a8d1e251f4bda72050f183) will point to a [CUcheckpointCustomStorageInfo](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUcheckpointCustomStorageInfo.html#structcucheckpointcustomstorageinfo) struct allocated and populated by the driver. For each GPU which contains data from the checkpointed process, there is a corresponding entry in the [CUcheckpointCustomStoragePerDeviceData](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUcheckpointCustomStoragePerDeviceData.html#structcucheckpointcustomstorageperdevicedata) array.
///
/// The application is responsible for copying the mapped data from the GPU at the specified device address to custom storage. When checkpointing to custom storage, the application is expected to call [`cuCheckpointOperationComplete`]. The [CUcheckpointCustomStorageInfo::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUcheckpointCustomStorageInfo.html#structcucheckpointcustomstorageinfo_1a9095a23e289a5e9f42b9ce9949d04d2c) set by this call should be passed to [`cuCheckpointOperationComplete`] in `handle`. The driver synchronizes all the streams in [`cuCheckpointOperationComplete`], at which point the copy to custom storage is considered complete.
///
/// When checkpointing to custom storage, the application is expected to retain primary contexts of all the devices used by the process to be checkpointed. Otherwise [`cuCheckpointProcessCheckpoint`] will return [`cudaError_enum::CUDA_ERROR_INVALID_CONTEXT`]. Unlike other checkpoint operations, checkpointing to custom storage requires [`cuInit`] to have been called before execution. Checkpointing the calling process’s GPU memory to custom storage is not supported. Upon successful return, the target process will be in the [`CUprocessState_enum::CU_PROCESS_STATE_CHECKPOINTING`] state.
///
/// When [CUcheckpointCheckpointArgs::customStorageInfo_out](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUcheckpointCheckpointArgs.html#structcucheckpointcheckpointargs_1ac3c629ce05a8d1e251f4bda72050f183) is NULL, the GPU memory contents will be brought into host memory by [`cuCheckpointProcessCheckpoint`]. The application is not expected to copy the GPU memory contents. The application is also not expected to call [`cuCheckpointOperationComplete`]. Upon successful return, the target process will be in the [`CUprocessState_enum::CU_PROCESS_STATE_CHECKPOINTED`] state.
///
/// # Parameters
///
/// - `pid`: The process ID of the CUDA process.
/// - `args`: Optional checkpoint operation arguments.
pub fn cuCheckpointProcessCheckpoint(
pid: ::core::ffi::c_int,
args: *mut CUcheckpointCheckpointArgs,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Restore a CUDA process’s GPU memory contents from its last checkpoint.
///
/// Restores a CUDA process specified by `pid` from its last checkpoint. Process must be in the [`CUprocessState_enum::CU_PROCESS_STATE_CHECKPOINTED`] state to restore.
///
/// 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 type as the old GPU. If an array of GPU UUID pairs is specified, it must contain every checkpointed GPU.
///
/// CUDA process restore requires persistence mode to be enabled or [`cuInit`] to have been called before execution.
///
/// When [CUcheckpointRestoreArgs::customStorageInfo_out](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUcheckpointRestoreArgs.html#structcucheckpointrestoreargs_1a0dcad30bf1005161fe90f512da4b9aec) is not NULL, all the GPU memory to be restored for the process with `pid` will be mapped onto the calling process’s GPUs so the application can copy the memory back to the GPU.
///
/// Upon return of this call, the pointer referenced by [CUcheckpointRestoreArgs::customStorageInfo_out](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUcheckpointRestoreArgs.html#structcucheckpointrestoreargs_1a0dcad30bf1005161fe90f512da4b9aec) will point to a [CUcheckpointCustomStorageInfo](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUcheckpointCustomStorageInfo.html#structcucheckpointcustomstorageinfo) struct allocated and populated by the driver. For each GPU which contains data from the restored process, there is a corresponding entry in the [CUcheckpointCustomStoragePerDeviceData](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUcheckpointCustomStoragePerDeviceData.html#structcucheckpointcustomstorageperdevicedata) array.
///
/// The application is responsible for copying the data from custom storage to the GPU at the specified device address. When restoring from custom storage, the application is expected to call [`cuCheckpointOperationComplete`]. The [CUcheckpointCustomStorageInfo::handle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUcheckpointCustomStorageInfo.html#structcucheckpointcustomstorageinfo_1a9095a23e289a5e9f42b9ce9949d04d2c) set by this call should be passed to [`cuCheckpointOperationComplete`] in `handle`. The driver synchronizes all the streams in [`cuCheckpointOperationComplete`], at which point the copy from custom storage is considered complete.
///
/// When restoring from custom storage, the application is expected to retain primary contexts of all the devices used by the process to be restored. Otherwise [`cuCheckpointProcessRestore`] will return [`cudaError_enum::CUDA_ERROR_INVALID_CONTEXT`]
///
/// . Restoring the calling process’s
///
/// GPU memory from custom storage is not supported. Upon successful return, the target process will be in the
///
/// When [CUcheckpointRestoreArgs::customStorageInfo_out](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-driver-api/cuda_driver_api/structCUcheckpointRestoreArgs.html#structcucheckpointrestoreargs_1a0dcad30bf1005161fe90f512da4b9aec) is NULL, the GPU memory contents will be restored from host memory by [`cuCheckpointProcessRestore`]. The application is not expected to copy back the GPU memory contents. The application is also not expected to call [`cuCheckpointOperationComplete`]. Upon successful return, the target process will be in the [`CUprocessState_enum::CU_PROCESS_STATE_LOCKED`] state.
///
/// # Parameters
///
/// - `pid`: The process ID of the CUDA process.
/// - `args`: Optional restore operation arguments.
pub fn cuCheckpointProcessRestore(
pid: ::core::ffi::c_int,
args: *mut CUcheckpointRestoreArgs,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Complete a custom-storage checkpoint or restore operation.
///
/// After [`cuCheckpointProcessCheckpoint`] or [`cuCheckpointProcessRestore`] with custom storage, [`cuCheckpointOperationComplete`] should be called when the application has finished or enqueued (on a stream) the required copies (for checkpoint, GPU mappings to custom storage and for restore, custom storage into GPU mappings) so the driver can finish the operation.
///
/// [`cuCheckpointOperationComplete`] will first synchronize on the streams returned by [`cuCheckpointProcessCheckpoint`] or [`cuCheckpointProcessRestore`]. The driver assumes that the application has completed copying the memory to or from custom storage once synchronization is done. None of the streams returned by [`cuCheckpointProcessCheckpoint`] or [`cuCheckpointProcessRestore`] should be in stream capture mode; any attempt to do so would result in [`cudaError_enum::CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED`]. Once the synchronization is done, [`cuCheckpointOperationComplete`] will unmap the GPU memory that was mapped on each GPU in a particular [`cuCheckpointProcessCheckpoint`] or [`cuCheckpointProcessRestore`] operation. [`cuCheckpointOperationComplete`] identifies the operation to be completed using `handle`. This handle is set by [`cuCheckpointProcessCheckpoint`] or [`cuCheckpointProcessRestore`].
///
/// When the call returns successfully, the target process will be in the [`CUprocessState_enum::CU_PROCESS_STATE_CHECKPOINTED`] state when completing a checkpoint operation or the [`CUprocessState_enum::CU_PROCESS_STATE_LOCKED`] state when completing a restore operation.
///
/// # Parameters
///
/// - `handle`: - ::CUcheckpointCustomStorageInfo::handle set by a prior ::cuCheckpointProcessCheckpoint or ::cuCheckpointProcessRestore call
pub fn cuCheckpointOperationComplete(
handle: CUcheckpointOperationHandle,
) -> CUresult;
}
singe_loader::functions! { crate::DRIVER;
/// Unlock a CUDA process to allow CUDA API calls.
///
/// Unlocks a process specified by `pid` allowing it to resume making CUDA API calls. Process must be in the LOCKED state.
///
/// Upon successful return the process will be in the RUNNING state.
///
/// # Parameters
///
/// - `pid`: The process ID of the CUDA process.
/// - `args`: Optional unlock operation arguments.
pub fn cuCheckpointProcessUnlock(
pid: ::core::ffi::c_int,
args: *mut CUcheckpointUnlockArgs,
) -> CUresult;
}