Expand description
Int8 W8A8 kernels: symmetric per-output-channel Q8 weights times per-row Q8 activations.
This is the Phase-2/3A quantized projection route for the talker and microdecoder GEMMs.
The numeric contract is S8S8: weights quantized by the canonical symmetric recipe
(scale = max|row| / 127, ties-to-even, [-127, 127], -128 never emitted — identical to
ftts-artifacts::converter::quantize_output_channel_q8, byte-for-byte, asserted by a
cross-crate test in ftts-model-qwen), activations quantized dynamically per row with the
same recipe. Accumulation is exact i32; the two f32 scales are applied once, after
accumulation, in a fixed multiplication order shared by every tier.
§Tier law
Every tier of dot_i32 is exactly equal in i32 to Int8Tier::Scalar on every input —
integer addition is associative, and the overflow selftest proves the all-extreme reduction
fits i32 at every census binding K. A tier is only dispatchable after
crate::selftest::run_selftest has executed its all-extreme proof rows through the real
kernel function on the running silicon. Do not add a tier here without extending the selftest.
Inherited prior NE-INH-003 (re-verify per toolchain): on Apple M4, LLVM autovectorization of
the scalar shape beat a hand SDOT micro-tile at m=1. Both routes therefore ship; dispatch
preference is decided by measurement (FTTS_INT8_TIER forces a route for A/B), never by
assumption.
Structs§
- Kernel
Plan V0 - The measured per-regime route assignment, decided once per process.
- Quantized
Matrix - A weight matrix quantized with per-output-channel symmetric Q8 scales.
Enums§
- Int8
Tier - An executable int8 dot-product route.
- Quant
Linear Mode - Which quantized linear op class the armed route runs.
Constants§
- Q8_
MAX_ ABS - Largest absolute Q8 byte the canonical symmetric recipe emits.
Functions§
- autotuned_
plan - Measures each available tier at the two live regimes and returns the winners.
- dot_i32
- Exact i32 dot product of two Q8 rows over the selected route.
- linear_
q8 - W8A8 linear: quantized activations
[m, k]times aQuantizedMatrix[n, k], producing f32[m, n]. - linear_
q8_ dynamic - Quantizes an f32 activation matrix
[m, k]per row and runslinear_q8. - linear_
w8a16 - W8A16 linear: f32 activations
[m, k]times aQuantizedMatrix[n, k]producing f32[m, n]. - neon_
sdot_ available - Whether the SDOT island is compiled in and the CPU reports FEAT_DotProd.
- quant_
linear - Runs one quantized linear in the selected mode; the drop-in used by the armed model paths.
- quant_
mode_ from_ environment - The armed quantized-linear mode for the talker/microdecoder route.
- quantize_
row_ q8 - Quantizes one row (weight output channel or activation row) with the canonical symmetric Q8 recipe.
- wasm_
simd128_ available - Whether the SIMD128 island is compiled in.