Merge pull request #169 from arizhih/whisper-cpp-latest
feat: Add support for new whisper.cpp project structure
This commit is contained in:
commit
8596d2d98c
10 changed files with 305 additions and 396 deletions
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "whisper-rs-sys"
|
||||
version = "0.10.1"
|
||||
version = "0.11.0"
|
||||
edition = "2021"
|
||||
description = "Rust bindings for whisper.cpp (FFI bindings)"
|
||||
license = "Unlicense"
|
||||
|
|
@ -10,29 +10,28 @@ links = "whisper"
|
|||
include = [
|
||||
"whisper.cpp/bindings/javascript/package-tmpl.json",
|
||||
"whisper.cpp/bindings/CMakeLists.txt",
|
||||
"whisper.cpp/cmake",
|
||||
"whisper.cpp/coreml",
|
||||
"whisper.cpp/CMakeLists.txt",
|
||||
"whisper.cpp/ggml.c",
|
||||
"whisper.cpp/ggml.h",
|
||||
"whisper.cpp/ggml-alloc.c",
|
||||
"whisper.cpp/ggml-alloc.h",
|
||||
"whisper.cpp/ggml-backend.c",
|
||||
"whisper.cpp/ggml-backend.h",
|
||||
"whisper.cpp/ggml-backend-impl.h",
|
||||
"whisper.cpp/ggml-cuda.cu",
|
||||
"whisper.cpp/ggml-cuda.h",
|
||||
"whisper.cpp/ggml-impl.h",
|
||||
"whisper.cpp/ggml-metal.h",
|
||||
"whisper.cpp/ggml-metal.m",
|
||||
"whisper.cpp/ggml-metal.metal",
|
||||
"whisper.cpp/ggml-opencl.cpp",
|
||||
"whisper.cpp/ggml-opencl.h",
|
||||
"whisper.cpp/ggml-quants.h",
|
||||
"whisper.cpp/ggml-quants.c",
|
||||
"whisper.cpp/cmake",
|
||||
"whisper.cpp/src/coreml",
|
||||
"whisper.cpp/src/CMakeLists.txt",
|
||||
"whisper.cpp/src/whisper.cpp",
|
||||
"whisper.cpp/include/whisper.h",
|
||||
"whisper.cpp/ggml/src/ggml.c",
|
||||
"whisper.cpp/ggml/src/ggml-alloc.c",
|
||||
"whisper.cpp/ggml/src/ggml-backend.c",
|
||||
"whisper.cpp/ggml/src/ggml-cuda.cu",
|
||||
"whisper.cpp/ggml/src/ggml-impl.h",
|
||||
"whisper.cpp/ggml/src/ggml-metal.m",
|
||||
"whisper.cpp/ggml/src/ggml-metal.metal",
|
||||
"whisper.cpp/ggml/src/ggml-quants.h",
|
||||
"whisper.cpp/ggml/src/ggml-quants.c",
|
||||
"whisper.cpp/ggml/include/ggml.h",
|
||||
"whisper.cpp/ggml/include/ggml-alloc.h",
|
||||
"whisper.cpp/ggml/include/ggml-backend.h",
|
||||
"whisper.cpp/ggml/include/ggml-backend-impl.h",
|
||||
"whisper.cpp/ggml/include/ggml-cuda.h",
|
||||
"whisper.cpp/ggml/include/ggml-metal.h",
|
||||
"whisper.cpp/LICENSE",
|
||||
"whisper.cpp/whisper.cpp",
|
||||
"whisper.cpp/whisper.h",
|
||||
"src/*.rs",
|
||||
"build.rs",
|
||||
"wrapper.h",
|
||||
|
|
@ -44,10 +43,10 @@ include = [
|
|||
coreml = []
|
||||
cuda = []
|
||||
hipblas = []
|
||||
opencl = []
|
||||
openblas = []
|
||||
metal = []
|
||||
force-debug = []
|
||||
openmp = []
|
||||
|
||||
[build-dependencies]
|
||||
cmake = "0.1"
|
||||
|
|
|
|||
60
sys/build.rs
60
sys/build.rs
|
|
@ -30,11 +30,6 @@ fn main() {
|
|||
|
||||
#[cfg(feature = "coreml")]
|
||||
println!("cargo:rustc-link-lib=static=whisper.coreml");
|
||||
#[cfg(feature = "opencl")]
|
||||
{
|
||||
println!("cargo:rustc-link-lib=clblast");
|
||||
println!("cargo:rustc-link-lib=OpenCL");
|
||||
}
|
||||
#[cfg(feature = "openblas")]
|
||||
{
|
||||
if let Ok(openblas_path) = env::var("OPENBLAS_PATH") {
|
||||
|
|
@ -91,6 +86,13 @@ fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "openmp")]
|
||||
{
|
||||
if target.contains("gnu") {
|
||||
println!("cargo:rustc-link-lib=gomp");
|
||||
}
|
||||
}
|
||||
|
||||
println!("cargo:rerun-if-changed=wrapper.h");
|
||||
|
||||
let out = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
|
|
@ -114,10 +116,11 @@ fn main() {
|
|||
let bindings = bindgen::Builder::default().header("wrapper.h");
|
||||
|
||||
#[cfg(feature = "metal")]
|
||||
let bindings = bindings.header("whisper.cpp/ggml-metal.h");
|
||||
let bindings = bindings.header("whisper.cpp/ggml/include/ggml-metal.h");
|
||||
|
||||
let bindings = bindings
|
||||
.clang_arg("-I./whisper.cpp")
|
||||
.clang_arg("-I./whisper.cpp/include")
|
||||
.clang_arg("-I./whisper.cpp/ggml/include")
|
||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
||||
.generate();
|
||||
|
||||
|
|
@ -160,11 +163,11 @@ fn main() {
|
|||
}
|
||||
|
||||
if cfg!(feature = "cuda") {
|
||||
config.define("WHISPER_CUDA", "ON");
|
||||
config.define("GGML_CUDA", "ON");
|
||||
}
|
||||
|
||||
if cfg!(feature = "hipblas") {
|
||||
config.define("WHISPER_HIPBLAS", "ON");
|
||||
config.define("GGML_HIPBLAS", "ON");
|
||||
config.define("CMAKE_C_COMPILER", "hipcc");
|
||||
config.define("CMAKE_CXX_COMPILER", "hipcc");
|
||||
println!("cargo:rerun-if-env-changed=AMDGPU_TARGETS");
|
||||
|
|
@ -174,20 +177,16 @@ fn main() {
|
|||
}
|
||||
|
||||
if cfg!(feature = "openblas") {
|
||||
config.define("WHISPER_OPENBLAS", "ON");
|
||||
}
|
||||
|
||||
if cfg!(feature = "opencl") {
|
||||
config.define("WHISPER_CLBLAST", "ON");
|
||||
config.define("GGML_BLAS", "ON");
|
||||
}
|
||||
|
||||
if cfg!(feature = "metal") {
|
||||
config.define("WHISPER_METAL", "ON");
|
||||
config.define("WHISPER_METAL_NDEBUG", "ON");
|
||||
config.define("WHISPER_METAL_EMBED_LIBRARY", "ON");
|
||||
config.define("GGML_METAL", "ON");
|
||||
config.define("GGML_METAL_NDEBUG", "ON");
|
||||
config.define("GGML_METAL_EMBED_LIBRARY", "ON");
|
||||
} else {
|
||||
// Metal is enabled by default, so we need to explicitly disable it
|
||||
config.define("WHISPER_METAL", "OFF");
|
||||
config.define("GGML_METAL", "OFF");
|
||||
}
|
||||
|
||||
if cfg!(debug_assertions) || cfg!(feature = "force-debug") {
|
||||
|
|
@ -207,18 +206,17 @@ fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
if cfg!(not(feature = "openmp")) {
|
||||
config.define("GGML_OPENMP", "OFF");
|
||||
}
|
||||
|
||||
let destination = config.build();
|
||||
|
||||
if target.contains("window") && !target.contains("gnu") {
|
||||
println!(
|
||||
"cargo:rustc-link-search={}",
|
||||
out.join("build").join("Release").display()
|
||||
);
|
||||
} else {
|
||||
println!("cargo:rustc-link-search={}", out.join("build").display());
|
||||
}
|
||||
add_link_search_path(&out.join("lib")).unwrap();
|
||||
|
||||
println!("cargo:rustc-link-search=native={}", destination.display());
|
||||
println!("cargo:rustc-link-lib=static=whisper");
|
||||
println!("cargo:rustc-link-lib=static=ggml");
|
||||
|
||||
// for whatever reason this file is generated during build and triggers cargo complaining
|
||||
_ = std::fs::remove_file("bindings/javascript/package.json");
|
||||
|
|
@ -236,3 +234,13 @@ fn get_cpp_link_stdlib(target: &str) -> Option<&'static str> {
|
|||
Some("stdc++")
|
||||
}
|
||||
}
|
||||
|
||||
fn add_link_search_path(dir: &std::path::Path) -> std::io::Result<()> {
|
||||
if dir.is_dir() {
|
||||
println!("cargo:rustc-link-search={}", dir.display());
|
||||
for entry in std::fs::read_dir(dir)? {
|
||||
add_link_search_path(&entry?.path())?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* automatically generated by rust-bindgen 0.69.1 */
|
||||
/* automatically generated by rust-bindgen 0.69.4 */
|
||||
|
||||
pub const __bool_true_false_are_defined: u32 = 1;
|
||||
pub const true_: u32 = 1;
|
||||
|
|
@ -161,8 +161,10 @@ pub const GGML_KQ_MASK_PAD: u32 = 32;
|
|||
pub const GGML_N_TASKS_MAX: i32 = -1;
|
||||
pub const WHISPER_SAMPLE_RATE: u32 = 16000;
|
||||
pub const WHISPER_N_FFT: u32 = 400;
|
||||
pub const WHISPER_N_FFT_HALF: u32 = 201;
|
||||
pub const WHISPER_HOP_LENGTH: u32 = 160;
|
||||
pub const WHISPER_CHUNK_SIZE: u32 = 30;
|
||||
pub const WHISPER_N_SAMPLES: u32 = 480000;
|
||||
pub type wchar_t = ::std::os::raw::c_int;
|
||||
#[repr(C)]
|
||||
#[repr(align(16))]
|
||||
|
|
@ -1289,6 +1291,14 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn __overflow(arg1: *mut FILE, arg2: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_abort(
|
||||
file: *const ::std::os::raw::c_char,
|
||||
line: ::std::os::raw::c_int,
|
||||
fmt: *const ::std::os::raw::c_char,
|
||||
...
|
||||
);
|
||||
}
|
||||
pub const ggml_status_GGML_STATUS_ALLOC_FAILED: ggml_status = -2;
|
||||
pub const ggml_status_GGML_STATUS_FAILED: ggml_status = -1;
|
||||
pub const ggml_status_GGML_STATUS_SUCCESS: ggml_status = 0;
|
||||
|
|
@ -1349,6 +1359,9 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn ggml_bf16_to_fp32_row(arg1: *const ggml_bf16_t, arg2: *mut f32, arg3: i64);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_fp32_to_bf16_row_ref(arg1: *const f32, arg2: *mut ggml_bf16_t, arg3: i64);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_fp32_to_bf16_row(arg1: *const f32, arg2: *mut ggml_bf16_t, arg3: i64);
|
||||
}
|
||||
|
|
@ -1386,7 +1399,10 @@ pub const ggml_type_GGML_TYPE_I64: ggml_type = 27;
|
|||
pub const ggml_type_GGML_TYPE_F64: ggml_type = 28;
|
||||
pub const ggml_type_GGML_TYPE_IQ1_M: ggml_type = 29;
|
||||
pub const ggml_type_GGML_TYPE_BF16: ggml_type = 30;
|
||||
pub const ggml_type_GGML_TYPE_COUNT: ggml_type = 31;
|
||||
pub 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_COUNT: ggml_type = 34;
|
||||
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;
|
||||
|
|
@ -1419,6 +1435,9 @@ 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;
|
||||
|
|
@ -1475,28 +1494,26 @@ pub const ggml_op_GGML_OP_ARANGE: ggml_op = 51;
|
|||
pub const ggml_op_GGML_OP_TIMESTEP_EMBEDDING: ggml_op = 52;
|
||||
pub const ggml_op_GGML_OP_ARGSORT: ggml_op = 53;
|
||||
pub const ggml_op_GGML_OP_LEAKY_RELU: ggml_op = 54;
|
||||
pub const ggml_op_GGML_OP_FLASH_ATTN: ggml_op = 55;
|
||||
pub const ggml_op_GGML_OP_FLASH_ATTN_EXT: ggml_op = 56;
|
||||
pub const ggml_op_GGML_OP_FLASH_FF: ggml_op = 57;
|
||||
pub const ggml_op_GGML_OP_FLASH_ATTN_BACK: ggml_op = 58;
|
||||
pub const ggml_op_GGML_OP_SSM_CONV: ggml_op = 59;
|
||||
pub const ggml_op_GGML_OP_SSM_SCAN: ggml_op = 60;
|
||||
pub const ggml_op_GGML_OP_WIN_PART: ggml_op = 61;
|
||||
pub const ggml_op_GGML_OP_WIN_UNPART: ggml_op = 62;
|
||||
pub const ggml_op_GGML_OP_GET_REL_POS: ggml_op = 63;
|
||||
pub const ggml_op_GGML_OP_ADD_REL_POS: ggml_op = 64;
|
||||
pub const ggml_op_GGML_OP_UNARY: ggml_op = 65;
|
||||
pub const ggml_op_GGML_OP_MAP_UNARY: ggml_op = 66;
|
||||
pub const ggml_op_GGML_OP_MAP_BINARY: ggml_op = 67;
|
||||
pub const ggml_op_GGML_OP_MAP_CUSTOM1_F32: ggml_op = 68;
|
||||
pub const ggml_op_GGML_OP_MAP_CUSTOM2_F32: ggml_op = 69;
|
||||
pub const ggml_op_GGML_OP_MAP_CUSTOM3_F32: ggml_op = 70;
|
||||
pub const ggml_op_GGML_OP_MAP_CUSTOM1: ggml_op = 71;
|
||||
pub const ggml_op_GGML_OP_MAP_CUSTOM2: ggml_op = 72;
|
||||
pub const ggml_op_GGML_OP_MAP_CUSTOM3: ggml_op = 73;
|
||||
pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS: ggml_op = 74;
|
||||
pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS_BACK: ggml_op = 75;
|
||||
pub const ggml_op_GGML_OP_COUNT: ggml_op = 76;
|
||||
pub const ggml_op_GGML_OP_FLASH_ATTN_EXT: ggml_op = 55;
|
||||
pub const ggml_op_GGML_OP_FLASH_ATTN_BACK: ggml_op = 56;
|
||||
pub const ggml_op_GGML_OP_SSM_CONV: ggml_op = 57;
|
||||
pub const ggml_op_GGML_OP_SSM_SCAN: ggml_op = 58;
|
||||
pub const ggml_op_GGML_OP_WIN_PART: ggml_op = 59;
|
||||
pub const ggml_op_GGML_OP_WIN_UNPART: ggml_op = 60;
|
||||
pub const ggml_op_GGML_OP_GET_REL_POS: ggml_op = 61;
|
||||
pub const ggml_op_GGML_OP_ADD_REL_POS: ggml_op = 62;
|
||||
pub const ggml_op_GGML_OP_UNARY: ggml_op = 63;
|
||||
pub const ggml_op_GGML_OP_MAP_UNARY: ggml_op = 64;
|
||||
pub const ggml_op_GGML_OP_MAP_BINARY: ggml_op = 65;
|
||||
pub const ggml_op_GGML_OP_MAP_CUSTOM1_F32: ggml_op = 66;
|
||||
pub const ggml_op_GGML_OP_MAP_CUSTOM2_F32: ggml_op = 67;
|
||||
pub const ggml_op_GGML_OP_MAP_CUSTOM3_F32: ggml_op = 68;
|
||||
pub const ggml_op_GGML_OP_MAP_CUSTOM1: ggml_op = 69;
|
||||
pub const ggml_op_GGML_OP_MAP_CUSTOM2: ggml_op = 70;
|
||||
pub const ggml_op_GGML_OP_MAP_CUSTOM3: ggml_op = 71;
|
||||
pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS: ggml_op = 72;
|
||||
pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS_BACK: ggml_op = 73;
|
||||
pub const ggml_op_GGML_OP_COUNT: ggml_op = 74;
|
||||
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;
|
||||
|
|
@ -1614,15 +1631,11 @@ pub struct ggml_tensor {
|
|||
pub flags: i32,
|
||||
pub grad: *mut ggml_tensor,
|
||||
pub src: [*mut ggml_tensor; 10usize],
|
||||
pub perf_runs: ::std::os::raw::c_int,
|
||||
pub perf_cycles: i64,
|
||||
pub perf_time_us: i64,
|
||||
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],
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_ggml_tensor() {
|
||||
|
|
@ -1630,7 +1643,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
|||
let ptr = UNINIT.as_ptr();
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<ggml_tensor>(),
|
||||
368usize,
|
||||
336usize,
|
||||
concat!("Size of: ", stringify!(ggml_tensor))
|
||||
);
|
||||
assert_eq!(
|
||||
|
|
@ -1738,39 +1751,9 @@ fn bindgen_test_layout_ggml_tensor() {
|
|||
stringify!(src)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).perf_runs) as usize - ptr as usize },
|
||||
240usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_tensor),
|
||||
"::",
|
||||
stringify!(perf_runs)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).perf_cycles) as usize - ptr as usize },
|
||||
248usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_tensor),
|
||||
"::",
|
||||
stringify!(perf_cycles)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).perf_time_us) as usize - ptr as usize },
|
||||
256usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_tensor),
|
||||
"::",
|
||||
stringify!(perf_time_us)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).view_src) as usize - ptr as usize },
|
||||
264usize,
|
||||
240usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_tensor),
|
||||
|
|
@ -1780,7 +1763,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
|||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).view_offs) as usize - ptr as usize },
|
||||
272usize,
|
||||
248usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_tensor),
|
||||
|
|
@ -1790,7 +1773,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
|||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
|
||||
280usize,
|
||||
256usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_tensor),
|
||||
|
|
@ -1800,7 +1783,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
|||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
|
||||
288usize,
|
||||
264usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_tensor),
|
||||
|
|
@ -1810,7 +1793,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
|||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).extra) as usize - ptr as usize },
|
||||
352usize,
|
||||
328usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_tensor),
|
||||
|
|
@ -1818,18 +1801,8 @@ fn bindgen_test_layout_ggml_tensor() {
|
|||
stringify!(extra)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).padding) as usize - ptr as usize },
|
||||
360usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_tensor),
|
||||
"::",
|
||||
stringify!(padding)
|
||||
)
|
||||
);
|
||||
}
|
||||
pub const GGML_TENSOR_SIZE: usize = 368;
|
||||
pub const GGML_TENSOR_SIZE: usize = 336;
|
||||
pub type ggml_abort_callback =
|
||||
::std::option::Option<unsafe extern "C" fn(data: *mut ::std::os::raw::c_void) -> bool>;
|
||||
#[repr(C)]
|
||||
|
|
@ -1910,10 +1883,12 @@ pub const ggml_cgraph_eval_order_GGML_CGRAPH_EVAL_ORDER_LEFT_TO_RIGHT: ggml_cgra
|
|||
pub const ggml_cgraph_eval_order_GGML_CGRAPH_EVAL_ORDER_RIGHT_TO_LEFT: ggml_cgraph_eval_order = 1;
|
||||
pub const ggml_cgraph_eval_order_GGML_CGRAPH_EVAL_ORDER_COUNT: ggml_cgraph_eval_order = 2;
|
||||
pub type ggml_cgraph_eval_order = ::std::os::raw::c_uint;
|
||||
pub type ggml_bitset_t = u32;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct ggml_hash_set {
|
||||
pub size: usize,
|
||||
pub used: *mut ggml_bitset_t,
|
||||
pub keys: *mut *mut ggml_tensor,
|
||||
}
|
||||
#[test]
|
||||
|
|
@ -1922,7 +1897,7 @@ fn bindgen_test_layout_ggml_hash_set() {
|
|||
let ptr = UNINIT.as_ptr();
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<ggml_hash_set>(),
|
||||
16usize,
|
||||
24usize,
|
||||
concat!("Size of: ", stringify!(ggml_hash_set))
|
||||
);
|
||||
assert_eq!(
|
||||
|
|
@ -1941,8 +1916,18 @@ fn bindgen_test_layout_ggml_hash_set() {
|
|||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).keys) as usize - ptr as usize },
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).used) as usize - ptr as usize },
|
||||
8usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_hash_set),
|
||||
"::",
|
||||
stringify!(used)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).keys) as usize - ptr as usize },
|
||||
16usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_hash_set),
|
||||
|
|
@ -1960,11 +1945,8 @@ pub struct ggml_cgraph {
|
|||
pub nodes: *mut *mut ggml_tensor,
|
||||
pub grads: *mut *mut ggml_tensor,
|
||||
pub leafs: *mut *mut ggml_tensor,
|
||||
pub visited_hash_table: ggml_hash_set,
|
||||
pub visited_hash_set: ggml_hash_set,
|
||||
pub order: ggml_cgraph_eval_order,
|
||||
pub perf_runs: ::std::os::raw::c_int,
|
||||
pub perf_cycles: i64,
|
||||
pub perf_time_us: i64,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_ggml_cgraph() {
|
||||
|
|
@ -1972,7 +1954,7 @@ fn bindgen_test_layout_ggml_cgraph() {
|
|||
let ptr = UNINIT.as_ptr();
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<ggml_cgraph>(),
|
||||
80usize,
|
||||
72usize,
|
||||
concat!("Size of: ", stringify!(ggml_cgraph))
|
||||
);
|
||||
assert_eq!(
|
||||
|
|
@ -2041,53 +2023,23 @@ fn bindgen_test_layout_ggml_cgraph() {
|
|||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).visited_hash_table) as usize - ptr as usize },
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).visited_hash_set) as usize - ptr as usize },
|
||||
40usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_cgraph),
|
||||
"::",
|
||||
stringify!(visited_hash_table)
|
||||
stringify!(visited_hash_set)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).order) as usize - ptr as usize },
|
||||
56usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_cgraph),
|
||||
"::",
|
||||
stringify!(order)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).perf_runs) as usize - ptr as usize },
|
||||
60usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_cgraph),
|
||||
"::",
|
||||
stringify!(perf_runs)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).perf_cycles) as usize - ptr as usize },
|
||||
64usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_cgraph),
|
||||
"::",
|
||||
stringify!(perf_cycles)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).perf_time_us) as usize - ptr as usize },
|
||||
72usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_cgraph),
|
||||
"::",
|
||||
stringify!(perf_time_us)
|
||||
stringify!(order)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
@ -2195,84 +2147,6 @@ fn bindgen_test_layout_ggml_init_params() {
|
|||
)
|
||||
);
|
||||
}
|
||||
pub const ggml_task_type_GGML_TASK_TYPE_INIT: ggml_task_type = 0;
|
||||
pub const ggml_task_type_GGML_TASK_TYPE_COMPUTE: ggml_task_type = 1;
|
||||
pub const ggml_task_type_GGML_TASK_TYPE_FINALIZE: ggml_task_type = 2;
|
||||
pub type ggml_task_type = ::std::os::raw::c_uint;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct ggml_compute_params {
|
||||
pub type_: ggml_task_type,
|
||||
pub ith: ::std::os::raw::c_int,
|
||||
pub nth: ::std::os::raw::c_int,
|
||||
pub wsize: usize,
|
||||
pub wdata: *mut ::std::os::raw::c_void,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_ggml_compute_params() {
|
||||
const UNINIT: ::std::mem::MaybeUninit<ggml_compute_params> = ::std::mem::MaybeUninit::uninit();
|
||||
let ptr = UNINIT.as_ptr();
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<ggml_compute_params>(),
|
||||
32usize,
|
||||
concat!("Size of: ", stringify!(ggml_compute_params))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<ggml_compute_params>(),
|
||||
8usize,
|
||||
concat!("Alignment of ", stringify!(ggml_compute_params))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_compute_params),
|
||||
"::",
|
||||
stringify!(type_)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).ith) as usize - ptr as usize },
|
||||
4usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_compute_params),
|
||||
"::",
|
||||
stringify!(ith)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).nth) as usize - ptr as usize },
|
||||
8usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_compute_params),
|
||||
"::",
|
||||
stringify!(nth)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).wsize) as usize - ptr as usize },
|
||||
16usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_compute_params),
|
||||
"::",
|
||||
stringify!(wsize)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).wdata) as usize - ptr as usize },
|
||||
24usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_compute_params),
|
||||
"::",
|
||||
stringify!(wdata)
|
||||
)
|
||||
);
|
||||
}
|
||||
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;
|
||||
|
|
@ -2300,9 +2174,6 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn ggml_cycles_per_ms() -> i64;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_print_backtrace();
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_fopen(
|
||||
fname: *const ::std::os::raw::c_char,
|
||||
|
|
@ -2334,7 +2205,7 @@ extern "C" {
|
|||
pub fn ggml_nbytes_pad(tensor: *const ggml_tensor) -> usize;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_blck_size(type_: ggml_type) -> ::std::os::raw::c_int;
|
||||
pub fn ggml_blck_size(type_: ggml_type) -> i64;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_type_size(type_: ggml_type) -> usize;
|
||||
|
|
@ -2372,9 +2243,6 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn ggml_is_transposed(tensor: *const ggml_tensor) -> bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_is_contiguous(tensor: *const ggml_tensor) -> bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_is_permuted(tensor: *const ggml_tensor) -> bool;
|
||||
}
|
||||
|
|
@ -2396,12 +2264,27 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn ggml_n_dims(tensor: *const ggml_tensor) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_is_contiguous(tensor: *const ggml_tensor) -> bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_is_contiguous_0(tensor: *const ggml_tensor) -> bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_is_contiguous_1(tensor: *const ggml_tensor) -> bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_is_contiguous_2(tensor: *const ggml_tensor) -> bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_are_same_shape(t0: *const ggml_tensor, t1: *const ggml_tensor) -> bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_are_same_stride(t0: *const ggml_tensor, t1: *const ggml_tensor) -> bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_can_repeat(t0: *const ggml_tensor, t1: *const ggml_tensor) -> bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_tensor_overhead() -> usize;
|
||||
}
|
||||
|
|
@ -2757,6 +2640,7 @@ extern "C" {
|
|||
ctx: *mut ggml_context,
|
||||
a: *mut ggml_tensor,
|
||||
b: *mut ggml_tensor,
|
||||
dim: ::std::os::raw::c_int,
|
||||
) -> *mut ggml_tensor;
|
||||
}
|
||||
extern "C" {
|
||||
|
|
@ -2873,6 +2757,7 @@ extern "C" {
|
|||
ctx: *mut ggml_context,
|
||||
a: *mut ggml_tensor,
|
||||
n_groups: ::std::os::raw::c_int,
|
||||
eps: f32,
|
||||
) -> *mut ggml_tensor;
|
||||
}
|
||||
extern "C" {
|
||||
|
|
@ -2880,6 +2765,7 @@ extern "C" {
|
|||
ctx: *mut ggml_context,
|
||||
a: *mut ggml_tensor,
|
||||
n_groups: ::std::os::raw::c_int,
|
||||
eps: f32,
|
||||
) -> *mut ggml_tensor;
|
||||
}
|
||||
extern "C" {
|
||||
|
|
@ -3208,7 +3094,6 @@ extern "C" {
|
|||
b: *mut ggml_tensor,
|
||||
n_dims: ::std::os::raw::c_int,
|
||||
mode: ::std::os::raw::c_int,
|
||||
n_ctx: ::std::os::raw::c_int,
|
||||
) -> *mut ggml_tensor;
|
||||
}
|
||||
extern "C" {
|
||||
|
|
@ -3218,7 +3103,40 @@ extern "C" {
|
|||
b: *mut ggml_tensor,
|
||||
n_dims: ::std::os::raw::c_int,
|
||||
mode: ::std::os::raw::c_int,
|
||||
n_ctx: ::std::os::raw::c_int,
|
||||
) -> *mut ggml_tensor;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_rope_ext(
|
||||
ctx: *mut ggml_context,
|
||||
a: *mut ggml_tensor,
|
||||
b: *mut ggml_tensor,
|
||||
c: *mut ggml_tensor,
|
||||
n_dims: ::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;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_rope_ext_inplace(
|
||||
ctx: *mut ggml_context,
|
||||
a: *mut ggml_tensor,
|
||||
b: *mut ggml_tensor,
|
||||
c: *mut ggml_tensor,
|
||||
n_dims: ::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;
|
||||
}
|
||||
extern "C" {
|
||||
|
|
@ -3228,8 +3146,7 @@ extern "C" {
|
|||
b: *mut ggml_tensor,
|
||||
n_dims: ::std::os::raw::c_int,
|
||||
mode: ::std::os::raw::c_int,
|
||||
n_ctx: ::std::os::raw::c_int,
|
||||
n_orig_ctx: ::std::os::raw::c_int,
|
||||
n_ctx_orig: ::std::os::raw::c_int,
|
||||
freq_base: f32,
|
||||
freq_scale: f32,
|
||||
ext_factor: f32,
|
||||
|
|
@ -3245,8 +3162,7 @@ extern "C" {
|
|||
b: *mut ggml_tensor,
|
||||
n_dims: ::std::os::raw::c_int,
|
||||
mode: ::std::os::raw::c_int,
|
||||
n_ctx: ::std::os::raw::c_int,
|
||||
n_orig_ctx: ::std::os::raw::c_int,
|
||||
n_ctx_orig: ::std::os::raw::c_int,
|
||||
freq_base: f32,
|
||||
freq_scale: f32,
|
||||
ext_factor: f32,
|
||||
|
|
@ -3258,40 +3174,28 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn ggml_rope_yarn_corr_dims(
|
||||
n_dims: ::std::os::raw::c_int,
|
||||
n_orig_ctx: ::std::os::raw::c_int,
|
||||
n_ctx_orig: ::std::os::raw::c_int,
|
||||
freq_base: f32,
|
||||
beta_fast: f32,
|
||||
beta_slow: f32,
|
||||
dims: *mut f32,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_rope_xpos_inplace(
|
||||
ctx: *mut ggml_context,
|
||||
a: *mut ggml_tensor,
|
||||
b: *mut ggml_tensor,
|
||||
n_dims: ::std::os::raw::c_int,
|
||||
base: f32,
|
||||
down: bool,
|
||||
) -> *mut ggml_tensor;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_rope_back(
|
||||
ctx: *mut ggml_context,
|
||||
a: *mut ggml_tensor,
|
||||
b: *mut ggml_tensor,
|
||||
c: *mut ggml_tensor,
|
||||
n_dims: ::std::os::raw::c_int,
|
||||
mode: ::std::os::raw::c_int,
|
||||
n_ctx: ::std::os::raw::c_int,
|
||||
n_orig_ctx: ::std::os::raw::c_int,
|
||||
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,
|
||||
xpos_base: f32,
|
||||
xpos_down: bool,
|
||||
) -> *mut ggml_tensor;
|
||||
}
|
||||
extern "C" {
|
||||
|
|
@ -3428,6 +3332,16 @@ extern "C" {
|
|||
scale_factor: ::std::os::raw::c_int,
|
||||
) -> *mut ggml_tensor;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_upscale_ext(
|
||||
ctx: *mut ggml_context,
|
||||
a: *mut ggml_tensor,
|
||||
ne0: ::std::os::raw::c_int,
|
||||
ne1: ::std::os::raw::c_int,
|
||||
ne2: ::std::os::raw::c_int,
|
||||
ne3: ::std::os::raw::c_int,
|
||||
) -> *mut ggml_tensor;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_pad(
|
||||
ctx: *mut ggml_context,
|
||||
|
|
@ -3471,15 +3385,6 @@ extern "C" {
|
|||
k: ::std::os::raw::c_int,
|
||||
) -> *mut ggml_tensor;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_flash_attn(
|
||||
ctx: *mut ggml_context,
|
||||
q: *mut ggml_tensor,
|
||||
k: *mut ggml_tensor,
|
||||
v: *mut ggml_tensor,
|
||||
masked: bool,
|
||||
) -> *mut ggml_tensor;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_flash_attn_ext(
|
||||
ctx: *mut ggml_context,
|
||||
|
|
@ -3504,16 +3409,6 @@ extern "C" {
|
|||
masked: bool,
|
||||
) -> *mut ggml_tensor;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_flash_ff(
|
||||
ctx: *mut ggml_context,
|
||||
a: *mut ggml_tensor,
|
||||
b0: *mut ggml_tensor,
|
||||
b1: *mut ggml_tensor,
|
||||
c0: *mut ggml_tensor,
|
||||
c1: *mut ggml_tensor,
|
||||
) -> *mut ggml_tensor;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_ssm_conv(
|
||||
ctx: *mut ggml_context,
|
||||
|
|
@ -5115,12 +5010,18 @@ extern "C" {
|
|||
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_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;
|
||||
}
|
||||
|
|
@ -5142,9 +5043,6 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn ggml_cpu_has_cuda() -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_cpu_has_clblast() -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_cpu_has_vulkan() -> ::std::os::raw::c_int;
|
||||
}
|
||||
|
|
@ -5163,18 +5061,30 @@ extern "C" {
|
|||
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;
|
||||
}
|
||||
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,
|
||||
|
|
@ -5187,19 +5097,46 @@ pub type ggml_vec_dot_t = ::std::option::Option<
|
|||
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_t {
|
||||
pub type_name: *const ::std::os::raw::c_char,
|
||||
pub blck_size: ::std::os::raw::c_int,
|
||||
pub blck_size: i64,
|
||||
pub blck_size_interleave: i64,
|
||||
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_reference: 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,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_ggml_type_traits_t() {
|
||||
|
|
@ -5207,7 +5144,7 @@ fn bindgen_test_layout_ggml_type_traits_t() {
|
|||
let ptr = UNINIT.as_ptr();
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<ggml_type_traits_t>(),
|
||||
80usize,
|
||||
120usize,
|
||||
concat!("Size of: ", stringify!(ggml_type_traits_t))
|
||||
);
|
||||
assert_eq!(
|
||||
|
|
@ -5236,8 +5173,18 @@ fn bindgen_test_layout_ggml_type_traits_t() {
|
|||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).type_size) as usize - ptr as usize },
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).blck_size_interleave) as usize - ptr as usize },
|
||||
16usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_type_traits_t),
|
||||
"::",
|
||||
stringify!(blck_size_interleave)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).type_size) as usize - ptr as usize },
|
||||
24usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_type_traits_t),
|
||||
|
|
@ -5247,7 +5194,7 @@ fn bindgen_test_layout_ggml_type_traits_t() {
|
|||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).is_quantized) as usize - ptr as usize },
|
||||
24usize,
|
||||
32usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_type_traits_t),
|
||||
|
|
@ -5257,7 +5204,7 @@ fn bindgen_test_layout_ggml_type_traits_t() {
|
|||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).to_float) as usize - ptr as usize },
|
||||
32usize,
|
||||
40usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_type_traits_t),
|
||||
|
|
@ -5267,7 +5214,7 @@ fn bindgen_test_layout_ggml_type_traits_t() {
|
|||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).from_float) as usize - ptr as usize },
|
||||
40usize,
|
||||
48usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_type_traits_t),
|
||||
|
|
@ -5276,18 +5223,28 @@ fn bindgen_test_layout_ggml_type_traits_t() {
|
|||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).from_float_reference) as usize - ptr as usize },
|
||||
48usize,
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).from_float_ref) as usize - ptr as usize },
|
||||
56usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_type_traits_t),
|
||||
"::",
|
||||
stringify!(from_float_reference)
|
||||
stringify!(from_float_ref)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).from_float_to_mat) as usize - ptr as usize },
|
||||
64usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_type_traits_t),
|
||||
"::",
|
||||
stringify!(from_float_to_mat)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).vec_dot) as usize - ptr as usize },
|
||||
56usize,
|
||||
72usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_type_traits_t),
|
||||
|
|
@ -5297,7 +5254,7 @@ fn bindgen_test_layout_ggml_type_traits_t() {
|
|||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).vec_dot_type) as usize - ptr as usize },
|
||||
64usize,
|
||||
80usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_type_traits_t),
|
||||
|
|
@ -5307,7 +5264,7 @@ fn bindgen_test_layout_ggml_type_traits_t() {
|
|||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).nrows) as usize - ptr as usize },
|
||||
72usize,
|
||||
88usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_type_traits_t),
|
||||
|
|
@ -5315,6 +5272,36 @@ fn bindgen_test_layout_ggml_type_traits_t() {
|
|||
stringify!(nrows)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).ncols) as usize - ptr as usize },
|
||||
96usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_type_traits_t),
|
||||
"::",
|
||||
stringify!(ncols)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).gemv) as usize - ptr as usize },
|
||||
104usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_type_traits_t),
|
||||
"::",
|
||||
stringify!(gemv)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).gemm) as usize - ptr as usize },
|
||||
112usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ggml_type_traits_t),
|
||||
"::",
|
||||
stringify!(gemm)
|
||||
)
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn ggml_internal_get_type_traits(type_: ggml_type) -> ggml_type_traits_t;
|
||||
|
|
@ -5897,23 +5884,6 @@ extern "C" {
|
|||
n_threads: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn whisper_pcm_to_mel_phase_vocoder(
|
||||
ctx: *mut whisper_context,
|
||||
samples: *const f32,
|
||||
n_samples: ::std::os::raw::c_int,
|
||||
n_threads: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn whisper_pcm_to_mel_phase_vocoder_with_state(
|
||||
ctx: *mut whisper_context,
|
||||
state: *mut whisper_state,
|
||||
samples: *const f32,
|
||||
n_samples: ::std::os::raw::c_int,
|
||||
n_threads: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn whisper_set_mel(
|
||||
ctx: *mut whisper_context,
|
||||
|
|
@ -6177,7 +6147,6 @@ pub struct whisper_full_params {
|
|||
pub max_len: ::std::os::raw::c_int,
|
||||
pub split_on_word: bool,
|
||||
pub max_tokens: ::std::os::raw::c_int,
|
||||
pub speed_up: bool,
|
||||
pub debug_mode: bool,
|
||||
pub audio_ctx: ::std::os::raw::c_int,
|
||||
pub tdrz_enable: bool,
|
||||
|
|
@ -6496,19 +6465,9 @@ fn bindgen_test_layout_whisper_full_params() {
|
|||
stringify!(max_tokens)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).speed_up) as usize - ptr as usize },
|
||||
52usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(whisper_full_params),
|
||||
"::",
|
||||
stringify!(speed_up)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).debug_mode) as usize - ptr as usize },
|
||||
53usize,
|
||||
52usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(whisper_full_params),
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit c7b6988678779901d02ceba1a8212d2c9908956e
|
||||
Subproject commit 9e3c5345cd46ea718209db53464e426c3fe7a25e
|
||||
Loading…
Add table
Add a link
Reference in a new issue