Repository navigation
Conversation
On the SpacemiT X60, the IME matrix acceleration only covered Q4_0/Q4_1/Q4_K. Q8_0 fell back to the generic scalar path, which is much slower for prefill. This adds an IME1 Q8_0 kernel so Q8_0 also uses the matrix engine. - add make_block_q8_0x16: interleave Q8_0 weights into the layout the IME1 vmadot sequence expects - add ime1::gemm_kernel_i8i8: an int8 x int8 IME1 kernel - wire it into forward_mul_mat / the repack factory for Q8_0 This is an M1-only kernel for now. For gemm_m >= 4 the A activations are forced through the single-row quantization path (quantize_a_4row_i8 = nullptr); an M4 kernel is left as a follow-up. Tested on Milk-V Jupiter (SpacemiT X60), gcc 14.2, Qwen2.5-0.5B Q8_0: output is correct, and llama-bench (-t 4) improves from pp128 10.7 -> 40.0 t/s and tg64 6.6 -> 10.0 t/s.
|
Hi @alanhc, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
I have a Milk-V Jupiter board and wanted to add a Q8_0 matrix-multiply kernel for the SpacemiT X60 (IME1). The X60 already had IME acceleration, but only for Q4_0/Q4_1/Q4_K — Q8_0 fell back to the generic scalar path. This PR adds the missing Q8_0 IME1 kernel, giving ~3.7x faster prefill.
Additional information
Changes:
make_block_q8_0x16+ repack: interleave Q8_0 weights into the layout the IME1vmadotsequence expects.ime1::gemm_kernel_i8i8: an int8 x int8 IME1 kernel.forward_mul_matand the repack factory forblock_q8_0.Limitation: this is an M1-only kernel. For
gemm_m >= 4, A activations are forced through the single-row quantization path (quantize_a_4row_i8 = nullptr). A dedicated M4 kernel is a planned follow-up.Depends on #27961 — without that build fix, the SpacemiT backend does not compile on gcc < 15.
Tested on Milk-V Jupiter (SpacemiT X60), gcc 14.2, Qwen2.5-0.5B-Q8_0,
-t 4(taskset -c 0-3):Output is correct, e.g. "The capital of France is Paris."
Requirements