Expand description
The block-scale lane: a weight block’s integer sums as the array and the activation side deliver them, turned into
the block’s f32 value and added into its row, exactly as super::numerics::dot does under
ActScaling::PerBlock.
The array never sees a signed code. A weight code q (a decoder’s unsigned code, one or two 4-bit digits) meets
an activation word in excess form: a one-word code a as a + 128, a two-word code’s signed high byte as
hi + 128 and its unsigned low byte as itself. Per 16-element unit the array delivers P′ = Σ q·a′ for each word,
the weight image carries Q = Σ q, and the activation side carries S′ = Σ a′. The unit’s sums against the signed
codes follow exactly:
Σ (q − z)·a = P′ − 128·Q − z·S′ + 128·16·z and Σ a = S′ − 128·16 for an excess word, P′ − z·S′ and S′
for the low byte, the high word weighted by 256;
the coefficient sum is Σ_u c_u·Σ(q − z)·a and the offset sum Σ_u n_u·Σ a. The lane multiplies them by the
block’s scales times the activation scale, sums the two terms exactly, rounds once and adds into the row.
Structs§
- Lane
Block - One weight block as a lane reads it.
- Unit
Sums - What the array and the activation side hand a lane for one unit of one word.
- Word
Sums - One word’s unit sums: whether the word crossed in excess form, and its weight in the code (1, or 256 for a two-word code’s high byte).
Constants§
- SUB_
BLOCK - Elements a per-32 activation scale covers: a sub-block of the lane.
Functions§
- block_
sums - The block’s two exact sums:
Σ coef·aandΣ offs·a. - deliver
- What the array, the weight image and the activation side deliver a lane for block
bof a row: the row’s decoded unitsunits(the block’s own), its block scalesa,b_scale, and the block’s activations ofactinwords. - deliver32
- What the array, the weight image and the activation side deliver the per-32 lane for the 32-element sub-block
sof a row’s weight blockb: the block’s decoded unitsunits(the sub-block’s two among them), the block’s scales, and the sub-block’s activations ofact, scaled per 32 elements, inwords. - group
- A group of the row —
super::numerics::GROUPelements, its sub-blockssubs— rounded once and added intoacc: every sub-block’s two exact sums times its block’s scales and its own activation scale, the group’s terms summed exactly, assuper::numerics::dotdoes underActScaling::Sub32. - lane
- The block’s value rounded once and added into
acc.