Add support for new whisper.cpp project structure
Remove opencl feature, removed in whisper.cpp Add openmp feature and enable by default as in whisper.cpp Update bindings
This commit is contained in:
parent
744804a8aa
commit
ec609f18ff
10 changed files with 164 additions and 371 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")]
|
||||
{
|
||||
println!("cargo:rustc-link-lib=openblas");
|
||||
|
|
@ -81,6 +76,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());
|
||||
|
|
@ -104,10 +106,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();
|
||||
|
||||
|
|
@ -150,11 +153,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");
|
||||
|
|
@ -164,20 +167,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") {
|
||||
|
|
@ -197,18 +196,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");
|
||||
|
|
@ -226,3 +224,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))]
|
||||
|
|
@ -1475,28 +1477,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 +1614,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 +1626,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 +1734,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 +1746,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 +1756,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 +1766,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 +1776,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 +1784,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)]
|
||||
|
|
@ -1962,9 +1918,6 @@ pub struct ggml_cgraph {
|
|||
pub leafs: *mut *mut ggml_tensor,
|
||||
pub visited_hash_table: 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 +1925,7 @@ fn bindgen_test_layout_ggml_cgraph() {
|
|||
let ptr = UNINIT.as_ptr();
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<ggml_cgraph>(),
|
||||
80usize,
|
||||
64usize,
|
||||
concat!("Size of: ", stringify!(ggml_cgraph))
|
||||
);
|
||||
assert_eq!(
|
||||
|
|
@ -2060,36 +2013,6 @@ fn bindgen_test_layout_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)
|
||||
)
|
||||
);
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
|
|
@ -2195,84 +2118,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;
|
||||
|
|
@ -2372,9 +2217,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,6 +2238,18 @@ 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;
|
||||
}
|
||||
|
|
@ -2757,6 +2611,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" {
|
||||
|
|
@ -3208,7 +3063,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 +3072,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 +3115,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 +3131,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 +3143,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 +3301,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 +3354,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 +3378,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 +4979,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 +5012,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,6 +5030,9 @@ 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;
|
||||
}
|
||||
|
|
@ -5897,23 +5767,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 +6030,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 +6348,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 fe36c909715e6751277ddb020e7892c7670b61d4
|
||||
Loading…
Add table
Add a link
Reference in a new issue