From e195c885a160158155123d6c57b5a0a1013ddbb1 Mon Sep 17 00:00:00 2001 From: Andrii Kotliar Date: Mon, 8 Jan 2024 01:24:38 +0100 Subject: [PATCH] Add whisper_lang_str_full function to whisper-rs --- Cargo.toml | 2 +- src/standalone.rs | 17 + sys/src/bindings.rs | 2656 +++++++++++++++++++++++++------------------ 3 files changed, 1584 insertions(+), 1091 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5f870e3..e92fefd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ exclude = ["examples/full_usage"] [package] name = "whisper-rs" -version = "0.10.0" +version = "0.10.1" edition = "2021" description = "Rust bindings for whisper.cpp" license = "Unlicense" diff --git a/src/standalone.rs b/src/standalone.rs index e945dfb..eb49751 100644 --- a/src/standalone.rs +++ b/src/standalone.rs @@ -53,6 +53,23 @@ pub fn get_lang_str(id: i32) -> Option<&'static str> { } } +/// Get the full string of the specified language name (e.g. 2 -> "german"). +/// +/// # Returns +/// The full string of the language, None if not found. +/// +/// # C++ equivalent +/// `const char * whisper_lang_str_full(int id)` +pub fn get_lang_str_full(id: i32) -> Option<&'static str> { + let c_buf = unsafe { whisper_rs_sys::whisper_lang_str_full(id) }; + if c_buf.is_null() { + None + } else { + let c_str = unsafe { CStr::from_ptr(c_buf) }; + Some(c_str.to_str().unwrap()) + } +} + /// Callback to control logging output: default behaviour is to print to stderr. /// /// # Safety diff --git a/sys/src/bindings.rs b/sys/src/bindings.rs index 0c91318..68ffe6f 100644 --- a/sys/src/bindings.rs +++ b/sys/src/bindings.rs @@ -1,101 +1,79 @@ /* automatically generated by rust-bindgen 0.69.1 */ -pub const _STDINT_H: u32 = 1; -pub const _FEATURES_H: u32 = 1; -pub const _DEFAULT_SOURCE: u32 = 1; -pub const __GLIBC_USE_ISOC2X: 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_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_C2X_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 = 38; -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_C2X: 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_C2X: 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 INT8_MIN: i32 = -128; -pub const INT16_MIN: i32 = -32768; -pub const INT32_MIN: i32 = -2147483648; +pub const __DARWIN_ONLY_64_BIT_INO_T: u32 = 1; +pub const __DARWIN_ONLY_UNIX_CONFORMANCE: u32 = 1; +pub const __DARWIN_ONLY_VERS_1050: u32 = 1; +pub const __DARWIN_UNIX03: u32 = 1; +pub const __DARWIN_64_BIT_INO_T: u32 = 1; +pub const __DARWIN_VERS_1050: u32 = 1; +pub const __DARWIN_NON_CANCELABLE: u32 = 0; +pub const __DARWIN_SUF_EXTSN: &[u8; 14] = b"$DARWIN_EXTSN\0"; +pub const __DARWIN_C_ANSI: u32 = 4096; +pub const __DARWIN_C_FULL: u32 = 900000; +pub const __DARWIN_C_LEVEL: u32 = 900000; +pub const __STDC_WANT_LIB_EXT1__: u32 = 1; +pub const __DARWIN_NO_LONG_LONG: u32 = 0; +pub const _DARWIN_FEATURE_64_BIT_INODE: u32 = 1; +pub const _DARWIN_FEATURE_ONLY_64_BIT_INODE: u32 = 1; +pub const _DARWIN_FEATURE_ONLY_VERS_1050: u32 = 1; +pub const _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE: u32 = 1; +pub const _DARWIN_FEATURE_UNIX_CONFORMANCE: u32 = 3; +pub const __has_ptrcheck: u32 = 0; +pub const __PTHREAD_SIZE__: u32 = 8176; +pub const __PTHREAD_ATTR_SIZE__: u32 = 56; +pub const __PTHREAD_MUTEXATTR_SIZE__: u32 = 8; +pub const __PTHREAD_MUTEX_SIZE__: u32 = 56; +pub const __PTHREAD_CONDATTR_SIZE__: u32 = 8; +pub const __PTHREAD_COND_SIZE__: u32 = 40; +pub const __PTHREAD_ONCE_SIZE__: u32 = 8; +pub const __PTHREAD_RWLOCK_SIZE__: u32 = 192; +pub const __PTHREAD_RWLOCKATTR_SIZE__: u32 = 16; pub const INT8_MAX: u32 = 127; pub const INT16_MAX: u32 = 32767; pub const INT32_MAX: u32 = 2147483647; +pub const INT64_MAX: u64 = 9223372036854775807; +pub const INT8_MIN: i32 = -128; +pub const INT16_MIN: i32 = -32768; +pub const INT32_MIN: i32 = -2147483648; +pub const INT64_MIN: i64 = -9223372036854775808; pub const UINT8_MAX: u32 = 255; pub const UINT16_MAX: u32 = 65535; pub const UINT32_MAX: u32 = 4294967295; +pub const UINT64_MAX: i32 = -1; pub const INT_LEAST8_MIN: i32 = -128; pub const INT_LEAST16_MIN: i32 = -32768; pub const INT_LEAST32_MIN: i32 = -2147483648; +pub const INT_LEAST64_MIN: i64 = -9223372036854775808; pub const INT_LEAST8_MAX: u32 = 127; pub const INT_LEAST16_MAX: u32 = 32767; pub const INT_LEAST32_MAX: u32 = 2147483647; +pub const INT_LEAST64_MAX: u64 = 9223372036854775807; pub const UINT_LEAST8_MAX: u32 = 255; pub const UINT_LEAST16_MAX: u32 = 65535; pub const UINT_LEAST32_MAX: u32 = 4294967295; +pub const UINT_LEAST64_MAX: i32 = -1; pub const INT_FAST8_MIN: i32 = -128; -pub const INT_FAST16_MIN: i64 = -9223372036854775808; -pub const INT_FAST32_MIN: i64 = -9223372036854775808; +pub const INT_FAST16_MIN: i32 = -32768; +pub const INT_FAST32_MIN: i32 = -2147483648; +pub const INT_FAST64_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 INT_FAST16_MAX: u32 = 32767; +pub const INT_FAST32_MAX: u32 = 2147483647; +pub const INT_FAST64_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 UINT_FAST16_MAX: u32 = 65535; +pub const UINT_FAST32_MAX: u32 = 4294967295; +pub const UINT_FAST64_MAX: i32 = -1; pub const INTPTR_MAX: u64 = 9223372036854775807; +pub const INTPTR_MIN: i64 = -9223372036854775808; pub const UINTPTR_MAX: i32 = -1; -pub const PTRDIFF_MIN: i64 = -9223372036854775808; -pub const PTRDIFF_MAX: u64 = 9223372036854775807; +pub const SIZE_MAX: i32 = -1; +pub const RSIZE_MAX: i32 = -1; +pub const WINT_MIN: i32 = -2147483648; +pub const WINT_MAX: u32 = 2147483647; 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; @@ -104,9 +82,9 @@ pub const GGML_FILE_VERSION: u32 = 1; pub const GGML_QNT_VERSION: u32 = 2; pub const GGML_QNT_VERSION_FACTOR: u32 = 1000; pub const GGML_MAX_DIMS: u32 = 4; -pub const GGML_MAX_PARAMS: u32 = 1024; +pub const GGML_MAX_PARAMS: u32 = 2048; pub const GGML_MAX_CONTEXTS: u32 = 64; -pub const GGML_MAX_SRC: u32 = 6; +pub const GGML_MAX_SRC: u32 = 10; pub const GGML_MAX_NAME: u32 = 64; pub const GGML_MAX_OP_PARAMS: u32 = 64; pub const GGML_DEFAULT_N_THREADS: u32 = 4; @@ -122,160 +100,574 @@ pub const WHISPER_SAMPLE_RATE: u32 = 16000; pub const WHISPER_N_FFT: u32 = 400; pub const WHISPER_HOP_LENGTH: u32 = 160; pub const WHISPER_CHUNK_SIZE: u32 = 30; -pub type __u_char = ::std::os::raw::c_uchar; -pub type __u_short = ::std::os::raw::c_ushort; -pub type __u_int = ::std::os::raw::c_uint; -pub type __u_long = ::std::os::raw::c_ulong; +pub type int_least8_t = i8; +pub type int_least16_t = i16; +pub type int_least32_t = i32; +pub type int_least64_t = i64; +pub type uint_least8_t = u8; +pub type uint_least16_t = u16; +pub type uint_least32_t = u32; +pub type uint_least64_t = u64; +pub type int_fast8_t = i8; +pub type int_fast16_t = i16; +pub type int_fast32_t = i32; +pub type int_fast64_t = i64; +pub type uint_fast8_t = u8; +pub type uint_fast16_t = u16; +pub type uint_fast32_t = u32; +pub type uint_fast64_t = u64; pub type __int8_t = ::std::os::raw::c_schar; pub type __uint8_t = ::std::os::raw::c_uchar; pub type __int16_t = ::std::os::raw::c_short; pub type __uint16_t = ::std::os::raw::c_ushort; pub type __int32_t = ::std::os::raw::c_int; pub type __uint32_t = ::std::os::raw::c_uint; -pub type __int64_t = ::std::os::raw::c_long; -pub type __uint64_t = ::std::os::raw::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 = ::std::os::raw::c_long; -pub type __u_quad_t = ::std::os::raw::c_ulong; -pub type __intmax_t = ::std::os::raw::c_long; -pub type __uintmax_t = ::std::os::raw::c_ulong; -pub type __dev_t = ::std::os::raw::c_ulong; -pub type __uid_t = ::std::os::raw::c_uint; -pub type __gid_t = ::std::os::raw::c_uint; -pub type __ino_t = ::std::os::raw::c_ulong; -pub type __ino64_t = ::std::os::raw::c_ulong; -pub type __mode_t = ::std::os::raw::c_uint; -pub type __nlink_t = ::std::os::raw::c_ulong; -pub type __off_t = ::std::os::raw::c_long; -pub type __off64_t = ::std::os::raw::c_long; -pub type __pid_t = ::std::os::raw::c_int; +pub type __int64_t = ::std::os::raw::c_longlong; +pub type __uint64_t = ::std::os::raw::c_ulonglong; +pub type __darwin_intptr_t = ::std::os::raw::c_long; +pub type __darwin_natural_t = ::std::os::raw::c_uint; +pub type __darwin_ct_rune_t = ::std::os::raw::c_int; #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __fsid_t { - pub __val: [::std::os::raw::c_int; 2usize], +#[derive(Copy, Clone)] +pub union __mbstate_t { + pub __mbstate8: [::std::os::raw::c_char; 128usize], + pub _mbstateL: ::std::os::raw::c_longlong, } #[test] -fn bindgen_test_layout___fsid_t() { - const UNINIT: ::std::mem::MaybeUninit<__fsid_t> = ::std::mem::MaybeUninit::uninit(); +fn bindgen_test_layout___mbstate_t() { + const UNINIT: ::std::mem::MaybeUninit<__mbstate_t> = ::std::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::<__fsid_t>(), + ::std::mem::size_of::<__mbstate_t>(), + 128usize, + concat!("Size of: ", stringify!(__mbstate_t)) + ); + assert_eq!( + ::std::mem::align_of::<__mbstate_t>(), 8usize, - concat!("Size of: ", stringify!(__fsid_t)) + concat!("Alignment of ", stringify!(__mbstate_t)) ); assert_eq!( - ::std::mem::align_of::<__fsid_t>(), - 4usize, - concat!("Alignment of ", stringify!(__fsid_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__val) as usize - ptr as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__mbstate8) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(__fsid_t), - "::", - stringify!(__val) + "Offset of field: ", + stringify!(__mbstate_t), + "::", + stringify!(__mbstate8) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._mbstateL) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t), + "::", + stringify!(_mbstateL) ) ); } -pub type __clock_t = ::std::os::raw::c_long; -pub type __rlim_t = ::std::os::raw::c_ulong; -pub type __rlim64_t = ::std::os::raw::c_ulong; -pub type __id_t = ::std::os::raw::c_uint; -pub type __time_t = ::std::os::raw::c_long; -pub type __useconds_t = ::std::os::raw::c_uint; -pub type __suseconds_t = ::std::os::raw::c_long; -pub type __suseconds64_t = ::std::os::raw::c_long; -pub type __daddr_t = ::std::os::raw::c_int; -pub type __key_t = ::std::os::raw::c_int; -pub type __clockid_t = ::std::os::raw::c_int; -pub type __timer_t = *mut ::std::os::raw::c_void; -pub type __blksize_t = ::std::os::raw::c_long; -pub type __blkcnt_t = ::std::os::raw::c_long; -pub type __blkcnt64_t = ::std::os::raw::c_long; -pub type __fsblkcnt_t = ::std::os::raw::c_ulong; -pub type __fsblkcnt64_t = ::std::os::raw::c_ulong; -pub type __fsfilcnt_t = ::std::os::raw::c_ulong; -pub type __fsfilcnt64_t = ::std::os::raw::c_ulong; -pub type __fsword_t = ::std::os::raw::c_long; -pub type __ssize_t = ::std::os::raw::c_long; -pub type __syscall_slong_t = ::std::os::raw::c_long; -pub type __syscall_ulong_t = ::std::os::raw::c_ulong; -pub type __loff_t = __off64_t; -pub type __caddr_t = *mut ::std::os::raw::c_char; -pub type __intptr_t = ::std::os::raw::c_long; -pub type __socklen_t = ::std::os::raw::c_uint; -pub type __sig_atomic_t = ::std::os::raw::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 = ::std::os::raw::c_schar; -pub type int_fast16_t = ::std::os::raw::c_long; -pub type int_fast32_t = ::std::os::raw::c_long; -pub type int_fast64_t = ::std::os::raw::c_long; -pub type uint_fast8_t = ::std::os::raw::c_uchar; -pub type uint_fast16_t = ::std::os::raw::c_ulong; -pub type uint_fast32_t = ::std::os::raw::c_ulong; -pub type uint_fast64_t = ::std::os::raw::c_ulong; -pub type intmax_t = __intmax_t; -pub type uintmax_t = __uintmax_t; -pub type wchar_t = ::std::os::raw::c_int; +pub type __darwin_mbstate_t = __mbstate_t; +pub type __darwin_ptrdiff_t = ::std::os::raw::c_long; +pub type __darwin_size_t = ::std::os::raw::c_ulong; +pub type __darwin_va_list = __builtin_va_list; +pub type __darwin_wchar_t = ::std::os::raw::c_int; +pub type __darwin_rune_t = __darwin_wchar_t; +pub type __darwin_wint_t = ::std::os::raw::c_int; +pub type __darwin_clock_t = ::std::os::raw::c_ulong; +pub type __darwin_socklen_t = __uint32_t; +pub type __darwin_ssize_t = ::std::os::raw::c_long; +pub type __darwin_time_t = ::std::os::raw::c_long; +pub type __darwin_blkcnt_t = __int64_t; +pub type __darwin_blksize_t = __int32_t; +pub type __darwin_dev_t = __int32_t; +pub type __darwin_fsblkcnt_t = ::std::os::raw::c_uint; +pub type __darwin_fsfilcnt_t = ::std::os::raw::c_uint; +pub type __darwin_gid_t = __uint32_t; +pub type __darwin_id_t = __uint32_t; +pub type __darwin_ino64_t = __uint64_t; +pub type __darwin_ino_t = __darwin_ino64_t; +pub type __darwin_mach_port_name_t = __darwin_natural_t; +pub type __darwin_mach_port_t = __darwin_mach_port_name_t; +pub type __darwin_mode_t = __uint16_t; +pub type __darwin_off_t = __int64_t; +pub type __darwin_pid_t = __int32_t; +pub type __darwin_sigset_t = __uint32_t; +pub type __darwin_suseconds_t = __int32_t; +pub type __darwin_uid_t = __uint32_t; +pub type __darwin_useconds_t = __uint32_t; +pub type __darwin_uuid_t = [::std::os::raw::c_uchar; 16usize]; +pub type __darwin_uuid_string_t = [::std::os::raw::c_char; 37usize]; #[repr(C)] -#[repr(align(16))] #[derive(Debug, Copy, Clone)] -pub struct max_align_t { - pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, - pub __bindgen_padding_0: u64, - pub __clang_max_align_nonce2: u128, +pub struct __darwin_pthread_handler_rec { + pub __routine: ::std::option::Option, + pub __arg: *mut ::std::os::raw::c_void, + pub __next: *mut __darwin_pthread_handler_rec, } #[test] -fn bindgen_test_layout_max_align_t() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); +fn bindgen_test_layout___darwin_pthread_handler_rec() { + const UNINIT: ::std::mem::MaybeUninit<__darwin_pthread_handler_rec> = + ::std::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(max_align_t)) + ::std::mem::size_of::<__darwin_pthread_handler_rec>(), + 24usize, + concat!("Size of: ", stringify!(__darwin_pthread_handler_rec)) ); assert_eq!( - ::std::mem::align_of::(), - 16usize, - concat!("Alignment of ", stringify!(max_align_t)) + ::std::mem::align_of::<__darwin_pthread_handler_rec>(), + 8usize, + concat!("Alignment of ", stringify!(__darwin_pthread_handler_rec)) ); assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__routine) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce1) + "Offset of field: ", + stringify!(__darwin_pthread_handler_rec), + "::", + stringify!(__routine) ) ); assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__arg) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__darwin_pthread_handler_rec), + "::", + stringify!(__arg) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__next) as usize - ptr as usize }, 16usize, concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce2) + "Offset of field: ", + stringify!(__darwin_pthread_handler_rec), + "::", + stringify!(__next) ) ); } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _opaque_pthread_attr_t { + pub __sig: ::std::os::raw::c_long, + pub __opaque: [::std::os::raw::c_char; 56usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_attr_t() { + const UNINIT: ::std::mem::MaybeUninit<_opaque_pthread_attr_t> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_opaque_pthread_attr_t>(), + 64usize, + concat!("Size of: ", stringify!(_opaque_pthread_attr_t)) + ); + assert_eq!( + ::std::mem::align_of::<_opaque_pthread_attr_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_attr_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__sig) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_attr_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__opaque) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_attr_t), + "::", + stringify!(__opaque) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _opaque_pthread_cond_t { + pub __sig: ::std::os::raw::c_long, + pub __opaque: [::std::os::raw::c_char; 40usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_cond_t() { + const UNINIT: ::std::mem::MaybeUninit<_opaque_pthread_cond_t> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_opaque_pthread_cond_t>(), + 48usize, + concat!("Size of: ", stringify!(_opaque_pthread_cond_t)) + ); + assert_eq!( + ::std::mem::align_of::<_opaque_pthread_cond_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_cond_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__sig) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_cond_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__opaque) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_cond_t), + "::", + stringify!(__opaque) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _opaque_pthread_condattr_t { + pub __sig: ::std::os::raw::c_long, + pub __opaque: [::std::os::raw::c_char; 8usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_condattr_t() { + const UNINIT: ::std::mem::MaybeUninit<_opaque_pthread_condattr_t> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_opaque_pthread_condattr_t>(), + 16usize, + concat!("Size of: ", stringify!(_opaque_pthread_condattr_t)) + ); + assert_eq!( + ::std::mem::align_of::<_opaque_pthread_condattr_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_condattr_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__sig) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_condattr_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__opaque) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_condattr_t), + "::", + stringify!(__opaque) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _opaque_pthread_mutex_t { + pub __sig: ::std::os::raw::c_long, + pub __opaque: [::std::os::raw::c_char; 56usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_mutex_t() { + const UNINIT: ::std::mem::MaybeUninit<_opaque_pthread_mutex_t> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_opaque_pthread_mutex_t>(), + 64usize, + concat!("Size of: ", stringify!(_opaque_pthread_mutex_t)) + ); + assert_eq!( + ::std::mem::align_of::<_opaque_pthread_mutex_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_mutex_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__sig) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_mutex_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__opaque) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_mutex_t), + "::", + stringify!(__opaque) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _opaque_pthread_mutexattr_t { + pub __sig: ::std::os::raw::c_long, + pub __opaque: [::std::os::raw::c_char; 8usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_mutexattr_t() { + const UNINIT: ::std::mem::MaybeUninit<_opaque_pthread_mutexattr_t> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_opaque_pthread_mutexattr_t>(), + 16usize, + concat!("Size of: ", stringify!(_opaque_pthread_mutexattr_t)) + ); + assert_eq!( + ::std::mem::align_of::<_opaque_pthread_mutexattr_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_mutexattr_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__sig) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_mutexattr_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__opaque) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_mutexattr_t), + "::", + stringify!(__opaque) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _opaque_pthread_once_t { + pub __sig: ::std::os::raw::c_long, + pub __opaque: [::std::os::raw::c_char; 8usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_once_t() { + const UNINIT: ::std::mem::MaybeUninit<_opaque_pthread_once_t> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_opaque_pthread_once_t>(), + 16usize, + concat!("Size of: ", stringify!(_opaque_pthread_once_t)) + ); + assert_eq!( + ::std::mem::align_of::<_opaque_pthread_once_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_once_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__sig) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_once_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__opaque) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_once_t), + "::", + stringify!(__opaque) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _opaque_pthread_rwlock_t { + pub __sig: ::std::os::raw::c_long, + pub __opaque: [::std::os::raw::c_char; 192usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_rwlock_t() { + const UNINIT: ::std::mem::MaybeUninit<_opaque_pthread_rwlock_t> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_opaque_pthread_rwlock_t>(), + 200usize, + concat!("Size of: ", stringify!(_opaque_pthread_rwlock_t)) + ); + assert_eq!( + ::std::mem::align_of::<_opaque_pthread_rwlock_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_rwlock_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__sig) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_rwlock_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__opaque) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_rwlock_t), + "::", + stringify!(__opaque) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _opaque_pthread_rwlockattr_t { + pub __sig: ::std::os::raw::c_long, + pub __opaque: [::std::os::raw::c_char; 16usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_rwlockattr_t() { + const UNINIT: ::std::mem::MaybeUninit<_opaque_pthread_rwlockattr_t> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_opaque_pthread_rwlockattr_t>(), + 24usize, + concat!("Size of: ", stringify!(_opaque_pthread_rwlockattr_t)) + ); + assert_eq!( + ::std::mem::align_of::<_opaque_pthread_rwlockattr_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_rwlockattr_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__sig) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_rwlockattr_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__opaque) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_rwlockattr_t), + "::", + stringify!(__opaque) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _opaque_pthread_t { + pub __sig: ::std::os::raw::c_long, + pub __cleanup_stack: *mut __darwin_pthread_handler_rec, + pub __opaque: [::std::os::raw::c_char; 8176usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_t() { + const UNINIT: ::std::mem::MaybeUninit<_opaque_pthread_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_opaque_pthread_t>(), + 8192usize, + concat!("Size of: ", stringify!(_opaque_pthread_t)) + ); + assert_eq!( + ::std::mem::align_of::<_opaque_pthread_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__sig) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__cleanup_stack) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_t), + "::", + stringify!(__cleanup_stack) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__opaque) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_t), + "::", + stringify!(__opaque) + ) + ); +} +pub type __darwin_pthread_attr_t = _opaque_pthread_attr_t; +pub type __darwin_pthread_cond_t = _opaque_pthread_cond_t; +pub type __darwin_pthread_condattr_t = _opaque_pthread_condattr_t; +pub type __darwin_pthread_key_t = ::std::os::raw::c_ulong; +pub type __darwin_pthread_mutex_t = _opaque_pthread_mutex_t; +pub type __darwin_pthread_mutexattr_t = _opaque_pthread_mutexattr_t; +pub type __darwin_pthread_once_t = _opaque_pthread_once_t; +pub type __darwin_pthread_rwlock_t = _opaque_pthread_rwlock_t; +pub type __darwin_pthread_rwlockattr_t = _opaque_pthread_rwlockattr_t; +pub type __darwin_pthread_t = *mut _opaque_pthread_t; +pub type u_int8_t = ::std::os::raw::c_uchar; +pub type u_int16_t = ::std::os::raw::c_ushort; +pub type u_int32_t = ::std::os::raw::c_uint; +pub type u_int64_t = ::std::os::raw::c_ulonglong; +pub type register_t = i64; +pub type user_addr_t = u_int64_t; +pub type user_size_t = u_int64_t; +pub type user_ssize_t = i64; +pub type user_long_t = i64; +pub type user_ulong_t = u_int64_t; +pub type user_time_t = i64; +pub type user_off_t = i64; +pub type syscall_arg_t = u_int64_t; +pub type intmax_t = ::std::os::raw::c_long; +pub type uintmax_t = ::std::os::raw::c_ulong; +pub type rsize_t = ::std::os::raw::c_ulong; +pub type wchar_t = ::std::os::raw::c_int; +pub type max_align_t = f64; pub type ggml_fp16_t = u16; extern "C" { pub fn ggml_fp16_to_fp32(x: ggml_fp16_t) -> f32; @@ -313,6 +705,9 @@ pub const ggml_type_GGML_TYPE_I16: ggml_type = 17; pub const ggml_type_GGML_TYPE_I32: ggml_type = 18; pub const ggml_type_GGML_TYPE_COUNT: ggml_type = 19; pub type ggml_type = ::std::os::raw::c_uint; +pub const ggml_prec_GGML_PREC_DEFAULT: ggml_prec = 0; +pub const ggml_prec_GGML_PREC_F32: ggml_prec = 1; +pub type ggml_prec = ::std::os::raw::c_uint; pub const ggml_backend_type_GGML_BACKEND_CPU: ggml_backend_type = 0; pub const ggml_backend_type_GGML_BACKEND_GPU: ggml_backend_type = 10; pub const ggml_backend_type_GGML_BACKEND_GPU_SPLIT: ggml_backend_type = 20; @@ -356,51 +751,55 @@ pub const ggml_op_GGML_OP_RMS_NORM: ggml_op = 20; pub const ggml_op_GGML_OP_RMS_NORM_BACK: ggml_op = 21; pub const ggml_op_GGML_OP_GROUP_NORM: ggml_op = 22; pub const ggml_op_GGML_OP_MUL_MAT: ggml_op = 23; -pub const ggml_op_GGML_OP_OUT_PROD: ggml_op = 24; -pub const ggml_op_GGML_OP_SCALE: ggml_op = 25; -pub const ggml_op_GGML_OP_SET: ggml_op = 26; -pub const ggml_op_GGML_OP_CPY: ggml_op = 27; -pub const ggml_op_GGML_OP_CONT: ggml_op = 28; -pub const ggml_op_GGML_OP_RESHAPE: ggml_op = 29; -pub const ggml_op_GGML_OP_VIEW: ggml_op = 30; -pub const ggml_op_GGML_OP_PERMUTE: ggml_op = 31; -pub const ggml_op_GGML_OP_TRANSPOSE: ggml_op = 32; -pub const ggml_op_GGML_OP_GET_ROWS: ggml_op = 33; -pub const ggml_op_GGML_OP_GET_ROWS_BACK: ggml_op = 34; -pub const ggml_op_GGML_OP_DIAG: ggml_op = 35; -pub const ggml_op_GGML_OP_DIAG_MASK_INF: ggml_op = 36; -pub const ggml_op_GGML_OP_DIAG_MASK_ZERO: ggml_op = 37; -pub const ggml_op_GGML_OP_SOFT_MAX: ggml_op = 38; -pub const ggml_op_GGML_OP_SOFT_MAX_BACK: ggml_op = 39; -pub const ggml_op_GGML_OP_ROPE: ggml_op = 40; -pub const ggml_op_GGML_OP_ROPE_BACK: ggml_op = 41; -pub const ggml_op_GGML_OP_ALIBI: ggml_op = 42; -pub const ggml_op_GGML_OP_CLAMP: ggml_op = 43; -pub const ggml_op_GGML_OP_CONV_TRANSPOSE_1D: ggml_op = 44; -pub const ggml_op_GGML_OP_IM2COL: ggml_op = 45; -pub const ggml_op_GGML_OP_CONV_TRANSPOSE_2D: ggml_op = 46; -pub const ggml_op_GGML_OP_POOL_1D: ggml_op = 47; -pub const ggml_op_GGML_OP_POOL_2D: ggml_op = 48; -pub const ggml_op_GGML_OP_UPSCALE: ggml_op = 49; -pub const ggml_op_GGML_OP_FLASH_ATTN: ggml_op = 50; -pub const ggml_op_GGML_OP_FLASH_FF: ggml_op = 51; -pub const ggml_op_GGML_OP_FLASH_ATTN_BACK: ggml_op = 52; -pub const ggml_op_GGML_OP_WIN_PART: ggml_op = 53; -pub const ggml_op_GGML_OP_WIN_UNPART: ggml_op = 54; -pub const ggml_op_GGML_OP_GET_REL_POS: ggml_op = 55; -pub const ggml_op_GGML_OP_ADD_REL_POS: ggml_op = 56; -pub const ggml_op_GGML_OP_UNARY: ggml_op = 57; -pub const ggml_op_GGML_OP_MAP_UNARY: ggml_op = 58; -pub const ggml_op_GGML_OP_MAP_BINARY: ggml_op = 59; -pub const ggml_op_GGML_OP_MAP_CUSTOM1_F32: ggml_op = 60; -pub const ggml_op_GGML_OP_MAP_CUSTOM2_F32: ggml_op = 61; -pub const ggml_op_GGML_OP_MAP_CUSTOM3_F32: ggml_op = 62; -pub const ggml_op_GGML_OP_MAP_CUSTOM1: ggml_op = 63; -pub const ggml_op_GGML_OP_MAP_CUSTOM2: ggml_op = 64; -pub const ggml_op_GGML_OP_MAP_CUSTOM3: ggml_op = 65; -pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS: ggml_op = 66; -pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS_BACK: ggml_op = 67; -pub const ggml_op_GGML_OP_COUNT: ggml_op = 68; +pub const ggml_op_GGML_OP_MUL_MAT_ID: ggml_op = 24; +pub const ggml_op_GGML_OP_OUT_PROD: ggml_op = 25; +pub const ggml_op_GGML_OP_SCALE: ggml_op = 26; +pub const ggml_op_GGML_OP_SET: ggml_op = 27; +pub const ggml_op_GGML_OP_CPY: ggml_op = 28; +pub const ggml_op_GGML_OP_CONT: ggml_op = 29; +pub const ggml_op_GGML_OP_RESHAPE: ggml_op = 30; +pub const ggml_op_GGML_OP_VIEW: ggml_op = 31; +pub const ggml_op_GGML_OP_PERMUTE: ggml_op = 32; +pub const ggml_op_GGML_OP_TRANSPOSE: ggml_op = 33; +pub const ggml_op_GGML_OP_GET_ROWS: ggml_op = 34; +pub const ggml_op_GGML_OP_GET_ROWS_BACK: ggml_op = 35; +pub const ggml_op_GGML_OP_DIAG: ggml_op = 36; +pub const ggml_op_GGML_OP_DIAG_MASK_INF: ggml_op = 37; +pub const ggml_op_GGML_OP_DIAG_MASK_ZERO: ggml_op = 38; +pub const ggml_op_GGML_OP_SOFT_MAX: ggml_op = 39; +pub const ggml_op_GGML_OP_SOFT_MAX_BACK: ggml_op = 40; +pub const ggml_op_GGML_OP_ROPE: ggml_op = 41; +pub const ggml_op_GGML_OP_ROPE_BACK: ggml_op = 42; +pub const ggml_op_GGML_OP_ALIBI: ggml_op = 43; +pub const ggml_op_GGML_OP_CLAMP: ggml_op = 44; +pub const ggml_op_GGML_OP_CONV_TRANSPOSE_1D: ggml_op = 45; +pub const ggml_op_GGML_OP_IM2COL: ggml_op = 46; +pub const ggml_op_GGML_OP_CONV_TRANSPOSE_2D: ggml_op = 47; +pub const ggml_op_GGML_OP_POOL_1D: ggml_op = 48; +pub const ggml_op_GGML_OP_POOL_2D: ggml_op = 49; +pub const ggml_op_GGML_OP_UPSCALE: ggml_op = 50; +pub const ggml_op_GGML_OP_PAD: ggml_op = 51; +pub const ggml_op_GGML_OP_ARGSORT: ggml_op = 52; +pub const ggml_op_GGML_OP_LEAKY_RELU: ggml_op = 53; +pub const ggml_op_GGML_OP_FLASH_ATTN: ggml_op = 54; +pub const ggml_op_GGML_OP_FLASH_FF: ggml_op = 55; +pub const ggml_op_GGML_OP_FLASH_ATTN_BACK: ggml_op = 56; +pub const ggml_op_GGML_OP_WIN_PART: ggml_op = 57; +pub const ggml_op_GGML_OP_WIN_UNPART: ggml_op = 58; +pub const ggml_op_GGML_OP_GET_REL_POS: ggml_op = 59; +pub const ggml_op_GGML_OP_ADD_REL_POS: ggml_op = 60; +pub const ggml_op_GGML_OP_UNARY: ggml_op = 61; +pub const ggml_op_GGML_OP_MAP_UNARY: ggml_op = 62; +pub const ggml_op_GGML_OP_MAP_BINARY: ggml_op = 63; +pub const ggml_op_GGML_OP_MAP_CUSTOM1_F32: ggml_op = 64; +pub const ggml_op_GGML_OP_MAP_CUSTOM2_F32: ggml_op = 65; +pub const ggml_op_GGML_OP_MAP_CUSTOM3_F32: ggml_op = 66; +pub const ggml_op_GGML_OP_MAP_CUSTOM1: ggml_op = 67; +pub const ggml_op_GGML_OP_MAP_CUSTOM2: ggml_op = 68; +pub const ggml_op_GGML_OP_MAP_CUSTOM3: ggml_op = 69; +pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS: ggml_op = 70; +pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS_BACK: ggml_op = 71; +pub const ggml_op_GGML_OP_COUNT: ggml_op = 72; pub type ggml_op = ::std::os::raw::c_uint; pub const ggml_unary_op_GGML_UNARY_OP_ABS: ggml_unary_op = 0; pub const ggml_unary_op_GGML_UNARY_OP_SGN: ggml_unary_op = 1; @@ -412,7 +811,7 @@ pub const ggml_unary_op_GGML_UNARY_OP_RELU: ggml_unary_op = 6; pub const ggml_unary_op_GGML_UNARY_OP_GELU: ggml_unary_op = 7; pub const ggml_unary_op_GGML_UNARY_OP_GELU_QUICK: ggml_unary_op = 8; pub const ggml_unary_op_GGML_UNARY_OP_SILU: ggml_unary_op = 9; -pub const ggml_unary_op_GGML_UNARY_OP_LEAKY: ggml_unary_op = 10; +pub const ggml_unary_op_GGML_UNARY_OP_COUNT: ggml_unary_op = 10; pub type ggml_unary_op = ::std::os::raw::c_uint; pub const ggml_object_type_GGML_OBJECT_TENSOR: ggml_object_type = 0; pub const ggml_object_type_GGML_OBJECT_GRAPH: ggml_object_type = 1; @@ -421,6 +820,7 @@ pub type ggml_object_type = ::std::os::raw::c_uint; pub const ggml_log_level_GGML_LOG_LEVEL_ERROR: ggml_log_level = 2; pub const ggml_log_level_GGML_LOG_LEVEL_WARN: ggml_log_level = 3; pub const ggml_log_level_GGML_LOG_LEVEL_INFO: ggml_log_level = 4; +pub const ggml_log_level_GGML_LOG_LEVEL_DEBUG: ggml_log_level = 5; pub type ggml_log_level = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -449,50 +849,50 @@ fn bindgen_test_layout_ggml_object() { unsafe { ::std::ptr::addr_of!((*ptr).offs) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(ggml_object), - "::", - stringify!(offs) + "Offset of field: ", + stringify!(ggml_object), + "::", + stringify!(offs) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(ggml_object), - "::", - stringify!(size) + "Offset of field: ", + stringify!(ggml_object), + "::", + stringify!(size) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).next) as usize - ptr as usize }, 16usize, concat!( - "Offset of field: ", - stringify!(ggml_object), - "::", - stringify!(next) + "Offset of field: ", + stringify!(ggml_object), + "::", + stringify!(next) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, 24usize, concat!( - "Offset of field: ", - stringify!(ggml_object), - "::", - stringify!(type_) + "Offset of field: ", + stringify!(ggml_object), + "::", + stringify!(type_) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).padding) as usize - ptr as usize }, 28usize, concat!( - "Offset of field: ", - stringify!(ggml_object), - "::", - stringify!(padding) + "Offset of field: ", + stringify!(ggml_object), + "::", + stringify!(padding) ) ); } @@ -503,14 +903,13 @@ pub struct ggml_tensor { pub type_: ggml_type, pub backend: ggml_backend_type, pub buffer: *mut ggml_backend_buffer, - pub n_dims: ::std::os::raw::c_int, pub ne: [i64; 4usize], pub nb: [usize; 4usize], pub op: ggml_op, pub op_params: [i32; 16usize], pub is_param: bool, pub grad: *mut ggml_tensor, - pub src: [*mut ggml_tensor; 6usize], + pub src: [*mut ggml_tensor; 10usize], pub perf_runs: ::std::os::raw::c_int, pub perf_cycles: i64, pub perf_time_us: i64, @@ -519,7 +918,7 @@ pub struct ggml_tensor { pub data: *mut ::std::os::raw::c_void, pub name: [::std::os::raw::c_char; 64usize], pub extra: *mut ::std::os::raw::c_void, - pub padding: [::std::os::raw::c_char; 12usize], + pub padding: [::std::os::raw::c_char; 8usize], } #[test] fn bindgen_test_layout_ggml_tensor() { @@ -527,7 +926,7 @@ fn bindgen_test_layout_ggml_tensor() { let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 352usize, + 368usize, concat!("Size of: ", stringify!(ggml_tensor)) ); assert_eq!( @@ -539,204 +938,194 @@ fn bindgen_test_layout_ggml_tensor() { unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(type_) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(type_) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).backend) as usize - ptr as usize }, 4usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(backend) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(backend) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).buffer) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(buffer) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).n_dims) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(n_dims) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(buffer) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).ne) as usize - ptr as usize }, - 24usize, + 16usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(ne) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(ne) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).nb) as usize - ptr as usize }, - 56usize, + 48usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(nb) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(nb) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).op) as usize - ptr as usize }, - 88usize, + 80usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(op) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(op) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).op_params) as usize - ptr as usize }, - 92usize, + 84usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(op_params) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(op_params) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).is_param) as usize - ptr as usize }, - 156usize, + 148usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(is_param) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(is_param) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).grad) as usize - ptr as usize }, - 160usize, + 152usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(grad) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(grad) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).src) as usize - ptr as usize }, - 168usize, + 160usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(src) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(src) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).perf_runs) as usize - ptr as usize }, - 216usize, + 240usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(perf_runs) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(perf_runs) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).perf_cycles) as usize - ptr as usize }, - 224usize, + 248usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(perf_cycles) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(perf_cycles) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).perf_time_us) as usize - ptr as usize }, - 232usize, + 256usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(perf_time_us) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(perf_time_us) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).view_src) as usize - ptr as usize }, - 240usize, + 264usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(view_src) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(view_src) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).view_offs) as usize - ptr as usize }, - 248usize, + 272usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(view_offs) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(view_offs) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, - 256usize, + 280usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(data) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(data) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, - 264usize, + 288usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(name) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(name) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).extra) as usize - ptr as usize }, - 328usize, + 352usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(extra) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(extra) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).padding) as usize - ptr as usize }, - 336usize, + 360usize, concat!( - "Offset of field: ", - stringify!(ggml_tensor), - "::", - stringify!(padding) + "Offset of field: ", + stringify!(ggml_tensor), + "::", + stringify!(padding) ) ); } -pub const GGML_TENSOR_SIZE: usize = 352; +pub const GGML_TENSOR_SIZE: usize = 368; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ggml_cplan { @@ -744,7 +1133,7 @@ pub struct ggml_cplan { pub work_data: *mut u8, pub n_threads: ::std::os::raw::c_int, pub abort_callback: - ::std::option::Option bool>, + ::std::option::Option bool>, pub abort_callback_data: *mut ::std::os::raw::c_void, } #[test] @@ -765,50 +1154,50 @@ fn bindgen_test_layout_ggml_cplan() { unsafe { ::std::ptr::addr_of!((*ptr).work_size) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(ggml_cplan), - "::", - stringify!(work_size) + "Offset of field: ", + stringify!(ggml_cplan), + "::", + stringify!(work_size) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).work_data) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(ggml_cplan), - "::", - stringify!(work_data) + "Offset of field: ", + stringify!(ggml_cplan), + "::", + stringify!(work_data) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).n_threads) as usize - ptr as usize }, 16usize, concat!( - "Offset of field: ", - stringify!(ggml_cplan), - "::", - stringify!(n_threads) + "Offset of field: ", + stringify!(ggml_cplan), + "::", + stringify!(n_threads) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).abort_callback) as usize - ptr as usize }, 24usize, concat!( - "Offset of field: ", - stringify!(ggml_cplan), - "::", - stringify!(abort_callback) + "Offset of field: ", + stringify!(ggml_cplan), + "::", + stringify!(abort_callback) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).abort_callback_data) as usize - ptr as usize }, 32usize, concat!( - "Offset of field: ", - stringify!(ggml_cplan), - "::", - stringify!(abort_callback_data) + "Offset of field: ", + stringify!(ggml_cplan), + "::", + stringify!(abort_callback_data) ) ); } @@ -840,20 +1229,20 @@ fn bindgen_test_layout_ggml_hash_set() { unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(ggml_hash_set), - "::", - stringify!(size) + "Offset of field: ", + stringify!(ggml_hash_set), + "::", + stringify!(size) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).keys) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(ggml_hash_set), - "::", - stringify!(keys) + "Offset of field: ", + stringify!(ggml_hash_set), + "::", + stringify!(keys) ) ); } @@ -890,110 +1279,110 @@ fn bindgen_test_layout_ggml_cgraph() { unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(ggml_cgraph), - "::", - stringify!(size) + "Offset of field: ", + stringify!(ggml_cgraph), + "::", + stringify!(size) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).n_nodes) as usize - ptr as usize }, 4usize, concat!( - "Offset of field: ", - stringify!(ggml_cgraph), - "::", - stringify!(n_nodes) + "Offset of field: ", + stringify!(ggml_cgraph), + "::", + stringify!(n_nodes) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).n_leafs) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(ggml_cgraph), - "::", - stringify!(n_leafs) + "Offset of field: ", + stringify!(ggml_cgraph), + "::", + stringify!(n_leafs) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).nodes) as usize - ptr as usize }, 16usize, concat!( - "Offset of field: ", - stringify!(ggml_cgraph), - "::", - stringify!(nodes) + "Offset of field: ", + stringify!(ggml_cgraph), + "::", + stringify!(nodes) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).grads) as usize - ptr as usize }, 24usize, concat!( - "Offset of field: ", - stringify!(ggml_cgraph), - "::", - stringify!(grads) + "Offset of field: ", + stringify!(ggml_cgraph), + "::", + stringify!(grads) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).leafs) as usize - ptr as usize }, 32usize, concat!( - "Offset of field: ", - stringify!(ggml_cgraph), - "::", - stringify!(leafs) + "Offset of field: ", + stringify!(ggml_cgraph), + "::", + stringify!(leafs) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).visited_hash_table) as usize - ptr as usize }, 40usize, concat!( - "Offset of field: ", - stringify!(ggml_cgraph), - "::", - stringify!(visited_hash_table) + "Offset of field: ", + stringify!(ggml_cgraph), + "::", + stringify!(visited_hash_table) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).order) as usize - ptr as usize }, 56usize, concat!( - "Offset of field: ", - stringify!(ggml_cgraph), - "::", - stringify!(order) + "Offset of field: ", + stringify!(ggml_cgraph), + "::", + stringify!(order) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).perf_runs) as usize - ptr as usize }, 60usize, concat!( - "Offset of field: ", - stringify!(ggml_cgraph), - "::", - stringify!(perf_runs) + "Offset of field: ", + stringify!(ggml_cgraph), + "::", + stringify!(perf_runs) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).perf_cycles) as usize - ptr as usize }, 64usize, concat!( - "Offset of field: ", - stringify!(ggml_cgraph), - "::", - stringify!(perf_cycles) + "Offset of field: ", + stringify!(ggml_cgraph), + "::", + stringify!(perf_cycles) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).perf_time_us) as usize - ptr as usize }, 72usize, concat!( - "Offset of field: ", - stringify!(ggml_cgraph), - "::", - stringify!(perf_time_us) + "Offset of field: ", + stringify!(ggml_cgraph), + "::", + stringify!(perf_time_us) ) ); } @@ -1022,30 +1411,30 @@ fn bindgen_test_layout_ggml_scratch() { unsafe { ::std::ptr::addr_of!((*ptr).offs) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(ggml_scratch), - "::", - stringify!(offs) + "Offset of field: ", + stringify!(ggml_scratch), + "::", + stringify!(offs) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(ggml_scratch), - "::", - stringify!(size) + "Offset of field: ", + stringify!(ggml_scratch), + "::", + stringify!(size) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, 16usize, concat!( - "Offset of field: ", - stringify!(ggml_scratch), - "::", - stringify!(data) + "Offset of field: ", + stringify!(ggml_scratch), + "::", + stringify!(data) ) ); } @@ -1074,30 +1463,30 @@ fn bindgen_test_layout_ggml_init_params() { unsafe { ::std::ptr::addr_of!((*ptr).mem_size) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(ggml_init_params), - "::", - stringify!(mem_size) + "Offset of field: ", + stringify!(ggml_init_params), + "::", + stringify!(mem_size) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).mem_buffer) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(ggml_init_params), - "::", - stringify!(mem_buffer) + "Offset of field: ", + stringify!(ggml_init_params), + "::", + stringify!(mem_buffer) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).no_alloc) as usize - ptr as usize }, 16usize, concat!( - "Offset of field: ", - stringify!(ggml_init_params), - "::", - stringify!(no_alloc) + "Offset of field: ", + stringify!(ggml_init_params), + "::", + stringify!(no_alloc) ) ); } @@ -1132,50 +1521,50 @@ fn bindgen_test_layout_ggml_compute_params() { unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(ggml_compute_params), - "::", - stringify!(type_) + "Offset of field: ", + stringify!(ggml_compute_params), + "::", + stringify!(type_) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).ith) as usize - ptr as usize }, 4usize, concat!( - "Offset of field: ", - stringify!(ggml_compute_params), - "::", - stringify!(ith) + "Offset of field: ", + stringify!(ggml_compute_params), + "::", + stringify!(ith) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).nth) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(ggml_compute_params), - "::", - stringify!(nth) + "Offset of field: ", + stringify!(ggml_compute_params), + "::", + stringify!(nth) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).wsize) as usize - ptr as usize }, 16usize, concat!( - "Offset of field: ", - stringify!(ggml_compute_params), - "::", - stringify!(wsize) + "Offset of field: ", + stringify!(ggml_compute_params), + "::", + stringify!(wsize) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).wdata) as usize - ptr as usize }, 24usize, concat!( - "Offset of field: ", - stringify!(ggml_compute_params), - "::", - stringify!(wdata) + "Offset of field: ", + stringify!(ggml_compute_params), + "::", + stringify!(wdata) ) ); } @@ -1221,12 +1610,6 @@ extern "C" { extern "C" { pub fn ggml_nbytes_pad(tensor: *const ggml_tensor) -> usize; } -extern "C" { - pub fn ggml_nbytes_split( - tensor: *const ggml_tensor, - nrows_split: ::std::os::raw::c_int, - ) -> usize; -} extern "C" { pub fn ggml_blck_size(type_: ggml_type) -> ::std::os::raw::c_int; } @@ -1234,7 +1617,10 @@ extern "C" { pub fn ggml_type_size(type_: ggml_type) -> usize; } extern "C" { - pub fn ggml_type_sizef(type_: ggml_type) -> f32; + pub fn ggml_row_size(type_: ggml_type, ne: i64) -> usize; +} +extern "C" { + pub fn ggml_type_sizef(type_: ggml_type) -> f64; } extern "C" { pub fn ggml_type_name(type_: ggml_type) -> *const ::std::os::raw::c_char; @@ -1245,6 +1631,12 @@ extern "C" { extern "C" { pub fn ggml_op_symbol(op: ggml_op) -> *const ::std::os::raw::c_char; } +extern "C" { + pub fn ggml_unary_op_name(op: ggml_unary_op) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn ggml_op_desc(t: *const ggml_tensor) -> *const ::std::os::raw::c_char; +} extern "C" { pub fn ggml_element_size(tensor: *const ggml_tensor) -> usize; } @@ -1263,6 +1655,21 @@ extern "C" { extern "C" { pub fn ggml_is_permuted(tensor: *const ggml_tensor) -> bool; } +extern "C" { + pub fn ggml_is_scalar(tensor: *const ggml_tensor) -> bool; +} +extern "C" { + pub fn ggml_is_vector(tensor: *const ggml_tensor) -> bool; +} +extern "C" { + pub fn ggml_is_matrix(tensor: *const ggml_tensor) -> bool; +} +extern "C" { + pub fn ggml_is_3d(tensor: *const ggml_tensor) -> bool; +} +extern "C" { + pub fn ggml_n_dims(tensor: *const ggml_tensor) -> ::std::os::raw::c_int; +} extern "C" { pub fn ggml_are_same_shape(t0: *const ggml_tensor, t1: *const ggml_tensor) -> bool; } @@ -1351,11 +1758,11 @@ extern "C" { pub fn ggml_view_tensor(ctx: *mut ggml_context, src: *mut ggml_tensor) -> *mut ggml_tensor; } extern "C" { - pub fn ggml_get_first_tensor(ctx: *mut ggml_context) -> *mut ggml_tensor; + pub fn ggml_get_first_tensor(ctx: *const ggml_context) -> *mut ggml_tensor; } extern "C" { pub fn ggml_get_next_tensor( - ctx: *mut ggml_context, + ctx: *const ggml_context, tensor: *mut ggml_tensor, ) -> *mut ggml_tensor; } @@ -1656,7 +2063,12 @@ extern "C" { pub fn ggml_relu(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } extern "C" { - pub fn ggml_leaky(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; + pub fn ggml_leaky_relu( + ctx: *mut ggml_context, + a: *mut ggml_tensor, + negative_slope: f32, + inplace: bool, + ) -> *mut ggml_tensor; } extern "C" { pub fn ggml_relu_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; @@ -1672,7 +2084,7 @@ extern "C" { } extern "C" { pub fn ggml_gelu_quick_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) - -> *mut ggml_tensor; + -> *mut ggml_tensor; } extern "C" { pub fn ggml_silu(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; @@ -1699,7 +2111,7 @@ extern "C" { } extern "C" { pub fn ggml_rms_norm(ctx: *mut ggml_context, a: *mut ggml_tensor, eps: f32) - -> *mut ggml_tensor; + -> *mut ggml_tensor; } extern "C" { pub fn ggml_rms_norm_inplace( @@ -1737,6 +2149,19 @@ extern "C" { b: *mut ggml_tensor, ) -> *mut ggml_tensor; } +extern "C" { + pub fn ggml_mul_mat_set_prec(a: *mut ggml_tensor, prec: ggml_prec); +} +extern "C" { + pub fn ggml_mul_mat_id( + ctx: *mut ggml_context, + as_: *const *mut ggml_tensor, + n_as: ::std::os::raw::c_int, + ids: *mut ggml_tensor, + id: ::std::os::raw::c_int, + b: *mut ggml_tensor, + ) -> *mut ggml_tensor; +} extern "C" { pub fn ggml_out_prod( ctx: *mut ggml_context, @@ -1745,17 +2170,13 @@ extern "C" { ) -> *mut ggml_tensor; } extern "C" { - pub fn ggml_scale( - ctx: *mut ggml_context, - a: *mut ggml_tensor, - b: *mut ggml_tensor, - ) -> *mut ggml_tensor; + pub fn ggml_scale(ctx: *mut ggml_context, a: *mut ggml_tensor, s: f32) -> *mut ggml_tensor; } extern "C" { pub fn ggml_scale_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, - b: *mut ggml_tensor, + s: f32, ) -> *mut ggml_tensor; } extern "C" { @@ -2014,6 +2435,14 @@ extern "C" { extern "C" { pub fn ggml_soft_max_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } +extern "C" { + pub fn ggml_soft_max_ext( + ctx: *mut ggml_context, + a: *mut ggml_tensor, + mask: *mut ggml_tensor, + scale: f32, + ) -> *mut ggml_tensor; +} extern "C" { pub fn ggml_soft_max_back( ctx: *mut ggml_context, @@ -2110,8 +2539,13 @@ extern "C" { n_dims: ::std::os::raw::c_int, mode: ::std::os::raw::c_int, n_ctx: ::std::os::raw::c_int, + n_orig_ctx: ::std::os::raw::c_int, freq_base: f32, freq_scale: f32, + ext_factor: f32, + attn_factor: f32, + beta_fast: f32, + beta_slow: f32, xpos_base: f32, xpos_down: bool, ) -> *mut ggml_tensor; @@ -2245,6 +2679,33 @@ extern "C" { scale_factor: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } +extern "C" { + pub fn ggml_pad( + ctx: *mut ggml_context, + a: *mut ggml_tensor, + p0: ::std::os::raw::c_int, + p1: ::std::os::raw::c_int, + p2: ::std::os::raw::c_int, + p3: ::std::os::raw::c_int, + ) -> *mut ggml_tensor; +} +pub const ggml_sort_order_GGML_SORT_ASC: ggml_sort_order = 0; +pub const ggml_sort_order_GGML_SORT_DESC: ggml_sort_order = 1; +pub type ggml_sort_order = ::std::os::raw::c_uint; +extern "C" { + pub fn ggml_argsort( + ctx: *mut ggml_context, + a: *mut ggml_tensor, + order: ggml_sort_order, + ) -> *mut ggml_tensor; +} +extern "C" { + pub fn ggml_top_k( + ctx: *mut ggml_context, + a: *mut ggml_tensor, + k: ::std::os::raw::c_int, + ) -> *mut ggml_tensor; +} extern "C" { pub fn ggml_flash_attn( ctx: *mut ggml_context, @@ -2340,7 +2801,7 @@ pub type ggml_binary_op_f32_t = ::std::option::Option< ), >; pub type ggml_custom1_op_f32_t = - ::std::option::Option; +::std::option::Option; pub type ggml_custom2_op_f32_t = ::std::option::Option< unsafe extern "C" fn( arg1: *mut ggml_tensor, @@ -2568,11 +3029,10 @@ extern "C" { } extern "C" { pub fn ggml_graph_view( - ctx: *mut ggml_context, cgraph: *mut ggml_cgraph, i0: ::std::os::raw::c_int, i1: ::std::os::raw::c_int, - ) -> *mut ggml_cgraph; + ) -> ggml_cgraph; } extern "C" { pub fn ggml_graph_cpy(src: *mut ggml_cgraph, dst: *mut ggml_cgraph); @@ -2728,110 +3188,110 @@ fn bindgen_test_layout_ggml_opt_params__bindgen_ty_1() { unsafe { ::std::ptr::addr_of!((*ptr).n_iter) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_1), - "::", - stringify!(n_iter) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_1), + "::", + stringify!(n_iter) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).sched) as usize - ptr as usize }, 4usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_1), - "::", - stringify!(sched) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_1), + "::", + stringify!(sched) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).decay) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_1), - "::", - stringify!(decay) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_1), + "::", + stringify!(decay) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).decay_min_ndim) as usize - ptr as usize }, 12usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_1), - "::", - stringify!(decay_min_ndim) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_1), + "::", + stringify!(decay_min_ndim) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).alpha) as usize - ptr as usize }, 16usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_1), - "::", - stringify!(alpha) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_1), + "::", + stringify!(alpha) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).beta1) as usize - ptr as usize }, 20usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_1), - "::", - stringify!(beta1) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_1), + "::", + stringify!(beta1) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).beta2) as usize - ptr as usize }, 24usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_1), - "::", - stringify!(beta2) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_1), + "::", + stringify!(beta2) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).eps) as usize - ptr as usize }, 28usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_1), - "::", - stringify!(eps) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_1), + "::", + stringify!(eps) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).eps_f) as usize - ptr as usize }, 32usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_1), - "::", - stringify!(eps_f) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_1), + "::", + stringify!(eps_f) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).eps_g) as usize - ptr as usize }, 36usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_1), - "::", - stringify!(eps_g) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_1), + "::", + stringify!(eps_g) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).gclip) as usize - ptr as usize }, 40usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_1), - "::", - stringify!(gclip) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_1), + "::", + stringify!(gclip) ) ); } @@ -2867,90 +3327,90 @@ fn bindgen_test_layout_ggml_opt_params__bindgen_ty_2() { unsafe { ::std::ptr::addr_of!((*ptr).m) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_2), - "::", - stringify!(m) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_2), + "::", + stringify!(m) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).n_iter) as usize - ptr as usize }, 4usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_2), - "::", - stringify!(n_iter) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_2), + "::", + stringify!(n_iter) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).max_linesearch) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_2), - "::", - stringify!(max_linesearch) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_2), + "::", + stringify!(max_linesearch) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).eps) as usize - ptr as usize }, 12usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_2), - "::", - stringify!(eps) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_2), + "::", + stringify!(eps) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).ftol) as usize - ptr as usize }, 16usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_2), - "::", - stringify!(ftol) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_2), + "::", + stringify!(ftol) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).wolfe) as usize - ptr as usize }, 20usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_2), - "::", - stringify!(wolfe) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_2), + "::", + stringify!(wolfe) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).min_step) as usize - ptr as usize }, 24usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_2), - "::", - stringify!(min_step) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_2), + "::", + stringify!(min_step) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).max_step) as usize - ptr as usize }, 28usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_2), - "::", - stringify!(max_step) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_2), + "::", + stringify!(max_step) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).linesearch) as usize - ptr as usize }, 32usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params__bindgen_ty_2), - "::", - stringify!(linesearch) + "Offset of field: ", + stringify!(ggml_opt_params__bindgen_ty_2), + "::", + stringify!(linesearch) ) ); } @@ -2972,110 +3432,110 @@ fn bindgen_test_layout_ggml_opt_params() { unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params), - "::", - stringify!(type_) + "Offset of field: ", + stringify!(ggml_opt_params), + "::", + stringify!(type_) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).graph_size) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params), - "::", - stringify!(graph_size) + "Offset of field: ", + stringify!(ggml_opt_params), + "::", + stringify!(graph_size) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).n_threads) as usize - ptr as usize }, 16usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params), - "::", - stringify!(n_threads) + "Offset of field: ", + stringify!(ggml_opt_params), + "::", + stringify!(n_threads) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).past) as usize - ptr as usize }, 20usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params), - "::", - stringify!(past) + "Offset of field: ", + stringify!(ggml_opt_params), + "::", + stringify!(past) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).delta) as usize - ptr as usize }, 24usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params), - "::", - stringify!(delta) + "Offset of field: ", + stringify!(ggml_opt_params), + "::", + stringify!(delta) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).max_no_improvement) as usize - ptr as usize }, 28usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params), - "::", - stringify!(max_no_improvement) + "Offset of field: ", + stringify!(ggml_opt_params), + "::", + stringify!(max_no_improvement) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).print_forward_graph) as usize - ptr as usize }, 32usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params), - "::", - stringify!(print_forward_graph) + "Offset of field: ", + stringify!(ggml_opt_params), + "::", + stringify!(print_forward_graph) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).print_backward_graph) as usize - ptr as usize }, 33usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params), - "::", - stringify!(print_backward_graph) + "Offset of field: ", + stringify!(ggml_opt_params), + "::", + stringify!(print_backward_graph) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).n_gradient_accumulation) as usize - ptr as usize }, 36usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params), - "::", - stringify!(n_gradient_accumulation) + "Offset of field: ", + stringify!(ggml_opt_params), + "::", + stringify!(n_gradient_accumulation) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).adam) as usize - ptr as usize }, 40usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params), - "::", - stringify!(adam) + "Offset of field: ", + stringify!(ggml_opt_params), + "::", + stringify!(adam) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).lbfgs) as usize - ptr as usize }, 84usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_params), - "::", - stringify!(lbfgs) + "Offset of field: ", + stringify!(ggml_opt_params), + "::", + stringify!(lbfgs) ) ); } @@ -3122,70 +3582,70 @@ fn bindgen_test_layout_ggml_opt_context__bindgen_ty_1() { unsafe { ::std::ptr::addr_of!((*ptr).g) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_1), - "::", - stringify!(g) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_1), + "::", + stringify!(g) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).m) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_1), - "::", - stringify!(m) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_1), + "::", + stringify!(m) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).v) as usize - ptr as usize }, 16usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_1), - "::", - stringify!(v) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_1), + "::", + stringify!(v) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).pf) as usize - ptr as usize }, 24usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_1), - "::", - stringify!(pf) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_1), + "::", + stringify!(pf) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).fx_best) as usize - ptr as usize }, 32usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_1), - "::", - stringify!(fx_best) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_1), + "::", + stringify!(fx_best) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).fx_prev) as usize - ptr as usize }, 36usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_1), - "::", - stringify!(fx_prev) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_1), + "::", + stringify!(fx_prev) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).n_no_improvement) as usize - ptr as usize }, 40usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_1), - "::", - stringify!(n_no_improvement) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_1), + "::", + stringify!(n_no_improvement) ) ); } @@ -3228,160 +3688,160 @@ fn bindgen_test_layout_ggml_opt_context__bindgen_ty_2() { unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_2), - "::", - stringify!(x) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_2), + "::", + stringify!(x) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).xp) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_2), - "::", - stringify!(xp) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_2), + "::", + stringify!(xp) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).g) as usize - ptr as usize }, 16usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_2), - "::", - stringify!(g) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_2), + "::", + stringify!(g) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).gp) as usize - ptr as usize }, 24usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_2), - "::", - stringify!(gp) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_2), + "::", + stringify!(gp) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 32usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_2), - "::", - stringify!(d) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_2), + "::", + stringify!(d) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).pf) as usize - ptr as usize }, 40usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_2), - "::", - stringify!(pf) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_2), + "::", + stringify!(pf) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).lmal) as usize - ptr as usize }, 48usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_2), - "::", - stringify!(lmal) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_2), + "::", + stringify!(lmal) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).lmys) as usize - ptr as usize }, 56usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_2), - "::", - stringify!(lmys) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_2), + "::", + stringify!(lmys) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).lms) as usize - ptr as usize }, 64usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_2), - "::", - stringify!(lms) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_2), + "::", + stringify!(lms) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).lmy) as usize - ptr as usize }, 72usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_2), - "::", - stringify!(lmy) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_2), + "::", + stringify!(lmy) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).fx_best) as usize - ptr as usize }, 80usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_2), - "::", - stringify!(fx_best) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_2), + "::", + stringify!(fx_best) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).step) as usize - ptr as usize }, 84usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_2), - "::", - stringify!(step) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_2), + "::", + stringify!(step) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).j) as usize - ptr as usize }, 88usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_2), - "::", - stringify!(j) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_2), + "::", + stringify!(j) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).k) as usize - ptr as usize }, 92usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_2), - "::", - stringify!(k) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_2), + "::", + stringify!(k) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize }, 96usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_2), - "::", - stringify!(end) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_2), + "::", + stringify!(end) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).n_no_improvement) as usize - ptr as usize }, 100usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context__bindgen_ty_2), - "::", - stringify!(n_no_improvement) + "Offset of field: ", + stringify!(ggml_opt_context__bindgen_ty_2), + "::", + stringify!(n_no_improvement) ) ); } @@ -3403,90 +3863,90 @@ fn bindgen_test_layout_ggml_opt_context() { unsafe { ::std::ptr::addr_of!((*ptr).ctx) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context), - "::", - stringify!(ctx) + "Offset of field: ", + stringify!(ggml_opt_context), + "::", + stringify!(ctx) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).params) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context), - "::", - stringify!(params) + "Offset of field: ", + stringify!(ggml_opt_context), + "::", + stringify!(params) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).iter) as usize - ptr as usize }, 128usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context), - "::", - stringify!(iter) + "Offset of field: ", + stringify!(ggml_opt_context), + "::", + stringify!(iter) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).nx) as usize - ptr as usize }, 136usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context), - "::", - stringify!(nx) + "Offset of field: ", + stringify!(ggml_opt_context), + "::", + stringify!(nx) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).just_initialized) as usize - ptr as usize }, 144usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context), - "::", - stringify!(just_initialized) + "Offset of field: ", + stringify!(ggml_opt_context), + "::", + stringify!(just_initialized) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).loss_before) as usize - ptr as usize }, 148usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context), - "::", - stringify!(loss_before) + "Offset of field: ", + stringify!(ggml_opt_context), + "::", + stringify!(loss_before) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).loss_after) as usize - ptr as usize }, 152usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context), - "::", - stringify!(loss_after) + "Offset of field: ", + stringify!(ggml_opt_context), + "::", + stringify!(loss_after) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).adam) as usize - ptr as usize }, 160usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context), - "::", - stringify!(adam) + "Offset of field: ", + stringify!(ggml_opt_context), + "::", + stringify!(adam) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).lbfgs) as usize - ptr as usize }, 208usize, concat!( - "Offset of field: ", - stringify!(ggml_opt_context), - "::", - stringify!(lbfgs) + "Offset of field: ", + stringify!(ggml_opt_context), + "::", + stringify!(lbfgs) ) ); } @@ -3670,20 +4130,20 @@ fn bindgen_test_layout_gguf_init_params() { unsafe { ::std::ptr::addr_of!((*ptr).no_alloc) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(gguf_init_params), - "::", - stringify!(no_alloc) + "Offset of field: ", + stringify!(gguf_init_params), + "::", + stringify!(no_alloc) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).ctx) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(gguf_init_params), - "::", - stringify!(ctx) + "Offset of field: ", + stringify!(gguf_init_params), + "::", + stringify!(ctx) ) ); } @@ -3774,6 +4234,12 @@ extern "C" { key_id: ::std::os::raw::c_int, ) -> *const ::std::os::raw::c_char; } +extern "C" { + pub fn gguf_get_val_data( + ctx: *const gguf_context, + key_id: ::std::os::raw::c_int, + ) -> *const ::std::os::raw::c_void; +} extern "C" { pub fn gguf_get_arr_n( ctx: *const gguf_context, @@ -3811,6 +4277,9 @@ extern "C" { i: ::std::os::raw::c_int, ) -> *mut ::std::os::raw::c_char; } +extern "C" { + pub fn gguf_get_tensor_type(ctx: *const gguf_context, i: ::std::os::raw::c_int) -> ggml_type; +} extern "C" { pub fn gguf_set_val_u8(ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, val: u8); } @@ -3905,6 +4374,9 @@ extern "C" { extern "C" { pub fn ggml_cpu_has_avx() -> ::std::os::raw::c_int; } +extern "C" { + pub fn ggml_cpu_has_avx_vnni() -> ::std::os::raw::c_int; +} extern "C" { pub fn ggml_cpu_has_avx2() -> ::std::os::raw::c_int; } @@ -4004,90 +4476,90 @@ fn bindgen_test_layout_ggml_type_traits_t() { unsafe { ::std::ptr::addr_of!((*ptr).type_name) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(ggml_type_traits_t), - "::", - stringify!(type_name) + "Offset of field: ", + stringify!(ggml_type_traits_t), + "::", + stringify!(type_name) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).blck_size) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(ggml_type_traits_t), - "::", - stringify!(blck_size) + "Offset of field: ", + stringify!(ggml_type_traits_t), + "::", + stringify!(blck_size) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).type_size) as usize - ptr as usize }, 16usize, concat!( - "Offset of field: ", - stringify!(ggml_type_traits_t), - "::", - stringify!(type_size) + "Offset of field: ", + stringify!(ggml_type_traits_t), + "::", + stringify!(type_size) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).is_quantized) as usize - ptr as usize }, 24usize, concat!( - "Offset of field: ", - stringify!(ggml_type_traits_t), - "::", - stringify!(is_quantized) + "Offset of field: ", + stringify!(ggml_type_traits_t), + "::", + stringify!(is_quantized) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).to_float) as usize - ptr as usize }, 32usize, concat!( - "Offset of field: ", - stringify!(ggml_type_traits_t), - "::", - stringify!(to_float) + "Offset of field: ", + stringify!(ggml_type_traits_t), + "::", + stringify!(to_float) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).from_float) as usize - ptr as usize }, 40usize, concat!( - "Offset of field: ", - stringify!(ggml_type_traits_t), - "::", - stringify!(from_float) + "Offset of field: ", + stringify!(ggml_type_traits_t), + "::", + stringify!(from_float) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).from_float_reference) as usize - ptr as usize }, 48usize, concat!( - "Offset of field: ", - stringify!(ggml_type_traits_t), - "::", - stringify!(from_float_reference) + "Offset of field: ", + stringify!(ggml_type_traits_t), + "::", + stringify!(from_float_reference) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).vec_dot) as usize - ptr as usize }, 56usize, concat!( - "Offset of field: ", - stringify!(ggml_type_traits_t), - "::", - stringify!(vec_dot) + "Offset of field: ", + stringify!(ggml_type_traits_t), + "::", + stringify!(vec_dot) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).vec_dot_type) as usize - ptr as usize }, 64usize, concat!( - "Offset of field: ", - stringify!(ggml_type_traits_t), - "::", - stringify!(vec_dot_type) + "Offset of field: ", + stringify!(ggml_type_traits_t), + "::", + stringify!(vec_dot_type) ) ); } @@ -4131,10 +4603,10 @@ fn bindgen_test_layout_whisper_context_params() { unsafe { ::std::ptr::addr_of!((*ptr).use_gpu) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(whisper_context_params), - "::", - stringify!(use_gpu) + "Offset of field: ", + stringify!(whisper_context_params), + "::", + stringify!(use_gpu) ) ); } @@ -4169,90 +4641,90 @@ fn bindgen_test_layout_whisper_token_data() { unsafe { ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(whisper_token_data), - "::", - stringify!(id) + "Offset of field: ", + stringify!(whisper_token_data), + "::", + stringify!(id) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).tid) as usize - ptr as usize }, 4usize, concat!( - "Offset of field: ", - stringify!(whisper_token_data), - "::", - stringify!(tid) + "Offset of field: ", + stringify!(whisper_token_data), + "::", + stringify!(tid) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).p) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(whisper_token_data), - "::", - stringify!(p) + "Offset of field: ", + stringify!(whisper_token_data), + "::", + stringify!(p) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).plog) as usize - ptr as usize }, 12usize, concat!( - "Offset of field: ", - stringify!(whisper_token_data), - "::", - stringify!(plog) + "Offset of field: ", + stringify!(whisper_token_data), + "::", + stringify!(plog) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).pt) as usize - ptr as usize }, 16usize, concat!( - "Offset of field: ", - stringify!(whisper_token_data), - "::", - stringify!(pt) + "Offset of field: ", + stringify!(whisper_token_data), + "::", + stringify!(pt) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).ptsum) as usize - ptr as usize }, 20usize, concat!( - "Offset of field: ", - stringify!(whisper_token_data), - "::", - stringify!(ptsum) + "Offset of field: ", + stringify!(whisper_token_data), + "::", + stringify!(ptsum) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).t0) as usize - ptr as usize }, 24usize, concat!( - "Offset of field: ", - stringify!(whisper_token_data), - "::", - stringify!(t0) + "Offset of field: ", + stringify!(whisper_token_data), + "::", + stringify!(t0) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).t1) as usize - ptr as usize }, 32usize, concat!( - "Offset of field: ", - stringify!(whisper_token_data), - "::", - stringify!(t1) + "Offset of field: ", + stringify!(whisper_token_data), + "::", + stringify!(t1) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).vlen) as usize - ptr as usize }, 40usize, concat!( - "Offset of field: ", - stringify!(whisper_token_data), - "::", - stringify!(vlen) + "Offset of field: ", + stringify!(whisper_token_data), + "::", + stringify!(vlen) ) ); } @@ -4288,40 +4760,40 @@ fn bindgen_test_layout_whisper_model_loader() { unsafe { ::std::ptr::addr_of!((*ptr).context) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(whisper_model_loader), - "::", - stringify!(context) + "Offset of field: ", + stringify!(whisper_model_loader), + "::", + stringify!(context) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).read) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(whisper_model_loader), - "::", - stringify!(read) + "Offset of field: ", + stringify!(whisper_model_loader), + "::", + stringify!(read) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).eof) as usize - ptr as usize }, 16usize, concat!( - "Offset of field: ", - stringify!(whisper_model_loader), - "::", - stringify!(eof) + "Offset of field: ", + stringify!(whisper_model_loader), + "::", + stringify!(eof) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).close) as usize - ptr as usize }, 24usize, concat!( - "Offset of field: ", - stringify!(whisper_model_loader), - "::", - stringify!(close) + "Offset of field: ", + stringify!(whisper_model_loader), + "::", + stringify!(close) ) ); } @@ -4358,20 +4830,20 @@ fn bindgen_test_layout_whisper_grammar_element() { unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(whisper_grammar_element), - "::", - stringify!(type_) + "Offset of field: ", + stringify!(whisper_grammar_element), + "::", + stringify!(type_) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).value) as usize - ptr as usize }, 4usize, concat!( - "Offset of field: ", - stringify!(whisper_grammar_element), - "::", - stringify!(value) + "Offset of field: ", + stringify!(whisper_grammar_element), + "::", + stringify!(value) ) ); } @@ -4566,6 +5038,9 @@ extern "C" { extern "C" { pub fn whisper_lang_str(id: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char; } +extern "C" { + pub fn whisper_lang_str_full(id: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char; +} extern "C" { pub fn whisper_lang_auto_detect( ctx: *mut whisper_context, @@ -4721,7 +5196,7 @@ pub type whisper_encoder_begin_callback = ::std::option::Option< ) -> bool, >; pub type whisper_abort_callback = - ::std::option::Option bool>; +::std::option::Option bool>; pub type whisper_logits_filter_callback = ::std::option::Option< unsafe extern "C" fn( ctx: *mut whisper_context, @@ -4808,18 +5283,18 @@ fn bindgen_test_layout_whisper_full_params__bindgen_ty_1() { ::std::mem::align_of::(), 4usize, concat!( - "Alignment of ", - stringify!(whisper_full_params__bindgen_ty_1) + "Alignment of ", + stringify!(whisper_full_params__bindgen_ty_1) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).best_of) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params__bindgen_ty_1), - "::", - stringify!(best_of) + "Offset of field: ", + stringify!(whisper_full_params__bindgen_ty_1), + "::", + stringify!(best_of) ) ); } @@ -4843,28 +5318,28 @@ fn bindgen_test_layout_whisper_full_params__bindgen_ty_2() { ::std::mem::align_of::(), 4usize, concat!( - "Alignment of ", - stringify!(whisper_full_params__bindgen_ty_2) + "Alignment of ", + stringify!(whisper_full_params__bindgen_ty_2) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).beam_size) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params__bindgen_ty_2), - "::", - stringify!(beam_size) + "Offset of field: ", + stringify!(whisper_full_params__bindgen_ty_2), + "::", + stringify!(beam_size) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).patience) as usize - ptr as usize }, 4usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params__bindgen_ty_2), - "::", - stringify!(patience) + "Offset of field: ", + stringify!(whisper_full_params__bindgen_ty_2), + "::", + stringify!(patience) ) ); } @@ -4886,400 +5361,400 @@ fn bindgen_test_layout_whisper_full_params() { unsafe { ::std::ptr::addr_of!((*ptr).strategy) as usize - ptr as usize }, 0usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(strategy) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(strategy) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).n_threads) as usize - ptr as usize }, 4usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(n_threads) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(n_threads) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).n_max_text_ctx) as usize - ptr as usize }, 8usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(n_max_text_ctx) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(n_max_text_ctx) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).offset_ms) as usize - ptr as usize }, 12usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(offset_ms) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(offset_ms) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).duration_ms) as usize - ptr as usize }, 16usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(duration_ms) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(duration_ms) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).translate) as usize - ptr as usize }, 20usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(translate) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(translate) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).no_context) as usize - ptr as usize }, 21usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(no_context) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(no_context) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).no_timestamps) as usize - ptr as usize }, 22usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(no_timestamps) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(no_timestamps) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).single_segment) as usize - ptr as usize }, 23usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(single_segment) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(single_segment) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).print_special) as usize - ptr as usize }, 24usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(print_special) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(print_special) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).print_progress) as usize - ptr as usize }, 25usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(print_progress) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(print_progress) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).print_realtime) as usize - ptr as usize }, 26usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(print_realtime) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(print_realtime) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).print_timestamps) as usize - ptr as usize }, 27usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(print_timestamps) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(print_timestamps) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).token_timestamps) as usize - ptr as usize }, 28usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(token_timestamps) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(token_timestamps) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).thold_pt) as usize - ptr as usize }, 32usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(thold_pt) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(thold_pt) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).thold_ptsum) as usize - ptr as usize }, 36usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(thold_ptsum) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(thold_ptsum) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).max_len) as usize - ptr as usize }, 40usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(max_len) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(max_len) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).split_on_word) as usize - ptr as usize }, 44usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(split_on_word) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(split_on_word) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).max_tokens) as usize - ptr as usize }, 48usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(max_tokens) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(max_tokens) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).speed_up) as usize - ptr as usize }, 52usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(speed_up) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(speed_up) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).debug_mode) as usize - ptr as usize }, 53usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(debug_mode) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(debug_mode) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).audio_ctx) as usize - ptr as usize }, 56usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(audio_ctx) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(audio_ctx) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).tdrz_enable) as usize - ptr as usize }, 60usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(tdrz_enable) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(tdrz_enable) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).initial_prompt) as usize - ptr as usize }, 64usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(initial_prompt) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(initial_prompt) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).prompt_tokens) as usize - ptr as usize }, 72usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(prompt_tokens) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(prompt_tokens) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).prompt_n_tokens) as usize - ptr as usize }, 80usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(prompt_n_tokens) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(prompt_n_tokens) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).language) as usize - ptr as usize }, 88usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(language) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(language) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).detect_language) as usize - ptr as usize }, 96usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(detect_language) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(detect_language) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).suppress_blank) as usize - ptr as usize }, 97usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(suppress_blank) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(suppress_blank) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).suppress_non_speech_tokens) as usize - ptr as usize }, 98usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(suppress_non_speech_tokens) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(suppress_non_speech_tokens) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).temperature) as usize - ptr as usize }, 100usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(temperature) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(temperature) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).max_initial_ts) as usize - ptr as usize }, 104usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(max_initial_ts) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(max_initial_ts) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).length_penalty) as usize - ptr as usize }, 108usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(length_penalty) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(length_penalty) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).temperature_inc) as usize - ptr as usize }, 112usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(temperature_inc) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(temperature_inc) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).entropy_thold) as usize - ptr as usize }, 116usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(entropy_thold) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(entropy_thold) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).logprob_thold) as usize - ptr as usize }, 120usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(logprob_thold) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(logprob_thold) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).no_speech_thold) as usize - ptr as usize }, 124usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(no_speech_thold) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(no_speech_thold) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).greedy) as usize - ptr as usize }, 128usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(greedy) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(greedy) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).beam_search) as usize - ptr as usize }, 132usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(beam_search) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(beam_search) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).new_segment_callback) as usize - ptr as usize }, 144usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(new_segment_callback) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(new_segment_callback) ) ); assert_eq!( @@ -5288,40 +5763,40 @@ fn bindgen_test_layout_whisper_full_params() { }, 152usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(new_segment_callback_user_data) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(new_segment_callback_user_data) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).progress_callback) as usize - ptr as usize }, 160usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(progress_callback) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(progress_callback) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).progress_callback_user_data) as usize - ptr as usize }, 168usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(progress_callback_user_data) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(progress_callback_user_data) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).encoder_begin_callback) as usize - ptr as usize }, 176usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(encoder_begin_callback) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(encoder_begin_callback) ) ); assert_eq!( @@ -5330,40 +5805,40 @@ fn bindgen_test_layout_whisper_full_params() { }, 184usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(encoder_begin_callback_user_data) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(encoder_begin_callback_user_data) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).abort_callback) as usize - ptr as usize }, 192usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(abort_callback) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(abort_callback) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).abort_callback_user_data) as usize - ptr as usize }, 200usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(abort_callback_user_data) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(abort_callback_user_data) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).logits_filter_callback) as usize - ptr as usize }, 208usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(logits_filter_callback) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(logits_filter_callback) ) ); assert_eq!( @@ -5372,50 +5847,50 @@ fn bindgen_test_layout_whisper_full_params() { }, 216usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(logits_filter_callback_user_data) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(logits_filter_callback_user_data) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).grammar_rules) as usize - ptr as usize }, 224usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(grammar_rules) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(grammar_rules) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).n_grammar_rules) as usize - ptr as usize }, 232usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(n_grammar_rules) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(n_grammar_rules) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).i_start_rule) as usize - ptr as usize }, 240usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(i_start_rule) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(i_start_rule) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).grammar_penalty) as usize - ptr as usize }, 248usize, concat!( - "Offset of field: ", - stringify!(whisper_full_params), - "::", - stringify!(grammar_penalty) + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(grammar_penalty) ) ); } @@ -5607,6 +6082,7 @@ extern "C" { extern "C" { pub fn whisper_log_set(log_callback: ggml_log_callback, user_data: *mut ::std::os::raw::c_void); } +pub type __builtin_va_list = *mut ::std::os::raw::c_char; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ggml_backend_buffer {