ggml-cpu: fuse RMS_NORM + MUL on CPU backend #22423
Merged
Merged
Conversation
Contributor
|
Some quick performance numbers
|
am17an
reviewed
Apr 27, 2026
Contributor
Author
|
Thanks for the review, @am17an Addressed in the latest commit. PTAL |
am17an
reviewed
Apr 28, 2026
am17an
reviewed
Apr 28, 2026
am17an
approved these changes
Apr 28, 2026
Contributor
Author
|
@ggml-org/maintainers need second approval please. |
ggerganov
reviewed
Apr 29, 2026
CISC
reviewed
Apr 30, 2026
ggerganov
reviewed
Apr 30, 2026
Member
|
@zzzzwc Sorry, as usual GitHub UI messed up newlines, please normalize to |
Contributor
Author
Done, Sorry for the delay. |
CISC
approved these changes
May 4, 2026
Contributor
Author
|
Is there anything else I should address before merging? |
ggerganov
reviewed
May 5, 2026
Add a fused rms_norm + mul kernel that computes the output in a single pass, avoiding materialization of the intermediate rms_norm result. The graph compute loop detects the pattern and dispatches to the fused path. fusion can be disabled via the GGML_CPU_DISABLE_FUSION environment variable.
- inline get_disable_fusion() into ggml_cpu_try_fuse_ops - fix env check: only disable on "1"/"on"/"true" (case-insensitive) - return fused node count (int) instead of bool, for future N-op fusion - add TODO to move fusion detection into ggml_graph_plan
Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>
- normalize to LF (\n) in ggml-cpu.c - rename variables in ops.cpp from xxx_dst to dst_xxx
- rename GGML_RMS_NORM_FUSE_XXX to GGML_RMS_NORM_FUSE_OP_xxx
ggerganov
approved these changes
May 6, 2026
cetarthoriphros
pushed a commit
to cetarthoriphros/llama.cpp
that referenced
this pull request
May 9, 2026
meh
pushed a commit
to meh/llama.cpp
that referenced
this pull request
May 10, 2026
baramofme
pushed a commit
to baramofme/llama-cpp-turboquant
that referenced
this pull request
May 23, 2026
carlosfundora
pushed a commit
to carlosfundora/llama.cpp-1-bit-turbo
that referenced
this pull request
May 24, 2026
(cherry picked from commit f08f20a)
winstonma
pushed a commit
to winstonma/llama.cpp
that referenced
this pull request
May 27, 2026
fewtarius
pushed a commit
to fewtarius/CachyLLama
that referenced
this pull request
May 30, 2026
fukuro-kun
pushed a commit
to fukuro-kun/fukuro-llama-cpp-turboquant
that referenced
this pull request
Jul 12, 2026
…026-07-12) 4 parallele Subagents (Vulkan/AMD, CUDA/MoE, arXiv, Multi-GPU/Batching) konsolidiert zu 25 neuen Items in ROADMAP: Tier 1 Quick Wins (3 neu): - AtomicBot-ai#31 K-Quant A-Matrix Transpose CM1 (PR ggml-org#22970, +5-15% PP auf Mars) - AtomicBot-ai#32 Pascal L1 Cache Tuning (-Xptxas -dlcm=ca, Styx) - TheTom#33 Per-Quant MMVQ/MMQ Batch Threshold (AMD MFMA, Mars/Venus) Tier 2 (7 neu): - TheTom#34 UBBoost, TheTom#35 Row-Packing DMMV, TheTom#36 Auto Param Fitting TP - TheTom#37 LFRU Expert Caching, TheTom#38 Conf-KV, TheTom#39 Talon, TheTom#40 MoE Load Balancing Tier 3 (5 neu): - TheTom#41 GRKV, TheTom#42 CapKV, TheTom#43 SliderQuant, TheTom#44 Alloc-MoE, TheTom#45 CUDA Streams QKV Tier 4 (10 neu): - TheTom#46-55: SpecMD, QUICK, FluxMoE, STAR-KV, VQKV, CompilerKV, SliceMoE, MoBiE, DASH-Q, GOOSE 7 PRs als bereits im Fork identifiziert (nicht erneut vorschlagen): ggml-org#21472, ggml-org#23764, ggml-org#22299, ggml-org#21611, ggml-org#22423, ggml-org#18749, Warp Shuffle, Constant Memory
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
Add a fused RMS_NORM + MUL kernel on the CPU backend that computes the output in a single pass, avoiding materialization of the intermediate rms_norm result to improve performance of the CPU backend. (Fusion can be disabled via GGML_CPU_DISABLE_FUSION.)
Extend test-backend-ops perf mode with perf_group_size() to support accurate multi-op benchmarking.
Additional information
Discussion: #22315
The benchmark result on my Mac:
Env
MacBook Air M2 24GB
Before (fusion disabled):
After (fusion enabled):
multi_add=0multi_add=1Requirements