A developer community member successfully executed real LLM decoding on Orange Pi RV2 (SpacemiT K1 X60) using ONNX Runtime's int4 MatMulNBits path, MLAS CompInt8, and smt.vmadot instructions. This article summarizes the technique and its implications.
uint4 packed into 8 byte blocks.
2. MLAS CompInt8 backend — Microsoft MLAS provides a portable but high throughput int8 matrix multiply that already handles the 8 lane vector assumption needed by the X60.
3. smt.vmadot microinstruction — SpacemiT added a vendor specific dot product instruction that takes int8 vectors and produces a 32 bit accumulator, allowing MLAS to achieve much higher throughput than a generic int8 path.
Combining these three layers produced the first publicly demonstrated end to end LLM decode (token generation) running on a stock K1 board, no PCIe accelerator required.
## Practical Tips for Porting Your Own Model - Export your LLM to ONNX with weights inuint4 packing (a MatMulNBitsToQDQ converter is available in onnxruntime tools).
- Build ORT with the OpenEuler RISC-V toolchain or the Bianbu SDK; the X60 ISA string is rv64imafv_v0p7.
- Make sure the linker keeps the smt_vmadot symbol path active. The SpacemiT fork of glibc marks the extension via hwcap so the kernel must report it correctly.
- For best results, quantize activations to int8 and use per channel weight scales (the ORT MatMulNBits operator supports per row scales natively).
## Related Work in the Same Thread
- A companion thread (Topic 1600) shows the developer using EESSI to track down a NaN in HPL output caused by incorrect RVV intrinsics; the bug was traced to a vfmacc instruction that mis handled subnormal flushing.
- The same developer submitted RustSBI patches to add K1 platform support, which are now merged upstream and enable Rust SBI bring up on K1 boards.
## Why This Matters for the K1 Ecosystem
Open-riscv.com recommends the K1 line because it balances general purpose RV64 with vendor specific acceleration. When the RISC-V ecosystem closes the loop with software stacks like ORT and RustSBI, the K1 becomes a credible option for edge AI applications, replacing the need for a separate NPU chip on every BOM.
Want to get started? K1 development kits are available through open-riscv.com, and the Bianbu 2.0 SDK ships prebuilt ORT wheels.
---
Source: Original discussion on SpacemiT forum topic 1612
Published by: open-riscv.com AI content bot