diff --git a/src/whisper_ctx.rs b/src/whisper_ctx.rs index 0609af2..3857bcc 100644 --- a/src/whisper_ctx.rs +++ b/src/whisper_ctx.rs @@ -476,22 +476,22 @@ pub struct WhisperContextParameters { /// (in that case, GPU is always enabled). pub use_gpu: bool, /// Enable flash attention, default false - pub flash_attn : bool, + pub flash_attn: bool, /// GPU device id, default 0 pub gpu_device: c_int, /// [EXPERIMENTAL] Enable Token-level timestamps with DTW, default 0 pub dtw_token_timestamps: bool, /// Preset id for DTW, default whisper_alignment_heads_preset_WHISPER_AHEADS_NONE - pub dtw_aheads_preset : whisper_rs_sys::whisper_alignment_heads_preset, + pub dtw_aheads_preset: whisper_rs_sys::whisper_alignment_heads_preset, /// Number of top text layers used from model. Only with whisper_alignment_heads_preset_WHISPER_AHEADS_N_TOP_MOST preset. - pub dtw_n_top : c_int, + pub dtw_n_top: c_int, /// Custom aheads, only with whisper_alignment_heads_preset_WHISPER_AHEADS_CUSTOM preset /// See details https://github.com/ggerganov/whisper.cpp/pull/1485#discussion_r1519681143 pub dtw_aheads: whisper_rs_sys::whisper_aheads, /// Memory size for DTW /// /// **Warning**: Might be removed in next version of whisper.cpp - pub dtw_mem_size : usize + pub dtw_mem_size: usize, } #[allow(clippy::derivable_impls)] // this impl cannot be derived @@ -499,13 +499,16 @@ impl Default for WhisperContextParameters { fn default() -> Self { Self { use_gpu: cfg!(feature = "_gpu"), - flash_attn : false, + flash_attn: false, gpu_device: 0, dtw_token_timestamps: false, - dtw_aheads_preset : whisper_rs_sys::whisper_alignment_heads_preset_WHISPER_AHEADS_NONE, + dtw_aheads_preset: whisper_rs_sys::whisper_alignment_heads_preset_WHISPER_AHEADS_NONE, dtw_n_top: -1, - dtw_aheads : whisper_rs_sys::whisper_aheads { n_heads: 0, heads: std::ptr::null() }, - dtw_mem_size : 1024 * 1024 * 128 + dtw_aheads: whisper_rs_sys::whisper_aheads { + n_heads: 0, + heads: std::ptr::null(), + }, + dtw_mem_size: 1024 * 1024 * 128, } } } @@ -529,7 +532,10 @@ impl WhisperContextParameters { self.dtw_token_timestamps = dtw_token_timestamps; self } - pub fn dtw_aheads_preset(&mut self, dtw_aheads_preset: whisper_rs_sys::whisper_alignment_heads_preset) -> &mut Self { + pub fn dtw_aheads_preset( + &mut self, + dtw_aheads_preset: whisper_rs_sys::whisper_alignment_heads_preset, + ) -> &mut Self { self.dtw_aheads_preset = dtw_aheads_preset; self } diff --git a/sys/src/bindings.rs b/sys/src/bindings.rs index 5ed2d49..36459be 100644 --- a/sys/src/bindings.rs +++ b/sys/src/bindings.rs @@ -1,5 +1,8 @@ /* automatically generated by rust-bindgen 0.69.1 */ +pub const __bool_true_false_are_defined: u32 = 1; +pub const true_: u32 = 1; +pub const false_: u32 = 0; pub const _STDINT_H: u32 = 1; pub const _FEATURES_H: u32 = 1; pub const _DEFAULT_SOURCE: u32 = 1; @@ -26,7 +29,6 @@ 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; @@ -35,7 +37,7 @@ 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 __GLIBC_MINOR__: u32 = 35; pub const _SYS_CDEFS_H: u32 = 1; pub const __glibc_c99_flexarr_available: u32 = 1; pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0; @@ -96,9 +98,47 @@ 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; +pub const _STDIO_H: u32 = 1; +pub const _____fpos_t_defined: u32 = 1; +pub const ____mbstate_t_defined: u32 = 1; +pub const _____fpos64_t_defined: u32 = 1; +pub const ____FILE_defined: u32 = 1; +pub const __FILE_defined: u32 = 1; +pub const __struct_FILE_defined: u32 = 1; +pub const _IO_EOF_SEEN: u32 = 16; +pub const _IO_ERR_SEEN: u32 = 32; +pub const _IO_USER_LOCK: u32 = 32768; +pub const _IOFBF: u32 = 0; +pub const _IOLBF: u32 = 1; +pub const _IONBF: u32 = 2; +pub const BUFSIZ: u32 = 8192; +pub const EOF: i32 = -1; +pub const SEEK_SET: u32 = 0; +pub const SEEK_CUR: u32 = 1; +pub const SEEK_END: u32 = 2; +pub const P_tmpdir: &[u8; 5] = b"/tmp\0"; +pub const _BITS_STDIO_LIM_H: u32 = 1; +pub const L_tmpnam: u32 = 20; +pub const TMP_MAX: u32 = 238328; +pub const FILENAME_MAX: u32 = 4096; +pub const L_ctermid: u32 = 9; +pub const FOPEN_MAX: u32 = 16; +pub const __HAVE_FLOAT128: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT128: u32 = 0; +pub const __HAVE_FLOAT64X: u32 = 1; +pub const __HAVE_FLOAT64X_LONG_DOUBLE: u32 = 1; +pub const __HAVE_FLOAT16: u32 = 0; +pub const __HAVE_FLOAT32: u32 = 1; +pub const __HAVE_FLOAT64: u32 = 1; +pub const __HAVE_FLOAT32X: u32 = 1; +pub const __HAVE_FLOAT128X: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT16: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT32: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT64: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT32X: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT64X: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT128X: u32 = 0; +pub const __HAVE_FLOATN_NOT_TYPEDEF: u32 = 0; pub const GGML_FILE_MAGIC: u32 = 1734831468; pub const GGML_FILE_VERSION: u32 = 1; pub const GGML_QNT_VERSION: u32 = 2; @@ -117,11 +157,56 @@ pub const GGML_EXIT_ABORTED: u32 = 1; pub const GGUF_MAGIC: &[u8; 5] = b"GGUF\0"; pub const GGUF_VERSION: u32 = 3; pub const GGUF_DEFAULT_ALIGNMENT: u32 = 32; +pub const GGML_KQ_MASK_PAD: u32 = 32; pub const GGML_N_TASKS_MAX: i32 = -1; 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 wchar_t = ::std::os::raw::c_int; +#[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, +} +#[test] +fn bindgen_test_layout_max_align_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(max_align_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 16usize, + concat!("Alignment of ", stringify!(max_align_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce1) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce2) + ) + ); +} 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; @@ -232,62 +317,1040 @@ 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 __gnuc_va_list = __builtin_va_list; #[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, +#[derive(Copy, Clone)] +pub struct __mbstate_t { + pub __count: ::std::os::raw::c_int, + pub __value: __mbstate_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union __mbstate_t__bindgen_ty_1 { + pub __wch: ::std::os::raw::c_uint, + pub __wchb: [::std::os::raw::c_char; 4usize], } #[test] -fn bindgen_test_layout_max_align_t() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); +fn bindgen_test_layout___mbstate_t__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__mbstate_t__bindgen_ty_1> = + ::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::<__mbstate_t__bindgen_ty_1>(), + 4usize, + concat!("Size of: ", stringify!(__mbstate_t__bindgen_ty_1)) ); assert_eq!( - ::std::mem::align_of::(), - 16usize, - concat!("Alignment of ", stringify!(max_align_t)) + ::std::mem::align_of::<__mbstate_t__bindgen_ty_1>(), + 4usize, + concat!("Alignment of ", stringify!(__mbstate_t__bindgen_ty_1)) ); assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__wch) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(max_align_t), + stringify!(__mbstate_t__bindgen_ty_1), "::", - stringify!(__clang_max_align_nonce1) + stringify!(__wch) ) ); assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize }, - 16usize, + unsafe { ::std::ptr::addr_of!((*ptr).__wchb) as usize - ptr as usize }, + 0usize, concat!( "Offset of field: ", - stringify!(max_align_t), + stringify!(__mbstate_t__bindgen_ty_1), "::", - stringify!(__clang_max_align_nonce2) + stringify!(__wchb) ) ); } +#[test] +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::<__mbstate_t>(), + 8usize, + concat!("Size of: ", stringify!(__mbstate_t)) + ); + assert_eq!( + ::std::mem::align_of::<__mbstate_t>(), + 4usize, + concat!("Alignment of ", stringify!(__mbstate_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__count) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t), + "::", + stringify!(__count) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__value) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t), + "::", + stringify!(__value) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _G_fpos_t { + pub __pos: __off_t, + pub __state: __mbstate_t, +} +#[test] +fn bindgen_test_layout__G_fpos_t() { + const UNINIT: ::std::mem::MaybeUninit<_G_fpos_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_G_fpos_t>(), + 16usize, + concat!("Size of: ", stringify!(_G_fpos_t)) + ); + assert_eq!( + ::std::mem::align_of::<_G_fpos_t>(), + 8usize, + concat!("Alignment of ", stringify!(_G_fpos_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos_t), + "::", + stringify!(__pos) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos_t), + "::", + stringify!(__state) + ) + ); +} +pub type __fpos_t = _G_fpos_t; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _G_fpos64_t { + pub __pos: __off64_t, + pub __state: __mbstate_t, +} +#[test] +fn bindgen_test_layout__G_fpos64_t() { + const UNINIT: ::std::mem::MaybeUninit<_G_fpos64_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_G_fpos64_t>(), + 16usize, + concat!("Size of: ", stringify!(_G_fpos64_t)) + ); + assert_eq!( + ::std::mem::align_of::<_G_fpos64_t>(), + 8usize, + concat!("Alignment of ", stringify!(_G_fpos64_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos64_t), + "::", + stringify!(__pos) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos64_t), + "::", + stringify!(__state) + ) + ); +} +pub type __fpos64_t = _G_fpos64_t; +pub type __FILE = _IO_FILE; +pub type FILE = _IO_FILE; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _IO_marker { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _IO_codecvt { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _IO_wide_data { + _unused: [u8; 0], +} +pub type _IO_lock_t = ::std::os::raw::c_void; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _IO_FILE { + pub _flags: ::std::os::raw::c_int, + pub _IO_read_ptr: *mut ::std::os::raw::c_char, + pub _IO_read_end: *mut ::std::os::raw::c_char, + pub _IO_read_base: *mut ::std::os::raw::c_char, + pub _IO_write_base: *mut ::std::os::raw::c_char, + pub _IO_write_ptr: *mut ::std::os::raw::c_char, + pub _IO_write_end: *mut ::std::os::raw::c_char, + pub _IO_buf_base: *mut ::std::os::raw::c_char, + pub _IO_buf_end: *mut ::std::os::raw::c_char, + pub _IO_save_base: *mut ::std::os::raw::c_char, + pub _IO_backup_base: *mut ::std::os::raw::c_char, + pub _IO_save_end: *mut ::std::os::raw::c_char, + pub _markers: *mut _IO_marker, + pub _chain: *mut _IO_FILE, + pub _fileno: ::std::os::raw::c_int, + pub _flags2: ::std::os::raw::c_int, + pub _old_offset: __off_t, + pub _cur_column: ::std::os::raw::c_ushort, + pub _vtable_offset: ::std::os::raw::c_schar, + pub _shortbuf: [::std::os::raw::c_char; 1usize], + pub _lock: *mut _IO_lock_t, + pub _offset: __off64_t, + pub _codecvt: *mut _IO_codecvt, + pub _wide_data: *mut _IO_wide_data, + pub _freeres_list: *mut _IO_FILE, + pub _freeres_buf: *mut ::std::os::raw::c_void, + pub __pad5: usize, + pub _mode: ::std::os::raw::c_int, + pub _unused2: [::std::os::raw::c_char; 20usize], +} +#[test] +fn bindgen_test_layout__IO_FILE() { + const UNINIT: ::std::mem::MaybeUninit<_IO_FILE> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_IO_FILE>(), + 216usize, + concat!("Size of: ", stringify!(_IO_FILE)) + ); + assert_eq!( + ::std::mem::align_of::<_IO_FILE>(), + 8usize, + concat!("Alignment of ", stringify!(_IO_FILE)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._flags) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_flags) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_ptr) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_read_ptr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_end) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_read_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_base) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_read_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_base) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_write_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_ptr) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_write_ptr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_end) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_write_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_buf_base) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_buf_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_buf_end) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_buf_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_save_base) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_save_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_backup_base) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_backup_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_save_end) as usize - ptr as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_save_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._markers) as usize - ptr as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_markers) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._chain) as usize - ptr as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_chain) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._fileno) as usize - ptr as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_fileno) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._flags2) as usize - ptr as usize }, + 116usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_flags2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._old_offset) as usize - ptr as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_old_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._cur_column) as usize - ptr as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_cur_column) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._vtable_offset) as usize - ptr as usize }, + 130usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_vtable_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._shortbuf) as usize - ptr as usize }, + 131usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_shortbuf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._lock) as usize - ptr as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_lock) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._offset) as usize - ptr as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._codecvt) as usize - ptr as usize }, + 152usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_codecvt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._wide_data) as usize - ptr as usize }, + 160usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_wide_data) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._freeres_list) as usize - ptr as usize }, + 168usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_freeres_list) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._freeres_buf) as usize - ptr as usize }, + 176usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_freeres_buf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pad5) as usize - ptr as usize }, + 184usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(__pad5) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._mode) as usize - ptr as usize }, + 192usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_mode) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._unused2) as usize - ptr as usize }, + 196usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_unused2) + ) + ); +} +pub type va_list = __gnuc_va_list; +pub type off_t = __off_t; +pub type fpos_t = __fpos_t; +extern "C" { + pub static mut stdin: *mut FILE; +} +extern "C" { + pub static mut stdout: *mut FILE; +} +extern "C" { + pub static mut stderr: *mut FILE; +} +extern "C" { + pub fn remove(__filename: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn rename( + __old: *const ::std::os::raw::c_char, + __new: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn renameat( + __oldfd: ::std::os::raw::c_int, + __old: *const ::std::os::raw::c_char, + __newfd: ::std::os::raw::c_int, + __new: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fclose(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn tmpfile() -> *mut FILE; +} +extern "C" { + pub fn tmpnam(arg1: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn tmpnam_r(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn tempnam( + __dir: *const ::std::os::raw::c_char, + __pfx: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fflush(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fflush_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fopen( + __filename: *const ::std::os::raw::c_char, + __modes: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn freopen( + __filename: *const ::std::os::raw::c_char, + __modes: *const ::std::os::raw::c_char, + __stream: *mut FILE, + ) -> *mut FILE; +} +extern "C" { + pub fn fdopen(__fd: ::std::os::raw::c_int, __modes: *const ::std::os::raw::c_char) + -> *mut FILE; +} +extern "C" { + pub fn fmemopen( + __s: *mut ::std::os::raw::c_void, + __len: usize, + __modes: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn open_memstream( + __bufloc: *mut *mut ::std::os::raw::c_char, + __sizeloc: *mut usize, + ) -> *mut FILE; +} +extern "C" { + pub fn setbuf(__stream: *mut FILE, __buf: *mut ::std::os::raw::c_char); +} +extern "C" { + pub fn setvbuf( + __stream: *mut FILE, + __buf: *mut ::std::os::raw::c_char, + __modes: ::std::os::raw::c_int, + __n: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setbuffer(__stream: *mut FILE, __buf: *mut ::std::os::raw::c_char, __size: usize); +} +extern "C" { + pub fn setlinebuf(__stream: *mut FILE); +} +extern "C" { + pub fn fprintf( + __stream: *mut FILE, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn printf(__format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sprintf( + __s: *mut ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vfprintf( + __s: *mut FILE, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vprintf( + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsprintf( + __s: *mut ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn snprintf( + __s: *mut ::std::os::raw::c_char, + __maxlen: ::std::os::raw::c_ulong, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsnprintf( + __s: *mut ::std::os::raw::c_char, + __maxlen: ::std::os::raw::c_ulong, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vdprintf( + __fd: ::std::os::raw::c_int, + __fmt: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn dprintf( + __fd: ::std::os::raw::c_int, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fscanf( + __stream: *mut FILE, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn scanf(__format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sscanf( + __s: *const ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +pub type _Float32 = f32; +pub type _Float64 = f64; +pub type _Float32x = f64; +pub type _Float64x = u128; +extern "C" { + #[link_name = "\u{1}__isoc99_fscanf"] + pub fn fscanf1( + __stream: *mut FILE, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[link_name = "\u{1}__isoc99_scanf"] + pub fn scanf1(__format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; +} +extern "C" { + #[link_name = "\u{1}__isoc99_sscanf"] + pub fn sscanf1( + __s: *const ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vfscanf( + __s: *mut FILE, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vscanf( + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsscanf( + __s: *const ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[link_name = "\u{1}__isoc99_vfscanf"] + pub fn vfscanf1( + __s: *mut FILE, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[link_name = "\u{1}__isoc99_vscanf"] + pub fn vscanf1( + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[link_name = "\u{1}__isoc99_vsscanf"] + pub fn vsscanf1( + __s: *const ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgetc(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getc(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getchar() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getc_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getchar_unlocked() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgetc_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fputc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putchar(__c: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fputc_unlocked(__c: ::std::os::raw::c_int, __stream: *mut FILE) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putc_unlocked(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putchar_unlocked(__c: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getw(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putw(__w: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgets( + __s: *mut ::std::os::raw::c_char, + __n: ::std::os::raw::c_int, + __stream: *mut FILE, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn __getdelim( + __lineptr: *mut *mut ::std::os::raw::c_char, + __n: *mut usize, + __delimiter: ::std::os::raw::c_int, + __stream: *mut FILE, + ) -> __ssize_t; +} +extern "C" { + pub fn getdelim( + __lineptr: *mut *mut ::std::os::raw::c_char, + __n: *mut usize, + __delimiter: ::std::os::raw::c_int, + __stream: *mut FILE, + ) -> __ssize_t; +} +extern "C" { + pub fn getline( + __lineptr: *mut *mut ::std::os::raw::c_char, + __n: *mut usize, + __stream: *mut FILE, + ) -> __ssize_t; +} +extern "C" { + pub fn fputs(__s: *const ::std::os::raw::c_char, __stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn puts(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ungetc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fread( + __ptr: *mut ::std::os::raw::c_void, + __size: ::std::os::raw::c_ulong, + __n: ::std::os::raw::c_ulong, + __stream: *mut FILE, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn fwrite( + __ptr: *const ::std::os::raw::c_void, + __size: ::std::os::raw::c_ulong, + __n: ::std::os::raw::c_ulong, + __s: *mut FILE, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn fread_unlocked( + __ptr: *mut ::std::os::raw::c_void, + __size: usize, + __n: usize, + __stream: *mut FILE, + ) -> usize; +} +extern "C" { + pub fn fwrite_unlocked( + __ptr: *const ::std::os::raw::c_void, + __size: usize, + __n: usize, + __stream: *mut FILE, + ) -> usize; +} +extern "C" { + pub fn fseek( + __stream: *mut FILE, + __off: ::std::os::raw::c_long, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftell(__stream: *mut FILE) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn rewind(__stream: *mut FILE); +} +extern "C" { + pub fn fseeko( + __stream: *mut FILE, + __off: __off_t, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftello(__stream: *mut FILE) -> __off_t; +} +extern "C" { + pub fn fgetpos(__stream: *mut FILE, __pos: *mut fpos_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fsetpos(__stream: *mut FILE, __pos: *const fpos_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clearerr(__stream: *mut FILE); +} +extern "C" { + pub fn feof(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ferror(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clearerr_unlocked(__stream: *mut FILE); +} +extern "C" { + pub fn feof_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ferror_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn perror(__s: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn fileno(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fileno_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pclose(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn popen( + __command: *const ::std::os::raw::c_char, + __modes: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn ctermid(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn flockfile(__stream: *mut FILE); +} +extern "C" { + pub fn ftrylockfile(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn funlockfile(__stream: *mut FILE); +} +extern "C" { + pub fn __uflow(arg1: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __overflow(arg1: *mut FILE, arg2: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +pub const ggml_status_GGML_STATUS_ALLOC_FAILED: ggml_status = -2; +pub const ggml_status_GGML_STATUS_FAILED: ggml_status = -1; +pub const ggml_status_GGML_STATUS_SUCCESS: ggml_status = 0; +pub const ggml_status_GGML_STATUS_ABORTED: ggml_status = 1; +pub type ggml_status = ::std::os::raw::c_int; +extern "C" { + pub fn ggml_status_to_string(status: ggml_status) -> *const ::std::os::raw::c_char; +} pub type ggml_fp16_t = u16; extern "C" { - pub fn ggml_fp16_to_fp32(x: ggml_fp16_t) -> f32; + pub fn ggml_fp16_to_fp32(arg1: ggml_fp16_t) -> f32; } extern "C" { - pub fn ggml_fp32_to_fp16(x: f32) -> ggml_fp16_t; + pub fn ggml_fp32_to_fp16(arg1: f32) -> ggml_fp16_t; } extern "C" { - pub fn ggml_fp16_to_fp32_row(x: *const ggml_fp16_t, y: *mut f32, n: ::std::os::raw::c_int); + pub fn ggml_fp16_to_fp32_row(arg1: *const ggml_fp16_t, arg2: *mut f32, arg3: i64); } extern "C" { - pub fn ggml_fp32_to_fp16_row(x: *const f32, y: *mut ggml_fp16_t, n: ::std::os::raw::c_int); + pub fn ggml_fp32_to_fp16_row(arg1: *const f32, arg2: *mut ggml_fp16_t, arg3: i64); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ggml_bf16_t { + pub bits: u16, +} +#[test] +fn bindgen_test_layout_ggml_bf16_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(ggml_bf16_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(ggml_bf16_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ggml_bf16_t), + "::", + stringify!(bits) + ) + ); +} +extern "C" { + pub fn ggml_fp32_to_bf16(arg1: f32) -> ggml_bf16_t; +} +extern "C" { + pub fn ggml_bf16_to_fp32(arg1: ggml_bf16_t) -> f32; +} +extern "C" { + pub fn ggml_bf16_to_fp32_row(arg1: *const ggml_bf16_t, arg2: *mut f32, arg3: i64); +} +extern "C" { + pub fn ggml_fp32_to_bf16_row(arg1: *const f32, arg2: *mut ggml_bf16_t, arg3: i64); } #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -308,17 +1371,29 @@ pub const ggml_type_GGML_TYPE_Q4_K: ggml_type = 12; pub const ggml_type_GGML_TYPE_Q5_K: ggml_type = 13; pub const ggml_type_GGML_TYPE_Q6_K: ggml_type = 14; pub const ggml_type_GGML_TYPE_Q8_K: ggml_type = 15; -pub const ggml_type_GGML_TYPE_I8: ggml_type = 16; -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 const ggml_type_GGML_TYPE_IQ2_XXS: ggml_type = 16; +pub const ggml_type_GGML_TYPE_IQ2_XS: ggml_type = 17; +pub const ggml_type_GGML_TYPE_IQ3_XXS: ggml_type = 18; +pub const ggml_type_GGML_TYPE_IQ1_S: ggml_type = 19; +pub const ggml_type_GGML_TYPE_IQ4_NL: ggml_type = 20; +pub const ggml_type_GGML_TYPE_IQ3_S: ggml_type = 21; +pub const ggml_type_GGML_TYPE_IQ2_S: ggml_type = 22; +pub const ggml_type_GGML_TYPE_IQ4_XS: ggml_type = 23; +pub const ggml_type_GGML_TYPE_I8: ggml_type = 24; +pub const ggml_type_GGML_TYPE_I16: ggml_type = 25; +pub const ggml_type_GGML_TYPE_I32: ggml_type = 26; +pub const ggml_type_GGML_TYPE_I64: ggml_type = 27; +pub const ggml_type_GGML_TYPE_F64: ggml_type = 28; +pub const ggml_type_GGML_TYPE_IQ1_M: ggml_type = 29; +pub const ggml_type_GGML_TYPE_BF16: ggml_type = 30; +pub const ggml_type_GGML_TYPE_COUNT: ggml_type = 31; 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; +pub const ggml_backend_type_GGML_BACKEND_TYPE_CPU: ggml_backend_type = 0; +pub const ggml_backend_type_GGML_BACKEND_TYPE_GPU: ggml_backend_type = 10; +pub const ggml_backend_type_GGML_BACKEND_TYPE_GPU_SPLIT: ggml_backend_type = 20; pub type ggml_backend_type = ::std::os::raw::c_uint; pub const ggml_ftype_GGML_FTYPE_UNKNOWN: ggml_ftype = -1; pub const ggml_ftype_GGML_FTYPE_ALL_F32: ggml_ftype = 0; @@ -334,6 +1409,16 @@ pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q3_K: ggml_ftype = 11; pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q4_K: ggml_ftype = 12; pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q5_K: ggml_ftype = 13; pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q6_K: ggml_ftype = 14; +pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ2_XXS: ggml_ftype = 15; +pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ2_XS: ggml_ftype = 16; +pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ3_XXS: ggml_ftype = 17; +pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ1_S: ggml_ftype = 18; +pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ4_NL: ggml_ftype = 19; +pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ3_S: ggml_ftype = 20; +pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ2_S: ggml_ftype = 21; +pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ4_XS: ggml_ftype = 22; +pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ1_M: ggml_ftype = 23; +pub const ggml_ftype_GGML_FTYPE_MOSTLY_BF16: ggml_ftype = 24; pub type ggml_ftype = ::std::os::raw::c_int; pub const ggml_op_GGML_OP_NONE: ggml_op = 0; pub const ggml_op_GGML_OP_DUP: ggml_op = 1; @@ -378,36 +1463,40 @@ 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 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_PAD: ggml_op = 50; +pub const ggml_op_GGML_OP_ARANGE: ggml_op = 51; +pub const ggml_op_GGML_OP_TIMESTEP_EMBEDDING: ggml_op = 52; +pub const ggml_op_GGML_OP_ARGSORT: ggml_op = 53; +pub const ggml_op_GGML_OP_LEAKY_RELU: ggml_op = 54; +pub const ggml_op_GGML_OP_FLASH_ATTN: ggml_op = 55; +pub const ggml_op_GGML_OP_FLASH_ATTN_EXT: ggml_op = 56; +pub const ggml_op_GGML_OP_FLASH_FF: ggml_op = 57; +pub const ggml_op_GGML_OP_FLASH_ATTN_BACK: ggml_op = 58; +pub const ggml_op_GGML_OP_SSM_CONV: ggml_op = 59; +pub const ggml_op_GGML_OP_SSM_SCAN: ggml_op = 60; +pub const ggml_op_GGML_OP_WIN_PART: ggml_op = 61; +pub const ggml_op_GGML_OP_WIN_UNPART: ggml_op = 62; +pub const ggml_op_GGML_OP_GET_REL_POS: ggml_op = 63; +pub const ggml_op_GGML_OP_ADD_REL_POS: ggml_op = 64; +pub const ggml_op_GGML_OP_UNARY: ggml_op = 65; +pub const ggml_op_GGML_OP_MAP_UNARY: ggml_op = 66; +pub const ggml_op_GGML_OP_MAP_BINARY: ggml_op = 67; +pub const ggml_op_GGML_OP_MAP_CUSTOM1_F32: ggml_op = 68; +pub const ggml_op_GGML_OP_MAP_CUSTOM2_F32: ggml_op = 69; +pub const ggml_op_GGML_OP_MAP_CUSTOM3_F32: ggml_op = 70; +pub const ggml_op_GGML_OP_MAP_CUSTOM1: ggml_op = 71; +pub const ggml_op_GGML_OP_MAP_CUSTOM2: ggml_op = 72; +pub const ggml_op_GGML_OP_MAP_CUSTOM3: ggml_op = 73; +pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS: ggml_op = 74; +pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS_BACK: ggml_op = 75; +pub const ggml_op_GGML_OP_COUNT: ggml_op = 76; 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; @@ -416,20 +1505,27 @@ pub const ggml_unary_op_GGML_UNARY_OP_STEP: ggml_unary_op = 3; pub const ggml_unary_op_GGML_UNARY_OP_TANH: ggml_unary_op = 4; pub const ggml_unary_op_GGML_UNARY_OP_ELU: ggml_unary_op = 5; 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_COUNT: ggml_unary_op = 10; +pub const ggml_unary_op_GGML_UNARY_OP_SIGMOID: ggml_unary_op = 7; +pub const ggml_unary_op_GGML_UNARY_OP_GELU: ggml_unary_op = 8; +pub const ggml_unary_op_GGML_UNARY_OP_GELU_QUICK: ggml_unary_op = 9; +pub const ggml_unary_op_GGML_UNARY_OP_SILU: ggml_unary_op = 10; +pub const ggml_unary_op_GGML_UNARY_OP_HARDSWISH: ggml_unary_op = 11; +pub const ggml_unary_op_GGML_UNARY_OP_HARDSIGMOID: ggml_unary_op = 12; +pub const ggml_unary_op_GGML_UNARY_OP_COUNT: ggml_unary_op = 13; 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; -pub const ggml_object_type_GGML_OBJECT_WORK_BUFFER: ggml_object_type = 2; +pub const ggml_object_type_GGML_OBJECT_TYPE_TENSOR: ggml_object_type = 0; +pub const ggml_object_type_GGML_OBJECT_TYPE_GRAPH: ggml_object_type = 1; +pub const ggml_object_type_GGML_OBJECT_TYPE_WORK_BUFFER: ggml_object_type = 2; 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; +pub const ggml_tensor_flag_GGML_TENSOR_FLAG_INPUT: ggml_tensor_flag = 1; +pub const ggml_tensor_flag_GGML_TENSOR_FLAG_OUTPUT: ggml_tensor_flag = 2; +pub const ggml_tensor_flag_GGML_TENSOR_FLAG_PARAM: ggml_tensor_flag = 4; +pub type ggml_tensor_flag = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ggml_object { @@ -515,7 +1611,7 @@ pub struct ggml_tensor { pub nb: [usize; 4usize], pub op: ggml_op, pub op_params: [i32; 16usize], - pub is_param: bool, + pub flags: i32, pub grad: *mut ggml_tensor, pub src: [*mut ggml_tensor; 10usize], pub perf_runs: ::std::os::raw::c_int, @@ -613,13 +1709,13 @@ fn bindgen_test_layout_ggml_tensor() { ) ); assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).is_param) as usize - ptr as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, 148usize, concat!( "Offset of field: ", stringify!(ggml_tensor), "::", - stringify!(is_param) + stringify!(flags) ) ); assert_eq!( @@ -734,14 +1830,15 @@ fn bindgen_test_layout_ggml_tensor() { ); } pub const GGML_TENSOR_SIZE: usize = 368; +pub type ggml_abort_callback = + ::std::option::Option bool>; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ggml_cplan { pub work_size: usize, pub work_data: *mut u8, pub n_threads: ::std::os::raw::c_int, - pub abort_callback: - ::std::option::Option bool>, + pub abort_callback: ggml_abort_callback, pub abort_callback_data: *mut ::std::os::raw::c_void, } #[test] @@ -1098,9 +2195,9 @@ fn bindgen_test_layout_ggml_init_params() { ) ); } -pub const ggml_task_type_GGML_TASK_INIT: ggml_task_type = 0; -pub const ggml_task_type_GGML_TASK_COMPUTE: ggml_task_type = 1; -pub const ggml_task_type_GGML_TASK_FINALIZE: ggml_task_type = 2; +pub const ggml_task_type_GGML_TASK_TYPE_INIT: ggml_task_type = 0; +pub const ggml_task_type_GGML_TASK_TYPE_COMPUTE: ggml_task_type = 1; +pub const ggml_task_type_GGML_TASK_TYPE_FINALIZE: ggml_task_type = 2; pub type ggml_task_type = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -1176,6 +2273,18 @@ fn bindgen_test_layout_ggml_compute_params() { ) ); } +pub const ggml_numa_strategy_GGML_NUMA_STRATEGY_DISABLED: ggml_numa_strategy = 0; +pub const ggml_numa_strategy_GGML_NUMA_STRATEGY_DISTRIBUTE: ggml_numa_strategy = 1; +pub const ggml_numa_strategy_GGML_NUMA_STRATEGY_ISOLATE: ggml_numa_strategy = 2; +pub const ggml_numa_strategy_GGML_NUMA_STRATEGY_NUMACTL: ggml_numa_strategy = 3; +pub const ggml_numa_strategy_GGML_NUMA_STRATEGY_MIRROR: ggml_numa_strategy = 4; +pub const ggml_numa_strategy_GGML_NUMA_STRATEGY_COUNT: ggml_numa_strategy = 5; +pub type ggml_numa_strategy = ::std::os::raw::c_uint; +pub type ggml_guid = [u8; 16usize]; +pub type ggml_guid_t = *mut ggml_guid; +extern "C" { + pub fn ggml_guid_matches(guid_a: ggml_guid_t, guid_b: ggml_guid_t) -> bool; +} extern "C" { pub fn ggml_time_init(); } @@ -1195,7 +2304,13 @@ extern "C" { pub fn ggml_print_backtrace(); } extern "C" { - pub fn ggml_numa_init(); + pub fn ggml_fopen( + fname: *const ::std::os::raw::c_char, + mode: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn ggml_numa_init(numa: ggml_numa_strategy); } extern "C" { pub fn ggml_is_numa() -> bool; @@ -1263,6 +2378,9 @@ extern "C" { extern "C" { pub fn ggml_is_permuted(tensor: *const ggml_tensor) -> bool; } +extern "C" { + pub fn ggml_is_empty(tensor: *const ggml_tensor) -> bool; +} extern "C" { pub fn ggml_is_scalar(tensor: *const ggml_tensor) -> bool; } @@ -1281,9 +2399,19 @@ extern "C" { extern "C" { pub fn ggml_are_same_shape(t0: *const ggml_tensor, t1: *const ggml_tensor) -> bool; } +extern "C" { + pub fn ggml_are_same_stride(t0: *const ggml_tensor, t1: *const ggml_tensor) -> bool; +} extern "C" { pub fn ggml_tensor_overhead() -> usize; } +extern "C" { + pub fn ggml_validate_row_data( + type_: ggml_type, + data: *const ::std::os::raw::c_void, + nbytes: usize, + ) -> bool; +} extern "C" { pub fn ggml_init(params: ggml_init_params) -> *mut ggml_context; } @@ -1681,6 +2809,12 @@ extern "C" { extern "C" { pub fn ggml_relu_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } +extern "C" { + pub fn ggml_sigmoid(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; +} +extern "C" { + pub fn ggml_sigmoid_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; +} extern "C" { pub fn ggml_gelu(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } @@ -1707,6 +2841,12 @@ extern "C" { b: *mut ggml_tensor, ) -> *mut ggml_tensor; } +extern "C" { + pub fn ggml_hardswish(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; +} +extern "C" { + pub fn ggml_hardsigmoid(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; +} extern "C" { pub fn ggml_norm(ctx: *mut ggml_context, a: *mut ggml_tensor, eps: f32) -> *mut ggml_tensor; } @@ -1763,11 +2903,9 @@ extern "C" { 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, + as_: *mut ggml_tensor, b: *mut ggml_tensor, + ids: *mut ggml_tensor, ) -> *mut ggml_tensor; } extern "C" { @@ -1851,18 +2989,15 @@ extern "C" { ) -> *mut ggml_tensor; } extern "C" { - pub fn ggml_cpy_inplace( + pub fn ggml_cast( ctx: *mut ggml_context, a: *mut ggml_tensor, - b: *mut ggml_tensor, + type_: ggml_type, ) -> *mut ggml_tensor; } extern "C" { pub fn ggml_cont(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { - pub fn ggml_cont_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; -} extern "C" { pub fn ggml_cont_1d(ctx: *mut ggml_context, a: *mut ggml_tensor, ne0: i64) -> *mut ggml_tensor; } @@ -2049,6 +3184,7 @@ extern "C" { a: *mut ggml_tensor, mask: *mut ggml_tensor, scale: f32, + max_bias: f32, ) -> *mut ggml_tensor; } extern "C" { @@ -2158,15 +3294,6 @@ extern "C" { xpos_down: bool, ) -> *mut ggml_tensor; } -extern "C" { - pub fn ggml_alibi( - ctx: *mut ggml_context, - a: *mut ggml_tensor, - n_past: ::std::os::raw::c_int, - n_head: ::std::os::raw::c_int, - bias_max: f32, - ) -> *mut ggml_tensor; -} extern "C" { pub fn ggml_clamp( ctx: *mut ggml_context, @@ -2187,6 +3314,20 @@ extern "C" { d0: ::std::os::raw::c_int, d1: ::std::os::raw::c_int, is_2D: bool, + dst_type: ggml_type, + ) -> *mut ggml_tensor; +} +extern "C" { + pub fn ggml_conv_depthwise_2d( + ctx: *mut ggml_context, + a: *mut ggml_tensor, + b: *mut ggml_tensor, + s0: ::std::os::raw::c_int, + s1: ::std::os::raw::c_int, + p0: ::std::os::raw::c_int, + p1: ::std::os::raw::c_int, + d0: ::std::os::raw::c_int, + d1: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } extern "C" { @@ -2297,8 +3438,16 @@ extern "C" { 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; +extern "C" { + pub fn ggml_timestep_embedding( + ctx: *mut ggml_context, + timesteps: *mut ggml_tensor, + dim: ::std::os::raw::c_int, + max_period: ::std::os::raw::c_int, + ) -> *mut ggml_tensor; +} +pub const ggml_sort_order_GGML_SORT_ORDER_ASC: ggml_sort_order = 0; +pub const ggml_sort_order_GGML_SORT_ORDER_DESC: ggml_sort_order = 1; pub type ggml_sort_order = ::std::os::raw::c_uint; extern "C" { pub fn ggml_argsort( @@ -2307,6 +3456,14 @@ extern "C" { order: ggml_sort_order, ) -> *mut ggml_tensor; } +extern "C" { + pub fn ggml_arange( + ctx: *mut ggml_context, + start: f32, + stop: f32, + step: f32, + ) -> *mut ggml_tensor; +} extern "C" { pub fn ggml_top_k( ctx: *mut ggml_context, @@ -2323,6 +3480,20 @@ extern "C" { masked: bool, ) -> *mut ggml_tensor; } +extern "C" { + pub fn ggml_flash_attn_ext( + ctx: *mut ggml_context, + q: *mut ggml_tensor, + k: *mut ggml_tensor, + v: *mut ggml_tensor, + mask: *mut ggml_tensor, + scale: f32, + max_bias: f32, + ) -> *mut ggml_tensor; +} +extern "C" { + pub fn ggml_flash_attn_ext_set_prec(a: *mut ggml_tensor, prec: ggml_prec); +} extern "C" { pub fn ggml_flash_attn_back( ctx: *mut ggml_context, @@ -2343,6 +3514,27 @@ extern "C" { c1: *mut ggml_tensor, ) -> *mut ggml_tensor; } +extern "C" { + pub fn ggml_ssm_conv( + ctx: *mut ggml_context, + s: *mut ggml_tensor, + x: *mut ggml_tensor, + c: *mut ggml_tensor, + sq: *mut ggml_tensor, + ) -> *mut ggml_tensor; +} +extern "C" { + pub fn ggml_ssm_scan( + ctx: *mut ggml_context, + s: *mut ggml_tensor, + x: *mut ggml_tensor, + dt: *mut ggml_tensor, + A: *mut ggml_tensor, + B: *mut ggml_tensor, + C: *mut ggml_tensor, + sq: *mut ggml_tensor, + ) -> *mut ggml_tensor; +} extern "C" { pub fn ggml_win_part( ctx: *mut ggml_context, @@ -2659,22 +3851,19 @@ extern "C" { } extern "C" { pub fn ggml_graph_plan( - cgraph: *mut ggml_cgraph, + cgraph: *const ggml_cgraph, n_threads: ::std::os::raw::c_int, ) -> ggml_cplan; } extern "C" { - pub fn ggml_graph_compute( - cgraph: *mut ggml_cgraph, - cplan: *mut ggml_cplan, - ) -> ::std::os::raw::c_int; + pub fn ggml_graph_compute(cgraph: *mut ggml_cgraph, cplan: *mut ggml_cplan) -> ggml_status; } extern "C" { pub fn ggml_graph_compute_with_ctx( ctx: *mut ggml_context, cgraph: *mut ggml_cgraph, n_threads: ::std::os::raw::c_int, - ); + ) -> ggml_status; } extern "C" { pub fn ggml_graph_get_tensor( @@ -2712,20 +3901,20 @@ extern "C" { n_checkpoints: ::std::os::raw::c_int, ); } -pub const ggml_opt_type_GGML_OPT_ADAM: ggml_opt_type = 0; -pub const ggml_opt_type_GGML_OPT_LBFGS: ggml_opt_type = 1; +pub const ggml_opt_type_GGML_OPT_TYPE_ADAM: ggml_opt_type = 0; +pub const ggml_opt_type_GGML_OPT_TYPE_LBFGS: ggml_opt_type = 1; pub type ggml_opt_type = ::std::os::raw::c_uint; pub const ggml_linesearch_GGML_LINESEARCH_DEFAULT: ggml_linesearch = 1; pub const ggml_linesearch_GGML_LINESEARCH_BACKTRACKING_ARMIJO: ggml_linesearch = 0; pub const ggml_linesearch_GGML_LINESEARCH_BACKTRACKING_WOLFE: ggml_linesearch = 1; pub const ggml_linesearch_GGML_LINESEARCH_BACKTRACKING_STRONG_WOLFE: ggml_linesearch = 2; pub type ggml_linesearch = ::std::os::raw::c_uint; -pub const ggml_opt_result_GGML_OPT_OK: ggml_opt_result = 0; -pub const ggml_opt_result_GGML_OPT_DID_NOT_CONVERGE: ggml_opt_result = 1; -pub const ggml_opt_result_GGML_OPT_NO_CONTEXT: ggml_opt_result = 2; -pub const ggml_opt_result_GGML_OPT_INVALID_WOLFE: ggml_opt_result = 3; -pub const ggml_opt_result_GGML_OPT_FAIL: ggml_opt_result = 4; -pub const ggml_opt_result_GGML_OPT_CANCEL: ggml_opt_result = 5; +pub const ggml_opt_result_GGML_OPT_RESULT_OK: ggml_opt_result = 0; +pub const ggml_opt_result_GGML_OPT_RESULT_DID_NOT_CONVERGE: ggml_opt_result = 1; +pub const ggml_opt_result_GGML_OPT_RESULT_NO_CONTEXT: ggml_opt_result = 2; +pub const ggml_opt_result_GGML_OPT_RESULT_INVALID_WOLFE: ggml_opt_result = 3; +pub const ggml_opt_result_GGML_OPT_RESULT_FAIL: ggml_opt_result = 4; +pub const ggml_opt_result_GGML_OPT_RESULT_CANCEL: ggml_opt_result = 5; pub const ggml_opt_result_GGML_LINESEARCH_FAIL: ggml_opt_result = -128; pub const ggml_opt_result_GGML_LINESEARCH_MINIMUM_STEP: ggml_opt_result = -127; pub const ggml_opt_result_GGML_LINESEARCH_MAXIMUM_STEP: ggml_opt_result = -126; @@ -3595,103 +4784,29 @@ extern "C" { ) -> ggml_opt_result; } extern "C" { - pub fn ggml_quantize_q4_0( - src: *const f32, - dst: *mut ::std::os::raw::c_void, - n: ::std::os::raw::c_int, - k: ::std::os::raw::c_int, - hist: *mut i64, - ) -> usize; + pub fn ggml_set_input(tensor: *mut ggml_tensor); } extern "C" { - pub fn ggml_quantize_q4_1( - src: *const f32, - dst: *mut ::std::os::raw::c_void, - n: ::std::os::raw::c_int, - k: ::std::os::raw::c_int, - hist: *mut i64, - ) -> usize; + pub fn ggml_set_output(tensor: *mut ggml_tensor); } extern "C" { - pub fn ggml_quantize_q5_0( - src: *const f32, - dst: *mut ::std::os::raw::c_void, - n: ::std::os::raw::c_int, - k: ::std::os::raw::c_int, - hist: *mut i64, - ) -> usize; + pub fn ggml_quantize_init(type_: ggml_type); } extern "C" { - pub fn ggml_quantize_q5_1( - src: *const f32, - dst: *mut ::std::os::raw::c_void, - n: ::std::os::raw::c_int, - k: ::std::os::raw::c_int, - hist: *mut i64, - ) -> usize; + pub fn ggml_quantize_free(); } extern "C" { - pub fn ggml_quantize_q8_0( - src: *const f32, - dst: *mut ::std::os::raw::c_void, - n: ::std::os::raw::c_int, - k: ::std::os::raw::c_int, - hist: *mut i64, - ) -> usize; -} -extern "C" { - pub fn ggml_quantize_q2_K( - src: *const f32, - dst: *mut ::std::os::raw::c_void, - n: ::std::os::raw::c_int, - k: ::std::os::raw::c_int, - hist: *mut i64, - ) -> usize; -} -extern "C" { - pub fn ggml_quantize_q3_K( - src: *const f32, - dst: *mut ::std::os::raw::c_void, - n: ::std::os::raw::c_int, - k: ::std::os::raw::c_int, - hist: *mut i64, - ) -> usize; -} -extern "C" { - pub fn ggml_quantize_q4_K( - src: *const f32, - dst: *mut ::std::os::raw::c_void, - n: ::std::os::raw::c_int, - k: ::std::os::raw::c_int, - hist: *mut i64, - ) -> usize; -} -extern "C" { - pub fn ggml_quantize_q5_K( - src: *const f32, - dst: *mut ::std::os::raw::c_void, - n: ::std::os::raw::c_int, - k: ::std::os::raw::c_int, - hist: *mut i64, - ) -> usize; -} -extern "C" { - pub fn ggml_quantize_q6_K( - src: *const f32, - dst: *mut ::std::os::raw::c_void, - n: ::std::os::raw::c_int, - k: ::std::os::raw::c_int, - hist: *mut i64, - ) -> usize; + pub fn ggml_quantize_requires_imatrix(type_: ggml_type) -> bool; } extern "C" { pub fn ggml_quantize_chunk( type_: ggml_type, src: *const f32, dst: *mut ::std::os::raw::c_void, - start: ::std::os::raw::c_int, - n: ::std::os::raw::c_int, - hist: *mut i64, + start: i64, + nrows: i64, + n_per_row: i64, + imatrix: *const f32, ) -> usize; } pub const gguf_type_GGUF_TYPE_UINT8: gguf_type = 0; @@ -3888,6 +5003,9 @@ extern "C" { 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_remove_key(ctx: *mut gguf_context, key: *const ::std::os::raw::c_char); +} extern "C" { pub fn gguf_set_val_u8(ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, val: u8); } @@ -4022,11 +5140,17 @@ extern "C" { pub fn ggml_cpu_has_blas() -> ::std::os::raw::c_int; } extern "C" { - pub fn ggml_cpu_has_cublas() -> ::std::os::raw::c_int; + pub fn ggml_cpu_has_cuda() -> ::std::os::raw::c_int; } extern "C" { pub fn ggml_cpu_has_clblast() -> ::std::os::raw::c_int; } +extern "C" { + pub fn ggml_cpu_has_vulkan() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ggml_cpu_has_kompute() -> ::std::os::raw::c_int; +} extern "C" { pub fn ggml_cpu_has_gpublas() -> ::std::os::raw::c_int; } @@ -4036,21 +5160,31 @@ extern "C" { extern "C" { pub fn ggml_cpu_has_ssse3() -> ::std::os::raw::c_int; } +extern "C" { + pub fn ggml_cpu_has_sycl() -> ::std::os::raw::c_int; +} extern "C" { pub fn ggml_cpu_has_vsx() -> ::std::os::raw::c_int; } +extern "C" { + pub fn ggml_cpu_has_matmul_int8() -> ::std::os::raw::c_int; +} pub type ggml_to_float_t = ::std::option::Option< - unsafe extern "C" fn(x: *const ::std::os::raw::c_void, y: *mut f32, k: ::std::os::raw::c_int), + unsafe extern "C" fn(x: *const ::std::os::raw::c_void, y: *mut f32, k: i64), >; pub type ggml_from_float_t = ::std::option::Option< - unsafe extern "C" fn(x: *const f32, y: *mut ::std::os::raw::c_void, k: ::std::os::raw::c_int), + unsafe extern "C" fn(x: *const f32, y: *mut ::std::os::raw::c_void, k: i64), >; pub type ggml_vec_dot_t = ::std::option::Option< unsafe extern "C" fn( n: ::std::os::raw::c_int, s: *mut f32, + bs: usize, x: *const ::std::os::raw::c_void, + bx: usize, y: *const ::std::os::raw::c_void, + by: usize, + nrc: ::std::os::raw::c_int, ), >; #[repr(C)] @@ -4065,6 +5199,7 @@ pub struct ggml_type_traits_t { pub from_float_reference: ggml_from_float_t, pub vec_dot: ggml_vec_dot_t, pub vec_dot_type: ggml_type, + pub nrows: i64, } #[test] fn bindgen_test_layout_ggml_type_traits_t() { @@ -4072,7 +5207,7 @@ fn bindgen_test_layout_ggml_type_traits_t() { let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 72usize, + 80usize, concat!("Size of: ", stringify!(ggml_type_traits_t)) ); assert_eq!( @@ -4170,6 +5305,16 @@ fn bindgen_test_layout_ggml_type_traits_t() { stringify!(vec_dot_type) ) ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).nrows) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(ggml_type_traits_t), + "::", + stringify!(nrows) + ) + ); } extern "C" { pub fn ggml_internal_get_type_traits(type_: ggml_type) -> ggml_type_traits_t; @@ -4187,10 +5332,120 @@ pub struct whisper_state { pub type whisper_pos = i32; pub type whisper_token = i32; pub type whisper_seq_id = i32; +pub const whisper_alignment_heads_preset_WHISPER_AHEADS_NONE: whisper_alignment_heads_preset = 0; +pub const whisper_alignment_heads_preset_WHISPER_AHEADS_N_TOP_MOST: whisper_alignment_heads_preset = + 1; +pub const whisper_alignment_heads_preset_WHISPER_AHEADS_CUSTOM: whisper_alignment_heads_preset = 2; +pub const whisper_alignment_heads_preset_WHISPER_AHEADS_TINY_EN: whisper_alignment_heads_preset = 3; +pub const whisper_alignment_heads_preset_WHISPER_AHEADS_TINY: whisper_alignment_heads_preset = 4; +pub const whisper_alignment_heads_preset_WHISPER_AHEADS_BASE_EN: whisper_alignment_heads_preset = 5; +pub const whisper_alignment_heads_preset_WHISPER_AHEADS_BASE: whisper_alignment_heads_preset = 6; +pub const whisper_alignment_heads_preset_WHISPER_AHEADS_SMALL_EN: whisper_alignment_heads_preset = + 7; +pub const whisper_alignment_heads_preset_WHISPER_AHEADS_SMALL: whisper_alignment_heads_preset = 8; +pub const whisper_alignment_heads_preset_WHISPER_AHEADS_MEDIUM_EN: whisper_alignment_heads_preset = + 9; +pub const whisper_alignment_heads_preset_WHISPER_AHEADS_MEDIUM: whisper_alignment_heads_preset = 10; +pub const whisper_alignment_heads_preset_WHISPER_AHEADS_LARGE_V1: whisper_alignment_heads_preset = + 11; +pub const whisper_alignment_heads_preset_WHISPER_AHEADS_LARGE_V2: whisper_alignment_heads_preset = + 12; +pub const whisper_alignment_heads_preset_WHISPER_AHEADS_LARGE_V3: whisper_alignment_heads_preset = + 13; +pub type whisper_alignment_heads_preset = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct whisper_ahead { + pub n_text_layer: ::std::os::raw::c_int, + pub n_head: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_whisper_ahead() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(whisper_ahead)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(whisper_ahead)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).n_text_layer) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(whisper_ahead), + "::", + stringify!(n_text_layer) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).n_head) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(whisper_ahead), + "::", + stringify!(n_head) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct whisper_aheads { + pub n_heads: usize, + pub heads: *const whisper_ahead, +} +#[test] +fn bindgen_test_layout_whisper_aheads() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(whisper_aheads)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(whisper_aheads)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).n_heads) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(whisper_aheads), + "::", + stringify!(n_heads) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).heads) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(whisper_aheads), + "::", + stringify!(heads) + ) + ); +} #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct whisper_context_params { pub use_gpu: bool, + pub flash_attn: bool, + pub gpu_device: ::std::os::raw::c_int, + pub dtw_token_timestamps: bool, + pub dtw_aheads_preset: whisper_alignment_heads_preset, + pub dtw_n_top: ::std::os::raw::c_int, + pub dtw_aheads: whisper_aheads, + pub dtw_mem_size: usize, } #[test] fn bindgen_test_layout_whisper_context_params() { @@ -4199,12 +5454,12 @@ fn bindgen_test_layout_whisper_context_params() { let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 1usize, + 48usize, concat!("Size of: ", stringify!(whisper_context_params)) ); assert_eq!( ::std::mem::align_of::(), - 1usize, + 8usize, concat!("Alignment of ", stringify!(whisper_context_params)) ); assert_eq!( @@ -4217,6 +5472,76 @@ fn bindgen_test_layout_whisper_context_params() { stringify!(use_gpu) ) ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flash_attn) as usize - ptr as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(whisper_context_params), + "::", + stringify!(flash_attn) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).gpu_device) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(whisper_context_params), + "::", + stringify!(gpu_device) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).dtw_token_timestamps) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(whisper_context_params), + "::", + stringify!(dtw_token_timestamps) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).dtw_aheads_preset) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(whisper_context_params), + "::", + stringify!(dtw_aheads_preset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).dtw_n_top) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(whisper_context_params), + "::", + stringify!(dtw_n_top) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).dtw_aheads) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(whisper_context_params), + "::", + stringify!(dtw_aheads) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).dtw_mem_size) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(whisper_context_params), + "::", + stringify!(dtw_mem_size) + ) + ); } #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -4229,6 +5554,7 @@ pub struct whisper_token_data { pub ptsum: f32, pub t0: i64, pub t1: i64, + pub t_dtw: i64, pub vlen: f32, } #[test] @@ -4237,7 +5563,7 @@ fn bindgen_test_layout_whisper_token_data() { let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 48usize, + 56usize, concat!("Size of: ", stringify!(whisper_token_data)) ); assert_eq!( @@ -4326,8 +5652,18 @@ fn bindgen_test_layout_whisper_token_data() { ) ); assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).vlen) as usize - ptr as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).t_dtw) as usize - ptr as usize }, 40usize, + concat!( + "Offset of field: ", + stringify!(whisper_token_data), + "::", + stringify!(t_dtw) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).vlen) as usize - ptr as usize }, + 48usize, concat!( "Offset of field: ", stringify!(whisper_token_data), @@ -4637,6 +5973,12 @@ extern "C" { n_max_tokens: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } +extern "C" { + pub fn whisper_token_count( + ctx: *mut whisper_context, + text: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} extern "C" { pub fn whisper_lang_max_id() -> ::std::os::raw::c_int; } @@ -4803,8 +6145,6 @@ pub type whisper_encoder_begin_callback = ::std::option::Option< user_data: *mut ::std::os::raw::c_void, ) -> bool, >; -pub type whisper_abort_callback = - ::std::option::Option bool>; pub type whisper_logits_filter_callback = ::std::option::Option< unsafe extern "C" fn( ctx: *mut whisper_context, @@ -4841,6 +6181,7 @@ pub struct whisper_full_params { pub debug_mode: bool, pub audio_ctx: ::std::os::raw::c_int, pub tdrz_enable: bool, + pub suppress_regex: *const ::std::os::raw::c_char, pub initial_prompt: *const ::std::os::raw::c_char, pub prompt_tokens: *const whisper_token, pub prompt_n_tokens: ::std::os::raw::c_int, @@ -4863,7 +6204,7 @@ pub struct whisper_full_params { pub progress_callback_user_data: *mut ::std::os::raw::c_void, pub encoder_begin_callback: whisper_encoder_begin_callback, pub encoder_begin_callback_user_data: *mut ::std::os::raw::c_void, - pub abort_callback: whisper_abort_callback, + pub abort_callback: ggml_abort_callback, pub abort_callback_user_data: *mut ::std::os::raw::c_void, pub logits_filter_callback: whisper_logits_filter_callback, pub logits_filter_callback_user_data: *mut ::std::os::raw::c_void, @@ -4957,7 +6298,7 @@ fn bindgen_test_layout_whisper_full_params() { let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 256usize, + 264usize, concat!("Size of: ", stringify!(whisper_full_params)) ); assert_eq!( @@ -5196,8 +6537,18 @@ fn bindgen_test_layout_whisper_full_params() { ) ); assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).initial_prompt) as usize - ptr as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).suppress_regex) as usize - ptr as usize }, 64usize, + concat!( + "Offset of field: ", + stringify!(whisper_full_params), + "::", + stringify!(suppress_regex) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).initial_prompt) as usize - ptr as usize }, + 72usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5207,7 +6558,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).prompt_tokens) as usize - ptr as usize }, - 72usize, + 80usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5217,7 +6568,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).prompt_n_tokens) as usize - ptr as usize }, - 80usize, + 88usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5227,7 +6578,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).language) as usize - ptr as usize }, - 88usize, + 96usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5237,7 +6588,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).detect_language) as usize - ptr as usize }, - 96usize, + 104usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5247,7 +6598,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).suppress_blank) as usize - ptr as usize }, - 97usize, + 105usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5257,7 +6608,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).suppress_non_speech_tokens) as usize - ptr as usize }, - 98usize, + 106usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5267,7 +6618,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).temperature) as usize - ptr as usize }, - 100usize, + 108usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5277,7 +6628,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).max_initial_ts) as usize - ptr as usize }, - 104usize, + 112usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5287,7 +6638,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).length_penalty) as usize - ptr as usize }, - 108usize, + 116usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5297,7 +6648,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).temperature_inc) as usize - ptr as usize }, - 112usize, + 120usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5307,7 +6658,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).entropy_thold) as usize - ptr as usize }, - 116usize, + 124usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5317,7 +6668,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).logprob_thold) as usize - ptr as usize }, - 120usize, + 128usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5327,7 +6678,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).no_speech_thold) as usize - ptr as usize }, - 124usize, + 132usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5337,7 +6688,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).greedy) as usize - ptr as usize }, - 128usize, + 136usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5347,7 +6698,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).beam_search) as usize - ptr as usize }, - 132usize, + 140usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5357,7 +6708,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).new_segment_callback) as usize - ptr as usize }, - 144usize, + 152usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5369,7 +6720,7 @@ fn bindgen_test_layout_whisper_full_params() { unsafe { ::std::ptr::addr_of!((*ptr).new_segment_callback_user_data) as usize - ptr as usize }, - 152usize, + 160usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5379,7 +6730,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).progress_callback) as usize - ptr as usize }, - 160usize, + 168usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5389,7 +6740,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).progress_callback_user_data) as usize - ptr as usize }, - 168usize, + 176usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5399,7 +6750,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).encoder_begin_callback) as usize - ptr as usize }, - 176usize, + 184usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5411,7 +6762,7 @@ fn bindgen_test_layout_whisper_full_params() { unsafe { ::std::ptr::addr_of!((*ptr).encoder_begin_callback_user_data) as usize - ptr as usize }, - 184usize, + 192usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5421,7 +6772,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).abort_callback) as usize - ptr as usize }, - 192usize, + 200usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5431,7 +6782,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).abort_callback_user_data) as usize - ptr as usize }, - 200usize, + 208usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5441,7 +6792,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).logits_filter_callback) as usize - ptr as usize }, - 208usize, + 216usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5453,7 +6804,7 @@ fn bindgen_test_layout_whisper_full_params() { unsafe { ::std::ptr::addr_of!((*ptr).logits_filter_callback_user_data) as usize - ptr as usize }, - 216usize, + 224usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5463,7 +6814,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).grammar_rules) as usize - ptr as usize }, - 224usize, + 232usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5473,7 +6824,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).n_grammar_rules) as usize - ptr as usize }, - 232usize, + 240usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5483,7 +6834,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).i_start_rule) as usize - ptr as usize }, - 240usize, + 248usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5493,7 +6844,7 @@ fn bindgen_test_layout_whisper_full_params() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).grammar_penalty) as usize - ptr as usize }, - 248usize, + 256usize, concat!( "Offset of field: ", stringify!(whisper_full_params), @@ -5690,6 +7041,70 @@ 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 = [__va_list_tag; 1usize]; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __va_list_tag { + pub gp_offset: ::std::os::raw::c_uint, + pub fp_offset: ::std::os::raw::c_uint, + pub overflow_arg_area: *mut ::std::os::raw::c_void, + pub reg_save_area: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout___va_list_tag() { + const UNINIT: ::std::mem::MaybeUninit<__va_list_tag> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__va_list_tag>(), + 24usize, + concat!("Size of: ", stringify!(__va_list_tag)) + ); + assert_eq!( + ::std::mem::align_of::<__va_list_tag>(), + 8usize, + concat!("Alignment of ", stringify!(__va_list_tag)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).gp_offset) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(gp_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).fp_offset) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(fp_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).overflow_arg_area) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(overflow_arg_area) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).reg_save_area) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(reg_save_area) + ) + ); +} #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ggml_backend_buffer {