From 331b683cf087ee675cb659e9e1dac338b60c15a5 Mon Sep 17 00:00:00 2001 From: Niko Date: Sat, 7 Jun 2025 23:38:47 -0700 Subject: [PATCH] Bump bindings to v1.7.5 of upstream whisper.cpp --- sys/Cargo.toml | 2 +- sys/src/bindings.rs | 3354 +++++++++++++++++++++++++------------------ 2 files changed, 1989 insertions(+), 1367 deletions(-) diff --git a/sys/Cargo.toml b/sys/Cargo.toml index c97c9a2..adbc89c 100644 --- a/sys/Cargo.toml +++ b/sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "whisper-rs-sys" -version = "0.12.1" +version = "0.13.0" edition = "2021" description = "Rust bindings for whisper.cpp (FFI bindings)" license = "Unlicense" diff --git a/sys/src/bindings.rs b/sys/src/bindings.rs index 34ab674..088c6ae 100644 --- a/sys/src/bindings.rs +++ b/sys/src/bindings.rs @@ -1,11 +1,155 @@ -/* automatically generated by rust-bindgen 0.70.1 */ +/* automatically generated by rust-bindgen 0.71.1 */ +#[repr(C)] +#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub struct __BindgenBitfieldUnit { + storage: Storage, +} +impl __BindgenBitfieldUnit { + #[inline] + pub const fn new(storage: Storage) -> Self { + Self { storage } + } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ + #[inline] + fn extract_bit(byte: u8, index: usize) -> bool { + let bit_index = if cfg!(target_endian = "big") { + 7 - (index % 8) + } else { + index % 8 + }; + let mask = 1 << bit_index; + byte & mask == mask + } + #[inline] + pub fn get_bit(&self, index: usize) -> bool { + debug_assert!(index / 8 < self.storage.as_ref().len()); + let byte_index = index / 8; + let byte = self.storage.as_ref()[byte_index]; + Self::extract_bit(byte, index) + } + #[inline] + pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool { + debug_assert!(index / 8 < core::mem::size_of::()); + let byte_index = index / 8; + let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize); + Self::extract_bit(byte, index) + } + #[inline] + fn change_bit(byte: u8, index: usize, val: bool) -> u8 { + let bit_index = if cfg!(target_endian = "big") { + 7 - (index % 8) + } else { + index % 8 + }; + let mask = 1 << bit_index; + if val { + byte | mask + } else { + byte & !mask + } + } + #[inline] + pub fn set_bit(&mut self, index: usize, val: bool) { + debug_assert!(index / 8 < self.storage.as_ref().len()); + let byte_index = index / 8; + let byte = &mut self.storage.as_mut()[byte_index]; + *byte = Self::change_bit(*byte, index, val); + } + #[inline] + pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) { + debug_assert!(index / 8 < core::mem::size_of::()); + let byte_index = index / 8; + let byte = + (core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize); + *byte = Self::change_bit(*byte, index, val); + } + #[inline] + pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + let mut val = 0; + for i in 0..(bit_width as usize) { + if self.get_bit(i + bit_offset) { + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + val |= 1 << index; + } + } + val + } + #[inline] + pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < core::mem::size_of::()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::()); + let mut val = 0; + for i in 0..(bit_width as usize) { + if Self::raw_get_bit(this, i + bit_offset) { + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + val |= 1 << index; + } + } + val + } + #[inline] + pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + for i in 0..(bit_width as usize) { + let mask = 1 << i; + let val_bit_is_set = val & mask == mask; + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + self.set_bit(index + bit_offset, val_bit_is_set); + } + } + #[inline] + pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < core::mem::size_of::()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::()); + for i in 0..(bit_width as usize) { + let mask = 1 << i; + let val_bit_is_set = val & mask == mask; + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + Self::raw_set_bit(this, index + bit_offset, val_bit_is_set); + } + } +} +#[derive(PartialEq, Copy, Clone, Hash, Debug, Default)] +#[repr(C)] +pub struct __BindgenComplex { + pub re: T, + pub im: T, +} 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; +pub const __GLIBC_USE_ISOC2Y: u32 = 0; pub const __GLIBC_USE_ISOC23: u32 = 0; pub const __USE_ISOC11: u32 = 1; pub const __USE_ISOC99: u32 = 1; @@ -39,7 +183,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 = 40; +pub const __GLIBC_MINOR__: u32 = 41; pub const _SYS_CDEFS_H: u32 = 1; pub const __glibc_c99_flexarr_available: u32 = 1; pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0; @@ -127,8 +271,8 @@ pub const _BITS_STDIO_LIM_H: u32 = 1; 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_FLOAT128: u32 = 1; +pub const __HAVE_DISTINCT_FLOAT128: u32 = 1; pub const __HAVE_FLOAT64X: u32 = 1; pub const __HAVE_FLOAT64X_LONG_DOUBLE: u32 = 1; pub const __HAVE_FLOAT16: u32 = 0; @@ -159,6 +303,8 @@ pub const GGML_MEM_ALIGN: u32 = 16; pub const GGML_EXIT_SUCCESS: u32 = 0; pub const GGML_EXIT_ABORTED: u32 = 1; pub const GGML_ROPE_TYPE_NEOX: u32 = 2; +pub const GGML_ROPE_TYPE_MROPE: u32 = 8; +pub const GGML_ROPE_TYPE_VISION: u32 = 24; pub const GGUF_MAGIC: &[u8; 5] = b"GGUF\0"; pub const GGUF_VERSION: u32 = 3; pub const GGUF_DEFAULT_ALIGNMENT: u32 = 32; @@ -375,7 +521,9 @@ pub struct _IO_FILE { 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 _bitfield_align_1: [u32; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 3usize]>, + pub _short_backupbuf: [::std::os::raw::c_char; 1usize], pub _old_offset: __off_t, pub _cur_column: ::std::os::raw::c_ushort, pub _vtable_offset: ::std::os::raw::c_schar, @@ -420,7 +568,8 @@ const _: () = { ["Offset of field: _IO_FILE::_markers"][::std::mem::offset_of!(_IO_FILE, _markers) - 96usize]; ["Offset of field: _IO_FILE::_chain"][::std::mem::offset_of!(_IO_FILE, _chain) - 104usize]; ["Offset of field: _IO_FILE::_fileno"][::std::mem::offset_of!(_IO_FILE, _fileno) - 112usize]; - ["Offset of field: _IO_FILE::_flags2"][::std::mem::offset_of!(_IO_FILE, _flags2) - 116usize]; + ["Offset of field: _IO_FILE::_short_backupbuf"] + [::std::mem::offset_of!(_IO_FILE, _short_backupbuf) - 119usize]; ["Offset of field: _IO_FILE::_old_offset"] [::std::mem::offset_of!(_IO_FILE, _old_offset) - 120usize]; ["Offset of field: _IO_FILE::_cur_column"] @@ -443,6 +592,50 @@ const _: () = { ["Offset of field: _IO_FILE::_mode"][::std::mem::offset_of!(_IO_FILE, _mode) - 192usize]; ["Offset of field: _IO_FILE::_unused2"][::std::mem::offset_of!(_IO_FILE, _unused2) - 196usize]; }; +impl _IO_FILE { + #[inline] + pub fn _flags2(&self) -> ::std::os::raw::c_int { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 24u8) as u32) } + } + #[inline] + pub fn set__flags2(&mut self, val: ::std::os::raw::c_int) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 24u8, val as u64) + } + } + #[inline] + pub unsafe fn _flags2_raw(this: *const Self) -> ::std::os::raw::c_int { + unsafe { + ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 3usize]>>::raw_get( + ::std::ptr::addr_of!((*this)._bitfield_1), + 0usize, + 24u8, + ) as u32) + } + } + #[inline] + pub unsafe fn set__flags2_raw(this: *mut Self, val: ::std::os::raw::c_int) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + <__BindgenBitfieldUnit<[u8; 3usize]>>::raw_set( + ::std::ptr::addr_of_mut!((*this)._bitfield_1), + 0usize, + 24u8, + val as u64, + ) + } + } + #[inline] + pub fn new_bitfield_1(_flags2: ::std::os::raw::c_int) -> __BindgenBitfieldUnit<[u8; 3usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 3usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 24u8, { + let _flags2: u32 = unsafe { ::std::mem::transmute(_flags2) }; + _flags2 as u64 + }); + __bindgen_bitfield_unit + } +} pub type cookie_read_function_t = ::std::option::Option< unsafe extern "C" fn( __cookie: *mut ::std::os::raw::c_void, @@ -494,25 +687,25 @@ pub type cookie_io_functions_t = _IO_cookie_io_functions_t; pub type va_list = __gnuc_va_list; pub type off_t = __off_t; pub type fpos_t = __fpos_t; -extern "C" { +unsafe extern "C" { pub static mut stdin: *mut FILE; } -extern "C" { +unsafe extern "C" { pub static mut stdout: *mut FILE; } -extern "C" { +unsafe extern "C" { pub static mut stderr: *mut FILE; } -extern "C" { +unsafe extern "C" { pub fn remove(__filename: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; } -extern "C" { +unsafe 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" { +unsafe extern "C" { pub fn renameat( __oldfd: ::std::os::raw::c_int, __old: *const ::std::os::raw::c_char, @@ -520,71 +713,71 @@ extern "C" { __new: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn fclose(__stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn tmpfile() -> *mut FILE; } -extern "C" { +unsafe extern "C" { pub fn tmpnam(arg1: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn tmpnam_r(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe 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" { +unsafe extern "C" { pub fn fflush(__stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn fflush_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn fopen( __filename: *const ::std::os::raw::c_char, __modes: *const ::std::os::raw::c_char, ) -> *mut FILE; } -extern "C" { +unsafe 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" { +unsafe extern "C" { pub fn fdopen(__fd: ::std::os::raw::c_int, __modes: *const ::std::os::raw::c_char) -> *mut FILE; } -extern "C" { +unsafe extern "C" { pub fn fopencookie( __magic_cookie: *mut ::std::os::raw::c_void, __modes: *const ::std::os::raw::c_char, __io_funcs: cookie_io_functions_t, ) -> *mut FILE; } -extern "C" { +unsafe 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" { +unsafe extern "C" { pub fn open_memstream( __bufloc: *mut *mut ::std::os::raw::c_char, __sizeloc: *mut usize, ) -> *mut FILE; } -extern "C" { +unsafe extern "C" { pub fn setbuf(__stream: *mut FILE, __buf: *mut ::std::os::raw::c_char); } -extern "C" { +unsafe extern "C" { pub fn setvbuf( __stream: *mut FILE, __buf: *mut ::std::os::raw::c_char, @@ -592,50 +785,50 @@ extern "C" { __n: usize, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn setbuffer(__stream: *mut FILE, __buf: *mut ::std::os::raw::c_char, __size: usize); } -extern "C" { +unsafe extern "C" { pub fn setlinebuf(__stream: *mut FILE); } -extern "C" { +unsafe extern "C" { pub fn fprintf( __stream: *mut FILE, __format: *const ::std::os::raw::c_char, ... ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn printf(__format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; } -extern "C" { +unsafe 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" { +unsafe 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" { +unsafe extern "C" { pub fn vprintf( __format: *const ::std::os::raw::c_char, __arg: *mut __va_list_tag, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe 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" { +unsafe extern "C" { pub fn snprintf( __s: *mut ::std::os::raw::c_char, __maxlen: ::std::os::raw::c_ulong, @@ -643,7 +836,7 @@ extern "C" { ... ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn vsnprintf( __s: *mut ::std::os::raw::c_char, __maxlen: ::std::os::raw::c_ulong, @@ -651,63 +844,65 @@ extern "C" { __arg: *mut __va_list_tag, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn vasprintf( __ptr: *mut *mut ::std::os::raw::c_char, __f: *const ::std::os::raw::c_char, __arg: *mut __va_list_tag, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn __asprintf( __ptr: *mut *mut ::std::os::raw::c_char, __fmt: *const ::std::os::raw::c_char, ... ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn asprintf( __ptr: *mut *mut ::std::os::raw::c_char, __fmt: *const ::std::os::raw::c_char, ... ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe 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" { +unsafe 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" { +unsafe extern "C" { pub fn fscanf( __stream: *mut FILE, __format: *const ::std::os::raw::c_char, ... ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn scanf(__format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; } -extern "C" { +unsafe 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 __cfloat128 = __BindgenComplex; +pub type _Float128 = u128; pub type _Float32 = f32; pub type _Float64 = f64; pub type _Float32x = f64; pub type _Float64x = u128; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}__isoc99_fscanf"] pub fn fscanf1( __stream: *mut FILE, @@ -715,11 +910,11 @@ extern "C" { ... ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe 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" { +unsafe extern "C" { #[link_name = "\u{1}__isoc99_sscanf"] pub fn sscanf1( __s: *const ::std::os::raw::c_char, @@ -727,27 +922,27 @@ extern "C" { ... ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe 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" { +unsafe extern "C" { pub fn vscanf( __format: *const ::std::os::raw::c_char, __arg: *mut __va_list_tag, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe 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" { +unsafe extern "C" { #[link_name = "\u{1}__isoc99_vfscanf"] pub fn vfscanf1( __s: *mut FILE, @@ -755,14 +950,14 @@ extern "C" { __arg: *mut __va_list_tag, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe 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" { +unsafe extern "C" { #[link_name = "\u{1}__isoc99_vsscanf"] pub fn vsscanf1( __s: *const ::std::os::raw::c_char, @@ -770,57 +965,57 @@ extern "C" { __arg: *mut __va_list_tag, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn fgetc(__stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn getc(__stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn getchar() -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn getc_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn getchar_unlocked() -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn fgetc_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn fputc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn putc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn putchar(__c: ::std::os::raw::c_int) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn fputc_unlocked(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn putc_unlocked(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn putchar_unlocked(__c: ::std::os::raw::c_int) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn getw(__stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn putw(__w: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe 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" { +unsafe extern "C" { pub fn __getdelim( __lineptr: *mut *mut ::std::os::raw::c_char, __n: *mut usize, @@ -828,7 +1023,7 @@ extern "C" { __stream: *mut FILE, ) -> __ssize_t; } -extern "C" { +unsafe extern "C" { pub fn getdelim( __lineptr: *mut *mut ::std::os::raw::c_char, __n: *mut usize, @@ -836,23 +1031,23 @@ extern "C" { __stream: *mut FILE, ) -> __ssize_t; } -extern "C" { +unsafe extern "C" { pub fn getline( __lineptr: *mut *mut ::std::os::raw::c_char, __n: *mut usize, __stream: *mut FILE, ) -> __ssize_t; } -extern "C" { +unsafe extern "C" { pub fn fputs(__s: *const ::std::os::raw::c_char, __stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn puts(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ungetc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn fread( __ptr: *mut ::std::os::raw::c_void, __size: ::std::os::raw::c_ulong, @@ -860,7 +1055,7 @@ extern "C" { __stream: *mut FILE, ) -> ::std::os::raw::c_ulong; } -extern "C" { +unsafe extern "C" { pub fn fwrite( __ptr: *const ::std::os::raw::c_void, __size: ::std::os::raw::c_ulong, @@ -868,7 +1063,7 @@ extern "C" { __s: *mut FILE, ) -> ::std::os::raw::c_ulong; } -extern "C" { +unsafe extern "C" { pub fn fread_unlocked( __ptr: *mut ::std::os::raw::c_void, __size: usize, @@ -876,7 +1071,7 @@ extern "C" { __stream: *mut FILE, ) -> usize; } -extern "C" { +unsafe extern "C" { pub fn fwrite_unlocked( __ptr: *const ::std::os::raw::c_void, __size: usize, @@ -884,90 +1079,90 @@ extern "C" { __stream: *mut FILE, ) -> usize; } -extern "C" { +unsafe 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" { +unsafe extern "C" { pub fn ftell(__stream: *mut FILE) -> ::std::os::raw::c_long; } -extern "C" { +unsafe extern "C" { pub fn rewind(__stream: *mut FILE); } -extern "C" { +unsafe extern "C" { pub fn fseeko( __stream: *mut FILE, __off: __off_t, __whence: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ftello(__stream: *mut FILE) -> __off_t; } -extern "C" { +unsafe extern "C" { pub fn fgetpos(__stream: *mut FILE, __pos: *mut fpos_t) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn fsetpos(__stream: *mut FILE, __pos: *const fpos_t) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn clearerr(__stream: *mut FILE); } -extern "C" { +unsafe extern "C" { pub fn feof(__stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ferror(__stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn clearerr_unlocked(__stream: *mut FILE); } -extern "C" { +unsafe extern "C" { pub fn feof_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ferror_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn perror(__s: *const ::std::os::raw::c_char); } -extern "C" { +unsafe extern "C" { pub fn fileno(__stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn fileno_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn pclose(__stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn popen( __command: *const ::std::os::raw::c_char, __modes: *const ::std::os::raw::c_char, ) -> *mut FILE; } -extern "C" { +unsafe extern "C" { pub fn ctermid(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn flockfile(__stream: *mut FILE); } -extern "C" { +unsafe extern "C" { pub fn ftrylockfile(__stream: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn funlockfile(__stream: *mut FILE); } -extern "C" { +unsafe extern "C" { pub fn __uflow(arg1: *mut FILE) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn __overflow(arg1: *mut FILE, arg2: ::std::os::raw::c_int) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ggml_abort( file: *const ::std::os::raw::c_char, line: ::std::os::raw::c_int, @@ -980,20 +1175,20 @@ 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" { +unsafe 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" { +unsafe extern "C" { pub fn ggml_fp16_to_fp32(arg1: ggml_fp16_t) -> f32; } -extern "C" { +unsafe extern "C" { pub fn ggml_fp32_to_fp16(arg1: f32) -> ggml_fp16_t; } -extern "C" { +unsafe extern "C" { pub fn ggml_fp16_to_fp32_row(arg1: *const ggml_fp16_t, arg2: *mut f32, arg3: i64); } -extern "C" { +unsafe extern "C" { pub fn ggml_fp32_to_fp16_row(arg1: *const f32, arg2: *mut ggml_fp16_t, arg3: i64); } #[repr(C)] @@ -1007,19 +1202,19 @@ const _: () = { ["Alignment of ggml_bf16_t"][::std::mem::align_of::() - 2usize]; ["Offset of field: ggml_bf16_t::bits"][::std::mem::offset_of!(ggml_bf16_t, bits) - 0usize]; }; -extern "C" { +unsafe extern "C" { pub fn ggml_fp32_to_bf16(arg1: f32) -> ggml_bf16_t; } -extern "C" { +unsafe extern "C" { pub fn ggml_bf16_to_fp32(arg1: ggml_bf16_t) -> f32; } -extern "C" { +unsafe extern "C" { pub fn ggml_bf16_to_fp32_row(arg1: *const ggml_bf16_t, arg2: *mut f32, arg3: i64); } -extern "C" { +unsafe extern "C" { pub fn ggml_fp32_to_bf16_row_ref(arg1: *const f32, arg2: *mut ggml_bf16_t, arg3: i64); } -extern "C" { +unsafe extern "C" { pub fn ggml_fp32_to_bf16_row(arg1: *const f32, arg2: *mut ggml_bf16_t, arg3: i64); } #[repr(C)] @@ -1066,12 +1261,9 @@ 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_Q4_0_4_4: ggml_type = 31; -pub const ggml_type_GGML_TYPE_Q4_0_4_8: ggml_type = 32; -pub const ggml_type_GGML_TYPE_Q4_0_8_8: ggml_type = 33; pub const ggml_type_GGML_TYPE_TQ1_0: ggml_type = 34; pub const ggml_type_GGML_TYPE_TQ2_0: ggml_type = 35; -pub const ggml_type_GGML_TYPE_COUNT: ggml_type = 36; +pub const ggml_type_GGML_TYPE_COUNT: ggml_type = 39; 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; @@ -1104,9 +1296,6 @@ 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 const ggml_ftype_GGML_FTYPE_MOSTLY_Q4_0_4_4: ggml_ftype = 25; -pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q4_0_4_8: ggml_ftype = 26; -pub const ggml_ftype_GGML_FTYPE_MOSTLY_Q4_0_8_8: ggml_ftype = 27; 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; @@ -1164,32 +1353,33 @@ pub const ggml_op_GGML_OP_POOL_2D: ggml_op = 52; pub const ggml_op_GGML_OP_POOL_2D_BACK: ggml_op = 53; pub const ggml_op_GGML_OP_UPSCALE: ggml_op = 54; pub const ggml_op_GGML_OP_PAD: ggml_op = 55; -pub const ggml_op_GGML_OP_ARANGE: ggml_op = 56; -pub const ggml_op_GGML_OP_TIMESTEP_EMBEDDING: ggml_op = 57; -pub const ggml_op_GGML_OP_ARGSORT: ggml_op = 58; -pub const ggml_op_GGML_OP_LEAKY_RELU: ggml_op = 59; -pub const ggml_op_GGML_OP_FLASH_ATTN_EXT: ggml_op = 60; -pub const ggml_op_GGML_OP_FLASH_ATTN_BACK: ggml_op = 61; -pub const ggml_op_GGML_OP_SSM_CONV: ggml_op = 62; -pub const ggml_op_GGML_OP_SSM_SCAN: ggml_op = 63; -pub const ggml_op_GGML_OP_WIN_PART: ggml_op = 64; -pub const ggml_op_GGML_OP_WIN_UNPART: ggml_op = 65; -pub const ggml_op_GGML_OP_GET_REL_POS: ggml_op = 66; -pub const ggml_op_GGML_OP_ADD_REL_POS: ggml_op = 67; -pub const ggml_op_GGML_OP_RWKV_WKV: ggml_op = 68; -pub const ggml_op_GGML_OP_UNARY: ggml_op = 69; -pub const ggml_op_GGML_OP_MAP_UNARY: ggml_op = 70; -pub const ggml_op_GGML_OP_MAP_BINARY: ggml_op = 71; -pub const ggml_op_GGML_OP_MAP_CUSTOM1_F32: ggml_op = 72; -pub const ggml_op_GGML_OP_MAP_CUSTOM2_F32: ggml_op = 73; -pub const ggml_op_GGML_OP_MAP_CUSTOM3_F32: ggml_op = 74; -pub const ggml_op_GGML_OP_MAP_CUSTOM1: ggml_op = 75; -pub const ggml_op_GGML_OP_MAP_CUSTOM2: ggml_op = 76; -pub const ggml_op_GGML_OP_MAP_CUSTOM3: ggml_op = 77; -pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS: ggml_op = 78; -pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS_BACK: ggml_op = 79; -pub const ggml_op_GGML_OP_OPT_STEP_ADAMW: ggml_op = 80; -pub const ggml_op_GGML_OP_COUNT: ggml_op = 81; +pub const ggml_op_GGML_OP_PAD_REFLECT_1D: ggml_op = 56; +pub const ggml_op_GGML_OP_ARANGE: ggml_op = 57; +pub const ggml_op_GGML_OP_TIMESTEP_EMBEDDING: ggml_op = 58; +pub const ggml_op_GGML_OP_ARGSORT: ggml_op = 59; +pub const ggml_op_GGML_OP_LEAKY_RELU: ggml_op = 60; +pub const ggml_op_GGML_OP_FLASH_ATTN_EXT: ggml_op = 61; +pub const ggml_op_GGML_OP_FLASH_ATTN_BACK: ggml_op = 62; +pub const ggml_op_GGML_OP_SSM_CONV: ggml_op = 63; +pub const ggml_op_GGML_OP_SSM_SCAN: ggml_op = 64; +pub const ggml_op_GGML_OP_WIN_PART: ggml_op = 65; +pub const ggml_op_GGML_OP_WIN_UNPART: ggml_op = 66; +pub const ggml_op_GGML_OP_GET_REL_POS: ggml_op = 67; +pub const ggml_op_GGML_OP_ADD_REL_POS: ggml_op = 68; +pub const ggml_op_GGML_OP_RWKV_WKV6: ggml_op = 69; +pub const ggml_op_GGML_OP_UNARY: ggml_op = 70; +pub const ggml_op_GGML_OP_MAP_UNARY: ggml_op = 71; +pub const ggml_op_GGML_OP_MAP_BINARY: ggml_op = 72; +pub const ggml_op_GGML_OP_MAP_CUSTOM1_F32: ggml_op = 73; +pub const ggml_op_GGML_OP_MAP_CUSTOM2_F32: ggml_op = 74; +pub const ggml_op_GGML_OP_MAP_CUSTOM3_F32: ggml_op = 75; +pub const ggml_op_GGML_OP_MAP_CUSTOM1: ggml_op = 76; +pub const ggml_op_GGML_OP_MAP_CUSTOM2: ggml_op = 77; +pub const ggml_op_GGML_OP_MAP_CUSTOM3: ggml_op = 78; +pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS: ggml_op = 79; +pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS_BACK: ggml_op = 80; +pub const ggml_op_GGML_OP_OPT_STEP_ADAMW: ggml_op = 81; +pub const ggml_op_GGML_OP_COUNT: ggml_op = 82; 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; @@ -1212,10 +1402,10 @@ 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_NONE: ggml_log_level = 0; -pub const ggml_log_level_GGML_LOG_LEVEL_INFO: ggml_log_level = 1; -pub const ggml_log_level_GGML_LOG_LEVEL_WARN: ggml_log_level = 2; -pub const ggml_log_level_GGML_LOG_LEVEL_ERROR: ggml_log_level = 3; -pub const ggml_log_level_GGML_LOG_LEVEL_DEBUG: ggml_log_level = 4; +pub const ggml_log_level_GGML_LOG_LEVEL_DEBUG: ggml_log_level = 1; +pub const ggml_log_level_GGML_LOG_LEVEL_INFO: 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_ERROR: ggml_log_level = 4; pub const ggml_log_level_GGML_LOG_LEVEL_CONT: 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; @@ -1225,133 +1415,6 @@ pub const ggml_tensor_flag_GGML_TENSOR_FLAG_LOSS: ggml_tensor_flag = 8; pub type ggml_tensor_flag = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct ggml_tensor { - pub type_: ggml_type, - pub backend: ggml_backend_type, - pub buffer: *mut ggml_backend_buffer, - pub ne: [i64; 4usize], - pub nb: [usize; 4usize], - pub op: ggml_op, - pub op_params: [i32; 16usize], - pub flags: i32, - pub grad: *mut ggml_tensor, - pub src: [*mut ggml_tensor; 10usize], - pub view_src: *mut ggml_tensor, - pub view_offs: usize, - pub data: *mut ::std::os::raw::c_void, - pub name: [::std::os::raw::c_char; 64usize], - pub extra: *mut ::std::os::raw::c_void, -} -#[allow(clippy::unnecessary_operation, clippy::identity_op)] -const _: () = { - ["Size of ggml_tensor"][::std::mem::size_of::() - 336usize]; - ["Alignment of ggml_tensor"][::std::mem::align_of::() - 8usize]; - ["Offset of field: ggml_tensor::type_"][::std::mem::offset_of!(ggml_tensor, type_) - 0usize]; - ["Offset of field: ggml_tensor::backend"] - [::std::mem::offset_of!(ggml_tensor, backend) - 4usize]; - ["Offset of field: ggml_tensor::buffer"][::std::mem::offset_of!(ggml_tensor, buffer) - 8usize]; - ["Offset of field: ggml_tensor::ne"][::std::mem::offset_of!(ggml_tensor, ne) - 16usize]; - ["Offset of field: ggml_tensor::nb"][::std::mem::offset_of!(ggml_tensor, nb) - 48usize]; - ["Offset of field: ggml_tensor::op"][::std::mem::offset_of!(ggml_tensor, op) - 80usize]; - ["Offset of field: ggml_tensor::op_params"] - [::std::mem::offset_of!(ggml_tensor, op_params) - 84usize]; - ["Offset of field: ggml_tensor::flags"][::std::mem::offset_of!(ggml_tensor, flags) - 148usize]; - ["Offset of field: ggml_tensor::grad"][::std::mem::offset_of!(ggml_tensor, grad) - 152usize]; - ["Offset of field: ggml_tensor::src"][::std::mem::offset_of!(ggml_tensor, src) - 160usize]; - ["Offset of field: ggml_tensor::view_src"] - [::std::mem::offset_of!(ggml_tensor, view_src) - 240usize]; - ["Offset of field: ggml_tensor::view_offs"] - [::std::mem::offset_of!(ggml_tensor, view_offs) - 248usize]; - ["Offset of field: ggml_tensor::data"][::std::mem::offset_of!(ggml_tensor, data) - 256usize]; - ["Offset of field: ggml_tensor::name"][::std::mem::offset_of!(ggml_tensor, name) - 264usize]; - ["Offset of field: ggml_tensor::extra"][::std::mem::offset_of!(ggml_tensor, extra) - 328usize]; -}; -pub const GGML_TENSOR_SIZE: usize = 336; -pub type ggml_abort_callback = - ::std::option::Option bool>; -pub const ggml_sched_priority_GGML_SCHED_PRIO_NORMAL: ggml_sched_priority = 0; -pub const ggml_sched_priority_GGML_SCHED_PRIO_MEDIUM: ggml_sched_priority = 1; -pub const ggml_sched_priority_GGML_SCHED_PRIO_HIGH: ggml_sched_priority = 2; -pub const ggml_sched_priority_GGML_SCHED_PRIO_REALTIME: ggml_sched_priority = 3; -pub type ggml_sched_priority = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ggml_threadpool_params { - pub cpumask: [bool; 512usize], - pub n_threads: ::std::os::raw::c_int, - pub prio: ggml_sched_priority, - pub poll: u32, - pub strict_cpu: bool, - pub paused: bool, -} -#[allow(clippy::unnecessary_operation, clippy::identity_op)] -const _: () = { - ["Size of ggml_threadpool_params"][::std::mem::size_of::() - 528usize]; - ["Alignment of ggml_threadpool_params"] - [::std::mem::align_of::() - 4usize]; - ["Offset of field: ggml_threadpool_params::cpumask"] - [::std::mem::offset_of!(ggml_threadpool_params, cpumask) - 0usize]; - ["Offset of field: ggml_threadpool_params::n_threads"] - [::std::mem::offset_of!(ggml_threadpool_params, n_threads) - 512usize]; - ["Offset of field: ggml_threadpool_params::prio"] - [::std::mem::offset_of!(ggml_threadpool_params, prio) - 516usize]; - ["Offset of field: ggml_threadpool_params::poll"] - [::std::mem::offset_of!(ggml_threadpool_params, poll) - 520usize]; - ["Offset of field: ggml_threadpool_params::strict_cpu"] - [::std::mem::offset_of!(ggml_threadpool_params, strict_cpu) - 524usize]; - ["Offset of field: ggml_threadpool_params::paused"] - [::std::mem::offset_of!(ggml_threadpool_params, paused) - 525usize]; -}; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ggml_threadpool { - _unused: [u8; 0], -} -pub type ggml_threadpool_t = *mut ggml_threadpool; -#[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 threadpool: *mut ggml_threadpool, - pub abort_callback: ggml_abort_callback, - pub abort_callback_data: *mut ::std::os::raw::c_void, -} -#[allow(clippy::unnecessary_operation, clippy::identity_op)] -const _: () = { - ["Size of ggml_cplan"][::std::mem::size_of::() - 48usize]; - ["Alignment of ggml_cplan"][::std::mem::align_of::() - 8usize]; - ["Offset of field: ggml_cplan::work_size"] - [::std::mem::offset_of!(ggml_cplan, work_size) - 0usize]; - ["Offset of field: ggml_cplan::work_data"] - [::std::mem::offset_of!(ggml_cplan, work_data) - 8usize]; - ["Offset of field: ggml_cplan::n_threads"] - [::std::mem::offset_of!(ggml_cplan, n_threads) - 16usize]; - ["Offset of field: ggml_cplan::threadpool"] - [::std::mem::offset_of!(ggml_cplan, threadpool) - 24usize]; - ["Offset of field: ggml_cplan::abort_callback"] - [::std::mem::offset_of!(ggml_cplan, abort_callback) - 32usize]; - ["Offset of field: ggml_cplan::abort_callback_data"] - [::std::mem::offset_of!(ggml_cplan, abort_callback_data) - 40usize]; -}; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ggml_scratch { - pub offs: usize, - pub size: usize, - pub data: *mut ::std::os::raw::c_void, -} -#[allow(clippy::unnecessary_operation, clippy::identity_op)] -const _: () = { - ["Size of ggml_scratch"][::std::mem::size_of::() - 24usize]; - ["Alignment of ggml_scratch"][::std::mem::align_of::() - 8usize]; - ["Offset of field: ggml_scratch::offs"][::std::mem::offset_of!(ggml_scratch, offs) - 0usize]; - ["Offset of field: ggml_scratch::size"][::std::mem::offset_of!(ggml_scratch, size) - 8usize]; - ["Offset of field: ggml_scratch::data"][::std::mem::offset_of!(ggml_scratch, data) - 16usize]; -}; -#[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct ggml_init_params { pub mem_size: usize, pub mem_buffer: *mut ::std::os::raw::c_void, @@ -1368,185 +1431,216 @@ const _: () = { ["Offset of field: ggml_init_params::no_alloc"] [::std::mem::offset_of!(ggml_init_params, no_alloc) - 16usize]; }; -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; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ggml_tensor { + pub type_: ggml_type, + pub backend: ggml_backend_type, + pub buffer: *mut ggml_backend_buffer, + pub ne: [i64; 4usize], + pub nb: [usize; 4usize], + pub op: ggml_op, + pub op_params: [i32; 16usize], + pub flags: i32, + pub src: [*mut ggml_tensor; 10usize], + pub view_src: *mut ggml_tensor, + pub view_offs: usize, + 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; 8usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ggml_tensor"][::std::mem::size_of::() - 336usize]; + ["Alignment of ggml_tensor"][::std::mem::align_of::() - 8usize]; + ["Offset of field: ggml_tensor::type_"][::std::mem::offset_of!(ggml_tensor, type_) - 0usize]; + ["Offset of field: ggml_tensor::backend"] + [::std::mem::offset_of!(ggml_tensor, backend) - 4usize]; + ["Offset of field: ggml_tensor::buffer"][::std::mem::offset_of!(ggml_tensor, buffer) - 8usize]; + ["Offset of field: ggml_tensor::ne"][::std::mem::offset_of!(ggml_tensor, ne) - 16usize]; + ["Offset of field: ggml_tensor::nb"][::std::mem::offset_of!(ggml_tensor, nb) - 48usize]; + ["Offset of field: ggml_tensor::op"][::std::mem::offset_of!(ggml_tensor, op) - 80usize]; + ["Offset of field: ggml_tensor::op_params"] + [::std::mem::offset_of!(ggml_tensor, op_params) - 84usize]; + ["Offset of field: ggml_tensor::flags"][::std::mem::offset_of!(ggml_tensor, flags) - 148usize]; + ["Offset of field: ggml_tensor::src"][::std::mem::offset_of!(ggml_tensor, src) - 152usize]; + ["Offset of field: ggml_tensor::view_src"] + [::std::mem::offset_of!(ggml_tensor, view_src) - 232usize]; + ["Offset of field: ggml_tensor::view_offs"] + [::std::mem::offset_of!(ggml_tensor, view_offs) - 240usize]; + ["Offset of field: ggml_tensor::data"][::std::mem::offset_of!(ggml_tensor, data) - 248usize]; + ["Offset of field: ggml_tensor::name"][::std::mem::offset_of!(ggml_tensor, name) - 256usize]; + ["Offset of field: ggml_tensor::extra"][::std::mem::offset_of!(ggml_tensor, extra) - 320usize]; + ["Offset of field: ggml_tensor::padding"] + [::std::mem::offset_of!(ggml_tensor, padding) - 328usize]; +}; +pub const GGML_TENSOR_SIZE: usize = 336; +pub type ggml_abort_callback = + ::std::option::Option bool>; pub type ggml_guid = [u8; 16usize]; pub type ggml_guid_t = *mut ggml_guid; -extern "C" { +unsafe extern "C" { pub fn ggml_guid_matches(guid_a: ggml_guid_t, guid_b: ggml_guid_t) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_time_init(); } -extern "C" { +unsafe extern "C" { pub fn ggml_time_ms() -> i64; } -extern "C" { +unsafe extern "C" { pub fn ggml_time_us() -> i64; } -extern "C" { +unsafe extern "C" { pub fn ggml_cycles() -> i64; } -extern "C" { +unsafe extern "C" { pub fn ggml_cycles_per_ms() -> i64; } -extern "C" { +unsafe extern "C" { 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; -} -extern "C" { +unsafe extern "C" { pub fn ggml_print_object(obj: *const ggml_object); } -extern "C" { +unsafe extern "C" { pub fn ggml_print_objects(ctx: *const ggml_context); } -extern "C" { +unsafe extern "C" { pub fn ggml_nelements(tensor: *const ggml_tensor) -> i64; } -extern "C" { +unsafe extern "C" { pub fn ggml_nrows(tensor: *const ggml_tensor) -> i64; } -extern "C" { +unsafe extern "C" { pub fn ggml_nbytes(tensor: *const ggml_tensor) -> usize; } -extern "C" { +unsafe extern "C" { pub fn ggml_nbytes_pad(tensor: *const ggml_tensor) -> usize; } -extern "C" { +unsafe extern "C" { pub fn ggml_blck_size(type_: ggml_type) -> i64; } -extern "C" { +unsafe extern "C" { pub fn ggml_type_size(type_: ggml_type) -> usize; } -extern "C" { +unsafe extern "C" { pub fn ggml_row_size(type_: ggml_type, ne: i64) -> usize; } -extern "C" { +unsafe extern "C" { pub fn ggml_type_sizef(type_: ggml_type) -> f64; } -extern "C" { +unsafe extern "C" { pub fn ggml_type_name(type_: ggml_type) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ggml_op_name(op: ggml_op) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ggml_op_symbol(op: ggml_op) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ggml_unary_op_name(op: ggml_unary_op) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ggml_op_desc(t: *const ggml_tensor) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ggml_element_size(tensor: *const ggml_tensor) -> usize; } -extern "C" { +unsafe extern "C" { pub fn ggml_is_quantized(type_: ggml_type) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_ftype_to_ggml_type(ftype: ggml_ftype) -> ggml_type; } -extern "C" { +unsafe extern "C" { pub fn ggml_is_transposed(tensor: *const ggml_tensor) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_is_permuted(tensor: *const ggml_tensor) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_is_empty(tensor: *const ggml_tensor) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_is_scalar(tensor: *const ggml_tensor) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_is_vector(tensor: *const ggml_tensor) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_is_matrix(tensor: *const ggml_tensor) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_is_3d(tensor: *const ggml_tensor) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_n_dims(tensor: *const ggml_tensor) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ggml_is_contiguous(tensor: *const ggml_tensor) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_is_contiguous_0(tensor: *const ggml_tensor) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_is_contiguous_1(tensor: *const ggml_tensor) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_is_contiguous_2(tensor: *const ggml_tensor) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_are_same_shape(t0: *const ggml_tensor, t1: *const ggml_tensor) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_are_same_stride(t0: *const ggml_tensor, t1: *const ggml_tensor) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_can_repeat(t0: *const ggml_tensor, t1: *const ggml_tensor) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_tensor_overhead() -> usize; } -extern "C" { +unsafe extern "C" { pub fn ggml_validate_row_data( type_: ggml_type, data: *const ::std::os::raw::c_void, nbytes: usize, ) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_init(params: ggml_init_params) -> *mut ggml_context; } -extern "C" { +unsafe extern "C" { pub fn ggml_reset(ctx: *mut ggml_context); } -extern "C" { +unsafe extern "C" { pub fn ggml_free(ctx: *mut ggml_context); } -extern "C" { +unsafe extern "C" { pub fn ggml_used_mem(ctx: *const ggml_context) -> usize; } -extern "C" { - pub fn ggml_set_scratch(ctx: *mut ggml_context, scratch: ggml_scratch) -> usize; -} -extern "C" { +unsafe extern "C" { pub fn ggml_get_no_alloc(ctx: *mut ggml_context) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_set_no_alloc(ctx: *mut ggml_context, no_alloc: bool); } -extern "C" { +unsafe extern "C" { pub fn ggml_get_mem_buffer(ctx: *const ggml_context) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { pub fn ggml_get_mem_size(ctx: *const ggml_context) -> usize; } -extern "C" { +unsafe extern "C" { pub fn ggml_get_max_tensor_size(ctx: *const ggml_context) -> usize; } -extern "C" { +unsafe extern "C" { pub fn ggml_new_tensor( ctx: *mut ggml_context, type_: ggml_type, @@ -1554,14 +1648,14 @@ extern "C" { ne: *const i64, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_new_tensor_1d( ctx: *mut ggml_context, type_: ggml_type, ne0: i64, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_new_tensor_2d( ctx: *mut ggml_context, type_: ggml_type, @@ -1569,7 +1663,7 @@ extern "C" { ne1: i64, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_new_tensor_3d( ctx: *mut ggml_context, type_: ggml_type, @@ -1578,7 +1672,7 @@ extern "C" { ne2: i64, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_new_tensor_4d( ctx: *mut ggml_context, type_: ggml_type, @@ -1588,43 +1682,31 @@ extern "C" { ne3: i64, ) -> *mut ggml_tensor; } -extern "C" { - pub fn ggml_new_i32(ctx: *mut ggml_context, value: i32) -> *mut ggml_tensor; +unsafe extern "C" { + pub fn ggml_new_buffer(ctx: *mut ggml_context, nbytes: usize) -> *mut ::std::os::raw::c_void; } -extern "C" { - pub fn ggml_new_f32(ctx: *mut ggml_context, value: f32) -> *mut ggml_tensor; -} -extern "C" { +unsafe extern "C" { pub fn ggml_dup_tensor(ctx: *mut ggml_context, src: *const ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_view_tensor(ctx: *mut ggml_context, src: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_get_first_tensor(ctx: *const ggml_context) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_get_next_tensor( ctx: *const ggml_context, tensor: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_get_tensor( ctx: *mut ggml_context, name: *const ::std::os::raw::c_char, ) -> *mut ggml_tensor; } -extern "C" { - pub fn ggml_set_zero(tensor: *mut ggml_tensor) -> *mut ggml_tensor; -} -extern "C" { - pub fn ggml_set_i32(tensor: *mut ggml_tensor, value: i32) -> *mut ggml_tensor; -} -extern "C" { - pub fn ggml_set_f32(tensor: *mut ggml_tensor, value: f32) -> *mut ggml_tensor; -} -extern "C" { +unsafe extern "C" { pub fn ggml_unravel_index( tensor: *const ggml_tensor, i: i64, @@ -1634,102 +1716,64 @@ extern "C" { i3: *mut i64, ); } -extern "C" { - pub fn ggml_get_i32_1d(tensor: *const ggml_tensor, i: ::std::os::raw::c_int) -> i32; -} -extern "C" { - pub fn ggml_set_i32_1d(tensor: *const ggml_tensor, i: ::std::os::raw::c_int, value: i32); -} -extern "C" { - pub fn ggml_get_i32_nd( - tensor: *const ggml_tensor, - i0: ::std::os::raw::c_int, - i1: ::std::os::raw::c_int, - i2: ::std::os::raw::c_int, - i3: ::std::os::raw::c_int, - ) -> i32; -} -extern "C" { - pub fn ggml_set_i32_nd( - tensor: *const ggml_tensor, - i0: ::std::os::raw::c_int, - i1: ::std::os::raw::c_int, - i2: ::std::os::raw::c_int, - i3: ::std::os::raw::c_int, - value: i32, - ); -} -extern "C" { - pub fn ggml_get_f32_1d(tensor: *const ggml_tensor, i: ::std::os::raw::c_int) -> f32; -} -extern "C" { - pub fn ggml_set_f32_1d(tensor: *const ggml_tensor, i: ::std::os::raw::c_int, value: f32); -} -extern "C" { - pub fn ggml_get_f32_nd( - tensor: *const ggml_tensor, - i0: ::std::os::raw::c_int, - i1: ::std::os::raw::c_int, - i2: ::std::os::raw::c_int, - i3: ::std::os::raw::c_int, - ) -> f32; -} -extern "C" { - pub fn ggml_set_f32_nd( - tensor: *const ggml_tensor, - i0: ::std::os::raw::c_int, - i1: ::std::os::raw::c_int, - i2: ::std::os::raw::c_int, - i3: ::std::os::raw::c_int, - value: f32, - ); -} -extern "C" { - pub fn ggml_get_data(tensor: *const ggml_tensor) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn ggml_get_data_f32(tensor: *const ggml_tensor) -> *mut f32; -} -extern "C" { +unsafe extern "C" { pub fn ggml_get_unary_op(tensor: *const ggml_tensor) -> ggml_unary_op; } -extern "C" { +unsafe extern "C" { + pub fn ggml_get_data(tensor: *const ggml_tensor) -> *mut ::std::os::raw::c_void; +} +unsafe extern "C" { + pub fn ggml_get_data_f32(tensor: *const ggml_tensor) -> *mut f32; +} +unsafe extern "C" { pub fn ggml_get_name(tensor: *const ggml_tensor) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ggml_set_name( tensor: *mut ggml_tensor, name: *const ::std::os::raw::c_char, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_format_name( tensor: *mut ggml_tensor, fmt: *const ::std::os::raw::c_char, ... ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { + pub fn ggml_set_input(tensor: *mut ggml_tensor); +} +unsafe extern "C" { + pub fn ggml_set_output(tensor: *mut ggml_tensor); +} +unsafe extern "C" { + pub fn ggml_set_param(ctx: *mut ggml_context, tensor: *mut ggml_tensor); +} +unsafe extern "C" { + pub fn ggml_set_loss(tensor: *mut ggml_tensor); +} +unsafe extern "C" { pub fn ggml_dup(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_dup_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_add( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_add_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_add_cast( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -1737,21 +1781,21 @@ extern "C" { type_: ggml_type, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_add1( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_add1_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_acc( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -1762,7 +1806,7 @@ extern "C" { offset: usize, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_acc_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -1773,112 +1817,112 @@ extern "C" { offset: usize, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_sub( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_sub_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_mul( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_mul_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_div( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_div_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_sqr(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_sqr_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_sqrt(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_sqrt_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_log(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_log_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_sin(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_sin_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_cos(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_cos_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_sum(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_sum_rows(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_mean(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_argmax(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_count_equal( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_repeat( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_repeat_back( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_concat( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -1886,46 +1930,46 @@ extern "C" { dim: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_abs(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_abs_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_sgn(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_sgn_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_neg(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_neg_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_step(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_step_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_tanh(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_tanh_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_elu(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_elu_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_relu(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_leaky_relu( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -1933,75 +1977,75 @@ extern "C" { inplace: bool, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_relu_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_sigmoid(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_sigmoid_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_gelu(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_gelu_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_gelu_quick(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_gelu_quick_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_silu(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_silu_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_silu_back( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_hardswish(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_hardsigmoid(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_exp(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_exp_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_norm(ctx: *mut ggml_context, a: *mut ggml_tensor, eps: f32) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_norm_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, eps: f32, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_rms_norm(ctx: *mut ggml_context, a: *mut ggml_tensor, eps: f32) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_rms_norm_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, eps: f32, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_group_norm( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2009,7 +2053,7 @@ extern "C" { eps: f32, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_group_norm_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2017,7 +2061,7 @@ extern "C" { eps: f32, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_rms_norm_back( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2025,17 +2069,17 @@ extern "C" { eps: f32, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_mul_mat( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_mul_mat_set_prec(a: *mut ggml_tensor, prec: ggml_prec); } -extern "C" { +unsafe extern "C" { pub fn ggml_mul_mat_id( ctx: *mut ggml_context, as_: *mut ggml_tensor, @@ -2043,24 +2087,24 @@ extern "C" { ids: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_out_prod( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_scale(ctx: *mut ggml_context, a: *mut ggml_tensor, s: f32) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_scale_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, s: f32, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_set( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2071,7 +2115,7 @@ extern "C" { offset: usize, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_set_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2082,7 +2126,7 @@ extern "C" { offset: usize, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_set_1d( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2090,7 +2134,7 @@ extern "C" { offset: usize, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_set_1d_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2098,7 +2142,7 @@ extern "C" { offset: usize, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_set_2d( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2107,7 +2151,7 @@ extern "C" { offset: usize, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_set_2d_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2116,27 +2160,27 @@ extern "C" { offset: usize, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_cpy( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_cast( ctx: *mut ggml_context, a: *mut ggml_tensor, type_: ggml_type, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_cont(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_cont_1d(ctx: *mut ggml_context, a: *mut ggml_tensor, ne0: i64) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_cont_2d( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2144,7 +2188,7 @@ extern "C" { ne1: i64, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_cont_3d( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2153,7 +2197,7 @@ extern "C" { ne2: i64, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_cont_4d( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2163,21 +2207,21 @@ extern "C" { ne3: i64, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_reshape( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_reshape_1d( ctx: *mut ggml_context, a: *mut ggml_tensor, ne0: i64, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_reshape_2d( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2185,7 +2229,7 @@ extern "C" { ne1: i64, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_reshape_3d( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2194,7 +2238,7 @@ extern "C" { ne2: i64, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_reshape_4d( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2204,7 +2248,7 @@ extern "C" { ne3: i64, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_view_1d( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2212,7 +2256,7 @@ extern "C" { offset: usize, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_view_2d( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2222,7 +2266,7 @@ extern "C" { offset: usize, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_view_3d( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2234,7 +2278,7 @@ extern "C" { offset: usize, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_view_4d( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2248,7 +2292,7 @@ extern "C" { offset: usize, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_permute( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2258,17 +2302,17 @@ extern "C" { axis3: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_transpose(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_get_rows( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_get_rows_back( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2276,44 +2320,44 @@ extern "C" { c: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_diag(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_diag_mask_inf( ctx: *mut ggml_context, a: *mut ggml_tensor, n_past: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_diag_mask_inf_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, n_past: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_diag_mask_zero( ctx: *mut ggml_context, a: *mut ggml_tensor, n_past: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_diag_mask_zero_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, n_past: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_soft_max(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_soft_max_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_soft_max_ext( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2322,21 +2366,21 @@ extern "C" { max_bias: f32, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_soft_max_back( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_soft_max_back_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_rope( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2345,7 +2389,7 @@ extern "C" { mode: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_rope_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2354,7 +2398,7 @@ extern "C" { mode: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_rope_ext( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2371,7 +2415,25 @@ extern "C" { beta_slow: f32, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { + pub fn ggml_rope_multi( + ctx: *mut ggml_context, + a: *mut ggml_tensor, + b: *mut ggml_tensor, + c: *mut ggml_tensor, + n_dims: ::std::os::raw::c_int, + sections: *mut ::std::os::raw::c_int, + mode: ::std::os::raw::c_int, + n_ctx_orig: ::std::os::raw::c_int, + freq_base: f32, + freq_scale: f32, + ext_factor: f32, + attn_factor: f32, + beta_fast: f32, + beta_slow: f32, + ) -> *mut ggml_tensor; +} +unsafe extern "C" { pub fn ggml_rope_ext_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2388,7 +2450,7 @@ extern "C" { beta_slow: f32, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_rope_custom( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2404,7 +2466,7 @@ extern "C" { beta_slow: f32, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_rope_custom_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2420,7 +2482,7 @@ extern "C" { beta_slow: f32, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_rope_yarn_corr_dims( n_dims: ::std::os::raw::c_int, n_ctx_orig: ::std::os::raw::c_int, @@ -2430,7 +2492,7 @@ extern "C" { dims: *mut f32, ); } -extern "C" { +unsafe extern "C" { pub fn ggml_rope_back( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2447,7 +2509,7 @@ extern "C" { beta_slow: f32, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_clamp( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2455,7 +2517,7 @@ extern "C" { max: f32, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_im2col( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2470,7 +2532,7 @@ extern "C" { dst_type: ggml_type, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_im2col_back( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2485,20 +2547,7 @@ extern "C" { is_2D: bool, ) -> *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" { +unsafe extern "C" { pub fn ggml_conv_1d( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2508,7 +2557,7 @@ extern "C" { d0: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_conv_1d_ph( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2517,7 +2566,26 @@ extern "C" { d: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { + pub fn ggml_conv_1d_dw( + ctx: *mut ggml_context, + a: *mut ggml_tensor, + b: *mut ggml_tensor, + s0: ::std::os::raw::c_int, + p0: ::std::os::raw::c_int, + d0: ::std::os::raw::c_int, + ) -> *mut ggml_tensor; +} +unsafe extern "C" { + pub fn ggml_conv_1d_dw_ph( + ctx: *mut ggml_context, + a: *mut ggml_tensor, + b: *mut ggml_tensor, + s0: ::std::os::raw::c_int, + d0: ::std::os::raw::c_int, + ) -> *mut ggml_tensor; +} +unsafe extern "C" { pub fn ggml_conv_transpose_1d( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2527,7 +2595,7 @@ extern "C" { d0: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_conv_2d( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2540,21 +2608,34 @@ extern "C" { d1: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_conv_2d_sk_p0( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_conv_2d_s1_ph( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { + pub fn ggml_conv_2d_dw( + 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; +} +unsafe extern "C" { pub fn ggml_conv_transpose_2d_p0( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2566,7 +2647,7 @@ pub const ggml_op_pool_GGML_OP_POOL_MAX: ggml_op_pool = 0; pub const ggml_op_pool_GGML_OP_POOL_AVG: ggml_op_pool = 1; pub const ggml_op_pool_GGML_OP_POOL_COUNT: ggml_op_pool = 2; pub type ggml_op_pool = ::std::os::raw::c_uint; -extern "C" { +unsafe extern "C" { pub fn ggml_pool_1d( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2576,7 +2657,7 @@ extern "C" { p0: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_pool_2d( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2589,7 +2670,7 @@ extern "C" { p1: f32, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_pool_2d_back( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2603,14 +2684,14 @@ extern "C" { p1: f32, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_upscale( ctx: *mut ggml_context, a: *mut ggml_tensor, scale_factor: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_upscale_ext( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2620,7 +2701,7 @@ extern "C" { ne3: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_pad( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2630,7 +2711,15 @@ extern "C" { p3: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { + pub fn ggml_pad_reflect_1d( + ctx: *mut ggml_context, + a: *mut ggml_tensor, + p0: ::std::os::raw::c_int, + p1: ::std::os::raw::c_int, + ) -> *mut ggml_tensor; +} +unsafe extern "C" { pub fn ggml_timestep_embedding( ctx: *mut ggml_context, timesteps: *mut ggml_tensor, @@ -2641,14 +2730,14 @@ extern "C" { 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" { +unsafe extern "C" { pub fn ggml_argsort( ctx: *mut ggml_context, a: *mut ggml_tensor, order: ggml_sort_order, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_arange( ctx: *mut ggml_context, start: f32, @@ -2656,14 +2745,14 @@ extern "C" { step: f32, ) -> *mut ggml_tensor; } -extern "C" { +unsafe 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" { +unsafe extern "C" { pub fn ggml_flash_attn_ext( ctx: *mut ggml_context, q: *mut ggml_tensor, @@ -2675,10 +2764,13 @@ extern "C" { logit_softcap: f32, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_flash_attn_ext_set_prec(a: *mut ggml_tensor, prec: ggml_prec); } -extern "C" { +unsafe extern "C" { + pub fn ggml_flash_attn_ext_get_prec(a: *const ggml_tensor) -> ggml_prec; +} +unsafe extern "C" { pub fn ggml_flash_attn_back( ctx: *mut ggml_context, q: *mut ggml_tensor, @@ -2688,14 +2780,14 @@ extern "C" { masked: bool, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_ssm_conv( ctx: *mut ggml_context, sx: *mut ggml_tensor, c: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_ssm_scan( ctx: *mut ggml_context, s: *mut ggml_tensor, @@ -2706,14 +2798,14 @@ extern "C" { C: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_win_part( ctx: *mut ggml_context, a: *mut ggml_tensor, w: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_win_unpart( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2722,21 +2814,21 @@ extern "C" { w: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_unary( ctx: *mut ggml_context, a: *mut ggml_tensor, op: ggml_unary_op, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_unary_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, op: ggml_unary_op, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_get_rel_pos( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2744,7 +2836,7 @@ extern "C" { kh: ::std::os::raw::c_int, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_add_rel_pos( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2752,7 +2844,7 @@ extern "C" { ph: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_add_rel_pos_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2760,8 +2852,8 @@ extern "C" { ph: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { - pub fn ggml_rwkv_wkv( +unsafe extern "C" { + pub fn ggml_rwkv_wkv6( ctx: *mut ggml_context, k: *mut ggml_tensor, v: *mut ggml_tensor, @@ -2799,21 +2891,21 @@ pub type ggml_custom3_op_f32_t = ::std::option::Option< arg4: *const ggml_tensor, ), >; -extern "C" { +unsafe extern "C" { pub fn ggml_map_unary_f32( ctx: *mut ggml_context, a: *mut ggml_tensor, fun: ggml_unary_op_f32_t, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_map_unary_inplace_f32( ctx: *mut ggml_context, a: *mut ggml_tensor, fun: ggml_unary_op_f32_t, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_map_binary_f32( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2821,7 +2913,7 @@ extern "C" { fun: ggml_binary_op_f32_t, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_map_binary_inplace_f32( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2829,21 +2921,21 @@ extern "C" { fun: ggml_binary_op_f32_t, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_map_custom1_f32( ctx: *mut ggml_context, a: *mut ggml_tensor, fun: ggml_custom1_op_f32_t, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_map_custom1_inplace_f32( ctx: *mut ggml_context, a: *mut ggml_tensor, fun: ggml_custom1_op_f32_t, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_map_custom2_f32( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2851,7 +2943,7 @@ extern "C" { fun: ggml_custom2_op_f32_t, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_map_custom2_inplace_f32( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2859,7 +2951,7 @@ extern "C" { fun: ggml_custom2_op_f32_t, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_map_custom3_f32( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2868,7 +2960,7 @@ extern "C" { fun: ggml_custom3_op_f32_t, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_map_custom3_inplace_f32( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2907,7 +2999,7 @@ pub type ggml_custom3_op_t = ::std::option::Option< userdata: *mut ::std::os::raw::c_void, ), >; -extern "C" { +unsafe extern "C" { pub fn ggml_map_custom1( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2916,7 +3008,7 @@ extern "C" { userdata: *mut ::std::os::raw::c_void, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_map_custom1_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2925,7 +3017,7 @@ extern "C" { userdata: *mut ::std::os::raw::c_void, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_map_custom2( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2935,7 +3027,7 @@ extern "C" { userdata: *mut ::std::os::raw::c_void, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_map_custom2_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2945,7 +3037,7 @@ extern "C" { userdata: *mut ::std::os::raw::c_void, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_map_custom3( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2956,7 +3048,7 @@ extern "C" { userdata: *mut ::std::os::raw::c_void, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_map_custom3_inplace( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2967,14 +3059,14 @@ extern "C" { userdata: *mut ::std::os::raw::c_void, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_cross_entropy_loss( ctx: *mut ggml_context, a: *mut ggml_tensor, b: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_cross_entropy_loss_back( ctx: *mut ggml_context, a: *mut ggml_tensor, @@ -2982,204 +3074,108 @@ extern "C" { c: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_opt_step_adamw( ctx: *mut ggml_context, a: *mut ggml_tensor, grad: *mut ggml_tensor, - alpha: f32, - beta1: f32, - beta2: f32, - eps: f32, - wd: f32, + m: *mut ggml_tensor, + v: *mut ggml_tensor, + adamw_params: *mut ggml_tensor, ) -> *mut ggml_tensor; } -extern "C" { - pub fn ggml_set_param(ctx: *mut ggml_context, tensor: *mut ggml_tensor); -} -extern "C" { - pub fn ggml_set_loss(tensor: *mut ggml_tensor); -} -extern "C" { +unsafe extern "C" { pub fn ggml_build_forward_expand(cgraph: *mut ggml_cgraph, tensor: *mut ggml_tensor); } -extern "C" { +unsafe extern "C" { pub fn ggml_build_backward_expand( - ctx: *mut ggml_context, - gf: *mut ggml_cgraph, - gb: *mut ggml_cgraph, + ctx_static: *mut ggml_context, + ctx_compute: *mut ggml_context, + cgraph: *mut ggml_cgraph, accumulate: bool, ); } -extern "C" { - pub fn ggml_build_opt_adamw( - ctx: *mut ggml_context, - gf: *mut ggml_cgraph, - gb: *mut ggml_cgraph, - alpha: f32, - beta1: f32, - beta2: f32, - eps: f32, - wd: f32, - ); -} -extern "C" { +unsafe extern "C" { pub fn ggml_new_graph(ctx: *mut ggml_context) -> *mut ggml_cgraph; } -extern "C" { +unsafe extern "C" { pub fn ggml_new_graph_custom( ctx: *mut ggml_context, size: usize, grads: bool, ) -> *mut ggml_cgraph; } -extern "C" { +unsafe extern "C" { pub fn ggml_graph_dup(ctx: *mut ggml_context, cgraph: *mut ggml_cgraph) -> *mut ggml_cgraph; } -extern "C" { +unsafe extern "C" { pub fn ggml_graph_cpy(src: *mut ggml_cgraph, dst: *mut ggml_cgraph); } -extern "C" { +unsafe extern "C" { pub fn ggml_graph_reset(cgraph: *mut ggml_cgraph); } -extern "C" { +unsafe extern "C" { pub fn ggml_graph_clear(cgraph: *mut ggml_cgraph); } -extern "C" { +unsafe extern "C" { pub fn ggml_graph_size(cgraph: *mut ggml_cgraph) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ggml_graph_node(cgraph: *mut ggml_cgraph, i: ::std::os::raw::c_int) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_graph_nodes(cgraph: *mut ggml_cgraph) -> *mut *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { pub fn ggml_graph_n_nodes(cgraph: *mut ggml_cgraph) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ggml_graph_add_node(cgraph: *mut ggml_cgraph, tensor: *mut ggml_tensor); } -extern "C" { +unsafe extern "C" { pub fn ggml_graph_overhead() -> usize; } -extern "C" { +unsafe extern "C" { pub fn ggml_graph_overhead_custom(size: usize, grads: bool) -> usize; } -extern "C" { - pub fn ggml_threadpool_params_default( - n_threads: ::std::os::raw::c_int, - ) -> ggml_threadpool_params; -} -extern "C" { - pub fn ggml_threadpool_params_init( - p: *mut ggml_threadpool_params, - n_threads: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn ggml_threadpool_params_match( - p0: *const ggml_threadpool_params, - p1: *const ggml_threadpool_params, - ) -> bool; -} -extern "C" { - pub fn ggml_threadpool_new(params: *mut ggml_threadpool_params) -> *mut ggml_threadpool; -} -extern "C" { - pub fn ggml_threadpool_free(threadpool: *mut ggml_threadpool); -} -extern "C" { - pub fn ggml_threadpool_get_n_threads(threadpool: *mut ggml_threadpool) - -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_threadpool_pause(threadpool: *mut ggml_threadpool); -} -extern "C" { - pub fn ggml_threadpool_resume(threadpool: *mut ggml_threadpool); -} -extern "C" { - pub fn ggml_graph_plan( - cgraph: *const ggml_cgraph, - n_threads: ::std::os::raw::c_int, - threadpool: *mut ggml_threadpool, - ) -> ggml_cplan; -} -extern "C" { - 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" { +unsafe extern "C" { pub fn ggml_graph_get_tensor( - cgraph: *mut ggml_cgraph, + cgraph: *const ggml_cgraph, name: *const ::std::os::raw::c_char, ) -> *mut ggml_tensor; } -extern "C" { +unsafe extern "C" { + pub fn ggml_graph_get_grad( + cgraph: *const ggml_cgraph, + node: *const ggml_tensor, + ) -> *mut ggml_tensor; +} +unsafe extern "C" { + pub fn ggml_graph_get_grad_acc( + cgraph: *const ggml_cgraph, + node: *const ggml_tensor, + ) -> *mut ggml_tensor; +} +unsafe extern "C" { pub fn ggml_graph_export(cgraph: *const ggml_cgraph, fname: *const ::std::os::raw::c_char); } -extern "C" { +unsafe extern "C" { pub fn ggml_graph_import( fname: *const ::std::os::raw::c_char, ctx_data: *mut *mut ggml_context, ctx_eval: *mut *mut ggml_context, ) -> *mut ggml_cgraph; } -extern "C" { +unsafe extern "C" { pub fn ggml_graph_print(cgraph: *const ggml_cgraph); } -extern "C" { +unsafe extern "C" { pub fn ggml_graph_dump_dot( gb: *const ggml_cgraph, gf: *const ggml_cgraph, filename: *const ::std::os::raw::c_char, ); } -extern "C" { - pub fn ggml_build_backward_gradient_checkpointing( - ctx: *mut ggml_context, - gf: *mut ggml_cgraph, - gb: *mut ggml_cgraph, - gb_tmp: *mut ggml_cgraph, - checkpoints: *mut *mut ggml_tensor, - n_checkpoints: ::std::os::raw::c_int, - ); -} -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_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; -pub const ggml_opt_result_GGML_LINESEARCH_MAXIMUM_ITERATIONS: ggml_opt_result = -125; -pub const ggml_opt_result_GGML_LINESEARCH_INVALID_PARAMETERS: ggml_opt_result = -124; -pub type ggml_opt_result = ::std::os::raw::c_int; -pub type ggml_opt_callback = ::std::option::Option< - unsafe extern "C" fn( - data: *mut ::std::os::raw::c_void, - accum_step: ::std::os::raw::c_int, - sched: *mut f32, - cancel: *mut bool, - ), ->; pub type ggml_log_callback = ::std::option::Option< unsafe extern "C" fn( level: ggml_log_level, @@ -3187,312 +3183,22 @@ pub type ggml_log_callback = ::std::option::Option< user_data: *mut ::std::os::raw::c_void, ), >; -extern "C" { +unsafe extern "C" { pub fn ggml_log_set(log_callback: ggml_log_callback, user_data: *mut ::std::os::raw::c_void); } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ggml_opt_params { - pub type_: ggml_opt_type, - pub graph_size: usize, - pub n_threads: ::std::os::raw::c_int, - pub past: ::std::os::raw::c_int, - pub delta: f32, - pub max_no_improvement: ::std::os::raw::c_int, - pub print_forward_graph: bool, - pub print_backward_graph: bool, - pub n_gradient_accumulation: ::std::os::raw::c_int, - pub adam: ggml_opt_params__bindgen_ty_1, - pub lbfgs: ggml_opt_params__bindgen_ty_2, +unsafe extern "C" { + pub fn ggml_set_zero(tensor: *mut ggml_tensor) -> *mut ggml_tensor; } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ggml_opt_params__bindgen_ty_1 { - pub n_iter: ::std::os::raw::c_int, - pub sched: f32, - pub decay: f32, - pub decay_min_ndim: ::std::os::raw::c_int, - pub alpha: f32, - pub beta1: f32, - pub beta2: f32, - pub eps: f32, - pub eps_f: f32, - pub eps_g: f32, - pub gclip: f32, -} -#[allow(clippy::unnecessary_operation, clippy::identity_op)] -const _: () = { - ["Size of ggml_opt_params__bindgen_ty_1"] - [::std::mem::size_of::() - 44usize]; - ["Alignment of ggml_opt_params__bindgen_ty_1"] - [::std::mem::align_of::() - 4usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_1::n_iter"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_1, n_iter) - 0usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_1::sched"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_1, sched) - 4usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_1::decay"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_1, decay) - 8usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_1::decay_min_ndim"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_1, decay_min_ndim) - 12usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_1::alpha"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_1, alpha) - 16usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_1::beta1"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_1, beta1) - 20usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_1::beta2"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_1, beta2) - 24usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_1::eps"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_1, eps) - 28usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_1::eps_f"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_1, eps_f) - 32usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_1::eps_g"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_1, eps_g) - 36usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_1::gclip"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_1, gclip) - 40usize]; -}; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ggml_opt_params__bindgen_ty_2 { - pub m: ::std::os::raw::c_int, - pub n_iter: ::std::os::raw::c_int, - pub max_linesearch: ::std::os::raw::c_int, - pub eps: f32, - pub ftol: f32, - pub wolfe: f32, - pub min_step: f32, - pub max_step: f32, - pub linesearch: ggml_linesearch, -} -#[allow(clippy::unnecessary_operation, clippy::identity_op)] -const _: () = { - ["Size of ggml_opt_params__bindgen_ty_2"] - [::std::mem::size_of::() - 36usize]; - ["Alignment of ggml_opt_params__bindgen_ty_2"] - [::std::mem::align_of::() - 4usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_2::m"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_2, m) - 0usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_2::n_iter"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_2, n_iter) - 4usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_2::max_linesearch"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_2, max_linesearch) - 8usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_2::eps"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_2, eps) - 12usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_2::ftol"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_2, ftol) - 16usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_2::wolfe"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_2, wolfe) - 20usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_2::min_step"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_2, min_step) - 24usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_2::max_step"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_2, max_step) - 28usize]; - ["Offset of field: ggml_opt_params__bindgen_ty_2::linesearch"] - [::std::mem::offset_of!(ggml_opt_params__bindgen_ty_2, linesearch) - 32usize]; -}; -#[allow(clippy::unnecessary_operation, clippy::identity_op)] -const _: () = { - ["Size of ggml_opt_params"][::std::mem::size_of::() - 120usize]; - ["Alignment of ggml_opt_params"][::std::mem::align_of::() - 8usize]; - ["Offset of field: ggml_opt_params::type_"] - [::std::mem::offset_of!(ggml_opt_params, type_) - 0usize]; - ["Offset of field: ggml_opt_params::graph_size"] - [::std::mem::offset_of!(ggml_opt_params, graph_size) - 8usize]; - ["Offset of field: ggml_opt_params::n_threads"] - [::std::mem::offset_of!(ggml_opt_params, n_threads) - 16usize]; - ["Offset of field: ggml_opt_params::past"] - [::std::mem::offset_of!(ggml_opt_params, past) - 20usize]; - ["Offset of field: ggml_opt_params::delta"] - [::std::mem::offset_of!(ggml_opt_params, delta) - 24usize]; - ["Offset of field: ggml_opt_params::max_no_improvement"] - [::std::mem::offset_of!(ggml_opt_params, max_no_improvement) - 28usize]; - ["Offset of field: ggml_opt_params::print_forward_graph"] - [::std::mem::offset_of!(ggml_opt_params, print_forward_graph) - 32usize]; - ["Offset of field: ggml_opt_params::print_backward_graph"] - [::std::mem::offset_of!(ggml_opt_params, print_backward_graph) - 33usize]; - ["Offset of field: ggml_opt_params::n_gradient_accumulation"] - [::std::mem::offset_of!(ggml_opt_params, n_gradient_accumulation) - 36usize]; - ["Offset of field: ggml_opt_params::adam"] - [::std::mem::offset_of!(ggml_opt_params, adam) - 40usize]; - ["Offset of field: ggml_opt_params::lbfgs"] - [::std::mem::offset_of!(ggml_opt_params, lbfgs) - 84usize]; -}; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ggml_opt_context { - pub ctx: *mut ggml_context, - pub params: ggml_opt_params, - pub iter: ::std::os::raw::c_int, - pub nx: i64, - pub just_initialized: bool, - pub loss_before: f32, - pub loss_after: f32, - pub adam: ggml_opt_context__bindgen_ty_1, - pub lbfgs: ggml_opt_context__bindgen_ty_2, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ggml_opt_context__bindgen_ty_1 { - pub g: *mut ggml_tensor, - pub m: *mut ggml_tensor, - pub v: *mut ggml_tensor, - pub pf: *mut ggml_tensor, - pub fx_best: f32, - pub fx_prev: f32, - pub n_no_improvement: ::std::os::raw::c_int, -} -#[allow(clippy::unnecessary_operation, clippy::identity_op)] -const _: () = { - ["Size of ggml_opt_context__bindgen_ty_1"] - [::std::mem::size_of::() - 48usize]; - ["Alignment of ggml_opt_context__bindgen_ty_1"] - [::std::mem::align_of::() - 8usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_1::g"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_1, g) - 0usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_1::m"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_1, m) - 8usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_1::v"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_1, v) - 16usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_1::pf"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_1, pf) - 24usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_1::fx_best"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_1, fx_best) - 32usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_1::fx_prev"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_1, fx_prev) - 36usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_1::n_no_improvement"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_1, n_no_improvement) - 40usize]; -}; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ggml_opt_context__bindgen_ty_2 { - pub x: *mut ggml_tensor, - pub xp: *mut ggml_tensor, - pub g: *mut ggml_tensor, - pub gp: *mut ggml_tensor, - pub d: *mut ggml_tensor, - pub pf: *mut ggml_tensor, - pub lmal: *mut ggml_tensor, - pub lmys: *mut ggml_tensor, - pub lms: *mut ggml_tensor, - pub lmy: *mut ggml_tensor, - pub fx_best: f32, - pub step: f32, - pub j: ::std::os::raw::c_int, - pub k: ::std::os::raw::c_int, - pub end: ::std::os::raw::c_int, - pub n_no_improvement: ::std::os::raw::c_int, -} -#[allow(clippy::unnecessary_operation, clippy::identity_op)] -const _: () = { - ["Size of ggml_opt_context__bindgen_ty_2"] - [::std::mem::size_of::() - 104usize]; - ["Alignment of ggml_opt_context__bindgen_ty_2"] - [::std::mem::align_of::() - 8usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_2::x"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_2, x) - 0usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_2::xp"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_2, xp) - 8usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_2::g"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_2, g) - 16usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_2::gp"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_2, gp) - 24usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_2::d"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_2, d) - 32usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_2::pf"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_2, pf) - 40usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_2::lmal"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_2, lmal) - 48usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_2::lmys"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_2, lmys) - 56usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_2::lms"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_2, lms) - 64usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_2::lmy"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_2, lmy) - 72usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_2::fx_best"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_2, fx_best) - 80usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_2::step"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_2, step) - 84usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_2::j"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_2, j) - 88usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_2::k"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_2, k) - 92usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_2::end"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_2, end) - 96usize]; - ["Offset of field: ggml_opt_context__bindgen_ty_2::n_no_improvement"] - [::std::mem::offset_of!(ggml_opt_context__bindgen_ty_2, n_no_improvement) - 100usize]; -}; -#[allow(clippy::unnecessary_operation, clippy::identity_op)] -const _: () = { - ["Size of ggml_opt_context"][::std::mem::size_of::() - 312usize]; - ["Alignment of ggml_opt_context"][::std::mem::align_of::() - 8usize]; - ["Offset of field: ggml_opt_context::ctx"] - [::std::mem::offset_of!(ggml_opt_context, ctx) - 0usize]; - ["Offset of field: ggml_opt_context::params"] - [::std::mem::offset_of!(ggml_opt_context, params) - 8usize]; - ["Offset of field: ggml_opt_context::iter"] - [::std::mem::offset_of!(ggml_opt_context, iter) - 128usize]; - ["Offset of field: ggml_opt_context::nx"] - [::std::mem::offset_of!(ggml_opt_context, nx) - 136usize]; - ["Offset of field: ggml_opt_context::just_initialized"] - [::std::mem::offset_of!(ggml_opt_context, just_initialized) - 144usize]; - ["Offset of field: ggml_opt_context::loss_before"] - [::std::mem::offset_of!(ggml_opt_context, loss_before) - 148usize]; - ["Offset of field: ggml_opt_context::loss_after"] - [::std::mem::offset_of!(ggml_opt_context, loss_after) - 152usize]; - ["Offset of field: ggml_opt_context::adam"] - [::std::mem::offset_of!(ggml_opt_context, adam) - 160usize]; - ["Offset of field: ggml_opt_context::lbfgs"] - [::std::mem::offset_of!(ggml_opt_context, lbfgs) - 208usize]; -}; -extern "C" { - pub fn ggml_opt_default_params(type_: ggml_opt_type) -> ggml_opt_params; -} -extern "C" { - pub fn ggml_opt( - ctx: *mut ggml_context, - params: ggml_opt_params, - f: *mut ggml_tensor, - ) -> ggml_opt_result; -} -extern "C" { - pub fn ggml_opt_init( - ctx: *mut ggml_context, - opt: *mut ggml_opt_context, - params: ggml_opt_params, - nx: i64, - ); -} -extern "C" { - pub fn ggml_opt_resume( - ctx: *mut ggml_context, - opt: *mut ggml_opt_context, - f: *mut ggml_tensor, - ) -> ggml_opt_result; -} -extern "C" { - pub fn ggml_opt_resume_g( - ctx: *mut ggml_context, - opt: *mut ggml_opt_context, - f: *mut ggml_tensor, - gf: *mut ggml_cgraph, - gb: *mut ggml_cgraph, - callback: ggml_opt_callback, - callback_data: *mut ::std::os::raw::c_void, - ) -> ggml_opt_result; -} -extern "C" { - pub fn ggml_set_input(tensor: *mut ggml_tensor); -} -extern "C" { - pub fn ggml_set_output(tensor: *mut ggml_tensor); -} -extern "C" { +unsafe extern "C" { pub fn ggml_quantize_init(type_: ggml_type); } -extern "C" { +unsafe extern "C" { pub fn ggml_quantize_free(); } -extern "C" { +unsafe extern "C" { pub fn ggml_quantize_requires_imatrix(type_: ggml_type) -> bool; } -extern "C" { +unsafe extern "C" { pub fn ggml_quantize_chunk( type_: ggml_type, src: *const f32, @@ -3538,183 +3244,183 @@ const _: () = { ["Offset of field: gguf_init_params::ctx"] [::std::mem::offset_of!(gguf_init_params, ctx) - 8usize]; }; -extern "C" { +unsafe extern "C" { pub fn gguf_init_empty() -> *mut gguf_context; } -extern "C" { +unsafe extern "C" { pub fn gguf_init_from_file( fname: *const ::std::os::raw::c_char, params: gguf_init_params, ) -> *mut gguf_context; } -extern "C" { +unsafe extern "C" { pub fn gguf_free(ctx: *mut gguf_context); } -extern "C" { +unsafe extern "C" { pub fn gguf_type_name(type_: gguf_type) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_version(ctx: *const gguf_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_alignment(ctx: *const gguf_context) -> usize; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_data_offset(ctx: *const gguf_context) -> usize; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_data(ctx: *const gguf_context) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_n_kv(ctx: *const gguf_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn gguf_find_key( ctx: *const gguf_context, key: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_key( ctx: *const gguf_context, key_id: ::std::os::raw::c_int, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_kv_type(ctx: *const gguf_context, key_id: ::std::os::raw::c_int) -> gguf_type; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_arr_type(ctx: *const gguf_context, key_id: ::std::os::raw::c_int) -> gguf_type; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_val_u8(ctx: *const gguf_context, key_id: ::std::os::raw::c_int) -> u8; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_val_i8(ctx: *const gguf_context, key_id: ::std::os::raw::c_int) -> i8; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_val_u16(ctx: *const gguf_context, key_id: ::std::os::raw::c_int) -> u16; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_val_i16(ctx: *const gguf_context, key_id: ::std::os::raw::c_int) -> i16; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_val_u32(ctx: *const gguf_context, key_id: ::std::os::raw::c_int) -> u32; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_val_i32(ctx: *const gguf_context, key_id: ::std::os::raw::c_int) -> i32; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_val_f32(ctx: *const gguf_context, key_id: ::std::os::raw::c_int) -> f32; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_val_u64(ctx: *const gguf_context, key_id: ::std::os::raw::c_int) -> u64; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_val_i64(ctx: *const gguf_context, key_id: ::std::os::raw::c_int) -> i64; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_val_f64(ctx: *const gguf_context, key_id: ::std::os::raw::c_int) -> f64; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_val_bool(ctx: *const gguf_context, key_id: ::std::os::raw::c_int) -> bool; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_val_str( ctx: *const gguf_context, key_id: ::std::os::raw::c_int, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe 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" { +unsafe extern "C" { pub fn gguf_get_arr_n( ctx: *const gguf_context, key_id: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_arr_data( ctx: *const gguf_context, key_id: ::std::os::raw::c_int, ) -> *const ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_arr_str( ctx: *const gguf_context, key_id: ::std::os::raw::c_int, i: ::std::os::raw::c_int, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_n_tensors(ctx: *const gguf_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn gguf_find_tensor( ctx: *const gguf_context, name: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_tensor_offset(ctx: *const gguf_context, i: ::std::os::raw::c_int) -> usize; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_tensor_name( ctx: *const gguf_context, i: ::std::os::raw::c_int, ) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_tensor_type(ctx: *const gguf_context, i: ::std::os::raw::c_int) -> ggml_type; } -extern "C" { +unsafe extern "C" { pub fn gguf_remove_key(ctx: *mut gguf_context, key: *const ::std::os::raw::c_char); } -extern "C" { +unsafe extern "C" { pub fn gguf_set_val_u8(ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, val: u8); } -extern "C" { +unsafe extern "C" { pub fn gguf_set_val_i8(ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, val: i8); } -extern "C" { +unsafe extern "C" { pub fn gguf_set_val_u16(ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, val: u16); } -extern "C" { +unsafe extern "C" { pub fn gguf_set_val_i16(ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, val: i16); } -extern "C" { +unsafe extern "C" { pub fn gguf_set_val_u32(ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, val: u32); } -extern "C" { +unsafe extern "C" { pub fn gguf_set_val_i32(ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, val: i32); } -extern "C" { +unsafe extern "C" { pub fn gguf_set_val_f32(ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, val: f32); } -extern "C" { +unsafe extern "C" { pub fn gguf_set_val_u64(ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, val: u64); } -extern "C" { +unsafe extern "C" { pub fn gguf_set_val_i64(ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, val: i64); } -extern "C" { +unsafe extern "C" { pub fn gguf_set_val_f64(ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, val: f64); } -extern "C" { +unsafe extern "C" { pub fn gguf_set_val_bool(ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, val: bool); } -extern "C" { +unsafe extern "C" { pub fn gguf_set_val_str( ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, val: *const ::std::os::raw::c_char, ); } -extern "C" { +unsafe extern "C" { pub fn gguf_set_arr_data( ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, @@ -3723,7 +3429,7 @@ extern "C" { n: ::std::os::raw::c_int, ); } -extern "C" { +unsafe extern "C" { pub fn gguf_set_arr_str( ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, @@ -3731,20 +3437,20 @@ extern "C" { n: ::std::os::raw::c_int, ); } -extern "C" { +unsafe extern "C" { pub fn gguf_set_kv(ctx: *mut gguf_context, src: *mut gguf_context); } -extern "C" { +unsafe extern "C" { pub fn gguf_add_tensor(ctx: *mut gguf_context, tensor: *const ggml_tensor); } -extern "C" { +unsafe extern "C" { pub fn gguf_set_tensor_type( ctx: *mut gguf_context, name: *const ::std::os::raw::c_char, type_: ggml_type, ); } -extern "C" { +unsafe extern "C" { pub fn gguf_set_tensor_data( ctx: *mut gguf_context, name: *const ::std::os::raw::c_char, @@ -3752,155 +3458,25 @@ extern "C" { size: usize, ); } -extern "C" { +unsafe extern "C" { pub fn gguf_write_to_file( ctx: *const gguf_context, fname: *const ::std::os::raw::c_char, only_meta: bool, ); } -extern "C" { +unsafe extern "C" { pub fn gguf_get_meta_size(ctx: *const gguf_context) -> usize; } -extern "C" { +unsafe extern "C" { pub fn gguf_get_meta_data(ctx: *const gguf_context, data: *mut ::std::os::raw::c_void); } -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; -} -extern "C" { - pub fn ggml_cpu_has_avx512() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_has_avx512_vbmi() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_has_avx512_vnni() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_has_avx512_bf16() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_has_amx_int8() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_has_fma() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_has_neon() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_has_sve() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_has_arm_fma() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_has_metal() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_has_f16c() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_has_fp16_va() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_has_wasm_simd() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_has_blas() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_has_cuda() -> ::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; -} -extern "C" { - pub fn ggml_cpu_has_sse3() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_has_ssse3() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_has_riscv_v() -> ::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_rpc() -> ::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; -} -extern "C" { - pub fn ggml_cpu_has_cann() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_has_llamafile() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ggml_cpu_get_sve_cnt() -> ::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: 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: i64), >; -pub type ggml_from_float_to_mat_t = ::std::option::Option< - unsafe extern "C" fn(x: *const f32, y: *mut ::std::os::raw::c_void, nr: i64, k: i64, bs: 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, - ), ->; -pub type ggml_gemv_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, - y: *const ::std::os::raw::c_void, - nr: ::std::os::raw::c_int, - nc: ::std::os::raw::c_int, - ), ->; -pub type ggml_gemm_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, - y: *const ::std::os::raw::c_void, - nr: ::std::os::raw::c_int, - nc: ::std::os::raw::c_int, - ), ->; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ggml_type_traits { @@ -3910,19 +3486,11 @@ pub struct ggml_type_traits { pub type_size: usize, pub is_quantized: bool, pub to_float: ggml_to_float_t, - pub from_float: ggml_from_float_t, pub from_float_ref: ggml_from_float_t, - pub from_float_to_mat: ggml_from_float_to_mat_t, - pub vec_dot: ggml_vec_dot_t, - pub vec_dot_type: ggml_type, - pub nrows: i64, - pub ncols: i64, - pub gemv: ggml_gemv_t, - pub gemm: ggml_gemm_t, } #[allow(clippy::unnecessary_operation, clippy::identity_op)] const _: () = { - ["Size of ggml_type_traits"][::std::mem::size_of::() - 120usize]; + ["Size of ggml_type_traits"][::std::mem::size_of::() - 56usize]; ["Alignment of ggml_type_traits"][::std::mem::align_of::() - 8usize]; ["Offset of field: ggml_type_traits::type_name"] [::std::mem::offset_of!(ggml_type_traits, type_name) - 0usize]; @@ -3936,28 +3504,1049 @@ const _: () = { [::std::mem::offset_of!(ggml_type_traits, is_quantized) - 32usize]; ["Offset of field: ggml_type_traits::to_float"] [::std::mem::offset_of!(ggml_type_traits, to_float) - 40usize]; - ["Offset of field: ggml_type_traits::from_float"] - [::std::mem::offset_of!(ggml_type_traits, from_float) - 48usize]; ["Offset of field: ggml_type_traits::from_float_ref"] - [::std::mem::offset_of!(ggml_type_traits, from_float_ref) - 56usize]; - ["Offset of field: ggml_type_traits::from_float_to_mat"] - [::std::mem::offset_of!(ggml_type_traits, from_float_to_mat) - 64usize]; - ["Offset of field: ggml_type_traits::vec_dot"] - [::std::mem::offset_of!(ggml_type_traits, vec_dot) - 72usize]; - ["Offset of field: ggml_type_traits::vec_dot_type"] - [::std::mem::offset_of!(ggml_type_traits, vec_dot_type) - 80usize]; - ["Offset of field: ggml_type_traits::nrows"] - [::std::mem::offset_of!(ggml_type_traits, nrows) - 88usize]; - ["Offset of field: ggml_type_traits::ncols"] - [::std::mem::offset_of!(ggml_type_traits, ncols) - 96usize]; - ["Offset of field: ggml_type_traits::gemv"] - [::std::mem::offset_of!(ggml_type_traits, gemv) - 104usize]; - ["Offset of field: ggml_type_traits::gemm"] - [::std::mem::offset_of!(ggml_type_traits, gemm) - 112usize]; + [::std::mem::offset_of!(ggml_type_traits, from_float_ref) - 48usize]; }; -extern "C" { +unsafe extern "C" { pub fn ggml_get_type_traits(type_: ggml_type) -> *const ggml_type_traits; } +pub const ggml_sched_priority_GGML_SCHED_PRIO_NORMAL: ggml_sched_priority = 0; +pub const ggml_sched_priority_GGML_SCHED_PRIO_MEDIUM: ggml_sched_priority = 1; +pub const ggml_sched_priority_GGML_SCHED_PRIO_HIGH: ggml_sched_priority = 2; +pub const ggml_sched_priority_GGML_SCHED_PRIO_REALTIME: ggml_sched_priority = 3; +pub type ggml_sched_priority = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ggml_threadpool_params { + pub cpumask: [bool; 512usize], + pub n_threads: ::std::os::raw::c_int, + pub prio: ggml_sched_priority, + pub poll: u32, + pub strict_cpu: bool, + pub paused: bool, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ggml_threadpool_params"][::std::mem::size_of::() - 528usize]; + ["Alignment of ggml_threadpool_params"] + [::std::mem::align_of::() - 4usize]; + ["Offset of field: ggml_threadpool_params::cpumask"] + [::std::mem::offset_of!(ggml_threadpool_params, cpumask) - 0usize]; + ["Offset of field: ggml_threadpool_params::n_threads"] + [::std::mem::offset_of!(ggml_threadpool_params, n_threads) - 512usize]; + ["Offset of field: ggml_threadpool_params::prio"] + [::std::mem::offset_of!(ggml_threadpool_params, prio) - 516usize]; + ["Offset of field: ggml_threadpool_params::poll"] + [::std::mem::offset_of!(ggml_threadpool_params, poll) - 520usize]; + ["Offset of field: ggml_threadpool_params::strict_cpu"] + [::std::mem::offset_of!(ggml_threadpool_params, strict_cpu) - 524usize]; + ["Offset of field: ggml_threadpool_params::paused"] + [::std::mem::offset_of!(ggml_threadpool_params, paused) - 525usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ggml_threadpool { + _unused: [u8; 0], +} +pub type ggml_threadpool_t = *mut ggml_threadpool; +unsafe extern "C" { + pub fn ggml_threadpool_params_default( + n_threads: ::std::os::raw::c_int, + ) -> ggml_threadpool_params; +} +unsafe extern "C" { + pub fn ggml_threadpool_params_init( + p: *mut ggml_threadpool_params, + n_threads: ::std::os::raw::c_int, + ); +} +unsafe extern "C" { + pub fn ggml_threadpool_params_match( + p0: *const ggml_threadpool_params, + p1: *const ggml_threadpool_params, + ) -> bool; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ggml_backend_buffer_type { + _unused: [u8; 0], +} +pub type ggml_backend_buffer_type_t = *mut ggml_backend_buffer_type; +pub type ggml_backend_buffer_t = *mut ggml_backend_buffer; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ggml_backend { + _unused: [u8; 0], +} +pub type ggml_backend_t = *mut ggml_backend; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ggml_tallocr { + pub buffer: ggml_backend_buffer_t, + pub base: *mut ::std::os::raw::c_void, + pub alignment: usize, + pub offset: usize, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ggml_tallocr"][::std::mem::size_of::() - 32usize]; + ["Alignment of ggml_tallocr"][::std::mem::align_of::() - 8usize]; + ["Offset of field: ggml_tallocr::buffer"] + [::std::mem::offset_of!(ggml_tallocr, buffer) - 0usize]; + ["Offset of field: ggml_tallocr::base"][::std::mem::offset_of!(ggml_tallocr, base) - 8usize]; + ["Offset of field: ggml_tallocr::alignment"] + [::std::mem::offset_of!(ggml_tallocr, alignment) - 16usize]; + ["Offset of field: ggml_tallocr::offset"] + [::std::mem::offset_of!(ggml_tallocr, offset) - 24usize]; +}; +unsafe extern "C" { + pub fn ggml_tallocr_new(buffer: ggml_backend_buffer_t) -> ggml_tallocr; +} +unsafe extern "C" { + pub fn ggml_tallocr_alloc(talloc: *mut ggml_tallocr, tensor: *mut ggml_tensor); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ggml_gallocr { + _unused: [u8; 0], +} +pub type ggml_gallocr_t = *mut ggml_gallocr; +unsafe extern "C" { + pub fn ggml_gallocr_new(buft: ggml_backend_buffer_type_t) -> ggml_gallocr_t; +} +unsafe extern "C" { + pub fn ggml_gallocr_new_n( + bufts: *mut ggml_backend_buffer_type_t, + n_bufs: ::std::os::raw::c_int, + ) -> ggml_gallocr_t; +} +unsafe extern "C" { + pub fn ggml_gallocr_free(galloc: ggml_gallocr_t); +} +unsafe extern "C" { + pub fn ggml_gallocr_reserve(galloc: ggml_gallocr_t, graph: *mut ggml_cgraph) -> bool; +} +unsafe extern "C" { + pub fn ggml_gallocr_reserve_n( + galloc: ggml_gallocr_t, + graph: *mut ggml_cgraph, + node_buffer_ids: *const ::std::os::raw::c_int, + leaf_buffer_ids: *const ::std::os::raw::c_int, + ) -> bool; +} +unsafe extern "C" { + pub fn ggml_gallocr_alloc_graph(galloc: ggml_gallocr_t, graph: *mut ggml_cgraph) -> bool; +} +unsafe extern "C" { + pub fn ggml_gallocr_get_buffer_size( + galloc: ggml_gallocr_t, + buffer_id: ::std::os::raw::c_int, + ) -> usize; +} +unsafe extern "C" { + pub fn ggml_backend_alloc_ctx_tensors_from_buft( + ctx: *mut ggml_context, + buft: ggml_backend_buffer_type_t, + ) -> *mut ggml_backend_buffer; +} +unsafe extern "C" { + pub fn ggml_backend_alloc_ctx_tensors( + ctx: *mut ggml_context, + backend: ggml_backend_t, + ) -> *mut ggml_backend_buffer; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ggml_backend_event { + _unused: [u8; 0], +} +pub type ggml_backend_event_t = *mut ggml_backend_event; +pub type ggml_backend_graph_plan_t = *mut ::std::os::raw::c_void; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ggml_backend_reg { + _unused: [u8; 0], +} +pub type ggml_backend_reg_t = *mut ggml_backend_reg; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ggml_backend_device { + _unused: [u8; 0], +} +pub type ggml_backend_dev_t = *mut ggml_backend_device; +unsafe extern "C" { + pub fn ggml_backend_buft_name( + buft: ggml_backend_buffer_type_t, + ) -> *const ::std::os::raw::c_char; +} +unsafe extern "C" { + pub fn ggml_backend_buft_alloc_buffer( + buft: ggml_backend_buffer_type_t, + size: usize, + ) -> ggml_backend_buffer_t; +} +unsafe extern "C" { + pub fn ggml_backend_buft_get_alignment(buft: ggml_backend_buffer_type_t) -> usize; +} +unsafe extern "C" { + pub fn ggml_backend_buft_get_max_size(buft: ggml_backend_buffer_type_t) -> usize; +} +unsafe extern "C" { + pub fn ggml_backend_buft_get_alloc_size( + buft: ggml_backend_buffer_type_t, + tensor: *mut ggml_tensor, + ) -> usize; +} +unsafe extern "C" { + pub fn ggml_backend_buft_is_host(buft: ggml_backend_buffer_type_t) -> bool; +} +unsafe extern "C" { + pub fn ggml_backend_buft_get_device(buft: ggml_backend_buffer_type_t) -> ggml_backend_dev_t; +} +pub const ggml_backend_buffer_usage_GGML_BACKEND_BUFFER_USAGE_ANY: ggml_backend_buffer_usage = 0; +pub const ggml_backend_buffer_usage_GGML_BACKEND_BUFFER_USAGE_WEIGHTS: ggml_backend_buffer_usage = + 1; +pub const ggml_backend_buffer_usage_GGML_BACKEND_BUFFER_USAGE_COMPUTE: ggml_backend_buffer_usage = + 2; +pub type ggml_backend_buffer_usage = ::std::os::raw::c_uint; +unsafe extern "C" { + pub fn ggml_backend_buffer_name(buffer: ggml_backend_buffer_t) + -> *const ::std::os::raw::c_char; +} +unsafe extern "C" { + pub fn ggml_backend_buffer_free(buffer: ggml_backend_buffer_t); +} +unsafe extern "C" { + pub fn ggml_backend_buffer_get_base( + buffer: ggml_backend_buffer_t, + ) -> *mut ::std::os::raw::c_void; +} +unsafe extern "C" { + pub fn ggml_backend_buffer_get_size(buffer: ggml_backend_buffer_t) -> usize; +} +unsafe extern "C" { + pub fn ggml_backend_buffer_init_tensor(buffer: ggml_backend_buffer_t, tensor: *mut ggml_tensor); +} +unsafe extern "C" { + pub fn ggml_backend_buffer_get_alignment(buffer: ggml_backend_buffer_t) -> usize; +} +unsafe extern "C" { + pub fn ggml_backend_buffer_get_max_size(buffer: ggml_backend_buffer_t) -> usize; +} +unsafe extern "C" { + pub fn ggml_backend_buffer_get_alloc_size( + buffer: ggml_backend_buffer_t, + tensor: *mut ggml_tensor, + ) -> usize; +} +unsafe extern "C" { + pub fn ggml_backend_buffer_clear(buffer: ggml_backend_buffer_t, value: u8); +} +unsafe extern "C" { + pub fn ggml_backend_buffer_is_host(buffer: ggml_backend_buffer_t) -> bool; +} +unsafe extern "C" { + pub fn ggml_backend_buffer_set_usage( + buffer: ggml_backend_buffer_t, + usage: ggml_backend_buffer_usage, + ); +} +unsafe extern "C" { + pub fn ggml_backend_buffer_get_usage( + buffer: ggml_backend_buffer_t, + ) -> ggml_backend_buffer_usage; +} +unsafe extern "C" { + pub fn ggml_backend_buffer_get_type( + buffer: ggml_backend_buffer_t, + ) -> ggml_backend_buffer_type_t; +} +unsafe extern "C" { + pub fn ggml_backend_buffer_reset(buffer: ggml_backend_buffer_t); +} +unsafe extern "C" { + pub fn ggml_backend_tensor_copy(src: *mut ggml_tensor, dst: *mut ggml_tensor); +} +unsafe extern "C" { + pub fn ggml_backend_guid(backend: ggml_backend_t) -> ggml_guid_t; +} +unsafe extern "C" { + pub fn ggml_backend_name(backend: ggml_backend_t) -> *const ::std::os::raw::c_char; +} +unsafe extern "C" { + pub fn ggml_backend_free(backend: ggml_backend_t); +} +unsafe extern "C" { + pub fn ggml_backend_get_default_buffer_type( + backend: ggml_backend_t, + ) -> ggml_backend_buffer_type_t; +} +unsafe extern "C" { + pub fn ggml_backend_alloc_buffer(backend: ggml_backend_t, size: usize) + -> ggml_backend_buffer_t; +} +unsafe extern "C" { + pub fn ggml_backend_get_alignment(backend: ggml_backend_t) -> usize; +} +unsafe extern "C" { + pub fn ggml_backend_get_max_size(backend: ggml_backend_t) -> usize; +} +unsafe extern "C" { + pub fn ggml_backend_tensor_set_async( + backend: ggml_backend_t, + tensor: *mut ggml_tensor, + data: *const ::std::os::raw::c_void, + offset: usize, + size: usize, + ); +} +unsafe extern "C" { + pub fn ggml_backend_tensor_get_async( + backend: ggml_backend_t, + tensor: *const ggml_tensor, + data: *mut ::std::os::raw::c_void, + offset: usize, + size: usize, + ); +} +unsafe extern "C" { + pub fn ggml_backend_tensor_set( + tensor: *mut ggml_tensor, + data: *const ::std::os::raw::c_void, + offset: usize, + size: usize, + ); +} +unsafe extern "C" { + pub fn ggml_backend_tensor_get( + tensor: *const ggml_tensor, + data: *mut ::std::os::raw::c_void, + offset: usize, + size: usize, + ); +} +unsafe extern "C" { + pub fn ggml_backend_tensor_memset( + tensor: *mut ggml_tensor, + value: u8, + offset: usize, + size: usize, + ); +} +unsafe extern "C" { + pub fn ggml_backend_synchronize(backend: ggml_backend_t); +} +unsafe extern "C" { + pub fn ggml_backend_graph_plan_create( + backend: ggml_backend_t, + cgraph: *mut ggml_cgraph, + ) -> ggml_backend_graph_plan_t; +} +unsafe extern "C" { + pub fn ggml_backend_graph_plan_free(backend: ggml_backend_t, plan: ggml_backend_graph_plan_t); +} +unsafe extern "C" { + pub fn ggml_backend_graph_plan_compute( + backend: ggml_backend_t, + plan: ggml_backend_graph_plan_t, + ) -> ggml_status; +} +unsafe extern "C" { + pub fn ggml_backend_graph_compute( + backend: ggml_backend_t, + cgraph: *mut ggml_cgraph, + ) -> ggml_status; +} +unsafe extern "C" { + pub fn ggml_backend_graph_compute_async( + backend: ggml_backend_t, + cgraph: *mut ggml_cgraph, + ) -> ggml_status; +} +unsafe extern "C" { + pub fn ggml_backend_supports_op(backend: ggml_backend_t, op: *const ggml_tensor) -> bool; +} +unsafe extern "C" { + pub fn ggml_backend_supports_buft( + backend: ggml_backend_t, + buft: ggml_backend_buffer_type_t, + ) -> bool; +} +unsafe extern "C" { + pub fn ggml_backend_offload_op(backend: ggml_backend_t, op: *const ggml_tensor) -> bool; +} +unsafe extern "C" { + pub fn ggml_backend_tensor_copy_async( + backend_src: ggml_backend_t, + backend_dst: ggml_backend_t, + src: *mut ggml_tensor, + dst: *mut ggml_tensor, + ); +} +unsafe extern "C" { + pub fn ggml_backend_get_device(backend: ggml_backend_t) -> ggml_backend_dev_t; +} +unsafe extern "C" { + pub fn ggml_backend_event_new(device: ggml_backend_dev_t) -> ggml_backend_event_t; +} +unsafe extern "C" { + pub fn ggml_backend_event_free(event: ggml_backend_event_t); +} +unsafe extern "C" { + pub fn ggml_backend_event_record(event: ggml_backend_event_t, backend: ggml_backend_t); +} +unsafe extern "C" { + pub fn ggml_backend_event_synchronize(event: ggml_backend_event_t); +} +unsafe extern "C" { + pub fn ggml_backend_event_wait(backend: ggml_backend_t, event: ggml_backend_event_t); +} +pub const ggml_backend_dev_type_GGML_BACKEND_DEVICE_TYPE_CPU: ggml_backend_dev_type = 0; +pub const ggml_backend_dev_type_GGML_BACKEND_DEVICE_TYPE_GPU: ggml_backend_dev_type = 1; +pub const ggml_backend_dev_type_GGML_BACKEND_DEVICE_TYPE_ACCEL: ggml_backend_dev_type = 2; +pub type ggml_backend_dev_type = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ggml_backend_dev_caps { + pub async_: bool, + pub host_buffer: bool, + pub buffer_from_host_ptr: bool, + pub events: bool, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ggml_backend_dev_caps"][::std::mem::size_of::() - 4usize]; + ["Alignment of ggml_backend_dev_caps"] + [::std::mem::align_of::() - 1usize]; + ["Offset of field: ggml_backend_dev_caps::async_"] + [::std::mem::offset_of!(ggml_backend_dev_caps, async_) - 0usize]; + ["Offset of field: ggml_backend_dev_caps::host_buffer"] + [::std::mem::offset_of!(ggml_backend_dev_caps, host_buffer) - 1usize]; + ["Offset of field: ggml_backend_dev_caps::buffer_from_host_ptr"] + [::std::mem::offset_of!(ggml_backend_dev_caps, buffer_from_host_ptr) - 2usize]; + ["Offset of field: ggml_backend_dev_caps::events"] + [::std::mem::offset_of!(ggml_backend_dev_caps, events) - 3usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ggml_backend_dev_props { + pub name: *const ::std::os::raw::c_char, + pub description: *const ::std::os::raw::c_char, + pub memory_free: usize, + pub memory_total: usize, + pub type_: ggml_backend_dev_type, + pub caps: ggml_backend_dev_caps, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ggml_backend_dev_props"][::std::mem::size_of::() - 40usize]; + ["Alignment of ggml_backend_dev_props"] + [::std::mem::align_of::() - 8usize]; + ["Offset of field: ggml_backend_dev_props::name"] + [::std::mem::offset_of!(ggml_backend_dev_props, name) - 0usize]; + ["Offset of field: ggml_backend_dev_props::description"] + [::std::mem::offset_of!(ggml_backend_dev_props, description) - 8usize]; + ["Offset of field: ggml_backend_dev_props::memory_free"] + [::std::mem::offset_of!(ggml_backend_dev_props, memory_free) - 16usize]; + ["Offset of field: ggml_backend_dev_props::memory_total"] + [::std::mem::offset_of!(ggml_backend_dev_props, memory_total) - 24usize]; + ["Offset of field: ggml_backend_dev_props::type_"] + [::std::mem::offset_of!(ggml_backend_dev_props, type_) - 32usize]; + ["Offset of field: ggml_backend_dev_props::caps"] + [::std::mem::offset_of!(ggml_backend_dev_props, caps) - 36usize]; +}; +unsafe extern "C" { + pub fn ggml_backend_dev_name(device: ggml_backend_dev_t) -> *const ::std::os::raw::c_char; +} +unsafe extern "C" { + pub fn ggml_backend_dev_description( + device: ggml_backend_dev_t, + ) -> *const ::std::os::raw::c_char; +} +unsafe extern "C" { + pub fn ggml_backend_dev_memory(device: ggml_backend_dev_t, free: *mut usize, total: *mut usize); +} +unsafe extern "C" { + pub fn ggml_backend_dev_type(device: ggml_backend_dev_t) -> ggml_backend_dev_type; +} +unsafe extern "C" { + pub fn ggml_backend_dev_get_props( + device: ggml_backend_dev_t, + props: *mut ggml_backend_dev_props, + ); +} +unsafe extern "C" { + pub fn ggml_backend_dev_backend_reg(device: ggml_backend_dev_t) -> ggml_backend_reg_t; +} +unsafe extern "C" { + pub fn ggml_backend_dev_init( + device: ggml_backend_dev_t, + params: *const ::std::os::raw::c_char, + ) -> ggml_backend_t; +} +unsafe extern "C" { + pub fn ggml_backend_dev_buffer_type(device: ggml_backend_dev_t) -> ggml_backend_buffer_type_t; +} +unsafe extern "C" { + pub fn ggml_backend_dev_host_buffer_type( + device: ggml_backend_dev_t, + ) -> ggml_backend_buffer_type_t; +} +unsafe extern "C" { + pub fn ggml_backend_dev_buffer_from_host_ptr( + device: ggml_backend_dev_t, + ptr: *mut ::std::os::raw::c_void, + size: usize, + max_tensor_size: usize, + ) -> ggml_backend_buffer_t; +} +unsafe extern "C" { + pub fn ggml_backend_dev_supports_op(device: ggml_backend_dev_t, op: *const ggml_tensor) + -> bool; +} +unsafe extern "C" { + pub fn ggml_backend_dev_supports_buft( + device: ggml_backend_dev_t, + buft: ggml_backend_buffer_type_t, + ) -> bool; +} +unsafe extern "C" { + pub fn ggml_backend_dev_offload_op(device: ggml_backend_dev_t, op: *const ggml_tensor) -> bool; +} +unsafe extern "C" { + pub fn ggml_backend_reg_name(reg: ggml_backend_reg_t) -> *const ::std::os::raw::c_char; +} +unsafe extern "C" { + pub fn ggml_backend_reg_dev_count(reg: ggml_backend_reg_t) -> usize; +} +unsafe extern "C" { + pub fn ggml_backend_reg_dev_get(reg: ggml_backend_reg_t, index: usize) -> ggml_backend_dev_t; +} +unsafe extern "C" { + pub fn ggml_backend_reg_get_proc_address( + reg: ggml_backend_reg_t, + name: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_void; +} +pub type ggml_backend_split_buffer_type_t = ::std::option::Option< + unsafe extern "C" fn( + main_device: ::std::os::raw::c_int, + tensor_split: *const f32, + ) -> ggml_backend_buffer_type_t, +>; +pub type ggml_backend_set_n_threads_t = ::std::option::Option< + unsafe extern "C" fn(backend: ggml_backend_t, n_threads: ::std::os::raw::c_int), +>; +pub type ggml_backend_dev_get_extra_bufts_t = ::std::option::Option< + unsafe extern "C" fn(device: ggml_backend_dev_t) -> *mut ggml_backend_buffer_type_t, +>; +pub type ggml_backend_set_abort_callback_t = ::std::option::Option< + unsafe extern "C" fn( + backend: ggml_backend_t, + abort_callback: ggml_abort_callback, + abort_callback_data: *mut ::std::os::raw::c_void, + ), +>; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ggml_backend_feature { + pub name: *const ::std::os::raw::c_char, + pub value: *const ::std::os::raw::c_char, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ggml_backend_feature"][::std::mem::size_of::() - 16usize]; + ["Alignment of ggml_backend_feature"][::std::mem::align_of::() - 8usize]; + ["Offset of field: ggml_backend_feature::name"] + [::std::mem::offset_of!(ggml_backend_feature, name) - 0usize]; + ["Offset of field: ggml_backend_feature::value"] + [::std::mem::offset_of!(ggml_backend_feature, value) - 8usize]; +}; +pub type ggml_backend_get_features_t = ::std::option::Option< + unsafe extern "C" fn(reg: ggml_backend_reg_t) -> *mut ggml_backend_feature, +>; +unsafe extern "C" { + pub fn ggml_backend_reg_count() -> usize; +} +unsafe extern "C" { + pub fn ggml_backend_reg_get(index: usize) -> ggml_backend_reg_t; +} +unsafe extern "C" { + pub fn ggml_backend_reg_by_name(name: *const ::std::os::raw::c_char) -> ggml_backend_reg_t; +} +unsafe extern "C" { + pub fn ggml_backend_dev_count() -> usize; +} +unsafe extern "C" { + pub fn ggml_backend_dev_get(index: usize) -> ggml_backend_dev_t; +} +unsafe extern "C" { + pub fn ggml_backend_dev_by_name(name: *const ::std::os::raw::c_char) -> ggml_backend_dev_t; +} +unsafe extern "C" { + pub fn ggml_backend_dev_by_type(type_: ggml_backend_dev_type) -> ggml_backend_dev_t; +} +unsafe extern "C" { + pub fn ggml_backend_init_by_name( + name: *const ::std::os::raw::c_char, + params: *const ::std::os::raw::c_char, + ) -> ggml_backend_t; +} +unsafe extern "C" { + pub fn ggml_backend_init_by_type( + type_: ggml_backend_dev_type, + params: *const ::std::os::raw::c_char, + ) -> ggml_backend_t; +} +unsafe extern "C" { + pub fn ggml_backend_init_best() -> ggml_backend_t; +} +unsafe extern "C" { + pub fn ggml_backend_load(path: *const ::std::os::raw::c_char) -> ggml_backend_reg_t; +} +unsafe extern "C" { + pub fn ggml_backend_unload(reg: ggml_backend_reg_t); +} +unsafe extern "C" { + pub fn ggml_backend_load_all(); +} +unsafe extern "C" { + pub fn ggml_backend_load_all_from_path(dir_path: *const ::std::os::raw::c_char); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ggml_backend_sched { + _unused: [u8; 0], +} +pub type ggml_backend_sched_t = *mut ggml_backend_sched; +pub type ggml_backend_sched_eval_callback = ::std::option::Option< + unsafe extern "C" fn( + t: *mut ggml_tensor, + ask: bool, + user_data: *mut ::std::os::raw::c_void, + ) -> bool, +>; +unsafe extern "C" { + pub fn ggml_backend_sched_new( + backends: *mut ggml_backend_t, + bufts: *mut ggml_backend_buffer_type_t, + n_backends: ::std::os::raw::c_int, + graph_size: usize, + parallel: bool, + ) -> ggml_backend_sched_t; +} +unsafe extern "C" { + pub fn ggml_backend_sched_free(sched: ggml_backend_sched_t); +} +unsafe extern "C" { + pub fn ggml_backend_sched_reserve( + sched: ggml_backend_sched_t, + measure_graph: *mut ggml_cgraph, + ) -> bool; +} +unsafe extern "C" { + pub fn ggml_backend_sched_get_n_backends(sched: ggml_backend_sched_t) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_backend_sched_get_backend( + sched: ggml_backend_sched_t, + i: ::std::os::raw::c_int, + ) -> ggml_backend_t; +} +unsafe extern "C" { + pub fn ggml_backend_sched_get_n_splits(sched: ggml_backend_sched_t) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_backend_sched_get_n_copies(sched: ggml_backend_sched_t) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_backend_sched_get_buffer_size( + sched: ggml_backend_sched_t, + backend: ggml_backend_t, + ) -> usize; +} +unsafe extern "C" { + pub fn ggml_backend_sched_set_tensor_backend( + sched: ggml_backend_sched_t, + node: *mut ggml_tensor, + backend: ggml_backend_t, + ); +} +unsafe extern "C" { + pub fn ggml_backend_sched_get_tensor_backend( + sched: ggml_backend_sched_t, + node: *mut ggml_tensor, + ) -> ggml_backend_t; +} +unsafe extern "C" { + pub fn ggml_backend_sched_alloc_graph( + sched: ggml_backend_sched_t, + graph: *mut ggml_cgraph, + ) -> bool; +} +unsafe extern "C" { + pub fn ggml_backend_sched_graph_compute( + sched: ggml_backend_sched_t, + graph: *mut ggml_cgraph, + ) -> ggml_status; +} +unsafe extern "C" { + pub fn ggml_backend_sched_graph_compute_async( + sched: ggml_backend_sched_t, + graph: *mut ggml_cgraph, + ) -> ggml_status; +} +unsafe extern "C" { + pub fn ggml_backend_sched_synchronize(sched: ggml_backend_sched_t); +} +unsafe extern "C" { + pub fn ggml_backend_sched_reset(sched: ggml_backend_sched_t); +} +unsafe extern "C" { + pub fn ggml_backend_sched_set_eval_callback( + sched: ggml_backend_sched_t, + callback: ggml_backend_sched_eval_callback, + user_data: *mut ::std::os::raw::c_void, + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ggml_backend_graph_copy { + pub buffer: ggml_backend_buffer_t, + pub ctx_allocated: *mut ggml_context, + pub ctx_unallocated: *mut ggml_context, + pub graph: *mut ggml_cgraph, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ggml_backend_graph_copy"][::std::mem::size_of::() - 32usize]; + ["Alignment of ggml_backend_graph_copy"] + [::std::mem::align_of::() - 8usize]; + ["Offset of field: ggml_backend_graph_copy::buffer"] + [::std::mem::offset_of!(ggml_backend_graph_copy, buffer) - 0usize]; + ["Offset of field: ggml_backend_graph_copy::ctx_allocated"] + [::std::mem::offset_of!(ggml_backend_graph_copy, ctx_allocated) - 8usize]; + ["Offset of field: ggml_backend_graph_copy::ctx_unallocated"] + [::std::mem::offset_of!(ggml_backend_graph_copy, ctx_unallocated) - 16usize]; + ["Offset of field: ggml_backend_graph_copy::graph"] + [::std::mem::offset_of!(ggml_backend_graph_copy, graph) - 24usize]; +}; +unsafe extern "C" { + pub fn ggml_backend_graph_copy( + backend: ggml_backend_t, + graph: *mut ggml_cgraph, + ) -> ggml_backend_graph_copy; +} +unsafe extern "C" { + pub fn ggml_backend_graph_copy_free(copy: ggml_backend_graph_copy); +} +pub type ggml_backend_eval_callback = ::std::option::Option< + unsafe extern "C" fn( + node_index: ::std::os::raw::c_int, + t1: *mut ggml_tensor, + t2: *mut ggml_tensor, + user_data: *mut ::std::os::raw::c_void, + ) -> bool, +>; +unsafe extern "C" { + pub fn ggml_backend_compare_graph_backend( + backend1: ggml_backend_t, + backend2: ggml_backend_t, + graph: *mut ggml_cgraph, + callback: ggml_backend_eval_callback, + user_data: *mut ::std::os::raw::c_void, + ) -> bool; +} +unsafe extern "C" { + pub fn ggml_backend_tensor_alloc( + buffer: ggml_backend_buffer_t, + tensor: *mut ggml_tensor, + addr: *mut ::std::os::raw::c_void, + ); +} +unsafe extern "C" { + pub fn ggml_backend_view_init(tensor: *mut ggml_tensor); +} +unsafe extern "C" { + pub fn ggml_backend_cpu_buffer_from_ptr( + ptr: *mut ::std::os::raw::c_void, + size: usize, + ) -> ggml_backend_buffer_t; +} +unsafe extern "C" { + pub fn ggml_backend_cpu_buffer_type() -> ggml_backend_buffer_type_t; +} +#[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 threadpool: *mut ggml_threadpool, + pub abort_callback: ggml_abort_callback, + pub abort_callback_data: *mut ::std::os::raw::c_void, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ggml_cplan"][::std::mem::size_of::() - 48usize]; + ["Alignment of ggml_cplan"][::std::mem::align_of::() - 8usize]; + ["Offset of field: ggml_cplan::work_size"] + [::std::mem::offset_of!(ggml_cplan, work_size) - 0usize]; + ["Offset of field: ggml_cplan::work_data"] + [::std::mem::offset_of!(ggml_cplan, work_data) - 8usize]; + ["Offset of field: ggml_cplan::n_threads"] + [::std::mem::offset_of!(ggml_cplan, n_threads) - 16usize]; + ["Offset of field: ggml_cplan::threadpool"] + [::std::mem::offset_of!(ggml_cplan, threadpool) - 24usize]; + ["Offset of field: ggml_cplan::abort_callback"] + [::std::mem::offset_of!(ggml_cplan, abort_callback) - 32usize]; + ["Offset of field: ggml_cplan::abort_callback_data"] + [::std::mem::offset_of!(ggml_cplan, abort_callback_data) - 40usize]; +}; +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; +unsafe extern "C" { + pub fn ggml_numa_init(numa: ggml_numa_strategy); +} +unsafe extern "C" { + pub fn ggml_is_numa() -> bool; +} +unsafe extern "C" { + pub fn ggml_new_i32(ctx: *mut ggml_context, value: i32) -> *mut ggml_tensor; +} +unsafe extern "C" { + pub fn ggml_new_f32(ctx: *mut ggml_context, value: f32) -> *mut ggml_tensor; +} +unsafe extern "C" { + pub fn ggml_set_i32(tensor: *mut ggml_tensor, value: i32) -> *mut ggml_tensor; +} +unsafe extern "C" { + pub fn ggml_set_f32(tensor: *mut ggml_tensor, value: f32) -> *mut ggml_tensor; +} +unsafe extern "C" { + pub fn ggml_get_i32_1d(tensor: *const ggml_tensor, i: ::std::os::raw::c_int) -> i32; +} +unsafe extern "C" { + pub fn ggml_set_i32_1d(tensor: *const ggml_tensor, i: ::std::os::raw::c_int, value: i32); +} +unsafe extern "C" { + pub fn ggml_get_i32_nd( + tensor: *const ggml_tensor, + i0: ::std::os::raw::c_int, + i1: ::std::os::raw::c_int, + i2: ::std::os::raw::c_int, + i3: ::std::os::raw::c_int, + ) -> i32; +} +unsafe extern "C" { + pub fn ggml_set_i32_nd( + tensor: *const ggml_tensor, + i0: ::std::os::raw::c_int, + i1: ::std::os::raw::c_int, + i2: ::std::os::raw::c_int, + i3: ::std::os::raw::c_int, + value: i32, + ); +} +unsafe extern "C" { + pub fn ggml_get_f32_1d(tensor: *const ggml_tensor, i: ::std::os::raw::c_int) -> f32; +} +unsafe extern "C" { + pub fn ggml_set_f32_1d(tensor: *const ggml_tensor, i: ::std::os::raw::c_int, value: f32); +} +unsafe extern "C" { + pub fn ggml_get_f32_nd( + tensor: *const ggml_tensor, + i0: ::std::os::raw::c_int, + i1: ::std::os::raw::c_int, + i2: ::std::os::raw::c_int, + i3: ::std::os::raw::c_int, + ) -> f32; +} +unsafe extern "C" { + pub fn ggml_set_f32_nd( + tensor: *const ggml_tensor, + i0: ::std::os::raw::c_int, + i1: ::std::os::raw::c_int, + i2: ::std::os::raw::c_int, + i3: ::std::os::raw::c_int, + value: f32, + ); +} +unsafe extern "C" { + pub fn ggml_threadpool_new(params: *mut ggml_threadpool_params) -> *mut ggml_threadpool; +} +unsafe extern "C" { + pub fn ggml_threadpool_free(threadpool: *mut ggml_threadpool); +} +unsafe extern "C" { + pub fn ggml_threadpool_get_n_threads(threadpool: *mut ggml_threadpool) + -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_threadpool_pause(threadpool: *mut ggml_threadpool); +} +unsafe extern "C" { + pub fn ggml_threadpool_resume(threadpool: *mut ggml_threadpool); +} +unsafe extern "C" { + pub fn ggml_graph_plan( + cgraph: *const ggml_cgraph, + n_threads: ::std::os::raw::c_int, + threadpool: *mut ggml_threadpool, + ) -> ggml_cplan; +} +unsafe extern "C" { + pub fn ggml_graph_compute(cgraph: *mut ggml_cgraph, cplan: *mut ggml_cplan) -> ggml_status; +} +unsafe 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; +} +unsafe extern "C" { + pub fn ggml_cpu_has_sse3() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_ssse3() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_avx() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_avx_vnni() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_avx2() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_f16c() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_fma() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_avx512() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_avx512_vbmi() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_avx512_vnni() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_avx512_bf16() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_amx_int8() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_neon() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_arm_fma() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_fp16_va() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_dotprod() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_matmul_int8() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_sve() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_get_sve_cnt() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_riscv_v() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_vsx() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_wasm_simd() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ggml_cpu_has_llamafile() -> ::std::os::raw::c_int; +} +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)] +#[derive(Debug, Copy, Clone)] +pub struct ggml_type_traits_cpu { + pub from_float: ggml_from_float_t, + pub vec_dot: ggml_vec_dot_t, + pub vec_dot_type: ggml_type, + pub nrows: i64, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ggml_type_traits_cpu"][::std::mem::size_of::() - 32usize]; + ["Alignment of ggml_type_traits_cpu"][::std::mem::align_of::() - 8usize]; + ["Offset of field: ggml_type_traits_cpu::from_float"] + [::std::mem::offset_of!(ggml_type_traits_cpu, from_float) - 0usize]; + ["Offset of field: ggml_type_traits_cpu::vec_dot"] + [::std::mem::offset_of!(ggml_type_traits_cpu, vec_dot) - 8usize]; + ["Offset of field: ggml_type_traits_cpu::vec_dot_type"] + [::std::mem::offset_of!(ggml_type_traits_cpu, vec_dot_type) - 16usize]; + ["Offset of field: ggml_type_traits_cpu::nrows"] + [::std::mem::offset_of!(ggml_type_traits_cpu, nrows) - 24usize]; +}; +unsafe extern "C" { + pub fn ggml_get_type_traits_cpu(type_: ggml_type) -> *const ggml_type_traits_cpu; +} +unsafe extern "C" { + pub fn ggml_cpu_init(); +} +unsafe extern "C" { + pub fn ggml_backend_cpu_init() -> ggml_backend_t; +} +unsafe extern "C" { + pub fn ggml_backend_is_cpu(backend: ggml_backend_t) -> bool; +} +unsafe extern "C" { + pub fn ggml_backend_cpu_set_n_threads( + backend_cpu: ggml_backend_t, + n_threads: ::std::os::raw::c_int, + ); +} +unsafe extern "C" { + pub fn ggml_backend_cpu_set_threadpool( + backend_cpu: ggml_backend_t, + threadpool: ggml_threadpool_t, + ); +} +unsafe extern "C" { + pub fn ggml_backend_cpu_set_abort_callback( + backend_cpu: ggml_backend_t, + abort_callback: ggml_abort_callback, + abort_callback_data: *mut ::std::os::raw::c_void, + ); +} +unsafe extern "C" { + pub fn ggml_backend_cpu_reg() -> ggml_backend_reg_t; +} #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct whisper_context { @@ -4148,76 +4737,76 @@ const _: () = { ["Offset of field: whisper_grammar_element::value"] [::std::mem::offset_of!(whisper_grammar_element, value) - 4usize]; }; -extern "C" { +unsafe extern "C" { pub fn whisper_init_from_file_with_params( path_model: *const ::std::os::raw::c_char, params: whisper_context_params, ) -> *mut whisper_context; } -extern "C" { +unsafe extern "C" { pub fn whisper_init_from_buffer_with_params( buffer: *mut ::std::os::raw::c_void, buffer_size: usize, params: whisper_context_params, ) -> *mut whisper_context; } -extern "C" { +unsafe extern "C" { pub fn whisper_init_with_params( loader: *mut whisper_model_loader, params: whisper_context_params, ) -> *mut whisper_context; } -extern "C" { +unsafe extern "C" { pub fn whisper_init_from_file_with_params_no_state( path_model: *const ::std::os::raw::c_char, params: whisper_context_params, ) -> *mut whisper_context; } -extern "C" { +unsafe extern "C" { pub fn whisper_init_from_buffer_with_params_no_state( buffer: *mut ::std::os::raw::c_void, buffer_size: usize, params: whisper_context_params, ) -> *mut whisper_context; } -extern "C" { +unsafe extern "C" { pub fn whisper_init_with_params_no_state( loader: *mut whisper_model_loader, params: whisper_context_params, ) -> *mut whisper_context; } -extern "C" { +unsafe extern "C" { pub fn whisper_init_from_file( path_model: *const ::std::os::raw::c_char, ) -> *mut whisper_context; } -extern "C" { +unsafe extern "C" { pub fn whisper_init_from_buffer( buffer: *mut ::std::os::raw::c_void, buffer_size: usize, ) -> *mut whisper_context; } -extern "C" { +unsafe extern "C" { pub fn whisper_init(loader: *mut whisper_model_loader) -> *mut whisper_context; } -extern "C" { +unsafe extern "C" { pub fn whisper_init_from_file_no_state( path_model: *const ::std::os::raw::c_char, ) -> *mut whisper_context; } -extern "C" { +unsafe extern "C" { pub fn whisper_init_from_buffer_no_state( buffer: *mut ::std::os::raw::c_void, buffer_size: usize, ) -> *mut whisper_context; } -extern "C" { +unsafe extern "C" { pub fn whisper_init_no_state(loader: *mut whisper_model_loader) -> *mut whisper_context; } -extern "C" { +unsafe extern "C" { pub fn whisper_init_state(ctx: *mut whisper_context) -> *mut whisper_state; } -extern "C" { +unsafe extern "C" { pub fn whisper_ctx_init_openvino_encoder_with_state( ctx: *mut whisper_context, state: *mut whisper_state, @@ -4226,7 +4815,7 @@ extern "C" { cache_dir: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_ctx_init_openvino_encoder( ctx: *mut whisper_context, model_path: *const ::std::os::raw::c_char, @@ -4234,19 +4823,19 @@ extern "C" { cache_dir: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_free(ctx: *mut whisper_context); } -extern "C" { +unsafe extern "C" { pub fn whisper_free_state(state: *mut whisper_state); } -extern "C" { +unsafe extern "C" { pub fn whisper_free_params(params: *mut whisper_full_params); } -extern "C" { +unsafe extern "C" { pub fn whisper_free_context_params(params: *mut whisper_context_params); } -extern "C" { +unsafe extern "C" { pub fn whisper_pcm_to_mel( ctx: *mut whisper_context, samples: *const f32, @@ -4254,7 +4843,7 @@ extern "C" { n_threads: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_pcm_to_mel_with_state( ctx: *mut whisper_context, state: *mut whisper_state, @@ -4263,7 +4852,7 @@ extern "C" { n_threads: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_set_mel( ctx: *mut whisper_context, data: *const f32, @@ -4271,7 +4860,7 @@ extern "C" { n_mel: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_set_mel_with_state( ctx: *mut whisper_context, state: *mut whisper_state, @@ -4280,14 +4869,14 @@ extern "C" { n_mel: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_encode( ctx: *mut whisper_context, offset: ::std::os::raw::c_int, n_threads: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_encode_with_state( ctx: *mut whisper_context, state: *mut whisper_state, @@ -4295,7 +4884,7 @@ extern "C" { n_threads: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_decode( ctx: *mut whisper_context, tokens: *const whisper_token, @@ -4304,7 +4893,7 @@ extern "C" { n_threads: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_decode_with_state( ctx: *mut whisper_context, state: *mut whisper_state, @@ -4314,7 +4903,7 @@ extern "C" { n_threads: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_tokenize( ctx: *mut whisper_context, text: *const ::std::os::raw::c_char, @@ -4322,25 +4911,25 @@ extern "C" { n_max_tokens: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe 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" { +unsafe extern "C" { pub fn whisper_lang_max_id() -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_lang_id(lang: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_lang_str(id: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn whisper_lang_str_full(id: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn whisper_lang_auto_detect( ctx: *mut whisper_context, offset_ms: ::std::os::raw::c_int, @@ -4348,7 +4937,7 @@ extern "C" { lang_probs: *mut f32, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_lang_auto_detect_with_state( ctx: *mut whisper_context, state: *mut whisper_state, @@ -4357,115 +4946,142 @@ extern "C" { lang_probs: *mut f32, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_n_len(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_n_len_from_state(state: *mut whisper_state) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_n_vocab(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_n_text_ctx(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_n_audio_ctx(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_is_multilingual(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_model_n_vocab(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_model_n_audio_ctx(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_model_n_audio_state(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_model_n_audio_head(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_model_n_audio_layer(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_model_n_text_ctx(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_model_n_text_state(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_model_n_text_head(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_model_n_text_layer(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_model_n_mels(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_model_ftype(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_model_type(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_get_logits(ctx: *mut whisper_context) -> *mut f32; } -extern "C" { +unsafe extern "C" { pub fn whisper_get_logits_from_state(state: *mut whisper_state) -> *mut f32; } -extern "C" { +unsafe extern "C" { pub fn whisper_token_to_str( ctx: *mut whisper_context, token: whisper_token, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn whisper_model_type_readable(ctx: *mut whisper_context) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn whisper_token_eot(ctx: *mut whisper_context) -> whisper_token; } -extern "C" { +unsafe extern "C" { pub fn whisper_token_sot(ctx: *mut whisper_context) -> whisper_token; } -extern "C" { +unsafe extern "C" { pub fn whisper_token_solm(ctx: *mut whisper_context) -> whisper_token; } -extern "C" { +unsafe extern "C" { pub fn whisper_token_prev(ctx: *mut whisper_context) -> whisper_token; } -extern "C" { +unsafe extern "C" { pub fn whisper_token_nosp(ctx: *mut whisper_context) -> whisper_token; } -extern "C" { +unsafe extern "C" { pub fn whisper_token_not(ctx: *mut whisper_context) -> whisper_token; } -extern "C" { +unsafe extern "C" { pub fn whisper_token_beg(ctx: *mut whisper_context) -> whisper_token; } -extern "C" { +unsafe extern "C" { pub fn whisper_token_lang( ctx: *mut whisper_context, lang_id: ::std::os::raw::c_int, ) -> whisper_token; } -extern "C" { +unsafe extern "C" { pub fn whisper_token_translate(ctx: *mut whisper_context) -> whisper_token; } -extern "C" { +unsafe extern "C" { pub fn whisper_token_transcribe(ctx: *mut whisper_context) -> whisper_token; } -extern "C" { +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct whisper_timings { + pub sample_ms: f32, + pub encode_ms: f32, + pub decode_ms: f32, + pub batchd_ms: f32, + pub prompt_ms: f32, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of whisper_timings"][::std::mem::size_of::() - 20usize]; + ["Alignment of whisper_timings"][::std::mem::align_of::() - 4usize]; + ["Offset of field: whisper_timings::sample_ms"] + [::std::mem::offset_of!(whisper_timings, sample_ms) - 0usize]; + ["Offset of field: whisper_timings::encode_ms"] + [::std::mem::offset_of!(whisper_timings, encode_ms) - 4usize]; + ["Offset of field: whisper_timings::decode_ms"] + [::std::mem::offset_of!(whisper_timings, decode_ms) - 8usize]; + ["Offset of field: whisper_timings::batchd_ms"] + [::std::mem::offset_of!(whisper_timings, batchd_ms) - 12usize]; + ["Offset of field: whisper_timings::prompt_ms"] + [::std::mem::offset_of!(whisper_timings, prompt_ms) - 16usize]; +}; +unsafe extern "C" { + pub fn whisper_get_timings(ctx: *mut whisper_context) -> *mut whisper_timings; +} +unsafe extern "C" { pub fn whisper_print_timings(ctx: *mut whisper_context); } -extern "C" { +unsafe extern "C" { pub fn whisper_reset_timings(ctx: *mut whisper_context); } -extern "C" { +unsafe extern "C" { pub fn whisper_print_system_info() -> *const ::std::os::raw::c_char; } pub const whisper_sampling_strategy_WHISPER_SAMPLING_GREEDY: whisper_sampling_strategy = 0; @@ -4536,7 +5152,7 @@ pub struct whisper_full_params { pub language: *const ::std::os::raw::c_char, pub detect_language: bool, pub suppress_blank: bool, - pub suppress_non_speech_tokens: bool, + pub suppress_nst: bool, pub temperature: f32, pub max_initial_ts: f32, pub length_penalty: f32, @@ -4654,8 +5270,8 @@ const _: () = { [::std::mem::offset_of!(whisper_full_params, detect_language) - 104usize]; ["Offset of field: whisper_full_params::suppress_blank"] [::std::mem::offset_of!(whisper_full_params, suppress_blank) - 105usize]; - ["Offset of field: whisper_full_params::suppress_non_speech_tokens"] - [::std::mem::offset_of!(whisper_full_params, suppress_non_speech_tokens) - 106usize]; + ["Offset of field: whisper_full_params::suppress_nst"] + [::std::mem::offset_of!(whisper_full_params, suppress_nst) - 106usize]; ["Offset of field: whisper_full_params::temperature"] [::std::mem::offset_of!(whisper_full_params, temperature) - 108usize]; ["Offset of field: whisper_full_params::max_initial_ts"] @@ -4703,21 +5319,21 @@ const _: () = { ["Offset of field: whisper_full_params::grammar_penalty"] [::std::mem::offset_of!(whisper_full_params, grammar_penalty) - 256usize]; }; -extern "C" { +unsafe extern "C" { pub fn whisper_context_default_params_by_ref() -> *mut whisper_context_params; } -extern "C" { +unsafe extern "C" { pub fn whisper_context_default_params() -> whisper_context_params; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_default_params_by_ref( strategy: whisper_sampling_strategy, ) -> *mut whisper_full_params; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_default_params(strategy: whisper_sampling_strategy) -> whisper_full_params; } -extern "C" { +unsafe extern "C" { pub fn whisper_full( ctx: *mut whisper_context, params: whisper_full_params, @@ -4725,7 +5341,7 @@ extern "C" { n_samples: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_with_state( ctx: *mut whisper_context, state: *mut whisper_state, @@ -4734,7 +5350,7 @@ extern "C" { n_samples: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_parallel( ctx: *mut whisper_context, params: whisper_full_params, @@ -4743,86 +5359,86 @@ extern "C" { n_processors: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_n_segments(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_n_segments_from_state(state: *mut whisper_state) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_lang_id(ctx: *mut whisper_context) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_lang_id_from_state(state: *mut whisper_state) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_get_segment_t0( ctx: *mut whisper_context, i_segment: ::std::os::raw::c_int, ) -> i64; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_get_segment_t0_from_state( state: *mut whisper_state, i_segment: ::std::os::raw::c_int, ) -> i64; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_get_segment_t1( ctx: *mut whisper_context, i_segment: ::std::os::raw::c_int, ) -> i64; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_get_segment_t1_from_state( state: *mut whisper_state, i_segment: ::std::os::raw::c_int, ) -> i64; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_get_segment_speaker_turn_next( ctx: *mut whisper_context, i_segment: ::std::os::raw::c_int, ) -> bool; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_get_segment_speaker_turn_next_from_state( state: *mut whisper_state, i_segment: ::std::os::raw::c_int, ) -> bool; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_get_segment_text( ctx: *mut whisper_context, i_segment: ::std::os::raw::c_int, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_get_segment_text_from_state( state: *mut whisper_state, i_segment: ::std::os::raw::c_int, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_n_tokens( ctx: *mut whisper_context, i_segment: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_n_tokens_from_state( state: *mut whisper_state, i_segment: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_get_token_text( ctx: *mut whisper_context, i_segment: ::std::os::raw::c_int, i_token: ::std::os::raw::c_int, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_get_token_text_from_state( ctx: *mut whisper_context, state: *mut whisper_state, @@ -4830,67 +5446,73 @@ extern "C" { i_token: ::std::os::raw::c_int, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_get_token_id( ctx: *mut whisper_context, i_segment: ::std::os::raw::c_int, i_token: ::std::os::raw::c_int, ) -> whisper_token; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_get_token_id_from_state( state: *mut whisper_state, i_segment: ::std::os::raw::c_int, i_token: ::std::os::raw::c_int, ) -> whisper_token; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_get_token_data( ctx: *mut whisper_context, i_segment: ::std::os::raw::c_int, i_token: ::std::os::raw::c_int, ) -> whisper_token_data; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_get_token_data_from_state( state: *mut whisper_state, i_segment: ::std::os::raw::c_int, i_token: ::std::os::raw::c_int, ) -> whisper_token_data; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_get_token_p( ctx: *mut whisper_context, i_segment: ::std::os::raw::c_int, i_token: ::std::os::raw::c_int, ) -> f32; } -extern "C" { +unsafe extern "C" { pub fn whisper_full_get_token_p_from_state( state: *mut whisper_state, i_segment: ::std::os::raw::c_int, i_token: ::std::os::raw::c_int, ) -> f32; } -extern "C" { +unsafe extern "C" { pub fn whisper_bench_memcpy(n_threads: ::std::os::raw::c_int) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_bench_memcpy_str( n_threads: ::std::os::raw::c_int, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn whisper_bench_ggml_mul_mat(n_threads: ::std::os::raw::c_int) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn whisper_bench_ggml_mul_mat_str( n_threads: ::std::os::raw::c_int, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn whisper_log_set(log_callback: ggml_log_callback, user_data: *mut ::std::os::raw::c_void); } +unsafe extern "C" { + pub fn whisper_full_get_segment_no_speech_prob( + ctx: *mut whisper_context, + i_segment: ::std::os::raw::c_int, + ) -> f32; +} pub type __builtin_va_list = [__va_list_tag; 1usize]; #[repr(C)] #[derive(Debug, Copy, Clone)]