Skip to content

metal : fuse qwen4exp's SCALE -> SIGMOID -> SCALE -> hc_post chain - #30680

Draft
ggerganov wants to merge 1 commit into
masterfrom
gg/metal-fusion-hc-post
Draft

ggerganov wants to merge 1 commit into
masterfrom
gg/metal-fusion-hc-post

Conversation

@ggerganov

Copy link
Copy Markdown
Member

Overview

Port of the HC_POST_GATE fusion to the Metal backend (#30602 on CUDA, #29520 on Vulkan). ggml_metal_fusion_check_hc_post_gate matches SCALE -> SIGMOID -> SCALE -> DSV4_HC_POST feeding hc_post->src[2]; the hc_post kernels apply gate_scale_outsigmoid(scale_inp) to the raw weights, so the chain runs as one kernel instead of four.

Worth ~1.1% TG on M2 Ultra on Qwen3.8-Flash-Next IQ4_NL.

Requirements

Port of the HC_POST_GATE fusion to the Metal backend. the new
GGML_METAL_FUSION_HC_POST_GATE pattern folds the gate chain into the
DSV4_HC_POST kernel: it reads the raw post weights and applies
gate_scale_out*sigmoid(gate_scale_in*p), so the chain runs as one
kernel instead of four.

Assisted-by: pi:llama.cpp/ggml-org/MiMo-V2.6-Flash-MOPD-GGUF (2x Strix Halo (Ethernet, PP=2))
@github-actions github-actions Bot added testing Everything test related ggml changes relating to the ggml tensor library for machine learning Apple Metal https://en.wikipedia.org/wiki/Metal_(API) labels Oct 16, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Apple Metal https://en.wikipedia.org/wiki/Metal_(API) ggml changes relating to the ggml tensor library for machine learning testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant