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 ownstatic_asserton 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
impl GgmlDType
pub fn from_u32(u: u32) -> Result<GgmlDType, Error>
pub fn to_u32(self) -> u32
pub fn type_size(&self) -> usize
pub fn block_size(&self) -> usize
Sourcepub fn supports_quantize(self) -> bool
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.
Sourcepub fn check_quantize(self) -> Result<(), Error>
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.
Sourcepub fn check_dequant_count(
self,
op_label: &str,
numel: usize,
byte_len: usize,
) -> Result<(), Error>
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§
impl Copy for GgmlDType
impl Eq for GgmlDType
impl StructuralPartialEq for GgmlDType
Auto Trait Implementations§
impl Freeze for GgmlDType
impl RefUnwindSafe for GgmlDType
impl Send for GgmlDType
impl Sync for GgmlDType
impl Unpin for GgmlDType
impl UnsafeUnpin for GgmlDType
impl UnwindSafe for GgmlDType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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