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
|
|
@ -4,7 +4,7 @@ exclude = ["examples/full_usage"]
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "whisper-rs"
|
name = "whisper-rs"
|
||||||
version = "0.12.1"
|
version = "0.13.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Rust bindings for whisper.cpp"
|
description = "Rust bindings for whisper.cpp"
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
|
|
@ -14,7 +14,7 @@ repository = "https://github.com/tazz4843/whisper-rs"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
whisper-rs-sys = { path = "sys", version = "0.10.1" }
|
whisper-rs-sys = { path = "sys", version = "0.11.0" }
|
||||||
log = { version = "0.4", optional = true }
|
log = { version = "0.4", optional = true }
|
||||||
tracing = { version = "0.1", optional = true }
|
tracing = { version = "0.1", optional = true }
|
||||||
|
|
||||||
|
|
@ -23,19 +23,19 @@ hound = "3.5.0"
|
||||||
rand = "0.8.4"
|
rand = "0.8.4"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = ["openmp"]
|
||||||
|
|
||||||
raw-api = []
|
raw-api = []
|
||||||
coreml = ["whisper-rs-sys/coreml"]
|
coreml = ["whisper-rs-sys/coreml"]
|
||||||
cuda = ["whisper-rs-sys/cuda", "_gpu"]
|
cuda = ["whisper-rs-sys/cuda", "_gpu"]
|
||||||
hipblas = ["whisper-rs-sys/hipblas", "_gpu"]
|
hipblas = ["whisper-rs-sys/hipblas", "_gpu"]
|
||||||
opencl = ["whisper-rs-sys/opencl"]
|
|
||||||
openblas = ["whisper-rs-sys/openblas"]
|
openblas = ["whisper-rs-sys/openblas"]
|
||||||
metal = ["whisper-rs-sys/metal", "_gpu"]
|
metal = ["whisper-rs-sys/metal", "_gpu"]
|
||||||
_gpu = []
|
_gpu = []
|
||||||
test-with-tiny-model = []
|
test-with-tiny-model = []
|
||||||
whisper-cpp-log = ["dep:log"]
|
whisper-cpp-log = ["dep:log"]
|
||||||
whisper-cpp-tracing = ["dep:tracing"]
|
whisper-cpp-tracing = ["dep:tracing"]
|
||||||
|
openmp = ["whisper-rs-sys/openmp"]
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
features = ["simd"]
|
features = ["simd"]
|
||||||
|
|
|
||||||
|
|
@ -72,8 +72,6 @@ All disabled by default unless otherwise specified.
|
||||||
as whisper-rs-sys may be upgraded to a breaking version in a patch release of whisper-rs.
|
as whisper-rs-sys may be upgraded to a breaking version in a patch release of whisper-rs.
|
||||||
* `cuda`: enable CUDA support. Implicitly enables hidden GPU flag at runtime.
|
* `cuda`: enable CUDA support. Implicitly enables hidden GPU flag at runtime.
|
||||||
* `hipblas`: enable ROCm/hipBLAS support. Only available on linux. Implicitly enables hidden GPU flag at runtime.
|
* `hipblas`: enable ROCm/hipBLAS support. Only available on linux. Implicitly enables hidden GPU flag at runtime.
|
||||||
* `opencl`: enable OpenCL support. Upstream whisper.cpp does not treat OpenCL as a GPU, so it is always enabled at
|
|
||||||
runtime.
|
|
||||||
* `openblas`: enable OpenBLAS support.
|
* `openblas`: enable OpenBLAS support.
|
||||||
* `metal`: enable Metal support. Implicitly enables hidden GPU flag at runtime.
|
* `metal`: enable Metal support. Implicitly enables hidden GPU flag at runtime.
|
||||||
* `whisper-cpp-log`: allows hooking into whisper.cpp's log output and sending it to the `log` backend. Requires calling
|
* `whisper-cpp-log`: allows hooking into whisper.cpp's log output and sending it to the `log` backend. Requires calling
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,6 @@ pub struct SystemInfo {
|
||||||
pub fma: bool,
|
pub fma: bool,
|
||||||
pub f16c: bool,
|
pub f16c: bool,
|
||||||
pub blas: bool,
|
pub blas: bool,
|
||||||
pub clblast: bool,
|
|
||||||
pub cuda: bool,
|
pub cuda: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -123,7 +122,6 @@ impl Default for SystemInfo {
|
||||||
fma: whisper_rs_sys::ggml_cpu_has_fma() != 0,
|
fma: whisper_rs_sys::ggml_cpu_has_fma() != 0,
|
||||||
f16c: whisper_rs_sys::ggml_cpu_has_f16c() != 0,
|
f16c: whisper_rs_sys::ggml_cpu_has_f16c() != 0,
|
||||||
blas: whisper_rs_sys::ggml_cpu_has_blas() != 0,
|
blas: whisper_rs_sys::ggml_cpu_has_blas() != 0,
|
||||||
clblast: whisper_rs_sys::ggml_cpu_has_clblast() != 0,
|
|
||||||
cuda: whisper_rs_sys::ggml_cpu_has_cuda() != 0,
|
cuda: whisper_rs_sys::ggml_cpu_has_cuda() != 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -471,9 +471,6 @@ unsafe impl Sync for WhisperInnerContext {}
|
||||||
|
|
||||||
pub struct WhisperContextParameters<'a> {
|
pub struct WhisperContextParameters<'a> {
|
||||||
/// Use GPU if available.
|
/// Use GPU if available.
|
||||||
///
|
|
||||||
/// **Warning**: Does not have an effect if OpenCL is selected as GPU backend
|
|
||||||
/// (in that case, GPU is always enabled).
|
|
||||||
pub use_gpu: bool,
|
pub use_gpu: bool,
|
||||||
/// Enable flash attention, default false
|
/// Enable flash attention, default false
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -222,16 +222,6 @@ impl<'a, 'b> FullParams<'a, 'b> {
|
||||||
self.fp.max_tokens = max_tokens;
|
self.fp.max_tokens = max_tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # EXPERIMENTAL
|
|
||||||
///
|
|
||||||
/// Speed up audio ~2x by using phase vocoder.
|
|
||||||
/// Note that this can significantly reduce the accuracy of the transcription.
|
|
||||||
///
|
|
||||||
/// Defaults to false.
|
|
||||||
pub fn set_speed_up(&mut self, speed_up: bool) {
|
|
||||||
self.fp.speed_up = speed_up;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// # EXPERIMENTAL
|
/// # EXPERIMENTAL
|
||||||
///
|
///
|
||||||
/// Enables debug mode, such as dumping the log mel spectrogram.
|
/// Enables debug mode, such as dumping the log mel spectrogram.
|
||||||
|
|
@ -244,7 +234,6 @@ impl<'a, 'b> FullParams<'a, 'b> {
|
||||||
/// # EXPERIMENTAL
|
/// # EXPERIMENTAL
|
||||||
///
|
///
|
||||||
/// Overwrite the audio context size. 0 = default.
|
/// Overwrite the audio context size. 0 = default.
|
||||||
/// As with [set_speed_up](FullParams::set_speed_up), this can significantly reduce the accuracy of the transcription.
|
|
||||||
///
|
///
|
||||||
/// Defaults to 0.
|
/// Defaults to 0.
|
||||||
pub fn set_audio_ctx(&mut self, audio_ctx: c_int) {
|
pub fn set_audio_ctx(&mut self, audio_ctx: c_int) {
|
||||||
|
|
|
||||||
|
|
@ -64,45 +64,6 @@ impl WhisperState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convert raw PCM audio (floating point 32 bit) to log mel spectrogram.
|
|
||||||
/// Applies a Phase Vocoder to speed up the audio x2.
|
|
||||||
/// The resulting spectrogram is stored in the context transparently.
|
|
||||||
///
|
|
||||||
/// # Arguments
|
|
||||||
/// * pcm: The raw PCM audio.
|
|
||||||
/// * threads: How many threads to use. Defaults to 1. Must be at least 1, returns an error otherwise.
|
|
||||||
///
|
|
||||||
/// # Returns
|
|
||||||
/// Ok(()) on success, Err(WhisperError) on failure.
|
|
||||||
///
|
|
||||||
/// # C++ equivalent
|
|
||||||
/// `int whisper_pcm_to_mel(struct whisper_context * ctx, const float * samples, int n_samples, int n_threads)`
|
|
||||||
pub fn pcm_to_mel_phase_vocoder(
|
|
||||||
&mut self,
|
|
||||||
pcm: &[f32],
|
|
||||||
threads: usize,
|
|
||||||
) -> Result<(), WhisperError> {
|
|
||||||
if threads < 1 {
|
|
||||||
return Err(WhisperError::InvalidThreadCount);
|
|
||||||
}
|
|
||||||
let ret = unsafe {
|
|
||||||
whisper_rs_sys::whisper_pcm_to_mel_phase_vocoder_with_state(
|
|
||||||
self.ctx.ctx,
|
|
||||||
self.ptr,
|
|
||||||
pcm.as_ptr(),
|
|
||||||
pcm.len() as c_int,
|
|
||||||
threads as c_int,
|
|
||||||
)
|
|
||||||
};
|
|
||||||
if ret == -1 {
|
|
||||||
Err(WhisperError::UnableToCalculateSpectrogram)
|
|
||||||
} else if ret == 0 {
|
|
||||||
Ok(())
|
|
||||||
} else {
|
|
||||||
Err(WhisperError::GenericError(ret))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// This can be used to set a custom log mel spectrogram inside the provided whisper state.
|
/// This can be used to set a custom log mel spectrogram inside the provided whisper state.
|
||||||
/// Use this instead of whisper_pcm_to_mel() if you want to provide your own log mel spectrogram.
|
/// Use this instead of whisper_pcm_to_mel() if you want to provide your own log mel spectrogram.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "whisper-rs-sys"
|
name = "whisper-rs-sys"
|
||||||
version = "0.10.1"
|
version = "0.11.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Rust bindings for whisper.cpp (FFI bindings)"
|
description = "Rust bindings for whisper.cpp (FFI bindings)"
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
|
|
@ -10,29 +10,28 @@ links = "whisper"
|
||||||
include = [
|
include = [
|
||||||
"whisper.cpp/bindings/javascript/package-tmpl.json",
|
"whisper.cpp/bindings/javascript/package-tmpl.json",
|
||||||
"whisper.cpp/bindings/CMakeLists.txt",
|
"whisper.cpp/bindings/CMakeLists.txt",
|
||||||
"whisper.cpp/cmake",
|
|
||||||
"whisper.cpp/coreml",
|
|
||||||
"whisper.cpp/CMakeLists.txt",
|
"whisper.cpp/CMakeLists.txt",
|
||||||
"whisper.cpp/ggml.c",
|
"whisper.cpp/cmake",
|
||||||
"whisper.cpp/ggml.h",
|
"whisper.cpp/src/coreml",
|
||||||
"whisper.cpp/ggml-alloc.c",
|
"whisper.cpp/src/CMakeLists.txt",
|
||||||
"whisper.cpp/ggml-alloc.h",
|
"whisper.cpp/src/whisper.cpp",
|
||||||
"whisper.cpp/ggml-backend.c",
|
"whisper.cpp/include/whisper.h",
|
||||||
"whisper.cpp/ggml-backend.h",
|
"whisper.cpp/ggml/src/ggml.c",
|
||||||
"whisper.cpp/ggml-backend-impl.h",
|
"whisper.cpp/ggml/src/ggml-alloc.c",
|
||||||
"whisper.cpp/ggml-cuda.cu",
|
"whisper.cpp/ggml/src/ggml-backend.c",
|
||||||
"whisper.cpp/ggml-cuda.h",
|
"whisper.cpp/ggml/src/ggml-cuda.cu",
|
||||||
"whisper.cpp/ggml-impl.h",
|
"whisper.cpp/ggml/src/ggml-impl.h",
|
||||||
"whisper.cpp/ggml-metal.h",
|
"whisper.cpp/ggml/src/ggml-metal.m",
|
||||||
"whisper.cpp/ggml-metal.m",
|
"whisper.cpp/ggml/src/ggml-metal.metal",
|
||||||
"whisper.cpp/ggml-metal.metal",
|
"whisper.cpp/ggml/src/ggml-quants.h",
|
||||||
"whisper.cpp/ggml-opencl.cpp",
|
"whisper.cpp/ggml/src/ggml-quants.c",
|
||||||
"whisper.cpp/ggml-opencl.h",
|
"whisper.cpp/ggml/include/ggml.h",
|
||||||
"whisper.cpp/ggml-quants.h",
|
"whisper.cpp/ggml/include/ggml-alloc.h",
|
||||||
"whisper.cpp/ggml-quants.c",
|
"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/LICENSE",
|
||||||
"whisper.cpp/whisper.cpp",
|
|
||||||
"whisper.cpp/whisper.h",
|
|
||||||
"src/*.rs",
|
"src/*.rs",
|
||||||
"build.rs",
|
"build.rs",
|
||||||
"wrapper.h",
|
"wrapper.h",
|
||||||
|
|
@ -44,10 +43,10 @@ include = [
|
||||||
coreml = []
|
coreml = []
|
||||||
cuda = []
|
cuda = []
|
||||||
hipblas = []
|
hipblas = []
|
||||||
opencl = []
|
|
||||||
openblas = []
|
openblas = []
|
||||||
metal = []
|
metal = []
|
||||||
force-debug = []
|
force-debug = []
|
||||||
|
openmp = []
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cmake = "0.1"
|
cmake = "0.1"
|
||||||
|
|
|
||||||
60
sys/build.rs
60
sys/build.rs
|
|
@ -30,11 +30,6 @@ fn main() {
|
||||||
|
|
||||||
#[cfg(feature = "coreml")]
|
#[cfg(feature = "coreml")]
|
||||||
println!("cargo:rustc-link-lib=static=whisper.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")]
|
#[cfg(feature = "openblas")]
|
||||||
{
|
{
|
||||||
if let Ok(openblas_path) = env::var("OPENBLAS_PATH") {
|
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");
|
println!("cargo:rerun-if-changed=wrapper.h");
|
||||||
|
|
||||||
let out = PathBuf::from(env::var("OUT_DIR").unwrap());
|
let out = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||||
|
|
@ -114,10 +116,11 @@ fn main() {
|
||||||
let bindings = bindgen::Builder::default().header("wrapper.h");
|
let bindings = bindgen::Builder::default().header("wrapper.h");
|
||||||
|
|
||||||
#[cfg(feature = "metal")]
|
#[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
|
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()))
|
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
||||||
.generate();
|
.generate();
|
||||||
|
|
||||||
|
|
@ -160,11 +163,11 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg!(feature = "cuda") {
|
if cfg!(feature = "cuda") {
|
||||||
config.define("WHISPER_CUDA", "ON");
|
config.define("GGML_CUDA", "ON");
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg!(feature = "hipblas") {
|
if cfg!(feature = "hipblas") {
|
||||||
config.define("WHISPER_HIPBLAS", "ON");
|
config.define("GGML_HIPBLAS", "ON");
|
||||||
config.define("CMAKE_C_COMPILER", "hipcc");
|
config.define("CMAKE_C_COMPILER", "hipcc");
|
||||||
config.define("CMAKE_CXX_COMPILER", "hipcc");
|
config.define("CMAKE_CXX_COMPILER", "hipcc");
|
||||||
println!("cargo:rerun-if-env-changed=AMDGPU_TARGETS");
|
println!("cargo:rerun-if-env-changed=AMDGPU_TARGETS");
|
||||||
|
|
@ -174,20 +177,16 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg!(feature = "openblas") {
|
if cfg!(feature = "openblas") {
|
||||||
config.define("WHISPER_OPENBLAS", "ON");
|
config.define("GGML_BLAS", "ON");
|
||||||
}
|
|
||||||
|
|
||||||
if cfg!(feature = "opencl") {
|
|
||||||
config.define("WHISPER_CLBLAST", "ON");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg!(feature = "metal") {
|
if cfg!(feature = "metal") {
|
||||||
config.define("WHISPER_METAL", "ON");
|
config.define("GGML_METAL", "ON");
|
||||||
config.define("WHISPER_METAL_NDEBUG", "ON");
|
config.define("GGML_METAL_NDEBUG", "ON");
|
||||||
config.define("WHISPER_METAL_EMBED_LIBRARY", "ON");
|
config.define("GGML_METAL_EMBED_LIBRARY", "ON");
|
||||||
} else {
|
} else {
|
||||||
// Metal is enabled by default, so we need to explicitly disable it
|
// 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") {
|
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();
|
let destination = config.build();
|
||||||
|
|
||||||
if target.contains("window") && !target.contains("gnu") {
|
add_link_search_path(&out.join("lib")).unwrap();
|
||||||
println!(
|
|
||||||
"cargo:rustc-link-search={}",
|
|
||||||
out.join("build").join("Release").display()
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
println!("cargo:rustc-link-search={}", out.join("build").display());
|
|
||||||
}
|
|
||||||
println!("cargo:rustc-link-search=native={}", destination.display());
|
println!("cargo:rustc-link-search=native={}", destination.display());
|
||||||
println!("cargo:rustc-link-lib=static=whisper");
|
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
|
// for whatever reason this file is generated during build and triggers cargo complaining
|
||||||
_ = std::fs::remove_file("bindings/javascript/package.json");
|
_ = std::fs::remove_file("bindings/javascript/package.json");
|
||||||
|
|
@ -236,3 +234,13 @@ fn get_cpp_link_stdlib(target: &str) -> Option<&'static str> {
|
||||||
Some("stdc++")
|
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 __bool_true_false_are_defined: u32 = 1;
|
||||||
pub const true_: 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 GGML_N_TASKS_MAX: i32 = -1;
|
||||||
pub const WHISPER_SAMPLE_RATE: u32 = 16000;
|
pub const WHISPER_SAMPLE_RATE: u32 = 16000;
|
||||||
pub const WHISPER_N_FFT: u32 = 400;
|
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_HOP_LENGTH: u32 = 160;
|
||||||
pub const WHISPER_CHUNK_SIZE: u32 = 30;
|
pub const WHISPER_CHUNK_SIZE: u32 = 30;
|
||||||
|
pub const WHISPER_N_SAMPLES: u32 = 480000;
|
||||||
pub type wchar_t = ::std::os::raw::c_int;
|
pub type wchar_t = ::std::os::raw::c_int;
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[repr(align(16))]
|
#[repr(align(16))]
|
||||||
|
|
@ -1289,6 +1291,14 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn __overflow(arg1: *mut FILE, arg2: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
|
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_ALLOC_FAILED: ggml_status = -2;
|
||||||
pub const ggml_status_GGML_STATUS_FAILED: ggml_status = -1;
|
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_SUCCESS: ggml_status = 0;
|
||||||
|
|
@ -1349,6 +1359,9 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_bf16_to_fp32_row(arg1: *const ggml_bf16_t, arg2: *mut f32, arg3: i64);
|
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" {
|
extern "C" {
|
||||||
pub fn ggml_fp32_to_bf16_row(arg1: *const f32, arg2: *mut ggml_bf16_t, arg3: i64);
|
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_F64: ggml_type = 28;
|
||||||
pub const ggml_type_GGML_TYPE_IQ1_M: ggml_type = 29;
|
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_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 type ggml_type = ::std::os::raw::c_uint;
|
||||||
pub const ggml_prec_GGML_PREC_DEFAULT: ggml_prec = 0;
|
pub const ggml_prec_GGML_PREC_DEFAULT: ggml_prec = 0;
|
||||||
pub const ggml_prec_GGML_PREC_F32: ggml_prec = 1;
|
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_IQ4_XS: ggml_ftype = 22;
|
||||||
pub const ggml_ftype_GGML_FTYPE_MOSTLY_IQ1_M: ggml_ftype = 23;
|
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_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 type ggml_ftype = ::std::os::raw::c_int;
|
||||||
pub const ggml_op_GGML_OP_NONE: ggml_op = 0;
|
pub const ggml_op_GGML_OP_NONE: ggml_op = 0;
|
||||||
pub const ggml_op_GGML_OP_DUP: ggml_op = 1;
|
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_TIMESTEP_EMBEDDING: ggml_op = 52;
|
||||||
pub const ggml_op_GGML_OP_ARGSORT: ggml_op = 53;
|
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_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 = 55;
|
||||||
pub const ggml_op_GGML_OP_FLASH_ATTN_EXT: ggml_op = 56;
|
pub const ggml_op_GGML_OP_FLASH_ATTN_BACK: ggml_op = 56;
|
||||||
pub const ggml_op_GGML_OP_FLASH_FF: ggml_op = 57;
|
pub const ggml_op_GGML_OP_SSM_CONV: ggml_op = 57;
|
||||||
pub const ggml_op_GGML_OP_FLASH_ATTN_BACK: ggml_op = 58;
|
pub const ggml_op_GGML_OP_SSM_SCAN: ggml_op = 58;
|
||||||
pub const ggml_op_GGML_OP_SSM_CONV: ggml_op = 59;
|
pub const ggml_op_GGML_OP_WIN_PART: ggml_op = 59;
|
||||||
pub const ggml_op_GGML_OP_SSM_SCAN: ggml_op = 60;
|
pub const ggml_op_GGML_OP_WIN_UNPART: ggml_op = 60;
|
||||||
pub const ggml_op_GGML_OP_WIN_PART: ggml_op = 61;
|
pub const ggml_op_GGML_OP_GET_REL_POS: ggml_op = 61;
|
||||||
pub const ggml_op_GGML_OP_WIN_UNPART: ggml_op = 62;
|
pub const ggml_op_GGML_OP_ADD_REL_POS: ggml_op = 62;
|
||||||
pub const ggml_op_GGML_OP_GET_REL_POS: ggml_op = 63;
|
pub const ggml_op_GGML_OP_UNARY: ggml_op = 63;
|
||||||
pub const ggml_op_GGML_OP_ADD_REL_POS: ggml_op = 64;
|
pub const ggml_op_GGML_OP_MAP_UNARY: ggml_op = 64;
|
||||||
pub const ggml_op_GGML_OP_UNARY: ggml_op = 65;
|
pub const ggml_op_GGML_OP_MAP_BINARY: ggml_op = 65;
|
||||||
pub const ggml_op_GGML_OP_MAP_UNARY: ggml_op = 66;
|
pub const ggml_op_GGML_OP_MAP_CUSTOM1_F32: ggml_op = 66;
|
||||||
pub const ggml_op_GGML_OP_MAP_BINARY: ggml_op = 67;
|
pub const ggml_op_GGML_OP_MAP_CUSTOM2_F32: ggml_op = 67;
|
||||||
pub const ggml_op_GGML_OP_MAP_CUSTOM1_F32: ggml_op = 68;
|
pub const ggml_op_GGML_OP_MAP_CUSTOM3_F32: ggml_op = 68;
|
||||||
pub const ggml_op_GGML_OP_MAP_CUSTOM2_F32: ggml_op = 69;
|
pub const ggml_op_GGML_OP_MAP_CUSTOM1: ggml_op = 69;
|
||||||
pub const ggml_op_GGML_OP_MAP_CUSTOM3_F32: ggml_op = 70;
|
pub const ggml_op_GGML_OP_MAP_CUSTOM2: ggml_op = 70;
|
||||||
pub const ggml_op_GGML_OP_MAP_CUSTOM1: ggml_op = 71;
|
pub const ggml_op_GGML_OP_MAP_CUSTOM3: ggml_op = 71;
|
||||||
pub const ggml_op_GGML_OP_MAP_CUSTOM2: ggml_op = 72;
|
pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS: ggml_op = 72;
|
||||||
pub const ggml_op_GGML_OP_MAP_CUSTOM3: ggml_op = 73;
|
pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS_BACK: ggml_op = 73;
|
||||||
pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS: ggml_op = 74;
|
pub const ggml_op_GGML_OP_COUNT: ggml_op = 74;
|
||||||
pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS_BACK: ggml_op = 75;
|
|
||||||
pub const ggml_op_GGML_OP_COUNT: ggml_op = 76;
|
|
||||||
pub type ggml_op = ::std::os::raw::c_uint;
|
pub 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_ABS: ggml_unary_op = 0;
|
||||||
pub const ggml_unary_op_GGML_UNARY_OP_SGN: ggml_unary_op = 1;
|
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 flags: i32,
|
||||||
pub grad: *mut ggml_tensor,
|
pub grad: *mut ggml_tensor,
|
||||||
pub src: [*mut ggml_tensor; 10usize],
|
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_src: *mut ggml_tensor,
|
||||||
pub view_offs: usize,
|
pub view_offs: usize,
|
||||||
pub data: *mut ::std::os::raw::c_void,
|
pub data: *mut ::std::os::raw::c_void,
|
||||||
pub name: [::std::os::raw::c_char; 64usize],
|
pub name: [::std::os::raw::c_char; 64usize],
|
||||||
pub extra: *mut ::std::os::raw::c_void,
|
pub extra: *mut ::std::os::raw::c_void,
|
||||||
pub padding: [::std::os::raw::c_char; 8usize],
|
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn bindgen_test_layout_ggml_tensor() {
|
fn bindgen_test_layout_ggml_tensor() {
|
||||||
|
|
@ -1630,7 +1643,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
let ptr = UNINIT.as_ptr();
|
let ptr = UNINIT.as_ptr();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
::std::mem::size_of::<ggml_tensor>(),
|
::std::mem::size_of::<ggml_tensor>(),
|
||||||
368usize,
|
336usize,
|
||||||
concat!("Size of: ", stringify!(ggml_tensor))
|
concat!("Size of: ", stringify!(ggml_tensor))
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
@ -1738,39 +1751,9 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
stringify!(src)
|
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!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).view_src) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).view_src) as usize - ptr as usize },
|
||||||
264usize,
|
240usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -1780,7 +1763,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).view_offs) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).view_offs) as usize - ptr as usize },
|
||||||
272usize,
|
248usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -1790,7 +1773,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
|
||||||
280usize,
|
256usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -1800,7 +1783,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
|
||||||
288usize,
|
264usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -1810,7 +1793,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).extra) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).extra) as usize - ptr as usize },
|
||||||
352usize,
|
328usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -1818,18 +1801,8 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
stringify!(extra)
|
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 =
|
pub type ggml_abort_callback =
|
||||||
::std::option::Option<unsafe extern "C" fn(data: *mut ::std::os::raw::c_void) -> bool>;
|
::std::option::Option<unsafe extern "C" fn(data: *mut ::std::os::raw::c_void) -> bool>;
|
||||||
#[repr(C)]
|
#[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_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 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_cgraph_eval_order = ::std::os::raw::c_uint;
|
||||||
|
pub type ggml_bitset_t = u32;
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub struct ggml_hash_set {
|
pub struct ggml_hash_set {
|
||||||
pub size: usize,
|
pub size: usize,
|
||||||
|
pub used: *mut ggml_bitset_t,
|
||||||
pub keys: *mut *mut ggml_tensor,
|
pub keys: *mut *mut ggml_tensor,
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
|
|
@ -1922,7 +1897,7 @@ fn bindgen_test_layout_ggml_hash_set() {
|
||||||
let ptr = UNINIT.as_ptr();
|
let ptr = UNINIT.as_ptr();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
::std::mem::size_of::<ggml_hash_set>(),
|
::std::mem::size_of::<ggml_hash_set>(),
|
||||||
16usize,
|
24usize,
|
||||||
concat!("Size of: ", stringify!(ggml_hash_set))
|
concat!("Size of: ", stringify!(ggml_hash_set))
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
@ -1941,8 +1916,18 @@ fn bindgen_test_layout_ggml_hash_set() {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
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,
|
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!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_hash_set),
|
stringify!(ggml_hash_set),
|
||||||
|
|
@ -1960,11 +1945,8 @@ pub struct ggml_cgraph {
|
||||||
pub nodes: *mut *mut ggml_tensor,
|
pub nodes: *mut *mut ggml_tensor,
|
||||||
pub grads: *mut *mut ggml_tensor,
|
pub grads: *mut *mut ggml_tensor,
|
||||||
pub leafs: *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 order: ggml_cgraph_eval_order,
|
||||||
pub perf_runs: ::std::os::raw::c_int,
|
|
||||||
pub perf_cycles: i64,
|
|
||||||
pub perf_time_us: i64,
|
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn bindgen_test_layout_ggml_cgraph() {
|
fn bindgen_test_layout_ggml_cgraph() {
|
||||||
|
|
@ -1972,7 +1954,7 @@ fn bindgen_test_layout_ggml_cgraph() {
|
||||||
let ptr = UNINIT.as_ptr();
|
let ptr = UNINIT.as_ptr();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
::std::mem::size_of::<ggml_cgraph>(),
|
::std::mem::size_of::<ggml_cgraph>(),
|
||||||
80usize,
|
72usize,
|
||||||
concat!("Size of: ", stringify!(ggml_cgraph))
|
concat!("Size of: ", stringify!(ggml_cgraph))
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
@ -2041,53 +2023,23 @@ fn bindgen_test_layout_ggml_cgraph() {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
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,
|
40usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_cgraph),
|
stringify!(ggml_cgraph),
|
||||||
"::",
|
"::",
|
||||||
stringify!(visited_hash_table)
|
stringify!(visited_hash_set)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).order) as usize - ptr as usize },
|
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,
|
64usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_cgraph),
|
stringify!(ggml_cgraph),
|
||||||
"::",
|
"::",
|
||||||
stringify!(perf_cycles)
|
stringify!(order)
|
||||||
)
|
|
||||||
);
|
|
||||||
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)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -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_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_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_ISOLATE: ggml_numa_strategy = 2;
|
||||||
|
|
@ -2300,9 +2174,6 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_cycles_per_ms() -> i64;
|
pub fn ggml_cycles_per_ms() -> i64;
|
||||||
}
|
}
|
||||||
extern "C" {
|
|
||||||
pub fn ggml_print_backtrace();
|
|
||||||
}
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_fopen(
|
pub fn ggml_fopen(
|
||||||
fname: *const ::std::os::raw::c_char,
|
fname: *const ::std::os::raw::c_char,
|
||||||
|
|
@ -2334,7 +2205,7 @@ extern "C" {
|
||||||
pub fn ggml_nbytes_pad(tensor: *const ggml_tensor) -> usize;
|
pub fn ggml_nbytes_pad(tensor: *const ggml_tensor) -> usize;
|
||||||
}
|
}
|
||||||
extern "C" {
|
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" {
|
extern "C" {
|
||||||
pub fn ggml_type_size(type_: ggml_type) -> usize;
|
pub fn ggml_type_size(type_: ggml_type) -> usize;
|
||||||
|
|
@ -2372,9 +2243,6 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_is_transposed(tensor: *const ggml_tensor) -> bool;
|
pub fn ggml_is_transposed(tensor: *const ggml_tensor) -> bool;
|
||||||
}
|
}
|
||||||
extern "C" {
|
|
||||||
pub fn ggml_is_contiguous(tensor: *const ggml_tensor) -> bool;
|
|
||||||
}
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_is_permuted(tensor: *const ggml_tensor) -> bool;
|
pub fn ggml_is_permuted(tensor: *const ggml_tensor) -> bool;
|
||||||
}
|
}
|
||||||
|
|
@ -2396,12 +2264,27 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_n_dims(tensor: *const ggml_tensor) -> ::std::os::raw::c_int;
|
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" {
|
extern "C" {
|
||||||
pub fn ggml_are_same_shape(t0: *const ggml_tensor, t1: *const ggml_tensor) -> bool;
|
pub fn ggml_are_same_shape(t0: *const ggml_tensor, t1: *const ggml_tensor) -> bool;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_are_same_stride(t0: *const ggml_tensor, t1: *const ggml_tensor) -> bool;
|
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" {
|
extern "C" {
|
||||||
pub fn ggml_tensor_overhead() -> usize;
|
pub fn ggml_tensor_overhead() -> usize;
|
||||||
}
|
}
|
||||||
|
|
@ -2757,6 +2640,7 @@ extern "C" {
|
||||||
ctx: *mut ggml_context,
|
ctx: *mut ggml_context,
|
||||||
a: *mut ggml_tensor,
|
a: *mut ggml_tensor,
|
||||||
b: *mut ggml_tensor,
|
b: *mut ggml_tensor,
|
||||||
|
dim: ::std::os::raw::c_int,
|
||||||
) -> *mut ggml_tensor;
|
) -> *mut ggml_tensor;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
@ -2873,6 +2757,7 @@ extern "C" {
|
||||||
ctx: *mut ggml_context,
|
ctx: *mut ggml_context,
|
||||||
a: *mut ggml_tensor,
|
a: *mut ggml_tensor,
|
||||||
n_groups: ::std::os::raw::c_int,
|
n_groups: ::std::os::raw::c_int,
|
||||||
|
eps: f32,
|
||||||
) -> *mut ggml_tensor;
|
) -> *mut ggml_tensor;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
@ -2880,6 +2765,7 @@ extern "C" {
|
||||||
ctx: *mut ggml_context,
|
ctx: *mut ggml_context,
|
||||||
a: *mut ggml_tensor,
|
a: *mut ggml_tensor,
|
||||||
n_groups: ::std::os::raw::c_int,
|
n_groups: ::std::os::raw::c_int,
|
||||||
|
eps: f32,
|
||||||
) -> *mut ggml_tensor;
|
) -> *mut ggml_tensor;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
@ -3208,7 +3094,6 @@ extern "C" {
|
||||||
b: *mut ggml_tensor,
|
b: *mut ggml_tensor,
|
||||||
n_dims: ::std::os::raw::c_int,
|
n_dims: ::std::os::raw::c_int,
|
||||||
mode: ::std::os::raw::c_int,
|
mode: ::std::os::raw::c_int,
|
||||||
n_ctx: ::std::os::raw::c_int,
|
|
||||||
) -> *mut ggml_tensor;
|
) -> *mut ggml_tensor;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
@ -3218,7 +3103,40 @@ extern "C" {
|
||||||
b: *mut ggml_tensor,
|
b: *mut ggml_tensor,
|
||||||
n_dims: ::std::os::raw::c_int,
|
n_dims: ::std::os::raw::c_int,
|
||||||
mode: ::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;
|
) -> *mut ggml_tensor;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
@ -3228,8 +3146,7 @@ extern "C" {
|
||||||
b: *mut ggml_tensor,
|
b: *mut ggml_tensor,
|
||||||
n_dims: ::std::os::raw::c_int,
|
n_dims: ::std::os::raw::c_int,
|
||||||
mode: ::std::os::raw::c_int,
|
mode: ::std::os::raw::c_int,
|
||||||
n_ctx: ::std::os::raw::c_int,
|
n_ctx_orig: ::std::os::raw::c_int,
|
||||||
n_orig_ctx: ::std::os::raw::c_int,
|
|
||||||
freq_base: f32,
|
freq_base: f32,
|
||||||
freq_scale: f32,
|
freq_scale: f32,
|
||||||
ext_factor: f32,
|
ext_factor: f32,
|
||||||
|
|
@ -3245,8 +3162,7 @@ extern "C" {
|
||||||
b: *mut ggml_tensor,
|
b: *mut ggml_tensor,
|
||||||
n_dims: ::std::os::raw::c_int,
|
n_dims: ::std::os::raw::c_int,
|
||||||
mode: ::std::os::raw::c_int,
|
mode: ::std::os::raw::c_int,
|
||||||
n_ctx: ::std::os::raw::c_int,
|
n_ctx_orig: ::std::os::raw::c_int,
|
||||||
n_orig_ctx: ::std::os::raw::c_int,
|
|
||||||
freq_base: f32,
|
freq_base: f32,
|
||||||
freq_scale: f32,
|
freq_scale: f32,
|
||||||
ext_factor: f32,
|
ext_factor: f32,
|
||||||
|
|
@ -3258,40 +3174,28 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_rope_yarn_corr_dims(
|
pub fn ggml_rope_yarn_corr_dims(
|
||||||
n_dims: ::std::os::raw::c_int,
|
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,
|
freq_base: f32,
|
||||||
beta_fast: f32,
|
beta_fast: f32,
|
||||||
beta_slow: f32,
|
beta_slow: f32,
|
||||||
dims: *mut 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" {
|
extern "C" {
|
||||||
pub fn ggml_rope_back(
|
pub fn ggml_rope_back(
|
||||||
ctx: *mut ggml_context,
|
ctx: *mut ggml_context,
|
||||||
a: *mut ggml_tensor,
|
a: *mut ggml_tensor,
|
||||||
b: *mut ggml_tensor,
|
b: *mut ggml_tensor,
|
||||||
|
c: *mut ggml_tensor,
|
||||||
n_dims: ::std::os::raw::c_int,
|
n_dims: ::std::os::raw::c_int,
|
||||||
mode: ::std::os::raw::c_int,
|
mode: ::std::os::raw::c_int,
|
||||||
n_ctx: ::std::os::raw::c_int,
|
n_ctx_orig: ::std::os::raw::c_int,
|
||||||
n_orig_ctx: ::std::os::raw::c_int,
|
|
||||||
freq_base: f32,
|
freq_base: f32,
|
||||||
freq_scale: f32,
|
freq_scale: f32,
|
||||||
ext_factor: f32,
|
ext_factor: f32,
|
||||||
attn_factor: f32,
|
attn_factor: f32,
|
||||||
beta_fast: f32,
|
beta_fast: f32,
|
||||||
beta_slow: f32,
|
beta_slow: f32,
|
||||||
xpos_base: f32,
|
|
||||||
xpos_down: bool,
|
|
||||||
) -> *mut ggml_tensor;
|
) -> *mut ggml_tensor;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
@ -3428,6 +3332,16 @@ extern "C" {
|
||||||
scale_factor: ::std::os::raw::c_int,
|
scale_factor: ::std::os::raw::c_int,
|
||||||
) -> *mut ggml_tensor;
|
) -> *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" {
|
extern "C" {
|
||||||
pub fn ggml_pad(
|
pub fn ggml_pad(
|
||||||
ctx: *mut ggml_context,
|
ctx: *mut ggml_context,
|
||||||
|
|
@ -3471,15 +3385,6 @@ extern "C" {
|
||||||
k: ::std::os::raw::c_int,
|
k: ::std::os::raw::c_int,
|
||||||
) -> *mut ggml_tensor;
|
) -> *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" {
|
extern "C" {
|
||||||
pub fn ggml_flash_attn_ext(
|
pub fn ggml_flash_attn_ext(
|
||||||
ctx: *mut ggml_context,
|
ctx: *mut ggml_context,
|
||||||
|
|
@ -3504,16 +3409,6 @@ extern "C" {
|
||||||
masked: bool,
|
masked: bool,
|
||||||
) -> *mut ggml_tensor;
|
) -> *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" {
|
extern "C" {
|
||||||
pub fn ggml_ssm_conv(
|
pub fn ggml_ssm_conv(
|
||||||
ctx: *mut ggml_context,
|
ctx: *mut ggml_context,
|
||||||
|
|
@ -5115,12 +5010,18 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_cpu_has_avx512_vnni() -> ::std::os::raw::c_int;
|
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" {
|
extern "C" {
|
||||||
pub fn ggml_cpu_has_fma() -> ::std::os::raw::c_int;
|
pub fn ggml_cpu_has_fma() -> ::std::os::raw::c_int;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_cpu_has_neon() -> ::std::os::raw::c_int;
|
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" {
|
extern "C" {
|
||||||
pub fn ggml_cpu_has_arm_fma() -> ::std::os::raw::c_int;
|
pub fn ggml_cpu_has_arm_fma() -> ::std::os::raw::c_int;
|
||||||
}
|
}
|
||||||
|
|
@ -5142,9 +5043,6 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_cpu_has_cuda() -> ::std::os::raw::c_int;
|
pub fn ggml_cpu_has_cuda() -> ::std::os::raw::c_int;
|
||||||
}
|
}
|
||||||
extern "C" {
|
|
||||||
pub fn ggml_cpu_has_clblast() -> ::std::os::raw::c_int;
|
|
||||||
}
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_cpu_has_vulkan() -> ::std::os::raw::c_int;
|
pub fn ggml_cpu_has_vulkan() -> ::std::os::raw::c_int;
|
||||||
}
|
}
|
||||||
|
|
@ -5163,18 +5061,30 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_cpu_has_sycl() -> ::std::os::raw::c_int;
|
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" {
|
extern "C" {
|
||||||
pub fn ggml_cpu_has_vsx() -> ::std::os::raw::c_int;
|
pub fn ggml_cpu_has_vsx() -> ::std::os::raw::c_int;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_cpu_has_matmul_int8() -> ::std::os::raw::c_int;
|
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<
|
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),
|
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<
|
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),
|
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<
|
pub type ggml_vec_dot_t = ::std::option::Option<
|
||||||
unsafe extern "C" fn(
|
unsafe extern "C" fn(
|
||||||
n: ::std::os::raw::c_int,
|
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,
|
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)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub struct ggml_type_traits_t {
|
pub struct ggml_type_traits_t {
|
||||||
pub type_name: *const ::std::os::raw::c_char,
|
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 type_size: usize,
|
||||||
pub is_quantized: bool,
|
pub is_quantized: bool,
|
||||||
pub to_float: ggml_to_float_t,
|
pub to_float: ggml_to_float_t,
|
||||||
pub from_float: ggml_from_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: ggml_vec_dot_t,
|
||||||
pub vec_dot_type: ggml_type,
|
pub vec_dot_type: ggml_type,
|
||||||
pub nrows: i64,
|
pub nrows: i64,
|
||||||
|
pub ncols: i64,
|
||||||
|
pub gemv: ggml_gemv_t,
|
||||||
|
pub gemm: ggml_gemm_t,
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn bindgen_test_layout_ggml_type_traits_t() {
|
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();
|
let ptr = UNINIT.as_ptr();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
::std::mem::size_of::<ggml_type_traits_t>(),
|
::std::mem::size_of::<ggml_type_traits_t>(),
|
||||||
80usize,
|
120usize,
|
||||||
concat!("Size of: ", stringify!(ggml_type_traits_t))
|
concat!("Size of: ", stringify!(ggml_type_traits_t))
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
@ -5236,8 +5173,18 @@ fn bindgen_test_layout_ggml_type_traits_t() {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
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,
|
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!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_type_traits_t),
|
stringify!(ggml_type_traits_t),
|
||||||
|
|
@ -5247,7 +5194,7 @@ fn bindgen_test_layout_ggml_type_traits_t() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).is_quantized) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).is_quantized) as usize - ptr as usize },
|
||||||
24usize,
|
32usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_type_traits_t),
|
stringify!(ggml_type_traits_t),
|
||||||
|
|
@ -5257,7 +5204,7 @@ fn bindgen_test_layout_ggml_type_traits_t() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).to_float) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).to_float) as usize - ptr as usize },
|
||||||
32usize,
|
40usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_type_traits_t),
|
stringify!(ggml_type_traits_t),
|
||||||
|
|
@ -5267,7 +5214,7 @@ fn bindgen_test_layout_ggml_type_traits_t() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).from_float) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).from_float) as usize - ptr as usize },
|
||||||
40usize,
|
48usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_type_traits_t),
|
stringify!(ggml_type_traits_t),
|
||||||
|
|
@ -5276,18 +5223,28 @@ fn bindgen_test_layout_ggml_type_traits_t() {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).from_float_reference) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).from_float_ref) as usize - ptr as usize },
|
||||||
48usize,
|
56usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_type_traits_t),
|
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!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).vec_dot) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).vec_dot) as usize - ptr as usize },
|
||||||
56usize,
|
72usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_type_traits_t),
|
stringify!(ggml_type_traits_t),
|
||||||
|
|
@ -5297,7 +5254,7 @@ fn bindgen_test_layout_ggml_type_traits_t() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).vec_dot_type) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).vec_dot_type) as usize - ptr as usize },
|
||||||
64usize,
|
80usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_type_traits_t),
|
stringify!(ggml_type_traits_t),
|
||||||
|
|
@ -5307,7 +5264,7 @@ fn bindgen_test_layout_ggml_type_traits_t() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).nrows) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).nrows) as usize - ptr as usize },
|
||||||
72usize,
|
88usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_type_traits_t),
|
stringify!(ggml_type_traits_t),
|
||||||
|
|
@ -5315,6 +5272,36 @@ fn bindgen_test_layout_ggml_type_traits_t() {
|
||||||
stringify!(nrows)
|
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" {
|
extern "C" {
|
||||||
pub fn ggml_internal_get_type_traits(type_: ggml_type) -> ggml_type_traits_t;
|
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,
|
n_threads: ::std::os::raw::c_int,
|
||||||
) -> ::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" {
|
extern "C" {
|
||||||
pub fn whisper_set_mel(
|
pub fn whisper_set_mel(
|
||||||
ctx: *mut whisper_context,
|
ctx: *mut whisper_context,
|
||||||
|
|
@ -6177,7 +6147,6 @@ pub struct whisper_full_params {
|
||||||
pub max_len: ::std::os::raw::c_int,
|
pub max_len: ::std::os::raw::c_int,
|
||||||
pub split_on_word: bool,
|
pub split_on_word: bool,
|
||||||
pub max_tokens: ::std::os::raw::c_int,
|
pub max_tokens: ::std::os::raw::c_int,
|
||||||
pub speed_up: bool,
|
|
||||||
pub debug_mode: bool,
|
pub debug_mode: bool,
|
||||||
pub audio_ctx: ::std::os::raw::c_int,
|
pub audio_ctx: ::std::os::raw::c_int,
|
||||||
pub tdrz_enable: bool,
|
pub tdrz_enable: bool,
|
||||||
|
|
@ -6496,19 +6465,9 @@ fn bindgen_test_layout_whisper_full_params() {
|
||||||
stringify!(max_tokens)
|
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!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).debug_mode) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).debug_mode) as usize - ptr as usize },
|
||||||
53usize,
|
52usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(whisper_full_params),
|
stringify!(whisper_full_params),
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit c7b6988678779901d02ceba1a8212d2c9908956e
|
Subproject commit 9e3c5345cd46ea718209db53464e426c3fe7a25e
|
||||||
Loading…
Add table
Add a link
Reference in a new issue