ggml: add support for MXFP8 CPU#26157
Open
michaelw9999 wants to merge 1 commit into
Open
Conversation
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
This PR adds MXFP8 support (CPU only) and includes accelerated x86, ARM, and generic fallback kernels.
Blackwell specific CUDA kernels with native MXFP8 support are ready and to immediately follow.
Support for converting existing Huggingface
MXFP8checkpoints to GGML is included.MXFP8 is a OCP MX block scaled quantization format at 8.25bpw; native hardware acceleration is currently supported on Blackwell.
It uses one FP8 (E4M3) scale per 32 weights.
The
block_mxfp8form used in this implementation has a block size of 256 with a subb;ock size of 32.This requires no padding and is perfectly aligned for GPU kernels.
Additional information
Significant testing and evaluation of MXFP8 with FP8 was described in #25336 .
Testing showed the best performance and quality came from MXFP8 standalone as its own native format.
The use case justification for bringing in
MXFP8into llama.cpp:Quality
The results below are from
Qwen3.5-4B Baseusing WikiText-2, using full KLD/PPL evaluation against complete BF16 logits.Performance
CPU results are for only a basic CPU implementation included in this initial PR. A higher performing implementation is possible, but is not trivial and would expand this PR, so can be added at a later time.
Example MXFP8 GGUF models
Requirements
Yes, AI was used to optimize and generate the CPU kernels. The generated code was exhaustively pruned and hand edited to be concise, minimal, and match llama.cpp style and standards. Verifying and validating the model outputs were done manually with
llama-cliandllama-server.