pub const _STDINT_H: u32 = 1;
pub const _FEATURES_H: u32 = 1;
pub const _DEFAULT_SOURCE: u32 = 1;
pub const __GLIBC_USE_ISOC23: u32 = 0;
pub const __USE_ISOC11: u32 = 1;
pub const __USE_ISOC99: u32 = 1;
pub const __USE_ISOC95: u32 = 1;
pub const __USE_POSIX_IMPLICITLY: u32 = 1;
pub const _POSIX_SOURCE: u32 = 1;
pub const _POSIX_C_SOURCE: u32 = 200809;
pub const __USE_POSIX: u32 = 1;
pub const __USE_POSIX2: u32 = 1;
pub const __USE_POSIX199309: u32 = 1;
pub const __USE_POSIX199506: u32 = 1;
pub const __USE_XOPEN2K: u32 = 1;
pub const __USE_XOPEN2K8: u32 = 1;
pub const _ATFILE_SOURCE: u32 = 1;
pub const __WORDSIZE: u32 = 64;
pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1;
pub const __SYSCALL_WORDSIZE: u32 = 64;
pub const __TIMESIZE: u32 = 64;
pub const __USE_TIME_BITS64: u32 = 1;
pub const __USE_MISC: u32 = 1;
pub const __USE_ATFILE: u32 = 1;
pub const __USE_FORTIFY_LEVEL: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
pub const __GLIBC_USE_C23_STRTOL: u32 = 0;
pub const _STDC_PREDEF_H: u32 = 1;
pub const __STDC_IEC_559__: u32 = 1;
pub const __STDC_IEC_60559_BFP__: u32 = 201404;
pub const __STDC_IEC_559_COMPLEX__: u32 = 1;
pub const __STDC_IEC_60559_COMPLEX__: u32 = 201404;
pub const __STDC_ISO_10646__: u32 = 201706;
pub const __GNU_LIBRARY__: u32 = 6;
pub const __GLIBC__: u32 = 2;
pub const __GLIBC_MINOR__: u32 = 40;
pub const _SYS_CDEFS_H: u32 = 1;
pub const __glibc_c99_flexarr_available: u32 = 1;
pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0;
pub const __HAVE_GENERIC_SELECTION: u32 = 1;
pub const __GLIBC_USE_LIB_EXT2: u32 = 0;
pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0;
pub const __GLIBC_USE_IEC_60559_BFP_EXT_C23: u32 = 0;
pub const __GLIBC_USE_IEC_60559_EXT: u32 = 0;
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0;
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C23: u32 = 0;
pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0;
pub const _BITS_TYPES_H: u32 = 1;
pub const _BITS_TYPESIZES_H: u32 = 1;
pub const __OFF_T_MATCHES_OFF64_T: u32 = 1;
pub const __INO_T_MATCHES_INO64_T: u32 = 1;
pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1;
pub const __STATFS_MATCHES_STATFS64: u32 = 1;
pub const __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64: u32 = 1;
pub const __FD_SETSIZE: u32 = 1024;
pub const _BITS_TIME64_H: u32 = 1;
pub const _BITS_WCHAR_H: u32 = 1;
pub const _BITS_STDINT_INTN_H: u32 = 1;
pub const _BITS_STDINT_UINTN_H: u32 = 1;
pub const _BITS_STDINT_LEAST_H: u32 = 1;
pub const INT8_MIN: i32 = -128;
pub const INT16_MIN: i32 = -32768;
pub const INT32_MIN: i32 = -2147483648;
pub const INT8_MAX: u32 = 127;
pub const INT16_MAX: u32 = 32767;
pub const INT32_MAX: u32 = 2147483647;
pub const UINT8_MAX: u32 = 255;
pub const UINT16_MAX: u32 = 65535;
pub const UINT32_MAX: u32 = 4294967295;
pub const INT_LEAST8_MIN: i32 = -128;
pub const INT_LEAST16_MIN: i32 = -32768;
pub const INT_LEAST32_MIN: i32 = -2147483648;
pub const INT_LEAST8_MAX: u32 = 127;
pub const INT_LEAST16_MAX: u32 = 32767;
pub const INT_LEAST32_MAX: u32 = 2147483647;
pub const UINT_LEAST8_MAX: u32 = 255;
pub const UINT_LEAST16_MAX: u32 = 65535;
pub const UINT_LEAST32_MAX: u32 = 4294967295;
pub const INT_FAST8_MIN: i32 = -128;
pub const INT_FAST16_MIN: i64 = -9223372036854775808;
pub const INT_FAST32_MIN: i64 = -9223372036854775808;
pub const INT_FAST8_MAX: u32 = 127;
pub const INT_FAST16_MAX: u64 = 9223372036854775807;
pub const INT_FAST32_MAX: u64 = 9223372036854775807;
pub const UINT_FAST8_MAX: u32 = 255;
pub const UINT_FAST16_MAX: i32 = -1;
pub const UINT_FAST32_MAX: i32 = -1;
pub const INTPTR_MIN: i64 = -9223372036854775808;
pub const INTPTR_MAX: u64 = 9223372036854775807;
pub const UINTPTR_MAX: i32 = -1;
pub const PTRDIFF_MIN: i64 = -9223372036854775808;
pub const PTRDIFF_MAX: u64 = 9223372036854775807;
pub const SIG_ATOMIC_MIN: i32 = -2147483648;
pub const SIG_ATOMIC_MAX: u32 = 2147483647;
pub const SIZE_MAX: i32 = -1;
pub const WINT_MIN: u32 = 0;
pub const WINT_MAX: u32 = 4294967295;
pub const __bool_true_false_are_defined: u32 = 1;
pub const true_: u32 = 1;
pub const false_: u32 = 0;
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum ErrorCode {
ERROR_CODE_NO_ERROR = 0,
ERROR_CODE_OUT_OF_MEMORY = 1,
ERROR_CODE_NOT_SUPPORT = 2,
ERROR_CODE_COMPUTE_SIZE_ERROR = 3,
ERROR_CODE_NO_EXECUTION = 4,
ERROR_CODE_INVALID_VALUE = 5,
ERROR_CODE_INPUT_DATA_ERROR = 10,
ERROR_CODE_CALL_BACK_STOP = 11,
ERROR_CODE_TENSOR_NOT_SUPPORT = 20,
ERROR_CODE_TENSOR_NEED_DIVIDE = 21,
}
pub type __u_char = core::ffi::c_uchar;
pub type __u_short = core::ffi::c_ushort;
pub type __u_int = core::ffi::c_uint;
pub type __u_long = core::ffi::c_ulong;
pub type __int8_t = core::ffi::c_schar;
pub type __uint8_t = core::ffi::c_uchar;
pub type __int16_t = core::ffi::c_short;
pub type __uint16_t = core::ffi::c_ushort;
pub type __int32_t = core::ffi::c_int;
pub type __uint32_t = core::ffi::c_uint;
pub type __int64_t = core::ffi::c_long;
pub type __uint64_t = core::ffi::c_ulong;
pub type __int_least8_t = __int8_t;
pub type __uint_least8_t = __uint8_t;
pub type __int_least16_t = __int16_t;
pub type __uint_least16_t = __uint16_t;
pub type __int_least32_t = __int32_t;
pub type __uint_least32_t = __uint32_t;
pub type __int_least64_t = __int64_t;
pub type __uint_least64_t = __uint64_t;
pub type __quad_t = core::ffi::c_long;
pub type __u_quad_t = core::ffi::c_ulong;
pub type __intmax_t = core::ffi::c_long;
pub type __uintmax_t = core::ffi::c_ulong;
pub type __dev_t = core::ffi::c_ulong;
pub type __uid_t = core::ffi::c_uint;
pub type __gid_t = core::ffi::c_uint;
pub type __ino_t = core::ffi::c_ulong;
pub type __ino64_t = core::ffi::c_ulong;
pub type __mode_t = core::ffi::c_uint;
pub type __nlink_t = core::ffi::c_ulong;
pub type __off_t = core::ffi::c_long;
pub type __off64_t = core::ffi::c_long;
pub type __pid_t = core::ffi::c_int;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __fsid_t {
pub __val: [core::ffi::c_int; 2usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of __fsid_t"][::std::mem::size_of::<__fsid_t>() - 8usize];
["Alignment of __fsid_t"][::std::mem::align_of::<__fsid_t>() - 4usize];
["Offset of field: __fsid_t::__val"][::std::mem::offset_of!(__fsid_t, __val) - 0usize];
};
pub type __clock_t = core::ffi::c_long;
pub type __rlim_t = core::ffi::c_ulong;
pub type __rlim64_t = core::ffi::c_ulong;
pub type __id_t = core::ffi::c_uint;
pub type __time_t = core::ffi::c_long;
pub type __useconds_t = core::ffi::c_uint;
pub type __suseconds_t = core::ffi::c_long;
pub type __suseconds64_t = core::ffi::c_long;
pub type __daddr_t = core::ffi::c_int;
pub type __key_t = core::ffi::c_int;
pub type __clockid_t = core::ffi::c_int;
pub type __timer_t = *mut core::ffi::c_void;
pub type __blksize_t = core::ffi::c_long;
pub type __blkcnt_t = core::ffi::c_long;
pub type __blkcnt64_t = core::ffi::c_long;
pub type __fsblkcnt_t = core::ffi::c_ulong;
pub type __fsblkcnt64_t = core::ffi::c_ulong;
pub type __fsfilcnt_t = core::ffi::c_ulong;
pub type __fsfilcnt64_t = core::ffi::c_ulong;
pub type __fsword_t = core::ffi::c_long;
pub type __ssize_t = core::ffi::c_long;
pub type __syscall_slong_t = core::ffi::c_long;
pub type __syscall_ulong_t = core::ffi::c_ulong;
pub type __loff_t = __off64_t;
pub type __caddr_t = *mut core::ffi::c_char;
pub type __intptr_t = core::ffi::c_long;
pub type __socklen_t = core::ffi::c_uint;
pub type __sig_atomic_t = core::ffi::c_int;
pub type int_least8_t = __int_least8_t;
pub type int_least16_t = __int_least16_t;
pub type int_least32_t = __int_least32_t;
pub type int_least64_t = __int_least64_t;
pub type uint_least8_t = __uint_least8_t;
pub type uint_least16_t = __uint_least16_t;
pub type uint_least32_t = __uint_least32_t;
pub type uint_least64_t = __uint_least64_t;
pub type int_fast8_t = core::ffi::c_schar;
pub type int_fast16_t = core::ffi::c_long;
pub type int_fast32_t = core::ffi::c_long;
pub type int_fast64_t = core::ffi::c_long;
pub type uint_fast8_t = core::ffi::c_uchar;
pub type uint_fast16_t = core::ffi::c_ulong;
pub type uint_fast32_t = core::ffi::c_ulong;
pub type uint_fast64_t = core::ffi::c_ulong;
pub type intmax_t = __intmax_t;
pub type uintmax_t = __uintmax_t;
pub type wchar_t = core::ffi::c_int;
#[repr(C)]
#[repr(align(16))]
#[derive(Debug, Copy, Clone)]
pub struct max_align_t {
pub __clang_max_align_nonce1: core::ffi::c_longlong,
pub __bindgen_padding_0: u64,
pub __clang_max_align_nonce2: u128,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of max_align_t"][::std::mem::size_of::<max_align_t>() - 32usize];
["Alignment of max_align_t"][::std::mem::align_of::<max_align_t>() - 16usize];
["Offset of field: max_align_t::__clang_max_align_nonce1"]
[::std::mem::offset_of!(max_align_t, __clang_max_align_nonce1) - 0usize];
["Offset of field: max_align_t::__clang_max_align_nonce2"]
[::std::mem::offset_of!(max_align_t, __clang_max_align_nonce2) - 16usize];
};
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum MNNForwardType {
MNN_FORWARD_CPU = 0,
MNN_FORWARD_AUTO = 4,
MNN_FORWARD_METAL = 1,
MNN_FORWARD_CUDA = 2,
MNN_FORWARD_OPENCL = 3,
MNN_FORWARD_OPENGL = 6,
MNN_FORWARD_VULKAN = 7,
MNN_FORWARD_NN = 5,
MNN_FORWARD_USER_0 = 8,
MNN_FORWARD_USER_1 = 9,
MNN_FORWARD_USER_2 = 10,
MNN_FORWARD_USER_3 = 11,
MNN_FORWARD_ALL = 12,
MNN_FORWARD_CPU_EXTENSION = 13,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum MNNGpuMode {
MNN_GPU_TUNING_NONE = 1,
MNN_GPU_TUNING_HEAVY = 2,
MNN_GPU_TUNING_WIDE = 4,
MNN_GPU_TUNING_NORMAL = 8,
MNN_GPU_TUNING_FAST = 16,
MNN_GPU_MEMORY_BUFFER = 64,
MNN_GPU_MEMORY_IMAGE = 128,
MNN_GPU_RECORD_OP = 256,
MNN_GPU_RECORD_BATCH = 512,
}
impl MemoryMode {
pub const Memory_Normal: MemoryMode = MemoryMode(0);
}
impl MemoryMode {
pub const Memory_High: MemoryMode = MemoryMode(1);
}
impl MemoryMode {
pub const Memory_Low: MemoryMode = MemoryMode(2);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct MemoryMode(pub core::ffi::c_uint);
impl PowerMode {
pub const Power_Normal: PowerMode = PowerMode(0);
}
impl PowerMode {
pub const Power_High: PowerMode = PowerMode(1);
}
impl PowerMode {
pub const Power_Low: PowerMode = PowerMode(2);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct PowerMode(pub core::ffi::c_uint);
impl PrecisionMode {
pub const Precision_Normal: PrecisionMode = PrecisionMode(0);
}
impl PrecisionMode {
pub const Precision_High: PrecisionMode = PrecisionMode(1);
}
impl PrecisionMode {
pub const Precision_Low: PrecisionMode = PrecisionMode(2);
}
impl PrecisionMode {
pub const Precision_Low_BF16: PrecisionMode = PrecisionMode(3);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct PrecisionMode(pub core::ffi::c_uint);
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MNNBackendConfig {
_unused: [u8; 0],
}
extern "C" {
pub fn mnnbc_create() -> *mut MNNBackendConfig;
}
extern "C" {
pub fn mnnbc_clone(config: *const MNNBackendConfig) -> *mut MNNBackendConfig;
}
extern "C" {
pub fn mnnbc_destroy(config: *mut MNNBackendConfig);
}
extern "C" {
pub fn mnnbc_set_memory_mode(config: *mut MNNBackendConfig, memory_mode: MemoryMode);
}
extern "C" {
pub fn mnnbc_set_power_mode(config: *mut MNNBackendConfig, power_mode: PowerMode);
}
extern "C" {
pub fn mnnbc_set_precision_mode(config: *mut MNNBackendConfig, precision_mode: PrecisionMode);
}
extern "C" {
pub fn mnnbc_set_shared_context(
config: *mut MNNBackendConfig,
shared_context: *mut core::ffi::c_void,
);
}
extern "C" {
pub fn mnnbc_set_flags(config: *mut MNNBackendConfig, flags: usize);
}
extern "C" {
pub fn mnnbc_reset(config: *mut MNNBackendConfig);
}
extern "C" {
pub fn mnnbc_get_memory_mode(config: *mut MNNBackendConfig) -> MemoryMode;
}
extern "C" {
pub fn mnnbc_get_power_mode(config: *mut MNNBackendConfig) -> PowerMode;
}
extern "C" {
pub fn mnnbc_get_precision_mode(config: *mut MNNBackendConfig) -> PrecisionMode;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MNNScheduleConfig {
_unused: [u8; 0],
}
extern "C" {
pub fn mnnsc_create() -> *mut MNNScheduleConfig;
}
extern "C" {
pub fn mnnsc_clone(from: *const MNNScheduleConfig) -> *mut MNNScheduleConfig;
}
extern "C" {
pub fn mnnsc_destroy(config: *mut MNNScheduleConfig);
}
extern "C" {
pub fn mnnsc_set_save_tensors(
config: *mut MNNScheduleConfig,
saveTensors: *const *const core::ffi::c_char,
saveTensorsSize: usize,
);
}
extern "C" {
pub fn mnnsc_set_type(config: *mut MNNScheduleConfig, type_: MNNForwardType);
}
extern "C" {
pub fn mnnsc_set_num_threads(config: *mut MNNScheduleConfig, numThread: core::ffi::c_int);
}
extern "C" {
pub fn mnnsc_set_mode(config: *mut MNNScheduleConfig, mode: core::ffi::c_int);
}
extern "C" {
pub fn mnnsc_set_backup_type(config: *mut MNNScheduleConfig, backupType: MNNForwardType);
}
extern "C" {
pub fn mnnsc_set_backend_config(
config: *mut MNNScheduleConfig,
backendConfig: *mut MNNBackendConfig,
);
}
extern "C" {
pub fn mnnsc_get_type(config: *mut MNNScheduleConfig) -> MNNForwardType;
}
extern "C" {
pub fn mnnsc_get_backup_type(config: *mut MNNScheduleConfig) -> MNNForwardType;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Session {
_unused: [u8; 0],
}
extern "C" {
pub fn Session_destroy(session: *mut Session);
}
extern "C" {
pub fn Session_hasAsyncWork(session: *mut Session) -> core::ffi::c_int;
}
#[repr(u32)]
#[doc = " Types in the halide type system. They can be ints, unsigned ints,\n or floats (of various bit-widths), or a handle (which is always 64-bits).\n Note that the int/uint/float values do not imply a specific bit width\n (the bit width is expected to be encoded in a separate value)."]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum halide_type_code_t {
#[doc = "!< signed integers"]
halide_type_int = 0,
#[doc = "!< unsigned integers"]
halide_type_uint = 1,
#[doc = "!< IEEE floating point numbers"]
halide_type_float = 2,
#[doc = "!< opaque pointer type (void *)"]
halide_type_handle = 3,
#[doc = "!< floating point numbers in the bfloat format"]
halide_type_bfloat = 4,
}
#[doc = " A runtime tag for a type in the halide type system. Can be ints,\n unsigned ints, or floats of various bit-widths (the 'bits'\n field). Can also be vectors of the same (by setting the 'lanes'\n field to something larger than one). This struct should be\n exactly 32-bits in size."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct halide_type_t {
#[doc = " The basic type code: signed integer, unsigned integer, or floating point."]
pub code: halide_type_code_t,
#[doc = " The number of bits of precision of a single scalar value of this type."]
pub bits: u8,
#[doc = " How many elements in a vector. This is 1 for scalar types."]
pub lanes: u16,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of halide_type_t"][::std::mem::size_of::<halide_type_t>() - 8usize];
["Alignment of halide_type_t"][::std::mem::align_of::<halide_type_t>() - 4usize];
["Offset of field: halide_type_t::code"][::std::mem::offset_of!(halide_type_t, code) - 0usize];
["Offset of field: halide_type_t::bits"][::std::mem::offset_of!(halide_type_t, bits) - 4usize];
["Offset of field: halide_type_t::lanes"]
[::std::mem::offset_of!(halide_type_t, lanes) - 6usize];
};
#[doc = " An opaque struct containing per-GPU API implementations of the\n device functions."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct halide_device_interface_impl_t {
_unused: [u8; 0],
}
#[doc = " Each GPU API provides a halide_device_interface_t struct pointing\n to the code that manages device allocations. You can access these\n functions directly from the struct member function pointers, or by\n calling the functions declared below. Note that the global\n functions are not available when using Halide as a JIT compiler.\n If you are using raw halide_buffer_t in that context you must use\n the function pointers in the device_interface struct.\n\n The function pointers below are currently the same for every GPU\n API; only the impl field varies. These top-level functions do the\n bookkeeping that is common across all GPU APIs, and then dispatch\n to more API-specific functions via another set of function pointers\n hidden inside the impl field."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct halide_device_interface_t {
pub device_malloc: ::std::option::Option<
unsafe extern "C" fn(
user_context: *mut core::ffi::c_void,
buf: *mut halide_buffer_t,
device_interface: *const halide_device_interface_t,
) -> core::ffi::c_int,
>,
pub device_free: ::std::option::Option<
unsafe extern "C" fn(
user_context: *mut core::ffi::c_void,
buf: *mut halide_buffer_t,
) -> core::ffi::c_int,
>,
pub device_sync: ::std::option::Option<
unsafe extern "C" fn(
user_context: *mut core::ffi::c_void,
buf: *mut halide_buffer_t,
) -> core::ffi::c_int,
>,
pub device_release: ::std::option::Option<
unsafe extern "C" fn(
user_context: *mut core::ffi::c_void,
device_interface: *const halide_device_interface_t,
),
>,
pub copy_to_host: ::std::option::Option<
unsafe extern "C" fn(
user_context: *mut core::ffi::c_void,
buf: *mut halide_buffer_t,
) -> core::ffi::c_int,
>,
pub copy_to_device: ::std::option::Option<
unsafe extern "C" fn(
user_context: *mut core::ffi::c_void,
buf: *mut halide_buffer_t,
device_interface: *const halide_device_interface_t,
) -> core::ffi::c_int,
>,
pub device_and_host_malloc: ::std::option::Option<
unsafe extern "C" fn(
user_context: *mut core::ffi::c_void,
buf: *mut halide_buffer_t,
device_interface: *const halide_device_interface_t,
) -> core::ffi::c_int,
>,
pub device_and_host_free: ::std::option::Option<
unsafe extern "C" fn(
user_context: *mut core::ffi::c_void,
buf: *mut halide_buffer_t,
) -> core::ffi::c_int,
>,
pub buffer_copy: ::std::option::Option<
unsafe extern "C" fn(
user_context: *mut core::ffi::c_void,
src: *mut halide_buffer_t,
dst_device_interface: *const halide_device_interface_t,
dst: *mut halide_buffer_t,
) -> core::ffi::c_int,
>,
pub device_crop: ::std::option::Option<
unsafe extern "C" fn(
user_context: *mut core::ffi::c_void,
src: *const halide_buffer_t,
dst: *mut halide_buffer_t,
) -> core::ffi::c_int,
>,
pub device_release_crop: ::std::option::Option<
unsafe extern "C" fn(
user_context: *mut core::ffi::c_void,
buf: *mut halide_buffer_t,
) -> core::ffi::c_int,
>,
pub wrap_native: ::std::option::Option<
unsafe extern "C" fn(
user_context: *mut core::ffi::c_void,
buf: *mut halide_buffer_t,
handle: u64,
device_interface: *const halide_device_interface_t,
) -> core::ffi::c_int,
>,
pub detach_native: ::std::option::Option<
unsafe extern "C" fn(
user_context: *mut core::ffi::c_void,
buf: *mut halide_buffer_t,
) -> core::ffi::c_int,
>,
pub impl_: *const halide_device_interface_impl_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of halide_device_interface_t"]
[::std::mem::size_of::<halide_device_interface_t>() - 112usize];
["Alignment of halide_device_interface_t"]
[::std::mem::align_of::<halide_device_interface_t>() - 8usize];
["Offset of field: halide_device_interface_t::device_malloc"]
[::std::mem::offset_of!(halide_device_interface_t, device_malloc) - 0usize];
["Offset of field: halide_device_interface_t::device_free"]
[::std::mem::offset_of!(halide_device_interface_t, device_free) - 8usize];
["Offset of field: halide_device_interface_t::device_sync"]
[::std::mem::offset_of!(halide_device_interface_t, device_sync) - 16usize];
["Offset of field: halide_device_interface_t::device_release"]
[::std::mem::offset_of!(halide_device_interface_t, device_release) - 24usize];
["Offset of field: halide_device_interface_t::copy_to_host"]
[::std::mem::offset_of!(halide_device_interface_t, copy_to_host) - 32usize];
["Offset of field: halide_device_interface_t::copy_to_device"]
[::std::mem::offset_of!(halide_device_interface_t, copy_to_device) - 40usize];
["Offset of field: halide_device_interface_t::device_and_host_malloc"]
[::std::mem::offset_of!(halide_device_interface_t, device_and_host_malloc) - 48usize];
["Offset of field: halide_device_interface_t::device_and_host_free"]
[::std::mem::offset_of!(halide_device_interface_t, device_and_host_free) - 56usize];
["Offset of field: halide_device_interface_t::buffer_copy"]
[::std::mem::offset_of!(halide_device_interface_t, buffer_copy) - 64usize];
["Offset of field: halide_device_interface_t::device_crop"]
[::std::mem::offset_of!(halide_device_interface_t, device_crop) - 72usize];
["Offset of field: halide_device_interface_t::device_release_crop"]
[::std::mem::offset_of!(halide_device_interface_t, device_release_crop) - 80usize];
["Offset of field: halide_device_interface_t::wrap_native"]
[::std::mem::offset_of!(halide_device_interface_t, wrap_native) - 88usize];
["Offset of field: halide_device_interface_t::detach_native"]
[::std::mem::offset_of!(halide_device_interface_t, detach_native) - 96usize];
["Offset of field: halide_device_interface_t::impl_"]
[::std::mem::offset_of!(halide_device_interface_t, impl_) - 104usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct halide_dimension_t {
pub min: i32,
pub extent: i32,
pub stride: i32,
pub flags: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of halide_dimension_t"][::std::mem::size_of::<halide_dimension_t>() - 16usize];
["Alignment of halide_dimension_t"][::std::mem::align_of::<halide_dimension_t>() - 4usize];
["Offset of field: halide_dimension_t::min"]
[::std::mem::offset_of!(halide_dimension_t, min) - 0usize];
["Offset of field: halide_dimension_t::extent"]
[::std::mem::offset_of!(halide_dimension_t, extent) - 4usize];
["Offset of field: halide_dimension_t::stride"]
[::std::mem::offset_of!(halide_dimension_t, stride) - 8usize];
["Offset of field: halide_dimension_t::flags"]
[::std::mem::offset_of!(halide_dimension_t, flags) - 12usize];
};
pub const halide_buffer_flags_halide_buffer_flag_host_dirty: halide_buffer_flags = 1;
pub const halide_buffer_flags_halide_buffer_flag_device_dirty: halide_buffer_flags = 2;
pub type halide_buffer_flags = core::ffi::c_uint;
#[doc = " \\file\n\n This file declares the routines used by Halide internally in its\n runtime. On platforms that support weak linking, these can be\n replaced with user-defined versions by defining an extern \"C\"\n function with the same name and signature.\n\n When doing Just In Time (JIT) compilation methods on the Func being\n compiled must be called instead. The corresponding methods are\n documented below.\n\n All of these functions take a \"void *user_context\" parameter as their\n first argument; if the Halide kernel that calls back to any of these\n functions has been compiled with the UserContext feature set on its Target,\n then the value of that pointer passed from the code that calls the\n Halide kernel is piped through to the function.\n\n Some of these are also useful to call when using the default\n implementation. E.g. halide_shutdown_thread_pool.\n\n Note that even on platforms with weak linking, some linker setups\n may not respect the override you provide. E.g. if the override is\n in a shared library and the halide object files are linked directly\n into the output, the builtin versions of the runtime functions will\n be called. See your linker documentation for more details. On\n Linux, LD_DYNAMIC_WEAK=1 may help.\n"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct halide_buffer_t {
#[doc = " A device-handle for e.g. GPU memory used to back this buffer."]
pub device: u64,
#[doc = " The interface used to interpret the above handle."]
pub device_interface: *const halide_device_interface_t,
#[doc = " A pointer to the start of the data in main memory. In terms of\n the Halide coordinate system, this is the address of the min\n coordinates (defined below)."]
pub host: *mut u8,
#[doc = " flags with various meanings."]
pub flags: u64,
#[doc = " The type of each buffer element."]
pub type_: halide_type_t,
#[doc = " The dimensionality of the buffer."]
pub dimensions: i32,
#[doc = " The shape of the buffer. Halide does not own this array - you\n must manage the memory for it yourself."]
pub dim: *mut halide_dimension_t,
#[doc = " Pads the buffer up to a multiple of 8 bytes"]
pub padding: *mut core::ffi::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of halide_buffer_t"][::std::mem::size_of::<halide_buffer_t>() - 64usize];
["Alignment of halide_buffer_t"][::std::mem::align_of::<halide_buffer_t>() - 8usize];
["Offset of field: halide_buffer_t::device"]
[::std::mem::offset_of!(halide_buffer_t, device) - 0usize];
["Offset of field: halide_buffer_t::device_interface"]
[::std::mem::offset_of!(halide_buffer_t, device_interface) - 8usize];
["Offset of field: halide_buffer_t::host"]
[::std::mem::offset_of!(halide_buffer_t, host) - 16usize];
["Offset of field: halide_buffer_t::flags"]
[::std::mem::offset_of!(halide_buffer_t, flags) - 24usize];
["Offset of field: halide_buffer_t::type_"]
[::std::mem::offset_of!(halide_buffer_t, type_) - 32usize];
["Offset of field: halide_buffer_t::dimensions"]
[::std::mem::offset_of!(halide_buffer_t, dimensions) - 40usize];
["Offset of field: halide_buffer_t::dim"]
[::std::mem::offset_of!(halide_buffer_t, dim) - 48usize];
["Offset of field: halide_buffer_t::padding"]
[::std::mem::offset_of!(halide_buffer_t, padding) - 56usize];
};
#[repr(C)]
#[derive(Debug)]
pub struct CString {
pub data: *mut core::ffi::c_char,
pub size: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of CString"][::std::mem::size_of::<CString>() - 16usize];
["Alignment of CString"][::std::mem::align_of::<CString>() - 8usize];
["Offset of field: CString::data"][::std::mem::offset_of!(CString, data) - 0usize];
["Offset of field: CString::size"][::std::mem::offset_of!(CString, size) - 8usize];
};
extern "C" {
pub fn createCString(data: *const core::ffi::c_char, size: usize) -> CString;
}
extern "C" {
pub fn destroyCString(string: *mut CString);
}
#[repr(C)]
#[derive(Debug)]
pub struct TensorInfo {
pub name: CString,
pub tensor: *mut core::ffi::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of TensorInfo"][::std::mem::size_of::<TensorInfo>() - 24usize];
["Alignment of TensorInfo"][::std::mem::align_of::<TensorInfo>() - 8usize];
["Offset of field: TensorInfo::name"][::std::mem::offset_of!(TensorInfo, name) - 0usize];
["Offset of field: TensorInfo::tensor"][::std::mem::offset_of!(TensorInfo, tensor) - 16usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct TensorInfoArray {
pub tensors: *mut TensorInfo,
pub size: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of TensorInfoArray"][::std::mem::size_of::<TensorInfoArray>() - 16usize];
["Alignment of TensorInfoArray"][::std::mem::align_of::<TensorInfoArray>() - 8usize];
["Offset of field: TensorInfoArray::tensors"]
[::std::mem::offset_of!(TensorInfoArray, tensors) - 0usize];
["Offset of field: TensorInfoArray::size"]
[::std::mem::offset_of!(TensorInfoArray, size) - 8usize];
};
extern "C" {
pub fn createTensorInfoArray(count: usize) -> *mut TensorInfoArray;
}
extern "C" {
pub fn destroyTensorInfoArray(array: *mut TensorInfoArray);
}
extern "C" {
pub fn getTensorInfoArray(array: *const TensorInfoArray, index: usize) -> *mut TensorInfo;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Tensor {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct TensorShape {
pub shape: [core::ffi::c_int; 4usize],
pub size: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of TensorShape"][::std::mem::size_of::<TensorShape>() - 24usize];
["Alignment of TensorShape"][::std::mem::align_of::<TensorShape>() - 8usize];
["Offset of field: TensorShape::shape"][::std::mem::offset_of!(TensorShape, shape) - 0usize];
["Offset of field: TensorShape::size"][::std::mem::offset_of!(TensorShape, size) - 16usize];
};
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum DimensionType {
TENSORFLOW = 0,
CAFFE = 1,
CAFFE_C4 = 2,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum HandleDataType {
HANDLE_NONE = 0,
HANDLE_STRING = 1,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum MapType {
MAP_TENSOR_WRITE = 0,
MAP_TENSOR_READ = 1,
}
extern "C" {
pub fn Tensor_create(dimSize: core::ffi::c_int, type_: DimensionType) -> *mut Tensor;
}
extern "C" {
pub fn Tensor_createFromTensor(
tensor: *const Tensor,
type_: DimensionType,
allocMemory: core::ffi::c_int,
) -> *mut Tensor;
}
extern "C" {
pub fn Tensor_destroy(tensor: *mut Tensor);
}
extern "C" {
pub fn Tensor_createDevice(
shape: *const core::ffi::c_int,
shapeSize: usize,
typeCode: halide_type_t,
dimType: DimensionType,
) -> *mut Tensor;
}
extern "C" {
pub fn Tensor_createWith(
shape: *const core::ffi::c_int,
shapeSize: usize,
typeCode: halide_type_t,
data: *mut core::ffi::c_void,
dimType: DimensionType,
) -> *mut Tensor;
}
extern "C" {
pub fn Tensor_copyFromHostTensor(
deviceTensor: *mut Tensor,
hostTensor: *const Tensor,
) -> core::ffi::c_int;
}
extern "C" {
pub fn Tensor_copyToHostTensor(
deviceTensor: *const Tensor,
hostTensor: *mut Tensor,
) -> core::ffi::c_int;
}
extern "C" {
pub fn Tensor_createHostTensorFromDevice(
deviceTensor: *const Tensor,
copyData: core::ffi::c_int,
) -> *mut Tensor;
}
extern "C" {
pub fn Tensor_getDimensionType(tensor: *const Tensor) -> DimensionType;
}
extern "C" {
pub fn Tensor_buffer(tensor: *const Tensor) -> *const halide_buffer_t;
}
extern "C" {
pub fn Tensor_buffer_mut(tensor: *mut Tensor) -> *mut halide_buffer_t;
}
extern "C" {
pub fn Tensor_host(tensor: *const Tensor) -> *const core::ffi::c_void;
}
extern "C" {
pub fn Tensor_host_mut(tensor: *mut Tensor) -> *mut core::ffi::c_void;
}
extern "C" {
pub fn Tensor_deviceId(tensor: *const Tensor) -> u64;
}
extern "C" {
pub fn Tensor_dimensions(tensor: *const Tensor) -> core::ffi::c_int;
}
extern "C" {
pub fn Tensor_shape(tensor: *const Tensor) -> TensorShape;
}
extern "C" {
pub fn Tensor_size(tensor: *const Tensor) -> core::ffi::c_int;
}
extern "C" {
pub fn Tensor_usize(tensor: *const Tensor) -> usize;
}
extern "C" {
pub fn Tensor_elementSize(tensor: *const Tensor) -> core::ffi::c_int;
}
extern "C" {
pub fn Tensor_width(tensor: *const Tensor) -> core::ffi::c_int;
}
extern "C" {
pub fn Tensor_height(tensor: *const Tensor) -> core::ffi::c_int;
}
extern "C" {
pub fn Tensor_channel(tensor: *const Tensor) -> core::ffi::c_int;
}
extern "C" {
pub fn Tensor_batch(tensor: *const Tensor) -> core::ffi::c_int;
}
extern "C" {
pub fn Tensor_stride(tensor: *const Tensor, index: core::ffi::c_int) -> core::ffi::c_int;
}
extern "C" {
pub fn Tensor_length(tensor: *const Tensor, index: core::ffi::c_int) -> core::ffi::c_int;
}
extern "C" {
pub fn Tensor_setStride(tensor: *mut Tensor, index: core::ffi::c_int, stride: core::ffi::c_int);
}
extern "C" {
pub fn Tensor_setLength(tensor: *mut Tensor, index: core::ffi::c_int, length: core::ffi::c_int);
}
extern "C" {
pub fn Tensor_getDeviceInfo(
tensor: *const Tensor,
dst: *mut core::ffi::c_void,
forwardType: core::ffi::c_int,
) -> core::ffi::c_int;
}
extern "C" {
pub fn Tensor_print(tensor: *const Tensor);
}
extern "C" {
pub fn Tensor_printShape(tensor: *const Tensor);
}
extern "C" {
pub fn Tensor_map(
tensor: *mut Tensor,
mtype: MapType,
dtype: DimensionType,
) -> *mut core::ffi::c_void;
}
extern "C" {
pub fn Tensor_unmap(
tensor: *mut Tensor,
mtype: MapType,
dtype: DimensionType,
mapPtr: *mut core::ffi::c_void,
);
}
extern "C" {
pub fn Tensor_clone(tensor: *const Tensor) -> *mut Tensor;
}
extern "C" {
pub fn Tensor_wait(
tensor: *mut Tensor,
mtype: MapType,
finish: core::ffi::c_int,
) -> core::ffi::c_int;
}
extern "C" {
pub fn Tensor_setDevicePtr(
tensor: *mut Tensor,
devicePtr: *const core::ffi::c_void,
memoryType: core::ffi::c_int,
) -> core::ffi::c_int;
}
extern "C" {
pub fn Tensor_getType(tensor: *const Tensor) -> halide_type_t;
}
extern "C" {
pub fn Tensor_isTypeOf(tensor: *const Tensor, type_: halide_type_t) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Interpreter {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Backend {
_unused: [u8; 0],
}
#[repr(u32)]
#[doc = " acquire runtime status by Runtime::getCurrentStatus with following keys,"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum RuntimeStatus {
#[doc = " get status whether this runtime support 16-bits float point arithmetic"]
STATUS_SUPPORT_FP16 = 0,
#[doc = " get status whether this runtime support dot-product arithmetic"]
STATUS_SUPPORT_DOT_PRODUCT = 1,
#[doc = " get status whether this runtime support power-low (means low priority for\n opencl)"]
STATUS_SUPPORT_POWER_LOW = 2,
#[doc = " emum total number"]
STATUS_COUNT = 3,
}
extern "C" {
pub fn modelPrintIO(model: *const core::ffi::c_char);
}
extern "C" {
#[doc = " @brief get mnn version info.\n @return mnn version string."]
pub fn getVersion() -> *const core::ffi::c_char;
}
extern "C" {
#[doc = " @brief create net from file.\n @param file given file.\n @return created net if success, NULL otherwise."]
pub fn Interpreter_createFromFile(file: *const core::ffi::c_char) -> *mut Interpreter;
}
extern "C" {
#[doc = " @brief create net from buffer.\n @param buffer given data buffer.\n @param size size of data buffer.\n @return created net if success, NULL otherwise."]
pub fn Interpreter_createFromBuffer(
buffer: *const core::ffi::c_void,
size: usize,
) -> *mut Interpreter;
}
extern "C" {
pub fn Interpreter_destroy(interpreter: *mut Interpreter);
}
pub mod SessionMode {
pub type Type = core::ffi::c_uint;
#[doc = " About CallBack, Default Session_Debug*/\n/** runSessionWithCallBack is allowed and can get internal op info"]
pub const Session_Debug: Type = 0;
#[doc = " runSessionWithCallBack is not valid and can't get any info of op in\nsession"]
pub const Session_Release: Type = 1;
#[doc = " About input tenosr, Default Session_Input_Inside*/\n/** The input tensor is alloced by session, input data after session resized"]
pub const Session_Input_Inside: Type = 2;
#[doc = " The input tensor is alloced by user, set input data before session\nresize"]
pub const Session_Input_User: Type = 3;
#[doc = " The output tensor depends on session, and can't be separate used"]
pub const Session_Output_Inside: Type = 4;
#[doc = " The output tensor can be separated from session"]
pub const Session_Output_User: Type = 5;
#[doc = " Try Resize Session when create Session or not, default direct:"]
pub const Session_Resize_Direct: Type = 6;
#[doc = " Try Resize Session when create Session or not, default direct:"]
pub const Session_Resize_Defer: Type = 7;
#[doc = " Determine the Execution's forward type is determine by user or auto\ndetermine"]
pub const Session_Backend_Fix: Type = 8;
#[doc = " Determine the Execution's forward type is determine by user or auto\ndetermine"]
pub const Session_Backend_Auto: Type = 9;
#[doc = " Determine static memory whether recyle in resizeSession or just cache the\nmemory"]
pub const Session_Memory_Collect: Type = 10;
#[doc = " Determine static memory whether recyle in resizeSession or just cache the\nmemory"]
pub const Session_Memory_Cache: Type = 11;
#[doc = " Determine whether use codegen function"]
pub const Session_Codegen_Disable: Type = 12;
#[doc = " Determine whether use codegen function"]
pub const Session_Codegen_Enable: Type = 13;
#[doc = " Dynamic Reisze Optimization"]
pub const Session_Resize_Check: Type = 14;
#[doc = " Dynamic Reisze Optimization"]
pub const Session_Resize_Fix: Type = 15;
}
extern "C" {
pub fn Interpreter_setSessionMode(interpreter: *mut Interpreter, mode: SessionMode::Type);
}
extern "C" {
pub fn Interpreter_setCacheFile(
interpreter: *mut Interpreter,
cacheFile: *const core::ffi::c_char,
keySize: usize,
);
}
extern "C" {
pub fn Interpreter_setExternalFile(
interpreter: *mut Interpreter,
file: *const core::ffi::c_char,
flag: usize,
);
}
extern "C" {
pub fn Interpreter_updateCacheFile(
interpreter: *mut Interpreter,
session: *mut Session,
) -> ErrorCode;
}
extern "C" {
pub fn Interpreter_setSessionHint(
interpreter: *mut Interpreter,
mode: core::ffi::c_int,
value: core::ffi::c_int,
);
}
extern "C" {
pub fn Interpreter_createSession(
interpreter: *mut Interpreter,
config: *const MNNScheduleConfig,
) -> *mut Session;
}
extern "C" {
pub fn Interpreter_createMultiPathSession(
interpreter: *mut Interpreter,
configs: *const *const MNNScheduleConfig,
configSize: usize,
) -> *mut Session;
}
extern "C" {
pub fn Interpreter_releaseSession(
interpreter: *mut Interpreter,
session: *mut Session,
) -> core::ffi::c_int;
}
extern "C" {
pub fn Interpreter_resizeSession(interpreter: *mut Interpreter, session: *mut Session);
}
extern "C" {
pub fn Interpreter_resizeSessionWithFlag(
interpreter: *mut Interpreter,
session: *mut Session,
needRelloc: core::ffi::c_int,
);
}
extern "C" {
pub fn Interpreter_releaseModel(interpreter: *mut Interpreter);
}
extern "C" {
pub fn Interpreter_getModelVersion(interpreter: *const Interpreter)
-> *const core::ffi::c_char;
}
extern "C" {
pub fn Interpreter_updateSessionToModel(
interpreter: *mut Interpreter,
session: *mut Session,
) -> ErrorCode;
}
extern "C" {
pub fn Interpreter_runSession(
interpreter: *const Interpreter,
session: *mut Session,
) -> ErrorCode;
}
extern "C" {
pub fn Interpreter_runSessionWithCallBackInfo(
interpreter: *const Interpreter,
session: *const Session,
before: *mut core::ffi::c_void,
end: *mut core::ffi::c_void,
sync: core::ffi::c_int,
) -> ErrorCode;
}
extern "C" {
pub fn Interpreter_getSessionInput(
interpreter: *mut Interpreter,
session: *const Session,
name: *const core::ffi::c_char,
) -> *mut Tensor;
}
extern "C" {
pub fn Interpreter_getSessionOutput(
interpreter: *mut Interpreter,
session: *const Session,
name: *const core::ffi::c_char,
) -> *mut Tensor;
}
extern "C" {
pub fn Interpreter_getSessionInfo(
interpreter: *mut Interpreter,
session: *const Session,
code: core::ffi::c_int,
ptr: *mut core::ffi::c_void,
) -> core::ffi::c_int;
}
extern "C" {
pub fn Interpreter_getSessionOutputAll(
interpreter: *const Interpreter,
session: *const Session,
) -> *const TensorInfoArray;
}
extern "C" {
pub fn Interpreter_getSessionInputAll(
interpreter: *const Interpreter,
session: *const Session,
) -> *const TensorInfoArray;
}
extern "C" {
pub fn Interpreter_resizeTensor(
interpreter: *mut Interpreter,
tensor: *mut Tensor,
dims: *const core::ffi::c_int,
dimsSize: usize,
);
}
extern "C" {
pub fn Interpreter_resizeTensorByNCHW(
interpreter: *mut Interpreter,
tensor: *mut Tensor,
batch: core::ffi::c_int,
channel: core::ffi::c_int,
height: core::ffi::c_int,
width: core::ffi::c_int,
);
}
extern "C" {
pub fn Interpreter_getBackend(
interpreter: *const Interpreter,
session: *const Session,
tensor: *const Tensor,
) -> *const Backend;
}
extern "C" {
pub fn Interpreter_bizCode(interpreter: *const Interpreter) -> *const core::ffi::c_char;
}
extern "C" {
pub fn Interpreter_uuid(interpreter: *const Interpreter) -> *const core::ffi::c_char;
}
extern "C" {
pub fn OperatorInfo_name(op: *const core::ffi::c_void) -> *const core::ffi::c_char;
}
extern "C" {
pub fn OperatorInfo_type(op: *const core::ffi::c_void) -> *const core::ffi::c_char;
}
extern "C" {
pub fn OperatorInfo_flops(op: *const core::ffi::c_void) -> f32;
}