singe_cuda_sys/runtime_sys_13040.rs
1/* automatically generated by rust-bindgen 0.72.1 */
2
3/// Compile-time CUDA runtime API version code. This identifies the headers used to generate these bindings, which may differ from the loaded library.
4pub const CUDART_VERSION: u32 = 13040;
5/// Selects a one-dimensional surface resource.
6pub const cudaSurfaceType1D: u32 = 1;
7/// Selects a two-dimensional surface resource.
8pub const cudaSurfaceType2D: u32 = 2;
9/// Selects a three-dimensional surface resource.
10pub const cudaSurfaceType3D: u32 = 3;
11/// Selects a cube-map surface resource.
12pub const cudaSurfaceTypeCubemap: u32 = 12;
13/// Selects a layered one-dimensional surface resource.
14pub const cudaSurfaceType1DLayered: u32 = 241;
15/// Selects a layered two-dimensional surface resource.
16pub const cudaSurfaceType2DLayered: u32 = 242;
17/// Selects a layered cube-map surface resource.
18pub const cudaSurfaceTypeCubemapLayered: u32 = 252;
19/// Selects a one-dimensional texture resource.
20pub const cudaTextureType1D: u32 = 1;
21/// Selects a two-dimensional texture resource.
22pub const cudaTextureType2D: u32 = 2;
23/// Selects a three-dimensional texture resource.
24pub const cudaTextureType3D: u32 = 3;
25/// Selects a cube-map texture resource.
26pub const cudaTextureTypeCubemap: u32 = 12;
27/// Selects a layered one-dimensional texture resource.
28pub const cudaTextureType1DLayered: u32 = 241;
29/// Selects a layered two-dimensional texture resource.
30pub const cudaTextureType2DLayered: u32 = 242;
31/// Selects a layered cube-map texture resource.
32pub const cudaTextureTypeCubemapLayered: u32 = 252;
33impl cudaRoundMode {
34 /// Rounds to the nearest representable value.
35 pub const cudaRoundNearest: cudaRoundMode = cudaRoundMode(0);
36 /// Rounds toward zero.
37 pub const cudaRoundZero: cudaRoundMode = cudaRoundMode(1);
38 /// Rounds toward positive infinity.
39 pub const cudaRoundPosInf: cudaRoundMode = cudaRoundMode(2);
40 /// Rounds toward negative infinity.
41 pub const cudaRoundMinInf: cudaRoundMode = cudaRoundMode(3);
42}
43/// Floating-point rounding direction for CUDA conversion operations.
44#[repr(transparent)]
45#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
46pub struct cudaRoundMode(pub ::core::ffi::c_uint);
47/// Unsigned C `size_t`, used for byte counts and object sizes in the native ABI.
48pub type size_t = ::core::ffi::c_ulong;
49impl cudaSurfaceBoundaryMode {
50 /// Zero boundary mode.
51 pub const cudaBoundaryModeZero: cudaSurfaceBoundaryMode = cudaSurfaceBoundaryMode(0);
52 /// Clamp boundary mode.
53 pub const cudaBoundaryModeClamp: cudaSurfaceBoundaryMode = cudaSurfaceBoundaryMode(
54 1,
55 );
56 /// Trap boundary mode.
57 pub const cudaBoundaryModeTrap: cudaSurfaceBoundaryMode = cudaSurfaceBoundaryMode(2);
58}
59/// CUDA Surface boundary modes.
60#[repr(transparent)]
61#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
62pub struct cudaSurfaceBoundaryMode(pub ::core::ffi::c_uint);
63impl cudaSurfaceFormatMode {
64 /// Forced format mode.
65 pub const cudaFormatModeForced: cudaSurfaceFormatMode = cudaSurfaceFormatMode(0);
66 /// Auto format mode.
67 pub const cudaFormatModeAuto: cudaSurfaceFormatMode = cudaSurfaceFormatMode(1);
68}
69/// CUDA Surface format modes.
70#[repr(transparent)]
71#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
72pub struct cudaSurfaceFormatMode(pub ::core::ffi::c_uint);
73/// An opaque value that represents a CUDA Surface object.
74pub type cudaSurfaceObject_t = ::core::ffi::c_ulonglong;
75impl cudaTextureAddressMode {
76 /// Wrapping address mode.
77 pub const cudaAddressModeWrap: cudaTextureAddressMode = cudaTextureAddressMode(0);
78 /// Clamp to edge address mode.
79 pub const cudaAddressModeClamp: cudaTextureAddressMode = cudaTextureAddressMode(1);
80 /// Mirror address mode.
81 pub const cudaAddressModeMirror: cudaTextureAddressMode = cudaTextureAddressMode(2);
82 /// Border address mode.
83 pub const cudaAddressModeBorder: cudaTextureAddressMode = cudaTextureAddressMode(3);
84}
85/// CUDA texture address modes.
86#[repr(transparent)]
87#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
88pub struct cudaTextureAddressMode(pub ::core::ffi::c_uint);
89impl cudaTextureFilterMode {
90 /// Point filter mode.
91 pub const cudaFilterModePoint: cudaTextureFilterMode = cudaTextureFilterMode(0);
92 /// Linear filter mode.
93 pub const cudaFilterModeLinear: cudaTextureFilterMode = cudaTextureFilterMode(1);
94}
95/// CUDA texture filter modes.
96#[repr(transparent)]
97#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
98pub struct cudaTextureFilterMode(pub ::core::ffi::c_uint);
99impl cudaTextureReadMode {
100 /// Read texture as specified element type.
101 pub const cudaReadModeElementType: cudaTextureReadMode = cudaTextureReadMode(0);
102 /// Read texture as normalized float.
103 pub const cudaReadModeNormalizedFloat: cudaTextureReadMode = cudaTextureReadMode(1);
104}
105/// CUDA texture read modes.
106#[repr(transparent)]
107#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
108pub struct cudaTextureReadMode(pub ::core::ffi::c_uint);
109/// CUDA texture descriptor.
110#[repr(C)]
111#[derive(Debug, Copy, Clone, PartialOrd, PartialEq)]
112pub struct cudaTextureDesc {
113 /// Texture address mode for up to 3 dimensions.
114 pub addressMode: [cudaTextureAddressMode; 3usize],
115 /// Texture filter mode.
116 pub filterMode: cudaTextureFilterMode,
117 /// Texture read mode.
118 pub readMode: cudaTextureReadMode,
119 /// Perform sRGB->linear conversion during texture read.
120 pub sRGB: ::core::ffi::c_int,
121 /// Texture Border Color.
122 pub borderColor: [f32; 4usize],
123 /// Indicates whether texture reads are normalized or not.
124 pub normalizedCoords: ::core::ffi::c_int,
125 /// Limit to the anisotropy ratio.
126 pub maxAnisotropy: ::core::ffi::c_uint,
127 /// Mipmap filter mode.
128 pub mipmapFilterMode: cudaTextureFilterMode,
129 /// Offset applied to the supplied mipmap level.
130 pub mipmapLevelBias: f32,
131 /// Lower end of the mipmap level range to clamp access to.
132 pub minMipmapLevelClamp: f32,
133 /// Upper end of the mipmap level range to clamp access to.
134 pub maxMipmapLevelClamp: f32,
135 /// Disable any trilinear filtering optimizations.
136 pub disableTrilinearOptimization: ::core::ffi::c_int,
137 /// Enable seamless cube map filtering.
138 pub seamlessCubemap: ::core::ffi::c_int,
139}
140impl Default for cudaTextureDesc {
141 fn default() -> Self {
142 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
143 unsafe {
144 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
145 s.assume_init()
146 }
147 }
148}
149/// An opaque value that represents a CUDA texture object.
150pub type cudaTextureObject_t = ::core::ffi::c_ulonglong;
151singe_loader::functions! { crate::RUNTIME;
152 /// Destroy all allocations and reset all state on the current device in the current process.
153 ///
154 /// Explicitly destroys and cleans up all resources associated with the current device in the current process. It is the caller’s responsibility to ensure that the resources are not accessed or passed in subsequent API calls and doing so will result in undefined behavior. These resources include CUDA types [cudaStream_t](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gae15d9c8b7a240312b533d6122558085a), [cudaEvent_t](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gaea2f543a9fc0e52fe4ae712920fd1247), [cudaArray_t](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gaaf8b3ba752727d996074a71ee997ce68), [cudaMipmappedArray_t](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga1b03ad14fc0ab86f8b033837f5562d8a), [`cudaPitchedPtr`], [`cudaTextureObject_t`], [`cudaSurfaceObject_t`], ::textureReference, ::surfaceReference, [cudaExternalMemory_t](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga79a2bf6a3a2aa9011a96dc17d476faf7), [cudaExternalSemaphore_t](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gaf8bc7ab93d638c5835e5289ac7d683c4) and [cudaGraphicsResource_t](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gaf58dd8d3c7a65714ff7f5459adbf7e6f). These resources also include memory allocations by [`cudaMalloc`], [`cudaMallocHost`], [`cudaMallocManaged`] and [`cudaMallocPitch`]. Any subsequent API call to this device will reinitialize the device.
155 ///
156 /// Note that this function will reset the device immediately. It is the caller’s responsibility to ensure that the device is not being accessed by any other host threads from the process when this function is called.
157 pub fn cudaDeviceReset() -> cudaError_t;
158}
159singe_loader::functions! { crate::RUNTIME;
160 /// Wait for compute device to finish.
161 ///
162 /// Blocks until the device has completed all preceding requested tasks. [`cudaDeviceSynchronize`] returns an error if one of the preceding tasks has failed. If the [cudaDeviceScheduleBlockingSync](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga057e6912c52708b6aa86e79dd83d007c) flag was set for this device, the host thread will block until the device has finished its work.
163 pub fn cudaDeviceSynchronize() -> cudaError_t;
164}
165singe_loader::functions! { crate::RUNTIME;
166 /// Set resource limits.
167 ///
168 /// Setting `limit` to `value` is a request by the application to update the current limit maintained by the device. 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 [`cudaDeviceGetLimit`] to find out exactly what the limit has been set to.
169 ///
170 /// Setting each [`cudaLimit`] has its own specific restrictions, so each is discussed here.
171 ///
172 /// # Parameters
173 ///
174 /// - `limit`: Limit to set.
175 /// - `value`: Size of limit.
176 pub fn cudaDeviceSetLimit(limit: cudaLimit, value: size_t) -> cudaError_t;
177}
178singe_loader::functions! { crate::RUNTIME;
179 /// Return resource limits.
180 ///
181 /// Returns in `*pValue` the current size of `limit`. The following [`cudaLimit`] values are supported.
182 ///
183 /// # Parameters
184 ///
185 /// - `pValue`: Returned size of the limit.
186 /// - `limit`: Limit to query.
187 pub fn cudaDeviceGetLimit(pValue: *mut size_t, limit: cudaLimit) -> cudaError_t;
188}
189singe_loader::functions! { crate::RUNTIME;
190 /// Returns the maximum number of elements allocatable in a 1D linear texture for a given element size.
191 ///
192 /// Returns in `maxWidthInElements` the maximum number of elements allocatable in a 1D linear texture for given format descriptor `fmtDesc`.
193 ///
194 /// # Parameters
195 ///
196 /// - `maxWidthInElements`: Returns maximum number of texture elements allocatable for given `fmtDesc`.
197 /// - `fmtDesc`: Texture format description.
198 pub fn cudaDeviceGetTexture1DLinearMaxWidth(
199 maxWidthInElements: *mut size_t,
200 fmtDesc: *const cudaChannelFormatDesc,
201 device: ::core::ffi::c_int,
202 ) -> cudaError_t;
203}
204singe_loader::functions! { crate::RUNTIME;
205 /// Returns the preferred cache configuration for the current device.
206 ///
207 /// On devices where the L1 cache and shared memory use the same hardware resources, this returns through `pCacheConfig` the preferred cache configuration for the current device. This is only a preference. The runtime will use the requested configuration if possible, but it is free to choose a different configuration if required to execute functions.
208 ///
209 /// This will return a `pCacheConfig` of [cudaFuncCachePreferNone](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ggab980f35ed69ee7991704de29a13de49ba3b4b8c65376ce1ca107be413e15981bc) on devices where the size of the L1 cache and shared memory are fixed.
210 ///
211 /// The supported cache configurations are.
212 ///
213 /// # Parameters
214 ///
215 /// - `pCacheConfig`: - Returned cache configuration
216 pub fn cudaDeviceGetCacheConfig(pCacheConfig: *mut cudaFuncCache) -> cudaError_t;
217}
218singe_loader::functions! { crate::RUNTIME;
219 /// Returns numerical values that correspond to the least and greatest stream priorities.
220 ///
221 /// 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 [`cudaStreamCreateWithPriority`] for details on creating a priority stream. A NULL may be passed in for `*leastPriority` or `*greatestPriority` if the value is not desired.
222 ///
223 /// This function will return ‘0’ in both `*leastPriority` and `*greatestPriority` if the current context’s device does not support stream priorities (see [`cudaDeviceGetAttribute`]).
224 ///
225 /// # Parameters
226 ///
227 /// - `leastPriority`: Pointer to an int in which the numerical value for least stream priority is returned.
228 /// - `greatestPriority`: Pointer to an int in which the numerical value for greatest stream priority is returned.
229 pub fn cudaDeviceGetStreamPriorityRange(
230 leastPriority: *mut ::core::ffi::c_int,
231 greatestPriority: *mut ::core::ffi::c_int,
232 ) -> cudaError_t;
233}
234singe_loader::functions! { crate::RUNTIME;
235 /// Sets the preferred cache configuration for the current device.
236 ///
237 /// On devices where the L1 cache and shared memory use the same hardware resources, this sets through `cacheConfig` the preferred cache configuration for the current device. This is only a preference. The runtime 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 [cudaFuncSetCacheConfig (C API)](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__EXECUTION.html#group__cudart__execution_1ga6699ca1943ac2655effa0d571b2f4f15) or [cudaFuncSetCacheConfig (C++ API)](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__HIGHLEVEL.html#group__cudart__highlevel_1ga981c8d74d33b21e7fd57609b7337653e) will be preferred over this device-wide setting. Setting the device-wide cache configuration to [cudaFuncCachePreferNone](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ggab980f35ed69ee7991704de29a13de49ba3b4b8c65376ce1ca107be413e15981bc) will cause subsequent kernel launches to prefer to not change the cache configuration unless required to launch the kernel.
238 ///
239 /// This setting does nothing on devices where the size of the L1 cache and shared memory are fixed.
240 ///
241 /// Launching a kernel with a different preference than the most recent preference setting may insert a device-side synchronization point.
242 ///
243 /// The supported cache configurations are.
244 ///
245 /// # Parameters
246 ///
247 /// - `cacheConfig`: - Requested cache configuration
248 pub fn cudaDeviceSetCacheConfig(cacheConfig: cudaFuncCache) -> cudaError_t;
249}
250singe_loader::functions! { crate::RUNTIME;
251 /// Returns a handle to a compute device.
252 ///
253 /// Returns in `*device` a device ordinal given a PCI bus ID string.
254 ///
255 /// where `domain`, `bus`, `device`, and `function` are all hexadecimal values.
256 ///
257 /// # Parameters
258 ///
259 /// - `device`: Returned device ordinal.
260 /// - `pciBusId`: String in one of the following forms.
261 pub fn cudaDeviceGetByPCIBusId(
262 device: *mut ::core::ffi::c_int,
263 pciBusId: *const ::core::ffi::c_char,
264 ) -> cudaError_t;
265}
266singe_loader::functions! { crate::RUNTIME;
267 /// Returns a PCI Bus Id string for the device.
268 ///
269 /// 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.
270 ///
271 /// where `domain`, `bus`, `device`, and `function` are all hexadecimal values. pciBusId should be large enough to store 13 characters including the NULL-terminator.
272 ///
273 /// # Parameters
274 ///
275 /// - `pciBusId`: Returned identifier string for the device in the following format.
276 /// - `len`: Maximum length of string to store in `name`.
277 /// - `device`: Device to get identifier string for.
278 pub fn cudaDeviceGetPCIBusId(
279 pciBusId: *mut ::core::ffi::c_char,
280 len: ::core::ffi::c_int,
281 device: ::core::ffi::c_int,
282 ) -> cudaError_t;
283}
284singe_loader::functions! { crate::RUNTIME;
285 /// Gets an interprocess handle for a previously allocated event.
286 ///
287 /// Takes as input a previously allocated event. This event must have been created with the [cudaEventInterprocess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga49ec9cd742f8a3f6fde4ee72a66326f6) and [cudaEventDisableTiming](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gaa5d3eff7c3623e2be533968d9cc1ee7e) flags set. This opaque handle may be copied into other processes and opened with [`cudaIpcOpenEventHandle`] to allow efficient hardware synchronization between GPU work in different processes.
288 ///
289 /// After the event has been been opened in the importing process, [`cudaEventRecord`], [`cudaEventSynchronize`], [`cudaStreamWaitEvent`] and [`cudaEventQuery`] may be used in either process. Performing operations on the imported event after the exported event has been freed with [`cudaEventDestroy`] will result in undefined behavior.
290 ///
291 /// 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 [`cudaDeviceGetAttribute`] with [cudaDevAttrIpcEventSupport](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cda0ab012a7c597ffbe86090ee2f9e1758c).
292 ///
293 /// # Parameters
294 ///
295 /// - `handle`: Pointer to a user allocated cudaIpcEventHandle in which to return the opaque event handle.
296 /// - `event`: Event allocated with [cudaEventInterprocess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga49ec9cd742f8a3f6fde4ee72a66326f6) and [cudaEventDisableTiming](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gaa5d3eff7c3623e2be533968d9cc1ee7e) flags.
297 pub fn cudaIpcGetEventHandle(
298 handle: *mut cudaIpcEventHandle_t,
299 event: cudaEvent_t,
300 ) -> cudaError_t;
301}
302singe_loader::functions! { crate::RUNTIME;
303 /// Opens an interprocess event handle for use in the current process.
304 ///
305 /// Opens an interprocess event handle exported from another process with [`cudaIpcGetEventHandle`]. This function returns a [cudaEvent_t](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gaea2f543a9fc0e52fe4ae712920fd1247) that behaves like a locally created event with the [cudaEventDisableTiming](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gaa5d3eff7c3623e2be533968d9cc1ee7e) flag specified. This event must be freed with [`cudaEventDestroy`].
306 ///
307 /// Performing operations on the imported event after the exported event has been freed with [`cudaEventDestroy`] will result in undefined behavior.
308 ///
309 /// 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 [`cudaDeviceGetAttribute`] with [cudaDevAttrIpcEventSupport](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cda0ab012a7c597ffbe86090ee2f9e1758c).
310 ///
311 /// # Parameters
312 ///
313 /// - `event`: Returns the imported event.
314 /// - `handle`: Interprocess handle to open.
315 pub fn cudaIpcOpenEventHandle(
316 event: *mut cudaEvent_t,
317 handle: cudaIpcEventHandle_t,
318 ) -> cudaError_t;
319}
320singe_loader::functions! { crate::RUNTIME;
321 /// Gets an interprocess memory handle for an existing device memory allocation.
322 ///
323 /// Takes a pointer to the base of an existing device memory allocation created with [`cudaMalloc`] 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.
324 ///
325 /// If a region of memory is freed with [`cudaFree`] and a subsequent call to [`cudaMalloc`] returns memory with the same device address, [`cudaIpcGetMemHandle`] will return a unique handle for the new memory.
326 ///
327 /// 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 [`cudaDeviceGetAttribute`] with [cudaDevAttrIpcEventSupport](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cda0ab012a7c597ffbe86090ee2f9e1758c).
328 ///
329 /// # Parameters
330 ///
331 /// - `handle`: Pointer to user allocated ::cudaIpcMemHandle to return the handle in.
332 /// - `devPtr`: Base pointer to previously allocated device memory.
333 pub fn cudaIpcGetMemHandle(
334 handle: *mut cudaIpcMemHandle_t,
335 devPtr: *mut ::core::ffi::c_void,
336 ) -> cudaError_t;
337}
338singe_loader::functions! { crate::RUNTIME;
339 /// Opens an interprocess memory handle exported from another process and returns a device pointer usable in the local process.
340 ///
341 /// Maps memory exported from another process with [`cudaIpcGetMemHandle`] into the current device address space. For contexts on different devices [`cudaIpcOpenMemHandle`] can attempt to enable peer access between the devices as if the user called [`cudaDeviceEnablePeerAccess`]. This behavior is controlled by the [cudaIpcMemLazyEnablePeerAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga60f28a5142ee7ae0336dfa83fd54e006) flag. [`cudaDeviceCanAccessPeer`] can determine if a mapping is possible.
342 ///
343 /// [`cudaIpcOpenMemHandle`] can open handles to devices that may not be visible in the process calling the API.
344 ///
345 /// Contexts that may open ::cudaIpcMemHandles are restricted in the following way. ::cudaIpcMemHandles from each device in a given process may only be opened by one context per device per other process.
346 ///
347 /// 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.
348 ///
349 /// Memory returned from [`cudaIpcOpenMemHandle`] must be freed with [`cudaIpcCloseMemHandle`].
350 ///
351 /// Calling [`cudaFree`] on an exported memory region before calling [`cudaIpcCloseMemHandle`] in the importing context will result in undefined behavior.
352 ///
353 /// 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 [`cudaDeviceGetAttribute`] with [cudaDevAttrIpcEventSupport](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cda0ab012a7c597ffbe86090ee2f9e1758c).
354 ///
355 /// # Parameters
356 ///
357 /// - `devPtr`: Returned device pointer.
358 /// - `handle`: cudaIpcMemHandle to open.
359 /// - `flags`: Flags for this operation. Must be specified as [cudaIpcMemLazyEnablePeerAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga60f28a5142ee7ae0336dfa83fd54e006).
360 pub fn cudaIpcOpenMemHandle(
361 devPtr: *mut *mut ::core::ffi::c_void,
362 handle: cudaIpcMemHandle_t,
363 flags: ::core::ffi::c_uint,
364 ) -> cudaError_t;
365}
366singe_loader::functions! { crate::RUNTIME;
367 /// Attempts to close memory mapped with cudaIpcOpenMemHandle.
368 ///
369 /// Decrements the reference count of the memory returnd by [`cudaIpcOpenMemHandle`] 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.
370 ///
371 /// Any resources used to enable peer access will be freed if this is the last mapping using them.
372 ///
373 /// 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 [`cudaDeviceGetAttribute`] with [cudaDevAttrIpcEventSupport](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cda0ab012a7c597ffbe86090ee2f9e1758c).
374 ///
375 /// # Parameters
376 ///
377 /// - `devPtr`: - Device pointer returned by ::cudaIpcOpenMemHandle
378 pub fn cudaIpcCloseMemHandle(devPtr: *mut ::core::ffi::c_void) -> cudaError_t;
379}
380singe_loader::functions! { crate::RUNTIME;
381 /// Blocks until remote writes are visible to the specified scope.
382 ///
383 /// Blocks until remote writes to the target context via mappings created through GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see <https://docs.nvidia.com/cuda/gpudirect-rdma> for more information), are visible to the specified scope.
384 ///
385 /// If the scope equals or lies within the scope indicated by [cudaDevAttrGPUDirectRDMAWritesOrdering](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cda881d5b0c5bf7777e382920af4d743bde), 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.
386 ///
387 /// Users may query support for this API via [cudaDevAttrGPUDirectRDMAFlushWritesOptions](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cda7b3462e13705248606f39fb5381446ee).
388 ///
389 /// # Parameters
390 ///
391 /// - `target`: The target of the operation, see cudaFlushGPUDirectRDMAWritesTarget.
392 /// - `scope`: The scope of the operation, see cudaFlushGPUDirectRDMAWritesScope.
393 pub fn cudaDeviceFlushGPUDirectRDMAWrites(
394 target: cudaFlushGPUDirectRDMAWritesTarget,
395 scope: cudaFlushGPUDirectRDMAWritesScope,
396 ) -> cudaError_t;
397}
398singe_loader::functions! { crate::RUNTIME;
399 /// Registers a callback function to receive async notifications.
400 ///
401 /// Registers `callbackFunc` to receive async notifications.
402 ///
403 /// The `userData` parameter is passed to the callback function at async notification time. Likewise, `callback` is also passed to the callback function to distinguish between multiple registered callbacks.
404 ///
405 /// 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.
406 ///
407 /// Callbacks may not call cudaDeviceRegisterAsyncNotification or cudaDeviceUnregisterAsyncNotification. Doing so will result in [cudaErrorNotPermitted](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a67b6095ab719b21659a400b553963eb3). Async notification callbacks execute in an undefined order and may be serialized.
408 ///
409 /// Returns in `*callback` a handle representing the registered callback instance.
410 ///
411 /// # Parameters
412 ///
413 /// - `device`: The device on which to register the callback.
414 /// - `callbackFunc`: The function to register as a callback.
415 /// - `userData`: A generic pointer to user data. This is passed into the callback function.
416 /// - `callback`: A handle representing the registered callback instance.
417 pub fn cudaDeviceRegisterAsyncNotification(
418 device: ::core::ffi::c_int,
419 callbackFunc: cudaAsyncCallback,
420 userData: *mut ::core::ffi::c_void,
421 callback: *mut cudaAsyncCallbackHandle_t,
422 ) -> cudaError_t;
423}
424singe_loader::functions! { crate::RUNTIME;
425 /// Unregisters an async notification callback.
426 ///
427 /// Unregisters `callback` so that the corresponding callback function will stop receiving async notifications.
428 ///
429 /// # Parameters
430 ///
431 /// - `device`: The device from which to remove `callback`.
432 /// - `callback`: The callback instance to unregister from receiving async notifications.
433 pub fn cudaDeviceUnregisterAsyncNotification(
434 device: ::core::ffi::c_int,
435 callback: cudaAsyncCallbackHandle_t,
436 ) -> cudaError_t;
437}
438singe_loader::functions! { crate::RUNTIME;
439 /// Returns the shared memory configuration for the current device.
440 ///
441 /// This function will return in `pConfig` the current size of shared memory banks on the current device. On devices with configurable shared memory banks, [`cudaDeviceSetSharedMemConfig`] can be used to change this setting, so that all subsequent kernel launches will by default use the new bank size. When [`cudaDeviceGetSharedMemConfig`] is called on devices without configurable shared memory, it will return the fixed bank size of the hardware.
442 ///
443 /// The returned bank configurations can be either.
444 ///
445 /// # Parameters
446 ///
447 /// - `pConfig`: - Returned cache configuration
448 #[deprecated]
449 pub fn cudaDeviceGetSharedMemConfig(
450 pConfig: *mut cudaSharedMemConfig,
451 ) -> cudaError_t;
452}
453singe_loader::functions! { crate::RUNTIME;
454 /// Sets the shared memory configuration for the current device.
455 ///
456 /// On devices with configurable shared memory banks, this function will set the shared memory bank size which is used for all subsequent kernel launches. Any per-function setting of shared memory set via [`cudaFuncSetSharedMemConfig`] will override the device wide setting.
457 ///
458 /// Changing the shared memory configuration between launches may introduce a device side synchronization point.
459 ///
460 /// 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.
461 ///
462 /// This function will do nothing on devices with fixed shared memory bank size.
463 ///
464 /// The supported bank configurations are.
465 ///
466 /// # Parameters
467 ///
468 /// - `config`: - Requested cache configuration
469 #[deprecated]
470 pub fn cudaDeviceSetSharedMemConfig(config: cudaSharedMemConfig) -> cudaError_t;
471}
472singe_loader::functions! { crate::RUNTIME;
473 /// Returns the last error from a runtime call.
474 ///
475 /// Returns the last error that has been produced by any of the runtime calls in the same instance of the CUDA Runtime library in the host thread and resets it to [cudaSuccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ae355f04607d824883b4a50662830d591).
476 ///
477 /// Note: Multiple instances of the CUDA Runtime library can be present in an application when using a library that statically links the CUDA Runtime.
478 pub fn cudaGetLastError() -> cudaError_t;
479}
480singe_loader::functions! { crate::RUNTIME;
481 /// Returns the last error from a runtime call.
482 ///
483 /// Returns the last error that has been produced by any of the runtime calls in the same instance of the CUDA Runtime library in the host thread. This call does not reset the error to [cudaSuccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ae355f04607d824883b4a50662830d591) like [`cudaGetLastError`].
484 ///
485 /// Note: Multiple instances of the CUDA Runtime library can be present in an application when using a library that statically links the CUDA Runtime.
486 pub fn cudaPeekAtLastError() -> cudaError_t;
487}
488singe_loader::functions! { crate::RUNTIME;
489 /// Returns the string representation of an error code enum name.
490 ///
491 /// Returns a string containing the name of an error code in the enum. If the error code is not recognized, “unrecognized error code” is returned.
492 ///
493 /// # Parameters
494 ///
495 /// - `error`: - Error code to convert to string
496 pub fn cudaGetErrorName(error: cudaError_t) -> *const ::core::ffi::c_char;
497}
498singe_loader::functions! { crate::RUNTIME;
499 /// Returns the description string for an error code.
500 ///
501 /// Returns the description string for an error code. If the error code is not recognized, “unrecognized error code” is returned.
502 ///
503 /// # Parameters
504 ///
505 /// - `error`: - Error code to convert to string
506 pub fn cudaGetErrorString(error: cudaError_t) -> *const ::core::ffi::c_char;
507}
508singe_loader::functions! { crate::RUNTIME;
509 /// Returns the number of compute-capable devices.
510 ///
511 /// Returns in `*count` the number of devices with compute capability greater or equal to 2.0 that are available for execution.
512 ///
513 /// # Parameters
514 ///
515 /// - `count`: - Returns the number of devices with compute capability greater or equal to 2.0
516 pub fn cudaGetDeviceCount(count: *mut ::core::ffi::c_int) -> cudaError_t;
517}
518singe_loader::functions! { crate::RUNTIME;
519 /// Returns information about the compute-device.
520 ///
521 /// Returns in `*prop` the properties of device `dev`.
522 ///
523 /// # Parameters
524 ///
525 /// - `prop`: Properties for the specified device.
526 /// - `device`: Device number to get properties for.
527 pub fn cudaGetDeviceProperties(
528 prop: *mut cudaDeviceProp,
529 device: ::core::ffi::c_int,
530 ) -> cudaError_t;
531}
532singe_loader::functions! { crate::RUNTIME;
533 /// Returns information about the device.
534 ///
535 /// Returns in `*value` the integer value of the attribute `attr` on device `device`.
536 ///
537 /// # Parameters
538 ///
539 /// - `value`: Returned device attribute value.
540 /// - `attr`: Device attribute to query.
541 /// - `device`: Device number to query.
542 pub fn cudaDeviceGetAttribute(
543 value: *mut ::core::ffi::c_int,
544 attr: cudaDeviceAttr,
545 device: ::core::ffi::c_int,
546 ) -> cudaError_t;
547}
548singe_loader::functions! { crate::RUNTIME;
549 /// Queries details about atomic operations supported between the device and host.
550 ///
551 /// 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`.
552 ///
553 /// For each [`cudaAtomicOperation`] in `*operations`, the corresponding result in `*capabilities` will be a bitmask indicating which of [cudaAtomicOperationCapability](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga3ded8497f09d41455ea64acb7a880868) the link supports natively.
554 ///
555 /// Returns [cudaErrorInvalidDevice](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a938c6e8b96ecde62e3ab5137156f739a) if `dev` is not valid.
556 ///
557 /// Returns [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) if `*capabilities` or `*operations` is NULL, if `count` is 0, or if any of `*operations` is not valid.
558 ///
559 /// # Parameters
560 ///
561 /// - `capabilities`: Returned capability details of each requested operation.
562 /// - `operations`: Requested operations.
563 /// - `count`: Count of requested operations and size of capabilities.
564 pub fn cudaDeviceGetHostAtomicCapabilities(
565 capabilities: *mut ::core::ffi::c_uint,
566 operations: *const cudaAtomicOperation,
567 count: ::core::ffi::c_uint,
568 device: ::core::ffi::c_int,
569 ) -> cudaError_t;
570}
571singe_loader::functions! { crate::RUNTIME;
572 /// Returns the default mempool of a device.
573 ///
574 /// The default mempool of a device contains device memory from that device.
575 pub fn cudaDeviceGetDefaultMemPool(
576 memPool: *mut cudaMemPool_t,
577 device: ::core::ffi::c_int,
578 ) -> cudaError_t;
579}
580singe_loader::functions! { crate::RUNTIME;
581 /// Sets the current memory pool of a device.
582 ///
583 /// The memory pool must be local to the specified device. Unless a mempool is specified in the [`cudaMallocAsync`] call, [`cudaMallocAsync`] allocates from the current mempool of the provided stream’s device. By default, a device’s current memory pool is its default memory pool.
584 pub fn cudaDeviceSetMemPool(
585 device: ::core::ffi::c_int,
586 memPool: cudaMemPool_t,
587 ) -> cudaError_t;
588}
589singe_loader::functions! { crate::RUNTIME;
590 /// Gets the current mempool for a device.
591 ///
592 /// Returns the last pool provided to [`cudaDeviceSetMemPool`] for this device or the device’s default memory pool if [`cudaDeviceSetMemPool`] 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 or [`cudaDeviceSetMemPool`].
593 pub fn cudaDeviceGetMemPool(
594 memPool: *mut cudaMemPool_t,
595 device: ::core::ffi::c_int,
596 ) -> cudaError_t;
597}
598singe_loader::functions! { crate::RUNTIME;
599 /// Return NvSciSync attributes that this device can support.
600 ///
601 /// Returns in `nvSciSyncAttrList`, the properties of NvSciSync that this CUDA device, `dev` can support. The returned `nvSciSyncAttrList` can be used to create an NvSciSync that matches this device’s capabilities.
602 ///
603 /// If NvSciSyncAttrKey_RequiredPerm field in `nvSciSyncAttrList` is already set this API will return [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c).
604 ///
605 /// The applications should set `nvSciSyncAttrList` to a valid NvSciSyncAttrList failing which this API will return ::cudaErrorInvalidHandle.
606 ///
607 /// The `flags` controls how applications intends to use the NvSciSync created from the `nvSciSyncAttrList`. The valid flags are:
608 ///
609 /// At least one of these flags must be set, failing which the API returns [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c). 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`.
610 ///
611 /// Note that this API updates the input `nvSciSyncAttrList` with values equivalent to the following public attribute key-values: NvSciSyncAttrKey_RequiredPerm is set to
612 ///
613 /// [cudaSuccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ae355f04607d824883b4a50662830d591), [cudaErrorDeviceUninitialized](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a9e95927732f0d5a68151c72296581504), [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c), ::cudaErrorInvalidHandle, [cudaErrorInvalidDevice](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a938c6e8b96ecde62e3ab5137156f739a), [cudaErrorNotSupported](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ad846fd9f2e8ba5e2fb4f1695b7ab6164), [cudaErrorMemoryAllocation](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038af210f50ae7f17f655e0504929606add9).
614 ///
615 /// # Parameters
616 ///
617 /// - `nvSciSyncAttrList`: Return NvSciSync attributes supported.
618 /// - `device`: Valid CUDA Device to get NvSciSync attributes for.
619 /// - `flags`: flags describing NvSciSync usage.
620 pub fn cudaDeviceGetNvSciSyncAttributes(
621 nvSciSyncAttrList: *mut ::core::ffi::c_void,
622 device: ::core::ffi::c_int,
623 flags: ::core::ffi::c_int,
624 ) -> cudaError_t;
625}
626singe_loader::functions! { crate::RUNTIME;
627 /// Queries attributes of the link between two devices.
628 ///
629 /// Returns in `*value` the value of the requested attribute `attrib` of the link between `srcDevice` and `dstDevice`. The supported attributes are:
630 ///
631 /// Returns [cudaErrorInvalidDevice](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a938c6e8b96ecde62e3ab5137156f739a) if `srcDevice` or `dstDevice` are not valid or if they represent the same device.
632 ///
633 /// Returns [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) if `attrib` is not valid or if `value` is a null pointer.
634 ///
635 /// # Parameters
636 ///
637 /// - `value`: Returned value of the requested attribute.
638 /// - `srcDevice`: The source device of the target link.
639 /// - `dstDevice`: The destination device of the target link.
640 pub fn cudaDeviceGetP2PAttribute(
641 value: *mut ::core::ffi::c_int,
642 attr: cudaDeviceP2PAttr,
643 srcDevice: ::core::ffi::c_int,
644 dstDevice: ::core::ffi::c_int,
645 ) -> cudaError_t;
646}
647singe_loader::functions! { crate::RUNTIME;
648 /// Queries details about atomic operations supported between two devices.
649 ///
650 /// 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`.
651 ///
652 /// For each [`cudaAtomicOperation`] in `*operations`, the corresponding result in `*capabilities` will be a bitmask indicating which of [cudaAtomicOperationCapability](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga3ded8497f09d41455ea64acb7a880868) the link supports natively.
653 ///
654 /// Returns [cudaErrorInvalidDevice](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a938c6e8b96ecde62e3ab5137156f739a) if `srcDevice` or `dstDevice` are not valid or if they represent the same device.
655 ///
656 /// Returns [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) if `*capabilities` or `*operations` is NULL, if `count` is 0, or if any of `*operations` is not valid.
657 ///
658 /// # Parameters
659 ///
660 /// - `capabilities`: Returned capability details of each requested operation.
661 /// - `operations`: Requested operations.
662 /// - `count`: Count of requested operations and size of capabilities.
663 /// - `srcDevice`: The source device of the target link.
664 /// - `dstDevice`: The destination device of the target link.
665 pub fn cudaDeviceGetP2PAtomicCapabilities(
666 capabilities: *mut ::core::ffi::c_uint,
667 operations: *const cudaAtomicOperation,
668 count: ::core::ffi::c_uint,
669 srcDevice: ::core::ffi::c_int,
670 dstDevice: ::core::ffi::c_int,
671 ) -> cudaError_t;
672}
673singe_loader::functions! { crate::RUNTIME;
674 /// Select compute-device which best matches criteria.
675 ///
676 /// Returns in `*device` the device which has properties that best match `*prop`.
677 ///
678 /// # Parameters
679 ///
680 /// - `device`: Device with best match.
681 /// - `prop`: Desired device properties.
682 pub fn cudaChooseDevice(
683 device: *mut ::core::ffi::c_int,
684 prop: *const cudaDeviceProp,
685 ) -> cudaError_t;
686}
687singe_loader::functions! { crate::RUNTIME;
688 /// Initialize device to be used for GPU executions.
689 ///
690 /// This function will initialize the CUDA Runtime structures and primary context on `device` when called, but the context will not be made current to `device`.
691 ///
692 /// When [cudaInitDeviceFlagsAreValid](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga2ff861a477ec064dcf01977194158e49) is set in `flags`, deviceFlags are applied to the requested device. The values of deviceFlags match those of the flags parameters in [`cudaSetDeviceFlags`]. The effect may be verified by [`cudaGetDeviceFlags`].
693 ///
694 /// This function will return an error if the device is in [`cudaComputeMode::cudaComputeModeExclusiveProcess`] and is occupied by another process or if the device is in [`cudaComputeMode::cudaComputeModeProhibited`].
695 ///
696 /// # Parameters
697 ///
698 /// - `device`: Device on which the runtime will initialize itself.
699 /// - `deviceFlags`: Parameters for device operation.
700 /// - `flags`: Flags for controlling the device initialization.
701 pub fn cudaInitDevice(
702 device: ::core::ffi::c_int,
703 deviceFlags: ::core::ffi::c_uint,
704 flags: ::core::ffi::c_uint,
705 ) -> cudaError_t;
706}
707singe_loader::functions! { crate::RUNTIME;
708 /// Set device to be used for GPU executions.
709 ///
710 /// Sets `device` as the current device for the calling host thread. Valid device id’s are 0 to ([`cudaGetDeviceCount`] - 1).
711 ///
712 /// Any device memory subsequently allocated from this host thread using [`cudaMalloc`], [`cudaMallocPitch`] or [`cudaMallocArray`] will be physically resident on `device`. Any host memory allocated from this host thread using [`cudaMallocHost`] or [`cudaHostAlloc`] or [`cudaHostRegister`] will have its lifetime associated with `device`. Any streams or events created from this host thread will be associated with `device`. Any kernels launched from this host thread using the <<<>>> operator or [`cudaLaunchKernel`] will be executed on `device`.
713 ///
714 /// This call may be made from any host thread, to any device, and at any time. This function will do no synchronization with the previous or new device, and should only take significant time when it initializes the runtime’s context state. This call will bind the primary context of the specified device to the calling thread and all the subsequent memory allocations, stream and event creations, and kernel launches will be associated with the primary context. This function will also immediately initialize the runtime state on the primary context, and the context will be current on `device` immediately. This function will return an error if the device is in [`cudaComputeMode::cudaComputeModeExclusiveProcess`] and is occupied by another process or if the device is in [`cudaComputeMode::cudaComputeModeProhibited`].
715 ///
716 /// It is not required to call [`cudaInitDevice`] before using this function.
717 ///
718 /// # Parameters
719 ///
720 /// - `device`: - Device on which the active host thread should execute the device code.
721 pub fn cudaSetDevice(device: ::core::ffi::c_int) -> cudaError_t;
722}
723singe_loader::functions! { crate::RUNTIME;
724 /// Returns which device is currently being used.
725 ///
726 /// Returns in `*device` the current device for the calling host thread.
727 ///
728 /// # Parameters
729 ///
730 /// - `device`: - Returns the device on which the active host thread executes the device code.
731 pub fn cudaGetDevice(device: *mut ::core::ffi::c_int) -> cudaError_t;
732}
733singe_loader::functions! { crate::RUNTIME;
734 /// Set a list of devices that can be used for CUDA.
735 ///
736 /// Sets a list of devices for CUDA execution in priority order using `device_arr`. The parameter `len` specifies the number of elements in the list. CUDA will try devices from the list sequentially until it finds one that works. If this function is not called, or if it is called with a `len` of 0, then CUDA will go back to its default behavior of trying devices sequentially from a default list containing all of the available CUDA devices in the system. If a specified device ID in the list does not exist, this function will return [cudaErrorInvalidDevice](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a938c6e8b96ecde62e3ab5137156f739a). If `len` is not 0 and `device_arr` is NULL or if `len` exceeds the number of devices in the system, then [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) is returned.
737 ///
738 /// # Parameters
739 ///
740 /// - `device_arr`: List of devices to try.
741 /// - `len`: Number of devices in specified list.
742 pub fn cudaSetValidDevices(
743 device_arr: *mut ::core::ffi::c_int,
744 len: ::core::ffi::c_int,
745 ) -> cudaError_t;
746}
747singe_loader::functions! { crate::RUNTIME;
748 /// Sets flags to be used for device executions.
749 ///
750 /// Records `flags` as the flags for the current device. If the current device has been set and that device has already been initialized, the previous flags are overwritten. If the current device has not been initialized, it is initialized with the provided flags. If no device has been made current to the calling thread, a default device is selected and initialized with the provided flags.
751 ///
752 /// The three LSBs of the `flags` parameter can be used to control how the CPU thread interacts with the OS scheduler when waiting for results from the device.
753 ///
754 /// # Parameters
755 ///
756 /// - `flags`: - Parameters for device operation
757 pub fn cudaSetDeviceFlags(flags: ::core::ffi::c_uint) -> cudaError_t;
758}
759singe_loader::functions! { crate::RUNTIME;
760 /// Gets the flags for the current device.
761 ///
762 /// Returns in `flags` the flags for the current device. If there is a current device for the calling thread, the flags for the device are returned. If there is no current device, the flags for the first device are returned, which may be the default flags. Compare to the behavior of [`cudaSetDeviceFlags`].
763 ///
764 /// Typically, the flags returned should match the behavior that will be seen if the calling thread uses a device after this call, without any change to the flags or current device inbetween by this or another thread. Note that if the device is not initialized, it is possible for another thread to change the flags for the current device before it is initialized. Additionally, when using exclusive mode, if this thread has not requested a specific device, it may use a device other than the first device, contrary to the assumption made by this function.
765 ///
766 /// If a context has been created via the driver API and is current to the calling thread, the flags for that context are always returned.
767 ///
768 /// Flags returned by this function may specifically include [cudaDeviceMapHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga3762be9cccdd809a4ca128354fd134b0) even though it is not accepted by [`cudaSetDeviceFlags`] because it is implicit in runtime API flags. The reason for this is that the current context may have been created via the driver API in which case the flag is not implicit and may be unset.
769 ///
770 /// # Parameters
771 ///
772 /// - `flags`: - Pointer to store the device flags
773 pub fn cudaGetDeviceFlags(flags: *mut ::core::ffi::c_uint) -> cudaError_t;
774}
775singe_loader::functions! { crate::RUNTIME;
776 /// Create an asynchronous stream.
777 ///
778 /// Creates a new asynchronous stream on the context that is current to the calling host thread. If no context is current to the calling host thread, then the primary context for a device is selected, made current to the calling thread, and initialized before creating a stream on it.
779 ///
780 /// # Parameters
781 ///
782 /// - `pStream`: - Pointer to new stream identifier
783 pub fn cudaStreamCreate(pStream: *mut cudaStream_t) -> cudaError_t;
784}
785singe_loader::functions! { crate::RUNTIME;
786 /// Create an asynchronous stream.
787 ///
788 /// Creates a new asynchronous stream on the context that is current to the calling host thread. If no context is current to the calling host thread, then the primary context for a device is selected, made current to the calling thread, and initialized before creating a stream on it. The `flags` argument determines the behaviors of the stream. Valid values for `flags` are.
789 ///
790 /// # Parameters
791 ///
792 /// - `pStream`: Pointer to new stream identifier.
793 /// - `flags`: Parameters for stream creation.
794 pub fn cudaStreamCreateWithFlags(
795 pStream: *mut cudaStream_t,
796 flags: ::core::ffi::c_uint,
797 ) -> cudaError_t;
798}
799singe_loader::functions! { crate::RUNTIME;
800 /// Create an asynchronous stream with the specified priority.
801 ///
802 /// Creates a stream with the specified priority and returns a handle in `pStream`. The stream is created on the context that is current to the calling host thread. If no context is current to the calling host thread, then the primary context for a device is selected, made current to the calling thread, and initialized before creating a stream on it. 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.
803 ///
804 /// `priority` follows a convention where lower numbers represent higher priorities. ‘0’ represents default priority. The range of meaningful numerical priorities can be queried using [`cudaDeviceGetStreamPriorityRange`]. If the specified priority is outside the numerical range returned by [`cudaDeviceGetStreamPriorityRange`], it will automatically be clamped to the lowest or the highest number in the range.
805 ///
806 /// # Parameters
807 ///
808 /// - `pStream`: Pointer to new stream identifier.
809 /// - `flags`: Flags for stream creation. See [`cudaStreamCreateWithFlags`] for a list of valid flags that can be passed.
810 /// - `priority`: Priority of the stream. Lower numbers represent higher priorities. See [`cudaDeviceGetStreamPriorityRange`] for more information about the meaningful stream priorities that can be passed.
811 pub fn cudaStreamCreateWithPriority(
812 pStream: *mut cudaStream_t,
813 flags: ::core::ffi::c_uint,
814 priority: ::core::ffi::c_int,
815 ) -> cudaError_t;
816}
817singe_loader::functions! { crate::RUNTIME;
818 /// Query the priority of a stream.
819 ///
820 /// Query the priority of a stream. The priority is returned in in `priority`. Note that if the stream was created with a priority outside the meaningful numerical range returned by [`cudaDeviceGetStreamPriorityRange`], this function returns the clamped priority. See [`cudaStreamCreateWithPriority`] for details about priority clamping.
821 ///
822 /// # Parameters
823 ///
824 /// - `hStream`: Handle to the stream to be queried.
825 /// - `priority`: Pointer to a signed integer in which the stream’s priority is returned.
826 pub fn cudaStreamGetPriority(
827 hStream: cudaStream_t,
828 priority: *mut ::core::ffi::c_int,
829 ) -> cudaError_t;
830}
831singe_loader::functions! { crate::RUNTIME;
832 /// Query the flags of a stream.
833 ///
834 /// Query the flags of a stream. The flags are returned in `flags`. See [`cudaStreamCreateWithFlags`] for a list of valid flags.
835 ///
836 /// # Parameters
837 ///
838 /// - `hStream`: Handle to the stream to be queried.
839 /// - `flags`: Pointer to an unsigned integer in which the stream’s flags are returned.
840 pub fn cudaStreamGetFlags(
841 hStream: cudaStream_t,
842 flags: *mut ::core::ffi::c_uint,
843 ) -> cudaError_t;
844}
845singe_loader::functions! { crate::RUNTIME;
846 /// Query the Id of a stream.
847 ///
848 /// Query the Id of a stream. The Id is returned in `streamId`. The Id is unique for the life of the program.
849 ///
850 /// The stream handle `hStream` can refer to any of the following.
851 ///
852 /// # Parameters
853 ///
854 /// - `hStream`: Handle to the stream to be queried.
855 /// - `streamId`: Pointer to an unsigned long long in which the stream Id is returned.
856 pub fn cudaStreamGetId(
857 hStream: cudaStream_t,
858 streamId: *mut ::core::ffi::c_ulonglong,
859 ) -> cudaError_t;
860}
861singe_loader::functions! { crate::RUNTIME;
862 /// Query the device of a stream.
863 ///
864 /// Returns in `*device` the device of the stream.
865 ///
866 /// # Parameters
867 ///
868 /// - `hStream`: Handle to the stream to be queried.
869 /// - `device`: Returns the device to which the stream belongs.
870 pub fn cudaStreamGetDevice(
871 hStream: cudaStream_t,
872 device: *mut ::core::ffi::c_int,
873 ) -> cudaError_t;
874}
875singe_loader::functions! { crate::RUNTIME;
876 /// Resets all persisting lines in cache to normal status.
877 ///
878 /// Resets all persisting lines in cache to normal status. Takes effect on function return.
879 pub fn cudaCtxResetPersistingL2Cache() -> cudaError_t;
880}
881singe_loader::functions! { crate::RUNTIME;
882 /// Copies attributes from source stream to destination stream.
883 ///
884 /// Copies attributes from source stream `src` to destination stream `dst`. Both streams must have the same context.
885 ///
886 /// # Parameters
887 ///
888 /// - `dst`: Destination stream.
889 /// - `src`: Source stream For attributes see cudaStreamAttrID.
890 pub fn cudaStreamCopyAttributes(dst: cudaStream_t, src: cudaStream_t) -> cudaError_t;
891}
892singe_loader::functions! { crate::RUNTIME;
893 /// Queries stream attribute.
894 ///
895 /// Queries attribute `attr` from `hStream` and stores it in corresponding member of `value_out`.
896 pub fn cudaStreamGetAttribute(
897 hStream: cudaStream_t,
898 attr: cudaLaunchAttributeID,
899 value_out: *mut cudaLaunchAttributeValue,
900 ) -> cudaError_t;
901}
902singe_loader::functions! { crate::RUNTIME;
903 /// Sets stream attribute.
904 ///
905 /// 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.
906 pub fn cudaStreamSetAttribute(
907 hStream: cudaStream_t,
908 attr: cudaLaunchAttributeID,
909 value: *const cudaLaunchAttributeValue,
910 ) -> cudaError_t;
911}
912singe_loader::functions! { crate::RUNTIME;
913 /// Destroys and cleans up an asynchronous stream.
914 ///
915 /// Destroys and cleans up the asynchronous stream specified by `stream`.
916 ///
917 /// In case the device is still doing work in the stream `stream` when [`cudaStreamDestroy`] is called, the function will return immediately and the resources associated with `stream` will be released automatically once the device has completed all work in `stream`.
918 ///
919 /// # Parameters
920 ///
921 /// - `stream`: - Stream identifier
922 pub fn cudaStreamDestroy(stream: cudaStream_t) -> cudaError_t;
923}
924singe_loader::functions! { crate::RUNTIME;
925 /// Make a compute stream wait on an event.
926 ///
927 /// Makes all future work submitted to `stream` wait for all work captured in `event`. See [`cudaEventRecord`] for details on what is captured by an event. The synchronization will be performed efficiently on the device when applicable. `event` may be from a different device than `stream`.
928 ///
929 /// flags include.
930 ///
931 /// # Parameters
932 ///
933 /// - `stream`: Stream to wait.
934 /// - `event`: Event to wait on.
935 /// - `flags`: Parameters for the operation(See above).
936 pub fn cudaStreamWaitEvent(
937 stream: cudaStream_t,
938 event: cudaEvent_t,
939 flags: ::core::ffi::c_uint,
940 ) -> cudaError_t;
941}
942/// Type of stream callback functions.
943///
944/// The stream as passed to ::cudaStreamAddCallback, may be NULL.
945///
946/// ::cudaSuccess or any persistent error on the stream.
947///
948/// User parameter provided at registration.
949pub type cudaStreamCallback_t = ::core::option::Option<
950 unsafe extern "C" fn(
951 stream: cudaStream_t,
952 status: cudaError_t,
953 userData: *mut ::core::ffi::c_void,
954 ),
955>;
956singe_loader::functions! { crate::RUNTIME;
957 /// Add a callback to a compute stream.
958 ///
959 /// Adds a callback to be called on the host after all currently enqueued items in the stream have completed. For each cudaStreamAddCallback call, a callback will be executed exactly once. The callback will block later work in the stream until it is finished.
960 ///
961 /// The callback may be passed [cudaSuccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ae355f04607d824883b4a50662830d591) or an error code. In the event of a device error, all subsequently executed callbacks will receive an appropriate [cudaError_t](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gaf599e5b8b829ce7db0f5216928f6ecb6).
962 ///
963 /// Callbacks must not make any CUDA API calls. Attempting to use CUDA APIs may result in [cudaErrorNotPermitted](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a67b6095ab719b21659a400b553963eb3). 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.
964 ///
965 /// For the purposes of Unified Memory, callback execution makes a number of guarantees.
966 ///
967 /// # Parameters
968 ///
969 /// - `stream`: Stream to add callback to.
970 /// - `callback`: The function to call once preceding stream operations are complete.
971 /// - `userData`: User specified data to be passed to the callback function.
972 /// - `flags`: Reserved for future use, must be 0.
973 pub fn cudaStreamAddCallback(
974 stream: cudaStream_t,
975 callback: cudaStreamCallback_t,
976 userData: *mut ::core::ffi::c_void,
977 flags: ::core::ffi::c_uint,
978 ) -> cudaError_t;
979}
980singe_loader::functions! { crate::RUNTIME;
981 /// Waits for stream tasks to complete.
982 ///
983 /// Blocks until `stream` has completed all operations. If the [cudaDeviceScheduleBlockingSync](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga057e6912c52708b6aa86e79dd83d007c) flag was set for this device, the host thread will block until the stream is finished with all of its tasks.
984 ///
985 /// # Parameters
986 ///
987 /// - `stream`: - Stream identifier
988 pub fn cudaStreamSynchronize(stream: cudaStream_t) -> cudaError_t;
989}
990singe_loader::functions! { crate::RUNTIME;
991 /// Queries an asynchronous stream for completion status.
992 ///
993 /// Returns [cudaSuccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ae355f04607d824883b4a50662830d591) if all operations in `stream` have completed, or [cudaErrorNotReady](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a285d0c852ab65b8925505e1065563f6d) if not.
994 ///
995 /// For the purposes of Unified Memory, a return value of [cudaSuccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ae355f04607d824883b4a50662830d591) is equivalent to having called [`cudaStreamSynchronize`].
996 ///
997 /// # Parameters
998 ///
999 /// - `stream`: - Stream identifier
1000 pub fn cudaStreamQuery(stream: cudaStream_t) -> cudaError_t;
1001}
1002singe_loader::functions! { crate::RUNTIME;
1003 /// Attach memory to a stream asynchronously.
1004 ///
1005 /// Enqueues an operation in `stream` to specify stream association of `length` bytes of memory starting from `devPtr`. 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.
1006 ///
1007 /// `devPtr` must point to an one of the following types of memories:
1008 ///
1009 /// 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.
1010 ///
1011 /// For pageable allocations, `length` must be non-zero.
1012 ///
1013 /// The stream association is specified using `flags` which must be one of [cudaMemAttachGlobal](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4808e47eba73eb94622ec70a9f9b91ff), [cudaMemAttachHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4f9a428d18fdd89a99441d0dd27131c0) or [cudaMemAttachSingle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gadc191442d08fc3a9de4cf055edfd2dbe). The default value for `flags` is [cudaMemAttachSingle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gadc191442d08fc3a9de4cf055edfd2dbe) If the [cudaMemAttachGlobal](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4808e47eba73eb94622ec70a9f9b91ff) flag is specified, the memory can be accessed by any stream on any device. If the [cudaMemAttachHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4f9a428d18fdd89a99441d0dd27131c0) 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 [cudaDevAttrConcurrentManagedAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdac88178f29891f2c18fe67361cc80de09). If the [cudaMemAttachSingle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gadc191442d08fc3a9de4cf055edfd2dbe) flag is specified and `stream` is associated with a device that has a zero value for the device attribute [cudaDevAttrConcurrentManagedAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdac88178f29891f2c18fe67361cc80de09), the program makes a guarantee that it will only access the memory on the device from `stream`. 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.
1014 ///
1015 /// 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 `stream` 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.
1016 ///
1017 /// 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.
1018 ///
1019 /// It is a program’s responsibility to order calls to [`cudaStreamAttachMemAsync`] 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.
1020 ///
1021 /// If `stream` 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 [`cudaMallocManaged`]. For **managed** variables, the default association is always [cudaMemAttachGlobal](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4808e47eba73eb94622ec70a9f9b91ff). 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.
1022 ///
1023 /// # Parameters
1024 ///
1025 /// - `stream`: Stream in which to enqueue the attach operation.
1026 /// - `devPtr`: Pointer to memory (must be a pointer to managed memory or to a valid host-accessible region of system-allocated memory).
1027 /// - `length`: Length of memory (defaults to zero).
1028 /// - `flags`: Must be one of [cudaMemAttachGlobal](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4808e47eba73eb94622ec70a9f9b91ff), [cudaMemAttachHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4f9a428d18fdd89a99441d0dd27131c0) or [cudaMemAttachSingle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gadc191442d08fc3a9de4cf055edfd2dbe) (defaults to [cudaMemAttachSingle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gadc191442d08fc3a9de4cf055edfd2dbe)).
1029 pub fn cudaStreamAttachMemAsync(
1030 stream: cudaStream_t,
1031 devPtr: *mut ::core::ffi::c_void,
1032 length: size_t,
1033 flags: ::core::ffi::c_uint,
1034 ) -> cudaError_t;
1035}
1036singe_loader::functions! { crate::RUNTIME;
1037 /// Begins graph capture on a stream.
1038 ///
1039 /// Begin graph capture on `stream`. 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 [`cudaStreamEndCapture`]. Capture may not be initiated if `stream` is [cudaStreamLegacy](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4e62d09dde16ba457b0a97f3a5262246). 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 [`cudaStreamIsCapturing`]. A unique id representing the capture sequence may be queried via [`cudaStreamGetCaptureInfo`].
1040 ///
1041 /// If `mode` is not cudaStreamCaptureModeRelaxed, [`cudaStreamEndCapture`] must be called on this stream from the same thread.
1042 ///
1043 /// # Parameters
1044 ///
1045 /// - `stream`: Stream in which to initiate capture.
1046 /// - `mode`: Controls the interaction of this capture sequence with other API calls that are potentially unsafe. For more details see [`cudaThreadExchangeStreamCaptureMode`].
1047 pub fn cudaStreamBeginCapture(
1048 stream: cudaStream_t,
1049 mode: cudaStreamCaptureMode,
1050 ) -> cudaError_t;
1051}
1052/// Callback function invoked when node parameter mismatches are detected while recapturing to an existing graph. Parameter struct pointers are only valid within the callback.
1053///
1054/// User parameter provided at beginning of recapture
1055///
1056/// Graph node with the parameter mismatch
1057///
1058/// The original node parameters from the graph
1059///
1060/// The node parameters received during the recapture
1061///
1062/// status Status code for the recapture of the node
1063///
1064///
1065///
1066/// # Return value
1067///
1068/// Error code for the callback. Anything other than cudaSuccess will cause the recapture to fail immediately.
1069pub type cudaGraphRecaptureCallback_t = ::core::option::Option<
1070 unsafe extern "C" fn(
1071 data: *mut ::core::ffi::c_void,
1072 node: cudaGraphNode_t,
1073 originalParams: *const cudaGraphNodeParams,
1074 recaptureParams: *const cudaGraphNodeParams,
1075 status: cudaGraphRecaptureStatus,
1076 ) -> cudaError_t,
1077>;
1078/// Struct of user callback data that is invoked when node parameter mismatches are detected while recapturing to an existing graph.
1079#[repr(C)]
1080#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1081pub struct cudaGraphRecaptureCallbackData {
1082 /// Callback function that will be invoked.
1083 pub callbackFunc: cudaGraphRecaptureCallback_t,
1084 /// Generic pointer that is passed to the callback function.
1085 pub userData: *mut ::core::ffi::c_void,
1086}
1087impl Default for cudaGraphRecaptureCallbackData {
1088 fn default() -> Self {
1089 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
1090 unsafe {
1091 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1092 s.assume_init()
1093 }
1094 }
1095}
1096singe_loader::functions! { crate::RUNTIME;
1097 /// Begin graph capture on a stream to an existing graph.
1098 ///
1099 /// Begin graph capture on `stream` to the existing `graph`. The node creation order while recapturing the graph must be identical to the original graph. The recapture will fail immediately for:
1100 ///
1101 /// 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 cudaSuccess.
1102 ///
1103 /// If the recapture fails for any reason, the `graph` will be in an undefined state and should be destroyed.
1104 ///
1105 /// See cudaStreamBeginCapture for additional detail on beginning the capture.
1106 ///
1107 /// # Parameters
1108 ///
1109 /// - `stream`: Stream in which to initiate capture.
1110 /// - `mode`: Controls the interaction of this capture sequence with other API calls that are potentially unsafe. For more details see [`cudaThreadExchangeStreamCaptureMode`].
1111 /// - `graph`: Existing CUDA graph to be captured into.
1112 /// - `callbackData`: Optional struct of callback data that will be invoked for all parameter mismatches from the original graph.
1113 pub fn cudaStreamBeginRecaptureToGraph(
1114 stream: cudaStream_t,
1115 mode: cudaStreamCaptureMode,
1116 graph: cudaGraph_t,
1117 callbackData: *mut cudaGraphRecaptureCallbackData,
1118 ) -> cudaError_t;
1119}
1120singe_loader::functions! { crate::RUNTIME;
1121 /// Begins graph capture on a stream to an existing graph.
1122 ///
1123 /// Begin graph capture on `stream`. When a stream is in capture mode, all operations pushed into the stream will not be executed, but will instead be captured into `graph`, which will be returned via [`cudaStreamEndCapture`].
1124 ///
1125 /// Capture may not be initiated if `stream` is [cudaStreamLegacy](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4e62d09dde16ba457b0a97f3a5262246). 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 [`cudaStreamIsCapturing`]. A unique id representing the capture sequence may be queried via [`cudaStreamGetCaptureInfo`].
1126 ///
1127 /// If `mode` is not cudaStreamCaptureModeRelaxed, [`cudaStreamEndCapture`] must be called on this stream from the same thread.
1128 ///
1129 /// # Parameters
1130 ///
1131 /// - `stream`: Stream in which to initiate capture.
1132 /// - `graph`: Graph to capture into.
1133 /// - `dependencies`: Dependencies of the first node captured in the stream. Can be NULL if numDependencies is 0.
1134 /// - `dependencyData`: Optional array of data associated with each dependency.
1135 /// - `numDependencies`: Number of dependencies.
1136 /// - `mode`: Controls the interaction of this capture sequence with other API calls that are potentially unsafe. For more details see [`cudaThreadExchangeStreamCaptureMode`].
1137 pub fn cudaStreamBeginCaptureToGraph(
1138 stream: cudaStream_t,
1139 graph: cudaGraph_t,
1140 dependencies: *const cudaGraphNode_t,
1141 dependencyData: *const cudaGraphEdgeData,
1142 numDependencies: size_t,
1143 mode: cudaStreamCaptureMode,
1144 ) -> cudaError_t;
1145}
1146singe_loader::functions! { crate::RUNTIME;
1147 /// Swaps the stream capture interaction mode for a thread.
1148 ///
1149 /// 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:
1150 ///
1151 /// During stream capture (see [`cudaStreamBeginCapture`]), 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 [`cudaStreamBeginCapture`] depended on the allocation being replayed whenever the graph is launched, the captured graph would be invalid.
1152 ///
1153 /// Therefore, stream capture places restrictions on API calls that can be made within or concurrently to a [`cudaStreamBeginCapture`]-[`cudaStreamEndCapture`] sequence. This behavior can be controlled via this API and flags to [`cudaStreamBeginCapture`].
1154 ///
1155 /// A thread’s mode is one of the following.
1156 ///
1157 /// # Parameters
1158 ///
1159 /// - `mode`: - Pointer to mode value to swap with the current mode
1160 pub fn cudaThreadExchangeStreamCaptureMode(
1161 mode: *mut cudaStreamCaptureMode,
1162 ) -> cudaError_t;
1163}
1164singe_loader::functions! { crate::RUNTIME;
1165 /// Ends capture on a stream, returning the captured graph.
1166 ///
1167 /// End capture on `stream`, returning the captured graph via `pGraph`. Capture must have been initiated on `stream` via a call to [`cudaStreamBeginCapture`]. If capture was invalidated, due to a violation of the rules of stream capture, then a NULL graph will be returned.
1168 ///
1169 /// If the `mode` argument to [`cudaStreamBeginCapture`] was not cudaStreamCaptureModeRelaxed, this call must be from the same thread as [`cudaStreamBeginCapture`].
1170 ///
1171 /// # Parameters
1172 ///
1173 /// - `stream`: Stream to query.
1174 /// - `pGraph`: The captured graph.
1175 pub fn cudaStreamEndCapture(
1176 stream: cudaStream_t,
1177 pGraph: *mut cudaGraph_t,
1178 ) -> cudaError_t;
1179}
1180singe_loader::functions! { crate::RUNTIME;
1181 /// Returns a stream’s capture status.
1182 ///
1183 /// Return the capture status of `stream` via `pCaptureStatus`. After a successful call, `*pCaptureStatus` will contain one of the following:
1184 ///
1185 /// Note that, if this is called on [cudaStreamLegacy](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4e62d09dde16ba457b0a97f3a5262246) (the “null stream”) while a blocking stream on the same device is capturing, it will return [cudaErrorStreamCaptureImplicit](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038acf775033deb76dbde57b8df7bd9244e7) and `*pCaptureStatus` is unspecified after the call. The blocking stream capture is not invalidated.
1186 ///
1187 /// 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).
1188 ///
1189 /// # Parameters
1190 ///
1191 /// - `stream`: Stream to query.
1192 /// - `pCaptureStatus`: Returns the stream’s capture status.
1193 pub fn cudaStreamIsCapturing(
1194 stream: cudaStream_t,
1195 pCaptureStatus: *mut cudaStreamCaptureStatus,
1196 ) -> cudaError_t;
1197}
1198singe_loader::functions! { crate::RUNTIME;
1199 /// Query a stream’s capture state.
1200 ///
1201 /// Query stream state related to stream capture.
1202 ///
1203 /// If called on [cudaStreamLegacy](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4e62d09dde16ba457b0a97f3a5262246) (the “null stream”) while a stream not created with [`cudaStreamNonBlocking`] is capturing, returns [cudaErrorStreamCaptureImplicit](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038acf775033deb76dbde57b8df7bd9244e7).
1204 ///
1205 /// Valid data (other than capture status) is returned only if both of the following are true:
1206 ///
1207 /// 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 [cudaErrorLossyQuery](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ad484d9d8e8f269cf93d4c111b646f908).
1208 ///
1209 /// # Parameters
1210 ///
1211 /// - `stream`: The stream to query.
1212 /// - `captureStatus_out`: Location to return the capture status of the stream; required.
1213 /// - `id_out`: Optional location to return an id for the capture sequence, which is unique over the lifetime of the process.
1214 /// - `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 [`cudaStreamEndCapture`]. 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 [`cudaStreamEndCapture`] due to direct actions on the graph do not trigger [cudaErrorStreamCaptureUnjoined](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ace9e4b4b58c1abf9faa1ce8b1079076d).
1215 /// - `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.
1216 /// - `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.
1217 /// - `numDependencies_out`: Optional location to store the size of the array returned in dependencies_out.
1218 pub fn cudaStreamGetCaptureInfo(
1219 stream: cudaStream_t,
1220 captureStatus_out: *mut cudaStreamCaptureStatus,
1221 id_out: *mut ::core::ffi::c_ulonglong,
1222 graph_out: *mut cudaGraph_t,
1223 dependencies_out: *mut *const cudaGraphNode_t,
1224 edgeData_out: *mut *const cudaGraphEdgeData,
1225 numDependencies_out: *mut size_t,
1226 ) -> cudaError_t;
1227}
1228singe_loader::functions! { crate::RUNTIME;
1229 /// Update the set of dependencies in a capturing stream.
1230 ///
1231 /// 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.
1232 ///
1233 /// Valid flags are [`cudaStreamUpdateCaptureDependenciesFlags::cudaStreamAddCaptureDependencies`] and [`cudaStreamUpdateCaptureDependenciesFlags::cudaStreamSetCaptureDependencies`]. 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 [`cudaStreamUpdateCaptureDependenciesFlags::cudaStreamAddCaptureDependencies`].
1234 ///
1235 /// Nodes that are removed from the dependency set via this API do not result in [cudaErrorStreamCaptureUnjoined](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ace9e4b4b58c1abf9faa1ce8b1079076d) if they are unreachable from the stream at [`cudaStreamEndCapture`].
1236 ///
1237 /// Returns [cudaErrorIllegalState](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a0604022302a2ed15d31bc33546b2e963) if the stream is not capturing.
1238 ///
1239 /// # Parameters
1240 ///
1241 /// - `stream`: The stream to update.
1242 /// - `dependencies`: The set of dependencies to add.
1243 /// - `dependencyData`: Optional array of data associated with each dependency.
1244 /// - `numDependencies`: The size of the dependencies array.
1245 /// - `flags`: See above.
1246 pub fn cudaStreamUpdateCaptureDependencies(
1247 stream: cudaStream_t,
1248 dependencies: *mut cudaGraphNode_t,
1249 dependencyData: *const cudaGraphEdgeData,
1250 numDependencies: size_t,
1251 flags: ::core::ffi::c_uint,
1252 ) -> cudaError_t;
1253}
1254singe_loader::functions! { crate::RUNTIME;
1255 /// Creates an event object
1256 ///
1257 /// Creates an event object for the current device using ::cudaEventDefault.
1258 ///
1259 ///
1260 ///
1261 ///
1262 ///
1263 /// # Return value
1264 ///
1265 /// ::cudaSuccess, ::cudaErrorInvalidValue, ::cudaErrorLaunchFailure, ::cudaErrorMemoryAllocation
1266 ///
1267 /// Note: _init_rt
1268 ///
1269 /// Note: _callback
1270 ///
1271 ///
1272 ///
1273 /// See also: `::cudaEventCreate(cudaEvent_t*`, unsigned int) "cudaEventCreate (C++ API)", ::cudaEventCreateWithFlags, ::cudaEventRecord, ::cudaEventQuery, ::cudaEventSynchronize, ::cudaEventDestroy, ::cudaEventElapsedTime, ::cudaStreamWaitEvent, ::cuEventCreate
1274 ///
1275 /// # Parameters
1276 ///
1277 /// - `event`: - Newly created event
1278 pub fn cudaEventCreate(event: *mut cudaEvent_t) -> cudaError_t;
1279}
1280singe_loader::functions! { crate::RUNTIME;
1281 /// Creates an event object with the specified flags.
1282 ///
1283 /// Creates an event object for the current device with the specified flags. Valid flags include.
1284 ///
1285 /// # Parameters
1286 ///
1287 /// - `event`: Newly created event.
1288 /// - `flags`: Flags for new event.
1289 pub fn cudaEventCreateWithFlags(
1290 event: *mut cudaEvent_t,
1291 flags: ::core::ffi::c_uint,
1292 ) -> cudaError_t;
1293}
1294singe_loader::functions! { crate::RUNTIME;
1295 /// Records an event.
1296 ///
1297 /// Captures in `event` the contents of `stream` at the time of this call. `event` and `stream` must be on the same CUDA context. Calls such as [`cudaEventQuery`] or [`cudaStreamWaitEvent`] will then examine or wait for completion of the work that was captured. Uses of `stream` after this call do not modify `event`. See note on default stream behavior for what is captured in the default case.
1298 ///
1299 /// [`cudaEventRecord`] can be called multiple times on the same event and will overwrite the previously captured state. Other APIs such as [`cudaStreamWaitEvent`] use the most recently captured state at the time of the API call, and are not affected by later calls to [`cudaEventRecord`]. Before the first call to [`cudaEventRecord`], an event represents an empty set of work, so for example [`cudaEventQuery`] would return [cudaSuccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ae355f04607d824883b4a50662830d591).
1300 ///
1301 /// # Parameters
1302 ///
1303 /// - `event`: Event to record.
1304 /// - `stream`: Stream in which to record event.
1305 pub fn cudaEventRecord(event: cudaEvent_t, stream: cudaStream_t) -> cudaError_t;
1306}
1307singe_loader::functions! { crate::RUNTIME;
1308 /// Records an event.
1309 ///
1310 /// Captures in `event` the contents of `stream` at the time of this call. `event` and `stream` must be on the same CUDA context. Calls such as [`cudaEventQuery`] or [`cudaStreamWaitEvent`] will then examine or wait for completion of the work that was captured. Uses of `stream` after this call do not modify `event`. See note on default stream behavior for what is captured in the default case.
1311 ///
1312 /// [`cudaEventRecordWithFlags`] can be called multiple times on the same event and will overwrite the previously captured state. Other APIs such as [`cudaStreamWaitEvent`] use the most recently captured state at the time of the API call, and are not affected by later calls to [`cudaEventRecordWithFlags`]. Before the first call to [`cudaEventRecordWithFlags`], an event represents an empty set of work, so for example [`cudaEventQuery`] would return [cudaSuccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ae355f04607d824883b4a50662830d591).
1313 ///
1314 /// flags include.
1315 ///
1316 /// # Parameters
1317 ///
1318 /// - `event`: Event to record.
1319 /// - `stream`: Stream in which to record event.
1320 /// - `flags`: Parameters for the operation(See above).
1321 pub fn cudaEventRecordWithFlags(
1322 event: cudaEvent_t,
1323 stream: cudaStream_t,
1324 flags: ::core::ffi::c_uint,
1325 ) -> cudaError_t;
1326}
1327singe_loader::functions! { crate::RUNTIME;
1328 /// Queries an event’s status.
1329 ///
1330 /// Queries the status of all work currently captured by `event`. See [`cudaEventRecord`] for details on what is captured by an event.
1331 ///
1332 /// Returns [cudaSuccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ae355f04607d824883b4a50662830d591) if all captured work has been completed, or [cudaErrorNotReady](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a285d0c852ab65b8925505e1065563f6d) if any captured work is incomplete.
1333 ///
1334 /// For the purposes of Unified Memory, a return value of [cudaSuccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ae355f04607d824883b4a50662830d591) is equivalent to having called [`cudaEventSynchronize`].
1335 ///
1336 /// # Parameters
1337 ///
1338 /// - `event`: - Event to query
1339 pub fn cudaEventQuery(event: cudaEvent_t) -> cudaError_t;
1340}
1341singe_loader::functions! { crate::RUNTIME;
1342 /// Waits for an event to complete.
1343 ///
1344 /// Waits until the completion of all work currently captured in `event`. See [`cudaEventRecord`] for details on what is captured by an event.
1345 ///
1346 /// Waiting for an event that was created with the [cudaEventBlockingSync](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga26509a522be9d449aa7c8c279612452d) flag will cause the calling CPU thread to block until the event has been completed by the device. If the [cudaEventBlockingSync](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga26509a522be9d449aa7c8c279612452d) flag has not been set, then the CPU thread will busy-wait until the event has been completed by the device.
1347 ///
1348 /// # Parameters
1349 ///
1350 /// - `event`: - Event to wait for
1351 pub fn cudaEventSynchronize(event: cudaEvent_t) -> cudaError_t;
1352}
1353singe_loader::functions! { crate::RUNTIME;
1354 /// Destroys an event object.
1355 ///
1356 /// Destroys the event specified by `event`.
1357 ///
1358 /// An event may be destroyed before it is complete (i.e., while [`cudaEventQuery`] would return [cudaErrorNotReady](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a285d0c852ab65b8925505e1065563f6d)). In this case, the call does not block on completion of the event, and any associated resources will automatically be released asynchronously at completion.
1359 ///
1360 /// # Parameters
1361 ///
1362 /// - `event`: - Event to destroy
1363 pub fn cudaEventDestroy(event: cudaEvent_t) -> cudaError_t;
1364}
1365singe_loader::functions! { crate::RUNTIME;
1366 /// Computes the elapsed time between events.
1367 ///
1368 /// 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 a elapsed time calculation only and polling for completion on the events to be compared should be done with [`cudaEventQuery`] instead.
1369 ///
1370 /// 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 [`cudaEventRecord`] 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.
1371 ///
1372 /// If [`cudaEventRecord`] has not been called on either event, then [cudaErrorInvalidResourceHandle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ac4673247aee4d1ab8d07871f376e0273) is returned. If [`cudaEventRecord`] has been called on both events but one or both of them has not yet been completed (that is, [`cudaEventQuery`] would return [cudaErrorNotReady](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a285d0c852ab65b8925505e1065563f6d) on at least one of the events), [cudaErrorNotReady](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a285d0c852ab65b8925505e1065563f6d) is returned. If either event was created with the [cudaEventDisableTiming](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gaa5d3eff7c3623e2be533968d9cc1ee7e) flag, then this function will return [cudaErrorInvalidResourceHandle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ac4673247aee4d1ab8d07871f376e0273).
1373 ///
1374 /// # Parameters
1375 ///
1376 /// - `ms`: Time between `start` and `end` in ms.
1377 /// - `start`: Starting event.
1378 /// - `end`: Ending event.
1379 pub fn cudaEventElapsedTime(
1380 ms: *mut f32,
1381 start: cudaEvent_t,
1382 end: cudaEvent_t,
1383 ) -> cudaError_t;
1384}
1385singe_loader::functions! { crate::RUNTIME;
1386 /// Imports an external memory object.
1387 ///
1388 /// Imports an externally allocated memory object and returns a handle to that in `extMem_out`.
1389 ///
1390 /// The properties of the handle being imported must be described in `memHandleDesc`. The [`cudaExternalMemoryHandleDesc`] structure is defined as follows:
1391 ///
1392 /// where [cudaExternalMemoryHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryHandleDesc.html#structcudaexternalmemoryhandledesc_1a8d2b65d3b597280eb9be66ee34c7ee52) specifies the type of handle being imported. [`cudaExternalMemoryHandleType`] is defined as:
1393 ///
1394 /// If [cudaExternalMemoryHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryHandleDesc.html#structcudaexternalmemoryhandledesc_1a8d2b65d3b597280eb9be66ee34c7ee52) is [`cudaExternalMemoryHandleType::cudaExternalMemoryHandleTypeOpaqueFd`], then ::cudaExternalMemoryHandleDesc::handle::fd 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.
1395 ///
1396 /// If [cudaExternalMemoryHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryHandleDesc.html#structcudaexternalmemoryhandledesc_1a8d2b65d3b597280eb9be66ee34c7ee52) is [`cudaExternalMemoryHandleType::cudaExternalMemoryHandleTypeOpaqueWin32`], then exactly one of ::cudaExternalMemoryHandleDesc::handle::win32::handle and ::cudaExternalMemoryHandleDesc::handle::win32::name must not be NULL. If ::cudaExternalMemoryHandleDesc::handle::win32::handle 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 ::cudaExternalMemoryHandleDesc::handle::win32::name is not NULL, then it must point to a NULL-terminated array of UTF-16 characters that refers to a memory object.
1397 ///
1398 /// If [cudaExternalMemoryHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryHandleDesc.html#structcudaexternalmemoryhandledesc_1a8d2b65d3b597280eb9be66ee34c7ee52) is [`cudaExternalMemoryHandleType::cudaExternalMemoryHandleTypeOpaqueWin32Kmt`], then ::cudaExternalMemoryHandleDesc::handle::win32::handle must be non-NULL and ::cudaExternalMemoryHandleDesc::handle::win32::name 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.
1399 ///
1400 /// If [cudaExternalMemoryHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryHandleDesc.html#structcudaexternalmemoryhandledesc_1a8d2b65d3b597280eb9be66ee34c7ee52) is [`cudaExternalMemoryHandleType::cudaExternalMemoryHandleTypeD3D12Heap`], then exactly one of ::cudaExternalMemoryHandleDesc::handle::win32::handle and ::cudaExternalMemoryHandleDesc::handle::win32::name must not be NULL. If ::cudaExternalMemoryHandleDesc::handle::win32::handle 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 ::cudaExternalMemoryHandleDesc::handle::win32::name is not NULL, then it must point to a NULL-terminated array of UTF-16 characters that refers to a ID3D12Heap object.
1401 ///
1402 /// If [cudaExternalMemoryHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryHandleDesc.html#structcudaexternalmemoryhandledesc_1a8d2b65d3b597280eb9be66ee34c7ee52) is [`cudaExternalMemoryHandleType::cudaExternalMemoryHandleTypeD3D12Resource`], then exactly one of ::cudaExternalMemoryHandleDesc::handle::win32::handle and ::cudaExternalMemoryHandleDesc::handle::win32::name must not be NULL. If ::cudaExternalMemoryHandleDesc::handle::win32::handle 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 ::cudaExternalMemoryHandleDesc::handle::win32::name is not NULL, then it must point to a NULL-terminated array of UTF-16 characters that refers to a ID3D12Resource object.
1403 ///
1404 /// If [cudaExternalMemoryHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryHandleDesc.html#structcudaexternalmemoryhandledesc_1a8d2b65d3b597280eb9be66ee34c7ee52) is [`cudaExternalMemoryHandleType::cudaExternalMemoryHandleTypeD3D11Resource`]
1405 ///
1406 /// ,then exactly one of ::cudaExternalMemoryHandleDesc::handle::win32::handle and ::cudaExternalMemoryHandleDesc::handle::win32::name must not be NULL. If ::cudaExternalMemoryHandleDesc::handle::win32::handle is
1407 ///
1408 /// not NULL, then it must represent a valid shared NT handle that is
1409 ///
1410 /// If [cudaExternalMemoryHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryHandleDesc.html#structcudaexternalmemoryhandledesc_1a8d2b65d3b597280eb9be66ee34c7ee52) is [`cudaExternalMemoryHandleType::cudaExternalMemoryHandleTypeD3D11ResourceKmt`], then ::cudaExternalMemoryHandleDesc::handle::win32::handle must be non-NULL and ::cudaExternalMemoryHandleDesc::handle::win32::name must be NULL. The handle specified must be a valid shared KMT handle that is returned by IDXGIResource::GetSharedHandle when referring to a ID3D11Resource object.
1411 ///
1412 /// If [cudaExternalMemoryHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryHandleDesc.html#structcudaexternalmemoryhandledesc_1a8d2b65d3b597280eb9be66ee34c7ee52) is [`cudaExternalMemoryHandleType::cudaExternalMemoryHandleTypeNvSciBuf`], then ::cudaExternalMemoryHandleDesc::handle::nvSciBufObject 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 [`cudaWaitExternalSemaphoresAsync`] or [`cudaSignalExternalSemaphoresAsync`] as approprriate barriers to maintain coherence between CUDA and the other drivers. See [cudaExternalSemaphoreWaitSkipNvSciBufMemSync](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga3643166ea40207f6a13f82ebd7b6c2c7) and [cudaExternalSemaphoreSignalSkipNvSciBufMemSync](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga39b71a7aa040658a7a280fcf31eb4a77) for memory synchronization.
1413 ///
1414 /// The size of the memory object must be specified in [cudaExternalMemoryHandleDesc::size](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryHandleDesc.html#structcudaexternalmemoryhandledesc_1a362086a22da90ac8fba1ca294e65548e).
1415 ///
1416 /// Specifying the flag [cudaExternalMemoryDedicated](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gaea2031488a28bcdb7695e9bbaf25e149) in [cudaExternalMemoryHandleDesc::flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryHandleDesc.html#structcudaexternalmemoryhandledesc_1a74412d3d2777ebc856aea0b9158aaafa) 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 [cudaExternalMemoryHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryHandleDesc.html#structcudaexternalmemoryhandledesc_1a8d2b65d3b597280eb9be66ee34c7ee52) is one of the following: [`cudaExternalMemoryHandleType::cudaExternalMemoryHandleTypeD3D12Resource`] [`cudaExternalMemoryHandleType::cudaExternalMemoryHandleTypeD3D11Resource`] [`cudaExternalMemoryHandleType::cudaExternalMemoryHandleTypeD3D11ResourceKmt`].
1417 ///
1418 /// # Parameters
1419 ///
1420 /// - `extMem_out`: Returned handle to an external memory object.
1421 /// - `memHandleDesc`: Memory import handle descriptor.
1422 pub fn cudaImportExternalMemory(
1423 extMem_out: *mut cudaExternalMemory_t,
1424 memHandleDesc: *const cudaExternalMemoryHandleDesc,
1425 ) -> cudaError_t;
1426}
1427singe_loader::functions! { crate::RUNTIME;
1428 /// Maps a buffer onto an imported memory object.
1429 ///
1430 /// Maps a buffer onto an imported memory object and returns a device pointer in `devPtr`.
1431 ///
1432 /// The properties of the buffer being mapped must be described in `bufferDesc`. The [`cudaExternalMemoryBufferDesc`] structure is defined as follows:
1433 ///
1434 /// where [cudaExternalMemoryBufferDesc::offset](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryBufferDesc.html#structcudaexternalmemorybufferdesc_1a034839893ecb4e103f82498888157ba6) is the offset in the memory object where the buffer’s base address is. [cudaExternalMemoryBufferDesc::size](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryBufferDesc.html#structcudaexternalmemorybufferdesc_1a56bdddff67c72329350ed4fa4f2cd746) is the size of the buffer. [cudaExternalMemoryBufferDesc::flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryBufferDesc.html#structcudaexternalmemorybufferdesc_1a0a7888cacfea49ab9b30ae7e9ab47d32) must be zero.
1435 ///
1436 /// 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.
1437 ///
1438 /// The returned pointer `devPtr` must be freed using [`cudaFree`].
1439 ///
1440 /// # Parameters
1441 ///
1442 /// - `devPtr`: Returned device pointer to buffer.
1443 /// - `extMem`: Handle to external memory object.
1444 /// - `bufferDesc`: Buffer descriptor.
1445 pub fn cudaExternalMemoryGetMappedBuffer(
1446 devPtr: *mut *mut ::core::ffi::c_void,
1447 extMem: cudaExternalMemory_t,
1448 bufferDesc: *const cudaExternalMemoryBufferDesc,
1449 ) -> cudaError_t;
1450}
1451singe_loader::functions! { crate::RUNTIME;
1452 /// Maps a CUDA mipmapped array onto an external memory object.
1453 ///
1454 /// Maps a CUDA mipmapped array onto an external object and returns a handle to it in `mipmap`.
1455 ///
1456 /// The properties of the CUDA mipmapped array being mapped must be described in `mipmapDesc`. The structure [`cudaExternalMemoryMipmappedArrayDesc`] is defined as follows:
1457 ///
1458 /// where [cudaExternalMemoryMipmappedArrayDesc::offset](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryMipmappedArrayDesc.html#structcudaexternalmemorymipmappedarraydesc_1a2f9441c3c6e3100f1517ccaf668ffd83) is the offset in the memory object where the base level of the mipmap chain is. [cudaExternalMemoryMipmappedArrayDesc::formatDesc](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryMipmappedArrayDesc.html#structcudaexternalmemorymipmappedarraydesc_1a42333e3049cc4a40213b086be45927e1) describes the format of the data. [cudaExternalMemoryMipmappedArrayDesc::extent](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryMipmappedArrayDesc.html#structcudaexternalmemorymipmappedarraydesc_1acba41d5152a8458ac72a24e65ee0f3ac) specifies the dimensions of the base level of the mipmap chain. [cudaExternalMemoryMipmappedArrayDesc::flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryMipmappedArrayDesc.html#structcudaexternalmemorymipmappedarraydesc_1ade6d5579b7f13034ea82e06012c8758f) are flags associated with CUDA mipmapped arrays. For further details, please refer to the documentation for [`cudaMalloc3DArray`]. Note that if the mipmapped array is bound as a color target in the graphics API, then the flag [cudaArrayColorAttachment](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gafec2b519ab85854efaa40e12f4e34ad3) must be specified in [cudaExternalMemoryMipmappedArrayDesc::flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryMipmappedArrayDesc.html#structcudaexternalmemorymipmappedarraydesc_1ade6d5579b7f13034ea82e06012c8758f). [cudaExternalMemoryMipmappedArrayDesc::numLevels](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalMemoryMipmappedArrayDesc.html#structcudaexternalmemorymipmappedarraydesc_1a4a939b3d6c1fca916dd78679049f36eb) specifies the total number of levels in the mipmap chain.
1459 ///
1460 /// The returned CUDA mipmapped array must be freed using [`cudaFreeMipmappedArray`].
1461 ///
1462 /// # Parameters
1463 ///
1464 /// - `mipmap`: Returned CUDA mipmapped array.
1465 /// - `extMem`: Handle to external memory object.
1466 /// - `mipmapDesc`: CUDA array descriptor.
1467 pub fn cudaExternalMemoryGetMappedMipmappedArray(
1468 mipmap: *mut cudaMipmappedArray_t,
1469 extMem: cudaExternalMemory_t,
1470 mipmapDesc: *const cudaExternalMemoryMipmappedArrayDesc,
1471 ) -> cudaError_t;
1472}
1473singe_loader::functions! { crate::RUNTIME;
1474 /// Destroys an external memory object.
1475 ///
1476 /// 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 [`cudaFree`] and [`cudaFreeMipmappedArray`] respectively.
1477 ///
1478 /// # Parameters
1479 ///
1480 /// - `extMem`: - External memory object to be destroyed
1481 pub fn cudaDestroyExternalMemory(extMem: cudaExternalMemory_t) -> cudaError_t;
1482}
1483singe_loader::functions! { crate::RUNTIME;
1484 /// Imports an external semaphore.
1485 ///
1486 /// Imports an externally allocated synchronization object and returns a handle to that in `extSem_out`.
1487 ///
1488 /// The properties of the handle being imported must be described in `semHandleDesc`. The [`cudaExternalSemaphoreHandleDesc`] is defined as follows:
1489 ///
1490 /// where [cudaExternalSemaphoreHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalSemaphoreHandleDesc.html#structcudaexternalsemaphorehandledesc_1ae925b19e386170fb3cccf58cfab0fd9c) specifies the type of handle being imported. [`cudaExternalSemaphoreHandleType`] is defined as:
1491 ///
1492 /// If [cudaExternalSemaphoreHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalSemaphoreHandleDesc.html#structcudaexternalsemaphorehandledesc_1ae925b19e386170fb3cccf58cfab0fd9c) is [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeOpaqueFd`], then ::cudaExternalSemaphoreHandleDesc::handle::fd 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.
1493 ///
1494 /// If [cudaExternalSemaphoreHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalSemaphoreHandleDesc.html#structcudaexternalsemaphorehandledesc_1ae925b19e386170fb3cccf58cfab0fd9c) is [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeOpaqueWin32`], then exactly one of ::cudaExternalSemaphoreHandleDesc::handle::win32::handle and ::cudaExternalSemaphoreHandleDesc::handle::win32::name must not be NULL. If ::cudaExternalSemaphoreHandleDesc::handle::win32::handle 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 ::cudaExternalSemaphoreHandleDesc::handle::win32::name is not NULL, then it must name a valid synchronization object.
1495 ///
1496 /// If [cudaExternalSemaphoreHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalSemaphoreHandleDesc.html#structcudaexternalsemaphorehandledesc_1ae925b19e386170fb3cccf58cfab0fd9c) is [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt`], then ::cudaExternalSemaphoreHandleDesc::handle::win32::handle must be non-NULL and ::cudaExternalSemaphoreHandleDesc::handle::win32::name 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.
1497 ///
1498 /// If [cudaExternalSemaphoreHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalSemaphoreHandleDesc.html#structcudaexternalsemaphorehandledesc_1ae925b19e386170fb3cccf58cfab0fd9c) is [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeD3D12Fence`], then exactly one of ::cudaExternalSemaphoreHandleDesc::handle::win32::handle and ::cudaExternalSemaphoreHandleDesc::handle::win32::name must not be NULL. If ::cudaExternalSemaphoreHandleDesc::handle::win32::handle 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 ::cudaExternalSemaphoreHandleDesc::handle::win32::name is not NULL, then it must name a valid synchronization object that refers to a valid ID3D12Fence object.
1499 ///
1500 /// If [cudaExternalSemaphoreHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalSemaphoreHandleDesc.html#structcudaexternalsemaphorehandledesc_1ae925b19e386170fb3cccf58cfab0fd9c) is [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeD3D11Fence`], then exactly one of ::cudaExternalSemaphoreHandleDesc::handle::win32::handle and ::cudaExternalSemaphoreHandleDesc::handle::win32::name must not be NULL. If ::cudaExternalSemaphoreHandleDesc::handle::win32::handle is not NULL, then it must represent a valid shared NT handle that is returned by ID3D11Fence::CreateSharedHandle. If ::cudaExternalSemaphoreHandleDesc::handle::win32::name is not NULL, then it must name a valid synchronization object that refers to a valid ID3D11Fence object.
1501 ///
1502 /// If [cudaExternalSemaphoreHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalSemaphoreHandleDesc.html#structcudaexternalsemaphorehandledesc_1ae925b19e386170fb3cccf58cfab0fd9c) is [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeNvSciSync`], then ::cudaExternalSemaphoreHandleDesc::handle::nvSciSyncObj represents a valid NvSciSyncObj.
1503 ///
1504 /// [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeKeyedMutex`], then exactly one of ::cudaExternalSemaphoreHandleDesc::handle::win32::handle and ::cudaExternalSemaphoreHandleDesc::handle::win32::name must not be NULL. If ::cudaExternalSemaphoreHandleDesc::handle::win32::handle is not NULL, then it represent a valid shared NT handle that is returned by IDXGIResource1::CreateSharedHandle when referring to a IDXGIKeyedMutex object.
1505 ///
1506 /// If [cudaExternalSemaphoreHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalSemaphoreHandleDesc.html#structcudaexternalsemaphorehandledesc_1ae925b19e386170fb3cccf58cfab0fd9c) is [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeKeyedMutexKmt`], then ::cudaExternalSemaphoreHandleDesc::handle::win32::handle must be non-NULL and ::cudaExternalSemaphoreHandleDesc::handle::win32::name must be NULL. The handle specified must represent a valid KMT handle that is returned by IDXGIResource::GetSharedHandle when referring to a IDXGIKeyedMutex object.
1507 ///
1508 /// If [cudaExternalSemaphoreHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalSemaphoreHandleDesc.html#structcudaexternalsemaphorehandledesc_1ae925b19e386170fb3cccf58cfab0fd9c) is [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd`], then ::cudaExternalSemaphoreHandleDesc::handle::fd 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.
1509 ///
1510 /// If [cudaExternalSemaphoreHandleDesc::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaExternalSemaphoreHandleDesc.html#structcudaexternalsemaphorehandledesc_1ae925b19e386170fb3cccf58cfab0fd9c) is [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32`], then exactly one of ::cudaExternalSemaphoreHandleDesc::handle::win32::handle and ::cudaExternalSemaphoreHandleDesc::handle::win32::name must not be NULL. If ::cudaExternalSemaphoreHandleDesc::handle::win32::handle 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 ::cudaExternalSemaphoreHandleDesc::handle::win32::name is not NULL, then it must name a valid synchronization object.
1511 ///
1512 /// # Parameters
1513 ///
1514 /// - `extSem_out`: Returned handle to an external semaphore.
1515 /// - `semHandleDesc`: Semaphore import handle descriptor.
1516 pub fn cudaImportExternalSemaphore(
1517 extSem_out: *mut cudaExternalSemaphore_t,
1518 semHandleDesc: *const cudaExternalSemaphoreHandleDesc,
1519 ) -> cudaError_t;
1520}
1521singe_loader::functions! { crate::RUNTIME;
1522 /// Signals a set of external semaphore objects.
1523 ///
1524 /// 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.
1525 ///
1526 /// The exact semantics of signaling a semaphore depends on the type of the object.
1527 ///
1528 /// If the semaphore object is any one of the following types: [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeOpaqueFd`], [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeOpaqueWin32`], [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt`] then signaling the semaphore will set it to the signaled state.
1529 ///
1530 /// If the semaphore object is any one of the following types: [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeD3D12Fence`], [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeD3D11Fence`], [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd`], [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32`] then the semaphore will be set to the value specified in ::cudaExternalSemaphoreSignalParams::params::fence::value.
1531 ///
1532 /// If the semaphore object is of the type [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeNvSciSync`] this API sets ::cudaExternalSemaphoreSignalParams::params::nvSciSync::fence 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 ::cudaExternalSemaphoreSignalParams::params::nvSciSync::fence. By default, signaling such an external semaphore object causes appropriate memory synchronization operations to be performed over all the external memory objects that are imported as [`cudaExternalMemoryHandleType::cudaExternalMemoryHandleTypeNvSciBuf`]. 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 [cudaExternalSemaphoreSignalSkipNvSciBufMemSync](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga39b71a7aa040658a7a280fcf31eb4a77), 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 [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeNvSciSync`], if the NvSciSyncAttrList used to create the NvSciSyncObj had not set the flags in [`cudaDeviceGetNvSciSyncAttributes`] to cudaNvSciSyncAttrSignal, this API will return cudaErrorNotSupported.
1533 ///
1534 /// ::cudaExternalSemaphoreSignalParams::params::nvSciSync::fence associated with semaphore object of the type [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeNvSciSync`] 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. ::cudaExternalSemaphoreSignalParams::params::nvSciSync::fence associated with semaphore object of the type [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeNvSciSync`] 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.
1535 ///
1536 /// If the semaphore object is any one of the following types: [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeKeyedMutex`], [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeKeyedMutexKmt`], then the keyed mutex will be released with the key specified in ::cudaExternalSemaphoreSignalParams::params::keyedmutex::key.
1537 ///
1538 /// # Parameters
1539 ///
1540 /// - `extSemArray`: Set of external semaphores to be signaled.
1541 /// - `paramsArray`: Array of semaphore parameters.
1542 /// - `numExtSems`: Number of semaphores to signal.
1543 /// - `stream`: Stream to enqueue the signal operations in.
1544 pub fn cudaSignalExternalSemaphoresAsync(
1545 extSemArray: *const cudaExternalSemaphore_t,
1546 paramsArray: *const cudaExternalSemaphoreSignalParams,
1547 numExtSems: ::core::ffi::c_uint,
1548 stream: cudaStream_t,
1549 ) -> cudaError_t;
1550}
1551singe_loader::functions! { crate::RUNTIME;
1552 /// Waits on a set of external semaphore objects.
1553 ///
1554 /// 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.
1555 ///
1556 /// The exact semantics of waiting on a semaphore depends on the type of the object.
1557 ///
1558 /// If the semaphore object is any one of the following types: [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeOpaqueFd`], [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeOpaqueWin32`], [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt`] 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.
1559 ///
1560 /// If the semaphore object is any one of the following types: [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeD3D12Fence`], [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeD3D11Fence`], [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd`], [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32`] then waiting on the semaphore will wait until the value of the semaphore is greater than or equal to ::cudaExternalSemaphoreWaitParams::params::fence::value.
1561 ///
1562 /// If the semaphore object is of the type [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeNvSciSync`] then, waiting on the semaphore will wait until the ::cudaExternalSemaphoreSignalParams::params::nvSciSync::fence 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 [`cudaExternalMemoryHandleType::cudaExternalMemoryHandleTypeNvSciBuf`]. 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 [cudaExternalSemaphoreWaitSkipNvSciBufMemSync](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga3643166ea40207f6a13f82ebd7b6c2c7), 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 [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeNvSciSync`], if the NvSciSyncAttrList used to create the NvSciSyncObj had not set the flags in [`cudaDeviceGetNvSciSyncAttributes`] to cudaNvSciSyncAttrWait, this API will return cudaErrorNotSupported.
1563 ///
1564 /// If the semaphore object is any one of the following types: [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeKeyedMutex`], [`cudaExternalSemaphoreHandleType::cudaExternalSemaphoreHandleTypeKeyedMutexKmt`], then the keyed mutex will be acquired when it is released with the key specified in ::cudaExternalSemaphoreSignalParams::params::keyedmutex::key or until the timeout specified by ::cudaExternalSemaphoreSignalParams::params::keyedmutex::timeoutMs 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.
1565 ///
1566 /// # Parameters
1567 ///
1568 /// - `extSemArray`: External semaphores to be waited on.
1569 /// - `paramsArray`: Array of semaphore parameters.
1570 /// - `numExtSems`: Number of semaphores to wait on.
1571 /// - `stream`: Stream to enqueue the wait operations in.
1572 pub fn cudaWaitExternalSemaphoresAsync(
1573 extSemArray: *const cudaExternalSemaphore_t,
1574 paramsArray: *const cudaExternalSemaphoreWaitParams,
1575 numExtSems: ::core::ffi::c_uint,
1576 stream: cudaStream_t,
1577 ) -> cudaError_t;
1578}
1579singe_loader::functions! { crate::RUNTIME;
1580 /// Destroys an external semaphore.
1581 ///
1582 /// 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.
1583 ///
1584 /// # Parameters
1585 ///
1586 /// - `extSem`: - External semaphore to be destroyed
1587 pub fn cudaDestroyExternalSemaphore(extSem: cudaExternalSemaphore_t) -> cudaError_t;
1588}
1589singe_loader::functions! { crate::RUNTIME;
1590 /// Launches a device function.
1591 ///
1592 /// The function invokes kernel `func` on `gridDim` (`gridDim.x ``gridDim.y ``gridDim.z`) grid of blocks. Each block contains `blockDim` (`blockDim.x ``blockDim.y ``blockDim.z`) threads.
1593 ///
1594 /// If the kernel has N parameters the `args` should point to array of N pointers. Each pointer, from `args\[0\]` to `args\[N - 1\]`, point to the region of memory from which the actual parameter will be copied.
1595 ///
1596 /// For templated functions, pass the function symbol as follows: func_name<template_arg_0,…,template_arg_N>
1597 ///
1598 /// `sharedMem` sets the amount of dynamic shared memory that will be available to each thread block.
1599 ///
1600 /// `stream` specifies a stream the invocation is associated to.
1601 ///
1602 /// # Parameters
1603 ///
1604 /// - `func`: Device function symbol.
1605 /// - `gridDim`: Grid dimentions.
1606 /// - `blockDim`: Block dimentions.
1607 /// - `args`: Arguments.
1608 /// - `sharedMem`: Shared memory.
1609 /// - `stream`: Stream identifier.
1610 pub fn cudaLaunchKernel(
1611 func: *const ::core::ffi::c_void,
1612 gridDim: dim3,
1613 blockDim: dim3,
1614 args: *mut *mut ::core::ffi::c_void,
1615 sharedMem: size_t,
1616 stream: cudaStream_t,
1617 ) -> cudaError_t;
1618}
1619singe_loader::functions! { crate::RUNTIME;
1620 /// Launches a CUDA function with launch-time configuration.
1621 ///
1622 /// Note that the functionally equivalent variadic template [cudaLaunchKernelEx](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__HIGHLEVEL.html#group__cudart__highlevel_1ga7d9168c86a4293639c75ea437465ed53) is available for C++11 and newer.
1623 ///
1624 /// Invokes the kernel `func` on `config->gridDim` (`config->gridDim.x ``config->gridDim.y ``config->gridDim.z`) grid of blocks. Each block contains `config->blockDim` (`config->blockDim.x ``config->blockDim.y ``config->blockDim.z`) threads.
1625 ///
1626 /// `config->dynamicSmemBytes` sets the amount of dynamic shared memory that will be available to each thread block.
1627 ///
1628 /// `config->stream` specifies a stream the invocation is associated to.
1629 ///
1630 /// Configuration beyond grid and block dimensions, dynamic shared memory size, and stream can be provided with the following two fields of `config:`
1631 ///
1632 /// `config->attrs` is an array of `config->numAttrs` contiguous [cudaLaunchAttribute](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaLaunchAttribute.html#structcudalaunchattribute) elements. The value of this pointer is not considered if `config->numAttrs` is zero. However, in that case, it is recommended to set the pointer to NULL. `config->numAttrs` is the number of attributes populating the first `config->numAttrs` positions of the `config->attrs` array.
1633 ///
1634 /// If the kernel has N parameters the `args` should point to array of N pointers. Each pointer, from `args\[0\]` to `args\[N - 1\]`, point to the region of memory from which the actual parameter will be copied.
1635 ///
1636 /// N.B. This function is so named to avoid unintentionally invoking the templated version, `cudaLaunchKernelEx`, for kernels taking a single void\*\* or void\* parameter.
1637 ///
1638 /// # Parameters
1639 ///
1640 /// - `config`: Launch configuration.
1641 /// - `func`: Kernel to launch.
1642 /// - `args`: Array of pointers to kernel parameters.
1643 pub fn cudaLaunchKernelExC(
1644 config: *const cudaLaunchConfig_t,
1645 func: *const ::core::ffi::c_void,
1646 args: *mut *mut ::core::ffi::c_void,
1647 ) -> cudaError_t;
1648}
1649singe_loader::functions! { crate::RUNTIME;
1650 /// Launches a device function where thread blocks can cooperate and synchronize as they execute.
1651 ///
1652 /// The function invokes kernel `func` on `gridDim` (`gridDim.x ``gridDim.y ``gridDim.z`) grid of blocks. Each block contains `blockDim` (`blockDim.x ``blockDim.y ``blockDim.z`) threads.
1653 ///
1654 /// The device on which this kernel is invoked must have a non-zero value for the device attribute [cudaDevAttrCooperativeLaunch](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cda108260813c2eb395a60d4acf08c97595).
1655 ///
1656 /// The total number of blocks launched cannot exceed the maximum number of blocks per multiprocessor as returned by [`cudaOccupancyMaxActiveBlocksPerMultiprocessor`] (or [`cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags`]) times the number of multiprocessors as specified by the device attribute [cudaDevAttrMultiProcessorCount](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cda74de9ed281f917c8e4ef272da09f338a).
1657 ///
1658 /// The kernel cannot make use of CUDA dynamic parallelism.
1659 ///
1660 /// If the kernel has N parameters the `args` should point to array of N pointers. Each pointer, from `args\[0\]` to `args\[N - 1\]`, point to the region of memory from which the actual parameter will be copied.
1661 ///
1662 /// For templated functions, pass the function symbol as follows: func_name<template_arg_0,…,template_arg_N>
1663 ///
1664 /// `sharedMem` sets the amount of dynamic shared memory that will be available to each thread block.
1665 ///
1666 /// `stream` specifies a stream the invocation is associated to.
1667 ///
1668 /// # Parameters
1669 ///
1670 /// - `func`: Device function symbol.
1671 /// - `gridDim`: Grid dimentions.
1672 /// - `blockDim`: Block dimentions.
1673 /// - `args`: Arguments.
1674 /// - `sharedMem`: Shared memory.
1675 /// - `stream`: Stream identifier.
1676 pub fn cudaLaunchCooperativeKernel(
1677 func: *const ::core::ffi::c_void,
1678 gridDim: dim3,
1679 blockDim: dim3,
1680 args: *mut *mut ::core::ffi::c_void,
1681 sharedMem: size_t,
1682 stream: cudaStream_t,
1683 ) -> cudaError_t;
1684}
1685singe_loader::functions! { crate::RUNTIME;
1686 /// Sets the preferred cache configuration for a device function.
1687 ///
1688 /// On devices where the L1 cache and shared memory use the same hardware resources, this sets through `cacheConfig` the preferred cache configuration for the function specified via `func`. This is only a preference. The runtime will use the requested configuration if possible, but it is free to choose a different configuration if required to execute `func`.
1689 ///
1690 /// `func` is a device function symbol and must be declared as a `__global__` function. If the specified function does not exist, then [cudaErrorInvalidDeviceFunction](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ab6af535e7e53d3f21e2437e8977b8c2e) is returned. For templated functions, pass the function symbol as follows: func_name<template_arg_0,…,template_arg_N>
1691 ///
1692 /// This setting does nothing on devices where the size of the L1 cache and shared memory are fixed.
1693 ///
1694 /// Launching a kernel with a different preference than the most recent preference setting may insert a device-side synchronization point.
1695 ///
1696 /// The supported cache configurations are.
1697 ///
1698 /// # Parameters
1699 ///
1700 /// - `func`: Device function symbol.
1701 /// - `cacheConfig`: Requested cache configuration.
1702 pub fn cudaFuncSetCacheConfig(
1703 func: *const ::core::ffi::c_void,
1704 cacheConfig: cudaFuncCache,
1705 ) -> cudaError_t;
1706}
1707singe_loader::functions! { crate::RUNTIME;
1708 /// Find out attributes for a given function.
1709 ///
1710 /// This function obtains the attributes of a function specified via `func`. `func` is a device function symbol and must be declared as a `__global__` function. The fetched attributes are placed in `attr`. If the specified function does not exist, then it is assumed to be a [cudaKernel_t](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga0b33f204b307b3154aa4f005a3c8a46a) and used as is. For templated functions, pass the function symbol as follows: func_name<template_arg_0,…,template_arg_N>
1711 ///
1712 /// Note that some function attributes such as [maxThreadsPerBlock](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaFuncAttributes.html#structcudafuncattributes_1ab8350f491105f159ff684f5c59167af0) may vary based on the device that is currently being used.
1713 ///
1714 /// # Parameters
1715 ///
1716 /// - `attr`: Return pointer to function’s attributes.
1717 /// - `func`: Device function symbol.
1718 pub fn cudaFuncGetAttributes(
1719 attr: *mut cudaFuncAttributes,
1720 func: *const ::core::ffi::c_void,
1721 ) -> cudaError_t;
1722}
1723singe_loader::functions! { crate::RUNTIME;
1724 /// Set attributes for a given function.
1725 ///
1726 /// This function sets the attributes of a function specified via `func`. The parameter `func` must be a pointer to a function that executes on the device. The parameter specified by `func` must be declared as a `__global__` function. The enumeration defined by `attr` is set to the value defined by `value`. If the specified function does not exist, then it is assumed to be a [cudaKernel_t](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga0b33f204b307b3154aa4f005a3c8a46a) and used as is. If the specified attribute cannot be written, or if the value is incorrect, then [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) is returned.
1727 ///
1728 /// Valid values for `attr` are:
1729 ///
1730 /// cudaLaunchKernel (C++ API), [cudaFuncSetCacheConfig (C++ API)](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__HIGHLEVEL.html#group__cudart__highlevel_1ga981c8d74d33b21e7fd57609b7337653e), [cudaFuncGetAttributes (C API)](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__EXECUTION.html#group__cudart__execution_1gace91ab5ae929d84d16860e4d1a189754),.
1731 ///
1732 /// # Parameters
1733 ///
1734 /// - `func`: Function to get attributes of.
1735 /// - `attr`: Attribute to set.
1736 /// - `value`: Value to set.
1737 pub fn cudaFuncSetAttribute(
1738 func: *const ::core::ffi::c_void,
1739 attr: cudaFuncAttribute,
1740 value: ::core::ffi::c_int,
1741 ) -> cudaError_t;
1742}
1743singe_loader::functions! { crate::RUNTIME;
1744 /// Returns the function name for a device entry function pointer.
1745 ///
1746 /// Returns in `**name` the function name associated with the symbol `func`. The function name is returned as a null-terminated string. This API may return a mangled name if the function is not declared as having C linkage. If `**name` is NULL, [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) is returned. If `func` is not a device entry function, then it is assumed to be a [cudaKernel_t](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga0b33f204b307b3154aa4f005a3c8a46a) and used as is.
1747 ///
1748 /// cudaFuncGetName (C++ API).
1749 ///
1750 /// # Parameters
1751 ///
1752 /// - `name`: The returned name of the function.
1753 /// - `func`: The function pointer to retrieve name for.
1754 pub fn cudaFuncGetName(
1755 name: *mut *const ::core::ffi::c_char,
1756 func: *const ::core::ffi::c_void,
1757 ) -> cudaError_t;
1758}
1759singe_loader::functions! { crate::RUNTIME;
1760 /// Returns the offset and size of a kernel parameter in the device-side parameter layout.
1761 ///
1762 /// Queries the kernel parameter at `paramIndex` in `func's` list of parameters and returns parameter information via `paramOffset` and `paramSize`. `paramOffset` returns the offset of the parameter in the device-side parameter layout. `paramSize` returns the size in bytes of the parameter. This information can be used to update kernel node parameters from the device via [cudaGraphKernelNodeSetParam()](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__GRAPH.html#group__cudart__graph_1ga9171bc40a4f9be650b3fe867e8bfb549) and [cudaGraphKernelNodeUpdatesApply()](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__GRAPH.html#group__cudart__graph_1ga2d558cf37c9616365c67447e61ac0d6a). `paramIndex` must be less than the number of parameters that `func` takes.
1763 ///
1764 /// # Parameters
1765 ///
1766 /// - `func`: The function to query.
1767 /// - `paramIndex`: The parameter index to query.
1768 /// - `paramOffset`: The offset into the device-side parameter layout at which the parameter resides.
1769 /// - `paramSize`: The size of the parameter in the device-side parameter layout.
1770 pub fn cudaFuncGetParamInfo(
1771 func: *const ::core::ffi::c_void,
1772 paramIndex: size_t,
1773 paramOffset: *mut size_t,
1774 paramSize: *mut size_t,
1775 ) -> cudaError_t;
1776}
1777singe_loader::functions! { crate::RUNTIME;
1778 /// Returns the number of parameters used by the function.
1779 ///
1780 /// Queries the number of kernel parameters used by `func` and returns it in `paramCount`.
1781 ///
1782 /// # Parameters
1783 ///
1784 /// - `func`: The function to query.
1785 /// - `paramCount`: Returns the number of parameters used by the function.
1786 pub fn cudaFuncGetParamCount(
1787 func: *const ::core::ffi::c_void,
1788 paramCount: *mut size_t,
1789 ) -> cudaError_t;
1790}
1791singe_loader::functions! { crate::RUNTIME;
1792 /// Enqueues a host function call in a stream.
1793 ///
1794 /// 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.
1795 ///
1796 /// The host function must not make any CUDA API calls. Attempting to use a CUDA API may result in [cudaErrorNotPermitted](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a67b6095ab719b21659a400b553963eb3), 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.
1797 ///
1798 /// For the purposes of Unified Memory, execution makes a number of guarantees:
1799 ///
1800 /// Note that, in constrast to ::cuStreamAddCallback, the function will not be called in the event of an error in the CUDA context.
1801 ///
1802 /// # Parameters
1803 ///
1804 /// - `stream`: Stream to enqueue function call in.
1805 /// - `fn_`: The function to call once preceding stream operations are complete.
1806 /// - `userData`: User-specified data to be passed to the function.
1807 pub fn cudaLaunchHostFunc(
1808 stream: cudaStream_t,
1809 fn_: cudaHostFn_t,
1810 userData: *mut ::core::ffi::c_void,
1811 ) -> cudaError_t;
1812}
1813singe_loader::functions! { crate::RUNTIME;
1814 /// Enqueues a host function call in a stream.
1815 ///
1816 /// 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.
1817 ///
1818 /// The host function must not make any CUDA API calls. Attempting to use a CUDA API may result in [cudaErrorNotPermitted](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a67b6095ab719b21659a400b553963eb3), 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.
1819 ///
1820 /// For the purposes of Unified Memory, execution makes a number of guarantees:
1821 ///
1822 /// Note that, in constrast to ::cuStreamAddCallback, the function will not be called in the event of an error in the CUDA context.
1823 ///
1824 /// # Parameters
1825 ///
1826 /// - `stream`: Stream to enqueue function call in.
1827 /// - `fn_`: The function to call once preceding stream operations are complete.
1828 /// - `userData`: User-specified data to be passed to the function.
1829 /// - `syncMode`: Sync mode for the host function.
1830 pub fn cudaLaunchHostFunc_v2(
1831 stream: cudaStream_t,
1832 fn_: cudaHostFn_t,
1833 userData: *mut ::core::ffi::c_void,
1834 syncMode: ::core::ffi::c_uint,
1835 ) -> cudaError_t;
1836}
1837singe_loader::functions! { crate::RUNTIME;
1838 /// Sets the shared memory configuration for a device function.
1839 ///
1840 /// 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.
1841 ///
1842 /// Any per-function setting of shared memory bank size set via [`cudaFuncSetSharedMemConfig`] will override the device wide setting set by [`cudaDeviceSetSharedMemConfig`].
1843 ///
1844 /// 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.
1845 ///
1846 /// This function will do nothing on devices with fixed shared memory bank size.
1847 ///
1848 /// For templated functions, pass the function symbol as follows: func_name<template_arg_0,…,template_arg_N>
1849 ///
1850 /// The supported bank configurations are.
1851 ///
1852 /// # Parameters
1853 ///
1854 /// - `func`: Device function symbol.
1855 /// - `config`: Requested shared memory configuration.
1856 #[deprecated]
1857 pub fn cudaFuncSetSharedMemConfig(
1858 func: *const ::core::ffi::c_void,
1859 config: cudaSharedMemConfig,
1860 ) -> cudaError_t;
1861}
1862singe_loader::functions! { crate::RUNTIME;
1863 /// Returns occupancy for a device function.
1864 ///
1865 /// Returns in `*numBlocks` the maximum number of active blocks per streaming multiprocessor for the device function.
1866 ///
1867 /// # Parameters
1868 ///
1869 /// - `numBlocks`: Returned occupancy.
1870 /// - `func`: Kernel function for which occupancy is calculated.
1871 /// - `blockSize`: Block size the kernel is intended to be launched with.
1872 /// - `dynamicSMemSize`: Per-block dynamic shared memory usage intended, in bytes.
1873 pub fn cudaOccupancyMaxActiveBlocksPerMultiprocessor(
1874 numBlocks: *mut ::core::ffi::c_int,
1875 func: *const ::core::ffi::c_void,
1876 blockSize: ::core::ffi::c_int,
1877 dynamicSMemSize: size_t,
1878 ) -> cudaError_t;
1879}
1880singe_loader::functions! { crate::RUNTIME;
1881 /// Returns dynamic shared memory available per block when launching `numBlocks` blocks on SM.
1882 ///
1883 /// Returns in `*dynamicSmemSize` the maximum size of dynamic shared memory to allow `numBlocks` blocks per SM.
1884 ///
1885 /// # Parameters
1886 ///
1887 /// - `dynamicSmemSize`: Returned maximum dynamic shared memory.
1888 /// - `func`: Kernel function for which occupancy is calculated.
1889 /// - `numBlocks`: Number of blocks to fit on SM.
1890 /// - `blockSize`: Size of the block.
1891 pub fn cudaOccupancyAvailableDynamicSMemPerBlock(
1892 dynamicSmemSize: *mut size_t,
1893 func: *const ::core::ffi::c_void,
1894 numBlocks: ::core::ffi::c_int,
1895 blockSize: ::core::ffi::c_int,
1896 ) -> cudaError_t;
1897}
1898singe_loader::functions! { crate::RUNTIME;
1899 /// Returns occupancy for a device function with the specified flags.
1900 ///
1901 /// Returns in `*numBlocks` the maximum number of active blocks per streaming multiprocessor for the device function.
1902 ///
1903 /// The `flags` parameter controls how special cases are handled. Valid flags include.
1904 ///
1905 /// # Parameters
1906 ///
1907 /// - `numBlocks`: Returned occupancy.
1908 /// - `func`: Kernel function for which occupancy is calculated.
1909 /// - `blockSize`: Block size the kernel is intended to be launched with.
1910 /// - `dynamicSMemSize`: Per-block dynamic shared memory usage intended, in bytes.
1911 /// - `flags`: Requested behavior for the occupancy calculator.
1912 pub fn cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
1913 numBlocks: *mut ::core::ffi::c_int,
1914 func: *const ::core::ffi::c_void,
1915 blockSize: ::core::ffi::c_int,
1916 dynamicSMemSize: size_t,
1917 flags: ::core::ffi::c_uint,
1918 ) -> cudaError_t;
1919}
1920singe_loader::functions! { crate::RUNTIME;
1921 /// Given the kernel function (`func`) and launch configuration (`config`), return the maximum cluster size in `*clusterSize`.
1922 ///
1923 /// The cluster dimensions in `config` are ignored. If func has a required cluster size set (see [`cudaFuncGetAttributes`]),`*clusterSize` will reflect the required cluster size.
1924 ///
1925 /// 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.
1926 ///
1927 /// This function will respect the compile time launch bounds.
1928 ///
1929 /// # Parameters
1930 ///
1931 /// - `clusterSize`: Returned maximum cluster size that can be launched for the given kernel function and launch configuration.
1932 /// - `func`: Kernel function for which maximum cluster size is calculated.
1933 pub fn cudaOccupancyMaxPotentialClusterSize(
1934 clusterSize: *mut ::core::ffi::c_int,
1935 func: *const ::core::ffi::c_void,
1936 launchConfig: *const cudaLaunchConfig_t,
1937 ) -> cudaError_t;
1938}
1939singe_loader::functions! { crate::RUNTIME;
1940 /// 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`.
1941 ///
1942 /// If the function has required cluster size already set (see [`cudaFuncGetAttributes`]), 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.
1943 ///
1944 /// 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.
1945 ///
1946 /// # Parameters
1947 ///
1948 /// - `numClusters`: Returned maximum number of clusters that could co-exist on the target device.
1949 /// - `func`: Kernel function for which maximum number of clusters are calculated.
1950 pub fn cudaOccupancyMaxActiveClusters(
1951 numClusters: *mut ::core::ffi::c_int,
1952 func: *const ::core::ffi::c_void,
1953 launchConfig: *const cudaLaunchConfig_t,
1954 ) -> cudaError_t;
1955}
1956singe_loader::functions! { crate::RUNTIME;
1957 /// Allocates memory that will be automatically managed by the Unified Memory system.
1958 ///
1959 /// Allocates `size` bytes of managed memory on the device and returns in `*devPtr` a pointer to the allocated memory. If the device doesn’t support allocating managed memory, [cudaErrorNotSupported](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ad846fd9f2e8ba5e2fb4f1695b7ab6164) is returned. Support for managed memory can be queried using the device attribute [cudaDevAttrManagedMemory](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cda5467985f87821a03625ab62e72195ff8). The allocated memory is suitably aligned for any kind of variable. The memory is not cleared. If `size` is 0, [`cudaMallocManaged`] returns [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c). 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.
1960 ///
1961 /// `flags` specifies the default stream association for this allocation. `flags` must be one of [cudaMemAttachGlobal](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4808e47eba73eb94622ec70a9f9b91ff) or [cudaMemAttachHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4f9a428d18fdd89a99441d0dd27131c0). The default value for `flags` is [cudaMemAttachGlobal](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4808e47eba73eb94622ec70a9f9b91ff). If [cudaMemAttachGlobal](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4808e47eba73eb94622ec70a9f9b91ff) is specified, then this memory is accessible from any stream on any device. If [cudaMemAttachHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4f9a428d18fdd89a99441d0dd27131c0) is specified, then the allocation should not be accessed from devices that have a zero value for the device attribute [cudaDevAttrConcurrentManagedAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdac88178f29891f2c18fe67361cc80de09); an explicit call to [`cudaStreamAttachMemAsync`] will be required to enable access on such devices.
1962 ///
1963 /// If the association is later changed via [`cudaStreamAttachMemAsync`] to a single stream, the default association, as specifed during [`cudaMallocManaged`], is restored when that stream is destroyed. For **managed** variables, the default association is always [cudaMemAttachGlobal](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4808e47eba73eb94622ec70a9f9b91ff). 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.
1964 ///
1965 /// Memory allocated with [`cudaMallocManaged`] should be released with [`cudaFree`].
1966 ///
1967 /// Device memory oversubscription is possible for GPUs that have a non-zero value for the device attribute [cudaDevAttrConcurrentManagedAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdac88178f29891f2c18fe67361cc80de09). 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.
1968 ///
1969 /// In a system where all GPUs have a non-zero value for the device attribute [cudaDevAttrConcurrentManagedAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdac88178f29891f2c18fe67361cc80de09), 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 [`cudaMemAdvise`]. The application can also explicitly migrate memory to a desired processor’s memory via [`cudaMemPrefetchAsync`].
1970 ///
1971 /// In a multi-GPU system where all of the GPUs have a zero value for the device attribute [cudaDevAttrConcurrentManagedAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdac88178f29891f2c18fe67361cc80de09) 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 [`cudaMallocManaged`] 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.
1972 ///
1973 /// 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 [cudaDevAttrConcurrentManagedAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdac88178f29891f2c18fe67361cc80de09) is zero for at least one of those GPUs, the location chosen for physical storage of managed memory is system-dependent.
1974 ///
1975 /// # Parameters
1976 ///
1977 /// - `devPtr`: Pointer to allocated device memory.
1978 /// - `size`: Requested allocation size in bytes.
1979 /// - `flags`: Must be either [cudaMemAttachGlobal](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4808e47eba73eb94622ec70a9f9b91ff) or [cudaMemAttachHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4f9a428d18fdd89a99441d0dd27131c0) (defaults to [cudaMemAttachGlobal](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga4808e47eba73eb94622ec70a9f9b91ff)).
1980 pub fn cudaMallocManaged(
1981 devPtr: *mut *mut ::core::ffi::c_void,
1982 size: size_t,
1983 flags: ::core::ffi::c_uint,
1984 ) -> cudaError_t;
1985}
1986singe_loader::functions! { crate::RUNTIME;
1987 /// Allocate memory on the device.
1988 ///
1989 /// Allocates `size` bytes of linear memory on the device and returns in `*devPtr` a pointer to the allocated memory. The allocated memory is suitably aligned for any kind of variable. The memory is not cleared. [`cudaMalloc`] returns [cudaErrorMemoryAllocation](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038af210f50ae7f17f655e0504929606add9) in case of failure.
1990 ///
1991 /// The device version of [`cudaFree`] cannot be used with a `*devPtr` allocated using the host API, and vice versa.
1992 ///
1993 /// # Parameters
1994 ///
1995 /// - `devPtr`: Pointer to allocated device memory.
1996 /// - `size`: Requested allocation size in bytes.
1997 pub fn cudaMalloc(
1998 devPtr: *mut *mut ::core::ffi::c_void,
1999 size: size_t,
2000 ) -> cudaError_t;
2001}
2002singe_loader::functions! { crate::RUNTIME;
2003 /// Allocates page-locked memory on the host
2004 ///
2005 /// Allocates `size` 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 ::cudaMemcpy*(). 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().
2006 ///
2007 /// On systems where ::pageableMemoryAccessUsesHostPageTables is true, ::cudaMallocHost may not page-lock the allocated memory.
2008 ///
2009 /// Page-locking excessive amounts of memory with ::cudaMallocHost() 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.
2010 ///
2011 ///
2012 ///
2013 ///
2014 ///
2015 /// # Return value
2016 ///
2017 /// ::cudaSuccess, ::cudaErrorInvalidValue, ::cudaErrorMemoryAllocation, ::cudaErrorExternalDevice
2018 ///
2019 /// Note: _init_rt
2020 ///
2021 /// Note: _callback
2022 ///
2023 ///
2024 ///
2025 /// See also: ::cudaMalloc, ::cudaMallocPitch, ::cudaMallocArray, ::cudaMalloc3D, ::cudaMalloc3DArray, ::cudaHostAlloc, ::cudaFree, ::cudaFreeArray, `::cudaMallocHost(void**`, size_t, unsigned int) "cudaMallocHost (C++ API)", ::cudaFreeHost, ::cudaHostAlloc, ::cuMemAllocHost
2026 ///
2027 /// # Parameters
2028 ///
2029 /// - `ptr`: - Pointer to allocated host memory
2030 /// - `size`: - Requested allocation size in bytes
2031 pub fn cudaMallocHost(
2032 ptr: *mut *mut ::core::ffi::c_void,
2033 size: size_t,
2034 ) -> cudaError_t;
2035}
2036singe_loader::functions! { crate::RUNTIME;
2037 /// Allocates pitched memory on the device.
2038 ///
2039 /// Allocates at least `width` (in bytes) \* `height` bytes of linear memory on the device and returns in `*devPtr` 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. The pitch returned in `*pitch` by [`cudaMallocPitch`] 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:
2040 ///
2041 /// For allocations of 2D arrays, it is recommended that programmers consider performing pitch allocations using [`cudaMallocPitch`]. Due to pitch 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).
2042 ///
2043 /// # Parameters
2044 ///
2045 /// - `devPtr`: Pointer to allocated pitched device memory.
2046 /// - `pitch`: Pitch for allocation.
2047 /// - `width`: Requested pitched allocation width (in bytes).
2048 /// - `height`: Requested pitched allocation height.
2049 pub fn cudaMallocPitch(
2050 devPtr: *mut *mut ::core::ffi::c_void,
2051 pitch: *mut size_t,
2052 width: size_t,
2053 height: size_t,
2054 ) -> cudaError_t;
2055}
2056singe_loader::functions! { crate::RUNTIME;
2057 /// Allocate an array on the device.
2058 ///
2059 /// Allocates a CUDA array according to the [`cudaChannelFormatDesc`] structure `desc` and returns a handle to the new CUDA array in `*array`.
2060 ///
2061 /// The [`cudaChannelFormatDesc`] is defined as:
2062 ///
2063 /// The `flags` parameter enables different options to be specified that affect the allocation, as follows.
2064 ///
2065 /// `width` and `height` must meet certain size requirements. See [`cudaMalloc3DArray`] for more details.
2066 ///
2067 /// # Parameters
2068 ///
2069 /// - `array`: Pointer to allocated array in device memory.
2070 /// - `desc`: Requested channel format.
2071 /// - `width`: Requested array allocation width.
2072 /// - `height`: Requested array allocation height.
2073 /// - `flags`: Requested properties of allocated array.
2074 pub fn cudaMallocArray(
2075 array: *mut cudaArray_t,
2076 desc: *const cudaChannelFormatDesc,
2077 width: size_t,
2078 height: size_t,
2079 flags: ::core::ffi::c_uint,
2080 ) -> cudaError_t;
2081}
2082singe_loader::functions! { crate::RUNTIME;
2083 /// Frees memory on the device.
2084 ///
2085 /// Frees the memory space pointed to by `devPtr`, which must have been returned by a previous call to one of the following memory allocation APIs - [`cudaMalloc`], [`cudaMallocPitch`], [`cudaMallocManaged`], [`cudaMallocAsync`], [`cudaMallocFromPoolAsync`].
2086 ///
2087 /// Note - This API will not perform any implicit synchronization when the pointer was allocated with [`cudaMallocAsync`] or [`cudaMallocFromPoolAsync`]. Callers must ensure that all accesses to these pointer have completed before invoking [`cudaFree`]. For best performance and memory reuse, users should use [`cudaFreeAsync`] to free memory allocated via the stream ordered memory allocator. For all other pointers, this API may perform implicit synchronization.
2088 ///
2089 /// If [`cudaFree`](`devPtr`) has already been called before, an error is returned. If `devPtr` is 0, no operation is performed. [`cudaFree`] returns ::cudaErrorValue in case of failure.
2090 ///
2091 /// The device version of [`cudaFree`] cannot be used with a `*devPtr` allocated using the host API, and vice versa.
2092 ///
2093 /// # Parameters
2094 ///
2095 /// - `devPtr`: - Device pointer to memory to free
2096 pub fn cudaFree(devPtr: *mut ::core::ffi::c_void) -> cudaError_t;
2097}
2098singe_loader::functions! { crate::RUNTIME;
2099 /// Frees page-locked memory.
2100 ///
2101 /// Frees the memory space pointed to by `hostPtr`, which must have been returned by a previous call to [`cudaMallocHost`] or [`cudaHostAlloc`].
2102 ///
2103 /// # Parameters
2104 ///
2105 /// - `ptr`: - Pointer to memory to free
2106 pub fn cudaFreeHost(ptr: *mut ::core::ffi::c_void) -> cudaError_t;
2107}
2108singe_loader::functions! { crate::RUNTIME;
2109 /// Frees an array on the device.
2110 ///
2111 /// Frees the CUDA array `array`, which must have been returned by a previous call to [`cudaMallocArray`]. If `devPtr` is 0, no operation is performed.
2112 ///
2113 /// # Parameters
2114 ///
2115 /// - `array`: - Pointer to array to free
2116 pub fn cudaFreeArray(array: cudaArray_t) -> cudaError_t;
2117}
2118singe_loader::functions! { crate::RUNTIME;
2119 /// Frees a mipmapped array on the device.
2120 ///
2121 /// Frees the CUDA mipmapped array `mipmappedArray`, which must have been returned by a previous call to [`cudaMallocMipmappedArray`]. If `devPtr` is 0, no operation is performed.
2122 ///
2123 /// # Parameters
2124 ///
2125 /// - `mipmappedArray`: - Pointer to mipmapped array to free
2126 pub fn cudaFreeMipmappedArray(mipmappedArray: cudaMipmappedArray_t) -> cudaError_t;
2127}
2128singe_loader::functions! { crate::RUNTIME;
2129 /// Allocates page-locked memory on the host.
2130 ///
2131 /// Allocates `size` 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 [`cudaMemcpy`]. 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(). Allocating excessive amounts of pinned 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.
2132 ///
2133 /// The `flags` parameter enables different options to be specified that affect the allocation, as follows.
2134 ///
2135 /// 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.
2136 ///
2137 /// In order for the [`cudaHostAllocMapped`] flag to have any effect, the CUDA context must support the [cudaDeviceMapHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga3762be9cccdd809a4ca128354fd134b0) flag, which can be checked via [`cudaGetDeviceFlags`]. The [cudaDeviceMapHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga3762be9cccdd809a4ca128354fd134b0) flag is implicitly set for contexts created via the runtime API.
2138 ///
2139 /// The [`cudaHostAllocMapped`] flag may be specified on CUDA contexts for devices that do not support mapped pinned memory. The failure is deferred to [`cudaHostGetDevicePointer`] because the memory may be mapped into other CUDA contexts via the [`cudaHostAllocPortable`] flag.
2140 ///
2141 /// Memory allocated by this function must be freed with [`cudaFreeHost`].
2142 ///
2143 /// # Parameters
2144 ///
2145 /// - `pHost`: Device pointer to allocated memory.
2146 /// - `size`: Requested allocation size in bytes.
2147 /// - `flags`: Requested properties of allocated memory.
2148 pub fn cudaHostAlloc(
2149 pHost: *mut *mut ::core::ffi::c_void,
2150 size: size_t,
2151 flags: ::core::ffi::c_uint,
2152 ) -> cudaError_t;
2153}
2154singe_loader::functions! { crate::RUNTIME;
2155 /// Registers an existing host memory range for use by CUDA.
2156 ///
2157 /// Page-locks the memory range specified by `ptr` and `size` and maps it for the device(s) as specified by `flags`. This memory range also is added to the same tracking mechanism as [`cudaHostAlloc`] to automatically accelerate calls to functions such as [`cudaMemcpy`]. 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.
2158 ///
2159 /// On systems where ::pageableMemoryAccessUsesHostPageTables is true, [`cudaHostRegister`] will not page-lock the memory range specified by `ptr` but only populate unpopulated pages.
2160 ///
2161 /// [`cudaHostRegister`] is supported only on I/O coherent devices that have a non-zero value for the device attribute [cudaDevAttrHostRegisterSupported](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cda6ea4a004a336c3c95b6ff06ec6269e29).
2162 ///
2163 /// The `flags` parameter enables different options to be specified that affect the allocation, as follows.
2164 ///
2165 /// All of these flags are orthogonal to one another: a developer may page-lock memory that is portable or mapped with no restrictions.
2166 ///
2167 /// The CUDA context must have been created with the ::cudaMapHost flag in order for the [`cudaHostRegisterMapped`] flag to have any effect.
2168 ///
2169 /// The [`cudaHostRegisterMapped`] flag may be specified on CUDA contexts for devices that do not support mapped pinned memory. The failure is deferred to [`cudaHostGetDevicePointer`] because the memory may be mapped into other CUDA contexts via the [`cudaHostRegisterPortable`] flag.
2170 ///
2171 /// For devices that have a non-zero value for the device attribute [cudaDevAttrCanUseHostPointerForRegisteredMem](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdab08e379a7a038dc8134914702c223f69), the memory can also be accessed from the device using the host pointer `ptr`. The device pointer returned by [`cudaHostGetDevicePointer`] 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 [`cudaHostGetDevicePointer`] 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 [`cudaHostGetDevicePointer`] 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.
2172 ///
2173 /// The memory page-locked by this function must be unregistered with [`cudaHostUnregister`].
2174 ///
2175 /// # Parameters
2176 ///
2177 /// - `ptr`: Host pointer to memory to page-lock.
2178 /// - `size`: Size in bytes of the address range to page-lock in bytes.
2179 /// - `flags`: Flags for allocation request.
2180 pub fn cudaHostRegister(
2181 ptr: *mut ::core::ffi::c_void,
2182 size: size_t,
2183 flags: ::core::ffi::c_uint,
2184 ) -> cudaError_t;
2185}
2186singe_loader::functions! { crate::RUNTIME;
2187 /// Unregisters a memory range that was registered with cudaHostRegister.
2188 ///
2189 /// Unmaps the memory range whose base address is specified by `ptr`, and makes it pageable again.
2190 ///
2191 /// The base address must be the same one specified to [`cudaHostRegister`].
2192 ///
2193 /// # Parameters
2194 ///
2195 /// - `ptr`: - Host pointer to memory to unregister
2196 pub fn cudaHostUnregister(ptr: *mut ::core::ffi::c_void) -> cudaError_t;
2197}
2198singe_loader::functions! { crate::RUNTIME;
2199 /// Passes back device pointer of mapped host memory allocated by cudaHostAlloc or registered by cudaHostRegister.
2200 ///
2201 /// Passes back the device pointer corresponding to the mapped, pinned host buffer allocated by [`cudaHostAlloc`] or registered by [`cudaHostRegister`].
2202 ///
2203 /// [`cudaHostGetDevicePointer`] will fail if the [cudaDeviceMapHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga3762be9cccdd809a4ca128354fd134b0) flag was not specified before deferred context creation occurred, or if called on a device that does not support mapped, pinned memory.
2204 ///
2205 /// For devices that have a non-zero value for the device attribute [cudaDevAttrCanUseHostPointerForRegisteredMem](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdab08e379a7a038dc8134914702c223f69), the memory can also be accessed from the device using the host pointer `pHost`. The device pointer returned by [`cudaHostGetDevicePointer`] may or may not match the original host pointer `pHost` 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 [`cudaHostGetDevicePointer`] will match the original pointer `pHost`. If any device visible to the application has a zero value for the device attribute, the device pointer returned by [`cudaHostGetDevicePointer`] will not match the original host pointer `pHost`, 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.
2206 ///
2207 /// `flags` provides for future releases. For now, it must be set to 0.
2208 ///
2209 /// # Parameters
2210 ///
2211 /// - `pDevice`: Returned device pointer for mapped memory.
2212 /// - `pHost`: Requested host pointer mapping.
2213 /// - `flags`: Flags for extensions (must be 0 for now).
2214 pub fn cudaHostGetDevicePointer(
2215 pDevice: *mut *mut ::core::ffi::c_void,
2216 pHost: *mut ::core::ffi::c_void,
2217 flags: ::core::ffi::c_uint,
2218 ) -> cudaError_t;
2219}
2220singe_loader::functions! { crate::RUNTIME;
2221 /// Passes back flags used to allocate pinned host memory allocated by cudaHostAlloc.
2222 ///
2223 /// [`cudaHostGetFlags`] will fail if the input pointer does not reside in an address range allocated by [`cudaHostAlloc`].
2224 ///
2225 /// # Parameters
2226 ///
2227 /// - `pFlags`: Returned flags word.
2228 /// - `pHost`: Host pointer.
2229 pub fn cudaHostGetFlags(
2230 pFlags: *mut ::core::ffi::c_uint,
2231 pHost: *mut ::core::ffi::c_void,
2232 ) -> cudaError_t;
2233}
2234singe_loader::functions! { crate::RUNTIME;
2235 /// Allocates logical 1D, 2D, or 3D memory objects on the device.
2236 ///
2237 /// Allocates at least `width` \* `height` \* `depth` bytes of linear memory on the device and returns a [`cudaPitchedPtr`] in which `ptr` is a pointer to the allocated memory. The function may pad the allocation to ensure hardware alignment requirements are met. The pitch returned in the `pitch` field of `pitchedDevPtr` is the width in bytes of the allocation.
2238 ///
2239 /// The returned [`cudaPitchedPtr`] contains additional fields `xsize` and `ysize`, the logical width and height of the allocation, which are equivalent to the `width` and `height` `extent` parameters provided by the programmer during allocation.
2240 ///
2241 /// For allocations of 2D and 3D objects, it is highly recommended that programmers perform allocations using [`cudaMalloc3D`] or [`cudaMallocPitch`]. Due to alignment restrictions in the hardware, this is especially true if the application will be performing memory copies involving 2D or 3D objects (whether linear memory or CUDA arrays).
2242 ///
2243 /// # Parameters
2244 ///
2245 /// - `pitchedDevPtr`: Pointer to allocated pitched device memory.
2246 /// - `extent`: Requested allocation size (`width` field in bytes).
2247 pub fn cudaMalloc3D(
2248 pitchedDevPtr: *mut cudaPitchedPtr,
2249 extent: cudaExtent,
2250 ) -> cudaError_t;
2251}
2252singe_loader::functions! { crate::RUNTIME;
2253 /// Allocate an array on the device.
2254 ///
2255 /// Allocates a CUDA array according to the [`cudaChannelFormatDesc`] structure `desc` and returns a handle to the new CUDA array in `*array`.
2256 ///
2257 /// The [`cudaChannelFormatDesc`] is defined as:
2258 ///
2259 /// [`cudaMalloc3DArray`] can allocate the following:
2260 ///
2261 /// The `flags` parameter enables different options to be specified that affect the allocation, as follows.
2262 ///
2263 /// The width, height and depth extents must meet certain size requirements as listed in the following table. All values are specified in elements.
2264 ///
2265 /// Note that 2D CUDA arrays have different size requirements if the [cudaArrayTextureGather](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga142b19a14d56a03b1e410430aa5202d1) flag is set. In that case, the valid range for (width, height, depth) is ((1,maxTexture2DGather\[0\]), (1,maxTexture2DGather\[1\]), 0).
2266 ///
2267 /// # Parameters
2268 ///
2269 /// - `array`: Pointer to allocated array in device memory.
2270 /// - `desc`: Requested channel format.
2271 /// - `extent`: Requested allocation size (`width` field in elements).
2272 /// - `flags`: Flags for extensions.
2273 pub fn cudaMalloc3DArray(
2274 array: *mut cudaArray_t,
2275 desc: *const cudaChannelFormatDesc,
2276 extent: cudaExtent,
2277 flags: ::core::ffi::c_uint,
2278 ) -> cudaError_t;
2279}
2280singe_loader::functions! { crate::RUNTIME;
2281 /// Allocate a mipmapped array on the device.
2282 ///
2283 /// Allocates a CUDA mipmapped array according to the [`cudaChannelFormatDesc`] structure `desc` and returns a handle to the new CUDA mipmapped array in `*mipmappedArray`. `numLevels` specifies the number of mipmap levels to be allocated. This value is clamped to the range \[1, 1 + floor(log2(max(width, height, depth)))\].
2284 ///
2285 /// The [`cudaChannelFormatDesc`] is defined as:
2286 ///
2287 /// [`cudaMallocMipmappedArray`] can allocate the following:
2288 ///
2289 /// The `flags` parameter enables different options to be specified that affect the allocation, as follows.
2290 ///
2291 /// The width, height and depth extents must meet certain size requirements as listed in the following table. All values are specified in elements.
2292 ///
2293 /// # Parameters
2294 ///
2295 /// - `mipmappedArray`: Pointer to allocated mipmapped array in device memory.
2296 /// - `desc`: Requested channel format.
2297 /// - `extent`: Requested allocation size (`width` field in elements).
2298 /// - `numLevels`: Number of mipmap levels to allocate.
2299 /// - `flags`: Flags for extensions.
2300 pub fn cudaMallocMipmappedArray(
2301 mipmappedArray: *mut cudaMipmappedArray_t,
2302 desc: *const cudaChannelFormatDesc,
2303 extent: cudaExtent,
2304 numLevels: ::core::ffi::c_uint,
2305 flags: ::core::ffi::c_uint,
2306 ) -> cudaError_t;
2307}
2308singe_loader::functions! { crate::RUNTIME;
2309 /// Gets a mipmap level of a CUDA mipmapped array.
2310 ///
2311 /// Returns in `*levelArray` a CUDA array that represents a single mipmap level of the CUDA mipmapped array `mipmappedArray`.
2312 ///
2313 /// If `level` is greater than the maximum number of levels in this mipmapped array, [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) is returned.
2314 ///
2315 /// If `mipmappedArray` is NULL, [cudaErrorInvalidResourceHandle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ac4673247aee4d1ab8d07871f376e0273) is returned.
2316 ///
2317 /// # Parameters
2318 ///
2319 /// - `levelArray`: Returned mipmap level CUDA array.
2320 /// - `mipmappedArray`: CUDA mipmapped array.
2321 /// - `level`: Mipmap level.
2322 pub fn cudaGetMipmappedArrayLevel(
2323 levelArray: *mut cudaArray_t,
2324 mipmappedArray: cudaMipmappedArray_const_t,
2325 level: ::core::ffi::c_uint,
2326 ) -> cudaError_t;
2327}
2328singe_loader::functions! { crate::RUNTIME;
2329 /// Copies data between 3D objects.
2330 ///
2331 /// [`cudaMemcpy3D`] copies data betwen two 3D objects. The source and destination objects may be in either host memory, device memory, or a CUDA array. The source, destination, extent, and kind of copy performed is specified by the [`cudaMemcpy3DParms`] struct which should be initialized to zero before use:
2332 ///
2333 /// The struct passed to [`cudaMemcpy3D`] must specify one of `srcArray` or `srcPtr` and one of `dstArray` or `dstPtr`. Passing more than one non-zero source or destination will cause [`cudaMemcpy3D`] to return an error.
2334 ///
2335 /// The `srcPos` and `dstPos` fields are optional offsets into the source and destination objects and are defined in units of each object’s elements. The element for a host or device pointer is assumed to be **unsigned char**.
2336 ///
2337 /// The `extent` field defines the dimensions of the transferred area in elements. If a CUDA array is participating in the copy, the extent is defined in terms of that array’s elements. If no CUDA array is participating in the copy then the extents are defined in elements of **unsigned char**.
2338 ///
2339 /// The `kind` field defines the direction of the copy. It must be one of [`cudaMemcpyKind::cudaMemcpyHostToHost`], [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing. For [`cudaMemcpyKind::cudaMemcpyHostToHost`] or [`cudaMemcpyKind::cudaMemcpyHostToDevice`] or [`cudaMemcpyKind::cudaMemcpyDeviceToHost`] passed as kind and cudaArray type passed as source or destination, if the kind implies cudaArray type to be present on the host, [`cudaMemcpy3D`] will disregard that implication and silently correct the kind based on the fact that cudaArray type can only be present on the device.
2340 ///
2341 /// If the source and destination are both arrays, [`cudaMemcpy3D`] will return an error if they do not have the same element size.
2342 ///
2343 /// The source and destination object may not overlap. If overlapping source and destination objects are specified, undefined behavior will result.
2344 ///
2345 /// The source object must entirely contain the region defined by `srcPos` and `extent`. The destination object must entirely contain the region defined by `dstPos` and `extent`.
2346 ///
2347 /// [`cudaMemcpy3D`] returns an error if the pitch of `srcPtr` or `dstPtr` exceeds the maximum allowed. The pitch of a [`cudaPitchedPtr`] allocated with [`cudaMalloc3D`] will always be valid.
2348 ///
2349 /// # Parameters
2350 ///
2351 /// - `p`: - 3D memory copy parameters
2352 pub fn cudaMemcpy3D(p: *const cudaMemcpy3DParms) -> cudaError_t;
2353}
2354singe_loader::functions! { crate::RUNTIME;
2355 /// Copies memory between devices.
2356 ///
2357 /// Perform a 3D memory copy according to the parameters specified in `p`. See the definition of the [`cudaMemcpy3DPeerParms`] structure for documentation of its parameters.
2358 ///
2359 /// Note that this function is synchronous with respect to the host only if the source or destination of the transfer is host memory. Note also that this copy is serialized with respect to all pending and future asynchronous work in to the current device, the copy’s source device, and the copy’s destination device (use [`cudaMemcpy3DPeerAsync`] to avoid this synchronization).
2360 ///
2361 /// # Parameters
2362 ///
2363 /// - `p`: - Parameters for the memory copy
2364 pub fn cudaMemcpy3DPeer(p: *const cudaMemcpy3DPeerParms) -> cudaError_t;
2365}
2366singe_loader::functions! { crate::RUNTIME;
2367 /// Copies data between 3D objects.
2368 ///
2369 /// [`cudaMemcpy3DAsync`] copies data betwen two 3D objects. The source and destination objects may be in either host memory, device memory, or a CUDA array. The source, destination, extent, and kind of copy performed is specified by the [`cudaMemcpy3DParms`] struct which should be initialized to zero before use:
2370 ///
2371 /// The struct passed to [`cudaMemcpy3DAsync`] must specify one of `srcArray` or `srcPtr` and one of `dstArray` or `dstPtr`. Passing more than one non-zero source or destination will cause [`cudaMemcpy3DAsync`] to return an error.
2372 ///
2373 /// The `srcPos` and `dstPos` fields are optional offsets into the source and destination objects and are defined in units of each object’s elements. The element for a host or device pointer is assumed to be **unsigned char**. For CUDA arrays, positions must be in the range [0, 2048) for any dimension.
2374 ///
2375 /// The `extent` field defines the dimensions of the transferred area in elements. If a CUDA array is participating in the copy, the extent is defined in terms of that array’s elements. If no CUDA array is participating in the copy then the extents are defined in elements of **unsigned char**.
2376 ///
2377 /// The `kind` field defines the direction of the copy. It must be one of [cudaMemcpyHostToHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga18fa99055ee694244a270e4d5101e95badeec295de8a74ac2a74f98ffb6c5d7c7), [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing. For [`cudaMemcpyKind::cudaMemcpyHostToHost`] or [`cudaMemcpyKind::cudaMemcpyHostToDevice`] or [`cudaMemcpyKind::cudaMemcpyDeviceToHost`] passed as kind and cudaArray type passed as source or destination, if the kind implies cudaArray type to be present on the host, [`cudaMemcpy3DAsync`] will disregard that implication and silently correct the kind based on the fact that cudaArray type can only be present on the device.
2378 ///
2379 /// If the source and destination are both arrays, [`cudaMemcpy3DAsync`] will return an error if they do not have the same element size.
2380 ///
2381 /// The source and destination object may not overlap. If overlapping source and destination objects are specified, undefined behavior will result.
2382 ///
2383 /// The source object must lie entirely within the region defined by `srcPos` and `extent`. The destination object must lie entirely within the region defined by `dstPos` and `extent`.
2384 ///
2385 /// [`cudaMemcpy3DAsync`] returns an error if the pitch of `srcPtr` or `dstPtr` exceeds the maximum allowed. The pitch of a [`cudaPitchedPtr`] allocated with [`cudaMalloc3D`] will always be valid.
2386 ///
2387 /// [`cudaMemcpy3DAsync`] is asynchronous with respect to the host, so the call may return before the copy is complete. The copy can optionally be associated to a stream by passing a non-zero `stream` argument. If `kind` is [`cudaMemcpyKind::cudaMemcpyHostToDevice`] or [`cudaMemcpyKind::cudaMemcpyDeviceToHost`] and `stream` is non-zero, the copy may overlap with operations in other streams.
2388 ///
2389 /// The device version of this function only handles device to device copies and cannot be given local or shared pointers.
2390 ///
2391 /// # Parameters
2392 ///
2393 /// - `p`: 3D memory copy parameters.
2394 /// - `stream`: Stream identifier.
2395 pub fn cudaMemcpy3DAsync(
2396 p: *const cudaMemcpy3DParms,
2397 stream: cudaStream_t,
2398 ) -> cudaError_t;
2399}
2400singe_loader::functions! { crate::RUNTIME;
2401 /// Copies memory between devices asynchronously.
2402 ///
2403 /// Perform a 3D memory copy according to the parameters specified in `p`. See the definition of the [`cudaMemcpy3DPeerParms`] structure for documentation of its parameters.
2404 ///
2405 /// # Parameters
2406 ///
2407 /// - `p`: Parameters for the memory copy.
2408 /// - `stream`: Stream identifier.
2409 pub fn cudaMemcpy3DPeerAsync(
2410 p: *const cudaMemcpy3DPeerParms,
2411 stream: cudaStream_t,
2412 ) -> cudaError_t;
2413}
2414singe_loader::functions! { crate::RUNTIME;
2415 /// Gets free and total device memory.
2416 ///
2417 /// Returns in `*total` the total amount of memory available to the current context. Returns in `*free` the amount of memory on the device that is free according to the OS. CUDA is not guaranteed to be able to allocate all of 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.
2418 ///
2419 /// 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.
2420 ///
2421 /// # Parameters
2422 ///
2423 /// - `free`: Returned free memory in bytes.
2424 /// - `total`: Returned total memory in bytes.
2425 pub fn cudaMemGetInfo(free: *mut size_t, total: *mut size_t) -> cudaError_t;
2426}
2427singe_loader::functions! { crate::RUNTIME;
2428 /// Gets info about the specified cudaArray.
2429 ///
2430 /// Returns in `*desc`, `*extent` and `*flags` respectively, the type, shape and flags of `array`.
2431 ///
2432 /// Any of `*desc`, `*extent` and `*flags` may be specified as NULL.
2433 ///
2434 /// # Parameters
2435 ///
2436 /// - `desc`: Returned array type.
2437 /// - `extent`: Returned array shape. 2D arrays will have depth of zero.
2438 /// - `flags`: Returned array flags.
2439 /// - `array`: The ::cudaArray to get info for.
2440 pub fn cudaArrayGetInfo(
2441 desc: *mut cudaChannelFormatDesc,
2442 extent: *mut cudaExtent,
2443 flags: *mut ::core::ffi::c_uint,
2444 array: cudaArray_t,
2445 ) -> cudaError_t;
2446}
2447singe_loader::functions! { crate::RUNTIME;
2448 /// Gets a CUDA array plane from a CUDA array.
2449 ///
2450 /// Returns in `pPlaneArray` a CUDA array that represents a single format plane of the CUDA array `hArray`.
2451 ///
2452 /// 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: [`cudaChannelFormatKind::cudaChannelFormatKindNV12`], then [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) is returned.
2453 ///
2454 /// Note that if the `hArray` has format [`cudaChannelFormatKind::cudaChannelFormatKindNV12`], then passing in 0 for `planeIdx` returns a CUDA array of the same size as `hArray` but with one 8-bit channel and [`cudaChannelFormatKind::cudaChannelFormatKindUnsigned`] as its format kind. If 1 is passed for `planeIdx`, then the returned CUDA array has half the height and width of `hArray` with two 8-bit channels and [`cudaChannelFormatKind::cudaChannelFormatKindUnsigned`] as its format kind.
2455 ///
2456 /// # Parameters
2457 ///
2458 /// - `pPlaneArray`: Returned CUDA array referenced by the `planeIdx`.
2459 /// - `hArray`: CUDA array.
2460 /// - `planeIdx`: Plane index.
2461 pub fn cudaArrayGetPlane(
2462 pPlaneArray: *mut cudaArray_t,
2463 hArray: cudaArray_t,
2464 planeIdx: ::core::ffi::c_uint,
2465 ) -> cudaError_t;
2466}
2467singe_loader::functions! { crate::RUNTIME;
2468 /// Returns the memory requirements of a CUDA array.
2469 ///
2470 /// Returns the memory requirements of a CUDA array in `memoryRequirements` If the CUDA array is not allocated with flag [cudaArrayDeferredMapping](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga91a50795515848406a89c2e6cef2fb02) [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) will be returned.
2471 ///
2472 /// The returned value in [cudaArrayMemoryRequirements::size](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaArrayMemoryRequirements.html#structcudaarraymemoryrequirements_1acff0bc12daa05c6c40892a2187befd87) represents the total size of the CUDA array. The returned value in [cudaArrayMemoryRequirements::alignment](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaArrayMemoryRequirements.html#structcudaarraymemoryrequirements_1a37898b13b500d39e4a43d0ee04cf0ef3) represents the alignment necessary for mapping the CUDA array.
2473 ///
2474 /// # Parameters
2475 ///
2476 /// - `memoryRequirements`: Pointer to [cudaArrayMemoryRequirements](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaArrayMemoryRequirements.html#structcudaarraymemoryrequirements).
2477 /// - `array`: CUDA array to get the memory requirements of.
2478 /// - `device`: Device to get the memory requirements for.
2479 pub fn cudaArrayGetMemoryRequirements(
2480 memoryRequirements: *mut cudaArrayMemoryRequirements,
2481 array: cudaArray_t,
2482 device: ::core::ffi::c_int,
2483 ) -> cudaError_t;
2484}
2485singe_loader::functions! { crate::RUNTIME;
2486 /// Returns the memory requirements of a CUDA mipmapped array.
2487 ///
2488 /// Returns the memory requirements of a CUDA mipmapped array in `memoryRequirements` If the CUDA mipmapped array is not allocated with flag [cudaArrayDeferredMapping](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga91a50795515848406a89c2e6cef2fb02) [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) will be returned.
2489 ///
2490 /// The returned value in [cudaArrayMemoryRequirements::size](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaArrayMemoryRequirements.html#structcudaarraymemoryrequirements_1acff0bc12daa05c6c40892a2187befd87) represents the total size of the CUDA mipmapped array. The returned value in [cudaArrayMemoryRequirements::alignment](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaArrayMemoryRequirements.html#structcudaarraymemoryrequirements_1a37898b13b500d39e4a43d0ee04cf0ef3) represents the alignment necessary for mapping the CUDA mipmapped array.
2491 ///
2492 /// # Parameters
2493 ///
2494 /// - `memoryRequirements`: Pointer to [cudaArrayMemoryRequirements](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaArrayMemoryRequirements.html#structcudaarraymemoryrequirements).
2495 /// - `mipmap`: CUDA mipmapped array to get the memory requirements of.
2496 /// - `device`: Device to get the memory requirements for.
2497 pub fn cudaMipmappedArrayGetMemoryRequirements(
2498 memoryRequirements: *mut cudaArrayMemoryRequirements,
2499 mipmap: cudaMipmappedArray_t,
2500 device: ::core::ffi::c_int,
2501 ) -> cudaError_t;
2502}
2503singe_loader::functions! { crate::RUNTIME;
2504 /// Returns the layout properties of a sparse CUDA array.
2505 ///
2506 /// Returns the layout properties of a sparse CUDA array in `sparseProperties`. If the CUDA array is not allocated with flag [cudaArraySparse](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga42c353686a15da063dc7722594ae4bff) [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) will be returned.
2507 ///
2508 /// If the returned value in [cudaArraySparseProperties::flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaArraySparseProperties.html#structcudaarraysparseproperties_1a44c8728469d60e511aceb4ba7086c164) contains [cudaArraySparsePropertiesSingleMipTail](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga6820071ffa1300699897eab8d319e4d9), then [cudaArraySparseProperties::miptailSize](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaArraySparseProperties.html#structcudaarraysparseproperties_1a22cfa4ad83195f0e9585303c988bb886) represents the total size of the array. Otherwise, it will be zero. Also, the returned value in [cudaArraySparseProperties::miptailFirstLevel](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaArraySparseProperties.html#structcudaarraysparseproperties_1ab6909e5db55b866477b6cc16fb02f9d3) is always zero. Note that the `array` must have been allocated using [`cudaMallocArray`] or [`cudaMalloc3DArray`]. For CUDA arrays obtained using ::cudaMipmappedArrayGetLevel, [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) will be returned. Instead, [`cudaMipmappedArrayGetSparseProperties`] must be used to obtain the sparse properties of the entire CUDA mipmapped array to which `array` belongs to.
2509 ///
2510 /// # Parameters
2511 ///
2512 /// - `sparseProperties`: Pointer to return the [cudaArraySparseProperties](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaArraySparseProperties.html#structcudaarraysparseproperties).
2513 /// - `array`: The CUDA array to get the sparse properties of.
2514 pub fn cudaArrayGetSparseProperties(
2515 sparseProperties: *mut cudaArraySparseProperties,
2516 array: cudaArray_t,
2517 ) -> cudaError_t;
2518}
2519singe_loader::functions! { crate::RUNTIME;
2520 /// Returns the layout properties of a sparse CUDA mipmapped array.
2521 ///
2522 /// Returns the sparse array layout properties in `sparseProperties`. If the CUDA mipmapped array is not allocated with flag [cudaArraySparse](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga42c353686a15da063dc7722594ae4bff) [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) will be returned.
2523 ///
2524 /// For non-layered CUDA mipmapped arrays, [cudaArraySparseProperties::miptailSize](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaArraySparseProperties.html#structcudaarraysparseproperties_1a22cfa4ad83195f0e9585303c988bb886) 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 [cudaArraySparseProperties::flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaArraySparseProperties.html#structcudaarraysparseproperties_1a44c8728469d60e511aceb4ba7086c164) contains [cudaArraySparsePropertiesSingleMipTail](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ga6820071ffa1300699897eab8d319e4d9), then [cudaArraySparseProperties::miptailSize](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaArraySparseProperties.html#structcudaarraysparseproperties_1a22cfa4ad83195f0e9585303c988bb886) specifies the size of the mip tail of all layers combined. Otherwise, [cudaArraySparseProperties::miptailSize](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaArraySparseProperties.html#structcudaarraysparseproperties_1a22cfa4ad83195f0e9585303c988bb886) specifies mip tail size per layer. The returned value of [cudaArraySparseProperties::miptailFirstLevel](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaArraySparseProperties.html#structcudaarraysparseproperties_1ab6909e5db55b866477b6cc16fb02f9d3) is valid only if [cudaArraySparseProperties::miptailSize](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaArraySparseProperties.html#structcudaarraysparseproperties_1a22cfa4ad83195f0e9585303c988bb886) is non-zero.
2525 ///
2526 /// # Parameters
2527 ///
2528 /// - `sparseProperties`: Pointer to return [cudaArraySparseProperties](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaArraySparseProperties.html#structcudaarraysparseproperties).
2529 /// - `mipmap`: The CUDA mipmapped array to get the sparse properties of.
2530 pub fn cudaMipmappedArrayGetSparseProperties(
2531 sparseProperties: *mut cudaArraySparseProperties,
2532 mipmap: cudaMipmappedArray_t,
2533 ) -> cudaError_t;
2534}
2535singe_loader::functions! { crate::RUNTIME;
2536 /// Copies data between host and device.
2537 ///
2538 /// Copies `count` bytes from the memory area pointed to by `src` to the memory area pointed to by `dst`, where `kind` specifies the direction of the copy, and must be one of [`cudaMemcpyKind::cudaMemcpyHostToHost`], [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing. Calling [`cudaMemcpy`] with dst and src pointers that do not match the direction of the copy results in an undefined behavior.
2539 ///
2540 /// # Parameters
2541 ///
2542 /// - `dst`: Destination memory address.
2543 /// - `src`: Source memory address.
2544 /// - `count`: Size in bytes to copy.
2545 /// - `kind`: Type of transfer.
2546 pub fn cudaMemcpy(
2547 dst: *mut ::core::ffi::c_void,
2548 src: *const ::core::ffi::c_void,
2549 count: size_t,
2550 kind: cudaMemcpyKind,
2551 ) -> cudaError_t;
2552}
2553singe_loader::functions! { crate::RUNTIME;
2554 /// Copies memory between two devices.
2555 ///
2556 /// Copies memory from one device to memory on another device. `dst` is the base device pointer of the destination memory and `dstDevice` is the destination device. `src` is the base device pointer of the source memory and `srcDevice` is the source device. `count` specifies the number of bytes to copy.
2557 ///
2558 /// Note that this function is asynchronous with respect to the host, but serialized with respect all pending and future asynchronous work in to the current device, `srcDevice`, and `dstDevice` (use [`cudaMemcpyPeerAsync`] to avoid this synchronization).
2559 ///
2560 /// # Parameters
2561 ///
2562 /// - `dst`: Destination device pointer.
2563 /// - `dstDevice`: Destination device.
2564 /// - `src`: Source device pointer.
2565 /// - `srcDevice`: Source device.
2566 /// - `count`: Size of memory copy in bytes.
2567 pub fn cudaMemcpyPeer(
2568 dst: *mut ::core::ffi::c_void,
2569 dstDevice: ::core::ffi::c_int,
2570 src: *const ::core::ffi::c_void,
2571 srcDevice: ::core::ffi::c_int,
2572 count: size_t,
2573 ) -> cudaError_t;
2574}
2575singe_loader::functions! { crate::RUNTIME;
2576 /// Copies data between host and device.
2577 ///
2578 /// Copies a matrix (`height` rows of `width` bytes each) from the memory area pointed to by `src` to the memory area pointed to by `dst`, where `kind` specifies the direction of the copy, and must be one of [`cudaMemcpyKind::cudaMemcpyHostToHost`], [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing. `dpitch` and `spitch` are the widths in memory in bytes of the 2D arrays pointed to by `dst` and `src`, including any padding added to the end of each row. The memory areas may not overlap. `width` must not exceed either `dpitch` or `spitch`. Calling [`cudaMemcpy2D`] with `dst` and `src` pointers that do not match the direction of the copy results in an undefined behavior. [`cudaMemcpy2D`] returns an error if `dpitch` or `spitch` exceeds the maximum allowed.
2579 ///
2580 /// # Parameters
2581 ///
2582 /// - `dst`: Destination memory address.
2583 /// - `dpitch`: Pitch of destination memory.
2584 /// - `src`: Source memory address.
2585 /// - `spitch`: Pitch of source memory.
2586 /// - `width`: Width of matrix transfer (columns in bytes).
2587 /// - `height`: Height of matrix transfer (rows).
2588 /// - `kind`: Type of transfer.
2589 pub fn cudaMemcpy2D(
2590 dst: *mut ::core::ffi::c_void,
2591 dpitch: size_t,
2592 src: *const ::core::ffi::c_void,
2593 spitch: size_t,
2594 width: size_t,
2595 height: size_t,
2596 kind: cudaMemcpyKind,
2597 ) -> cudaError_t;
2598}
2599singe_loader::functions! { crate::RUNTIME;
2600 /// Copies data between host and device.
2601 ///
2602 /// Copies a matrix (`height` rows of `width` bytes each) from the memory area pointed to by `src` to the CUDA array `dst` starting at `hOffset` rows and `wOffset` bytes from the upper left corner, where `kind` specifies the direction of the copy, and must be one of [`cudaMemcpyKind::cudaMemcpyHostToHost`], [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing. `spitch` is the width in memory in bytes of the 2D array pointed to by `src`, including any padding added to the end of each row. `wOffset` + `width` must not exceed the width of the CUDA array `dst`. `width` must not exceed `spitch`. [`cudaMemcpy2DToArray`] returns an error if `spitch` exceeds the maximum allowed.
2603 ///
2604 /// # Parameters
2605 ///
2606 /// - `dst`: Destination memory address.
2607 /// - `wOffset`: Destination starting X offset (columns in bytes).
2608 /// - `hOffset`: Destination starting Y offset (rows).
2609 /// - `src`: Source memory address.
2610 /// - `spitch`: Pitch of source memory.
2611 /// - `width`: Width of matrix transfer (columns in bytes).
2612 /// - `height`: Height of matrix transfer (rows).
2613 /// - `kind`: Type of transfer.
2614 pub fn cudaMemcpy2DToArray(
2615 dst: cudaArray_t,
2616 wOffset: size_t,
2617 hOffset: size_t,
2618 src: *const ::core::ffi::c_void,
2619 spitch: size_t,
2620 width: size_t,
2621 height: size_t,
2622 kind: cudaMemcpyKind,
2623 ) -> cudaError_t;
2624}
2625singe_loader::functions! { crate::RUNTIME;
2626 /// Copies data between host and device.
2627 ///
2628 /// Copies a matrix (`height` rows of `width` bytes each) from the CUDA array `src` starting at `hOffset` rows and `wOffset` bytes from the upper left corner to the memory area pointed to by `dst`, where `kind` specifies the direction of the copy, and must be one of [`cudaMemcpyKind::cudaMemcpyHostToHost`], [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing. `dpitch` is the width in memory in bytes of the 2D array pointed to by `dst`, including any padding added to the end of each row. `wOffset` + `width` must not exceed the width of the CUDA array `src`. `width` must not exceed `dpitch`. [`cudaMemcpy2DFromArray`] returns an error if `dpitch` exceeds the maximum allowed.
2629 ///
2630 /// # Parameters
2631 ///
2632 /// - `dst`: Destination memory address.
2633 /// - `dpitch`: Pitch of destination memory.
2634 /// - `src`: Source memory address.
2635 /// - `wOffset`: Source starting X offset (columns in bytes).
2636 /// - `hOffset`: Source starting Y offset (rows).
2637 /// - `width`: Width of matrix transfer (columns in bytes).
2638 /// - `height`: Height of matrix transfer (rows).
2639 /// - `kind`: Type of transfer.
2640 pub fn cudaMemcpy2DFromArray(
2641 dst: *mut ::core::ffi::c_void,
2642 dpitch: size_t,
2643 src: cudaArray_const_t,
2644 wOffset: size_t,
2645 hOffset: size_t,
2646 width: size_t,
2647 height: size_t,
2648 kind: cudaMemcpyKind,
2649 ) -> cudaError_t;
2650}
2651singe_loader::functions! { crate::RUNTIME;
2652 /// Copies data between host and device.
2653 ///
2654 /// Copies a matrix (`height` rows of `width` bytes each) from the CUDA array `src` starting at `hOffsetSrc` rows and `wOffsetSrc` bytes from the upper left corner to the CUDA array `dst` starting at `hOffsetDst` rows and `wOffsetDst` bytes from the upper left corner, where `kind` specifies the direction of the copy, and must be one of [`cudaMemcpyKind::cudaMemcpyHostToHost`], [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing. `wOffsetDst` + `width` must not exceed the width of the CUDA array `dst`. `wOffsetSrc` + `width` must not exceed the width of the CUDA array `src`.
2655 ///
2656 /// # Parameters
2657 ///
2658 /// - `dst`: Destination memory address.
2659 /// - `wOffsetDst`: Destination starting X offset (columns in bytes).
2660 /// - `hOffsetDst`: Destination starting Y offset (rows).
2661 /// - `src`: Source memory address.
2662 /// - `wOffsetSrc`: Source starting X offset (columns in bytes).
2663 /// - `hOffsetSrc`: Source starting Y offset (rows).
2664 /// - `width`: Width of matrix transfer (columns in bytes).
2665 /// - `height`: Height of matrix transfer (rows).
2666 /// - `kind`: Type of transfer.
2667 pub fn cudaMemcpy2DArrayToArray(
2668 dst: cudaArray_t,
2669 wOffsetDst: size_t,
2670 hOffsetDst: size_t,
2671 src: cudaArray_const_t,
2672 wOffsetSrc: size_t,
2673 hOffsetSrc: size_t,
2674 width: size_t,
2675 height: size_t,
2676 kind: cudaMemcpyKind,
2677 ) -> cudaError_t;
2678}
2679singe_loader::functions! { crate::RUNTIME;
2680 /// Copies data to the given symbol on the device.
2681 ///
2682 /// Copies `count` bytes from the memory area pointed to by `src` to the memory area pointed to by `offset` bytes from the start of symbol `symbol`. The memory areas may not overlap. `symbol` is a variable that resides in global or constant memory space. `kind` can be either [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing.
2683 ///
2684 /// # Parameters
2685 ///
2686 /// - `symbol`: Device symbol address.
2687 /// - `src`: Source memory address.
2688 /// - `count`: Size in bytes to copy.
2689 /// - `offset`: Offset from start of symbol in bytes.
2690 /// - `kind`: Type of transfer.
2691 pub fn cudaMemcpyToSymbol(
2692 symbol: *const ::core::ffi::c_void,
2693 src: *const ::core::ffi::c_void,
2694 count: size_t,
2695 offset: size_t,
2696 kind: cudaMemcpyKind,
2697 ) -> cudaError_t;
2698}
2699singe_loader::functions! { crate::RUNTIME;
2700 /// Copies data from the given symbol on the device.
2701 ///
2702 /// Copies `count` bytes from the memory area pointed to by `offset` bytes from the start of symbol `symbol` to the memory area pointed to by `dst`. The memory areas may not overlap. `symbol` is a variable that resides in global or constant memory space. `kind` can be either [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing.
2703 ///
2704 /// # Parameters
2705 ///
2706 /// - `dst`: Destination memory address.
2707 /// - `symbol`: Device symbol address.
2708 /// - `count`: Size in bytes to copy.
2709 /// - `offset`: Offset from start of symbol in bytes.
2710 /// - `kind`: Type of transfer.
2711 pub fn cudaMemcpyFromSymbol(
2712 dst: *mut ::core::ffi::c_void,
2713 symbol: *const ::core::ffi::c_void,
2714 count: size_t,
2715 offset: size_t,
2716 kind: cudaMemcpyKind,
2717 ) -> cudaError_t;
2718}
2719singe_loader::functions! { crate::RUNTIME;
2720 /// Copies data between host and device.
2721 ///
2722 /// Copies `count` bytes from the memory area pointed to by `src` to the memory area pointed to by `dst`, where `kind` specifies the direction of the copy, and must be one of [`cudaMemcpyKind::cudaMemcpyHostToHost`], [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing.
2723 ///
2724 /// The memory areas may not overlap. Calling [`cudaMemcpyAsync`] with `dst` and `src` pointers that do not match the direction of the copy results in an undefined behavior.
2725 ///
2726 /// [`cudaMemcpyAsync`] is asynchronous with respect to the host, so the call may return before the copy is complete. The copy can optionally be associated to a stream by passing a non-zero `stream` argument. If `kind` is [`cudaMemcpyKind::cudaMemcpyHostToDevice`] or [`cudaMemcpyKind::cudaMemcpyDeviceToHost`] and the `stream` is non-zero, the copy may overlap with operations in other streams.
2727 ///
2728 /// The device version of this function only handles device to device copies and cannot be given local or shared pointers.
2729 ///
2730 /// # Parameters
2731 ///
2732 /// - `dst`: Destination memory address.
2733 /// - `src`: Source memory address.
2734 /// - `count`: Size in bytes to copy.
2735 /// - `kind`: Type of transfer.
2736 /// - `stream`: Stream identifier.
2737 pub fn cudaMemcpyAsync(
2738 dst: *mut ::core::ffi::c_void,
2739 src: *const ::core::ffi::c_void,
2740 count: size_t,
2741 kind: cudaMemcpyKind,
2742 stream: cudaStream_t,
2743 ) -> cudaError_t;
2744}
2745singe_loader::functions! { crate::RUNTIME;
2746 /// Copies memory between two devices asynchronously.
2747 ///
2748 /// Copies memory from one device to memory on another device. `dst` is the base device pointer of the destination memory and `dstDevice` is the destination device. `src` is the base device pointer of the source memory and `srcDevice` is the source device. `count` specifies the number of bytes to copy.
2749 ///
2750 /// Note that this function is asynchronous with respect to the host and all work on other devices.
2751 ///
2752 /// # Parameters
2753 ///
2754 /// - `dst`: Destination device pointer.
2755 /// - `dstDevice`: Destination device.
2756 /// - `src`: Source device pointer.
2757 /// - `srcDevice`: Source device.
2758 /// - `count`: Size of memory copy in bytes.
2759 /// - `stream`: Stream identifier.
2760 pub fn cudaMemcpyPeerAsync(
2761 dst: *mut ::core::ffi::c_void,
2762 dstDevice: ::core::ffi::c_int,
2763 src: *const ::core::ffi::c_void,
2764 srcDevice: ::core::ffi::c_int,
2765 count: size_t,
2766 stream: cudaStream_t,
2767 ) -> cudaError_t;
2768}
2769singe_loader::functions! { crate::RUNTIME;
2770 /// Performs a batch of memory copies asynchronously.
2771 ///
2772 /// 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 [`cudaMemcpy3DBatchAsync`].
2773 ///
2774 /// 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.
2775 ///
2776 /// 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`.
2777 ///
2778 /// The [cudaMemcpyAttributes::srcAccessOrder](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemcpyAttributes.html#structcudamemcpyattributes_1a0d466b9b554cfd529fa0d0344c0c391a) indicates the source access ordering to be observed for copies associated with the attribute. If the source access order is set to [cudaMemcpySrcAccessOrderStream](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga1a0bf7e313a2ef3dcabacefcf8a013b5ab0c0860266a1fe9e640296317e8e32ae), then the source will be accessed in stream order. If the source access order is set to [cudaMemcpySrcAccessOrderDuringApiCall](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga1a0bf7e313a2ef3dcabacefcf8a013b5acf1101b874ba5ffe6ad6d89b7e807b29) 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 [cudaMemcpySrcAccessOrderAny](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga1a0bf7e313a2ef3dcabacefcf8a013b5a17b318d18bd58f8bfb6eb4b44a7d6949) 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 [cudaMemcpyAttributes](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemcpyAttributes.html#structcudamemcpyattributes) corresponding to it including the appropriate srcAccessOrder setting, otherwise the API will return [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c).
2779 ///
2780 /// The [cudaMemcpyAttributes::srcLocHint](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemcpyAttributes.html#structcudamemcpyattributes_1a02741caad443491b1a0504c1fda2e495) and [cudaMemcpyAttributes::dstLocHint](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemcpyAttributes.html#structcudamemcpyattributes_1a1afc02fa1b53087f91d115ee8718dd65) 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 [cudaDevAttrConcurrentManagedAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdac88178f29891f2c18fe67361cc80de09) is true or system-allocated pageable memory on devices where [cudaDevAttrPageableMemoryAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdadc80992427a92713e699953a6d249d6f) is true. For other cases, these hints are ignored.
2781 ///
2782 /// The [cudaMemcpyAttributes::flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemcpyAttributes.html#structcudamemcpyattributes_1af18d7011fefaecb0fa72cbdbf8aad0fb) field can be used to specify certain flags for copies. Setting the [cudaMemcpyFlagPreferOverlapWithCompute](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ggae21aa0690949b1d1e5360e4edcf75dcfafef0e1bac799cb33d1ee092124ced948) 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.
2783 ///
2784 /// # Parameters
2785 ///
2786 /// - `dsts`: Array of destination pointers.
2787 /// - `srcs`: Array of memcpy source pointers.
2788 /// - `sizes`: Array of sizes for memcpy operations.
2789 /// - `count`: Size of `dsts`, `srcs` and `sizes` arrays.
2790 /// - `attrs`: Array of memcpy attributes.
2791 /// - `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.
2792 /// - `numAttrs`: Size of `attrs` and `attrsIdxs` arrays.
2793 /// - `stream`: The stream to enqueue the operations in. Must not be legacy NULL stream.
2794 pub fn cudaMemcpyBatchAsync(
2795 dsts: *const *mut ::core::ffi::c_void,
2796 srcs: *const *const ::core::ffi::c_void,
2797 sizes: *const size_t,
2798 count: size_t,
2799 attrs: *mut cudaMemcpyAttributes,
2800 attrsIdxs: *mut size_t,
2801 numAttrs: size_t,
2802 stream: cudaStream_t,
2803 ) -> cudaError_t;
2804}
2805singe_loader::functions! { crate::RUNTIME;
2806 /// Performs a batch of 3D memory copies asynchronously.
2807 ///
2808 /// 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.
2809 ///
2810 /// 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 [cudaMemcpy3DBatchOp::src](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemcpy3DBatchOp.html#structcudamemcpy3dbatchop_1a8ffb48e0046cf9c16b1f4b7ad83baa31) and [cudaMemcpy3DBatchOp::dst](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemcpy3DBatchOp.html#structcudamemcpy3dbatchop_1a0295c551c9a400a93fa5304a864ccfea) 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 [cudaMemcpy3DBatchOp::extent](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemcpy3DBatchOp.html#structcudamemcpy3dbatchop_1a4368cd2ad50ccd13bef8e7a088e63e3f). 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.
2811 ///
2812 /// For a given operand, if cudaMemcpy3DOperand::type is specified as [cudaMemcpyOperandTypePointer](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ggada2d93832ded1a29fd7cb28a6261ee6ca395369a66615a9cacf1a734334859a67), then ::cudaMemcpy3DOperand::op::ptr will be used. The ::cudaMemcpy3DOperand::op::ptr::ptr field must contain the pointer where the copy should begin. The ::cudaMemcpy3DOperand::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 ::cudaMemcpy3DBatchOp::extent::width. The ::cudaMemcpy3DOperand::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 ::cudaMemcpy3DBatchOp::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 [cudaDevAttrConcurrentManagedAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdac88178f29891f2c18fe67361cc80de09) is true or system-allocated pageable memory on devices where [cudaDevAttrPageableMemoryAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdadc80992427a92713e699953a6d249d6f) is true, the ::cudaMemcpy3DOperand::op::ptr::locHint field can be used to hint the location of the operand.
2813 ///
2814 /// If an operand’s type is specified as [cudaMemcpyOperandTypeArray](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ggada2d93832ded1a29fd7cb28a6261ee6ca468b9e5daeac88a1cddc387310cb2952), then ::cudaMemcpy3DOperand::op::array will be used. The ::cudaMemcpy3DOperand::op::array::array field specifies the CUDA array and ::cudaMemcpy3DOperand::op::array::offset specifies the 3D offset into that array where the copy begins.
2815 ///
2816 /// The [cudaMemcpyAttributes::srcAccessOrder](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemcpyAttributes.html#structcudamemcpyattributes_1a0d466b9b554cfd529fa0d0344c0c391a) indicates the source access ordering to be observed for copies associated with the attribute. If the source access order is set to [cudaMemcpySrcAccessOrderStream](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga1a0bf7e313a2ef3dcabacefcf8a013b5ab0c0860266a1fe9e640296317e8e32ae), then the source will be accessed in stream order. If the source access order is set to [cudaMemcpySrcAccessOrderDuringApiCall](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga1a0bf7e313a2ef3dcabacefcf8a013b5acf1101b874ba5ffe6ad6d89b7e807b29) 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 [cudaMemcpySrcAccessOrderAny](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga1a0bf7e313a2ef3dcabacefcf8a013b5a17b318d18bd58f8bfb6eb4b44a7d6949) 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 [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c).
2817 ///
2818 /// The [cudaMemcpyAttributes::flags](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemcpyAttributes.html#structcudamemcpyattributes_1af18d7011fefaecb0fa72cbdbf8aad0fb) field can be used to specify certain flags for copies. Setting the [cudaMemcpyFlagPreferOverlapWithCompute](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ggae21aa0690949b1d1e5360e4edcf75dcfafef0e1bac799cb33d1ee092124ced948) 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.
2819 ///
2820 /// # Parameters
2821 ///
2822 /// - `numOps`: Total number of memcpy operations.
2823 /// - `opList`: Array of size `numOps` containing the actual memcpy operations.
2824 /// - `flags`: Flags for future use, must be zero now.
2825 /// - `stream`: The stream to enqueue the operations in. Must not be default NULL stream.
2826 pub fn cudaMemcpy3DBatchAsync(
2827 numOps: size_t,
2828 opList: *mut cudaMemcpy3DBatchOp,
2829 flags: ::core::ffi::c_ulonglong,
2830 stream: cudaStream_t,
2831 ) -> cudaError_t;
2832}
2833singe_loader::functions! { crate::RUNTIME;
2834 /// Performs asynchronous memory copy operation with the specified attributes.
2835 ///
2836 /// 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 `stream` specifies the stream to enqueue the operation in.
2837 ///
2838 /// For more information regarding the attributes, please refer to [cudaMemcpyAttributes](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemcpyAttributes.html#structcudamemcpyattributes) and it’s usage desciption in::cudaMemcpyBatchAsync.
2839 ///
2840 /// # Parameters
2841 ///
2842 /// - `dst`: Destination device pointer.
2843 /// - `src`: Source device pointer.
2844 /// - `size`: Number of bytes to copy.
2845 /// - `attr`: Attributes for the copy.
2846 /// - `stream`: Stream to enqueue the operation in.
2847 pub fn cudaMemcpyWithAttributesAsync(
2848 dst: *mut ::core::ffi::c_void,
2849 src: *const ::core::ffi::c_void,
2850 size: size_t,
2851 attr: *mut cudaMemcpyAttributes,
2852 stream: cudaStream_t,
2853 ) -> cudaError_t;
2854}
2855singe_loader::functions! { crate::RUNTIME;
2856 /// Performs 3D asynchronous memory copy with the specified attributes.
2857 ///
2858 /// Performs the copy operation specified in `op`. `flags` specifies the flags for the copy and `stream` specifies the stream to enqueue the operation in.
2859 ///
2860 /// For more information regarding the operation, please refer to [cudaMemcpy3DBatchOp](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemcpy3DBatchOp.html#structcudamemcpy3dbatchop) and it’s usage desciption in::cudaMemcpy3DBatchAsync.
2861 ///
2862 /// # Parameters
2863 ///
2864 /// - `op`: Operation to perform.
2865 /// - `flags`: Flags for the copy, must be zero now.
2866 /// - `stream`: Stream to enqueue the operation in.
2867 pub fn cudaMemcpy3DWithAttributesAsync(
2868 op: *mut cudaMemcpy3DBatchOp,
2869 flags: ::core::ffi::c_ulonglong,
2870 stream: cudaStream_t,
2871 ) -> cudaError_t;
2872}
2873singe_loader::functions! { crate::RUNTIME;
2874 /// Copies data between host and device.
2875 ///
2876 /// Copies a matrix (`height` rows of `width` bytes each) from the memory area pointed to by `src` to the memory area pointed to by `dst`, where `kind` specifies the direction of the copy, and must be one of [`cudaMemcpyKind::cudaMemcpyHostToHost`], [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing. `dpitch` and `spitch` are the widths in memory in bytes of the 2D arrays pointed to by `dst` and `src`, including any padding added to the end of each row. The memory areas may not overlap. `width` must not exceed either `dpitch` or `spitch`.
2877 ///
2878 /// Calling [`cudaMemcpy2DAsync`] with `dst` and `src` pointers that do not match the direction of the copy results in an undefined behavior. [`cudaMemcpy2DAsync`] returns an error if `dpitch` or `spitch` is greater than the maximum allowed.
2879 ///
2880 /// [`cudaMemcpy2DAsync`] is asynchronous with respect to the host, so the call may return before the copy is complete. The copy can optionally be associated to a stream by passing a non-zero `stream` argument. If `kind` is [`cudaMemcpyKind::cudaMemcpyHostToDevice`] or [`cudaMemcpyKind::cudaMemcpyDeviceToHost`] and `stream` is non-zero, the copy may overlap with operations in other streams.
2881 ///
2882 /// The device version of this function only handles device to device copies and cannot be given local or shared pointers.
2883 ///
2884 /// # Parameters
2885 ///
2886 /// - `dst`: Destination memory address.
2887 /// - `dpitch`: Pitch of destination memory.
2888 /// - `src`: Source memory address.
2889 /// - `spitch`: Pitch of source memory.
2890 /// - `width`: Width of matrix transfer (columns in bytes).
2891 /// - `height`: Height of matrix transfer (rows).
2892 /// - `kind`: Type of transfer.
2893 /// - `stream`: Stream identifier.
2894 pub fn cudaMemcpy2DAsync(
2895 dst: *mut ::core::ffi::c_void,
2896 dpitch: size_t,
2897 src: *const ::core::ffi::c_void,
2898 spitch: size_t,
2899 width: size_t,
2900 height: size_t,
2901 kind: cudaMemcpyKind,
2902 stream: cudaStream_t,
2903 ) -> cudaError_t;
2904}
2905singe_loader::functions! { crate::RUNTIME;
2906 /// Copies data between host and device.
2907 ///
2908 /// Copies a matrix (`height` rows of `width` bytes each) from the memory area pointed to by `src` to the CUDA array `dst` starting at `hOffset` rows and `wOffset` bytes from the upper left corner, where `kind` specifies the direction of the copy, and must be one of [`cudaMemcpyKind::cudaMemcpyHostToHost`], [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing. `spitch` is the width in memory in bytes of the 2D array pointed to by `src`, including any padding added to the end of each row. `wOffset` + `width` must not exceed the width of the CUDA array `dst`. `width` must not exceed `spitch`. [`cudaMemcpy2DToArrayAsync`] returns an error if `spitch` exceeds the maximum allowed.
2909 ///
2910 /// [`cudaMemcpy2DToArrayAsync`] is asynchronous with respect to the host, so the call may return before the copy is complete. The copy can optionally be associated to a stream by passing a non-zero `stream` argument. If `kind` is [`cudaMemcpyKind::cudaMemcpyHostToDevice`] or [`cudaMemcpyKind::cudaMemcpyDeviceToHost`] and `stream` is non-zero, the copy may overlap with operations in other streams.
2911 ///
2912 /// [`cudaMemcpy2DFromArrayAsync`], [`cudaMemcpyToSymbolAsync`], [`cudaMemcpyFromSymbolAsync`], ::cuMemcpy2DAsync.
2913 ///
2914 /// # Parameters
2915 ///
2916 /// - `dst`: Destination memory address.
2917 /// - `wOffset`: Destination starting X offset (columns in bytes).
2918 /// - `hOffset`: Destination starting Y offset (rows).
2919 /// - `src`: Source memory address.
2920 /// - `spitch`: Pitch of source memory.
2921 /// - `width`: Width of matrix transfer (columns in bytes).
2922 /// - `height`: Height of matrix transfer (rows).
2923 /// - `kind`: Type of transfer.
2924 /// - `stream`: Stream identifier.
2925 pub fn cudaMemcpy2DToArrayAsync(
2926 dst: cudaArray_t,
2927 wOffset: size_t,
2928 hOffset: size_t,
2929 src: *const ::core::ffi::c_void,
2930 spitch: size_t,
2931 width: size_t,
2932 height: size_t,
2933 kind: cudaMemcpyKind,
2934 stream: cudaStream_t,
2935 ) -> cudaError_t;
2936}
2937singe_loader::functions! { crate::RUNTIME;
2938 /// Copies data between host and device.
2939 ///
2940 /// Copies a matrix (`height` rows of `width` bytes each) from the CUDA array `src` starting at `hOffset` rows and `wOffset` bytes from the upper left corner to the memory area pointed to by `dst`, where `kind` specifies the direction of the copy, and must be one of [`cudaMemcpyKind::cudaMemcpyHostToHost`], [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing. `dpitch` is the width in memory in bytes of the 2D array pointed to by `dst`, including any padding added to the end of each row. `wOffset` + `width` must not exceed the width of the CUDA array `src`. `width` must not exceed `dpitch`. [`cudaMemcpy2DFromArrayAsync`] returns an error if `dpitch` exceeds the maximum allowed.
2941 ///
2942 /// [`cudaMemcpy2DFromArrayAsync`] is asynchronous with respect to the host, so the call may return before the copy is complete. The copy can optionally be associated to a stream by passing a non-zero `stream` argument. If `kind` is [`cudaMemcpyKind::cudaMemcpyHostToDevice`] or [`cudaMemcpyKind::cudaMemcpyDeviceToHost`] and `stream` is non-zero, the copy may overlap with operations in other streams.
2943 ///
2944 /// [`cudaMemcpyToSymbolAsync`], [`cudaMemcpyFromSymbolAsync`], ::cuMemcpy2DAsync.
2945 ///
2946 /// # Parameters
2947 ///
2948 /// - `dst`: Destination memory address.
2949 /// - `dpitch`: Pitch of destination memory.
2950 /// - `src`: Source memory address.
2951 /// - `wOffset`: Source starting X offset (columns in bytes).
2952 /// - `hOffset`: Source starting Y offset (rows).
2953 /// - `width`: Width of matrix transfer (columns in bytes).
2954 /// - `height`: Height of matrix transfer (rows).
2955 /// - `kind`: Type of transfer.
2956 /// - `stream`: Stream identifier.
2957 pub fn cudaMemcpy2DFromArrayAsync(
2958 dst: *mut ::core::ffi::c_void,
2959 dpitch: size_t,
2960 src: cudaArray_const_t,
2961 wOffset: size_t,
2962 hOffset: size_t,
2963 width: size_t,
2964 height: size_t,
2965 kind: cudaMemcpyKind,
2966 stream: cudaStream_t,
2967 ) -> cudaError_t;
2968}
2969singe_loader::functions! { crate::RUNTIME;
2970 /// Copies data to the given symbol on the device.
2971 ///
2972 /// Copies `count` bytes from the memory area pointed to by `src` to the memory area pointed to by `offset` bytes from the start of symbol `symbol`. The memory areas may not overlap. `symbol` is a variable that resides in global or constant memory space. `kind` can be either [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing.
2973 ///
2974 /// [`cudaMemcpyToSymbolAsync`] is asynchronous with respect to the host, so the call may return before the copy is complete. The copy can optionally be associated to a stream by passing a non-zero `stream` argument. If `kind` is [`cudaMemcpyKind::cudaMemcpyHostToDevice`] and `stream` is non-zero, the copy may overlap with operations in other streams.
2975 ///
2976 /// # Parameters
2977 ///
2978 /// - `symbol`: Device symbol address.
2979 /// - `src`: Source memory address.
2980 /// - `count`: Size in bytes to copy.
2981 /// - `offset`: Offset from start of symbol in bytes.
2982 /// - `kind`: Type of transfer.
2983 /// - `stream`: Stream identifier.
2984 pub fn cudaMemcpyToSymbolAsync(
2985 symbol: *const ::core::ffi::c_void,
2986 src: *const ::core::ffi::c_void,
2987 count: size_t,
2988 offset: size_t,
2989 kind: cudaMemcpyKind,
2990 stream: cudaStream_t,
2991 ) -> cudaError_t;
2992}
2993singe_loader::functions! { crate::RUNTIME;
2994 /// Copies data from the given symbol on the device.
2995 ///
2996 /// Copies `count` bytes from the memory area pointed to by `offset` bytes from the start of symbol `symbol` to the memory area pointed to by `dst`. The memory areas may not overlap. `symbol` is a variable that resides in global or constant memory space. `kind` can be either [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing.
2997 ///
2998 /// [`cudaMemcpyFromSymbolAsync`] is asynchronous with respect to the host, so the call may return before the copy is complete. The copy can optionally be associated to a stream by passing a non-zero `stream` argument. If `kind` is [`cudaMemcpyKind::cudaMemcpyDeviceToHost`] and `stream` is non-zero, the copy may overlap with operations in other streams.
2999 ///
3000 /// # Parameters
3001 ///
3002 /// - `dst`: Destination memory address.
3003 /// - `symbol`: Device symbol address.
3004 /// - `count`: Size in bytes to copy.
3005 /// - `offset`: Offset from start of symbol in bytes.
3006 /// - `kind`: Type of transfer.
3007 /// - `stream`: Stream identifier.
3008 pub fn cudaMemcpyFromSymbolAsync(
3009 dst: *mut ::core::ffi::c_void,
3010 symbol: *const ::core::ffi::c_void,
3011 count: size_t,
3012 offset: size_t,
3013 kind: cudaMemcpyKind,
3014 stream: cudaStream_t,
3015 ) -> cudaError_t;
3016}
3017singe_loader::functions! { crate::RUNTIME;
3018 /// Initializes or sets device memory to a value.
3019 ///
3020 /// Fills the first `count` bytes of the memory area pointed to by `devPtr` with the constant byte value `value`.
3021 ///
3022 /// Note that this function is asynchronous with respect to the host unless `devPtr` refers to pinned host memory.
3023 ///
3024 /// # Parameters
3025 ///
3026 /// - `devPtr`: Pointer to device memory.
3027 /// - `value`: Value to set for each byte of specified memory.
3028 /// - `count`: Size in bytes to set.
3029 pub fn cudaMemset(
3030 devPtr: *mut ::core::ffi::c_void,
3031 value: ::core::ffi::c_int,
3032 count: size_t,
3033 ) -> cudaError_t;
3034}
3035singe_loader::functions! { crate::RUNTIME;
3036 /// Initializes or sets device memory to a value.
3037 ///
3038 /// Sets to the specified value `value` a matrix (`height` rows of `width` bytes each) pointed to by `dstPtr`. `pitch` is the width in bytes of the 2D array pointed to by `dstPtr`, including any padding added to the end of each row. This function performs fastest when the pitch is one that has been passed back by [`cudaMallocPitch`].
3039 ///
3040 /// Note that this function is asynchronous with respect to the host unless `devPtr` refers to pinned host memory.
3041 ///
3042 /// # Parameters
3043 ///
3044 /// - `devPtr`: Pointer to 2D device memory.
3045 /// - `pitch`: Pitch in bytes of 2D device memory(Unused if `height` is 1).
3046 /// - `value`: Value to set for each byte of specified memory.
3047 /// - `width`: Width of matrix set (columns in bytes).
3048 /// - `height`: Height of matrix set (rows).
3049 pub fn cudaMemset2D(
3050 devPtr: *mut ::core::ffi::c_void,
3051 pitch: size_t,
3052 value: ::core::ffi::c_int,
3053 width: size_t,
3054 height: size_t,
3055 ) -> cudaError_t;
3056}
3057singe_loader::functions! { crate::RUNTIME;
3058 /// Initializes or sets device memory to a value.
3059 ///
3060 /// Initializes each element of a 3D array to the specified value `value`. The object to initialize is defined by `pitchedDevPtr`. The `pitch` field of `pitchedDevPtr` is the width in memory in bytes of the 3D array pointed to by `pitchedDevPtr`, including any padding added to the end of each row. The `xsize` field specifies the logical width of each row in bytes, while the `ysize` field specifies the height of each 2D slice in rows. The `pitch` field of `pitchedDevPtr` is ignored when `height` and `depth` are both equal to 1.
3061 ///
3062 /// The extents of the initialized region are specified as a `width` in bytes, a `height` in rows, and a `depth` in slices.
3063 ///
3064 /// Extents with `width` greater than or equal to the `xsize` of `pitchedDevPtr` may perform significantly faster than extents narrower than the `xsize`. Secondarily, extents with `height` equal to the `ysize` of `pitchedDevPtr` will perform faster than when the `height` is shorter than the `ysize`.
3065 ///
3066 /// This function performs fastest when the `pitchedDevPtr` has been allocated by [`cudaMalloc3D`].
3067 ///
3068 /// Note that this function is asynchronous with respect to the host unless `pitchedDevPtr` refers to pinned host memory.
3069 ///
3070 /// # Parameters
3071 ///
3072 /// - `pitchedDevPtr`: Pointer to pitched device memory.
3073 /// - `value`: Value to set for each byte of specified memory.
3074 /// - `extent`: Size parameters for where to set device memory (`width` field in bytes).
3075 pub fn cudaMemset3D(
3076 pitchedDevPtr: cudaPitchedPtr,
3077 value: ::core::ffi::c_int,
3078 extent: cudaExtent,
3079 ) -> cudaError_t;
3080}
3081singe_loader::functions! { crate::RUNTIME;
3082 /// Initializes or sets device memory to a value.
3083 ///
3084 /// Fills the first `count` bytes of the memory area pointed to by `devPtr` with the constant byte value `value`.
3085 ///
3086 /// [`cudaMemsetAsync`] is asynchronous with respect to the host, so the call may return before the memset is complete. The operation can optionally be associated to a stream by passing a non-zero `stream` argument. If `stream` is non-zero, the operation may overlap with operations in other streams.
3087 ///
3088 /// The device version of this function only handles device to device copies and cannot be given local or shared pointers.
3089 ///
3090 /// # Parameters
3091 ///
3092 /// - `devPtr`: Pointer to device memory.
3093 /// - `value`: Value to set for each byte of specified memory.
3094 /// - `count`: Size in bytes to set.
3095 /// - `stream`: Stream identifier.
3096 pub fn cudaMemsetAsync(
3097 devPtr: *mut ::core::ffi::c_void,
3098 value: ::core::ffi::c_int,
3099 count: size_t,
3100 stream: cudaStream_t,
3101 ) -> cudaError_t;
3102}
3103singe_loader::functions! { crate::RUNTIME;
3104 /// Initializes or sets device memory to a value.
3105 ///
3106 /// Sets to the specified value `value` a matrix (`height` rows of `width` bytes each) pointed to by `dstPtr`. `pitch` is the width in bytes of the 2D array pointed to by `dstPtr`, including any padding added to the end of each row. This function performs fastest when the pitch is one that has been passed back by [`cudaMallocPitch`].
3107 ///
3108 /// [`cudaMemset2DAsync`] is asynchronous with respect to the host, so the call may return before the memset is complete. The operation can optionally be associated to a stream by passing a non-zero `stream` argument. If `stream` is non-zero, the operation may overlap with operations in other streams.
3109 ///
3110 /// The device version of this function only handles device to device copies and cannot be given local or shared pointers.
3111 ///
3112 /// # Parameters
3113 ///
3114 /// - `devPtr`: Pointer to 2D device memory.
3115 /// - `pitch`: Pitch in bytes of 2D device memory(Unused if `height` is 1).
3116 /// - `value`: Value to set for each byte of specified memory.
3117 /// - `width`: Width of matrix set (columns in bytes).
3118 /// - `height`: Height of matrix set (rows).
3119 /// - `stream`: Stream identifier.
3120 pub fn cudaMemset2DAsync(
3121 devPtr: *mut ::core::ffi::c_void,
3122 pitch: size_t,
3123 value: ::core::ffi::c_int,
3124 width: size_t,
3125 height: size_t,
3126 stream: cudaStream_t,
3127 ) -> cudaError_t;
3128}
3129singe_loader::functions! { crate::RUNTIME;
3130 /// Initializes or sets device memory to a value.
3131 ///
3132 /// Initializes each element of a 3D array to the specified value `value`. The object to initialize is defined by `pitchedDevPtr`. The `pitch` field of `pitchedDevPtr` is the width in memory in bytes of the 3D array pointed to by `pitchedDevPtr`, including any padding added to the end of each row. The `xsize` field specifies the logical width of each row in bytes, while the `ysize` field specifies the height of each 2D slice in rows. The `pitch` field of `pitchedDevPtr` is ignored when `height` and `depth` are both equal to 1.
3133 ///
3134 /// The extents of the initialized region are specified as a `width` in bytes, a `height` in rows, and a `depth` in slices.
3135 ///
3136 /// Extents with `width` greater than or equal to the `xsize` of `pitchedDevPtr` may perform significantly faster than extents narrower than the `xsize`. Secondarily, extents with `height` equal to the `ysize` of `pitchedDevPtr` will perform faster than when the `height` is shorter than the `ysize`.
3137 ///
3138 /// This function performs fastest when the `pitchedDevPtr` has been allocated by [`cudaMalloc3D`].
3139 ///
3140 /// [`cudaMemset3DAsync`] is asynchronous with respect to the host, so the call may return before the memset is complete. The operation can optionally be associated to a stream by passing a non-zero `stream` argument. If `stream` is non-zero, the operation may overlap with operations in other streams.
3141 ///
3142 /// The device version of this function only handles device to device copies and cannot be given local or shared pointers.
3143 ///
3144 /// # Parameters
3145 ///
3146 /// - `pitchedDevPtr`: Pointer to pitched device memory.
3147 /// - `value`: Value to set for each byte of specified memory.
3148 /// - `extent`: Size parameters for where to set device memory (`width` field in bytes).
3149 /// - `stream`: Stream identifier.
3150 pub fn cudaMemset3DAsync(
3151 pitchedDevPtr: cudaPitchedPtr,
3152 value: ::core::ffi::c_int,
3153 extent: cudaExtent,
3154 stream: cudaStream_t,
3155 ) -> cudaError_t;
3156}
3157singe_loader::functions! { crate::RUNTIME;
3158 /// Finds the address associated with a CUDA symbol.
3159 ///
3160 /// Returns in `*devPtr` the address of symbol `symbol` on the device. `symbol` is a variable that resides in global or constant memory space. If `symbol` cannot be found, or if `symbol` is not declared in the global or constant memory space, `*devPtr` is unchanged and the error [cudaErrorInvalidSymbol](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a01a4a97f3060ec714ffa9dd650b9213a) is returned.
3161 ///
3162 /// # Parameters
3163 ///
3164 /// - `devPtr`: Return device pointer associated with symbol.
3165 /// - `symbol`: Device symbol address.
3166 pub fn cudaGetSymbolAddress(
3167 devPtr: *mut *mut ::core::ffi::c_void,
3168 symbol: *const ::core::ffi::c_void,
3169 ) -> cudaError_t;
3170}
3171singe_loader::functions! { crate::RUNTIME;
3172 /// Finds the size of the object associated with a CUDA symbol.
3173 ///
3174 /// Returns in `*size` the size of symbol `symbol`. `symbol` is a variable that resides in global or constant memory space. If `symbol` cannot be found, or if `symbol` is not declared in global or constant memory space, `*size` is unchanged and the error [cudaErrorInvalidSymbol](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a01a4a97f3060ec714ffa9dd650b9213a) is returned.
3175 ///
3176 /// # Parameters
3177 ///
3178 /// - `size`: Size of object associated with symbol.
3179 /// - `symbol`: Device symbol address.
3180 pub fn cudaGetSymbolSize(
3181 size: *mut size_t,
3182 symbol: *const ::core::ffi::c_void,
3183 ) -> cudaError_t;
3184}
3185singe_loader::functions! { crate::RUNTIME;
3186 /// Prefetches memory to the specified destination location.
3187 ///
3188 /// 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. `stream` is the stream in which the operation is enqueued. The memory range must refer to managed memory allocated via [`cudaMallocManaged`] or declared via **managed** variables, or it may also refer to memory allocated from a managed memory pool, or it may also refer to system-allocated memory on systems with non-zero cudaDevAttrPageableMemoryAccess.
3189 ///
3190 /// Specifying [cudaMemLocationTypeDevice](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0ae479b8710f3c5270117ee9d8cf5868d4) for [cudaMemLocation::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemLocation.html#structcudamemlocation_1a6df2243c9f48e48ad92306df676b2fe0) will prefetch memory to GPU specified by device ordinal [cudaMemLocation::id](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemLocation.html#structcudamemlocation_1a1c914cd5c3cc7323b4fde9756458efb0) which must have non-zero value for the device attribute ::concurrentManagedAccess. Additionally, `stream` must be associated with a device that has a non-zero value for the device attribute ::concurrentManagedAccess. Specifying [cudaMemLocationTypeHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a1ec97ff5f3c715e4b18e39dabf9e31c5) as [cudaMemLocation::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemLocation.html#structcudamemlocation_1a6df2243c9f48e48ad92306df676b2fe0) will prefetch data to host memory. Applications can request prefetching memory to a specific host NUMA node by specifying [cudaMemLocationTypeHostNuma](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a24dc63fb938dee27b41e3842da35d2d0) for [cudaMemLocation::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemLocation.html#structcudamemlocation_1a6df2243c9f48e48ad92306df676b2fe0) and a valid host NUMA node id in [cudaMemLocation::id](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemLocation.html#structcudamemlocation_1a1c914cd5c3cc7323b4fde9756458efb0) Users can also request prefetching memory to the host NUMA node closest to the current thread’s CPU by specifying [cudaMemLocationTypeHostNumaCurrent](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0aa3925690e32332c940cb726ef56a4258) for [cudaMemLocation::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemLocation.html#structcudamemlocation_1a6df2243c9f48e48ad92306df676b2fe0). Note when [cudaMemLocation::type](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemLocation.html#structcudamemlocation_1a6df2243c9f48e48ad92306df676b2fe0) is etiher [cudaMemLocationTypeHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a1ec97ff5f3c715e4b18e39dabf9e31c5) OR [cudaMemLocationTypeHostNumaCurrent](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0aa3925690e32332c940cb726ef56a4258), [cudaMemLocation::id](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemLocation.html#structcudamemlocation_1a1c914cd5c3cc7323b4fde9756458efb0) will be ignored. Prefetching to [cudaMemLocationTypeDeviceLocalityDomain](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a88b5d659aa9d7501f0382836eebb125b) locations is not supported.
3191 ///
3192 /// 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.
3193 ///
3194 /// 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 [`cudaMallocManaged`] allocations to host memory in order to make room. Device memory allocated using [`cudaMalloc`] or [`cudaMallocArray`] will not be evicted.
3195 ///
3196 /// 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:
3197 ///
3198 /// If [cudaMemAdviseSetReadMostly](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ggac314a8b14091f7e02a7ad15dcb36c857a441d911811beda174627f403142d5ff0) 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.
3199 ///
3200 /// If [cudaMemAdviseSetPreferredLocation](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ggac314a8b14091f7e02a7ad15dcb36c857aa4a2bc3c7d218dcd9a1b425b432759eb) 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.
3201 ///
3202 /// If [cudaMemAdviseSetAccessedBy](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ggac314a8b14091f7e02a7ad15dcb36c857a50a22279bce0dc29956ad4f257084623) 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.
3203 ///
3204 /// 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.
3205 ///
3206 /// Note that this function is asynchronous with respect to the host and all work on other devices.
3207 ///
3208 /// # Parameters
3209 ///
3210 /// - `devPtr`: Pointer to be prefetched.
3211 /// - `count`: Size in bytes.
3212 /// - `location`: location to prefetch to.
3213 /// - `flags`: flags for future use, must be zero now.
3214 /// - `stream`: Stream to enqueue prefetch operation.
3215 pub fn cudaMemPrefetchAsync(
3216 devPtr: *const ::core::ffi::c_void,
3217 count: size_t,
3218 location: cudaMemLocation,
3219 flags: ::core::ffi::c_uint,
3220 stream: cudaStream_t,
3221 ) -> cudaError_t;
3222}
3223singe_loader::functions! { crate::RUNTIME;
3224 /// Performs a batch of memory prefetches asynchronously.
3225 ///
3226 /// 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 [cudaDevAttrConcurrentManagedAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdac88178f29891f2c18fe67361cc80de09) otherwise the API will return an error.
3227 ///
3228 /// The semantics of the individual prefetch operations are as described in [`cudaMemPrefetchAsync`].
3229 ///
3230 /// 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 [`cudaMallocManaged`] or declared via **managed** variables or it may also refer to system-allocated memory when all devices have a non-zero value for [cudaDevAttrPageableMemoryAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdadc80992427a92713e699953a6d249d6f). 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`.
3231 ///
3232 /// # Parameters
3233 ///
3234 /// - `dptrs`: Array of pointers to be prefetched.
3235 /// - `sizes`: Array of sizes for memory prefetch operations.
3236 /// - `count`: Size of `dptrs` and `sizes` arrays.
3237 /// - `prefetchLocs`: Array of locations to prefetch to.
3238 /// - `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.
3239 /// - `numPrefetchLocs`: Size of `prefetchLocs` and `prefetchLocIdxs` arrays.
3240 /// - `flags`: Flags reserved for future use. Must be zero.
3241 /// - `stream`: The stream to enqueue the operations in. Must not be legacy NULL stream.
3242 pub fn cudaMemPrefetchBatchAsync(
3243 dptrs: *mut *mut ::core::ffi::c_void,
3244 sizes: *mut size_t,
3245 count: size_t,
3246 prefetchLocs: *mut cudaMemLocation,
3247 prefetchLocIdxs: *mut size_t,
3248 numPrefetchLocs: size_t,
3249 flags: ::core::ffi::c_ulonglong,
3250 stream: cudaStream_t,
3251 ) -> cudaError_t;
3252}
3253singe_loader::functions! { crate::RUNTIME;
3254 /// Performs a batch of memory discards asynchronously.
3255 ///
3256 /// 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 [cudaDevAttrConcurrentManagedAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdac88178f29891f2c18fe67361cc80de09) otherwise the API will return an error.
3257 ///
3258 /// 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 [`cudaMemPrefetchAsync`] or [`cudaMemPrefetchBatchAsync`]. 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.
3259 ///
3260 /// 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 [`cudaMallocManaged`] or declared via **managed** variables or it may also refer to system-allocated memory when all devices have a non-zero value for [cudaDevAttrPageableMemoryAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdadc80992427a92713e699953a6d249d6f).
3261 ///
3262 /// # Parameters
3263 ///
3264 /// - `dptrs`: Array of pointers to be discarded.
3265 /// - `sizes`: Array of sizes for memory discard operations.
3266 /// - `count`: Size of `dptrs` and `sizes` arrays.
3267 /// - `flags`: Flags reserved for future use. Must be zero.
3268 /// - `stream`: The stream to enqueue the operations in. Must not be legacy NULL stream.
3269 pub fn cudaMemDiscardBatchAsync(
3270 dptrs: *mut *mut ::core::ffi::c_void,
3271 sizes: *mut size_t,
3272 count: size_t,
3273 flags: ::core::ffi::c_ulonglong,
3274 stream: cudaStream_t,
3275 ) -> cudaError_t;
3276}
3277singe_loader::functions! { crate::RUNTIME;
3278 /// Performs a batch of memory discards and prefetches asynchronously.
3279 ///
3280 /// 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 [cudaDevAttrConcurrentManagedAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdac88178f29891f2c18fe67361cc80de09) otherwise the API will return an error.
3281 ///
3282 /// Calling [`cudaMemDiscardAndPrefetchBatchAsync`] is semantically equivalent to calling [`cudaMemDiscardBatchAsync`] followed by [`cudaMemPrefetchBatchAsync`], but is more optimal. For more details on what discarding and prefetching imply, please refer to [`cudaMemDiscardBatchAsync`] and [`cudaMemPrefetchBatchAsync`] 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.
3283 ///
3284 /// 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 [`cudaMallocManaged`] or declared via **managed** variables or it may also refer to system-allocated memory when all devices have a non-zero value for [cudaDevAttrPageableMemoryAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdadc80992427a92713e699953a6d249d6f). 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`.
3285 ///
3286 /// # Parameters
3287 ///
3288 /// - `dptrs`: Array of pointers to be discarded.
3289 /// - `sizes`: Array of sizes for memory discard operations.
3290 /// - `count`: Size of `dptrs` and `sizes` arrays.
3291 /// - `prefetchLocs`: Array of locations to prefetch to.
3292 /// - `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.
3293 /// - `numPrefetchLocs`: Size of `prefetchLocs` and `prefetchLocIdxs` arrays.
3294 /// - `flags`: Flags reserved for future use. Must be zero.
3295 /// - `stream`: The stream to enqueue the operations in. Must not be legacy NULL stream.
3296 pub fn cudaMemDiscardAndPrefetchBatchAsync(
3297 dptrs: *mut *mut ::core::ffi::c_void,
3298 sizes: *mut size_t,
3299 count: size_t,
3300 prefetchLocs: *mut cudaMemLocation,
3301 prefetchLocIdxs: *mut size_t,
3302 numPrefetchLocs: size_t,
3303 flags: ::core::ffi::c_ulonglong,
3304 stream: cudaStream_t,
3305 ) -> cudaError_t;
3306}
3307singe_loader::functions! { crate::RUNTIME;
3308 /// Gets location information for a memory address range.
3309 ///
3310 /// Retrieves memory location information for the specified address range starting at `ptr` with size `size`. The API determines the most common location by sampling memory at intervals defined by `samplingGranularity` within the whole interval.
3311 ///
3312 /// 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.
3313 ///
3314 /// For example, with an address range of 1GB, a `summaryGranularity` of 128MB, and a `samplingGranularity` of 2MB, the function will:
3315 ///
3316 /// When the memory is not resident on any processor, the call returns [cudaSuccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ae355f04607d824883b4a50662830d591) and the returned location type for that interval is [cudaMemLocationTypeNone](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a53b6266fa56e0b7efe6a0b78ed8e8f49).
3317 ///
3318 /// The memory range must refer to one of the following:
3319 ///
3320 /// All devices on the system must have non-zero value for the device attribute [cudaDevAttrConcurrentManagedAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdac88178f29891f2c18fe67361cc80de09). If not, this call returns [cudaErrorNotSupported](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ad846fd9f2e8ba5e2fb4f1695b7ab6164).
3321 ///
3322 /// # Parameters
3323 ///
3324 /// - `size`: Size in bytes of the memory range to query.
3325 /// - `summaryGranularity`: Granularity in bytes at which to summarize location information.
3326 /// - `samplingGranularity`: Granularity in bytes at which to sample memory within each summary region.
3327 /// - `location_out`: Array to store location information, one entry per summary region.
3328 pub fn cudaMemGetLocationInfo(
3329 devPtr: *mut ::core::ffi::c_void,
3330 size: size_t,
3331 summaryGranularity: size_t,
3332 samplingGranularity: size_t,
3333 location_out: *mut cudaMemLocation,
3334 ) -> cudaError_t;
3335}
3336singe_loader::functions! { crate::RUNTIME;
3337 /// Advise about the usage of a given memory range.
3338 ///
3339 /// 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 [`cudaMallocManaged`] 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.
3340 ///
3341 /// The `advice` parameter can take the following values.
3342 ///
3343 /// # Parameters
3344 ///
3345 /// - `devPtr`: Pointer to memory to set the advice for.
3346 /// - `count`: Size in bytes of the memory range.
3347 /// - `advice`: Advice to be applied for the specified memory range.
3348 /// - `location`: location to apply the advice for.
3349 pub fn cudaMemAdvise(
3350 devPtr: *const ::core::ffi::c_void,
3351 count: size_t,
3352 advice: cudaMemoryAdvise,
3353 location: cudaMemLocation,
3354 ) -> cudaError_t;
3355}
3356singe_loader::functions! { crate::RUNTIME;
3357 /// Query an attribute of a given memory range.
3358 ///
3359 /// 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 [`cudaMallocManaged`] or declared via **managed** variables.
3360 ///
3361 /// The `attribute` parameter can take the following values.
3362 ///
3363 /// # Parameters
3364 ///
3365 /// - `data`: A pointers to a memory location where the result of each attribute query will be written to.
3366 /// - `dataSize`: Array containing the size of data.
3367 /// - `attribute`: The attribute to query.
3368 /// - `devPtr`: Start of the range to query.
3369 /// - `count`: Size of the range to query.
3370 pub fn cudaMemRangeGetAttribute(
3371 data: *mut ::core::ffi::c_void,
3372 dataSize: size_t,
3373 attribute: cudaMemRangeAttribute,
3374 devPtr: *const ::core::ffi::c_void,
3375 count: size_t,
3376 ) -> cudaError_t;
3377}
3378singe_loader::functions! { crate::RUNTIME;
3379 /// Query attributes of a given memory range.
3380 ///
3381 /// 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 [`cudaMallocManaged`] 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`.
3382 ///
3383 /// The list of supported attributes are given below. Please refer to [`cudaMemRangeGetAttribute`] for attribute descriptions and restrictions.
3384 ///
3385 /// # Parameters
3386 ///
3387 /// - `data`: A two-dimensional array containing pointers to memory locations where the result of each attribute query will be written to.
3388 /// - `dataSizes`: Array containing the sizes of each result.
3389 /// - `attributes`: An array of attributes to query (numAttributes and the number of attributes in this array should match).
3390 /// - `numAttributes`: Number of attributes to query.
3391 /// - `devPtr`: Start of the range to query.
3392 /// - `count`: Size of the range to query.
3393 pub fn cudaMemRangeGetAttributes(
3394 data: *mut *mut ::core::ffi::c_void,
3395 dataSizes: *mut size_t,
3396 attributes: *mut cudaMemRangeAttribute,
3397 numAttributes: size_t,
3398 devPtr: *const ::core::ffi::c_void,
3399 count: size_t,
3400 ) -> cudaError_t;
3401}
3402singe_loader::functions! { crate::RUNTIME;
3403 /// Copies data between host and device.
3404 ///
3405 /// Copies `count` bytes from the memory area pointed to by `src` to the CUDA array `dst` starting at `hOffset` rows and `wOffset` bytes from the upper left corner, where `kind` specifies the direction of the copy, and must be one of [`cudaMemcpyKind::cudaMemcpyHostToHost`], [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing.
3406 ///
3407 /// # Parameters
3408 ///
3409 /// - `dst`: Destination memory address.
3410 /// - `wOffset`: Destination starting X offset (columns in bytes).
3411 /// - `hOffset`: Destination starting Y offset (rows).
3412 /// - `src`: Source memory address.
3413 /// - `count`: Size in bytes to copy.
3414 /// - `kind`: Type of transfer.
3415 #[deprecated]
3416 pub fn cudaMemcpyToArray(
3417 dst: cudaArray_t,
3418 wOffset: size_t,
3419 hOffset: size_t,
3420 src: *const ::core::ffi::c_void,
3421 count: size_t,
3422 kind: cudaMemcpyKind,
3423 ) -> cudaError_t;
3424}
3425singe_loader::functions! { crate::RUNTIME;
3426 /// Copies data between host and device.
3427 ///
3428 /// Copies `count` bytes from the CUDA array `src` starting at `hOffset` rows and `wOffset` bytes from the upper left corner to the memory area pointed to by `dst`, where `kind` specifies the direction of the copy, and must be one of [`cudaMemcpyKind::cudaMemcpyHostToHost`], [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing.
3429 ///
3430 /// # Parameters
3431 ///
3432 /// - `dst`: Destination memory address.
3433 /// - `src`: Source memory address.
3434 /// - `wOffset`: Source starting X offset (columns in bytes).
3435 /// - `hOffset`: Source starting Y offset (rows).
3436 /// - `count`: Size in bytes to copy.
3437 /// - `kind`: Type of transfer.
3438 #[deprecated]
3439 pub fn cudaMemcpyFromArray(
3440 dst: *mut ::core::ffi::c_void,
3441 src: cudaArray_const_t,
3442 wOffset: size_t,
3443 hOffset: size_t,
3444 count: size_t,
3445 kind: cudaMemcpyKind,
3446 ) -> cudaError_t;
3447}
3448singe_loader::functions! { crate::RUNTIME;
3449 /// Copies data between host and device.
3450 ///
3451 /// Copies `count` bytes from the CUDA array `src` starting at `hOffsetSrc` rows and `wOffsetSrc` bytes from the upper left corner to the CUDA array `dst` starting at `hOffsetDst` rows and `wOffsetDst` bytes from the upper left corner, where `kind` specifies the direction of the copy, and must be one of [`cudaMemcpyKind::cudaMemcpyHostToHost`], [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing.
3452 ///
3453 /// # Parameters
3454 ///
3455 /// - `dst`: Destination memory address.
3456 /// - `wOffsetDst`: Destination starting X offset (columns in bytes).
3457 /// - `hOffsetDst`: Destination starting Y offset (rows).
3458 /// - `src`: Source memory address.
3459 /// - `wOffsetSrc`: Source starting X offset (columns in bytes).
3460 /// - `hOffsetSrc`: Source starting Y offset (rows).
3461 /// - `count`: Size in bytes to copy.
3462 /// - `kind`: Type of transfer.
3463 #[deprecated]
3464 pub fn cudaMemcpyArrayToArray(
3465 dst: cudaArray_t,
3466 wOffsetDst: size_t,
3467 hOffsetDst: size_t,
3468 src: cudaArray_const_t,
3469 wOffsetSrc: size_t,
3470 hOffsetSrc: size_t,
3471 count: size_t,
3472 kind: cudaMemcpyKind,
3473 ) -> cudaError_t;
3474}
3475singe_loader::functions! { crate::RUNTIME;
3476 /// Copies data between host and device.
3477 ///
3478 /// Copies `count` bytes from the memory area pointed to by `src` to the CUDA array `dst` starting at `hOffset` rows and `wOffset` bytes from the upper left corner, where `kind` specifies the direction of the copy, and must be one of [`cudaMemcpyKind::cudaMemcpyHostToHost`], [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing.
3479 ///
3480 /// [`cudaMemcpyToArrayAsync`] is asynchronous with respect to the host, so the call may return before the copy is complete. The copy can optionally be associated to a stream by passing a non-zero `stream` argument. If `kind` is [`cudaMemcpyKind::cudaMemcpyHostToDevice`] or [`cudaMemcpyKind::cudaMemcpyDeviceToHost`] and `stream` is non-zero, the copy may overlap with operations in other streams.
3481 ///
3482 /// # Parameters
3483 ///
3484 /// - `dst`: Destination memory address.
3485 /// - `wOffset`: Destination starting X offset (columns in bytes).
3486 /// - `hOffset`: Destination starting Y offset (rows).
3487 /// - `src`: Source memory address.
3488 /// - `count`: Size in bytes to copy.
3489 /// - `kind`: Type of transfer.
3490 /// - `stream`: Stream identifier.
3491 #[deprecated]
3492 pub fn cudaMemcpyToArrayAsync(
3493 dst: cudaArray_t,
3494 wOffset: size_t,
3495 hOffset: size_t,
3496 src: *const ::core::ffi::c_void,
3497 count: size_t,
3498 kind: cudaMemcpyKind,
3499 stream: cudaStream_t,
3500 ) -> cudaError_t;
3501}
3502singe_loader::functions! { crate::RUNTIME;
3503 /// Copies data between host and device.
3504 ///
3505 /// Copies `count` bytes from the CUDA array `src` starting at `hOffset` rows and `wOffset` bytes from the upper left corner to the memory area pointed to by `dst`, where `kind` specifies the direction of the copy, and must be one of [`cudaMemcpyKind::cudaMemcpyHostToHost`], [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing.
3506 ///
3507 /// [`cudaMemcpyFromArrayAsync`] is asynchronous with respect to the host, so the call may return before the copy is complete. The copy can optionally be associated to a stream by passing a non-zero `stream` argument. If `kind` is [`cudaMemcpyKind::cudaMemcpyHostToDevice`] or [`cudaMemcpyKind::cudaMemcpyDeviceToHost`] and `stream` is non-zero, the copy may overlap with operations in other streams.
3508 ///
3509 /// # Parameters
3510 ///
3511 /// - `dst`: Destination memory address.
3512 /// - `src`: Source memory address.
3513 /// - `wOffset`: Source starting X offset (columns in bytes).
3514 /// - `hOffset`: Source starting Y offset (rows).
3515 /// - `count`: Size in bytes to copy.
3516 /// - `kind`: Type of transfer.
3517 /// - `stream`: Stream identifier.
3518 #[deprecated]
3519 pub fn cudaMemcpyFromArrayAsync(
3520 dst: *mut ::core::ffi::c_void,
3521 src: cudaArray_const_t,
3522 wOffset: size_t,
3523 hOffset: size_t,
3524 count: size_t,
3525 kind: cudaMemcpyKind,
3526 stream: cudaStream_t,
3527 ) -> cudaError_t;
3528}
3529singe_loader::functions! { crate::RUNTIME;
3530 /// Allocates memory with stream ordered semantics
3531 ///
3532 /// 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 the allocation operation completes. The allocation comes from the memory pool associated with the stream's device.
3533 ///
3534 ///
3535 ///
3536 /// Note: The default memory pool of a device contains device memory from that device.
3537 ///
3538 /// Note: Basic stream ordering allows future work submitted into the same stream to use the allocation. Stream query, stream synchronize, and CUDA events can be used to guarantee that the allocation operation completes before work submitted in a separate stream runs.
3539 ///
3540 /// Note: During stream capture, this function results in the creation of an allocation node. In this case, the allocation is owned by the graph instead of the memory pool. The memory pool's properties are used to set the node's creation parameters.
3541 ///
3542 ///
3543 ///
3544 ///
3545 ///
3546 /// # Return value
3547 ///
3548 /// ::cudaSuccess, ::cudaErrorInvalidValue, ::cudaErrorNotSupported, ::cudaErrorOutOfMemory,
3549 ///
3550 /// Note: _null_stream
3551 ///
3552 /// Note: _init_rt
3553 ///
3554 /// Note: _callback
3555 ///
3556 ///
3557 ///
3558 /// See also: ::cuMemAllocAsync, `::cudaMallocAsync(void**` ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) "cudaMallocAsync (C++ API)", ::cudaMallocFromPoolAsync, ::cudaFreeAsync, ::cudaDeviceSetMemPool, ::cudaDeviceGetDefaultMemPool, ::cudaDeviceGetMemPool, ::cudaMemPoolSetAccess, ::cudaMemPoolSetAttribute, ::cudaMemPoolGetAttribute
3559 ///
3560 /// # Parameters
3561 ///
3562 /// - `devPtr`: - Returned device pointer
3563 /// - `size`: - Number of bytes to allocate
3564 /// - `hStream`: - The stream establishing the stream ordering contract and the memory pool to allocate from
3565 pub fn cudaMallocAsync(
3566 devPtr: *mut *mut ::core::ffi::c_void,
3567 size: size_t,
3568 hStream: cudaStream_t,
3569 ) -> cudaError_t;
3570}
3571singe_loader::functions! { crate::RUNTIME;
3572 /// Frees memory with stream ordered semantics.
3573 ///
3574 /// 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.
3575 ///
3576 /// # Parameters
3577 ///
3578 /// - `hStream`: The stream establishing the stream ordering promise.
3579 pub fn cudaFreeAsync(
3580 devPtr: *mut ::core::ffi::c_void,
3581 hStream: cudaStream_t,
3582 ) -> cudaError_t;
3583}
3584singe_loader::functions! { crate::RUNTIME;
3585 /// Tries to release memory back to the OS.
3586 ///
3587 /// 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.
3588 ///
3589 /// # Parameters
3590 ///
3591 /// - `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.
3592 pub fn cudaMemPoolTrimTo(
3593 memPool: cudaMemPool_t,
3594 minBytesToKeep: size_t,
3595 ) -> cudaError_t;
3596}
3597singe_loader::functions! { crate::RUNTIME;
3598 /// Sets attributes of a memory pool.
3599 ///
3600 /// Supported attributes are.
3601 ///
3602 /// # Parameters
3603 ///
3604 /// - `attr`: The attribute to modify.
3605 /// - `value`: Pointer to the value to assign.
3606 pub fn cudaMemPoolSetAttribute(
3607 memPool: cudaMemPool_t,
3608 attr: cudaMemPoolAttr,
3609 value: *mut ::core::ffi::c_void,
3610 ) -> cudaError_t;
3611}
3612singe_loader::functions! { crate::RUNTIME;
3613 /// Gets attributes of a memory pool.
3614 ///
3615 /// Supported attributes are:
3616 ///
3617 /// The following properties can be also be queried on imported and default pools.
3618 ///
3619 /// # Parameters
3620 ///
3621 /// - `attr`: The attribute to get.
3622 /// - `value`: Retrieved value.
3623 pub fn cudaMemPoolGetAttribute(
3624 memPool: cudaMemPool_t,
3625 attr: cudaMemPoolAttr,
3626 value: *mut ::core::ffi::c_void,
3627 ) -> cudaError_t;
3628}
3629singe_loader::functions! { crate::RUNTIME;
3630 /// Controls visibility of pools between devices.
3631 ///
3632 /// # Parameters
3633 ///
3634 /// - `count`: Number of descriptors in the map array.
3635 pub fn cudaMemPoolSetAccess(
3636 memPool: cudaMemPool_t,
3637 descList: *const cudaMemAccessDesc,
3638 count: size_t,
3639 ) -> cudaError_t;
3640}
3641singe_loader::functions! { crate::RUNTIME;
3642 /// Returns the accessibility of a pool from a device.
3643 ///
3644 /// Returns the accessibility of the pool’s memory from the specified location.
3645 ///
3646 /// # Parameters
3647 ///
3648 /// - `flags`: the accessibility of the pool from the specified location.
3649 /// - `memPool`: the pool being queried.
3650 /// - `location`: the location accessing the pool.
3651 pub fn cudaMemPoolGetAccess(
3652 flags: *mut cudaMemAccessFlags,
3653 memPool: cudaMemPool_t,
3654 location: *mut cudaMemLocation,
3655 ) -> cudaError_t;
3656}
3657singe_loader::functions! { crate::RUNTIME;
3658 /// Creates a memory pool.
3659 ///
3660 /// 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.
3661 ///
3662 /// To create a memory pool for host memory not targeting a specific NUMA node, applications must set set ::cudaMemPoolProps::cudaMemLocation::type to [cudaMemLocationTypeHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a1ec97ff5f3c715e4b18e39dabf9e31c5). ::cudaMemPoolProps::cudaMemLocation::id is ignored for such pools. Pools created with the type [cudaMemLocationTypeHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a1ec97ff5f3c715e4b18e39dabf9e31c5) are not IPC capable and [cudaMemPoolProps::handleTypes](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemPoolProps.html#structcudamempoolprops_1a4cf896bffe71384e374c4d2decca9a53) must be 0, any other values will result in [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c). To create a memory pool targeting a specific host NUMA node, applications must set ::cudaMemPoolProps::cudaMemLocation::type to [cudaMemLocationTypeHostNuma](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a24dc63fb938dee27b41e3842da35d2d0) and ::cudaMemPoolProps::cudaMemLocation::id must specify the NUMA ID of the host memory node. Specifying [cudaMemLocationTypeHostNumaCurrent](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0aa3925690e32332c940cb726ef56a4258) as the ::cudaMemPoolProps::cudaMemLocation::type will result in [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c). To create a memory pool targeting a specific device locality domain, applications must set ::cudaMemPoolProps::cudaMemLocation::type to [cudaMemLocationTypeDeviceLocalityDomain](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a88b5d659aa9d7501f0382836eebb125b), ::cudaMemPoolProps::cudaMemLocation::localized.deviceId must specify the device ID, and ::cudaMemPoolProps::cudaMemLocation::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 [`cudaDeviceGetAttribute`] with the attribute [cudaDevAttrLocalityDomainCount](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cda53544b5a7a807fb2c96f15dda587500d). By default, the pool’s memory will be accessible from the device it is allocated on. In the case of pools created with [cudaMemLocationTypeHostNuma](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a24dc63fb938dee27b41e3842da35d2d0) or [cudaMemLocationTypeHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a1ec97ff5f3c715e4b18e39dabf9e31c5), 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 [cudaMemPoolProps::maxSize](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemPoolProps.html#structcudamempoolprops_1a2d90e82afb8d577a2aee847d082e145d). If set to 0, the maximum size of the pool will default to a system dependent value.
3663 ///
3664 /// Applications that intend to use ::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.
3665 ///
3666 /// When exporter and importer CUDA processes have been granted access to the same IMEX channel, they can securely share memory.
3667 ///
3668 /// 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.
3669 ///
3670 /// 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`
3671 ///
3672 /// To create a managed memory pool, applications must set [cudaMemPoolProps](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemPoolProps.html#structcudamempoolprops):cudaMemAllocationType to [`cudaMemAllocationType::cudaMemAllocationTypeManaged`]. ::cudaMemPoolProps::cudaMemAllocationHandleType must also be set to [cudaMemHandleTypeNone](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ggaabde707dfb8a602b917e0b177f77f365afed45251c1591431e1b9da28c1a04191) since IPC is not supported. For managed memory pools, ::cudaMemPoolProps::cudaMemLocation will be treated as the preferred location for all allocations created from the pool. An application can also set [cudaMemLocationTypeNone](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a53b6266fa56e0b7efe6a0b78ed8e8f49) to indicate no preferred location. [cudaMemPoolProps::maxSize](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemPoolProps.html#structcudamempoolprops_1a2d90e82afb8d577a2aee847d082e145d) must be set to zero for managed memory pools. [cudaMemPoolProps::usage](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaMemPoolProps.html#structcudamempoolprops_1a377241affe79dd0a3c7b40453824bd6b) 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 [cudaErrorNotSupported](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ad846fd9f2e8ba5e2fb4f1695b7ab6164).
3673 pub fn cudaMemPoolCreate(
3674 memPool: *mut cudaMemPool_t,
3675 poolProps: *const cudaMemPoolProps,
3676 ) -> cudaError_t;
3677}
3678singe_loader::functions! { crate::RUNTIME;
3679 /// Destroys the specified memory pool.
3680 ///
3681 /// If any pointers obtained from this pool haven’t been freed or the pool has free operations that haven’t completed when [`cudaMemPoolDestroy`] 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.
3682 ///
3683 /// Destroying the current mempool of a device sets the default mempool of that device as the current mempool for that device.
3684 pub fn cudaMemPoolDestroy(memPool: cudaMemPool_t) -> cudaError_t;
3685}
3686singe_loader::functions! { crate::RUNTIME;
3687 /// Returns the default memory pool for a given location and allocation type.
3688 ///
3689 /// The memory location can be of one of [cudaMemLocationTypeDevice](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0ae479b8710f3c5270117ee9d8cf5868d4), [cudaMemLocationTypeHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a1ec97ff5f3c715e4b18e39dabf9e31c5), [cudaMemLocationTypeHostNuma](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a24dc63fb938dee27b41e3842da35d2d0), or [cudaMemLocationTypeDeviceLocalityDomain](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a88b5d659aa9d7501f0382836eebb125b). The allocation type can be one of [`cudaMemAllocationType::cudaMemAllocationTypePinned`] or [`cudaMemAllocationType::cudaMemAllocationTypeManaged`]. When the allocation type is [`cudaMemAllocationType::cudaMemAllocationTypeManaged`], the location type can also be [cudaMemLocationTypeNone](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a53b6266fa56e0b7efe6a0b78ed8e8f49) to indicate no preferred location for the managed memory pool. [`cudaMemAllocationType::cudaMemAllocationTypeManaged`] can not be used with [cudaMemLocationTypeDeviceLocalityDomain](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a88b5d659aa9d7501f0382836eebb125b). In all other cases, the call return [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c).
3690 pub fn cudaMemGetDefaultMemPool(
3691 memPool: *mut cudaMemPool_t,
3692 location: *mut cudaMemLocation,
3693 type_: cudaMemAllocationType,
3694 ) -> cudaError_t;
3695}
3696singe_loader::functions! { crate::RUNTIME;
3697 /// Gets the current memory pool for a given memory location and allocation type.
3698 ///
3699 /// The memory location can be of one of [cudaMemLocationTypeDevice](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0ae479b8710f3c5270117ee9d8cf5868d4), [cudaMemLocationTypeHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a1ec97ff5f3c715e4b18e39dabf9e31c5), [cudaMemLocationTypeHostNuma](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a24dc63fb938dee27b41e3842da35d2d0), or [cudaMemLocationTypeDeviceLocalityDomain](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a88b5d659aa9d7501f0382836eebb125b). The allocation type can be one of [`cudaMemAllocationType::cudaMemAllocationTypePinned`] or [`cudaMemAllocationType::cudaMemAllocationTypeManaged`]. When the allocation type is [`cudaMemAllocationType::cudaMemAllocationTypeManaged`], the location type can also be [cudaMemLocationTypeNone](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a53b6266fa56e0b7efe6a0b78ed8e8f49) to indicate no preferred location for the managed memory pool. [`cudaMemAllocationType::cudaMemAllocationTypeManaged`] can not be used with [cudaMemLocationTypeDeviceLocalityDomain](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a88b5d659aa9d7501f0382836eebb125b). In all other cases, the call return [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c)
3700 ///
3701 /// Returns the last pool provided to [`cudaMemSetMemPool`] or [`cudaDeviceSetMemPool`] for this location and allocation type or the location’s default memory pool if [`cudaMemSetMemPool`] or [`cudaDeviceSetMemPool`] for that allocType and location has never been called. By default the current mempool of a location is the default mempool for a device that can be obtained via cudaMemGetDefaultMemPool Otherwise the returned pool must have been set with [`cudaDeviceSetMemPool`].
3702 pub fn cudaMemGetMemPool(
3703 memPool: *mut cudaMemPool_t,
3704 location: *mut cudaMemLocation,
3705 type_: cudaMemAllocationType,
3706 ) -> cudaError_t;
3707}
3708singe_loader::functions! { crate::RUNTIME;
3709 /// Sets the current memory pool for a memory location and allocation type.
3710 ///
3711 /// The memory location can be of one of [cudaMemLocationTypeDevice](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0ae479b8710f3c5270117ee9d8cf5868d4), [cudaMemLocationTypeHost](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a1ec97ff5f3c715e4b18e39dabf9e31c5) [cudaMemLocationTypeHostNuma](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a24dc63fb938dee27b41e3842da35d2d0), or [cudaMemLocationTypeDeviceLocalityDomain](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a88b5d659aa9d7501f0382836eebb125b). The allocation type can be one of [`cudaMemAllocationType::cudaMemAllocationTypePinned`] or [`cudaMemAllocationType::cudaMemAllocationTypeManaged`]. When the allocation type is [`cudaMemAllocationType::cudaMemAllocationTypeManaged`], the location type can also be [cudaMemLocationTypeNone](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a53b6266fa56e0b7efe6a0b78ed8e8f49) to indicate no preferred location for the managed memory pool. [`cudaMemAllocationType::cudaMemAllocationTypeManaged`] can not be used with [cudaMemLocationTypeDeviceLocalityDomain](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga2279aa08666f329f3ba4afe397fa60f0a88b5d659aa9d7501f0382836eebb125b). In all other cases, the call return [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c)
3712 ///
3713 /// When a memory pool is set as the current memory pool, the location parameter should be the same as the location of the pool. If the location type or index don’t match, the call returns [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c). The type of memory pool should also match the parameter allocType. Else the call returns [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c)
3714 ///
3715 /// .
3716 ///
3717 /// By default, a memory location’s current memory pool is its default memory pool. If the location type is.
3718 pub fn cudaMemSetMemPool(
3719 location: *mut cudaMemLocation,
3720 type_: cudaMemAllocationType,
3721 memPool: cudaMemPool_t,
3722 ) -> cudaError_t;
3723}
3724singe_loader::functions! { crate::RUNTIME;
3725 /// Allocates memory from a specified pool with stream ordered semantics.
3726 ///
3727 /// Inserts an allocation operation into `stream`. 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.
3728 ///
3729 /// # Parameters
3730 ///
3731 /// - `ptr`: Returned device pointer.
3732 /// - `memPool`: The pool to allocate from.
3733 /// - `stream`: The stream establishing the stream ordering semantic.
3734 pub fn cudaMallocFromPoolAsync(
3735 ptr: *mut *mut ::core::ffi::c_void,
3736 size: size_t,
3737 memPool: cudaMemPool_t,
3738 stream: cudaStream_t,
3739 ) -> cudaError_t;
3740}
3741singe_loader::functions! { crate::RUNTIME;
3742 /// Exports a memory pool to the requested handle type.
3743 ///
3744 /// 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 [`cudaMemPoolImportFromShareableHandle`]. Individual pointers can then be shared with the [`cudaMemPoolExportPointer`] and [`cudaMemPoolImportPointer`] APIs. The implementation of what the shareable handle is and how it can be transferred is defined by the requested handle type.
3745 ///
3746 /// # Parameters
3747 ///
3748 /// - `handleType`: the type of handle to create.
3749 /// - `flags`: must be 0.
3750 pub fn cudaMemPoolExportToShareableHandle(
3751 shareableHandle: *mut ::core::ffi::c_void,
3752 memPool: cudaMemPool_t,
3753 handleType: cudaMemAllocationHandleType,
3754 flags: ::core::ffi::c_uint,
3755 ) -> cudaError_t;
3756}
3757singe_loader::functions! { crate::RUNTIME;
3758 /// imports a memory pool from a shared handle.
3759 ///
3760 /// Specific allocations can be imported from the imported pool with [`cudaMemPoolImportPointer`].
3761 ///
3762 /// # Parameters
3763 ///
3764 /// - `handleType`: The type of handle being imported.
3765 /// - `flags`: must be 0.
3766 pub fn cudaMemPoolImportFromShareableHandle(
3767 memPool: *mut cudaMemPool_t,
3768 shareableHandle: *mut ::core::ffi::c_void,
3769 handleType: cudaMemAllocationHandleType,
3770 flags: ::core::ffi::c_uint,
3771 ) -> cudaError_t;
3772}
3773singe_loader::functions! { crate::RUNTIME;
3774 /// Export data to share a memory pool allocation between processes.
3775 ///
3776 /// Constructs `shareData_out` for sharing a specific allocation from an already shared memory pool. The recipient process can import the allocation with the [`cudaMemPoolImportPointer`] api. The data is not a handle and may be shared through any IPC mechanism.
3777 ///
3778 /// # Parameters
3779 ///
3780 /// - `ptr`: pointer to memory being exported.
3781 pub fn cudaMemPoolExportPointer(
3782 exportData: *mut cudaMemPoolPtrExportData,
3783 ptr: *mut ::core::ffi::c_void,
3784 ) -> cudaError_t;
3785}
3786singe_loader::functions! { crate::RUNTIME;
3787 /// Import a memory pool allocation from another process.
3788 ///
3789 /// 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 cudaFree or cudaFreeAsync. If [`cudaFreeAsync`] is used, the free must be completed on the importing process before the free operation on the exporting process.
3790 pub fn cudaMemPoolImportPointer(
3791 ptr: *mut *mut ::core::ffi::c_void,
3792 memPool: cudaMemPool_t,
3793 exportData: *mut cudaMemPoolPtrExportData,
3794 ) -> cudaError_t;
3795}
3796singe_loader::functions! { crate::RUNTIME;
3797 /// Returns attributes about a specified pointer.
3798 ///
3799 /// Returns in `*attributes` the attributes of the pointer `ptr`. If pointer was not allocated in, mapped by or registered with context supporting unified addressing [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) is returned.
3800 ///
3801 /// The [`cudaPointerAttributes`] structure is defined as.
3802 ///
3803 /// # Parameters
3804 ///
3805 /// - `attributes`: Attributes for the specified pointer.
3806 /// - `ptr`: Pointer to get attributes for.
3807 pub fn cudaPointerGetAttributes(
3808 attributes: *mut cudaPointerAttributes,
3809 ptr: *const ::core::ffi::c_void,
3810 ) -> cudaError_t;
3811}
3812singe_loader::functions! { crate::RUNTIME;
3813 /// Queries if a device may directly access a peer device’s memory.
3814 ///
3815 /// Returns in `*canAccessPeer` a value of 1 if device `device` is capable of directly accessing memory from `peerDevice` and 0 otherwise. If direct access of `peerDevice` from `device` is possible, then access may be enabled by calling [`cudaDeviceEnablePeerAccess`].
3816 ///
3817 /// # Parameters
3818 ///
3819 /// - `canAccessPeer`: Returned access capability.
3820 /// - `device`: Device from which allocations on `peerDevice` are to be directly accessed.
3821 /// - `peerDevice`: Device on which the allocations to be directly accessed by `device` reside.
3822 pub fn cudaDeviceCanAccessPeer(
3823 canAccessPeer: *mut ::core::ffi::c_int,
3824 device: ::core::ffi::c_int,
3825 peerDevice: ::core::ffi::c_int,
3826 ) -> cudaError_t;
3827}
3828singe_loader::functions! { crate::RUNTIME;
3829 /// Enables direct access to memory allocations on a peer device.
3830 ///
3831 /// On success, all allocations from `peerDevice` will immediately be accessible by the current device. They will remain accessible until access is explicitly disabled using [`cudaDeviceDisablePeerAccess`] or either device is reset using [`cudaDeviceReset`].
3832 ///
3833 /// Note that access granted by this call is unidirectional and that in order to access memory on the current device from `peerDevice`, a separate symmetric call to [`cudaDeviceEnablePeerAccess`] is required.
3834 ///
3835 /// 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”.
3836 ///
3837 /// Returns [cudaErrorInvalidDevice](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a938c6e8b96ecde62e3ab5137156f739a) if [`cudaDeviceCanAccessPeer`] indicates that the current device cannot directly access memory from `peerDevice`.
3838 ///
3839 /// Returns [cudaErrorPeerAccessAlreadyEnabled](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a0bc28e8217afa14b95f907631cb84f33) if direct access of `peerDevice` from the current device has already been enabled.
3840 ///
3841 /// Returns [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) if `flags` is not 0.
3842 ///
3843 /// # Parameters
3844 ///
3845 /// - `peerDevice`: Peer device to enable direct access to from the current device.
3846 /// - `flags`: Reserved for future use and must be set to 0.
3847 pub fn cudaDeviceEnablePeerAccess(
3848 peerDevice: ::core::ffi::c_int,
3849 flags: ::core::ffi::c_uint,
3850 ) -> cudaError_t;
3851}
3852singe_loader::functions! { crate::RUNTIME;
3853 /// Disables direct access to memory allocations on a peer device.
3854 ///
3855 /// Returns [cudaErrorPeerAccessNotEnabled](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a821b54bce59b87db6efc2ea59a867bf7) if direct access to memory on `peerDevice` has not yet been enabled from the current device.
3856 ///
3857 /// # Parameters
3858 ///
3859 /// - `peerDevice`: - Peer device to disable direct access to
3860 pub fn cudaDeviceDisablePeerAccess(peerDevice: ::core::ffi::c_int) -> cudaError_t;
3861}
3862singe_loader::functions! { crate::RUNTIME;
3863 /// Unregisters a graphics resource for access by CUDA.
3864 ///
3865 /// Unregisters the graphics resource `resource` so it is not accessible by CUDA unless registered again.
3866 ///
3867 /// If `resource` is invalid then [cudaErrorInvalidResourceHandle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ac4673247aee4d1ab8d07871f376e0273) is returned.
3868 ///
3869 /// # Parameters
3870 ///
3871 /// - `resource`: - Resource to unregister
3872 pub fn cudaGraphicsUnregisterResource(
3873 resource: cudaGraphicsResource_t,
3874 ) -> cudaError_t;
3875}
3876singe_loader::functions! { crate::RUNTIME;
3877 /// Set usage flags for mapping a graphics resource.
3878 ///
3879 /// Set `flags` for mapping the graphics resource `resource`.
3880 ///
3881 /// Changes to `flags` will take effect the next time `resource` is mapped. The `flags` argument may be any of the following:
3882 ///
3883 /// If `resource` is presently mapped for access by CUDA then [cudaErrorUnknown](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a2e491daacef266c7b3e3c1e140a6133c) is returned. If `flags` is not one of the above values then [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) is returned.
3884 ///
3885 /// # Parameters
3886 ///
3887 /// - `resource`: Registered resource to set flags for.
3888 /// - `flags`: Parameters for resource mapping.
3889 pub fn cudaGraphicsResourceSetMapFlags(
3890 resource: cudaGraphicsResource_t,
3891 flags: ::core::ffi::c_uint,
3892 ) -> cudaError_t;
3893}
3894singe_loader::functions! { crate::RUNTIME;
3895 /// Map graphics resources for access by CUDA.
3896 ///
3897 /// Maps the `count` graphics resources in `resources` for access by CUDA.
3898 ///
3899 /// 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.
3900 ///
3901 /// This function provides the synchronization guarantee that any graphics calls issued before [`cudaGraphicsMapResources`] will complete before any subsequent CUDA work issued in `stream` begins.
3902 ///
3903 /// If `resources` contains any duplicate entries then [cudaErrorInvalidResourceHandle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ac4673247aee4d1ab8d07871f376e0273) is returned. If any of `resources` are presently mapped for access by CUDA then [cudaErrorUnknown](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a2e491daacef266c7b3e3c1e140a6133c) is returned.
3904 ///
3905 /// # Parameters
3906 ///
3907 /// - `count`: Number of resources to map.
3908 /// - `resources`: Resources to map for CUDA.
3909 /// - `stream`: Stream for synchronization.
3910 pub fn cudaGraphicsMapResources(
3911 count: ::core::ffi::c_int,
3912 resources: *mut cudaGraphicsResource_t,
3913 stream: cudaStream_t,
3914 ) -> cudaError_t;
3915}
3916singe_loader::functions! { crate::RUNTIME;
3917 /// Unmap graphics resources.
3918 ///
3919 /// Unmaps the `count` graphics resources in `resources`.
3920 ///
3921 /// Once unmapped, the resources in `resources` may not be accessed by CUDA until they are mapped again.
3922 ///
3923 /// This function provides the synchronization guarantee that any CUDA work issued in `stream` before [`cudaGraphicsUnmapResources`] will complete before any subsequently issued graphics work begins.
3924 ///
3925 /// If `resources` contains any duplicate entries then [cudaErrorInvalidResourceHandle](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ac4673247aee4d1ab8d07871f376e0273) is returned. If any of `resources` are not presently mapped for access by CUDA then [cudaErrorUnknown](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a2e491daacef266c7b3e3c1e140a6133c) is returned.
3926 ///
3927 /// # Parameters
3928 ///
3929 /// - `count`: Number of resources to unmap.
3930 /// - `resources`: Resources to unmap.
3931 /// - `stream`: Stream for synchronization.
3932 pub fn cudaGraphicsUnmapResources(
3933 count: ::core::ffi::c_int,
3934 resources: *mut cudaGraphicsResource_t,
3935 stream: cudaStream_t,
3936 ) -> cudaError_t;
3937}
3938singe_loader::functions! { crate::RUNTIME;
3939 /// Get an device pointer through which to access a mapped graphics resource.
3940 ///
3941 /// Returns in `*devPtr` a pointer through which the mapped graphics resource `resource` may be accessed. Returns in `*size` the size of the memory in bytes which may be accessed from that pointer. The value set in `devPtr` may change every time that `resource` is mapped.
3942 ///
3943 /// If `resource` is not a buffer then it cannot be accessed via a pointer and [cudaErrorUnknown](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a2e491daacef266c7b3e3c1e140a6133c) is returned. If `resource` is not mapped then [cudaErrorUnknown](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a2e491daacef266c7b3e3c1e140a6133c) is returned.
3944 ///
3945 /// # Parameters
3946 ///
3947 /// - `devPtr`: Returned pointer through which `resource` may be accessed.
3948 /// - `size`: Returned size of the buffer accessible starting at `*devPtr`.
3949 /// - `resource`: Mapped resource to access.
3950 pub fn cudaGraphicsResourceGetMappedPointer(
3951 devPtr: *mut *mut ::core::ffi::c_void,
3952 size: *mut size_t,
3953 resource: cudaGraphicsResource_t,
3954 ) -> cudaError_t;
3955}
3956singe_loader::functions! { crate::RUNTIME;
3957 /// Get an array through which to access a subresource of a mapped graphics resource.
3958 ///
3959 /// Returns in `*array` 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 `array` may change every time that `resource` is mapped.
3960 ///
3961 /// If `resource` is not a texture then it cannot be accessed via an array and [cudaErrorUnknown](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a2e491daacef266c7b3e3c1e140a6133c) is returned. If `arrayIndex` is not a valid array index for `resource` then [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) is returned. If `mipLevel` is not a valid mipmap level for `resource` then [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) is returned. If `resource` is not mapped then [cudaErrorUnknown](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a2e491daacef266c7b3e3c1e140a6133c) is returned.
3962 ///
3963 /// # Parameters
3964 ///
3965 /// - `array`: Returned array through which a subresource of `resource` may be accessed.
3966 /// - `resource`: Mapped resource to access.
3967 /// - `arrayIndex`: Array index for array textures or cubemap face index as defined by [cudaGraphicsCubeFace](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gabf3ce16a621826a09263b8a58902fee8) for cubemap textures for the subresource to access.
3968 /// - `mipLevel`: Mipmap level for the subresource to access.
3969 pub fn cudaGraphicsSubResourceGetMappedArray(
3970 array: *mut cudaArray_t,
3971 resource: cudaGraphicsResource_t,
3972 arrayIndex: ::core::ffi::c_uint,
3973 mipLevel: ::core::ffi::c_uint,
3974 ) -> cudaError_t;
3975}
3976singe_loader::functions! { crate::RUNTIME;
3977 /// Get a mipmapped array through which to access a mapped graphics resource.
3978 ///
3979 /// Returns in `*mipmappedArray` a mipmapped array through which the mapped graphics resource `resource` may be accessed. The value set in `mipmappedArray` may change every time that `resource` is mapped.
3980 ///
3981 /// If `resource` is not a texture then it cannot be accessed via an array and [cudaErrorUnknown](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a2e491daacef266c7b3e3c1e140a6133c) is returned. If `resource` is not mapped then [cudaErrorUnknown](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a2e491daacef266c7b3e3c1e140a6133c) is returned.
3982 ///
3983 /// # Parameters
3984 ///
3985 /// - `mipmappedArray`: Returned mipmapped array through which `resource` may be accessed.
3986 /// - `resource`: Mapped resource to access.
3987 pub fn cudaGraphicsResourceGetMappedMipmappedArray(
3988 mipmappedArray: *mut cudaMipmappedArray_t,
3989 resource: cudaGraphicsResource_t,
3990 ) -> cudaError_t;
3991}
3992singe_loader::functions! { crate::RUNTIME;
3993 /// Get the channel descriptor of an array.
3994 ///
3995 /// Returns in `*desc` the channel descriptor of the CUDA array `array`.
3996 ///
3997 /// # Parameters
3998 ///
3999 /// - `desc`: Channel format.
4000 /// - `array`: Memory array on device.
4001 pub fn cudaGetChannelDesc(
4002 desc: *mut cudaChannelFormatDesc,
4003 array: cudaArray_const_t,
4004 ) -> cudaError_t;
4005}
4006singe_loader::functions! { crate::RUNTIME;
4007 /// Returns a channel descriptor using the specified format
4008 ///
4009 /// Returns a channel descriptor with format `f` and number of bits of each component `x`, `y`, `z`, and `w`. The ::cudaChannelFormatDesc is defined as:
4010 ///
4011 ///
4012 ///
4013 /// ```text
4014 /// struct cudaChannelFormatDesc {
4015 /// int x, y, z, w;
4016 /// enum cudaChannelFormatKind f;
4017 /// };
4018 /// ```
4019 ///
4020 /// where ::cudaChannelFormatKind is one of ::cudaChannelFormatKindSigned, ::cudaChannelFormatKindUnsigned, or ::cudaChannelFormatKindFloat.
4021 ///
4022 ///
4023 ///
4024 ///
4025 ///
4026 /// # Return value
4027 ///
4028 /// Channel descriptor with format `f`
4029 ///
4030 ///
4031 ///
4032 /// See also: `::cudaCreateChannelDesc(void)` "cudaCreateChannelDesc (C++ API)", ::cudaGetChannelDesc, ::cudaCreateTextureObject, ::cudaCreateSurfaceObject
4033 ///
4034 /// # Parameters
4035 ///
4036 /// - `x`: - X component
4037 /// - `y`: - Y component
4038 /// - `z`: - Z component
4039 /// - `w`: - W component
4040 /// - `f`: - Channel format
4041 pub fn cudaCreateChannelDesc(
4042 x: ::core::ffi::c_int,
4043 y: ::core::ffi::c_int,
4044 z: ::core::ffi::c_int,
4045 w: ::core::ffi::c_int,
4046 f: cudaChannelFormatKind,
4047 ) -> cudaChannelFormatDesc;
4048}
4049singe_loader::functions! { crate::RUNTIME;
4050 /// Creates a texture object.
4051 ///
4052 /// 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.
4053 ///
4054 /// 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.
4055 ///
4056 /// The [`cudaResourceDesc`] structure is defined as:
4057 ///
4058 /// The [`cudaTextureDesc`] struct is defined as
4059 ///
4060 /// The [`cudaResourceViewDesc`] struct is defined as.
4061 ///
4062 /// # Parameters
4063 ///
4064 /// - `pTexObject`: Texture object to create.
4065 /// - `pResDesc`: Resource descriptor.
4066 /// - `pTexDesc`: Texture descriptor.
4067 /// - `pResViewDesc`: Resource view descriptor.
4068 pub fn cudaCreateTextureObject(
4069 pTexObject: *mut cudaTextureObject_t,
4070 pResDesc: *const cudaResourceDesc,
4071 pTexDesc: *const cudaTextureDesc,
4072 pResViewDesc: *const cudaResourceViewDesc,
4073 ) -> cudaError_t;
4074}
4075singe_loader::functions! { crate::RUNTIME;
4076 /// Destroys a texture object.
4077 ///
4078 /// Destroys the texture object specified by `texObject`.
4079 ///
4080 /// # Parameters
4081 ///
4082 /// - `texObject`: - Texture object to destroy
4083 pub fn cudaDestroyTextureObject(texObject: cudaTextureObject_t) -> cudaError_t;
4084}
4085singe_loader::functions! { crate::RUNTIME;
4086 /// Returns a texture object’s resource descriptor.
4087 ///
4088 /// Returns the resource descriptor for the texture object specified by `texObject`.
4089 ///
4090 /// # Parameters
4091 ///
4092 /// - `pResDesc`: Resource descriptor.
4093 /// - `texObject`: Texture object.
4094 pub fn cudaGetTextureObjectResourceDesc(
4095 pResDesc: *mut cudaResourceDesc,
4096 texObject: cudaTextureObject_t,
4097 ) -> cudaError_t;
4098}
4099singe_loader::functions! { crate::RUNTIME;
4100 /// Returns a texture object’s texture descriptor.
4101 ///
4102 /// Returns the texture descriptor for the texture object specified by `texObject`.
4103 ///
4104 /// # Parameters
4105 ///
4106 /// - `pTexDesc`: Texture descriptor.
4107 /// - `texObject`: Texture object.
4108 pub fn cudaGetTextureObjectTextureDesc(
4109 pTexDesc: *mut cudaTextureDesc,
4110 texObject: cudaTextureObject_t,
4111 ) -> cudaError_t;
4112}
4113singe_loader::functions! { crate::RUNTIME;
4114 /// Returns a texture object’s resource view descriptor.
4115 ///
4116 /// Returns the resource view descriptor for the texture object specified by `texObject`. If no resource view was specified, [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) is returned.
4117 ///
4118 /// # Parameters
4119 ///
4120 /// - `pResViewDesc`: Resource view descriptor.
4121 /// - `texObject`: Texture object.
4122 pub fn cudaGetTextureObjectResourceViewDesc(
4123 pResViewDesc: *mut cudaResourceViewDesc,
4124 texObject: cudaTextureObject_t,
4125 ) -> cudaError_t;
4126}
4127singe_loader::functions! { crate::RUNTIME;
4128 /// Creates a surface object.
4129 ///
4130 /// Creates a surface object and returns it in `pSurfObject`. `pResDesc` describes the data to perform surface load/stores on. [cudaResourceDesc::resType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaResourceDesc.html#structcudaresourcedesc_1aaac8b3bb1d63bd25d8e9af7ee0b9a580) must be [`cudaResourceType::cudaResourceTypeArray`] and ::cudaResourceDesc::res::array::array must be set to a valid CUDA array handle.
4131 ///
4132 /// 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.
4133 ///
4134 /// # Parameters
4135 ///
4136 /// - `pSurfObject`: Surface object to create.
4137 /// - `pResDesc`: Resource descriptor.
4138 pub fn cudaCreateSurfaceObject(
4139 pSurfObject: *mut cudaSurfaceObject_t,
4140 pResDesc: *const cudaResourceDesc,
4141 ) -> cudaError_t;
4142}
4143singe_loader::functions! { crate::RUNTIME;
4144 /// Destroys a surface object.
4145 ///
4146 /// Destroys the surface object specified by `surfObject`.
4147 ///
4148 /// # Parameters
4149 ///
4150 /// - `surfObject`: - Surface object to destroy
4151 pub fn cudaDestroySurfaceObject(surfObject: cudaSurfaceObject_t) -> cudaError_t;
4152}
4153singe_loader::functions! { crate::RUNTIME;
4154 /// Returns a surface object’s resource descriptor Returns the resource descriptor for the surface object specified by `surfObject`.
4155 ///
4156 /// # Parameters
4157 ///
4158 /// - `pResDesc`: Resource descriptor.
4159 /// - `surfObject`: Surface object.
4160 pub fn cudaGetSurfaceObjectResourceDesc(
4161 pResDesc: *mut cudaResourceDesc,
4162 surfObject: cudaSurfaceObject_t,
4163 ) -> cudaError_t;
4164}
4165singe_loader::functions! { crate::RUNTIME;
4166 /// Returns the latest version of CUDA supported by the driver.
4167 ///
4168 /// Returns in `*driverVersion` the latest 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. If no driver is installed, then 0 is returned as the driver version.
4169 ///
4170 /// This function automatically returns [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) if `driverVersion` is NULL.
4171 ///
4172 /// # Parameters
4173 ///
4174 /// - `driverVersion`: - Returns the CUDA driver version.
4175 pub fn cudaDriverGetVersion(driverVersion: *mut ::core::ffi::c_int) -> cudaError_t;
4176}
4177singe_loader::functions! { crate::RUNTIME;
4178 /// Returns the CUDA Runtime version.
4179 ///
4180 /// Returns in `*runtimeVersion` the version number of the current CUDA Runtime instance. The version is returned as (1000 major + 10 minor). For example, CUDA 9.2 would be represented by 9020.
4181 ///
4182 /// As of CUDA 12.0, this function no longer initializes CUDA. The purpose of this API is solely to return a compile-time constant stating the CUDA Toolkit version in the above format.
4183 ///
4184 /// As of CUDA 13.0, on Windows, the `runtimeVersion` may not be the same as the CUDA Toolkit version the app was built with. Windows will use the CUDA Runtime packaged with the display driver, and that version will be reported.
4185 ///
4186 /// This function automatically returns [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) if the `runtimeVersion` argument is NULL.
4187 ///
4188 /// # Parameters
4189 ///
4190 /// - `runtimeVersion`: - Returns the CUDA Runtime version.
4191 pub fn cudaRuntimeGetVersion(runtimeVersion: *mut ::core::ffi::c_int) -> cudaError_t;
4192}
4193/// Type of public error reporting callback functions.
4194///
4195/// User parameter provided at registration
4196///
4197/// Severity level of the log message
4198///
4199/// Error log message being reported
4200///
4201/// Length of the message in bytes
4202pub type cudaLogsCallback_t = ::core::option::Option<
4203 unsafe extern "C" fn(
4204 data: *mut ::core::ffi::c_void,
4205 logLevel: cudaLogLevel,
4206 message: *mut ::core::ffi::c_char,
4207 length: size_t,
4208 ),
4209>;
4210singe_loader::functions! { crate::RUNTIME;
4211 /// Register a callback function to receive error log messages.
4212 ///
4213 /// # Parameters
4214 ///
4215 /// - `callbackFunc`: The function to register as a callback.
4216 /// - `userData`: A generic pointer to user data. This is passed into the callback function.
4217 /// - `callback_out`: Optional location to store the callback handle after it is registered.
4218 pub fn cudaLogsRegisterCallback(
4219 callbackFunc: cudaLogsCallback_t,
4220 userData: *mut ::core::ffi::c_void,
4221 callback_out: *mut cudaLogsCallbackHandle,
4222 ) -> cudaError_t;
4223}
4224singe_loader::functions! { crate::RUNTIME;
4225 /// Unregister a log message callback.
4226 ///
4227 /// # Parameters
4228 ///
4229 /// - `callback`: - The callback instance to unregister from receiving log messages
4230 pub fn cudaLogsUnregisterCallback(callback: cudaLogsCallbackHandle) -> cudaError_t;
4231}
4232singe_loader::functions! { crate::RUNTIME;
4233 /// Sets log iterator to point to the end of log buffer, where the next message would be written.
4234 ///
4235 /// # Parameters
4236 ///
4237 /// - `iterator_out`: Location to store an iterator to the current tail of the logs.
4238 /// - `flags`: Reserved for future use, must be 0.
4239 pub fn cudaLogsCurrent(
4240 iterator_out: *mut cudaLogIterator,
4241 flags: ::core::ffi::c_uint,
4242 ) -> cudaError_t;
4243}
4244singe_loader::functions! { crate::RUNTIME;
4245 /// Dump accumulated driver logs into a file.
4246 ///
4247 /// 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.
4248 ///
4249 /// # Parameters
4250 ///
4251 /// - `iterator`: Optional auto-advancing iterator specifying the starting log to read. NULL value dumps all logs.
4252 /// - `pathToFile`: Path to output file for dumping logs.
4253 /// - `flags`: Reserved for future use, must be 0.
4254 pub fn cudaLogsDumpToFile(
4255 iterator: *mut cudaLogIterator,
4256 pathToFile: *const ::core::ffi::c_char,
4257 flags: ::core::ffi::c_uint,
4258 ) -> cudaError_t;
4259}
4260singe_loader::functions! { crate::RUNTIME;
4261 /// Dump accumulated driver logs into a buffer.
4262 ///
4263 /// 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 ::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 ::CUDA_ERROR_INVALID_VALUE.
4264 ///
4265 /// # Parameters
4266 ///
4267 /// - `iterator`: Optional auto-advancing iterator specifying the starting log to read. NULL value dumps all logs.
4268 /// - `buffer`: Pointer to dump logs.
4269 /// - `size`: See description.
4270 /// - `flags`: Reserved for future use, must be 0.
4271 pub fn cudaLogsDumpToMemory(
4272 iterator: *mut cudaLogIterator,
4273 buffer: *mut ::core::ffi::c_char,
4274 size: *mut size_t,
4275 flags: ::core::ffi::c_uint,
4276 ) -> cudaError_t;
4277}
4278singe_loader::functions! { crate::RUNTIME;
4279 /// Creates a graph.
4280 ///
4281 /// Creates an empty graph, which is returned via `pGraph`.
4282 ///
4283 /// # Parameters
4284 ///
4285 /// - `pGraph`: Returns newly created graph.
4286 /// - `flags`: Graph creation flags, must be 0.
4287 pub fn cudaGraphCreate(
4288 pGraph: *mut cudaGraph_t,
4289 flags: ::core::ffi::c_uint,
4290 ) -> cudaError_t;
4291}
4292singe_loader::functions! { crate::RUNTIME;
4293 /// Creates a kernel execution node and adds it to a graph.
4294 ///
4295 /// Creates a new kernel execution node and adds it to `graph` with `numDependencies` dependencies specified via `pDependencies` and arguments specified in `pNodeParams`. It is possible for `numDependencies` to be 0, in which case the node will be placed at the root of the graph. `pDependencies` may not have any duplicate entries. A handle to the new node will be returned in `pGraphNode`.
4296 ///
4297 /// The [`cudaKernelNodeParams`] structure is defined as:
4298 ///
4299 /// When the graph is launched, the node will invoke kernel `func` on a (`gridDim.x` x `gridDim.y` x `gridDim.z`) grid of blocks. Each block contains (`blockDim.x` x `blockDim.y` x `blockDim.z`) threads.
4300 ///
4301 /// `sharedMem` sets the amount of dynamic shared memory that will be available to each thread block.
4302 ///
4303 /// Kernel parameters to `func` can be specified in one of two ways:
4304 ///
4305 /// 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.
4306 ///
4307 /// 2) Kernel parameters 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.
4308 ///
4309 /// The error [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) will be returned if kernel parameters are specified with both `kernelParams` and `extra` (i.e. both `kernelParams` and `extra` are non-NULL).
4310 ///
4311 /// The `kernelParams` or `extra` array, as well as the argument values it points to, are copied during this call.
4312 ///
4313 /// # Parameters
4314 ///
4315 /// - `pGraphNode`: Returns newly created node.
4316 /// - `graph`: Graph to which to add the node.
4317 /// - `pDependencies`: Dependencies of the node.
4318 /// - `numDependencies`: Number of dependencies.
4319 /// - `pNodeParams`: Parameters for the GPU execution node.
4320 pub fn cudaGraphAddKernelNode(
4321 pGraphNode: *mut cudaGraphNode_t,
4322 graph: cudaGraph_t,
4323 pDependencies: *const cudaGraphNode_t,
4324 numDependencies: size_t,
4325 pNodeParams: *const cudaKernelNodeParams,
4326 ) -> cudaError_t;
4327}
4328singe_loader::functions! { crate::RUNTIME;
4329 /// Returns a kernel node’s parameters.
4330 ///
4331 /// Returns the parameters of kernel node `node` in `pNodeParams`. The `kernelParams` or `extra` array returned in `pNodeParams`, 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 [`cudaGraphKernelNodeSetParams`] to update the parameters of this node.
4332 ///
4333 /// The params will contain either `kernelParams` or `extra`, according to which of these was most recently set on the node.
4334 ///
4335 /// # Parameters
4336 ///
4337 /// - `node`: Node to get the parameters for.
4338 /// - `pNodeParams`: Pointer to return the parameters.
4339 pub fn cudaGraphKernelNodeGetParams(
4340 node: cudaGraphNode_t,
4341 pNodeParams: *mut cudaKernelNodeParams,
4342 ) -> cudaError_t;
4343}
4344singe_loader::functions! { crate::RUNTIME;
4345 /// Sets a kernel node’s parameters.
4346 ///
4347 /// Sets the parameters of kernel node `node` to `pNodeParams`.
4348 ///
4349 /// # Parameters
4350 ///
4351 /// - `node`: Node to set the parameters for.
4352 /// - `pNodeParams`: Parameters to copy.
4353 pub fn cudaGraphKernelNodeSetParams(
4354 node: cudaGraphNode_t,
4355 pNodeParams: *const cudaKernelNodeParams,
4356 ) -> cudaError_t;
4357}
4358singe_loader::functions! { crate::RUNTIME;
4359 /// Copies attributes from source node to destination node.
4360 ///
4361 /// Copies attributes from source node `hSrc` to destination node `hDst`. Both node must have the same context.
4362 ///
4363 /// # Parameters
4364 ///
4365 /// - `hDst`: Destination node.
4366 /// - `hSrc`: Source node For list of attributes see cudaKernelNodeAttrID.
4367 pub fn cudaGraphKernelNodeCopyAttributes(
4368 hDst: cudaGraphNode_t,
4369 hSrc: cudaGraphNode_t,
4370 ) -> cudaError_t;
4371}
4372singe_loader::functions! { crate::RUNTIME;
4373 /// Queries node attribute.
4374 ///
4375 /// Queries attribute `attr` from node `hNode` and stores it in corresponding member of `value_out`.
4376 pub fn cudaGraphKernelNodeGetAttribute(
4377 hNode: cudaGraphNode_t,
4378 attr: cudaLaunchAttributeID,
4379 value_out: *mut cudaLaunchAttributeValue,
4380 ) -> cudaError_t;
4381}
4382singe_loader::functions! { crate::RUNTIME;
4383 /// Sets node attribute.
4384 ///
4385 /// Sets attribute `attr` on node `hNode` from corresponding attribute of `value`.
4386 pub fn cudaGraphKernelNodeSetAttribute(
4387 hNode: cudaGraphNode_t,
4388 attr: cudaLaunchAttributeID,
4389 value: *const cudaLaunchAttributeValue,
4390 ) -> cudaError_t;
4391}
4392singe_loader::functions! { crate::RUNTIME;
4393 /// Creates a memcpy node and adds it to a graph.
4394 ///
4395 /// Creates a new memcpy node and adds it to `graph` with `numDependencies` dependencies specified via `pDependencies`. It is possible for `numDependencies` to be 0, in which case the node will be placed at the root of the graph. `pDependencies` may not have any duplicate entries. A handle to the new node will be returned in `pGraphNode`.
4396 ///
4397 /// When the graph is launched, the node will perform the memcpy described by `pCopyParams`. See [`cudaMemcpy3D`] for a description of the structure and its restrictions.
4398 ///
4399 /// 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 [cudaDevAttrConcurrentManagedAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdac88178f29891f2c18fe67361cc80de09).
4400 ///
4401 /// # Parameters
4402 ///
4403 /// - `pGraphNode`: Returns newly created node.
4404 /// - `graph`: Graph to which to add the node.
4405 /// - `pDependencies`: Dependencies of the node.
4406 /// - `numDependencies`: Number of dependencies.
4407 /// - `pCopyParams`: Parameters for the memory copy.
4408 pub fn cudaGraphAddMemcpyNode(
4409 pGraphNode: *mut cudaGraphNode_t,
4410 graph: cudaGraph_t,
4411 pDependencies: *const cudaGraphNode_t,
4412 numDependencies: size_t,
4413 pCopyParams: *const cudaMemcpy3DParms,
4414 ) -> cudaError_t;
4415}
4416singe_loader::functions! { crate::RUNTIME;
4417 /// Creates a memcpy node to copy to a symbol on the device and adds it to a graph.
4418 ///
4419 /// Creates a new memcpy node to copy to `symbol` and adds it to `graph` with `numDependencies` dependencies specified via `pDependencies`. It is possible for `numDependencies` to be 0, in which case the node will be placed at the root of the graph. `pDependencies` may not have any duplicate entries. A handle to the new node will be returned in `pGraphNode`.
4420 ///
4421 /// When the graph is launched, the node will copy `count` bytes from the memory area pointed to by `src` to the memory area pointed to by `offset` bytes from the start of symbol `symbol`. The memory areas may not overlap. `symbol` is a variable that resides in global or constant memory space. `kind` can be either [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing.
4422 ///
4423 /// 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 [cudaDevAttrConcurrentManagedAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdac88178f29891f2c18fe67361cc80de09).
4424 ///
4425 /// # Parameters
4426 ///
4427 /// - `pGraphNode`: Returns newly created node.
4428 /// - `graph`: Graph to which to add the node.
4429 /// - `pDependencies`: Dependencies of the node.
4430 /// - `numDependencies`: Number of dependencies.
4431 /// - `symbol`: Device symbol address.
4432 /// - `src`: Source memory address.
4433 /// - `count`: Size in bytes to copy.
4434 /// - `offset`: Offset from start of symbol in bytes.
4435 /// - `kind`: Type of transfer.
4436 pub fn cudaGraphAddMemcpyNodeToSymbol(
4437 pGraphNode: *mut cudaGraphNode_t,
4438 graph: cudaGraph_t,
4439 pDependencies: *const cudaGraphNode_t,
4440 numDependencies: size_t,
4441 symbol: *const ::core::ffi::c_void,
4442 src: *const ::core::ffi::c_void,
4443 count: size_t,
4444 offset: size_t,
4445 kind: cudaMemcpyKind,
4446 ) -> cudaError_t;
4447}
4448singe_loader::functions! { crate::RUNTIME;
4449 /// Creates a memcpy node to copy from a symbol on the device and adds it to a graph.
4450 ///
4451 /// Creates a new memcpy node to copy from `symbol` and adds it to `graph` with `numDependencies` dependencies specified via `pDependencies`. It is possible for `numDependencies` to be 0, in which case the node will be placed at the root of the graph. `pDependencies` may not have any duplicate entries. A handle to the new node will be returned in `pGraphNode`.
4452 ///
4453 /// When the graph is launched, the node will copy `count` bytes from the memory area pointed to by `offset` bytes from the start of symbol `symbol` to the memory area pointed to by `dst`. The memory areas may not overlap. `symbol` is a variable that resides in global or constant memory space. `kind` can be either [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing.
4454 ///
4455 /// 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 [cudaDevAttrConcurrentManagedAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdac88178f29891f2c18fe67361cc80de09).
4456 ///
4457 /// # Parameters
4458 ///
4459 /// - `pGraphNode`: Returns newly created node.
4460 /// - `graph`: Graph to which to add the node.
4461 /// - `pDependencies`: Dependencies of the node.
4462 /// - `numDependencies`: Number of dependencies.
4463 /// - `dst`: Destination memory address.
4464 /// - `symbol`: Device symbol address.
4465 /// - `count`: Size in bytes to copy.
4466 /// - `offset`: Offset from start of symbol in bytes.
4467 /// - `kind`: Type of transfer.
4468 pub fn cudaGraphAddMemcpyNodeFromSymbol(
4469 pGraphNode: *mut cudaGraphNode_t,
4470 graph: cudaGraph_t,
4471 pDependencies: *const cudaGraphNode_t,
4472 numDependencies: size_t,
4473 dst: *mut ::core::ffi::c_void,
4474 symbol: *const ::core::ffi::c_void,
4475 count: size_t,
4476 offset: size_t,
4477 kind: cudaMemcpyKind,
4478 ) -> cudaError_t;
4479}
4480singe_loader::functions! { crate::RUNTIME;
4481 /// Creates a 1D memcpy node and adds it to a graph.
4482 ///
4483 /// Creates a new 1D memcpy node and adds it to `graph` with `numDependencies` dependencies specified via `pDependencies`. It is possible for `numDependencies` to be 0, in which case the node will be placed at the root of the graph. `pDependencies` may not have any duplicate entries. A handle to the new node will be returned in `pGraphNode`.
4484 ///
4485 /// When the graph is launched, the node will copy `count` bytes from the memory area pointed to by `src` to the memory area pointed to by `dst`, where `kind` specifies the direction of the copy, and must be one of [`cudaMemcpyKind::cudaMemcpyHostToHost`], [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing. Launching a memcpy node with dst and src pointers that do not match the direction of the copy results in an undefined behavior.
4486 ///
4487 /// 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 [cudaDevAttrConcurrentManagedAccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga49e2f8c2c0bd6fe264f2fc970912e5cdac88178f29891f2c18fe67361cc80de09).
4488 ///
4489 /// # Parameters
4490 ///
4491 /// - `pGraphNode`: Returns newly created node.
4492 /// - `graph`: Graph to which to add the node.
4493 /// - `pDependencies`: Dependencies of the node.
4494 /// - `numDependencies`: Number of dependencies.
4495 /// - `dst`: Destination memory address.
4496 /// - `src`: Source memory address.
4497 /// - `count`: Size in bytes to copy.
4498 /// - `kind`: Type of transfer.
4499 pub fn cudaGraphAddMemcpyNode1D(
4500 pGraphNode: *mut cudaGraphNode_t,
4501 graph: cudaGraph_t,
4502 pDependencies: *const cudaGraphNode_t,
4503 numDependencies: size_t,
4504 dst: *mut ::core::ffi::c_void,
4505 src: *const ::core::ffi::c_void,
4506 count: size_t,
4507 kind: cudaMemcpyKind,
4508 ) -> cudaError_t;
4509}
4510singe_loader::functions! { crate::RUNTIME;
4511 /// Returns a memcpy node’s parameters.
4512 ///
4513 /// Returns the parameters of memcpy node `node` in `pNodeParams`.
4514 ///
4515 /// # Parameters
4516 ///
4517 /// - `node`: Node to get the parameters for.
4518 /// - `pNodeParams`: Pointer to return the parameters.
4519 pub fn cudaGraphMemcpyNodeGetParams(
4520 node: cudaGraphNode_t,
4521 pNodeParams: *mut cudaMemcpy3DParms,
4522 ) -> cudaError_t;
4523}
4524singe_loader::functions! { crate::RUNTIME;
4525 /// Sets a memcpy node’s parameters.
4526 ///
4527 /// Sets the parameters of memcpy node `node` to `pNodeParams`.
4528 ///
4529 /// # Parameters
4530 ///
4531 /// - `node`: Node to set the parameters for.
4532 /// - `pNodeParams`: Parameters to copy.
4533 pub fn cudaGraphMemcpyNodeSetParams(
4534 node: cudaGraphNode_t,
4535 pNodeParams: *const cudaMemcpy3DParms,
4536 ) -> cudaError_t;
4537}
4538singe_loader::functions! { crate::RUNTIME;
4539 /// Sets a memcpy node’s parameters to copy to a symbol on the device.
4540 ///
4541 /// Sets the parameters of memcpy node `node` to the copy described by the provided parameters.
4542 ///
4543 /// When the graph is launched, the node will copy `count` bytes from the memory area pointed to by `src` to the memory area pointed to by `offset` bytes from the start of symbol `symbol`. The memory areas may not overlap. `symbol` is a variable that resides in global or constant memory space. `kind` can be either [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing.
4544 ///
4545 /// # Parameters
4546 ///
4547 /// - `node`: Node to set the parameters for.
4548 /// - `symbol`: Device symbol address.
4549 /// - `src`: Source memory address.
4550 /// - `count`: Size in bytes to copy.
4551 /// - `offset`: Offset from start of symbol in bytes.
4552 /// - `kind`: Type of transfer.
4553 pub fn cudaGraphMemcpyNodeSetParamsToSymbol(
4554 node: cudaGraphNode_t,
4555 symbol: *const ::core::ffi::c_void,
4556 src: *const ::core::ffi::c_void,
4557 count: size_t,
4558 offset: size_t,
4559 kind: cudaMemcpyKind,
4560 ) -> cudaError_t;
4561}
4562singe_loader::functions! { crate::RUNTIME;
4563 /// Sets a memcpy node’s parameters to copy from a symbol on the device.
4564 ///
4565 /// Sets the parameters of memcpy node `node` to the copy described by the provided parameters.
4566 ///
4567 /// When the graph is launched, the node will copy `count` bytes from the memory area pointed to by `offset` bytes from the start of symbol `symbol` to the memory area pointed to by `dst`. The memory areas may not overlap. `symbol` is a variable that resides in global or constant memory space. `kind` can be either [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing.
4568 ///
4569 /// # Parameters
4570 ///
4571 /// - `node`: Node to set the parameters for.
4572 /// - `dst`: Destination memory address.
4573 /// - `symbol`: Device symbol address.
4574 /// - `count`: Size in bytes to copy.
4575 /// - `offset`: Offset from start of symbol in bytes.
4576 /// - `kind`: Type of transfer.
4577 pub fn cudaGraphMemcpyNodeSetParamsFromSymbol(
4578 node: cudaGraphNode_t,
4579 dst: *mut ::core::ffi::c_void,
4580 symbol: *const ::core::ffi::c_void,
4581 count: size_t,
4582 offset: size_t,
4583 kind: cudaMemcpyKind,
4584 ) -> cudaError_t;
4585}
4586singe_loader::functions! { crate::RUNTIME;
4587 /// Sets a memcpy node’s parameters to perform a 1-dimensional copy.
4588 ///
4589 /// Sets the parameters of memcpy node `node` to the copy described by the provided parameters.
4590 ///
4591 /// When the graph is launched, the node will copy `count` bytes from the memory area pointed to by `src` to the memory area pointed to by `dst`, where `kind` specifies the direction of the copy, and must be one of [`cudaMemcpyKind::cudaMemcpyHostToHost`], [`cudaMemcpyKind::cudaMemcpyHostToDevice`], [`cudaMemcpyKind::cudaMemcpyDeviceToHost`], [`cudaMemcpyKind::cudaMemcpyDeviceToDevice`], or [`cudaMemcpyKind::cudaMemcpyDefault`]. Passing [`cudaMemcpyKind::cudaMemcpyDefault`] is recommended, in which case the type of transfer is inferred from the pointer values. However, [`cudaMemcpyKind::cudaMemcpyDefault`] is only allowed on systems that support unified virtual addressing. Launching a memcpy node with dst and src pointers that do not match the direction of the copy results in an undefined behavior.
4592 ///
4593 /// # Parameters
4594 ///
4595 /// - `node`: Node to set the parameters for.
4596 /// - `dst`: Destination memory address.
4597 /// - `src`: Source memory address.
4598 /// - `count`: Size in bytes to copy.
4599 /// - `kind`: Type of transfer.
4600 pub fn cudaGraphMemcpyNodeSetParams1D(
4601 node: cudaGraphNode_t,
4602 dst: *mut ::core::ffi::c_void,
4603 src: *const ::core::ffi::c_void,
4604 count: size_t,
4605 kind: cudaMemcpyKind,
4606 ) -> cudaError_t;
4607}
4608singe_loader::functions! { crate::RUNTIME;
4609 /// Creates a memset node and adds it to a graph.
4610 ///
4611 /// Creates a new memset node and adds it to `graph` with `numDependencies` dependencies specified via `pDependencies`. It is possible for `numDependencies` to be 0, in which case the node will be placed at the root of the graph. `pDependencies` may not have any duplicate entries. A handle to the new node will be returned in `pGraphNode`.
4612 ///
4613 /// The element size must be 1, 2, or 4 bytes. When the graph is launched, the node will perform the memset described by `pMemsetParams`.
4614 ///
4615 /// # Parameters
4616 ///
4617 /// - `pGraphNode`: Returns newly created node.
4618 /// - `graph`: Graph to which to add the node.
4619 /// - `pDependencies`: Dependencies of the node.
4620 /// - `numDependencies`: Number of dependencies.
4621 /// - `pMemsetParams`: Parameters for the memory set.
4622 pub fn cudaGraphAddMemsetNode(
4623 pGraphNode: *mut cudaGraphNode_t,
4624 graph: cudaGraph_t,
4625 pDependencies: *const cudaGraphNode_t,
4626 numDependencies: size_t,
4627 pMemsetParams: *const cudaMemsetParams,
4628 ) -> cudaError_t;
4629}
4630singe_loader::functions! { crate::RUNTIME;
4631 /// Returns a memset node’s parameters.
4632 ///
4633 /// Returns the parameters of memset node `node` in `pNodeParams`.
4634 ///
4635 /// # Parameters
4636 ///
4637 /// - `node`: Node to get the parameters for.
4638 /// - `pNodeParams`: Pointer to return the parameters.
4639 pub fn cudaGraphMemsetNodeGetParams(
4640 node: cudaGraphNode_t,
4641 pNodeParams: *mut cudaMemsetParams,
4642 ) -> cudaError_t;
4643}
4644singe_loader::functions! { crate::RUNTIME;
4645 /// Sets a memset node’s parameters.
4646 ///
4647 /// Sets the parameters of memset node `node` to `pNodeParams`.
4648 ///
4649 /// # Parameters
4650 ///
4651 /// - `node`: Node to set the parameters for.
4652 /// - `pNodeParams`: Parameters to copy.
4653 pub fn cudaGraphMemsetNodeSetParams(
4654 node: cudaGraphNode_t,
4655 pNodeParams: *const cudaMemsetParams,
4656 ) -> cudaError_t;
4657}
4658singe_loader::functions! { crate::RUNTIME;
4659 /// Creates a host execution node and adds it to a graph.
4660 ///
4661 /// Creates a new CPU execution node and adds it to `graph` with `numDependencies` dependencies specified via `pDependencies` and arguments specified in `pNodeParams`. It is possible for `numDependencies` to be 0, in which case the node will be placed at the root of the graph. `pDependencies` may not have any duplicate entries. A handle to the new node will be returned in `pGraphNode`.
4662 ///
4663 /// When the graph is launched, the node will invoke the specified CPU function. Host nodes are not supported under MPS with pre-Volta GPUs.
4664 ///
4665 /// # Parameters
4666 ///
4667 /// - `pGraphNode`: Returns newly created node.
4668 /// - `graph`: Graph to which to add the node.
4669 /// - `pDependencies`: Dependencies of the node.
4670 /// - `numDependencies`: Number of dependencies.
4671 /// - `pNodeParams`: Parameters for the host node.
4672 pub fn cudaGraphAddHostNode(
4673 pGraphNode: *mut cudaGraphNode_t,
4674 graph: cudaGraph_t,
4675 pDependencies: *const cudaGraphNode_t,
4676 numDependencies: size_t,
4677 pNodeParams: *const cudaHostNodeParams,
4678 ) -> cudaError_t;
4679}
4680singe_loader::functions! { crate::RUNTIME;
4681 /// Returns a host node’s parameters.
4682 ///
4683 /// Returns the parameters of host node `node` in `pNodeParams`.
4684 ///
4685 /// # Parameters
4686 ///
4687 /// - `node`: Node to get the parameters for.
4688 /// - `pNodeParams`: Pointer to return the parameters.
4689 pub fn cudaGraphHostNodeGetParams(
4690 node: cudaGraphNode_t,
4691 pNodeParams: *mut cudaHostNodeParams,
4692 ) -> cudaError_t;
4693}
4694singe_loader::functions! { crate::RUNTIME;
4695 /// Sets a host node’s parameters.
4696 ///
4697 /// Sets the parameters of host node `node` to `nodeParams`.
4698 ///
4699 /// # Parameters
4700 ///
4701 /// - `node`: Node to set the parameters for.
4702 /// - `pNodeParams`: Parameters to copy.
4703 pub fn cudaGraphHostNodeSetParams(
4704 node: cudaGraphNode_t,
4705 pNodeParams: *const cudaHostNodeParams,
4706 ) -> cudaError_t;
4707}
4708singe_loader::functions! { crate::RUNTIME;
4709 /// Creates a child graph node and adds it to a graph.
4710 ///
4711 /// Creates a new node which executes an embedded graph, and adds it to `graph` with `numDependencies` dependencies specified via `pDependencies`. It is possible for `numDependencies` to be 0, in which case the node will be placed at the root of the graph. `pDependencies` may not have any duplicate entries. A handle to the new node will be returned in `pGraphNode`.
4712 ///
4713 /// If `childGraph` contains allocation nodes, free nodes, or conditional nodes, this call will return an error.
4714 ///
4715 /// The node executes an embedded child graph. The child graph is cloned in this call.
4716 ///
4717 /// # Parameters
4718 ///
4719 /// - `pGraphNode`: Returns newly created node.
4720 /// - `graph`: Graph to which to add the node.
4721 /// - `pDependencies`: Dependencies of the node.
4722 /// - `numDependencies`: Number of dependencies.
4723 /// - `childGraph`: The graph to clone into this node.
4724 pub fn cudaGraphAddChildGraphNode(
4725 pGraphNode: *mut cudaGraphNode_t,
4726 graph: cudaGraph_t,
4727 pDependencies: *const cudaGraphNode_t,
4728 numDependencies: size_t,
4729 childGraph: cudaGraph_t,
4730 ) -> cudaError_t;
4731}
4732singe_loader::functions! { crate::RUNTIME;
4733 /// Gets a handle to the embedded graph of a child graph node.
4734 ///
4735 /// 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.
4736 ///
4737 /// Allocation and free nodes cannot be added to the returned graph. Attempting to do so will return an error.
4738 ///
4739 /// # Parameters
4740 ///
4741 /// - `node`: Node to get the embedded graph for.
4742 /// - `pGraph`: Location to store a handle to the graph.
4743 pub fn cudaGraphChildGraphNodeGetGraph(
4744 node: cudaGraphNode_t,
4745 pGraph: *mut cudaGraph_t,
4746 ) -> cudaError_t;
4747}
4748singe_loader::functions! { crate::RUNTIME;
4749 /// Creates an empty node and adds it to a graph.
4750 ///
4751 /// Creates a new node which performs no operation, and adds it to `graph` with `numDependencies` dependencies specified via `pDependencies`. It is possible for `numDependencies` to be 0, in which case the node will be placed at the root of the graph. `pDependencies` may not have any duplicate entries. A handle to the new node will be returned in `pGraphNode`.
4752 ///
4753 /// 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.
4754 ///
4755 /// # Parameters
4756 ///
4757 /// - `pGraphNode`: Returns newly created node.
4758 /// - `graph`: Graph to which to add the node.
4759 /// - `pDependencies`: Dependencies of the node.
4760 /// - `numDependencies`: Number of dependencies.
4761 pub fn cudaGraphAddEmptyNode(
4762 pGraphNode: *mut cudaGraphNode_t,
4763 graph: cudaGraph_t,
4764 pDependencies: *const cudaGraphNode_t,
4765 numDependencies: size_t,
4766 ) -> cudaError_t;
4767}
4768singe_loader::functions! { crate::RUNTIME;
4769 /// Creates an event record node and adds it to a graph.
4770 ///
4771 /// 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`.
4772 ///
4773 /// Each launch of the graph will record `event` to capture execution of the node’s dependencies.
4774 ///
4775 /// These nodes may not be used in loops or conditionals.
4776 ///
4777 /// # Parameters
4778 ///
4779 /// - `numDependencies`: Number of dependencies.
4780 /// - `event`: Event for the node.
4781 pub fn cudaGraphAddEventRecordNode(
4782 pGraphNode: *mut cudaGraphNode_t,
4783 graph: cudaGraph_t,
4784 pDependencies: *const cudaGraphNode_t,
4785 numDependencies: size_t,
4786 event: cudaEvent_t,
4787 ) -> cudaError_t;
4788}
4789singe_loader::functions! { crate::RUNTIME;
4790 /// Returns the event associated with an event record node.
4791 ///
4792 /// Returns the event of event record node `hNode` in `event_out`.
4793 ///
4794 /// # Parameters
4795 ///
4796 /// - `event_out`: Pointer to return the event.
4797 pub fn cudaGraphEventRecordNodeGetEvent(
4798 node: cudaGraphNode_t,
4799 event_out: *mut cudaEvent_t,
4800 ) -> cudaError_t;
4801}
4802singe_loader::functions! { crate::RUNTIME;
4803 /// Sets an event record node’s event.
4804 ///
4805 /// Sets the event of event record node `hNode` to `event`.
4806 ///
4807 /// # Parameters
4808 ///
4809 /// - `event`: Event to use.
4810 pub fn cudaGraphEventRecordNodeSetEvent(
4811 node: cudaGraphNode_t,
4812 event: cudaEvent_t,
4813 ) -> cudaError_t;
4814}
4815singe_loader::functions! { crate::RUNTIME;
4816 /// Creates an event wait node and adds it to a graph.
4817 ///
4818 /// 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`.
4819 ///
4820 /// The graph node will wait for all work captured in `event`. See ::cuEventRecord() for details on what is captured by an event. The synchronization will be performed efficiently on the device when applicable. `event` may be from a different context or device than the launch stream.
4821 ///
4822 /// These nodes may not be used in loops or conditionals.
4823 ///
4824 /// # Parameters
4825 ///
4826 /// - `numDependencies`: Number of dependencies.
4827 /// - `event`: Event for the node.
4828 pub fn cudaGraphAddEventWaitNode(
4829 pGraphNode: *mut cudaGraphNode_t,
4830 graph: cudaGraph_t,
4831 pDependencies: *const cudaGraphNode_t,
4832 numDependencies: size_t,
4833 event: cudaEvent_t,
4834 ) -> cudaError_t;
4835}
4836singe_loader::functions! { crate::RUNTIME;
4837 /// Returns the event associated with an event wait node.
4838 ///
4839 /// Returns the event of event wait node `hNode` in `event_out`.
4840 ///
4841 /// # Parameters
4842 ///
4843 /// - `event_out`: Pointer to return the event.
4844 pub fn cudaGraphEventWaitNodeGetEvent(
4845 node: cudaGraphNode_t,
4846 event_out: *mut cudaEvent_t,
4847 ) -> cudaError_t;
4848}
4849singe_loader::functions! { crate::RUNTIME;
4850 /// Sets an event wait node’s event.
4851 ///
4852 /// Sets the event of event wait node `hNode` to `event`.
4853 ///
4854 /// # Parameters
4855 ///
4856 /// - `event`: Event to use.
4857 pub fn cudaGraphEventWaitNodeSetEvent(
4858 node: cudaGraphNode_t,
4859 event: cudaEvent_t,
4860 ) -> cudaError_t;
4861}
4862singe_loader::functions! { crate::RUNTIME;
4863 /// Creates an external semaphore signal node and adds it to a graph.
4864 ///
4865 /// Creates a new external semaphore signal node and adds it to `graph` 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 `pGraphNode`.
4866 ///
4867 /// 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.
4868 ///
4869 /// # Parameters
4870 ///
4871 /// - `pGraphNode`: Returns newly created node.
4872 /// - `graph`: Graph to which to add the node.
4873 /// - `pDependencies`: Dependencies of the node.
4874 /// - `numDependencies`: Number of dependencies.
4875 /// - `nodeParams`: Parameters for the node.
4876 pub fn cudaGraphAddExternalSemaphoresSignalNode(
4877 pGraphNode: *mut cudaGraphNode_t,
4878 graph: cudaGraph_t,
4879 pDependencies: *const cudaGraphNode_t,
4880 numDependencies: size_t,
4881 nodeParams: *const cudaExternalSemaphoreSignalNodeParams,
4882 ) -> cudaError_t;
4883}
4884singe_loader::functions! { crate::RUNTIME;
4885 /// Returns an external semaphore signal node’s parameters.
4886 ///
4887 /// 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 [`cudaGraphExternalSemaphoresSignalNodeSetParams`] to update the parameters of this node.
4888 ///
4889 /// # Parameters
4890 ///
4891 /// - `hNode`: Node to get the parameters for.
4892 /// - `params_out`: Pointer to return the parameters.
4893 pub fn cudaGraphExternalSemaphoresSignalNodeGetParams(
4894 hNode: cudaGraphNode_t,
4895 params_out: *mut cudaExternalSemaphoreSignalNodeParams,
4896 ) -> cudaError_t;
4897}
4898singe_loader::functions! { crate::RUNTIME;
4899 /// Sets an external semaphore signal node’s parameters.
4900 ///
4901 /// Sets the parameters of an external semaphore signal node `hNode` to `nodeParams`.
4902 ///
4903 /// # Parameters
4904 ///
4905 /// - `hNode`: Node to set the parameters for.
4906 /// - `nodeParams`: Parameters to copy.
4907 pub fn cudaGraphExternalSemaphoresSignalNodeSetParams(
4908 hNode: cudaGraphNode_t,
4909 nodeParams: *const cudaExternalSemaphoreSignalNodeParams,
4910 ) -> cudaError_t;
4911}
4912singe_loader::functions! { crate::RUNTIME;
4913 /// Creates an external semaphore wait node and adds it to a graph.
4914 ///
4915 /// Creates a new external semaphore wait node and adds it to `graph` 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 `pGraphNode`.
4916 ///
4917 /// 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.
4918 ///
4919 /// # Parameters
4920 ///
4921 /// - `pGraphNode`: Returns newly created node.
4922 /// - `graph`: Graph to which to add the node.
4923 /// - `pDependencies`: Dependencies of the node.
4924 /// - `numDependencies`: Number of dependencies.
4925 /// - `nodeParams`: Parameters for the node.
4926 pub fn cudaGraphAddExternalSemaphoresWaitNode(
4927 pGraphNode: *mut cudaGraphNode_t,
4928 graph: cudaGraph_t,
4929 pDependencies: *const cudaGraphNode_t,
4930 numDependencies: size_t,
4931 nodeParams: *const cudaExternalSemaphoreWaitNodeParams,
4932 ) -> cudaError_t;
4933}
4934singe_loader::functions! { crate::RUNTIME;
4935 /// Returns an external semaphore wait node’s parameters.
4936 ///
4937 /// 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 [`cudaGraphExternalSemaphoresSignalNodeSetParams`] to update the parameters of this node.
4938 ///
4939 /// # Parameters
4940 ///
4941 /// - `hNode`: Node to get the parameters for.
4942 /// - `params_out`: Pointer to return the parameters.
4943 pub fn cudaGraphExternalSemaphoresWaitNodeGetParams(
4944 hNode: cudaGraphNode_t,
4945 params_out: *mut cudaExternalSemaphoreWaitNodeParams,
4946 ) -> cudaError_t;
4947}
4948singe_loader::functions! { crate::RUNTIME;
4949 /// Sets an external semaphore wait node’s parameters.
4950 ///
4951 /// Sets the parameters of an external semaphore wait node `hNode` to `nodeParams`.
4952 ///
4953 /// # Parameters
4954 ///
4955 /// - `hNode`: Node to set the parameters for.
4956 /// - `nodeParams`: Parameters to copy.
4957 pub fn cudaGraphExternalSemaphoresWaitNodeSetParams(
4958 hNode: cudaGraphNode_t,
4959 nodeParams: *const cudaExternalSemaphoreWaitNodeParams,
4960 ) -> cudaError_t;
4961}
4962singe_loader::functions! { crate::RUNTIME;
4963 /// Creates an allocation node and adds it to a graph.
4964 ///
4965 /// Creates a new allocation node and adds it to `graph` with `numDependencies` dependencies specified via `pDependencies` 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. `pDependencies` may not have any duplicate entries. A handle to the new node will be returned in `pGraphNode`.
4966 ///
4967 /// When [`cudaGraphAddMemAllocNode`] creates an allocation node, it returns the address of the allocation in `nodeParams.dptr`. The allocation’s address remains fixed across instantiations and launches.
4968 ///
4969 /// If the allocation is freed in the same graph, by creating a free node using [`cudaGraphAddMemFreeNode`], 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.
4970 ///
4971 /// 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.
4972 ///
4973 /// Allocations which are not freed in the same graph can be freed by:
4974 ///
4975 /// 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.
4976 ///
4977 /// The following restrictions apply to graphs which contain allocation and/or memory free nodes.
4978 ///
4979 /// # Parameters
4980 ///
4981 /// - `pGraphNode`: Returns newly created node.
4982 /// - `graph`: Graph to which to add the node.
4983 /// - `pDependencies`: Dependencies of the node.
4984 /// - `numDependencies`: Number of dependencies.
4985 /// - `nodeParams`: Parameters for the node.
4986 pub fn cudaGraphAddMemAllocNode(
4987 pGraphNode: *mut cudaGraphNode_t,
4988 graph: cudaGraph_t,
4989 pDependencies: *const cudaGraphNode_t,
4990 numDependencies: size_t,
4991 nodeParams: *mut cudaMemAllocNodeParams,
4992 ) -> cudaError_t;
4993}
4994singe_loader::functions! { crate::RUNTIME;
4995 /// Returns a memory alloc node’s parameters.
4996 ///
4997 /// 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.
4998 ///
4999 /// # Parameters
5000 ///
5001 /// - `node`: Node to get the parameters for.
5002 /// - `params_out`: Pointer to return the parameters.
5003 pub fn cudaGraphMemAllocNodeGetParams(
5004 node: cudaGraphNode_t,
5005 params_out: *mut cudaMemAllocNodeParams,
5006 ) -> cudaError_t;
5007}
5008singe_loader::functions! { crate::RUNTIME;
5009 /// Creates a memory free node and adds it to a graph.
5010 ///
5011 /// Creates a new memory free node and adds it to `graph` with `numDependencies` dependencies specified via `pDependencies` and address specified in `dptr`. It is possible for `numDependencies` to be 0, in which case the node will be placed at the root of the graph. `pDependencies` may not have any duplicate entries. A handle to the new node will be returned in `pGraphNode`.
5012 ///
5013 /// [`cudaGraphAddMemFreeNode`] will return [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) if the user attempts to free:
5014 ///
5015 /// The following restrictions apply to graphs which contain allocation and/or memory free nodes.
5016 ///
5017 /// # Parameters
5018 ///
5019 /// - `pGraphNode`: Returns newly created node.
5020 /// - `graph`: Graph to which to add the node.
5021 /// - `pDependencies`: Dependencies of the node.
5022 /// - `numDependencies`: Number of dependencies.
5023 /// - `dptr`: Address of memory to free.
5024 pub fn cudaGraphAddMemFreeNode(
5025 pGraphNode: *mut cudaGraphNode_t,
5026 graph: cudaGraph_t,
5027 pDependencies: *const cudaGraphNode_t,
5028 numDependencies: size_t,
5029 dptr: *mut ::core::ffi::c_void,
5030 ) -> cudaError_t;
5031}
5032singe_loader::functions! { crate::RUNTIME;
5033 /// Returns a memory free node’s parameters.
5034 ///
5035 /// Returns the address of a memory free node `hNode` in `dptr_out`.
5036 ///
5037 /// # Parameters
5038 ///
5039 /// - `node`: Node to get the parameters for.
5040 /// - `dptr_out`: Pointer to return the device address.
5041 pub fn cudaGraphMemFreeNodeGetParams(
5042 node: cudaGraphNode_t,
5043 dptr_out: *mut ::core::ffi::c_void,
5044 ) -> cudaError_t;
5045}
5046singe_loader::functions! { crate::RUNTIME;
5047 /// Free unused memory that was cached on the specified device for use with graphs back to the OS.
5048 ///
5049 /// 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.
5050 ///
5051 /// # Parameters
5052 ///
5053 /// - `device`: - The device for which cached memory should be freed.
5054 pub fn cudaDeviceGraphMemTrim(device: ::core::ffi::c_int) -> cudaError_t;
5055}
5056singe_loader::functions! { crate::RUNTIME;
5057 /// Query asynchronous allocation attributes related to graphs.
5058 ///
5059 /// Valid attributes are.
5060 ///
5061 /// # Parameters
5062 ///
5063 /// - `device`: Specifies the scope of the query.
5064 /// - `attr`: attribute to get.
5065 /// - `value`: retrieved value.
5066 pub fn cudaDeviceGetGraphMemAttribute(
5067 device: ::core::ffi::c_int,
5068 attr: cudaGraphMemAttributeType,
5069 value: *mut ::core::ffi::c_void,
5070 ) -> cudaError_t;
5071}
5072singe_loader::functions! { crate::RUNTIME;
5073 /// Set asynchronous allocation attributes related to graphs.
5074 ///
5075 /// Valid attributes are.
5076 ///
5077 /// # Parameters
5078 ///
5079 /// - `device`: Specifies the scope of the query.
5080 /// - `attr`: attribute to get.
5081 /// - `value`: pointer to value to set.
5082 pub fn cudaDeviceSetGraphMemAttribute(
5083 device: ::core::ffi::c_int,
5084 attr: cudaGraphMemAttributeType,
5085 value: *mut ::core::ffi::c_void,
5086 ) -> cudaError_t;
5087}
5088singe_loader::functions! { crate::RUNTIME;
5089 /// Clones a graph.
5090 ///
5091 /// This function creates a copy of `originalGraph` and returns it in `pGraphClone`. All parameters are copied into the cloned graph. The original graph may be modified after this call without affecting the clone.
5092 ///
5093 /// Child graph nodes in the original graph are recursively copied into the clone.
5094 ///
5095 /// # Parameters
5096 ///
5097 /// - `pGraphClone`: Returns newly created cloned graph.
5098 /// - `originalGraph`: Graph to clone.
5099 pub fn cudaGraphClone(
5100 pGraphClone: *mut cudaGraph_t,
5101 originalGraph: cudaGraph_t,
5102 ) -> cudaError_t;
5103}
5104singe_loader::functions! { crate::RUNTIME;
5105 /// Finds a cloned version of a node.
5106 ///
5107 /// This function returns the node in `clonedGraph` corresponding to `originalNode` in the original graph.
5108 ///
5109 /// `clonedGraph` must have been cloned from `originalGraph` via [`cudaGraphClone`]. `originalNode` must have been in `originalGraph` at the time of the call to [`cudaGraphClone`], and the corresponding cloned node in `clonedGraph` must not have been removed. The cloned node is then returned via `pClonedNode`.
5110 ///
5111 /// # Parameters
5112 ///
5113 /// - `pNode`: Returns handle to the cloned node.
5114 /// - `originalNode`: Handle to the original node.
5115 /// - `clonedGraph`: Cloned graph to query.
5116 pub fn cudaGraphNodeFindInClone(
5117 pNode: *mut cudaGraphNode_t,
5118 originalNode: cudaGraphNode_t,
5119 clonedGraph: cudaGraph_t,
5120 ) -> cudaError_t;
5121}
5122singe_loader::functions! { crate::RUNTIME;
5123 /// Returns a node’s type.
5124 ///
5125 /// Returns the node type of `node` in `pType`.
5126 ///
5127 /// # Parameters
5128 ///
5129 /// - `node`: Node to query.
5130 /// - `pType`: Pointer to return the node type.
5131 pub fn cudaGraphNodeGetType(
5132 node: cudaGraphNode_t,
5133 pType: *mut cudaGraphNodeType,
5134 ) -> cudaError_t;
5135}
5136singe_loader::functions! { crate::RUNTIME;
5137 /// Returns the graph that contains a given graph node.
5138 ///
5139 /// Returns the graph that contains `hNode` in `*phGraph`. If hNode is in a child graph, the child graph it is in is returned.
5140 ///
5141 /// # Parameters
5142 ///
5143 /// - `hNode`: Node to query.
5144 /// - `phGraph`: Pointer to return the containing graph.
5145 pub fn cudaGraphNodeGetContainingGraph(
5146 hNode: cudaGraphNode_t,
5147 phGraph: *mut cudaGraph_t,
5148 ) -> cudaError_t;
5149}
5150singe_loader::functions! { crate::RUNTIME;
5151 /// Returns the node id of a given graph node.
5152 ///
5153 /// Returns the node id of `hNode` in `*nodeId`. The nodeId matches that referenced by [`cudaGraphDebugDotPrint`]. The local nodeId and graphId together can uniquely identify the node.
5154 ///
5155 /// # Parameters
5156 ///
5157 /// - `hNode`: Node to query.
5158 /// - `nodeId`: Pointer to return the nodeId.
5159 pub fn cudaGraphNodeGetLocalId(
5160 hNode: cudaGraphNode_t,
5161 nodeId: *mut ::core::ffi::c_uint,
5162 ) -> cudaError_t;
5163}
5164singe_loader::functions! { crate::RUNTIME;
5165 /// Returns an id used by tools to identify a given node.
5166 ///
5167 /// # Parameters
5168 ///
5169 /// - `hNode`: Node to query.
5170 pub fn cudaGraphNodeGetToolsId(
5171 hNode: cudaGraphNode_t,
5172 toolsNodeId: *mut ::core::ffi::c_ulonglong,
5173 ) -> cudaError_t;
5174}
5175singe_loader::functions! { crate::RUNTIME;
5176 /// Returns the id of a given graph.
5177 ///
5178 /// Returns the id of `hGraph` in `*graphId`. The value in `*graphId` matches that referenced by [`cudaGraphDebugDotPrint`].
5179 ///
5180 /// # Parameters
5181 ///
5182 /// - `hGraph`: Graph to query.
5183 pub fn cudaGraphGetId(
5184 hGraph: cudaGraph_t,
5185 graphID: *mut ::core::ffi::c_uint,
5186 ) -> cudaError_t;
5187}
5188singe_loader::functions! { crate::RUNTIME;
5189 /// Returns the id of a given graph exec.
5190 ///
5191 /// Returns the id of `hGraphExec` in `*graphId`. The value in `*graphId` matches that referenced by [`cudaGraphDebugDotPrint`].
5192 ///
5193 /// # Parameters
5194 ///
5195 /// - `hGraphExec`: Graph to query.
5196 pub fn cudaGraphExecGetId(
5197 hGraphExec: cudaGraphExec_t,
5198 graphID: *mut ::core::ffi::c_uint,
5199 ) -> cudaError_t;
5200}
5201singe_loader::functions! { crate::RUNTIME;
5202 /// Returns a graph’s nodes.
5203 ///
5204 /// Returns a list of `graph'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`.
5205 ///
5206 /// # Parameters
5207 ///
5208 /// - `graph`: Graph to query.
5209 /// - `nodes`: Pointer to return the nodes.
5210 /// - `numNodes`: See description.
5211 pub fn cudaGraphGetNodes(
5212 graph: cudaGraph_t,
5213 nodes: *mut cudaGraphNode_t,
5214 numNodes: *mut size_t,
5215 ) -> cudaError_t;
5216}
5217singe_loader::functions! { crate::RUNTIME;
5218 /// Returns a graph’s root nodes.
5219 ///
5220 /// Returns a list of `graph's` root nodes. `pRootNodes` may be NULL, in which case this function will return the number of root nodes in `pNumRootNodes`. Otherwise, `pNumRootNodes` entries will be filled in. If `pNumRootNodes` is higher than the actual number of root nodes, the remaining entries in `pRootNodes` will be set to NULL, and the number of nodes actually obtained will be returned in `pNumRootNodes`.
5221 ///
5222 /// # Parameters
5223 ///
5224 /// - `graph`: Graph to query.
5225 /// - `pRootNodes`: Pointer to return the root nodes.
5226 /// - `pNumRootNodes`: See description.
5227 pub fn cudaGraphGetRootNodes(
5228 graph: cudaGraph_t,
5229 pRootNodes: *mut cudaGraphNode_t,
5230 pNumRootNodes: *mut size_t,
5231 ) -> cudaError_t;
5232}
5233singe_loader::functions! { crate::RUNTIME;
5234 /// Returns a graph’s dependency edges.
5235 ///
5236 /// Returns a list of `graph'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 losst query via NULL `edgeData` will result in [cudaErrorLossyQuery](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ad484d9d8e8f269cf93d4c111b646f908). If `edgeData` is non-NULL then `from` and `to` must be as well.
5237 ///
5238 /// # Parameters
5239 ///
5240 /// - `graph`: Graph to get the edges from.
5241 /// - `from`: Location to return edge endpoints.
5242 /// - `to`: Location to return edge endpoints.
5243 /// - `edgeData`: Optional location to return edge data.
5244 /// - `numEdges`: See description.
5245 pub fn cudaGraphGetEdges(
5246 graph: cudaGraph_t,
5247 from: *mut cudaGraphNode_t,
5248 to: *mut cudaGraphNode_t,
5249 edgeData: *mut cudaGraphEdgeData,
5250 numEdges: *mut size_t,
5251 ) -> cudaError_t;
5252}
5253singe_loader::functions! { crate::RUNTIME;
5254 /// Returns a node’s dependencies.
5255 ///
5256 /// Returns a list of `node's` dependencies. `pDependencies` may be NULL, in which case this function will return the number of dependencies in `pNumDependencies`. Otherwise, `pNumDependencies` entries will be filled in. If `pNumDependencies` is higher than the actual number of dependencies, the remaining entries in `pDependencies` will be set to NULL, and the number of nodes actually obtained will be returned in `pNumDependencies`.
5257 ///
5258 /// Note that if an edge has non-zero (non-default) edge data and `edgeData` is NULL, this API will return [cudaErrorLossyQuery](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ad484d9d8e8f269cf93d4c111b646f908). If `edgeData` is non-NULL, then `pDependencies` must be as well.
5259 ///
5260 /// # Parameters
5261 ///
5262 /// - `node`: Node to query.
5263 /// - `pDependencies`: Pointer to return the dependencies.
5264 /// - `edgeData`: Optional array to return edge data for each dependency.
5265 /// - `pNumDependencies`: See description.
5266 pub fn cudaGraphNodeGetDependencies(
5267 node: cudaGraphNode_t,
5268 pDependencies: *mut cudaGraphNode_t,
5269 edgeData: *mut cudaGraphEdgeData,
5270 pNumDependencies: *mut size_t,
5271 ) -> cudaError_t;
5272}
5273singe_loader::functions! { crate::RUNTIME;
5274 /// Returns a node’s dependent nodes.
5275 ///
5276 /// Returns a list of `node's` dependent nodes. `pDependentNodes` may be NULL, in which case this function will return the number of dependent nodes in `pNumDependentNodes`. Otherwise, `pNumDependentNodes` entries will be filled in. If `pNumDependentNodes` is higher than the actual number of dependent nodes, the remaining entries in `pDependentNodes` will be set to NULL, and the number of nodes actually obtained will be returned in `pNumDependentNodes`.
5277 ///
5278 /// Note that if an edge has non-zero (non-default) edge data and `edgeData` is NULL, this API will return [cudaErrorLossyQuery](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ad484d9d8e8f269cf93d4c111b646f908). If `edgeData` is non-NULL, then `pDependentNodes` must be as well.
5279 ///
5280 /// # Parameters
5281 ///
5282 /// - `node`: Node to query.
5283 /// - `pDependentNodes`: Pointer to return the dependent nodes.
5284 /// - `edgeData`: Optional pointer to return edge data for dependent nodes.
5285 /// - `pNumDependentNodes`: See description.
5286 pub fn cudaGraphNodeGetDependentNodes(
5287 node: cudaGraphNode_t,
5288 pDependentNodes: *mut cudaGraphNode_t,
5289 edgeData: *mut cudaGraphEdgeData,
5290 pNumDependentNodes: *mut size_t,
5291 ) -> cudaError_t;
5292}
5293singe_loader::functions! { crate::RUNTIME;
5294 /// Adds dependency edges to a graph.
5295 ///
5296 /// The number of dependencies to be added is defined by `numDependencies` Elements in `pFrom` and `pTo` at corresponding indices define a dependency. Each node in `pFrom` and `pTo` must belong to `graph`.
5297 ///
5298 /// If `numDependencies` is 0, elements in `pFrom` and `pTo` will be ignored. Specifying an existing dependency will return an error.
5299 ///
5300 /// # Parameters
5301 ///
5302 /// - `graph`: Graph to which dependencies are added.
5303 /// - `from`: Array of nodes that provide the dependencies.
5304 /// - `to`: Array of dependent nodes.
5305 /// - `edgeData`: Optional array of edge data. If NULL, default (zeroed) edge data is assumed.
5306 /// - `numDependencies`: Number of dependencies to be added.
5307 pub fn cudaGraphAddDependencies(
5308 graph: cudaGraph_t,
5309 from: *const cudaGraphNode_t,
5310 to: *const cudaGraphNode_t,
5311 edgeData: *const cudaGraphEdgeData,
5312 numDependencies: size_t,
5313 ) -> cudaError_t;
5314}
5315singe_loader::functions! { crate::RUNTIME;
5316 /// Removes dependency edges from a graph.
5317 ///
5318 /// The number of `pDependencies` to be removed is defined by `numDependencies`. Elements in `pFrom` and `pTo` at corresponding indices define a dependency. Each node in `pFrom` and `pTo` must belong to `graph`.
5319 ///
5320 /// If `numDependencies` is 0, elements in `pFrom` and `pTo` 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.
5321 ///
5322 /// # Parameters
5323 ///
5324 /// - `graph`: Graph from which to remove dependencies.
5325 /// - `from`: Array of nodes that provide the dependencies.
5326 /// - `to`: Array of dependent nodes.
5327 /// - `edgeData`: Optional array of edge data. If NULL, edge data is assumed to be default (zeroed).
5328 /// - `numDependencies`: Number of dependencies to be removed.
5329 pub fn cudaGraphRemoveDependencies(
5330 graph: cudaGraph_t,
5331 from: *const cudaGraphNode_t,
5332 to: *const cudaGraphNode_t,
5333 edgeData: *const cudaGraphEdgeData,
5334 numDependencies: size_t,
5335 ) -> cudaError_t;
5336}
5337singe_loader::functions! { crate::RUNTIME;
5338 /// Remove a node from the graph.
5339 ///
5340 /// Removes `node` from its graph. This operation also severs any dependencies of other nodes on `node` and vice versa.
5341 ///
5342 /// Dependencies cannot be removed from graphs which contain allocation or free nodes. Any attempt to do so will return an error.
5343 ///
5344 /// # Parameters
5345 ///
5346 /// - `node`: - Node to remove
5347 pub fn cudaGraphDestroyNode(node: cudaGraphNode_t) -> cudaError_t;
5348}
5349singe_loader::functions! { crate::RUNTIME;
5350 /// Creates an executable graph from a graph
5351 ///
5352 /// Instantiates `graph` 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 `pGraphExec`.
5353 ///
5354 /// The `flags` parameter controls the behavior of instantiation and subsequent graph launches. Valid flags are:
5355 ///
5356 /// - ::cudaGraphInstantiateFlagAutoFreeOnLaunch, which configures a graph containing memory allocation nodes to automatically free any unfreed memory allocations before the graph is relaunched.
5357 ///
5358 /// - ::cudaGraphInstantiateFlagDeviceLaunch, 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 cannot be used in conjunction with ::cudaGraphInstantiateFlagAutoFreeOnLaunch.
5359 ///
5360 /// - ::cudaGraphInstantiateFlagUseNodePriority, 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.
5361 ///
5362 /// If `graph` 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 ::cudaGraphExecDestroy will result in an error. The same also applies if `graph` contains any device-updatable kernel nodes.
5363 ///
5364 /// Graphs instantiated for launch on the device have additional restrictions which do not apply to host graphs:
5365 ///
5366 /// - The graph's nodes must reside on a single device.
5367 /// - The graph can only contain kernel nodes, memcpy nodes, memset nodes, and child graph nodes.
5368 /// - The graph cannot be empty and must contain at least one kernel, memcpy, or memset node. Operation-specific restrictions are outlined below.
5369 /// - Kernel nodes:
5370 /// - Use of CUDA Dynamic Parallelism is not permitted.
5371 /// - Cooperative launches are permitted as long as MPS is not in use.
5372 /// - Memcpy nodes:
5373 /// - Only copies involving device memory and/or pinned device-mapped host memory are permitted.
5374 /// - Copies involving CUDA arrays are not permitted.
5375 /// - Both operands must be accessible from the current device, and the current device must match the device of other nodes in the graph.
5376 ///
5377 /// If `graph` is not instantiated for launch on the device but contains kernels which call device-side cudaGraphLaunch() from multiple devices, this will result in an error.
5378 ///
5379 ///
5380 ///
5381 ///
5382 ///
5383 /// # Return value
5384 ///
5385 /// ::cudaSuccess, ::cudaErrorInvalidValue
5386 ///
5387 /// Note: _graph_thread_safety
5388 ///
5389 /// Note: _init_rt
5390 ///
5391 /// Note: _callback
5392 ///
5393 ///
5394 ///
5395 /// See also: ::cudaGraphInstantiateWithFlags, ::cudaGraphCreate, ::cudaGraphUpload, ::cudaGraphLaunch, ::cudaGraphExecDestroy
5396 ///
5397 /// # Parameters
5398 ///
5399 /// - `pGraphExec`: - Returns instantiated graph
5400 /// - `graph`: - Graph to instantiate
5401 /// - `flags`: - Flags to control instantiation. See ::CUgraphInstantiate_flags.
5402 pub fn cudaGraphInstantiate(
5403 pGraphExec: *mut cudaGraphExec_t,
5404 graph: cudaGraph_t,
5405 flags: ::core::ffi::c_ulonglong,
5406 ) -> cudaError_t;
5407}
5408singe_loader::functions! { crate::RUNTIME;
5409 /// Creates an executable graph from a graph.
5410 ///
5411 /// Instantiates `graph` 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 `pGraphExec`.
5412 ///
5413 /// The `flags` parameter controls the behavior of instantiation and subsequent graph launches. Valid flags are:
5414 ///
5415 /// If `graph` 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 [`cudaGraphExecDestroy`] will result in an error. The same also applies if `graph` contains any device-updatable kernel nodes.
5416 ///
5417 /// If `graph` contains kernels which call device-side [`cudaGraphLaunch`] from multiple devices, this will result in an error.
5418 ///
5419 /// Graphs instantiated for launch on the device have additional restrictions which do not apply to host graphs.
5420 ///
5421 /// # Parameters
5422 ///
5423 /// - `pGraphExec`: Returns instantiated graph.
5424 /// - `graph`: Graph to instantiate.
5425 /// - `flags`: Flags to control instantiation. See ::CUgraphInstantiate_flags.
5426 pub fn cudaGraphInstantiateWithFlags(
5427 pGraphExec: *mut cudaGraphExec_t,
5428 graph: cudaGraph_t,
5429 flags: ::core::ffi::c_ulonglong,
5430 ) -> cudaError_t;
5431}
5432singe_loader::functions! { crate::RUNTIME;
5433 /// Creates an executable graph from a graph.
5434 ///
5435 /// Instantiates `graph` 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 `pGraphExec`.
5436 ///
5437 /// `instantiateParams` controls the behavior of instantiation and subsequent graph launches, as well as returning more detailed information in the event of an error. [cudaGraphInstantiateParams](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaGraphInstantiateParams.html#structcudagraphinstantiateparams) is defined as:
5438 ///
5439 /// The `flags` field controls the behavior of instantiation and subsequent graph launches. Valid flags are:
5440 ///
5441 /// If `graph` 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 [`cudaGraphExecDestroy`] will result in an error. The same also applies if `graph` contains any device-updatable kernel nodes.
5442 ///
5443 /// If `graph` contains kernels which call device-side [`cudaGraphLaunch`] from multiple devices, this will result in an error.
5444 ///
5445 /// Graphs instantiated for launch on the device have additional restrictions which do not apply to host graphs:
5446 ///
5447 /// In the event of an error, the `result_out` and `errNode_out` fields will contain more information about the nature of the error. Possible error reporting includes:
5448 ///
5449 /// If instantiation is successful, `result_out` will be set to [cudaGraphInstantiateSuccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3faefd09000966e3b9d6ca5bcf7b2b9da6b92d94f90110623dafb5fe8081f6f45), and `hErrNode_out` will be set to NULL.
5450 ///
5451 /// # Parameters
5452 ///
5453 /// - `pGraphExec`: Returns instantiated graph.
5454 /// - `graph`: Graph to instantiate.
5455 /// - `instantiateParams`: Instantiation parameters.
5456 pub fn cudaGraphInstantiateWithParams(
5457 pGraphExec: *mut cudaGraphExec_t,
5458 graph: cudaGraph_t,
5459 instantiateParams: *mut cudaGraphInstantiateParams,
5460 ) -> cudaError_t;
5461}
5462singe_loader::functions! { crate::RUNTIME;
5463 /// Query the instantiation flags of an executable graph.
5464 ///
5465 /// Returns the flags that were passed to instantiation for the given executable graph. [cudaGraphInstantiateFlagUpload](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga638577f2b0f6a98b5e6a0e6a72d09004a565872dd74cc9d97125bf43740345238) will not be returned by this API as it does not affect the resulting executable graph.
5466 ///
5467 /// # Parameters
5468 ///
5469 /// - `graphExec`: The executable graph to query.
5470 /// - `flags`: Returns the instantiation flags.
5471 pub fn cudaGraphExecGetFlags(
5472 graphExec: cudaGraphExec_t,
5473 flags: *mut ::core::ffi::c_ulonglong,
5474 ) -> cudaError_t;
5475}
5476singe_loader::functions! { crate::RUNTIME;
5477 /// Sets the parameters for a kernel node in the given graphExec.
5478 ///
5479 /// Sets the parameters of a kernel node in an executable graph `hGraphExec`. The node is identified by the corresponding node `node` in the non-executable graph, from which the executable graph was instantiated.
5480 ///
5481 /// `node` must not have been removed from the original graph. All `nodeParams` fields may change, but the following restrictions apply to `func` updates:
5482 ///
5483 /// The modifications only affect future launches of `hGraphExec`. Already enqueued or running launches of `hGraphExec` are not affected by this call. `node` is also not modified by this call.
5484 ///
5485 /// If `node` 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.
5486 ///
5487 /// # Parameters
5488 ///
5489 /// - `hGraphExec`: The executable graph in which to set the specified node.
5490 /// - `node`: kernel node from the graph from which graphExec was instantiated.
5491 /// - `pNodeParams`: Updated Parameters to set.
5492 pub fn cudaGraphExecKernelNodeSetParams(
5493 hGraphExec: cudaGraphExec_t,
5494 node: cudaGraphNode_t,
5495 pNodeParams: *const cudaKernelNodeParams,
5496 ) -> cudaError_t;
5497}
5498singe_loader::functions! { crate::RUNTIME;
5499 /// Sets the parameters for a memcpy node in the given graphExec.
5500 ///
5501 /// Updates the work represented by `node` in `hGraphExec` as though `node` had contained `pNodeParams` at instantiation. `node` must remain in the graph which was used to instantiate `hGraphExec`. Changed edges to and from `node` are ignored.
5502 ///
5503 /// The source and destination memory in `pNodeParams` 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 `pNodeParams` must be 1-dimensional. Zero-length operations are not supported.
5504 ///
5505 /// The modifications only affect future launches of `hGraphExec`. Already enqueued or running launches of `hGraphExec` are not affected by this call. `node` is also not modified by this call.
5506 ///
5507 /// Returns [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) if the memory operands’ mappings changed or either the original or new memory operands are multidimensional.
5508 ///
5509 /// # Parameters
5510 ///
5511 /// - `hGraphExec`: The executable graph in which to set the specified node.
5512 /// - `node`: Memcpy node from the graph which was used to instantiate graphExec.
5513 /// - `pNodeParams`: Updated Parameters to set.
5514 pub fn cudaGraphExecMemcpyNodeSetParams(
5515 hGraphExec: cudaGraphExec_t,
5516 node: cudaGraphNode_t,
5517 pNodeParams: *const cudaMemcpy3DParms,
5518 ) -> cudaError_t;
5519}
5520singe_loader::functions! { crate::RUNTIME;
5521 /// Sets the parameters for a memcpy node in the given graphExec to copy to a symbol on the device.
5522 ///
5523 /// Updates the work represented by `node` in `hGraphExec` as though `node` had contained the given params at instantiation. `node` must remain in the graph which was used to instantiate `hGraphExec`. Changed edges to and from `node` are ignored.
5524 ///
5525 /// `src` and `symbol` must be allocated from the same contexts as the original source and destination memory. The instantiation-time memory operands must be 1-dimensional. Zero-length operations are not supported.
5526 ///
5527 /// The modifications only affect future launches of `hGraphExec`. Already enqueued or running launches of `hGraphExec` are not affected by this call. `node` is also not modified by this call.
5528 ///
5529 /// Returns [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) if the memory operands’ mappings changed or the original memory operands are multidimensional.
5530 ///
5531 /// # Parameters
5532 ///
5533 /// - `hGraphExec`: The executable graph in which to set the specified node.
5534 /// - `node`: Memcpy node from the graph which was used to instantiate graphExec.
5535 /// - `symbol`: Device symbol address.
5536 /// - `src`: Source memory address.
5537 /// - `count`: Size in bytes to copy.
5538 /// - `offset`: Offset from start of symbol in bytes.
5539 /// - `kind`: Type of transfer.
5540 pub fn cudaGraphExecMemcpyNodeSetParamsToSymbol(
5541 hGraphExec: cudaGraphExec_t,
5542 node: cudaGraphNode_t,
5543 symbol: *const ::core::ffi::c_void,
5544 src: *const ::core::ffi::c_void,
5545 count: size_t,
5546 offset: size_t,
5547 kind: cudaMemcpyKind,
5548 ) -> cudaError_t;
5549}
5550singe_loader::functions! { crate::RUNTIME;
5551 /// Sets the parameters for a memcpy node in the given graphExec to copy from a symbol on the device.
5552 ///
5553 /// Updates the work represented by `node` in `hGraphExec` as though `node` had contained the given params at instantiation. `node` must remain in the graph which was used to instantiate `hGraphExec`. Changed edges to and from `node` are ignored.
5554 ///
5555 /// `symbol` and `dst` must be allocated from the same contexts as the original source and destination memory. The instantiation-time memory operands must be 1-dimensional. Zero-length operations are not supported.
5556 ///
5557 /// The modifications only affect future launches of `hGraphExec`. Already enqueued or running launches of `hGraphExec` are not affected by this call. `node` is also not modified by this call.
5558 ///
5559 /// Returns [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) if the memory operands’ mappings changed or the original memory operands are multidimensional.
5560 ///
5561 /// # Parameters
5562 ///
5563 /// - `hGraphExec`: The executable graph in which to set the specified node.
5564 /// - `node`: Memcpy node from the graph which was used to instantiate graphExec.
5565 /// - `dst`: Destination memory address.
5566 /// - `symbol`: Device symbol address.
5567 /// - `count`: Size in bytes to copy.
5568 /// - `offset`: Offset from start of symbol in bytes.
5569 /// - `kind`: Type of transfer.
5570 pub fn cudaGraphExecMemcpyNodeSetParamsFromSymbol(
5571 hGraphExec: cudaGraphExec_t,
5572 node: cudaGraphNode_t,
5573 dst: *mut ::core::ffi::c_void,
5574 symbol: *const ::core::ffi::c_void,
5575 count: size_t,
5576 offset: size_t,
5577 kind: cudaMemcpyKind,
5578 ) -> cudaError_t;
5579}
5580singe_loader::functions! { crate::RUNTIME;
5581 /// Sets the parameters for a memcpy node in the given graphExec to perform a 1-dimensional copy.
5582 ///
5583 /// Updates the work represented by `node` in `hGraphExec` as though `node` had contained the given params at instantiation. `node` must remain in the graph which was used to instantiate `hGraphExec`. Changed edges to and from `node` are ignored.
5584 ///
5585 /// `src` and `dst` must be allocated from the same contexts as the original source and destination memory. The instantiation-time memory operands must be 1-dimensional. Zero-length operations are not supported.
5586 ///
5587 /// The modifications only affect future launches of `hGraphExec`. Already enqueued or running launches of `hGraphExec` are not affected by this call. `node` is also not modified by this call.
5588 ///
5589 /// Returns [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c) if the memory operands’ mappings changed or the original memory operands are multidimensional.
5590 ///
5591 /// # Parameters
5592 ///
5593 /// - `hGraphExec`: The executable graph in which to set the specified node.
5594 /// - `node`: Memcpy node from the graph which was used to instantiate graphExec.
5595 /// - `dst`: Destination memory address.
5596 /// - `src`: Source memory address.
5597 /// - `count`: Size in bytes to copy.
5598 /// - `kind`: Type of transfer.
5599 pub fn cudaGraphExecMemcpyNodeSetParams1D(
5600 hGraphExec: cudaGraphExec_t,
5601 node: cudaGraphNode_t,
5602 dst: *mut ::core::ffi::c_void,
5603 src: *const ::core::ffi::c_void,
5604 count: size_t,
5605 kind: cudaMemcpyKind,
5606 ) -> cudaError_t;
5607}
5608singe_loader::functions! { crate::RUNTIME;
5609 /// Sets the parameters for a memset node in the given graphExec.
5610 ///
5611 /// Updates the work represented by `node` in `hGraphExec` as though `node` had contained `pNodeParams` at instantiation. `node` must remain in the graph which was used to instantiate `hGraphExec`. Changed edges to and from `node` are ignored.
5612 ///
5613 /// Zero sized operations are not supported.
5614 ///
5615 /// The new destination pointer in `pNodeParams` 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.
5616 ///
5617 /// Both the value and pointer address may be updated.
5618 ///
5619 /// 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.
5620 ///
5621 /// The modifications only affect future launches of `hGraphExec`. Already enqueued or running launches of `hGraphExec` are not affected by this call. `node` is also not modified by this call.
5622 ///
5623 /// # Parameters
5624 ///
5625 /// - `hGraphExec`: The executable graph in which to set the specified node.
5626 /// - `node`: Memset node from the graph which was used to instantiate graphExec.
5627 /// - `pNodeParams`: Updated Parameters to set.
5628 pub fn cudaGraphExecMemsetNodeSetParams(
5629 hGraphExec: cudaGraphExec_t,
5630 node: cudaGraphNode_t,
5631 pNodeParams: *const cudaMemsetParams,
5632 ) -> cudaError_t;
5633}
5634singe_loader::functions! { crate::RUNTIME;
5635 /// Sets the parameters for a host node in the given graphExec.
5636 ///
5637 /// Updates the work represented by `node` in `hGraphExec` as though `node` had contained `pNodeParams` at instantiation. `node` must remain in the graph which was used to instantiate `hGraphExec`. Changed edges to and from `node` are ignored.
5638 ///
5639 /// The modifications only affect future launches of `hGraphExec`. Already enqueued or running launches of `hGraphExec` are not affected by this call. `node` is also not modified by this call.
5640 ///
5641 /// # Parameters
5642 ///
5643 /// - `hGraphExec`: The executable graph in which to set the specified node.
5644 /// - `node`: Host node from the graph which was used to instantiate graphExec.
5645 /// - `pNodeParams`: Updated Parameters to set.
5646 pub fn cudaGraphExecHostNodeSetParams(
5647 hGraphExec: cudaGraphExec_t,
5648 node: cudaGraphNode_t,
5649 pNodeParams: *const cudaHostNodeParams,
5650 ) -> cudaError_t;
5651}
5652singe_loader::functions! { crate::RUNTIME;
5653 /// Updates node parameters in the child graph node in the given graphExec.
5654 ///
5655 /// Updates the work represented by `node` in `hGraphExec` as though the nodes contained in `node's` graph had the parameters contained in `childGraph's` nodes at instantiation. `node` must remain in the graph which was used to instantiate `hGraphExec`. Changed edges to and from `node` are ignored.
5656 ///
5657 /// The modifications only affect future launches of `hGraphExec`. Already enqueued or running launches of `hGraphExec` are not affected by this call. `node` is also not modified by this call.
5658 ///
5659 /// The topology of `childGraph`, as well as the node insertion order, must match that of the graph contained in `node`. See [`cudaGraphExecUpdate`] 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.
5660 ///
5661 /// # Parameters
5662 ///
5663 /// - `hGraphExec`: The executable graph in which to set the specified node.
5664 /// - `node`: Host node from the graph which was used to instantiate graphExec.
5665 /// - `childGraph`: The graph supplying the updated parameters.
5666 pub fn cudaGraphExecChildGraphNodeSetParams(
5667 hGraphExec: cudaGraphExec_t,
5668 node: cudaGraphNode_t,
5669 childGraph: cudaGraph_t,
5670 ) -> cudaError_t;
5671}
5672singe_loader::functions! { crate::RUNTIME;
5673 /// Sets the event for an event record node in the given graphExec.
5674 ///
5675 /// 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.
5676 ///
5677 /// 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.
5678 ///
5679 /// # Parameters
5680 ///
5681 /// - `hGraphExec`: The executable graph in which to set the specified node.
5682 /// - `hNode`: Event record node from the graph from which graphExec was instantiated.
5683 /// - `event`: Updated event to use.
5684 pub fn cudaGraphExecEventRecordNodeSetEvent(
5685 hGraphExec: cudaGraphExec_t,
5686 hNode: cudaGraphNode_t,
5687 event: cudaEvent_t,
5688 ) -> cudaError_t;
5689}
5690singe_loader::functions! { crate::RUNTIME;
5691 /// Sets the event for an event wait node in the given graphExec.
5692 ///
5693 /// 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.
5694 ///
5695 /// 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.
5696 ///
5697 /// # Parameters
5698 ///
5699 /// - `hGraphExec`: The executable graph in which to set the specified node.
5700 /// - `hNode`: Event wait node from the graph from which graphExec was instantiated.
5701 /// - `event`: Updated event to use.
5702 pub fn cudaGraphExecEventWaitNodeSetEvent(
5703 hGraphExec: cudaGraphExec_t,
5704 hNode: cudaGraphNode_t,
5705 event: cudaEvent_t,
5706 ) -> cudaError_t;
5707}
5708singe_loader::functions! { crate::RUNTIME;
5709 /// Sets the parameters for an external semaphore signal node in the given graphExec.
5710 ///
5711 /// 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.
5712 ///
5713 /// `hNode` must not have been removed from the original graph.
5714 ///
5715 /// 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.
5716 ///
5717 /// Changing `nodeParams->numExtSems` is not supported.
5718 ///
5719 /// # Parameters
5720 ///
5721 /// - `hGraphExec`: The executable graph in which to set the specified node.
5722 /// - `hNode`: semaphore signal node from the graph from which graphExec was instantiated.
5723 /// - `nodeParams`: Updated Parameters to set.
5724 pub fn cudaGraphExecExternalSemaphoresSignalNodeSetParams(
5725 hGraphExec: cudaGraphExec_t,
5726 hNode: cudaGraphNode_t,
5727 nodeParams: *const cudaExternalSemaphoreSignalNodeParams,
5728 ) -> cudaError_t;
5729}
5730singe_loader::functions! { crate::RUNTIME;
5731 /// Sets the parameters for an external semaphore wait node in the given graphExec.
5732 ///
5733 /// 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.
5734 ///
5735 /// `hNode` must not have been removed from the original graph.
5736 ///
5737 /// 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.
5738 ///
5739 /// Changing `nodeParams->numExtSems` is not supported.
5740 ///
5741 /// # Parameters
5742 ///
5743 /// - `hGraphExec`: The executable graph in which to set the specified node.
5744 /// - `hNode`: semaphore wait node from the graph from which graphExec was instantiated.
5745 /// - `nodeParams`: Updated Parameters to set.
5746 pub fn cudaGraphExecExternalSemaphoresWaitNodeSetParams(
5747 hGraphExec: cudaGraphExec_t,
5748 hNode: cudaGraphNode_t,
5749 nodeParams: *const cudaExternalSemaphoreWaitNodeParams,
5750 ) -> cudaError_t;
5751}
5752singe_loader::functions! { crate::RUNTIME;
5753 /// Enables or disables the specified node in the given graphExec.
5754 ///
5755 /// 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.
5756 ///
5757 /// The node is identified by the corresponding node `hNode` in the non-executable graph, from which the executable graph was instantiated.
5758 ///
5759 /// `hNode` must not have been removed from the original graph.
5760 ///
5761 /// 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.
5762 ///
5763 /// # Parameters
5764 ///
5765 /// - `hGraphExec`: The executable graph in which to set the specified node.
5766 /// - `hNode`: Node from the graph from which graphExec was instantiated.
5767 /// - `isEnabled`: Node is enabled if != 0, otherwise the node is disabled.
5768 pub fn cudaGraphNodeSetEnabled(
5769 hGraphExec: cudaGraphExec_t,
5770 hNode: cudaGraphNode_t,
5771 isEnabled: ::core::ffi::c_uint,
5772 ) -> cudaError_t;
5773}
5774singe_loader::functions! { crate::RUNTIME;
5775 /// Query whether a node in the given graphExec is enabled.
5776 ///
5777 /// Sets isEnabled to 1 if `hNode` is enabled, or 0 if `hNode` is disabled.
5778 ///
5779 /// The node is identified by the corresponding node `hNode` in the non-executable graph, from which the executable graph was instantiated.
5780 ///
5781 /// `hNode` must not have been removed from the original graph.
5782 ///
5783 /// # Parameters
5784 ///
5785 /// - `hGraphExec`: The executable graph in which to set the specified node.
5786 /// - `hNode`: Node from the graph from which graphExec was instantiated.
5787 /// - `isEnabled`: Location to return the enabled status of the node.
5788 pub fn cudaGraphNodeGetEnabled(
5789 hGraphExec: cudaGraphExec_t,
5790 hNode: cudaGraphNode_t,
5791 isEnabled: *mut ::core::ffi::c_uint,
5792 ) -> cudaError_t;
5793}
5794singe_loader::functions! { crate::RUNTIME;
5795 /// Check whether an executable graph can be updated with a graph and perform the update if possible
5796 ///
5797 /// Updates the node parameters in the instantiated graph specified by `hGraphExec` with the node parameters in a topologically identical graph specified by `hGraph`.
5798 ///
5799 /// Limitations:
5800 ///
5801 /// - Kernel nodes:
5802 /// - The owning context of the function cannot change.
5803 /// - A node whose function originally did not use CUDA dynamic parallelism cannot be updated to a function which uses CDP.
5804 /// - A node whose function originally did not make device-side update calls cannot be updated to a function which makes device-side update calls.
5805 /// - A cooperative node cannot be updated to a non-cooperative node, and vice-versa.
5806 /// - If the graph was instantiated with cudaGraphInstantiateFlagUseNodePriority, the priority attribute cannot change. Equality is checked on the originally requested priority values, before they are clamped to the device's supported range.
5807 /// - 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 device as nodes which contained such calls at instantiate-time. If no such calls were present at instantiation, these updates cannot be performed at all.
5808 /// - Neither `hGraph` nor `hGraphExec` may contain device-updatable kernel nodes.
5809 /// - Memset and memcpy nodes:
5810 /// - The CUDA device(s) to which the operand(s) was allocated/mapped cannot change.
5811 /// - The source/destination memory must be allocated from the same contexts as the original source/destination memory.
5812 /// - For 2d memsets, only address and assigned value may be updated.
5813 /// - 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.
5814 /// - Additional memcpy node restrictions:
5815 /// - Changing either the source or destination memory type(i.e. CU_MEMORYTYPE_DEVICE, CU_MEMORYTYPE_ARRAY, etc.) is not supported.
5816 /// - Conditional nodes:
5817 /// - Changing node parameters is not supported.
5818 /// - Changing parameters of nodes within the conditional body graph is subject to the rules above.
5819 /// - Conditional handle flags and default values are updated as part of the graph update.
5820 ///
5821 /// Note: The API may add further restrictions in future releases. The return code should always be checked.
5822 ///
5823 /// cudaGraphExecUpdate sets the result member of `resultInfo` to cudaGraphExecUpdateErrorTopologyChanged under the following conditions:
5824 /// - The count of nodes directly in `hGraphExec` and `hGraph` differ, in which case resultInfo->errorNode is set to NULL.
5825 /// - `hGraph` has more exit nodes than `hGraph`, in which case resultInfo->errorNode is set to one of the exit nodes in hGraph.
5826 /// - 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`.
5827 /// - 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.
5828 ///
5829 /// cudaGraphExecUpdate sets `the` result member of `resultInfo` to:
5830 /// - cudaGraphExecUpdateError if passed an invalid value.
5831 /// - cudaGraphExecUpdateErrorTopologyChanged if the graph topology changed
5832 /// - cudaGraphExecUpdateErrorNodeTypeChanged if the type of a node changed, in which case `hErrorNode_out` is set to the node from `hGraph`.
5833 /// - cudaGraphExecUpdateErrorFunctionChanged if the function of a kernel node changed (CUDA driver < 11.2)
5834 /// - cudaGraphExecUpdateErrorUnsupportedFunctionChange if the func field of a kernel changed in an unsupported way(see note above), in which case `hErrorNode_out` is set to the node from `hGraph`
5835 /// - cudaGraphExecUpdateErrorParametersChanged 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`
5836 /// - cudaGraphExecUpdateErrorAttributesChanged 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`
5837 /// - cudaGraphExecUpdateErrorNotSupported 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`
5838 ///
5839 /// If the update fails for a reason not listed above, the result member of `resultInfo` will be set to cudaGraphExecUpdateError. If the update succeeds, the result member will be set to cudaGraphExecUpdateSuccess.
5840 ///
5841 /// cudaGraphExecUpdate returns cudaSuccess when the updated was performed successfully. It returns cudaErrorGraphExecUpdateFailure if the graph update was not performed because it included changes which violated constraints specific to instantiated graph update.
5842 ///
5843 ///
5844 ///
5845 ///
5846 ///
5847 /// # Return value
5848 ///
5849 /// ::cudaSuccess, ::cudaErrorGraphExecUpdateFailure,
5850 ///
5851 /// Note: _graph_thread_safety
5852 ///
5853 /// Note: _init_rt
5854 ///
5855 /// Note: _callback
5856 ///
5857 ///
5858 ///
5859 /// See also: ::cudaGraphInstantiate
5860 ///
5861 /// # Parameters
5862 ///
5863 /// - `hGraphExec`: The instantiated graph to be updated
5864 /// - `hGraph`: The graph containing the updated parameters
5865 /// - `resultInfo`: the error info structure
5866 pub fn cudaGraphExecUpdate(
5867 hGraphExec: cudaGraphExec_t,
5868 hGraph: cudaGraph_t,
5869 resultInfo: *mut cudaGraphExecUpdateResultInfo,
5870 ) -> cudaError_t;
5871}
5872singe_loader::functions! { crate::RUNTIME;
5873 /// Uploads an executable graph in a stream.
5874 ///
5875 /// Uploads `graphExec` to the device in `stream` without executing it. Uploads of the same `graphExec` will be serialized. Each upload is ordered behind both any previous work in `stream` and any previous launches of `graphExec`. Uses memory cached by `stream` to back the allocations owned by `graphExec`.
5876 ///
5877 /// # Parameters
5878 ///
5879 /// - `graphExec`: Executable graph to upload.
5880 /// - `stream`: Stream in which to upload the graph.
5881 pub fn cudaGraphUpload(
5882 graphExec: cudaGraphExec_t,
5883 stream: cudaStream_t,
5884 ) -> cudaError_t;
5885}
5886singe_loader::functions! { crate::RUNTIME;
5887 /// Launches an executable graph in a stream.
5888 ///
5889 /// Executes `graphExec` in `stream`. Only one instance of `graphExec` may be executing at a time. Each launch is ordered behind both any previous work in `stream` and any previous launches of `graphExec`. To execute a graph concurrently, it must be instantiated multiple times into multiple executable graphs.
5890 ///
5891 /// If any allocations created by `graphExec` remain unfreed (from a previous launch) and `graphExec` was not instantiated with [cudaGraphInstantiateFlagAutoFreeOnLaunch](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga638577f2b0f6a98b5e6a0e6a72d09004a4258c8d3adc203f97e73e92810e1785f), the launch will fail with [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c).
5892 ///
5893 /// # Parameters
5894 ///
5895 /// - `graphExec`: Executable graph to launch.
5896 /// - `stream`: Stream in which to launch the graph.
5897 pub fn cudaGraphLaunch(
5898 graphExec: cudaGraphExec_t,
5899 stream: cudaStream_t,
5900 ) -> cudaError_t;
5901}
5902singe_loader::functions! { crate::RUNTIME;
5903 /// Destroys an executable graph.
5904 ///
5905 /// Destroys the executable graph specified by `graphExec`.
5906 ///
5907 /// # Parameters
5908 ///
5909 /// - `graphExec`: - Executable graph to destroy
5910 pub fn cudaGraphExecDestroy(graphExec: cudaGraphExec_t) -> cudaError_t;
5911}
5912singe_loader::functions! { crate::RUNTIME;
5913 /// Destroys a graph.
5914 ///
5915 /// Destroys the graph specified by `graph`, as well as all of its nodes.
5916 ///
5917 /// # Parameters
5918 ///
5919 /// - `graph`: - Graph to destroy
5920 pub fn cudaGraphDestroy(graph: cudaGraph_t) -> cudaError_t;
5921}
5922singe_loader::functions! { crate::RUNTIME;
5923 /// Write a DOT file describing graph structure.
5924 ///
5925 /// Using the provided `graph`, 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.
5926 ///
5927 /// # Parameters
5928 ///
5929 /// - `graph`: The graph to create a DOT file from.
5930 /// - `path`: The path to write the DOT file to.
5931 /// - `flags`: Flags from cudaGraphDebugDotFlags for specifying which additional node information to write.
5932 pub fn cudaGraphDebugDotPrint(
5933 graph: cudaGraph_t,
5934 path: *const ::core::ffi::c_char,
5935 flags: ::core::ffi::c_uint,
5936 ) -> cudaError_t;
5937}
5938singe_loader::functions! { crate::RUNTIME;
5939 /// Create a user object.
5940 ///
5941 /// Create a user object with the specified destructor callback and initial reference count. The initial references are owned by the caller.
5942 ///
5943 /// 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.
5944 ///
5945 /// See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects.
5946 ///
5947 /// # Parameters
5948 ///
5949 /// - `object_out`: Location to return the user object handle.
5950 /// - `ptr`: The pointer to pass to the destroy function.
5951 /// - `destroy`: Callback to free the user object when it is no longer in use.
5952 /// - `initialRefcount`: The initial refcount to create the object with, typically 1. The initial references are owned by the calling thread.
5953 /// - `flags`: Currently it is required to pass [cudaUserObjectNoDestructorSync](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ggaf4748f36762263564ca8a7a47fd902bbaca181af9d994c9a5290b509175ea99fe), 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.
5954 pub fn cudaUserObjectCreate(
5955 object_out: *mut cudaUserObject_t,
5956 ptr: *mut ::core::ffi::c_void,
5957 destroy: cudaHostFn_t,
5958 initialRefcount: ::core::ffi::c_uint,
5959 flags: ::core::ffi::c_uint,
5960 ) -> cudaError_t;
5961}
5962singe_loader::functions! { crate::RUNTIME;
5963 /// Retain a reference to a user object.
5964 ///
5965 /// Retains new references to a user object. The new references are owned by the caller.
5966 ///
5967 /// See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects.
5968 ///
5969 /// # Parameters
5970 ///
5971 /// - `object`: The object to retain.
5972 /// - `count`: The number of references to retain, typically 1. Must be nonzero and not larger than INT_MAX.
5973 pub fn cudaUserObjectRetain(
5974 object: cudaUserObject_t,
5975 count: ::core::ffi::c_uint,
5976 ) -> cudaError_t;
5977}
5978singe_loader::functions! { crate::RUNTIME;
5979 /// Release a reference to a user object.
5980 ///
5981 /// Releases user object references owned by the caller. The object’s destructor is invoked if the reference count reaches zero.
5982 ///
5983 /// It is undefined behavior to release references not owned by the caller, or to use a user object handle after all references are released.
5984 ///
5985 /// See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects.
5986 ///
5987 /// # Parameters
5988 ///
5989 /// - `object`: The object to release.
5990 /// - `count`: The number of references to release, typically 1. Must be nonzero and not larger than INT_MAX.
5991 pub fn cudaUserObjectRelease(
5992 object: cudaUserObject_t,
5993 count: ::core::ffi::c_uint,
5994 ) -> cudaError_t;
5995}
5996singe_loader::functions! { crate::RUNTIME;
5997 /// Retain a reference to a user object from a graph.
5998 ///
5999 /// Creates or moves user object references that will be owned by a CUDA graph.
6000 ///
6001 /// See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects.
6002 ///
6003 /// # Parameters
6004 ///
6005 /// - `graph`: The graph to associate the reference with.
6006 /// - `object`: The user object to retain a reference for.
6007 /// - `count`: The number of references to add to the graph, typically 1. Must be nonzero and not larger than INT_MAX.
6008 /// - `flags`: The optional flag [cudaGraphUserObjectMove](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1ggae53f516fc65103fccb14c83184188157a96b13064f28cdb8932c782b94ab5802f) transfers references from the calling thread, rather than create new references. Pass 0 to create new references.
6009 pub fn cudaGraphRetainUserObject(
6010 graph: cudaGraph_t,
6011 object: cudaUserObject_t,
6012 count: ::core::ffi::c_uint,
6013 flags: ::core::ffi::c_uint,
6014 ) -> cudaError_t;
6015}
6016singe_loader::functions! { crate::RUNTIME;
6017 /// Release a user object reference from a graph.
6018 ///
6019 /// Releases user object references owned by a graph.
6020 ///
6021 /// See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects.
6022 ///
6023 /// # Parameters
6024 ///
6025 /// - `graph`: The graph that will release the reference.
6026 /// - `object`: The user object to release a reference for.
6027 /// - `count`: The number of references to release, typically 1. Must be nonzero and not larger than INT_MAX.
6028 pub fn cudaGraphReleaseUserObject(
6029 graph: cudaGraph_t,
6030 object: cudaUserObject_t,
6031 count: ::core::ffi::c_uint,
6032 ) -> cudaError_t;
6033}
6034singe_loader::functions! { crate::RUNTIME;
6035 /// Adds a node of arbitrary type to a graph.
6036 ///
6037 /// Creates a new node in `graph` described by `nodeParams` with `numDependencies` dependencies specified via `pDependencies`. `numDependencies` may be 0. `pDependencies` may be null if `numDependencies` is 0. `pDependencies` may not have any duplicate entries.
6038 ///
6039 /// `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.
6040 ///
6041 /// Note that for some node types, `nodeParams` may contain “out parameters” which are modified during the call, such as `nodeParams->alloc.dptr`.
6042 ///
6043 /// A handle to the new node will be returned in `phGraphNode`.
6044 ///
6045 /// # Parameters
6046 ///
6047 /// - `pGraphNode`: Returns newly created node.
6048 /// - `graph`: Graph to which to add the node.
6049 /// - `pDependencies`: Dependencies of the node.
6050 /// - `dependencyData`: Optional edge data for the dependencies. If NULL, the data is assumed to be default (zeroed) for all dependencies.
6051 /// - `numDependencies`: Number of dependencies.
6052 /// - `nodeParams`: Specification of the node.
6053 pub fn cudaGraphAddNode(
6054 pGraphNode: *mut cudaGraphNode_t,
6055 graph: cudaGraph_t,
6056 pDependencies: *const cudaGraphNode_t,
6057 dependencyData: *const cudaGraphEdgeData,
6058 numDependencies: size_t,
6059 nodeParams: *mut cudaGraphNodeParams,
6060 ) -> cudaError_t;
6061}
6062singe_loader::functions! { crate::RUNTIME;
6063 /// Update a graph node’s parameters.
6064 ///
6065 /// Sets the parameters of graph node `node` to `nodeParams`. The node type specified by `nodeParams->type` must match the type of `node`. `nodeParams` must be fully initialized and all unused bytes (reserved, padding) zeroed.
6066 ///
6067 /// Modifying parameters is not supported for node types cudaGraphNodeTypeMemAlloc and cudaGraphNodeTypeMemFree.
6068 ///
6069 /// # Parameters
6070 ///
6071 /// - `node`: Node to set the parameters for.
6072 /// - `nodeParams`: Parameters to copy.
6073 pub fn cudaGraphNodeSetParams(
6074 node: cudaGraphNode_t,
6075 nodeParams: *mut cudaGraphNodeParams,
6076 ) -> cudaError_t;
6077}
6078singe_loader::functions! { crate::RUNTIME;
6079 /// Returns a graph node’s parameters.
6080 ///
6081 /// Returns the parameters of graph node `node` in `*nodeParams`.
6082 ///
6083 /// 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.
6084 ///
6085 /// 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.
6086 ///
6087 /// # Parameters
6088 ///
6089 /// - `node`: Node to get the parameters for.
6090 /// - `nodeParams`: Pointer to return the parameters.
6091 pub fn cudaGraphNodeGetParams(
6092 node: cudaGraphNode_t,
6093 nodeParams: *mut cudaGraphNodeParams,
6094 ) -> cudaError_t;
6095}
6096singe_loader::functions! { crate::RUNTIME;
6097 /// Update a graph node’s parameters in an instantiated graph.
6098 ///
6099 /// Sets the parameters of a node in an executable graph `graphExec`. The node is identified by the corresponding node `node` in the non-executable graph from which the executable graph was instantiated. `node` must not have been removed from the original graph.
6100 ///
6101 /// The modifications only affect future launches of `graphExec`. Already enqueued or running launches of `graphExec` are not affected by this call. `node` is also not modified by this call.
6102 ///
6103 /// Allowed changes to parameters on executable graphs are as follows.
6104 ///
6105 /// # Parameters
6106 ///
6107 /// - `graphExec`: The executable graph in which to update the specified node.
6108 /// - `node`: Corresponding node from the graph from which graphExec was instantiated.
6109 /// - `nodeParams`: Updated Parameters to set.
6110 pub fn cudaGraphExecNodeSetParams(
6111 graphExec: cudaGraphExec_t,
6112 node: cudaGraphNode_t,
6113 nodeParams: *mut cudaGraphNodeParams,
6114 ) -> cudaError_t;
6115}
6116singe_loader::functions! { crate::RUNTIME;
6117 /// Create a conditional handle.
6118 ///
6119 /// Creates a conditional handle associated with `hGraph`.
6120 ///
6121 /// The conditional handle must be associated with a conditional node in this graph or one of its children.
6122 ///
6123 /// Handles not associated with a conditional node may cause graph instantiation to fail.
6124 ///
6125 /// # Parameters
6126 ///
6127 /// - `pHandle_out`: Pointer used to return the handle to the caller.
6128 /// - `graph`: Graph which will contain the conditional node using this handle.
6129 /// - `defaultLaunchValue`: Optional initial value for the conditional variable. Applied at the beginning of each graph execution if cudaGraphCondAssignDefault is set in `flags`.
6130 /// - `flags`: Currently must be cudaGraphCondAssignDefault or 0.
6131 pub fn cudaGraphConditionalHandleCreate(
6132 pHandle_out: *mut cudaGraphConditionalHandle,
6133 graph: cudaGraph_t,
6134 defaultLaunchValue: ::core::ffi::c_uint,
6135 flags: ::core::ffi::c_uint,
6136 ) -> cudaError_t;
6137}
6138singe_loader::functions! { crate::RUNTIME;
6139 /// Create a conditional handle.
6140 ///
6141 /// Creates a conditional handle associated with `hGraph`.
6142 ///
6143 /// The conditional handle must be associated with a conditional node in this graph or one of its children.
6144 ///
6145 /// Handles not associated with a conditional node may cause graph instantiation to fail.
6146 ///
6147 /// # Parameters
6148 ///
6149 /// - `pHandle_out`: Pointer used to return the handle to the caller.
6150 /// - `graph`: Graph which will contain the conditional node using this handle.
6151 /// - `ctx`: Execution context for the handle and associated conditional node. If NULL, current context will be used.
6152 /// - `defaultLaunchValue`: Optional initial value for the conditional variable. Applied at the beginning of each graph execution if cudaGraphCondAssignDefault is set in `flags`.
6153 /// - `flags`: Currently must be cudaGraphCondAssignDefault or 0.
6154 pub fn cudaGraphConditionalHandleCreate_v2(
6155 pHandle_out: *mut cudaGraphConditionalHandle,
6156 graph: cudaGraph_t,
6157 ctx: cudaExecutionContext_t,
6158 defaultLaunchValue: ::core::ffi::c_uint,
6159 flags: ::core::ffi::c_uint,
6160 ) -> cudaError_t;
6161}
6162singe_loader::functions! { crate::RUNTIME;
6163 /// Returns the requested driver API function pointer.
6164 ///
6165 /// Returns in `**funcPtr` the address of the CUDA driver function for the requested flags.
6166 ///
6167 /// For a requested driver symbol, if the CUDA version in which the driver symbol was introduced is less than or equal to the CUDA runtime version, the API will return the function pointer to the corresponding versioned driver function.
6168 ///
6169 /// 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.
6170 ///
6171 /// The API will return [cudaSuccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ae355f04607d824883b4a50662830d591) and set the returned `funcPtr` if the requested driver function is valid and supported on the platform.
6172 ///
6173 /// The API will return [cudaSuccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ae355f04607d824883b4a50662830d591) and set the returned `funcPtr` to NULL if the requested driver function is not supported on the platform, no ABI compatible driver function exists for the CUDA runtime version or if the driver symbol is invalid.
6174 ///
6175 /// It will also set the optional `driverStatus` to one of the values in [cudaDriverEntryPointQueryResult](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gaeb22957eedf779d624069585c25f1d1f) with the following meanings:
6176 ///
6177 /// The requested flags can be.
6178 ///
6179 /// # Parameters
6180 ///
6181 /// - `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. Note that the API will use the CUDA runtime version to return the address to the most recent ABI compatible driver symbol, ::cuMemAlloc or ::cuMemAlloc_v2.
6182 /// - `funcPtr`: Location to return the function pointer to the requested driver function.
6183 /// - `flags`: Flags to specify search options.
6184 /// - `driverStatus`: Optional location to store the status of finding the symbol from the driver. See [cudaDriverEntryPointQueryResult](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gaeb22957eedf779d624069585c25f1d1f) for possible values.
6185 pub fn cudaGetDriverEntryPoint(
6186 symbol: *const ::core::ffi::c_char,
6187 funcPtr: *mut *mut ::core::ffi::c_void,
6188 flags: ::core::ffi::c_ulonglong,
6189 driverStatus: *mut cudaDriverEntryPointQueryResult,
6190 ) -> cudaError_t;
6191}
6192singe_loader::functions! { crate::RUNTIME;
6193 /// Returns the requested driver API function pointer by CUDA version.
6194 ///
6195 /// Returns in `**funcPtr` the address of the CUDA driver function for the requested flags and CUDA driver version.
6196 ///
6197 /// 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 [cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c).
6198 ///
6199 /// 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.
6200 ///
6201 /// For the case where the CUDA version requested is greater than the CUDA Toolkit installed, there may not be an appropriate function pointer typedef in the corresponding header file and may need a custom typedef to match the driver function signature returned. This can be done by getting the typedefs from a later toolkit or creating appropriately matching custom function typedefs.
6202 ///
6203 /// The API will return [cudaSuccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ae355f04607d824883b4a50662830d591) and set the returned `funcPtr` if the requested driver function is valid and supported on the platform.
6204 ///
6205 /// The API will return [cudaSuccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ae355f04607d824883b4a50662830d591) and set the returned `funcPtr` to NULL if the requested driver function is not supported on the platform, no ABI compatible driver function exists for the requested version or if the driver symbol is invalid.
6206 ///
6207 /// It will also set the optional `driverStatus` to one of the values in [cudaDriverEntryPointQueryResult](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gaeb22957eedf779d624069585c25f1d1f) with the following meanings:
6208 ///
6209 /// The requested flags can be.
6210 ///
6211 /// # Parameters
6212 ///
6213 /// - `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.
6214 /// - `funcPtr`: Location to return the function pointer to the requested driver function.
6215 /// - `cudaVersion`: The CUDA version to look for the requested driver symbol.
6216 /// - `flags`: Flags to specify search options.
6217 /// - `driverStatus`: Optional location to store the status of finding the symbol from the driver. See [cudaDriverEntryPointQueryResult](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gaeb22957eedf779d624069585c25f1d1f) for possible values.
6218 pub fn cudaGetDriverEntryPointByVersion(
6219 symbol: *const ::core::ffi::c_char,
6220 funcPtr: *mut *mut ::core::ffi::c_void,
6221 cudaVersion: ::core::ffi::c_uint,
6222 flags: ::core::ffi::c_ulonglong,
6223 driverStatus: *mut cudaDriverEntryPointQueryResult,
6224 ) -> cudaError_t;
6225}
6226singe_loader::functions! { crate::RUNTIME;
6227 /// Load a library with specified code and options.
6228 ///
6229 /// Takes a pointer `code` and loads the corresponding library `library` based on the application defined library loading mode:
6230 ///
6231 /// These environment variables are described in the CUDA programming guide under the “CUDA environment variables” section.
6232 ///
6233 /// 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. Please also see the documentation for nvrtc (<https://docs.nvidia.com/cuda/nvrtc/index.html>), nvjitlink (<https://docs.nvidia.com/cuda/nvjitlink/index.html>), and nvfatbin (<https://docs.nvidia.com/cuda/nvfatbin/index.html>) for more information on generating loadable code at runtime.
6234 ///
6235 /// 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`.
6236 ///
6237 /// 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`.
6238 ///
6239 /// # Parameters
6240 ///
6241 /// - `library`: Returned library.
6242 /// - `code`: Code to load.
6243 /// - `jitOptions`: Options for JIT.
6244 /// - `jitOptionsValues`: Option values for JIT.
6245 /// - `numJitOptions`: Number of options.
6246 /// - `libraryOptions`: Options for loading.
6247 /// - `libraryOptionValues`: Option values for loading.
6248 /// - `numLibraryOptions`: Number of options for loading.
6249 pub fn cudaLibraryLoadData(
6250 library: *mut cudaLibrary_t,
6251 code: *const ::core::ffi::c_void,
6252 jitOptions: *mut cudaJitOption,
6253 jitOptionsValues: *mut *mut ::core::ffi::c_void,
6254 numJitOptions: ::core::ffi::c_uint,
6255 libraryOptions: *mut cudaLibraryOption,
6256 libraryOptionValues: *mut *mut ::core::ffi::c_void,
6257 numLibraryOptions: ::core::ffi::c_uint,
6258 ) -> cudaError_t;
6259}
6260singe_loader::functions! { crate::RUNTIME;
6261 /// Load a library with specified file and options.
6262 ///
6263 /// Takes a pointer `code` and loads the corresponding library `library` based on the application defined library loading mode:
6264 ///
6265 /// These environment variables are described in the CUDA programming guide under the “CUDA environment variables” section.
6266 ///
6267 /// 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. Please also see the documentation for nvrtc (<https://docs.nvidia.com/cuda/nvrtc/index.html>), nvjitlink (<https://docs.nvidia.com/cuda/nvjitlink/index.html>), and nvfatbin (<https://docs.nvidia.com/cuda/nvfatbin/index.html>) for more information on generating loadable code at runtime.
6268 ///
6269 /// 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`.
6270 ///
6271 /// 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`.
6272 ///
6273 /// # Parameters
6274 ///
6275 /// - `library`: Returned library.
6276 /// - `fileName`: File to load from.
6277 /// - `jitOptions`: Options for JIT.
6278 /// - `jitOptionsValues`: Option values for JIT.
6279 /// - `numJitOptions`: Number of options.
6280 /// - `libraryOptions`: Options for loading.
6281 /// - `libraryOptionValues`: Option values for loading.
6282 /// - `numLibraryOptions`: Number of options for loading.
6283 pub fn cudaLibraryLoadFromFile(
6284 library: *mut cudaLibrary_t,
6285 fileName: *const ::core::ffi::c_char,
6286 jitOptions: *mut cudaJitOption,
6287 jitOptionsValues: *mut *mut ::core::ffi::c_void,
6288 numJitOptions: ::core::ffi::c_uint,
6289 libraryOptions: *mut cudaLibraryOption,
6290 libraryOptionValues: *mut *mut ::core::ffi::c_void,
6291 numLibraryOptions: ::core::ffi::c_uint,
6292 ) -> cudaError_t;
6293}
6294singe_loader::functions! { crate::RUNTIME;
6295 /// Unloads a library.
6296 ///
6297 /// Unloads the library specified with `library`.
6298 ///
6299 /// # Parameters
6300 ///
6301 /// - `library`: - Library to unload
6302 pub fn cudaLibraryUnload(library: cudaLibrary_t) -> cudaError_t;
6303}
6304singe_loader::functions! { crate::RUNTIME;
6305 /// Returns a kernel handle.
6306 ///
6307 /// Returns in `pKernel` the handle of the kernel with name `name` located in library `library`. If kernel handle is not found, the call returns [cudaErrorSymbolNotFound](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a9d51ecb21a3081d01e078d136c137593).
6308 ///
6309 /// # Parameters
6310 ///
6311 /// - `pKernel`: Returned kernel handle.
6312 /// - `library`: Library to retrieve kernel from.
6313 /// - `name`: Name of kernel to retrieve.
6314 pub fn cudaLibraryGetKernel(
6315 pKernel: *mut cudaKernel_t,
6316 library: cudaLibrary_t,
6317 name: *const ::core::ffi::c_char,
6318 ) -> cudaError_t;
6319}
6320singe_loader::functions! { crate::RUNTIME;
6321 /// Returns a global device pointer.
6322 ///
6323 /// Returns in `*dptr` and `*bytes` the base pointer and size of the global with name `name` for the requested library `library` and the current device. If no global for the requested name `name` exists, the call returns [cudaErrorSymbolNotFound](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a9d51ecb21a3081d01e078d136c137593). One of the parameters `dptr` or `bytes` (not both) can be NULL in which case it is ignored. The returned `dptr` cannot be passed to the Symbol APIs such as [`cudaMemcpyToSymbol`], [`cudaMemcpyFromSymbol`], [`cudaGetSymbolAddress`], or [`cudaGetSymbolSize`].
6324 ///
6325 /// # Parameters
6326 ///
6327 /// - `dptr`: Returned global device pointer for the requested library.
6328 /// - `bytes`: Returned global size in bytes.
6329 /// - `library`: Library to retrieve global from.
6330 /// - `name`: Name of global to retrieve.
6331 pub fn cudaLibraryGetGlobal(
6332 dptr: *mut *mut ::core::ffi::c_void,
6333 bytes: *mut size_t,
6334 library: cudaLibrary_t,
6335 name: *const ::core::ffi::c_char,
6336 ) -> cudaError_t;
6337}
6338singe_loader::functions! { crate::RUNTIME;
6339 /// Returns a pointer to managed memory.
6340 ///
6341 /// 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 [cudaErrorSymbolNotFound](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a9d51ecb21a3081d01e078d136c137593). 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. The returned `dptr` cannot be passed to the Symbol APIs such as [`cudaMemcpyToSymbol`], [`cudaMemcpyFromSymbol`], [`cudaGetSymbolAddress`], or [`cudaGetSymbolSize`].
6342 ///
6343 /// # Parameters
6344 ///
6345 /// - `dptr`: Returned pointer to the managed memory.
6346 /// - `bytes`: Returned memory size in bytes.
6347 /// - `library`: Library to retrieve managed memory from.
6348 /// - `name`: Name of managed memory to retrieve.
6349 pub fn cudaLibraryGetManaged(
6350 dptr: *mut *mut ::core::ffi::c_void,
6351 bytes: *mut size_t,
6352 library: cudaLibrary_t,
6353 name: *const ::core::ffi::c_char,
6354 ) -> cudaError_t;
6355}
6356singe_loader::functions! { crate::RUNTIME;
6357 /// Returns a pointer to a unified function.
6358 ///
6359 /// Returns in `*fptr` the function pointer to a unified function denoted by `symbol`. If no unified function with name `symbol` exists, the call returns [cudaErrorSymbolNotFound](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a9d51ecb21a3081d01e078d136c137593). If there is no device with attribute [cudaDeviceProp::unifiedFunctionPointers](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaDeviceProp.html#structcudadeviceprop_1a9f94309e6d30a640821cc9de9591e565) present in the system, the call may return [cudaErrorSymbolNotFound](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a9d51ecb21a3081d01e078d136c137593).
6360 ///
6361 /// # Parameters
6362 ///
6363 /// - `fptr`: Returned pointer to a unified function.
6364 /// - `library`: Library to retrieve function pointer memory from.
6365 /// - `symbol`: Name of function pointer to retrieve.
6366 pub fn cudaLibraryGetUnifiedFunction(
6367 fptr: *mut *mut ::core::ffi::c_void,
6368 library: cudaLibrary_t,
6369 symbol: *const ::core::ffi::c_char,
6370 ) -> cudaError_t;
6371}
6372singe_loader::functions! { crate::RUNTIME;
6373 /// Returns the number of kernels within a library.
6374 ///
6375 /// Returns in `count` the number of kernels in `lib`.
6376 ///
6377 /// # Parameters
6378 ///
6379 /// - `count`: Number of kernels found within the library.
6380 /// - `lib`: Library to query.
6381 pub fn cudaLibraryGetKernelCount(
6382 count: *mut ::core::ffi::c_uint,
6383 lib: cudaLibrary_t,
6384 ) -> cudaError_t;
6385}
6386singe_loader::functions! { crate::RUNTIME;
6387 /// Retrieve the kernel handles within a library.
6388 ///
6389 /// Returns in `kernels` a maximum number of `numKernels` kernel handles within `lib`. The returned kernel handle becomes invalid when the library is unloaded.
6390 ///
6391 /// # Parameters
6392 ///
6393 /// - `kernels`: Buffer where the kernel handles are returned to.
6394 /// - `numKernels`: Maximum number of kernel handles may be returned to the buffer.
6395 /// - `lib`: Library to query from.
6396 pub fn cudaLibraryEnumerateKernels(
6397 kernels: *mut cudaKernel_t,
6398 numKernels: ::core::ffi::c_uint,
6399 lib: cudaLibrary_t,
6400 ) -> cudaError_t;
6401}
6402singe_loader::functions! { crate::RUNTIME;
6403 /// Sets information about a kernel.
6404 ///
6405 /// This call sets the value of a specified attribute `attr` on the kernel `kernel` for the requested device `device` to an integer value specified by `value`. This function returns [cudaSuccess](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038ae355f04607d824883b4a50662830d591) 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 ([cudaErrorInvalidValue](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a3e8aef5398ee38e28ed41e357b48917c))
6406 ///
6407 /// Note that attributes set using [`cudaFuncSetAttribute`] will override the attribute set by this API irrespective of whether the call to [`cudaFuncSetAttribute`] is made before or after this API call. Because of this and the stricter locking requirements mentioned below it is suggested that this call be used during the initialization path and not on each thread accessing `kernel` such as on kernel launches or on the critical path.
6408 ///
6409 /// Valid values for `attr` are.
6410 ///
6411 /// # Parameters
6412 ///
6413 /// - `kernel`: Kernel to set attribute of.
6414 /// - `attr`: Attribute requested.
6415 /// - `value`: Value to set.
6416 /// - `device`: Device to set attribute of.
6417 pub fn cudaKernelSetAttributeForDevice(
6418 kernel: cudaKernel_t,
6419 attr: cudaFuncAttribute,
6420 value: ::core::ffi::c_int,
6421 device: ::core::ffi::c_int,
6422 ) -> cudaError_t;
6423}
6424singe_loader::functions! { crate::RUNTIME;
6425 /// Get device resources.
6426 ///
6427 /// Get the `type` resources available to the `device`. This may often be the starting point for further partitioning or configuring of resources.
6428 ///
6429 /// Note: The API is not supported on 32-bit platforms.
6430 ///
6431 /// # Parameters
6432 ///
6433 /// - `device`: Device to get resource for.
6434 /// - `resource`: Output pointer to a [cudaDevResource](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaDevResource.html#structcudadevresource) structure.
6435 /// - `type_`: Type of resource to retrieve.
6436 pub fn cudaDeviceGetDevResource(
6437 device: ::core::ffi::c_int,
6438 resource: *mut cudaDevResource,
6439 type_: cudaDevResourceType,
6440 ) -> cudaError_t;
6441}
6442singe_loader::functions! { crate::RUNTIME;
6443 /// Splits [`cudaDevResourceType::cudaDevResourceTypeSm`] resources.
6444 ///
6445 /// Splits [`cudaDevResourceType::cudaDevResourceTypeSm`] 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.
6446 ///
6447 /// This API is used to spatially partition the input resource. The input resource needs to come from one of [`cudaDeviceGetDevResource`], or [`cudaExecutionCtxGetDevResource`]. 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.
6448 ///
6449 /// 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 [`cudaDeviceGetDevResource`], or [`cudaExecutionCtxGetDevResource`] for [`cudaDevResourceType::cudaDevResourceTypeSm`], using the `minSmPartitionSize` and `smCoscheduledAlignment` fields to determine minimum partition size and alignment granularity, respectively.
6450 ///
6451 /// 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.
6452 ///
6453 /// The following flags are supported:
6454 ///
6455 /// A successful API call must either have:
6456 ///
6457 /// Note: The API is not supported on 32-bit platforms.
6458 ///
6459 /// # Parameters
6460 ///
6461 /// - `result`: Output array of `cudaDevResource` resources. Can be NULL to query the number of groups.
6462 /// - `nbGroups`: This is a pointer, specifying the number of groups that would be or should be created as described below.
6463 /// - `input`: Input SM resource to be split. Must be a valid [`cudaDevSmResource`] resource.
6464 /// - `remaining`: If the input resource cannot be cleanly split among `nbGroups`, the remaining is placed in here. Can be ommitted (NULL) if the user does not need the remaining set.
6465 /// - `flags`: Flags specifying how these partitions are used or which constraints to abide by when splitting the input. Zero is valid for default behavior.
6466 /// - `minCount`: Minimum number of SMs required.
6467 pub fn cudaDevSmResourceSplitByCount(
6468 result: *mut cudaDevResource,
6469 nbGroups: *mut ::core::ffi::c_uint,
6470 input: *const cudaDevResource,
6471 remaining: *mut cudaDevResource,
6472 flags: ::core::ffi::c_uint,
6473 minCount: ::core::ffi::c_uint,
6474 ) -> cudaError_t;
6475}
6476singe_loader::functions! { crate::RUNTIME;
6477 /// Splits a [`cudaDevResourceType::cudaDevResourceTypeSm`] resource into structured groups.
6478 ///
6479 /// This API will split a resource of [`cudaDevResourceType::cudaDevResourceTypeSm`] 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.
6480 ///
6481 /// 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.
6482 ///
6483 /// 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.
6484 ///
6485 /// For a valid call:
6486 ///
6487 /// **Example params and their effect:**
6488 ///
6489 /// A groupParams array element is defined in the following order:
6490 ///
6491 /// The difference between a catch-all param group as the last entry and the remainder is in two aspects:
6492 ///
6493 /// 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.
6494 ///
6495 /// # Parameters
6496 ///
6497 /// - `result`: Output array of `cudaDevResource` resources. Can be NULL, alongside an smCount of 0, for discovery purpose.
6498 /// - `nbGroups`: Specifies the number of groups in `result` and `groupParams`.
6499 /// - `input`: Input SM resource to be split. Must be a valid [`cudaDevResourceType::cudaDevResourceTypeSm`] resource.
6500 /// - `remainder`: If splitting the input resource leaves any SMs, the remainder is placed in here.
6501 /// - `flags`: Flags specifying how the API should behave. The value should be 0 for now.
6502 /// - `groupParams`: Description of how the SMs should be split and assigned to the corresponding result entry.
6503 pub fn cudaDevSmResourceSplit(
6504 result: *mut cudaDevResource,
6505 nbGroups: ::core::ffi::c_uint,
6506 input: *const cudaDevResource,
6507 remainder: *mut cudaDevResource,
6508 flags: ::core::ffi::c_uint,
6509 groupParams: *mut cudaDevSmResourceGroupParams,
6510 ) -> cudaError_t;
6511}
6512singe_loader::functions! { crate::RUNTIME;
6513 /// Generate a resource descriptor.
6514 ///
6515 /// 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 [`cudaGreenCtxCreate`] API. Resources of the same type can be passed in, provided they meet the requirements as noted below.
6516 ///
6517 /// A successful API call must have:
6518 ///
6519 /// Note: The API is not supported on 32-bit platforms.
6520 ///
6521 /// # Parameters
6522 ///
6523 /// - `phDesc`: Output descriptor.
6524 /// - `resources`: Array of resources to be included in the descriptor.
6525 /// - `nbResources`: Number of resources passed in `resources`.
6526 pub fn cudaDevResourceGenerateDesc(
6527 phDesc: *mut cudaDevResourceDesc_t,
6528 resources: *mut cudaDevResource,
6529 nbResources: ::core::ffi::c_uint,
6530 ) -> cudaError_t;
6531}
6532singe_loader::functions! { crate::RUNTIME;
6533 /// Creates a green context with a specified set of resources.
6534 ///
6535 /// This API creates a green context with the resources specified in the descriptor `desc` and returns it in the handle represented by `phCtx`.
6536 ///
6537 /// This API retains the device’s primary context for the lifetime of the green context. The primary context will be released when the green context is destroyed. To avoid the overhead of repeated initialization and teardown, it is recommended to explicitly initialize the device’s primary context ahead of time using [`cudaInitDevice`]. This ensures that the primary context remains initialized throughout the program’s lifetime, minimizing overhead during green context creation and destruction.
6538 ///
6539 /// The API does not create a default stream for the green context. Developers are expected to create streams explicitly using [`cudaExecutionCtxStreamCreate`] to submit work to the green context.
6540 ///
6541 /// Note: The API is not supported on 32-bit platforms.
6542 ///
6543 /// # Parameters
6544 ///
6545 /// - `phCtx`: Pointer for the output handle to the green context.
6546 /// - `desc`: Descriptor generated via [`cudaDevResourceGenerateDesc`] which contains the set of resources to be used.
6547 /// - `device`: Device on which to create the green context.
6548 /// - `flags`: Green context creation flags. Must be 0, currently reserved for future use.
6549 pub fn cudaGreenCtxCreate(
6550 phCtx: *mut cudaExecutionContext_t,
6551 desc: cudaDevResourceDesc_t,
6552 device: ::core::ffi::c_int,
6553 flags: ::core::ffi::c_uint,
6554 ) -> cudaError_t;
6555}
6556singe_loader::functions! { crate::RUNTIME;
6557 /// Destroy a execution context.
6558 ///
6559 /// Destroys the specified execution context `ctx`. It is the responsibility of the caller to ensure that no API call issues using `ctx` while [`cudaExecutionCtxDestroy`] is executing or subsequently.
6560 ///
6561 /// If `ctx` is a green context, any resources provisioned for it (that were initially available via the resource descriptor) are released as well.
6562 ///
6563 /// The API does not destroy streams created via [`cudaExecutionCtxStreamCreate`]. Users are expected to destroy these streams explicitly using [`cudaStreamDestroy`] to avoid resource leaks. Once the execution context is destroyed, any subsequent API calls involving these streams will return [cudaErrorStreamDetached](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038adac625035f38851dbb8e21a4b556c141) with the exception of the following APIs:
6564 ///
6565 /// Additionally, the API will invalidate all active captures on these streams.
6566 ///
6567 /// Passing in a `ctx` that was not explicitly created via CUDA Runtime APIs is not allowed and will result in undefined behavior.
6568 ///
6569 /// # Parameters
6570 ///
6571 /// - `ctx`: - Execution context to destroy (required parameter, see note below)
6572 pub fn cudaExecutionCtxDestroy(ctx: cudaExecutionContext_t) -> cudaError_t;
6573}
6574singe_loader::functions! { crate::RUNTIME;
6575 /// Get context resources.
6576 ///
6577 /// Get the `type` resources available to context represented by `ctx`.
6578 ///
6579 /// Note: The API is not supported on 32-bit platforms.
6580 ///
6581 /// # Parameters
6582 ///
6583 /// - `ctx`: Execution context to get resource for (required parameter, see note below).
6584 /// - `resource`: Output pointer to a [cudaDevResource](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaDevResource.html#structcudadevresource) structure.
6585 /// - `type_`: Type of resource to retrieve.
6586 pub fn cudaExecutionCtxGetDevResource(
6587 ctx: cudaExecutionContext_t,
6588 resource: *mut cudaDevResource,
6589 type_: cudaDevResourceType,
6590 ) -> cudaError_t;
6591}
6592singe_loader::functions! { crate::RUNTIME;
6593 /// Returns the device handle for the execution context.
6594 ///
6595 /// Returns in `*device` the handle of the specified execution context’s device. The execution context should not be NULL.
6596 ///
6597 /// # Parameters
6598 ///
6599 /// - `device`: Returned device handle for the specified execution context.
6600 /// - `ctx`: Execution context for which to obtain the device (required parameter, see note below).
6601 pub fn cudaExecutionCtxGetDevice(
6602 device: *mut ::core::ffi::c_int,
6603 ctx: cudaExecutionContext_t,
6604 ) -> cudaError_t;
6605}
6606singe_loader::functions! { crate::RUNTIME;
6607 /// Returns the unique Id associated with the execution context supplied.
6608 ///
6609 /// 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. The execution context should not be NULL.
6610 ///
6611 /// # Parameters
6612 ///
6613 /// - `ctx`: Context for which to obtain the Id (required parameter, see note below).
6614 /// - `ctxId`: Pointer to store the Id of the context.
6615 pub fn cudaExecutionCtxGetId(
6616 ctx: cudaExecutionContext_t,
6617 ctxId: *mut ::core::ffi::c_ulonglong,
6618 ) -> cudaError_t;
6619}
6620singe_loader::functions! { crate::RUNTIME;
6621 /// Creates a stream and initializes it for the given execution context.
6622 ///
6623 /// The API creates a CUDA stream with the specified `flags` and `priority`, initializing it with resources as defined at the time of creating the specified `ctx`. Additionally, the API also enables work submitted to to the stream to be tracked under `ctx`.
6624 ///
6625 /// The supported values for `flags` are:
6626 ///
6627 /// 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 [`cudaDeviceGetStreamPriorityRange`]. If the specified priority is outside the numerical range returned by [`cudaDeviceGetStreamPriorityRange`], it will automatically be clamped to the lowest or the highest number in the range.
6628 ///
6629 /// # Parameters
6630 ///
6631 /// - `phStream`: Returned stream handle.
6632 /// - `ctx`: Execution context to initialize the stream with (required parameter, see note below).
6633 /// - `flags`: Flags for stream creation.
6634 /// - `priority`: Stream priority.
6635 pub fn cudaExecutionCtxStreamCreate(
6636 phStream: *mut cudaStream_t,
6637 ctx: cudaExecutionContext_t,
6638 flags: ::core::ffi::c_uint,
6639 priority: ::core::ffi::c_int,
6640 ) -> cudaError_t;
6641}
6642singe_loader::functions! { crate::RUNTIME;
6643 /// Block for the specified execution context’s tasks to complete.
6644 ///
6645 /// Blocks until the specified execution context has completed all preceding requested tasks. If the specified execution context is the device (primary) context obtained via [`cudaDeviceGetExecutionCtx`], green contexts that have been created on the device will also be synchronized.
6646 ///
6647 /// The API returns an error if one of the preceding tasks failed.
6648 ///
6649 /// # Parameters
6650 ///
6651 /// - `ctx`: - Execution context to synchronize (required parameter, see note below)
6652 pub fn cudaExecutionCtxSynchronize(ctx: cudaExecutionContext_t) -> cudaError_t;
6653}
6654singe_loader::functions! { crate::RUNTIME;
6655 /// Get stream resources.
6656 ///
6657 /// Get the `type` resources available to the `hStream` and store them in `resource`.
6658 ///
6659 /// Note: The API will return [cudaErrorInvalidResourceType](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/group__CUDART__TYPES.html#group__cudart__types_1gga3f51e3575c2178246db0a94a430e0038a4954cdb4893fda9f1a30251a018c32fe) is `type` is [`cudaDevResourceType::cudaDevResourceTypeWorkqueueConfig`] or [`cudaDevResourceType::cudaDevResourceTypeWorkqueue`].
6660 ///
6661 /// # Parameters
6662 ///
6663 /// - `hStream`: Stream to get resource for.
6664 /// - `resource`: Output pointer to a [cudaDevResource](https://docs.nvidia.com/cuda/archive/13.4.2/cuda-runtime-api/cuda_runtime_api/structcudaDevResource.html#structcudadevresource) structure.
6665 /// - `type_`: Type of resource to retrieve.
6666 pub fn cudaStreamGetDevResource(
6667 hStream: cudaStream_t,
6668 resource: *mut cudaDevResource,
6669 type_: cudaDevResourceType,
6670 ) -> cudaError_t;
6671}
6672singe_loader::functions! { crate::RUNTIME;
6673 /// Records an event for the specified execution context.
6674 ///
6675 /// Captures in `event` all the activities of the execution context `ctx` at the time of this call. `event` and `ctx` must be from the same CUDA device, otherwise ::cudaErrorInvalidHandle will be returned. Calls such as [`cudaEventQuery`] or [`cudaExecutionCtxWaitEvent`] will then examine or wait for completion of the work that was captured. Uses of `ctx` after this call do not modify `event`. If the execution context passed to `ctx` is the device (primary) context obtained via [`cudaDeviceGetExecutionCtx`], `event` will capture all the activities of the green contexts created on the device as well.
6676 ///
6677 /// # Parameters
6678 ///
6679 /// - `ctx`: Execution context to record event for (required parameter, see note below).
6680 /// - `event`: Event to record.
6681 pub fn cudaExecutionCtxRecordEvent(
6682 ctx: cudaExecutionContext_t,
6683 event: cudaEvent_t,
6684 ) -> cudaError_t;
6685}
6686singe_loader::functions! { crate::RUNTIME;
6687 /// Make an execution context wait on an event.
6688 ///
6689 /// Makes all future work submitted to execution context `ctx` wait for all work captured in `event`. The synchronization will be performed on the device and will not block the calling CPU thread. See [`cudaExecutionCtxRecordEvent`] for details on what is captured by an event. If the execution context passed to `ctx` is the device (primary) context obtained via [`cudaDeviceGetExecutionCtx`], all green contexts created on the device will wait for `event` as well.
6690 ///
6691 /// # Parameters
6692 ///
6693 /// - `ctx`: Execution context to wait for (required parameter, see note below).
6694 /// - `event`: Event to wait on.
6695 pub fn cudaExecutionCtxWaitEvent(
6696 ctx: cudaExecutionContext_t,
6697 event: cudaEvent_t,
6698 ) -> cudaError_t;
6699}
6700singe_loader::functions! { crate::RUNTIME;
6701 /// Returns the execution context for a device.
6702 ///
6703 /// Returns in `ctx` the execution context for the specified device. This is the device’s primary context. The returned context can then be passed to APIs that take in a cudaExecutionContext_t enabling explicit context-based programming without relying on thread-local state.
6704 ///
6705 /// Passing the returned execution context to [`cudaExecutionCtxDestroy`] is not allowed and will result in undefined behavior.
6706 ///
6707 /// # Parameters
6708 ///
6709 /// - `ctx`: Returns the device execution context.
6710 /// - `device`: Device to get the execution context for.
6711 pub fn cudaDeviceGetExecutionCtx(
6712 ctx: *mut cudaExecutionContext_t,
6713 device: ::core::ffi::c_int,
6714 ) -> cudaError_t;
6715}
6716singe_loader::functions! { crate::RUNTIME;
6717 /// impl_private
6718 pub fn cudaGetExportTable(
6719 ppExportTable: *mut *const ::core::ffi::c_void,
6720 pExportTableId: *const cudaUUID_t,
6721 ) -> cudaError_t;
6722}
6723singe_loader::functions! { crate::RUNTIME;
6724 /// Get pointer to device entry function that matches entry function `symbolPtr`.
6725 ///
6726 /// Returns in `functionPtr` the device entry function corresponding to the symbol `symbolPtr`.
6727 ///
6728 /// # Parameters
6729 ///
6730 /// - `functionPtr`: Returns the device entry function.
6731 /// - `symbolPtr`: Pointer to device entry function to search for.
6732 pub fn cudaGetFuncBySymbol(
6733 functionPtr: *mut cudaFunction_t,
6734 symbolPtr: *const ::core::ffi::c_void,
6735 ) -> cudaError_t;
6736}
6737singe_loader::functions! { crate::RUNTIME;
6738 /// Get pointer to device kernel that matches entry function `entryFuncAddr`.
6739 ///
6740 /// Returns in `kernelPtr` the device kernel corresponding to the entry function `entryFuncAddr`.
6741 ///
6742 /// Note that it is possible that there are multiple symbols belonging to different translation units with the same `entryFuncAddr` registered with this CUDA Runtime and so the order which the translation units are loaded and registered with the CUDA Runtime can lead to differing return pointers in `kernelPtr`. Suggested methods of ensuring uniqueness are to limit visibility of **global** device functions by using static or hidden visibility attribute in the respective translation units.
6743 ///
6744 /// # Parameters
6745 ///
6746 /// - `kernelPtr`: Returns the device kernel.
6747 /// - `entryFuncAddr`: Address of device entry function to search kernel for.
6748 pub fn cudaGetKernel(
6749 kernelPtr: *mut cudaKernel_t,
6750 entryFuncAddr: *const ::core::ffi::c_void,
6751 ) -> cudaError_t;
6752}