Details
ggml: support quant scales for fp8 and nvfp4 (#28898)
-
ggml: add tensor scaling (per-tensor, per-channel, per-expert, per-expert-per-channel) support
-
add meta backend scale split
-
add optional activation scales to mul_mat and mul_mat_id tensors
-
handle bitnet scales too, disable in backends
-
Don't treat single expert as per-channel-per-expert
-
Temp workaround for moe-cache with scaled data-types
-
Also apply scales in CPU backend 's tiled mul_mat
-
Handle strided views on scales
-
Make *scale tensors use existing GGML_OP_MUL buffer probe
-
Make scale tensors required for ggml_type with needs_scale=true
-
Make needs_scale=true for FP8
-
Use ggml_need_scale in code-base
-
Transform companion FP8 scales
-
Add comment explaining intended use of activation scales
-
Fix pre-existing view-handling failure in meta backend
eae135b exposed an issue with single-ton dimension ambiguitiy + views
in meta backend, see https://github.com/ggml-org/llama.cpp/actions/runs/39765669007/job/119780422102
-
Enforce scale side-cars for scaled data-types during conversion
-
tq quants also need scales
-
llama: use map for scale tensors instead of manual handling
Assisted-by: Codex
-
Fix conversion edge-case for FP8 block-scales
-
Revert "tq quants also need scales"
This reverts commit 5920e55.
- Disable dedicated kernels also for kleidiai in requant test
We want to test requant errors so we should be using the same kernels
to avoid a cofounder
-
Add separate tests for scaled and unscaled DSV2
-
Also remove IQ from needs_scale related tests/behvaior
-
Wire activation scales and disallow broadcasting over K
-
Adjust build_* in lfm3.cpp
-
Avoid internal includes in test-llama-arch for moe scales
see #27512 (comment)
-
djust build_* in limite.c
pp as well -
Adjust build_* for mistral 4
-
More build_*_ffn changes
-
fp8 : fix integration after rebase
-
Another round of model scale map fixes
-
Only read scales for valid experts
-
handle input scales through cache similar to weight scales
-
check supports_op in cache slots
-
use is_scalar/is_vector functions
-
fix Windows CI cleanup failure
-
exclude BLOOM, JAIS and REFACT from sm_tensor due to Alibi not handled in TP correctly yet
-
increase error threshold for hunyuan and maincoder context shifting
-
adapt CUDA fusion code to scale change
-
fix MoE cache too small error
-
increase error threshold for hrm_text
-
replace missing model matmul cases
-
clean up unused CUDA code
-
more missed matmuls
-
handle per-tensor (scalar) scales in moe cache
-
place scales with their weights
-
increase error threshold for moe scales check
-
restore CUDA cublaslt scale path
-
convert model matmuls, handle weight views, add tests
-
fix comments and error style
-
cuda: use global scale functions
-
fix kleidiai
-
cuda: honour f32 prec in cublaslt call
-
update Metal fusion count
-
fix gemma4 scale issue
-
don't remove trivial scale if required
-
adapt new models changes
-
adapt conversion qwen4exp changes and tests
-
improve error message when scale unsupported
-
address feedback
-
adapt new models
-
metal : apply the weight scale of MUL_MAT and MUL_MAT_ID
-
ggml : avoid
ggml_type_traitsABI change + TODOs -
metal : drop the comments of the weight scale epilogue
-
undo moe-cache-specific changes
-
tests : update the Metal fusion baseline
-
handle scale in repack and kleidiai, fix scale buffer placement in loader
-
llama : fix weight scale lookup, validate MUL_MAT_ID scales
- only look up a weight scale for .weight tensors (k_scale/v_scale
tensors were checked against the weight scale and failed to load) - check MUL_MAT_ID weight scale shapes at load time instead of asserting
- llama-quantize: error out on nvfp4/f8_e4m3 targets (no scale computed)
- llama-quant: NULL -> nullptr
- clean up unnecessary tests
Co-authored-by: Oliver Simons osimons@nvidia.com
Co-authored-by: Pascal admin@serveurperso.com
Co-authored-by: Georgi Gerganov ggerganov@gmail.com
Website:
Attestations:
macOS/iOS:
- macOS Apple Silicon (arm64)
- macOS Apple Silicon (arm64, KleidiAI enabled) DISABLED
- macOS Intel (x64)
- iOS XCFramework
Linux:
- Ubuntu x64 (CPU)
- Ubuntu arm64 (CPU)
- Ubuntu 24.04 s390x (CPU)
- Ubuntu 26.04 s390x (CPU)
- Ubuntu 26.04 s390x (zDNN)
- Ubuntu x64 (Vulkan)
- Ubuntu arm64 (Vulkan)
- Ubuntu x64 (CUDA 12) - CUDA 12.8 libraries
- Ubuntu x64 (CUDA 13) - CUDA 13.5 libraries
- Ubuntu arm64 (CUDA 13) - CUDA 13.5 libraries
- Ubuntu x64 (ROCm 10.0)
- Ubuntu x64 (OpenVINO)
- Ubuntu x64 (SYCL FP32)
- Ubuntu x64 (SYCL FP16)
- Linux arm64 (Snapdragon: CPU, Adreno GPU, Hexagon NPU) - setup guide
Android:
Windows:
- Windows x64 (CPU)
- Windows arm64 (CPU)
- Windows arm64 (OpenCL Adreno)
- Windows x64 (CUDA 12) - CUDA 12.4 DLLs
- Windows x64 (CUDA 13) - CUDA 13.5 DLLs
- Windows arm64 (CUDA 13) - CUDA 13.5 DLLs
- Windows x64 (Vulkan)
- Windows arm64 (Vulkan)
- Windows x64 (OpenVINO)
- Windows x64 (SYCL)
- Windows x64 (ROCm 10.0)
openEuler:
- DISABLED
- openEuler x86 (310p)
- openEuler x86 (910b, ACL Graph)
- openEuler aarch64 (310p)
- openEuler aarch64 (910b, ACL Graph)
UI: