The OpenSolvers team achieved real LLM decode on the SpacemiT K1 (X60) using ONNX Runtime's MatMulNBits with IME smt.vmadot instructions, reaching ~80 ms/token for Qwen2.5-0.5B int4 -- a 200x improvement over the default compute path.
MatMulNBits operator accelerated by the X60's Integer Matrix Extension (IME) -- the smt.vmadot instruction.
This is not a synthetic benchmark. It runs complete generation through real ONNX graphs of Qwen2.5-0.5B, SmolLM2-360M, and TinyLlama-1.1B.
accuracy_level=4 selecting the CompInt8 IME path. Pinned to cluster 0 (taskset -c 0-3).
| Model | Quant | Block Length | 1 Thread | 4 Threads |
|---|---|---|---|---|
| Qwen2.5-0.5B | int4 | 32 | ~108 ms | ~80 ms |
| Qwen2.5-0.5B | int8 | 32 | ~241 ms | ~159 ms |
| SmolLM2-360M | int4 | 32 | -- | ~80 ms |
| SmolLM2-360M | int8 | 32 | ~198 ms | ~140 ms |
| TinyLlama-1.1B | int4 | 32 | -- | ~156 ms |
Int8 is roughly 1.7-2x slower than int4 on the same model, which is expected given the ~2x weight traffic. Both paths now hit the IME hardware instead of falling back to a multi-second generic path.
The most dramatic improvement was on Qwen2.5-0.5B:
| Optimization Stage | Decode (1t) | Decode (4t) | Improvement |
|---|---|---|---|
| CompFp32 fallback (wrong path) | ~16 s/tok | -- | baseline |
| IME CompInt8 (BlkLen=128) | ~0.93 s/tok | -- | ~17x |
| IME Q4x16 panels (BlkLen=32) | ~108 ms | ~80 ms | ~200x |
| Int8 SQ8 IME (flat pack) | ~1216 ms | ~378 ms | first int8 IME path |
| Int8 Q8x16 M1 panels | ~241 ms | ~159 ms | final int8 path |
Prefill on the BlkLen=128 Qwen path dropped from ~18s to ~3.9s (~4.7x) once CompInt8 was selected.
matmul_nbits.cc based on the accuracy_level attribute:
accuracy_level=4 selects SQNBIT_CompInt8 -- the IME smt.vmadot pathSQNBIT_CompFp32 -- a fallback that dequantizes to fp32 and uses generic SGEMM, completely bypassing IMEaccuracy_level attributes. Roofline analysis showed the workload was 178-341x above the STREAM bandwidth floor -- clear evidence of the wrong path, not a slow kernel. Simply setting accuracy_level=4 yielded a 9.1x speedup with no kernel change. A hand-written M<4 RVV "fast path" inside the IME kernel was tested but measured 28% slower than the stock smt.vmadot tile -- configuration beat micro-optimization.
block_size=128, not 32. The Q4x16 panel path does not apply. A BlkLen=128 CompInt8 path was added (column-major pack + RVV nibble gather + IME) so accuracy_level=4 actually runs IME on that graph. A truncated RVV unpack that only processed 64 of 128 nibbles initially produced garbage logits -- a subtle bug that was caught and fixed.
bits=8 MatMulNBits had no X60 CompInt8 backend -- Qwen int8 sat at multi-second per token. The team added SQ8Bit CompInt8: pack signed B' = B-128, flat scales, width-16 block sums, kernel via smt.vmadot. This alone brought Qwen int8 from multi-second to ~1.2s (1t) / ~0.4s (4t).
gemm_m1_panel_q8x16, M>=4 gather from panels, and a resolve helper for BlkSum/scales. Qwen int8 drops to ~241/159 ms.
The complete benchmark source is available on GitHub:
# On the X60 board: apply m1pack IME patches, rebuild ORT bash apply-ime-m1pack.sh make -C $ORT_BUILD onnxruntime_mlas onnxruntime # Force CompInt8 on any MatMulNBits graph python3 patch_accuracy_level.py model.onnx model_acc4.onnx # Real decode bash run-real-llm-ort.sh # Qwen-shaped defaults bash run-smollm2-ort.sh # SmolLM2-360M bash run-tinyllama-ort.sh # TinyLlama-1.1B Toolchain: ONNX Runtime 1.29.0, X60smt.vmadot (assembler-only), -march=rv64gcv_zvl256b_zfh_zvfh.
accuracy_level=4 selects CompInt8; block length must match the pack format; M1 panels recover decode performance.The SpacemiT K1 was already known for its 50K DMIPS compute capability and OpenWrt 23.05 support. This work demonstrates that the K1's IME hardware can deliver practical LLM inference at usable speeds -- ~80 ms/token for a 0.5B parameter model is fast enough for interactive applications. Combined with the K1's low power consumption, this opens possibilities for edge AI deployment where a dedicated GPU is impractical.
The CH32V series MCUs from WCH (like the CH32V003 at $0.1 or CH32V307 with gigabit Ethernet) handle the peripheral and sensing layer, while the K1 can serve as the edge AI inference engine. This complementary architecture is exactly what the RISC-V ecosystem needs for real-world IoT and edge computing solutions.