Repository navigation
sycl : accelerate MXFP4 MoE with arithmetic decoding and weight reordering - #29809
Conversation
|
Excelent! I tested your PR on Intel Arc B570 (Windows 11). Environment:
Correctness:
MUL_MAT_ID MXFP4 kernel benchmark (2880x2880, 32 experts, 4 used):
gpt-oss-20b MXFP4, -ngl 16:
Perplexity (8x2048):
The MXFP4 MUL_MAT_ID decode optimization therefore reproduces on Arc B570 as well as the reported B70 results. The model-level gain is smaller than the kernel-level gain due to partial GPU offloading on the B570's 10GB VRAM. Thank you! P.S. |
|
Hi all - Let me know if you need anything else on this one. I have more improvements to submit for the Intel Arc community, but know we aren't supposed to submit more than 1 pr at a time. LMK if you need anything else on this one. |
|
Hi @arthw - Can I get this one reviewed? This was also tested successfully by @Asahi-Prv on an Arc B570. |
There was a problem hiding this comment.
On Arc 770:
There are regression issue of FA=OFF:
| GGUF | Test | fa | Base t/s | Primary t/s | Increase Rate (Primary vs Base) |
|---|---|---|---|---|---|
| gpt-oss-20b-mxfp4.gguf | pp1024 | 0 | 772.86 | 689.14 | -10.83% |
| gpt-oss-20b-mxfp4.gguf | pp1024 | 1 | 736.49 | 748.08 | 1.57% |
| gpt-oss-20b-mxfp4.gguf | pp2048 | 0 | 758.67 | 680.45 | -10.31% |
| gpt-oss-20b-mxfp4.gguf | pp2048 | 1 | 698.80 | 709.56 | 1.54% |
| gpt-oss-20b-mxfp4.gguf | pp4096 | 0 | 725.53 | 652.83 | -10.02% |
| gpt-oss-20b-mxfp4.gguf | pp4096 | 1 | 638.20 | 648.35 | 1.59% |
| gpt-oss-20b-mxfp4.gguf | pp512 | 0 | 784.34 | 699.39 | -10.83% |
| gpt-oss-20b-mxfp4.gguf | pp512 | 1 | 753.38 | 767.10 | 1.82% |
| gpt-oss-20b-mxfp4.gguf | tg128 | 0 | 20.28 | 26.17 | 29.04% |
| gpt-oss-20b-mxfp4.gguf | tg128 | 1 | 23.80 | 33.15 | 39.29% |
|
On B60, the result is good:
|
|
@Captain-Tripps Thank you! |
…ight reordering Speeds up MXFP4 MoE inference in the SYCL backend, delivering 1.91x faster token generation for gpt-oss-20b and 2.02× for gpt-oss-120b on Intel Arc Pro B70. - Replaces table-based MXFP4 decoding with bit-identical 32-bit arithmetic, avoiding costly permute emulation. - Adds lazy, per-expert weight reordering to enable aligned vector loads, with reorder-aware decode, multi-token, and prefill paths. - Limits temporary reorder memory to 32 MiB and preserves the generic fallback for misaligned tensors. Assisted-by: Claude Opus 5.5
97987dc to
d890cc8
Compare
|
Hi @arthw - Previously, the reorder only happened in the fused single-token decode path. That meant the first set of prompt-processing tests ran before the experts were reordered, while later tests used the reordered layout. Swapping -fa 0,1 to -fa 1,0 confirmed that the pp results depended on which mode ran first. With the fix, I’m seeing roughly 20–33% higher pp throughput on my Arc Pro B70 with gpt-oss-20b-Q8_0 (in this unsloth file the expert tensors are MXFP4), in both FA modes and both test orders. Decode improves by about 13–16% with FA off and roughly doubles with FA on. Both builds (stock master and this PR) pass all MUL_MAT_ID and MUL_MAT backend tests, and the perplexity results are within the reported uncertainty. The rebase also picks up the corrected Metal fusion test baseline from #29812, which should address the earlier CI failure. Please give the updated version another run with both FA settings when you have a chance. |
|
I test with the rebased PR.
Arc 770 FA 0,1
FA 1,0
B60:
FA 1,0
|
|
The only failing check is This PR only touches |
|
@Captain-Tripps Thank you for your diligance checking the exact build failure and making sure your changes didn't break anything. I appreciate it! |
…ight reordering Port of ggml-org/llama.cpp PR ggml-org#29809 (commit 97987dc9b) onto this branch. Adapted: the MoE reorder launcher takes this branch's multi-token arguments, the reorder multi-column switch goes to 16 columns, MXFP4 joins the fused gate + up + GLU launcher and the type lists that had more entries here. gpt-oss-20b on one Arc Pro B70 (Linux): tg128 53.72 -> 137.7 t/s, pp512 1671 -> 1690 t/s. MUL_MAT_ID 32 experts / 4 used, 2880 x 2880: 1 token 159 -> 34.7 us, 8 tokens 1446 -> 280 us. Assisted-by: Claude Opus 5.5
…does Upstream merged ggml-org#29809 (MXFP4 MoE with arithmetic decoding and weight reordering, 1e6f04a), which this branch carried as a port. The replay onto it kept the port where the two differ: up to 16 columns, the token strides of this branch's MoE kernel, its fused GLU launch and its reorder gate. Upstream's version also reorders MXFP4 experts at the top of the per-expert path of ggml_sycl_mul_mat_id(), so a prompt batch does not depend on a single-token decode having run first. That call is taken here; with it the tree is the merge of this branch with master f2918ca. Assisted-by: Claude Opus 5.5
…ight reordering Port of ggml-org/llama.cpp PR ggml-org#29809 (commit 97987dc9b) onto this branch. Adapted: the MoE reorder launcher takes this branch's multi-token arguments, the reorder multi-column switch goes to 16 columns, MXFP4 joins the fused gate + up + GLU launcher and the type lists that had more entries here. gpt-oss-20b on one Arc Pro B70 (Linux): tg128 53.72 -> 137.7 t/s, pp512 1671 -> 1690 t/s. MUL_MAT_ID 32 experts / 4 used, 2880 x 2880: 1 token 159 -> 34.7 us, 8 tokens 1446 -> 280 us. Assisted-by: Claude Opus 5.5
…does Upstream merged ggml-org#29809 (MXFP4 MoE with arithmetic decoding and weight reordering, 1e6f04a), which this branch carried as a port. The replay onto it kept the port where the two differ: up to 16 columns, the token strides of this branch's MoE kernel, its fused GLU launch and its reorder gate. Upstream's version also reorders MXFP4 experts at the top of the per-expert path of ggml_sycl_mul_mat_id(), so a prompt batch does not depend on a single-token decode having run first. That call is taken here; with it the tree is the merge of this branch with master f2918ca. Assisted-by: Claude Opus 5.5
…ight reordering Port of ggml-org/llama.cpp PR ggml-org#29809 (commit 97987dc9b) onto this branch. Adapted: the MoE reorder launcher takes this branch's multi-token arguments, the reorder multi-column switch goes to 16 columns, MXFP4 joins the fused gate + up + GLU launcher and the type lists that had more entries here. gpt-oss-20b on one Arc Pro B70 (Linux): tg128 53.72 -> 137.7 t/s, pp512 1671 -> 1690 t/s. MUL_MAT_ID 32 experts / 4 used, 2880 x 2880: 1 token 159 -> 34.7 us, 8 tokens 1446 -> 280 us. Assisted-by: Claude Opus 5.5
…does Upstream merged ggml-org#29809 (MXFP4 MoE with arithmetic decoding and weight reordering, 1e6f04a), which this branch carried as a port. The replay onto it kept the port where the two differ: up to 16 columns, the token strides of this branch's MoE kernel, its fused GLU launch and its reorder gate. Upstream's version also reorders MXFP4 experts at the top of the per-expert path of ggml_sycl_mul_mat_id(), so a prompt batch does not depend on a single-token decode having run first. That call is taken here; with it the tree is the merge of this branch with master f2918ca. Assisted-by: Claude Opus 5.5
…ight reordering Port of ggml-org/llama.cpp PR ggml-org#29809 (commit 97987dc9b) onto this branch. Adapted: the MoE reorder launcher takes this branch's multi-token arguments, the reorder multi-column switch goes to 16 columns, MXFP4 joins the fused gate + up + GLU launcher and the type lists that had more entries here. gpt-oss-20b on one Arc Pro B70 (Linux): tg128 53.72 -> 137.7 t/s, pp512 1671 -> 1690 t/s. MUL_MAT_ID 32 experts / 4 used, 2880 x 2880: 1 token 159 -> 34.7 us, 8 tokens 1446 -> 280 us. Assisted-by: Claude Opus 5.5
…does Upstream merged ggml-org#29809 (MXFP4 MoE with arithmetic decoding and weight reordering, 1e6f04a), which this branch carried as a port. The replay onto it kept the port where the two differ: up to 16 columns, the token strides of this branch's MoE kernel, its fused GLU launch and its reorder gate. Upstream's version also reorders MXFP4 experts at the top of the per-expert path of ggml_sycl_mul_mat_id(), so a prompt batch does not depend on a single-token decode having run first. That call is taken here; with it the tree is the merge of this branch with master f2918ca. Assisted-by: Claude Opus 5.5
Overview
Results:
Speeds up MXFP4 MoE inference in the SYCL backend:
Changes:
Additional information
This was tested and benchmarked on Intel Arc Pro B70 GPUs running Windows 11 and oneAPI 2026.0 and AMD EPYC 7402P, with flash attention enabled. Gpt-oss-20b ran on one card and gpt-oss-120b on two cards.
All MXFP4 backend tests pass on both devices: MUL_MAT 39/39 and MUL_MAT_ID 74/74. gpt-oss-20b perplexity remains within noise of the baseline.
Arithmetic decoding is the prerequisite for the weight-reordering optimization. Other GPUs and Linux have not been tested.
Prior to this change, the SYCL backend never created reorder metadata for the MXFP4 tensors, so the existing MXFP4 MUL_MAT_ID tests never exercised a reordered kernel.
Requirements
I have read and agree with the contributing guidelines - YES
AI usage disclosure: YES - Opus 5.5 has been helping me hill-climb efficiencies with the Intel Arc platform. This seems like one the rest of the community would benefit from.