Commit 5fcf9ed
committed
ggml-openvino: add Gemma-4 26B MoE support
Adds support for the Gemma-4 26B-A4B hybrid-FFN MoE model on the OpenVINO
backend (dense shared FFN + 128-expert top-8 MoE per layer, interleaved
SWA/global attention, QK-norm, sandwich norms, logit soft-cap).
Backend changes (all under ggml/src/ggml-openvino/):
- 3D quantized expert weights: rank-2 GatherCompressed-matchable dequant
(Q4_K gate/up, Q5_1 down), f16 zero-point (zp = -bias/scale) so the
fusable Subtract form stays algebraically w*s + min without OOM; extracted
in-place into the backend buffer (use_bias sizing).
- Per-expert VIEW slicing on the non-static path + unique VIEW output names
so the 8 same-named expert views no longer collide in the tensor_map.
- MoE token dim kept dynamic through SUM_ROWS/DIV/CLAMP routing-norm ops and
the per-expert scale, so all RoPE concats stay dynamic (fixes decode
Broadcast mismatch and the GPU in-place-concat KV-cache corruption).
- GET_ROWS batched-gather index broadcast tied to the data batch dim.
- Full-MoE GPU path auto-enabled for quant-MoE models (latched on MUL_MAT_ID
at placement); keeps the whole MoE on one OV submodel and dodges the GPU
rms_fusion bug (Multiply-square instead of Power(x,2)) for the router norm.
- op gating: exclude fused TOPK_MOE (uses ARGSORT routing), i64 CONCAT,
borderline q4_1/q5_1 n=256 GET_ROWS, and oversized non-expert MUL_MAT_ID.
- Guard is_kvcache() against a null view_src on SCALE ops (gemma4 inp_scaled),
which otherwise segfaults compute_llm_params.
Verified against ravi9/dev_backend_openvino: gemma4 26B MoE CPU greedy
"Paris is the capital of France"; gemma4 E2B on CPU/GPU/NPU; dense
Llama-3.2-1B (cli/bench/perplexity/server) on CPU+GPU byte-identical to
baseline; test-backend-ops OPENVINO CPU 2622/2622 and GPU 2597/2597.1 parent c6311c3 commit 5fcf9ed
10 files changed
Lines changed: 569 additions & 75 deletions
File tree
- ggml/src/ggml-openvino
- openvino
- op
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
566 | 566 | | |
567 | 567 | | |
568 | 568 | | |
569 | | - | |
| 569 | + | |
570 | 570 | | |
571 | 571 | | |
572 | 572 | | |
| |||
979 | 979 | | |
980 | 980 | | |
981 | 981 | | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
982 | 1006 | | |
983 | 1007 | | |
984 | 1008 | | |
| |||
1694 | 1718 | | |
1695 | 1719 | | |
1696 | 1720 | | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
1697 | 1729 | | |
1698 | 1730 | | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
1699 | 1737 | | |
1700 | 1738 | | |
1701 | 1739 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
176 | 198 | | |
177 | 199 | | |
178 | 200 | | |
| |||
252 | 274 | | |
253 | 275 | | |
254 | 276 | | |
255 | | - | |
256 | | - | |
257 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
258 | 283 | | |
259 | 284 | | |
260 | 285 | | |
| |||
390 | 415 | | |
391 | 416 | | |
392 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
393 | 422 | | |
394 | 423 | | |
395 | 424 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
102 | 119 | | |
103 | 120 | | |
104 | 121 | | |
| |||
0 commit comments