ggml: optimize ggml_vec_dot_mxfp4_q8_0 dot product on ARM SVE #19171
+105
−1
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.
Proposal
This proposal introduces an ARM SVE-optimized implementation of ggml_vec_dot_mxfp4_q8_0 for the ggml/llama.cpp CPU backend.
The current implementation relies on scalar or NEON-based code paths, which do not fully utilize the wide vector capabilities available on modern ARM CPUs equipped with Scalable Vector Extension(SVE). By leveraging SVE intrinsics, this proposal aims to:
Verifying Features
The proposed SVE implementation was verified with the following considerations:
Accumulation logic and scaling factors follow the original ggml_vec_dot_mxfp4_q8_0 definition.
The implementation uses SVE intrinsics only, without assuming a fixed vector length.
The SVE path is guarded by __ARM_FEATURE_SVE to ensure it is executed only on supported hardware.
Non-SVE platforms continue to use the existing scalar or NEON implementations without modification.
The change does not affect other quantization paths.
Performance check
The performance was measured with FX700.
Performance is improved as follows. The value is tokens per second.
The command used to measure the performance is
llama-batched --model ${PATH_TO_MODEL} --prompt 'AI is going to' --parallel 8 --predict 128 --seed 0 --threads 48