use core::ffi::c_void;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Default)]
#[repr(transparent)]
pub struct CUdevice(pub i32);
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Default)]
#[repr(transparent)]
pub struct CUdeviceptr(pub u64);
unsafe impl baracuda_types::DeviceRepr for CUdevice {}
unsafe impl baracuda_types::DeviceRepr for CUdeviceptr {}
pub type CUcontext = *mut c_void;
pub type CUmodule = *mut c_void;
pub type CUfunction = *mut c_void;
pub type CUlibrary = *mut c_void;
pub type CUkernel = *mut c_void;
pub type CUstream = *mut c_void;
pub type CUevent = *mut c_void;
pub type CUgraph = *mut c_void;
pub type CUgraphNode = *mut c_void;
pub type CUgraphExec = *mut c_void;
pub type CUmemoryPool = *mut c_void;
pub type CUarray = *mut c_void;
pub type CUtexObject = u64;
pub type CUsurfObject = u64;
pub type CUmemGenericAllocationHandle = u64;
pub type CUexternalMemory = *mut c_void;
pub type CUexternalSemaphore = *mut c_void;
pub const CU_STREAM_LEGACY: CUstream = 0x1 as CUstream;
pub const CU_STREAM_PER_THREAD: CUstream = 0x2 as CUstream;
#[allow(non_snake_case)]
pub mod CUevent_flags {
pub const DEFAULT: u32 = 0x0;
pub const BLOCKING_SYNC: u32 = 0x1;
pub const DISABLE_TIMING: u32 = 0x2;
pub const INTERPROCESS: u32 = 0x4;
}
#[allow(non_snake_case)]
pub mod CUstream_flags {
pub const DEFAULT: u32 = 0x0;
pub const NON_BLOCKING: u32 = 0x1;
}
#[allow(non_snake_case)]
pub mod CUcontext_flags {
pub const SCHED_AUTO: u32 = 0x0;
pub const SCHED_SPIN: u32 = 0x1;
pub const SCHED_YIELD: u32 = 0x2;
pub const SCHED_BLOCKING_SYNC: u32 = 0x4;
pub const MAP_HOST: u32 = 0x8;
pub const LMEM_RESIZE_TO_MAX: u32 = 0x10;
}
#[allow(non_snake_case)]
pub mod CUlimit {
pub const STACK_SIZE: u32 = 0x00;
pub const PRINTF_FIFO_SIZE: u32 = 0x01;
pub const MALLOC_HEAP_SIZE: u32 = 0x02;
pub const DEV_RUNTIME_SYNC_DEPTH: u32 = 0x03;
pub const DEV_RUNTIME_PENDING_LAUNCH_COUNT: u32 = 0x04;
pub const MAX_L2_FETCH_GRANULARITY: u32 = 0x05;
pub const PERSISTING_L2_CACHE_SIZE: u32 = 0x06;
}
#[allow(non_snake_case)]
pub mod CUfunc_cache {
pub const PREFER_NONE: u32 = 0x00;
pub const PREFER_SHARED: u32 = 0x01;
pub const PREFER_L1: u32 = 0x02;
pub const PREFER_EQUAL: u32 = 0x03;
}
#[allow(non_snake_case)]
pub mod CUmemAttach_flags {
pub const GLOBAL: u32 = 0x01;
pub const HOST: u32 = 0x02;
pub const SINGLE: u32 = 0x04;
}
#[allow(non_snake_case)]
pub mod CUmem_advise {
pub const SET_READ_MOSTLY: i32 = 1;
pub const UNSET_READ_MOSTLY: i32 = 2;
pub const SET_PREFERRED_LOCATION: i32 = 3;
pub const UNSET_PREFERRED_LOCATION: i32 = 4;
pub const SET_ACCESSED_BY: i32 = 5;
pub const UNSET_ACCESSED_BY: i32 = 6;
}
#[allow(non_snake_case)]
pub mod CUmemRangeHandleType {
pub const DMA_BUF_FD: i32 = 1;
}
#[allow(non_snake_case)]
pub mod CUarraySparseSubresourceType {
pub const SPARSE_LEVEL: i32 = 0;
pub const MIPTAIL: i32 = 1;
}
#[allow(non_snake_case)]
pub mod CUmemOperationType {
pub const MAP: i32 = 1;
pub const UNMAP: i32 = 2;
}
#[allow(non_snake_case)]
pub mod CUmemHandleType {
pub const GENERIC: i32 = 0;
}
#[repr(C)]
#[derive(Copy, Clone)]
#[allow(non_camel_case_types)]
pub struct CUarrayMapInfo {
pub resource_type: core::ffi::c_int,
_pad0: u32,
pub resource_raw: u64,
pub subresource_type: core::ffi::c_int,
_pad1: u32,
pub subresource_raw: [u64; 4],
pub mem_operation_type: core::ffi::c_int,
pub mem_handle_type: core::ffi::c_int,
pub mem_handle_raw: u64,
pub offset: u64,
pub device_bit_mask: core::ffi::c_uint,
pub flags: core::ffi::c_uint,
pub reserved: [core::ffi::c_uint; 2],
}
impl Default for CUarrayMapInfo {
fn default() -> Self {
Self {
resource_type: 0,
_pad0: 0,
resource_raw: 0,
subresource_type: 0,
_pad1: 0,
subresource_raw: [0; 4],
mem_operation_type: 0,
mem_handle_type: CUmemHandleType::GENERIC,
mem_handle_raw: 0,
offset: 0,
device_bit_mask: 0,
flags: 0,
reserved: [0; 2],
}
}
}
impl core::fmt::Debug for CUarrayMapInfo {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("CUarrayMapInfo")
.field("resource_type", &self.resource_type)
.field("subresource_type", &self.subresource_type)
.field("mem_operation_type", &self.mem_operation_type)
.field("offset", &self.offset)
.finish_non_exhaustive()
}
}
impl CUarrayMapInfo {
pub fn with_array(mut self, array: CUarray) -> Self {
self.resource_type = CUresourcetype::ARRAY as core::ffi::c_int;
self.resource_raw = array as usize as u64;
self
}
pub fn with_mipmapped_array(mut self, mipmap: CUmipmappedArray) -> Self {
self.resource_type = CUresourcetype::MIPMAPPED_ARRAY as core::ffi::c_int;
self.resource_raw = mipmap as usize as u64;
self
}
#[allow(clippy::too_many_arguments)]
pub fn with_sparse_level(
mut self,
level: u32,
layer: u32,
offset_x: u32,
offset_y: u32,
offset_z: u32,
extent_width: u32,
extent_height: u32,
extent_depth: u32,
) -> Self {
self.subresource_type = CUarraySparseSubresourceType::SPARSE_LEVEL;
let sl = [
level,
layer,
offset_x,
offset_y,
offset_z,
extent_width,
extent_height,
extent_depth,
];
unsafe {
let p = self.subresource_raw.as_mut_ptr() as *mut [u32; 8];
p.write(sl);
}
self
}
pub fn with_miptail(mut self, layer: u32, tail_offset: u64, tail_size: u64) -> Self {
self.subresource_type = CUarraySparseSubresourceType::MIPTAIL;
#[repr(C)]
struct Miptail {
layer: u32,
_pad: u32,
offset: u64,
size: u64,
}
let m = Miptail {
layer,
_pad: 0,
offset: tail_offset,
size: tail_size,
};
unsafe {
let p = self.subresource_raw.as_mut_ptr() as *mut Miptail;
p.write(m);
}
self
}
pub fn with_mem_handle(mut self, handle: CUmemGenericAllocationHandle) -> Self {
self.mem_handle_type = CUmemHandleType::GENERIC;
self.mem_handle_raw = handle;
self
}
pub fn as_map(mut self) -> Self {
self.mem_operation_type = CUmemOperationType::MAP;
self
}
pub fn as_unmap(mut self) -> Self {
self.mem_operation_type = CUmemOperationType::UNMAP;
self
}
pub fn with_offset(mut self, offset: u64) -> Self {
self.offset = offset;
self
}
pub fn with_device_bit_mask(mut self, mask: u32) -> Self {
self.device_bit_mask = mask;
self
}
}
#[allow(non_snake_case)]
pub mod CUexecAffinityType {
pub const SM_COUNT: i32 = 0;
}
#[allow(non_snake_case)]
pub mod CUdevice_P2PAttribute {
pub const PERFORMANCE_RANK: i32 = 1;
pub const ACCESS_SUPPORTED: i32 = 2;
pub const NATIVE_ATOMIC_SUPPORTED: i32 = 3;
pub const CUDA_ARRAY_ACCESS_SUPPORTED: i32 = 4;
}
#[allow(non_snake_case)]
pub mod CUflushGPUDirectRDMAWritesTarget {
pub const CURRENT_CTX: i32 = 0;
}
#[allow(non_snake_case)]
pub mod CUflushGPUDirectRDMAWritesScope {
pub const TO_OWNER: i32 = 100;
pub const TO_ALL_DEVICES: i32 = 200;
}
#[allow(non_snake_case)]
pub mod CUcoredumpSettings {
pub const ENABLE_ON_EXCEPTION: i32 = 1;
pub const TRIGGER_HOST: i32 = 2;
pub const LIGHTWEIGHT: i32 = 3;
pub const ENABLE_USER_TRIGGER: i32 = 4;
pub const FILE: i32 = 5;
pub const PIPE: i32 = 6;
pub const GENERATION_FLAGS: i32 = 7;
}
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
#[allow(non_camel_case_types)]
pub struct CUDA_ARRAY_SPARSE_PROPERTIES {
pub tile_extent_width: core::ffi::c_uint,
pub tile_extent_height: core::ffi::c_uint,
pub tile_extent_depth: core::ffi::c_uint,
pub miptail_first_level: core::ffi::c_uint,
pub miptail_size: u64,
pub flags: core::ffi::c_uint,
pub reserved: [core::ffi::c_uint; 4],
}
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
#[allow(non_camel_case_types)]
pub struct CUDA_ARRAY_MEMORY_REQUIREMENTS {
pub size: usize,
pub alignment: usize,
pub reserved: [core::ffi::c_uint; 4],
}
#[allow(non_snake_case)]
pub mod CUgraphicsMapResourceFlags {
pub const NONE: u32 = 0;
pub const READ_ONLY: u32 = 1;
pub const WRITE_DISCARD: u32 = 2;
}
#[allow(non_snake_case)]
pub mod CUgraphicsRegisterFlags {
pub const NONE: u32 = 0;
pub const READ_ONLY: u32 = 1;
pub const WRITE_DISCARD: u32 = 2;
pub const SURFACE_LDST: u32 = 4;
pub const TEXTURE_GATHER: u32 = 8;
}
#[allow(non_snake_case)]
pub mod CUGLDeviceList {
pub const ALL: u32 = 0x01;
pub const CURRENT_FRAME: u32 = 0x02;
pub const NEXT_FRAME: u32 = 0x03;
}
pub use CUGLDeviceList as CUd3dXDeviceList;
pub type GLuint = core::ffi::c_uint;
pub type GLenum = core::ffi::c_uint;
pub type ID3DDevice = *mut c_void;
pub type ID3DResource = *mut c_void;
pub type VdpDevice = core::ffi::c_uint;
pub type VdpGetProcAddress = *mut c_void;
pub type VdpVideoSurface = core::ffi::c_uint;
pub type VdpOutputSurface = core::ffi::c_uint;
pub type EGLImageKHR = *mut c_void;
pub type EGLStreamKHR = *mut c_void;
pub type EGLSyncKHR = *mut c_void;
#[repr(C)]
#[derive(Copy, Clone)]
#[allow(non_camel_case_types)]
pub struct CUeglFrame {
pub raw: [u64; 10],
}
impl Default for CUeglFrame {
#[allow(clippy::derivable_impls)]
fn default() -> Self {
Self { raw: [0; 10] }
}
}
impl core::fmt::Debug for CUeglFrame {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("CUeglFrame").finish_non_exhaustive()
}
}
pub type NvSciSyncAttrList = *mut c_void;
pub type NvSciSyncObj = *mut c_void;
pub type NvSciSyncFence = *mut c_void;
pub type NvSciBufObj = *mut c_void;
#[allow(non_snake_case)]
pub mod CUnvSciSyncAttr {
pub const SIGNAL: i32 = 1;
pub const WAIT: i32 = 2;
}
#[allow(non_snake_case)]
pub mod CUpointer_attribute {
pub const CONTEXT: i32 = 1;
pub const MEMORY_TYPE: i32 = 2;
pub const DEVICE_POINTER: i32 = 3;
pub const HOST_POINTER: i32 = 4;
pub const P2P_TOKENS: i32 = 5;
pub const SYNC_MEMOPS: i32 = 6;
pub const BUFFER_ID: i32 = 7;
pub const IS_MANAGED: i32 = 8;
pub const DEVICE_ORDINAL: i32 = 9;
pub const IS_LEGACY_CUDA_IPC_CAPABLE: i32 = 10;
pub const RANGE_START_ADDR: i32 = 11;
pub const RANGE_SIZE: i32 = 12;
pub const MAPPED: i32 = 13;
pub const ALLOWED_HANDLE_TYPES: i32 = 14;
pub const IS_GPU_DIRECT_RDMA_CAPABLE: i32 = 15;
pub const ACCESS_FLAGS: i32 = 16;
pub const MEMPOOL_HANDLE: i32 = 17;
pub const MAPPING_SIZE: i32 = 18;
pub const MAPPING_BASE_ADDR: i32 = 19;
pub const MEMORY_BLOCK_ID: i32 = 20;
}
#[allow(non_snake_case)]
pub mod CUmemorytype {
pub const HOST: u32 = 0x01;
pub const DEVICE: u32 = 0x02;
pub const ARRAY: u32 = 0x03;
pub const UNIFIED: u32 = 0x04;
}
#[allow(non_snake_case)]
pub mod CUlaunchAttributeID {
pub const IGNORE: u32 = 0;
pub const ACCESS_POLICY_WINDOW: u32 = 1;
pub const COOPERATIVE: u32 = 2;
pub const SYNCHRONIZATION_POLICY: u32 = 3;
pub const CLUSTER_DIMENSION: u32 = 4;
pub const CLUSTER_SCHEDULING_POLICY_PREFERENCE: u32 = 5;
pub const PROGRAMMATIC_STREAM_SERIALIZATION: u32 = 6;
pub const PROGRAMMATIC_EVENT: u32 = 7;
pub const PRIORITY: u32 = 8;
pub const MEM_SYNC_DOMAIN_MAP: u32 = 9;
pub const MEM_SYNC_DOMAIN: u32 = 10;
pub const LAUNCH_COMPLETION_EVENT: u32 = 12;
pub const DEVICE_UPDATABLE_KERNEL_NODE: u32 = 13;
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
pub struct CUlaunchAttributeValue(pub [u8; 64]);
impl Default for CUlaunchAttributeValue {
fn default() -> Self {
Self([0u8; 64])
}
}
#[allow(non_snake_case)]
pub mod CUaccessProperty {
pub const NORMAL: i32 = 0;
pub const STREAMING: i32 = 1;
pub const PERSISTING: i32 = 2;
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
pub struct CUaccessPolicyWindow {
pub base_ptr: *mut c_void,
pub num_bytes: usize,
pub hit_ratio: f32,
pub hit_prop: core::ffi::c_int,
pub miss_prop: core::ffi::c_int,
}
impl Default for CUaccessPolicyWindow {
fn default() -> Self {
Self {
base_ptr: core::ptr::null_mut(),
num_bytes: 0,
hit_ratio: 0.0,
hit_prop: CUaccessProperty::NORMAL,
miss_prop: CUaccessProperty::NORMAL,
}
}
}
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
#[allow(non_camel_case_types)]
pub struct CUlaunchAttribute {
pub id: core::ffi::c_uint,
pub pad: [u8; 4],
pub value: CUlaunchAttributeValue,
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
pub struct CUlaunchConfig {
pub grid_dim_x: core::ffi::c_uint,
pub grid_dim_y: core::ffi::c_uint,
pub grid_dim_z: core::ffi::c_uint,
pub block_dim_x: core::ffi::c_uint,
pub block_dim_y: core::ffi::c_uint,
pub block_dim_z: core::ffi::c_uint,
pub shared_mem_bytes: core::ffi::c_uint,
pub stream: CUstream,
pub attrs: *mut CUlaunchAttribute,
pub num_attrs: core::ffi::c_uint,
}
impl Default for CUlaunchConfig {
fn default() -> Self {
Self {
grid_dim_x: 1,
grid_dim_y: 1,
grid_dim_z: 1,
block_dim_x: 1,
block_dim_y: 1,
block_dim_z: 1,
shared_mem_bytes: 0,
stream: core::ptr::null_mut(),
attrs: core::ptr::null_mut(),
num_attrs: 0,
}
}
}
#[allow(non_snake_case)]
pub mod CUfunction_attribute {
pub const MAX_THREADS_PER_BLOCK: i32 = 0;
pub const SHARED_SIZE_BYTES: i32 = 1;
pub const CONST_SIZE_BYTES: i32 = 2;
pub const LOCAL_SIZE_BYTES: i32 = 3;
pub const NUM_REGS: i32 = 4;
pub const PTX_VERSION: i32 = 5;
pub const BINARY_VERSION: i32 = 6;
pub const CACHE_MODE_CA: i32 = 7;
pub const MAX_DYNAMIC_SHARED_SIZE_BYTES: i32 = 8;
pub const PREFERRED_SHARED_MEMORY_CARVEOUT: i32 = 9;
pub const CLUSTER_SIZE_MUST_BE_SET: i32 = 10;
pub const REQUIRED_CLUSTER_WIDTH: i32 = 11;
pub const REQUIRED_CLUSTER_HEIGHT: i32 = 12;
pub const REQUIRED_CLUSTER_DEPTH: i32 = 13;
pub const NON_PORTABLE_CLUSTER_SIZE_ALLOWED: i32 = 14;
pub const CLUSTER_SCHEDULING_POLICY_PREFERENCE: i32 = 15;
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
pub struct CUDA_MEMCPY2D {
pub src_x_in_bytes: usize,
pub src_y: usize,
pub src_memory_type: u32,
pub src_host: *const c_void,
pub src_device: CUdeviceptr,
pub src_array: *mut c_void,
pub src_pitch: usize,
pub dst_x_in_bytes: usize,
pub dst_y: usize,
pub dst_memory_type: u32,
pub dst_host: *mut c_void,
pub dst_device: CUdeviceptr,
pub dst_array: *mut c_void,
pub dst_pitch: usize,
pub width_in_bytes: usize,
pub height: usize,
}
impl Default for CUDA_MEMCPY2D {
fn default() -> Self {
Self {
src_x_in_bytes: 0,
src_y: 0,
src_memory_type: 0,
src_host: core::ptr::null(),
src_device: CUdeviceptr(0),
src_array: core::ptr::null_mut(),
src_pitch: 0,
dst_x_in_bytes: 0,
dst_y: 0,
dst_memory_type: 0,
dst_host: core::ptr::null_mut(),
dst_device: CUdeviceptr(0),
dst_array: core::ptr::null_mut(),
dst_pitch: 0,
width_in_bytes: 0,
height: 0,
}
}
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
pub struct CUDA_KERNEL_NODE_PARAMS {
pub func: CUfunction,
pub grid_dim_x: core::ffi::c_uint,
pub grid_dim_y: core::ffi::c_uint,
pub grid_dim_z: core::ffi::c_uint,
pub block_dim_x: core::ffi::c_uint,
pub block_dim_y: core::ffi::c_uint,
pub block_dim_z: core::ffi::c_uint,
pub shared_mem_bytes: core::ffi::c_uint,
pub kernel_params: *mut *mut c_void,
pub extra: *mut *mut c_void,
pub kern: CUkernel,
pub ctx: CUcontext,
}
impl Default for CUDA_KERNEL_NODE_PARAMS {
fn default() -> Self {
Self {
func: core::ptr::null_mut(),
grid_dim_x: 1,
grid_dim_y: 1,
grid_dim_z: 1,
block_dim_x: 1,
block_dim_y: 1,
block_dim_z: 1,
shared_mem_bytes: 0,
kernel_params: core::ptr::null_mut(),
extra: core::ptr::null_mut(),
kern: core::ptr::null_mut(),
ctx: core::ptr::null_mut(),
}
}
}
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
#[allow(non_camel_case_types)]
pub struct CUDA_MEMSET_NODE_PARAMS {
pub dst: CUdeviceptr,
pub pitch: usize,
pub value: core::ffi::c_uint,
pub element_size: core::ffi::c_uint,
pub width: usize,
pub height: usize,
}
pub type CUhostFnRaw = Option<unsafe extern "C" fn(user_data: *mut c_void)>;
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
pub struct CUDA_HOST_NODE_PARAMS {
pub fn_: CUhostFnRaw,
pub user_data: *mut c_void,
}
impl Default for CUDA_HOST_NODE_PARAMS {
fn default() -> Self {
Self {
fn_: None,
user_data: core::ptr::null_mut(),
}
}
}
#[repr(C, align(64))]
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
pub struct CUtensorMap {
pub opaque: [u64; 16],
}
#[allow(clippy::derivable_impls)]
impl Default for CUtensorMap {
fn default() -> Self {
Self { opaque: [0; 16] }
}
}
#[allow(non_snake_case)]
pub mod CUtensorMapDataType {
pub const UINT8: i32 = 0;
pub const UINT16: i32 = 1;
pub const UINT32: i32 = 2;
pub const INT32: i32 = 3;
pub const UINT64: i32 = 4;
pub const INT64: i32 = 5;
pub const FLOAT16: i32 = 6;
pub const FLOAT32: i32 = 7;
pub const FLOAT64: i32 = 8;
pub const BFLOAT16: i32 = 9;
pub const FLOAT32_FTZ: i32 = 10;
pub const TFLOAT32: i32 = 11;
pub const TFLOAT32_FTZ: i32 = 12;
}
#[allow(non_snake_case)]
pub mod CUtensorMapInterleave {
pub const NONE: i32 = 0;
pub const INTERLEAVE_16B: i32 = 1;
pub const INTERLEAVE_32B: i32 = 2;
}
#[allow(non_snake_case)]
pub mod CUtensorMapSwizzle {
pub const NONE: i32 = 0;
pub const SWIZZLE_32B: i32 = 1;
pub const SWIZZLE_64B: i32 = 2;
pub const SWIZZLE_128B: i32 = 3;
}
#[allow(non_snake_case)]
pub mod CUtensorMapL2promotion {
pub const NONE: i32 = 0;
pub const L2_64B: i32 = 1;
pub const L2_128B: i32 = 2;
pub const L2_256B: i32 = 3;
}
#[allow(non_snake_case)]
pub mod CUtensorMapFloatOOBfill {
pub const NONE: i32 = 0;
pub const NAN_REQUEST_ZERO_FMA: i32 = 1;
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
pub struct CUipcEventHandle {
pub reserved: [core::ffi::c_char; 64],
}
impl Default for CUipcEventHandle {
fn default() -> Self {
Self { reserved: [0; 64] }
}
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
pub struct CUipcMemHandle {
pub reserved: [core::ffi::c_char; 64],
}
impl Default for CUipcMemHandle {
fn default() -> Self {
Self { reserved: [0; 64] }
}
}
pub type CUgraphConditionalHandle = u64;
#[allow(non_snake_case)]
pub mod CUgraphConditionalNodeType {
pub const IF: i32 = 0;
pub const WHILE: i32 = 1;
pub const SWITCH: i32 = 2;
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
pub struct CUDA_CONDITIONAL_NODE_PARAMS {
pub handle: CUgraphConditionalHandle,
pub type_: core::ffi::c_int,
pub size: core::ffi::c_uint,
pub body_graph_out: *mut CUgraph,
pub ctx: CUcontext,
}
impl Default for CUDA_CONDITIONAL_NODE_PARAMS {
fn default() -> Self {
Self {
handle: 0,
type_: CUgraphConditionalNodeType::IF,
size: 1,
body_graph_out: core::ptr::null_mut(),
ctx: core::ptr::null_mut(),
}
}
}
#[repr(C)]
#[derive(Copy, Clone)]
#[allow(non_camel_case_types)]
pub struct CUgraphNodeParams {
pub type_: core::ffi::c_int,
pub reserved0: [core::ffi::c_int; 3],
pub payload: [u64; 29],
pub reserved2: core::ffi::c_longlong,
}
impl Default for CUgraphNodeParams {
fn default() -> Self {
Self {
type_: CUgraphNodeType::EMPTY,
reserved0: [0; 3],
payload: [0; 29],
reserved2: 0,
}
}
}
impl core::fmt::Debug for CUgraphNodeParams {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("CUgraphNodeParams")
.field("type", &self.type_)
.finish_non_exhaustive()
}
}
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
#[allow(non_camel_case_types)]
pub struct CUgraphEdgeData {
pub from_port: u8,
pub to_port: u8,
pub type_: u8,
pub reserved: [u8; 5],
}
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
#[allow(non_camel_case_types)]
pub struct CUmulticastObjectProp {
pub num_devices: core::ffi::c_uint,
pub size: usize,
pub handle_types: u64,
pub flags: u64,
}
#[allow(non_snake_case)]
pub mod CUmulticastGranularity_flags {
pub const MINIMUM: i32 = 0;
pub const RECOMMENDED: i32 = 1;
}
#[allow(non_snake_case)]
pub mod CUdevResourceType {
pub const INVALID: i32 = 0;
pub const SM: i32 = 1;
}
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
#[allow(non_camel_case_types)]
pub struct CUdevSmResource {
pub sm_count: core::ffi::c_uint,
pub min_sm_partition_size: core::ffi::c_uint,
pub sm_coscheduled_alignment: core::ffi::c_uint,
}
#[repr(C)]
#[derive(Copy, Clone)]
#[allow(non_camel_case_types)]
pub struct CUdevResource {
pub type_: core::ffi::c_int,
pub internal_padding: [core::ffi::c_uchar; 92],
pub res: [u64; 6], }
impl Default for CUdevResource {
fn default() -> Self {
Self {
type_: CUdevResourceType::INVALID,
internal_padding: [0u8; 92],
res: [0u64; 6],
}
}
}
impl core::fmt::Debug for CUdevResource {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("CUdevResource")
.field("type", &self.type_)
.finish_non_exhaustive()
}
}
impl CUdevResource {
#[inline]
pub fn as_sm(&self) -> CUdevSmResource {
unsafe { core::ptr::read(self.res.as_ptr() as *const CUdevSmResource) }
}
}
#[allow(non_snake_case)]
pub mod CUgraphNodeType {
pub const KERNEL: i32 = 0;
pub const MEMCPY: i32 = 1;
pub const MEMSET: i32 = 2;
pub const HOST: i32 = 3;
pub const GRAPH: i32 = 4;
pub const EMPTY: i32 = 5;
pub const WAIT_EVENT: i32 = 6;
pub const EVENT_RECORD: i32 = 7;
pub const EXT_SEMAS_SIGNAL: i32 = 8;
pub const EXT_SEMAS_WAIT: i32 = 9;
pub const MEM_ALLOC: i32 = 10;
pub const MEM_FREE: i32 = 11;
pub const BATCH_MEM_OP: i32 = 12;
pub const CONDITIONAL: i32 = 13;
}
#[allow(non_snake_case)]
pub mod CUstreamCaptureMode {
pub const GLOBAL: u32 = 0;
pub const THREAD_LOCAL: u32 = 1;
pub const RELAXED: u32 = 2;
}
#[allow(non_snake_case)]
pub mod CUstreamCaptureStatus {
pub const NONE: u32 = 0;
pub const ACTIVE: u32 = 1;
pub const INVALIDATED: u32 = 2;
}
#[allow(non_snake_case)]
pub mod CUgraphInstantiate_flags {
pub const AUTO_FREE_ON_LAUNCH: u64 = 1;
pub const UPLOAD: u64 = 2;
pub const USE_NODE_PRIORITY: u64 = 8;
}
#[allow(non_snake_case)]
pub mod CUdevice_attribute {
pub const MAX_THREADS_PER_BLOCK: i32 = 1;
pub const MAX_BLOCK_DIM_X: i32 = 2;
pub const MAX_BLOCK_DIM_Y: i32 = 3;
pub const MAX_BLOCK_DIM_Z: i32 = 4;
pub const MAX_GRID_DIM_X: i32 = 5;
pub const MAX_GRID_DIM_Y: i32 = 6;
pub const MAX_GRID_DIM_Z: i32 = 7;
pub const MAX_SHARED_MEMORY_PER_BLOCK: i32 = 8;
pub const TOTAL_CONSTANT_MEMORY: i32 = 9;
pub const WARP_SIZE: i32 = 10;
pub const MAX_PITCH: i32 = 11;
pub const MAX_REGISTERS_PER_BLOCK: i32 = 12;
pub const CLOCK_RATE: i32 = 13;
pub const TEXTURE_ALIGNMENT: i32 = 14;
pub const MULTIPROCESSOR_COUNT: i32 = 16;
pub const INTEGRATED: i32 = 18;
pub const COMPUTE_CAPABILITY_MAJOR: i32 = 75;
pub const COMPUTE_CAPABILITY_MINOR: i32 = 76;
pub const PCI_BUS_ID: i32 = 33;
pub const PCI_DEVICE_ID: i32 = 34;
pub const PCI_DOMAIN_ID: i32 = 50;
pub const CONCURRENT_KERNELS: i32 = 31;
pub const ECC_ENABLED: i32 = 32;
}
#[allow(non_snake_case)]
pub mod CUarray_format {
pub const UNSIGNED_INT8: u32 = 0x01;
pub const UNSIGNED_INT16: u32 = 0x02;
pub const UNSIGNED_INT32: u32 = 0x03;
pub const SIGNED_INT8: u32 = 0x08;
pub const SIGNED_INT16: u32 = 0x09;
pub const SIGNED_INT32: u32 = 0x0a;
pub const HALF: u32 = 0x10;
pub const FLOAT: u32 = 0x20;
}
#[allow(non_snake_case)]
pub mod CUaddress_mode {
pub const WRAP: u32 = 0;
pub const CLAMP: u32 = 1;
pub const MIRROR: u32 = 2;
pub const BORDER: u32 = 3;
}
#[allow(non_snake_case)]
pub mod CUfilter_mode {
pub const POINT: u32 = 0;
pub const LINEAR: u32 = 1;
}
#[allow(non_snake_case)]
pub mod CUresourcetype {
pub const ARRAY: u32 = 0;
pub const MIPMAPPED_ARRAY: u32 = 1;
pub const LINEAR: u32 = 2;
pub const PITCH2D: u32 = 3;
}
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
#[allow(non_camel_case_types)]
pub struct CUDA_ARRAY_DESCRIPTOR {
pub width: usize,
pub height: usize,
pub format: u32,
pub num_channels: core::ffi::c_uint,
}
#[repr(C)]
#[derive(Copy, Clone)]
#[allow(non_camel_case_types)]
pub struct CUDA_RESOURCE_DESC {
pub res_type: core::ffi::c_int,
_pad0: u32,
pub res: [u64; 16],
pub flags: core::ffi::c_uint,
_pad1: u32,
}
impl Default for CUDA_RESOURCE_DESC {
fn default() -> Self {
Self {
res_type: CUresourcetype::ARRAY as core::ffi::c_int,
_pad0: 0,
res: [0u64; 16],
flags: 0,
_pad1: 0,
}
}
}
impl core::fmt::Debug for CUDA_RESOURCE_DESC {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("CUDA_RESOURCE_DESC")
.field("res_type", &self.res_type)
.field("flags", &self.flags)
.finish_non_exhaustive()
}
}
impl CUDA_RESOURCE_DESC {
#[allow(clippy::not_unsafe_ptr_arg_deref)]
pub fn from_array(array: CUarray) -> Self {
let mut d = Self::default();
unsafe {
let p = d.res.as_mut_ptr() as *mut CUarray;
p.write(array);
}
d
}
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
pub struct CUDA_TEXTURE_DESC {
pub address_mode: [u32; 3],
pub filter_mode: u32,
pub flags: core::ffi::c_uint,
pub max_anisotropy: core::ffi::c_uint,
pub mipmap_filter_mode: u32,
pub mipmap_level_bias: f32,
pub min_mipmap_level_clamp: f32,
pub max_mipmap_level_clamp: f32,
pub border_color: [f32; 4],
pub reserved: [core::ffi::c_int; 12],
}
impl Default for CUDA_TEXTURE_DESC {
fn default() -> Self {
Self {
address_mode: [CUaddress_mode::CLAMP; 3],
filter_mode: CUfilter_mode::POINT,
flags: 0,
max_anisotropy: 0,
mipmap_filter_mode: CUfilter_mode::POINT,
mipmap_level_bias: 0.0,
min_mipmap_level_clamp: 0.0,
max_mipmap_level_clamp: 0.0,
border_color: [0.0; 4],
reserved: [0; 12],
}
}
}
#[allow(non_snake_case)]
pub mod CUmemAllocationType {
pub const INVALID: i32 = 0;
pub const PINNED: i32 = 1;
}
#[allow(non_snake_case)]
pub mod CUmemLocationType {
pub const INVALID: i32 = 0;
pub const DEVICE: i32 = 1;
pub const HOST: i32 = 2;
pub const HOST_NUMA: i32 = 3;
pub const HOST_NUMA_CURRENT: i32 = 4;
}
#[allow(non_snake_case)]
pub mod CUmemAllocationHandleType {
pub const NONE: i32 = 0;
pub const POSIX_FILE_DESCRIPTOR: i32 = 1;
pub const WIN32: i32 = 2;
pub const WIN32_KMT: i32 = 4;
pub const FABRIC: i32 = 8;
}
#[allow(non_snake_case)]
pub mod CUmemAccess_flags {
pub const NONE: i32 = 0;
pub const READ: i32 = 1;
pub const READWRITE: i32 = 3;
}
#[allow(non_snake_case)]
pub mod CUmemAllocationGranularity_flags {
pub const MINIMUM: i32 = 0;
pub const RECOMMENDED: i32 = 1;
}
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
#[allow(non_camel_case_types)]
pub struct CUmemLocation {
pub type_: core::ffi::c_int,
pub id: core::ffi::c_int,
}
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
#[allow(non_camel_case_types)]
pub struct CUmemAllocationPropFlags {
pub compression_type: core::ffi::c_uchar,
pub gpu_direct_rdma_capable: core::ffi::c_uchar,
pub usage: core::ffi::c_ushort,
pub reserved: [core::ffi::c_uchar; 4],
}
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
#[allow(non_camel_case_types)]
pub struct CUmemAllocationProp {
pub type_: core::ffi::c_int,
pub requested_handle_types: core::ffi::c_int,
pub location: CUmemLocation,
pub win32_handle_meta_data: *mut c_void,
pub alloc_flags: CUmemAllocationPropFlags,
}
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
#[allow(non_camel_case_types)]
pub struct CUmemAccessDesc {
pub location: CUmemLocation,
pub flags: core::ffi::c_int,
}
#[allow(non_snake_case)]
pub mod CUmemPool_attribute {
pub const REUSE_FOLLOW_EVENT_DEPENDENCIES: i32 = 1;
pub const REUSE_ALLOW_OPPORTUNISTIC: i32 = 2;
pub const REUSE_ALLOW_INTERNAL_DEPENDENCIES: i32 = 3;
pub const RELEASE_THRESHOLD: i32 = 4;
pub const RESERVED_MEM_CURRENT: i32 = 5;
pub const RESERVED_MEM_HIGH: i32 = 6;
pub const USED_MEM_CURRENT: i32 = 7;
pub const USED_MEM_HIGH: i32 = 8;
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
pub struct CUmemPoolProps {
pub alloc_type: core::ffi::c_int,
pub handle_types: core::ffi::c_int,
pub location: CUmemLocation,
pub win32_security_attributes: *mut c_void,
pub max_size: usize,
pub usage: core::ffi::c_ushort,
pub reserved: [core::ffi::c_uchar; 54],
}
impl Default for CUmemPoolProps {
fn default() -> Self {
Self {
alloc_type: CUmemAllocationType::PINNED,
handle_types: CUmemAllocationHandleType::NONE,
location: CUmemLocation::default(),
win32_security_attributes: core::ptr::null_mut(),
max_size: 0,
usage: 0,
reserved: [0u8; 54],
}
}
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
pub struct CUmemPoolPtrExportData {
pub reserved: [core::ffi::c_uchar; 64],
}
impl Default for CUmemPoolPtrExportData {
fn default() -> Self {
Self {
reserved: [0u8; 64],
}
}
}
#[allow(non_snake_case)]
pub mod CUexternalMemoryHandleType {
pub const OPAQUE_FD: i32 = 1;
pub const OPAQUE_WIN32: i32 = 2;
pub const OPAQUE_WIN32_KMT: i32 = 3;
pub const D3D12_HEAP: i32 = 4;
pub const D3D12_RESOURCE: i32 = 5;
pub const D3D11_RESOURCE: i32 = 6;
pub const D3D11_RESOURCE_KMT: i32 = 7;
pub const NVSCIBUF: i32 = 8;
}
#[allow(non_snake_case)]
pub mod CUexternalSemaphoreHandleType {
pub const OPAQUE_FD: i32 = 1;
pub const OPAQUE_WIN32: i32 = 2;
pub const OPAQUE_WIN32_KMT: i32 = 3;
pub const D3D12_FENCE: i32 = 4;
pub const D3D11_FENCE: i32 = 5;
pub const NVSCISYNC: i32 = 6;
pub const KEYED_MUTEX: i32 = 7;
pub const KEYED_MUTEX_KMT: i32 = 8;
pub const TIMELINE_SEMAPHORE_FD: i32 = 9;
pub const TIMELINE_SEMAPHORE_WIN32: i32 = 10;
}
pub type CUmipmappedArray = *mut c_void;
pub type CUuserObject = *mut c_void;
pub type CUgraphicsResource = *mut c_void;
pub type CUlogsCallbackHandle = *mut c_void;
pub type CUlogIterator = core::ffi::c_uint;
#[allow(non_snake_case)]
pub mod CUlogLevel {
pub const ERROR: i32 = 0;
pub const WARNING: i32 = 1;
pub const INFO: i32 = 2;
pub const TRACE: i32 = 3;
}
pub type CUlogsCallback = Option<
unsafe extern "C" fn(
data: *mut c_void,
log_level: core::ffi::c_int,
message: *const core::ffi::c_char,
len: core::ffi::c_uint,
),
>;
#[allow(non_snake_case)]
pub mod CUmoduleLoadingMode {
pub const EAGER_LOADING: i32 = 0x1;
pub const LAZY_LOADING: i32 = 0x2;
}
#[allow(non_snake_case)]
pub mod CUgraphExecUpdateResult {
pub const SUCCESS: i32 = 0;
pub const ERROR: i32 = 1;
pub const ERROR_TOPOLOGY_CHANGED: i32 = 2;
pub const ERROR_NODE_TYPE_CHANGED: i32 = 3;
pub const ERROR_FUNCTION_CHANGED: i32 = 4;
pub const ERROR_PARAMETERS_CHANGED: i32 = 5;
pub const ERROR_NOT_SUPPORTED: i32 = 6;
pub const ERROR_UNSUPPORTED_FUNCTION_CHANGE: i32 = 7;
pub const ERROR_ATTRIBUTES_CHANGED: i32 = 8;
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
pub struct CUgraphExecUpdateResultInfo {
pub result: core::ffi::c_int,
pub error_node: CUgraphNode,
pub error_from_node: CUgraphNode,
}
impl Default for CUgraphExecUpdateResultInfo {
fn default() -> Self {
Self {
result: CUgraphExecUpdateResult::SUCCESS,
error_node: core::ptr::null_mut(),
error_from_node: core::ptr::null_mut(),
}
}
}
#[allow(non_snake_case)]
pub mod CUgraphMem_attribute {
pub const USED_MEM_CURRENT: i32 = 0;
pub const USED_MEM_HIGH: i32 = 1;
pub const RESERVED_MEM_CURRENT: i32 = 2;
pub const RESERVED_MEM_HIGH: i32 = 3;
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
pub struct CUDA_MEM_ALLOC_NODE_PARAMS {
pub pool_props: CUmemPoolProps,
pub access_descs: *const CUmemAccessDesc,
pub access_desc_count: usize,
pub bytesize: usize,
pub dptr: CUdeviceptr,
}
impl Default for CUDA_MEM_ALLOC_NODE_PARAMS {
fn default() -> Self {
Self {
pool_props: CUmemPoolProps::default(),
access_descs: core::ptr::null(),
access_desc_count: 0,
bytesize: 0,
dptr: CUdeviceptr(0),
}
}
}
#[allow(non_snake_case)]
pub mod CUstreamBatchMemOpType {
pub const WAIT_VALUE_32: u32 = 1;
pub const WRITE_VALUE_32: u32 = 2;
pub const WAIT_VALUE_64: u32 = 4;
pub const WRITE_VALUE_64: u32 = 5;
pub const BARRIER: u32 = 6;
pub const FLUSH_REMOTE_WRITES: u32 = 3;
}
#[allow(non_snake_case)]
pub mod CUstreamWaitValue_flags {
pub const GEQ: u32 = 0x0;
pub const EQ: u32 = 0x1;
pub const AND: u32 = 0x2;
pub const NOR: u32 = 0x3;
pub const FLUSH: u32 = 1 << 30;
}
#[allow(non_snake_case)]
pub mod CUstreamWriteValue_flags {
pub const DEFAULT: u32 = 0x0;
pub const NO_MEMORY_BARRIER: u32 = 0x1;
}
#[repr(C)]
#[derive(Copy, Clone)]
#[allow(non_camel_case_types)]
pub struct CUstreamBatchMemOpParams {
pub raw: [u64; 6],
}
#[allow(clippy::derivable_impls)]
impl Default for CUstreamBatchMemOpParams {
fn default() -> Self {
Self { raw: [0; 6] }
}
}
impl core::fmt::Debug for CUstreamBatchMemOpParams {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("CUstreamBatchMemOpParams")
.field("op", &(self.raw[0] as u32))
.finish_non_exhaustive()
}
}
impl CUstreamBatchMemOpParams {
pub fn wait_value_32(address: CUdeviceptr, value: u32, flags: u32) -> Self {
let mut s = Self::default();
unsafe {
let p = s.raw.as_mut_ptr() as *mut u8;
(p as *mut u32).write(CUstreamBatchMemOpType::WAIT_VALUE_32);
(p.add(8) as *mut u64).write(address.0);
(p.add(16) as *mut u32).write(value);
(p.add(24) as *mut u32).write(flags);
}
s
}
pub fn wait_value_64(address: CUdeviceptr, value: u64, flags: u32) -> Self {
let mut s = Self::default();
unsafe {
let p = s.raw.as_mut_ptr() as *mut u8;
(p as *mut u32).write(CUstreamBatchMemOpType::WAIT_VALUE_64);
(p.add(8) as *mut u64).write(address.0);
(p.add(16) as *mut u64).write(value);
(p.add(24) as *mut u32).write(flags);
}
s
}
pub fn write_value_32(address: CUdeviceptr, value: u32, flags: u32) -> Self {
let mut s = Self::default();
unsafe {
let p = s.raw.as_mut_ptr() as *mut u8;
(p as *mut u32).write(CUstreamBatchMemOpType::WRITE_VALUE_32);
(p.add(8) as *mut u64).write(address.0);
(p.add(16) as *mut u32).write(value);
(p.add(24) as *mut u32).write(flags);
}
s
}
pub fn write_value_64(address: CUdeviceptr, value: u64, flags: u32) -> Self {
let mut s = Self::default();
unsafe {
let p = s.raw.as_mut_ptr() as *mut u8;
(p as *mut u32).write(CUstreamBatchMemOpType::WRITE_VALUE_64);
(p.add(8) as *mut u64).write(address.0);
(p.add(16) as *mut u64).write(value);
(p.add(24) as *mut u32).write(flags);
}
s
}
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
pub struct CUDA_BATCH_MEM_OP_NODE_PARAMS {
pub ctx: CUcontext,
pub count: core::ffi::c_uint,
pub param_array: *mut CUstreamBatchMemOpParams,
pub flags: core::ffi::c_uint,
}
impl Default for CUDA_BATCH_MEM_OP_NODE_PARAMS {
fn default() -> Self {
Self {
ctx: core::ptr::null_mut(),
count: 0,
param_array: core::ptr::null_mut(),
flags: 0,
}
}
}
pub type CUgreenCtx = *mut c_void;
pub type CUdevResourceDesc = *mut c_void;
#[repr(C)]
#[derive(Copy, Clone)]
#[allow(non_camel_case_types)]
pub struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC {
pub type_: core::ffi::c_int,
_pad0: u32,
pub handle: [u64; 2],
pub size: u64,
pub flags: core::ffi::c_uint,
pub reserved: [core::ffi::c_uint; 16],
}
#[allow(clippy::derivable_impls)]
impl Default for CUDA_EXTERNAL_MEMORY_HANDLE_DESC {
fn default() -> Self {
Self {
type_: 0,
_pad0: 0,
handle: [0; 2],
size: 0,
flags: 0,
reserved: [0; 16],
}
}
}
impl core::fmt::Debug for CUDA_EXTERNAL_MEMORY_HANDLE_DESC {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("CUDA_EXTERNAL_MEMORY_HANDLE_DESC")
.field("type", &self.type_)
.field("size", &self.size)
.field("flags", &self.flags)
.finish_non_exhaustive()
}
}
impl CUDA_EXTERNAL_MEMORY_HANDLE_DESC {
pub fn from_fd(fd: core::ffi::c_int, size: u64) -> Self {
let mut d = Self {
type_: CUexternalMemoryHandleType::OPAQUE_FD,
size,
..Default::default()
};
let slot = d.handle.as_mut_ptr() as *mut core::ffi::c_int;
unsafe { slot.write(fd) };
d
}
pub unsafe fn from_win32_handle(
type_: core::ffi::c_int,
handle: *mut c_void,
name: *const c_void,
size: u64,
) -> Self {
let mut d = Self {
type_,
size,
..Default::default()
};
let p = d.handle.as_mut_ptr() as *mut [*mut c_void; 2];
unsafe { p.write([handle, name as *mut c_void]) };
d
}
}
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
#[allow(non_camel_case_types)]
pub struct CUDA_EXTERNAL_MEMORY_BUFFER_DESC {
pub offset: u64,
pub size: u64,
pub flags: core::ffi::c_uint,
pub reserved: [core::ffi::c_uint; 16],
}
#[repr(C)]
#[derive(Copy, Clone)]
#[allow(non_camel_case_types)]
pub struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC {
pub type_: core::ffi::c_int,
_pad0: u32,
pub handle: [u64; 2],
pub flags: core::ffi::c_uint,
pub reserved: [core::ffi::c_uint; 16],
}
#[allow(clippy::derivable_impls)]
impl Default for CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC {
fn default() -> Self {
Self {
type_: 0,
_pad0: 0,
handle: [0; 2],
flags: 0,
reserved: [0; 16],
}
}
}
impl core::fmt::Debug for CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC")
.field("type", &self.type_)
.field("flags", &self.flags)
.finish_non_exhaustive()
}
}
impl CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC {
pub fn from_fd(fd: core::ffi::c_int, type_: core::ffi::c_int) -> Self {
let mut d = Self {
type_,
..Default::default()
};
let slot = d.handle.as_mut_ptr() as *mut core::ffi::c_int;
unsafe { slot.write(fd) };
d
}
pub unsafe fn from_win32_handle(
type_: core::ffi::c_int,
handle: *mut c_void,
name: *const c_void,
) -> Self {
let mut d = Self {
type_,
..Default::default()
};
let p = d.handle.as_mut_ptr() as *mut [*mut c_void; 2];
unsafe { p.write([handle, name as *mut c_void]) };
d
}
}
#[repr(C)]
#[derive(Copy, Clone)]
#[allow(non_camel_case_types)]
pub struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS {
pub params: [u64; 9],
pub flags: core::ffi::c_uint,
pub reserved: [core::ffi::c_uint; 16],
}
#[allow(clippy::derivable_impls)]
impl Default for CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS {
fn default() -> Self {
Self {
params: [0; 9],
flags: 0,
reserved: [0; 16],
}
}
}
impl core::fmt::Debug for CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS")
.field("fence_value", &self.params[0])
.field("flags", &self.flags)
.finish_non_exhaustive()
}
}
impl CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS {
pub fn fence_value(value: u64) -> Self {
let mut s = Self::default();
s.params[0] = value;
s
}
}
#[repr(C)]
#[derive(Copy, Clone)]
#[allow(non_camel_case_types)]
pub struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS {
pub params: [u64; 9],
pub flags: core::ffi::c_uint,
pub reserved: [core::ffi::c_uint; 16],
}
#[allow(clippy::derivable_impls)]
impl Default for CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS {
fn default() -> Self {
Self {
params: [0; 9],
flags: 0,
reserved: [0; 16],
}
}
}
impl core::fmt::Debug for CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS")
.field("fence_value", &self.params[0])
.field("flags", &self.flags)
.finish_non_exhaustive()
}
}
impl CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS {
pub fn fence_value(value: u64) -> Self {
let mut s = Self::default();
s.params[0] = value;
s
}
}
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
#[allow(non_camel_case_types)]
pub struct CUDA_ARRAY3D_DESCRIPTOR {
pub width: usize,
pub height: usize,
pub depth: usize,
pub format: u32,
pub num_channels: core::ffi::c_uint,
pub flags: core::ffi::c_uint,
}
#[allow(non_snake_case)]
pub mod CUarray3D_flags {
pub const LAYERED: u32 = 0x01;
pub const SURFACE_LDST: u32 = 0x02;
pub const CUBEMAP: u32 = 0x04;
pub const TEXTURE_GATHER: u32 = 0x08;
pub const DEPTH_TEXTURE: u32 = 0x10;
pub const COLOR_ATTACHMENT: u32 = 0x20;
pub const SPARSE: u32 = 0x40;
pub const DEFERRED_MAPPING: u32 = 0x80;
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
pub struct CUDA_MEMCPY3D {
pub src_x_in_bytes: usize,
pub src_y: usize,
pub src_z: usize,
pub src_lod: usize,
pub src_memory_type: u32,
_pad0: u32,
pub src_host: *const c_void,
pub src_device: CUdeviceptr,
pub src_array: *mut c_void,
pub reserved0: *mut c_void,
pub src_pitch: usize,
pub src_height: usize,
pub dst_x_in_bytes: usize,
pub dst_y: usize,
pub dst_z: usize,
pub dst_lod: usize,
pub dst_memory_type: u32,
_pad1: u32,
pub dst_host: *mut c_void,
pub dst_device: CUdeviceptr,
pub dst_array: *mut c_void,
pub reserved1: *mut c_void,
pub dst_pitch: usize,
pub dst_height: usize,
pub width_in_bytes: usize,
pub height: usize,
pub depth: usize,
}
impl Default for CUDA_MEMCPY3D {
fn default() -> Self {
Self {
src_x_in_bytes: 0,
src_y: 0,
src_z: 0,
src_lod: 0,
src_memory_type: 0,
_pad0: 0,
src_host: core::ptr::null(),
src_device: CUdeviceptr(0),
src_array: core::ptr::null_mut(),
reserved0: core::ptr::null_mut(),
src_pitch: 0,
src_height: 0,
dst_x_in_bytes: 0,
dst_y: 0,
dst_z: 0,
dst_lod: 0,
dst_memory_type: 0,
_pad1: 0,
dst_host: core::ptr::null_mut(),
dst_device: CUdeviceptr(0),
dst_array: core::ptr::null_mut(),
reserved1: core::ptr::null_mut(),
dst_pitch: 0,
dst_height: 0,
width_in_bytes: 0,
height: 0,
depth: 0,
}
}
}