﻿# llama.cpp SpacemiT Q4_1: the single-row tail still needs zero-point correction

The b12327 SpacemiT Q4_1 path completes zero-point handling for remaining rows; test row-count remainders as well as aligned weight tiles.

Author: Retrivium team
Updated: 2026-11-15
Canonical URL: https://retrivium.ai/journal/week46-engine-spacemit-q41-m1-zero-point/
Language: en

llama.cpp b12327 enables a SpacemiT Q4_1 32×256 packed path and completes its single-row zero-point branch. Upstream notes that the multi-row kernel already handled the layout. The important coverage gap was therefore not the existence of packed weights, but execution of the remaining rows through the appropriate correction path.

## Packed storage was already present

The PR says the layout already carried a separate zero-point array, while selection was disabled and a single-row branch remained incomplete. That distinction matters: adding dispatch to an existing format can expose an execution path that still lacks required arithmetic. A file-format inspection would not have found that missing branch. Support requires the selector, repack interpretation and every reached kernel path to agree.

## Remainder rows choose another implementation

Upstream uses a multi-row kernel for groups of activation rows and a single-row route for the remainder. A test whose row count divides evenly can validate the first while never reaching the second. A proposed regression includes several nonzero remainders and checks each output row independently. Keep the same packed weights so differences track the execution route rather than a change in quantization or tile eligibility.

## Make the zero point observable

Choose quantized inputs with nontrivial zero-point correction and a trusted reference that interprets the same stored values. Symmetric or specially chosen data can make an omitted correction numerically invisible. Include tile-aligned and ineligible shapes to verify selection boundaries, but avoid assuming the newly enabled path handles every Q4_1 matrix. The PR imposes explicit dimension divisibility and hardware conditions for its selector.

## Separate a completed path from a speed promise

The release makes a previously incomplete route usable under its stated conditions. A performance claim still needs the actual SpacemiT platform, shape and workload phase, with correctness established first. This article reports the missing-branch repair and an edge-case design, not a new model benchmark. The broader lesson is to include remainder handling in backend support reviews even when the main multi-row kernel has already passed its tests.

## Sources

- [llama.cpp b12327 release](https://github.com/ggml-org/llama.cpp/releases/tag/b12327)
- [llama.cpp pull request #31929](https://github.com/ggml-org/llama.cpp/pull/31929)

## Related reading

- [ONNX QuantizeLinear: the scale shape and axis define what is quantized together](/journal/fg2-onnx-quantize-linear-axis-scale-contract/)
- [Tune llama.cpp CPU threads separately for prefill and decode](/journal/llama-cpp-prefill-decode-cpu-threads/)
