Skip to main content

GgmlDType

Enum GgmlDType 

Source
pub enum GgmlDType {
Show 28 variants F32, F16, BF16, Q4_0, Q4_1, Q5_0, Q5_1, Q8_0, Q8_1, Q2K, Q3K, Q4K, Q5K, Q6K, Q8K, Iq4Nl, Iq4Xs, Iq2Xxs, Iq2Xs, Iq3Xxs, Iq1S, Iq3S, Iq2S, Iq1M, Tq1_0, Tq2_0, Mxfp4, Nvfp4,
}
Expand description

The ggml block-format dtype tag. Mirrors llama.cpp’s ggml_type @9d57ce456c for the subset fuel supports (the classic 15 — F32/F16/BF16 plus Q4_0..Q8_1 and Q2K..Q8K, plus every IQ family: IQ4_NL/IQ4_XS (GAP-211 B1) and the decode-only IQ1_S/IQ1_M/IQ2_XXS/IQ2_XS/IQ2_S/IQ3_XXS/IQ3_S (GAP-211 B2); block geometry and the dequant formula verified against ggml-common.h and ggml-quants.c at that commit), plus the decode-only TQ1_0/TQ2_0/MXFP4/NVFP4 (GAP-211 C); NOT the other ggml types, which an unsupported-tensor GGUF load reports by name instead).

Geometry checked against that commit (GAP-248 instance 5), and the referee differs by column:

  • type_size (bytes/block) is ADJUDICATED — upstream’s own static_assert on each block struct is the referee; 12/12 for the quant types here.
  • block_size (elems/block) and the numeric codes are CORROBORATED — both are transcribed upstream (type_traits[].blck_size, enum ggml_type) and agree 12/12 with MLMF’s INDEPENDENT transcription; no referee exists.
  • per-block alignment is UNANCHORED by both projects; fuel tracks none, so an upstream alignment change is undetectable here.

NO DETECTOR: this pin makes drift ANSWERABLE, not detected — it ages silently. Re-run the comparison on any llama.cpp bump that touches ggml_type or type_traits[].

Lives here (rather than in quantized/mod.rs) because per-backend kernel crates need to name it without depending on fuel-core.

Variants§

§

F32

§

F16

§

BF16

§

Q4_0

§

Q4_1

§

Q5_0

§

Q5_1

§

Q8_0

§

Q8_1

§

Q2K

§

Q3K

§

Q4K

§

Q5K

§

Q6K

§

Q8K

§

Iq4Nl

llama.cpp GGML_TYPE_IQ4_NL (20): 32 elems/block, non-linear 4-bit codebook.

§

Iq4Xs

llama.cpp GGML_TYPE_IQ4_XS (23): 256 elems/block, 4-bit codebook, 6-bit sub-block scales.

§

Iq2Xxs

llama.cpp GGML_TYPE_IQ2_XXS (16): 256 elems/block, grid-table quantization; DECODE-ONLY (GAP-211 B2).

§

Iq2Xs

llama.cpp GGML_TYPE_IQ2_XS (17): 256 elems/block, grid-table quantization; DECODE-ONLY (GAP-211 B2).

§

Iq3Xxs

llama.cpp GGML_TYPE_IQ3_XXS (18): 256 elems/block, grid-table quantization; DECODE-ONLY (GAP-211 B2).

§

Iq1S

llama.cpp GGML_TYPE_IQ1_S (19): 256 elems/block, grid-table quantization; DECODE-ONLY (GAP-211 B2).

§

Iq3S

llama.cpp GGML_TYPE_IQ3_S (21): 256 elems/block, grid-table quantization; DECODE-ONLY (GAP-211 B2).

§

Iq2S

llama.cpp GGML_TYPE_IQ2_S (22): 256 elems/block, grid-table quantization; DECODE-ONLY (GAP-211 B2).

§

Iq1M

llama.cpp GGML_TYPE_IQ1_M (29): 256 elems/block, grid-table quantization; DECODE-ONLY (GAP-211 B2).

§

Tq1_0

llama.cpp GGML_TYPE_TQ1_0 (34): 256 elems/block, ternary (5 trits/byte); DECODE-ONLY (GAP-211 C).

§

Tq2_0

llama.cpp GGML_TYPE_TQ2_0 (35): 256 elems/block, ternary (2 bits/elem); DECODE-ONLY (GAP-211 C).

§

Mxfp4

llama.cpp GGML_TYPE_MXFP4 (39): 32 elems/block, E2M1 with an E8M0 block scale; DECODE-ONLY (GAP-211 C).

§

Nvfp4

llama.cpp GGML_TYPE_NVFP4 (40): 64 elems/block, E2M1 with four UE4M3 sub-block scales; DECODE-ONLY (GAP-211 C).

Implementations§

Source§

impl GgmlDType

Source

pub fn from_u32(u: u32) -> Result<GgmlDType, Error>

Source

pub fn to_u32(self) -> u32

Source

pub fn type_size(&self) -> usize

Source

pub fn block_size(&self) -> usize

Source

pub fn supports_quantize(self) -> bool

false for the grid-table IQ formats (GAP-211 B2) and the TQ/MXFP4/NVFP4 formats (GAP-211 C): Fuel decodes them but has no quantizer for them.

Source

pub fn check_quantize(self) -> Result<(), Error>

Declines quantizing to a decode-only format with a typed error that names it, instead of reaching GgmlType::from_float, which has nothing to run.

Source

pub fn check_dequant_count( self, op_label: &str, numel: usize, byte_len: usize, ) -> Result<(), Error>

GAP-333: numel dequantized elements are read from numel / block_size whole blocks of type_size bytes. Declines a count that is not a whole number of blocks, or whose blocks do not fit in byte_len.

The one copy every backend’s dequantize calls before it reads, so the predicate cannot drift between them.

Trait Implementations§

Source§

impl Clone for GgmlDType

Source§

fn clone(&self) -> GgmlDType

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for GgmlDType

Source§

impl Debug for GgmlDType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for GgmlDType

Source§

impl Hash for GgmlDType

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for GgmlDType

Source§

fn eq(&self, other: &GgmlDType) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for GgmlDType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V