fuel_quantized/lib.rs
1// SPDX-License-Identifier: MIT OR Apache-2.0
2//! Backend-agnostic quantized (ggml/gguf block-format) numerics.
3//!
4//! This crate owns the format-side of fuel's quantization stack:
5//!
6//! - [`k_quants`] — `BlockQX` block types, the [`GgmlType`](k_quants::GgmlType)
7//! trait, and scalar reference impls of every fmt fuel supports.
8//! - [`utils`] — quantization-time helpers shared by k_quants impls.
9//! - [`cpu`] — CPU-side adapters that bridge `Vec<BlockQX>` to the
10//! backend-agnostic [`fuel_backend_contract::quantized::DynQuantizedStorage`]
11//! trait, plus the `QuantizedDeviceKernels` impl on
12//! `fuel_cpu_backend::CpuBackendDevice`.
13//!
14//! Per-backend (CUDA, Metal, future Vulkan) quantized fast paths live in
15//! their own crates and implement the same trait pair from
16//! `fuel-core-types`.
17
18pub mod awq_repack;
19pub mod cpu;
20pub mod dequant;
21pub mod iq4;
22pub mod iq_grid_types;
23pub mod iq_grids;
24pub mod k_quants;
25pub mod tq_mx_types;
26pub mod utils;
27
28pub use cpu::{QuantizedType, cpu_from_data, cpu_zeros};
29pub use dequant::dequant_ggml_bytes;
30pub use k_quants::{
31 BlockQ2K, BlockQ3K, BlockQ4_0, BlockQ4_1, BlockQ4K, BlockQ5_0, BlockQ5_1, BlockQ5K, BlockQ6K,
32 BlockQ8_0, BlockQ8_1, BlockQ8K, GgmlType, K_SCALE_SIZE, QK_K, QK4_0, QK4_1, QK5_0, QK5_1,
33 QK8_0, QK8_1, blocks_as_bytes, blocks_from_bytes_cow, matmul, matmul_f16,
34};
35
36// Re-export GgmlDType so downstream callers can write
37// `fuel_quantized::GgmlDType` without naming fuel-core-types.
38pub use fuel_backend_contract::quantized::{DynQuantizedStorage, QuantizedDeviceKernels};
39pub use fuel_ir::quantized::GgmlDType;