Skip to main content

Module weights

Module weights 

Source
Expand description

The weight decoders as Verilog: each GGUF block format the array reads, unpacked in place into one form the array and the block-scale unit share.

Every weight is a·c_u·(code − z) + b·n_u: code an unsigned integer (one or two 4-bit digits), z the format’s offset, c_u and n_u small signed integers of the weight’s 16-element unit, a and b the block’s binary16 scales. That is the coded row’s coef = c_u·(code − z) and offs = n_u (crate::spatial::decode_engine::numerics::CodedRow), so a decoder is held to the coded row element by element.

A decoder logos_dec_<format> takes one block’s bytes (blk, byte 0 in bits 7:0) and gives code (8 bits an element), c and n (16 signed bits a unit), a and b (the scales’ bits), and its offset z as a constant. An IQ4 nibble indexes a non-linear level; its code is the level in excess form, level + 128.

Structs§

Decoder
A format’s decoder: the offset it subtracts from its codes and the bits a code spans.
Units
One block as its decoder decodes it: every element’s code, every unit’s multipliers, the two scales’ bits.

Constants§

DECODERS
Every format the engine reads, with its decoder.
UNIT
Elements one unit multiplier c/n covers.

Functions§

decoder_name
The module name of ty’s decoder.
units
ty’s decoder in software, field for field: what logos_dec_<format> gives for the block blk.
weights_verilog
Every decoder.