The three kernel tables (scalar, AVX2, AVX-VNNI) move unchanged into one constructor each;
with_isa keeps the support check and the match. The same function pointers and closures are
stored in the same fields; no kernel code changed. leleka-cpu-kernels tests (parity, mxfp4, q8,
lib) pass, test ids unchanged, clippy -D warnings clean.
Codegen effect is not A/B-measured; no performance claim is made.
attn_weighted_sum_avx2, attn_weighted_sum_f16_avx2, dot_i8i8_avxvnni, dot_i4i8_avxvnni,
dot_mxfp4_q8r4_avxvnni, dot_mxfp4_q8r4_avx2 and quantize_q8_0_avx2 are cut into statement-group
helpers (#[inline] with the same #[target_feature] as the original, unsafe fn, the 64-byte/4-block
main loops, the per-head accumulator block, the scalar column tail, the amax reduction and the
scale/round/pack step, the MXFP4 scaled fma, the int4 nibble unpack). #[inline(always)] is not
combinable with #[target_feature], so #[inline] is used, as the existing helpers do.
Arithmetic, accumulator count, FMA/accumulation order, lane order, rounding and the bounds-check
sites are unchanged; no expression was rewritten.
Identity check (throwaway, deleted): the base-commit x86 module tree (git HEAD) and the new tree were
compiled side by side in a test and run on fixed xorshift inputs, comparing output bits:
attn_weighted_sum f32 and f16 (heads 1-4, hd 1..192 incl. non multiples of 8, n 1..40, stride > hd),
dot_i8i8 / dot_i4i8 (n 0..513 around the 16/32/64 steps), dot_mxfp4_q8r4 avx2 and vnni (0..33 blocks),
quantize_q8_0 (0..33 blocks, zero and -0.0 blocks): 792 cases, all bit-identical, debug and release.
The AVX-VNNI variants cannot run on this CPU (i9-11900H: AVX2, FMA, F16C, AVX-512, no AVX-VNNI):
for them the check ran both trees with vpdpbusd replaced by a scalar emulation and the avxvnni
target feature removed, which proves the loop/helper restructuring but not the instruction itself;
the real VNNI instructions were only compiled. leleka-cpu-sys tests (attention, multi, tiles, lib)
pass; test ids unchanged; clippy -D warnings clean.
Codegen effect is not A/B-measured; no performance claim is made.
attend_group_with_sink now reads as scores, per-head inverse denominators, weighted sum, per-head scaling; the two
loops moved into `#[inline(always)]` helpers (softmax_inverse_denominators, scale_heads_by_inverse) with the same
operations in the same order (same max/exp_shift_sum/exp/reciprocal, same `*o *= inv`), error checks in the same
order. kar_roundtrip: the sample normalisation and the encode/decode of a chunk are helpers (normalized_sample,
kar_reconstruct); same calls, same order, same error mapping.
Identity check (throwaway, deleted): the original ops.rs / quant_probes.rs from the branch start were compiled next to
the new ones and compared on fixed pseudo-random inputs (xorshift): attend_group_with_sink on 6 shapes (1..32 heads,
1..1000 positions) x every available ISA level, output and scores scratch compared by f32 bit pattern, plus the n == 0
and short-scratch error paths; kar_roundtrip for 0/1/7/100/3000/5000/70000 blocks (several 32768-block chunks) x
levels 0..9, output bytes equal, error texts equal, NaN and all-zero groups equal. All equal. Crate suite passes
(31 lib + 11 integration), test ids unchanged, clippy -D warnings clean.
Codegen effect is not A/B-measured; no performance claim is made.
decode_block of both formats now reads as the subblock loop; the per-subblock scale, the quartet-pair/group decode and
the signed grid store are `#[inline(always)]` helpers with the identical arithmetic (same operands, same order, same
rounding, no reassociation).
Identity check (throwaway, deleted): the original iq3_s.rs / iq3_xxs.rs from the branch start were compiled next to the
new ones and compared on 40000 fixed pseudo-random blocks per format (xorshift seed 0x9E3779B97F4A7C15, including
non-finite iq3_s scales: 39155 Ok blocks compared by f32 bit pattern, 845 Err texts equal; 40000 iq3_xxs blocks by bit
pattern): all equal. Crate test suite 36/36 passes, test ids unchanged, clippy -D warnings and fmt clean.
Codegen effect is not A/B-measured; no performance claim is made.