Skip to content

sycl: *glu flat path - #26354

Merged
ggerganov merged 3 commits into
ggml-org:masterfrom
Titaniumtown:pr/sycl-swiglu-flat-path
Aug 7, 2026
Merged

sycl: *glu flat path#26354
ggerganov merged 3 commits into
ggml-org:masterfrom
Titaniumtown:pr/sycl-swiglu-flat-path

Conversation

@Titaniumtown

@Titaniumtown Titaniumtown commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Overview

Adds a flat path for *GLU kernels.

Also deduplicated shared *GLU codepaths to use a new ggml_sycl_op_unary_gated function.

In addition, I added performance metrics so performance could be measured.

Additional information

I'm not 100% on the terminology used to describe my changes. Please let me know how I could better explain :)

Marking this as a draft for further review and feedback.

Benchmarks

PP perf uplift

On Intel Arc B70:

llama-bench -m Qwen3.6-27B-UD-Q4_K_XL.gguf -ngl 99 -fa on -b 2048 -ub 2048 -p 2048 -n 0 -r 4
metric master @ 958d9c0 PR delta
pp2048 (t/s) 1051.44 1053.67 +0.21%

SWIGLU perf (avg over 3 runs)

On Intel Arc B70:

test-backend-ops perf -o SWIGLU -b SYCL0
dtype shape layout master @ 958d9c0 (GiB/s) PR (GiB/s) delta
f16 17408 x 512 split 292.0 334.2 +14.4%
f16 17408 x 2048 split 268.4 306.2 +14.1%
f32 17408 x 512 split 431.4 446.8 +3.6%
f32 17408 x 2048 split 437.5 455.1 +4.0%
f16 34816 x 512 fused 293.2 292.0 -0.4%
f16 34816 x 2048 fused 261.0 261.0 +0.0%
f32 34816 x 512 fused 439.4 440.4 +0.2%
f32 34816 x 2048 fused 439.4 439.4 -0.0%

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES - Claude Opus 5 was used to debug and make repetitive edits.

perf mode had no GLU coverage. Adds SWIGLU at 17408 columns, 512 and
2048 tokens, f16 and f32, with the operands both fused and split.
They differed only in which op_* they called, so take the op as an argument and share a common launcher.
Their block sizes were all 256, so launch geometry is unchanged;
SYCL_GELU_BLOCK_SIZE and SYCL_SILU_BLOCK_SIZE lose their last users so are dropped.
o0 == n and o1 == n collapse the de-interleave index math to the
identity, so dispatch a flat kernel in that case. It fires for
ggml_glu_split with packed operands; a fused [gate|up] tensor keeps the
strided path. test-backend-ops perf -o SWIGLU on an Arc Pro B70: split
+14% f16 and +4% f32, fused unchanged.
@Titaniumtown Titaniumtown changed the title SYCL: swiglu flat path sycl: swiglu flat path Jul 31, 2026
@github-actions github-actions Bot added testing Everything test related ggml changes relating to the ggml tensor library for machine learning SYCL https://en.wikipedia.org/wiki/SYCL - GPU programming language labels Jul 31, 2026
@Titaniumtown Titaniumtown changed the title sycl: swiglu flat path sycl: *glu flat path Jul 31, 2026

@arthw arthw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good job!

With Qwen3.6-27B-UD-Q4_K_XL.gguf on B60, there is still increasing.

Test fa Base t/s Primary t/s Increase Rate (Primary vs Base)
pp512 0 190.05 190.15 0.05%
pp512 1 187.94 188.02 0.04%
tg128 0 16.98 16.98 0.00%
tg128 1 16.98 16.99 0.06%

Thank you!

@Titaniumtown
Titaniumtown marked this pull request as ready for review July 31, 2026 16:26
@Titaniumtown
Titaniumtown requested review from a team and ggerganov as code owners July 31, 2026 16:26
@arthw arthw added the merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge. label Aug 4, 2026
@ggerganov
ggerganov merged commit 6b5c2ef into ggml-org:master Aug 7, 2026
26 of 29 checks passed
miltos22 pushed a commit to miltos22/llama.cpp-wackMall-merge-request that referenced this pull request Aug 10, 2026
* tests: add SWIGLU perf cases

perf mode had no GLU coverage. Adds SWIGLU at 17408 columns, 512 and
2048 tokens, f16 and f32, with the operands both fused and split.

* sycl: consolidate fused-GLU kernels

They differed only in which op_* they called, so take the op as an argument and share a common launcher.
Their block sizes were all 256, so launch geometry is unchanged;
SYCL_GELU_BLOCK_SIZE and SYCL_SILU_BLOCK_SIZE lose their last users so are dropped.

* sycl: contiguous fast path for the fused GLU ops

o0 == n and o1 == n collapse the de-interleave index math to the
identity, so dispatch a flat kernel in that case. It fires for
ggml_glu_split with packed operands; a fused [gate|up] tensor keeps the
strided path. test-backend-ops perf -o SWIGLU on an Arc Pro B70: split
+14% f16 and +4% f32, fused unchanged.
satindergrewal pushed a commit to satindergrewal/llama.cpp that referenced this pull request Aug 11, 2026
* tests: add SWIGLU perf cases

perf mode had no GLU coverage. Adds SWIGLU at 17408 columns, 512 and
2048 tokens, f16 and f32, with the operands both fused and split.

* sycl: consolidate fused-GLU kernels

They differed only in which op_* they called, so take the op as an argument and share a common launcher.
Their block sizes were all 256, so launch geometry is unchanged;
SYCL_GELU_BLOCK_SIZE and SYCL_SILU_BLOCK_SIZE lose their last users so are dropped.

* sycl: contiguous fast path for the fused GLU ops

o0 == n and o1 == n collapse the de-interleave index math to the
identity, so dispatch a flat kernel in that case. It fires for
ggml_glu_split with packed operands; a fused [gate|up] tensor keeps the
strided path. test-backend-ops perf -o SWIGLU on an Arc Pro B70: split
+14% f16 and +4% f32, fused unchanged.
satindergrewal pushed a commit to satindergrewal/llama.cpp that referenced this pull request Aug 12, 2026
* tests: add SWIGLU perf cases

perf mode had no GLU coverage. Adds SWIGLU at 17408 columns, 512 and
2048 tokens, f16 and f32, with the operands both fused and split.

* sycl: consolidate fused-GLU kernels

They differed only in which op_* they called, so take the op as an argument and share a common launcher.
Their block sizes were all 256, so launch geometry is unchanged;
SYCL_GELU_BLOCK_SIZE and SYCL_SILU_BLOCK_SIZE lose their last users so are dropped.

* sycl: contiguous fast path for the fused GLU ops

o0 == n and o1 == n collapse the de-interleave index math to the
identity, so dispatch a flat kernel in that case. It fires for
ggml_glu_split with packed operands; a fused [gate|up] tensor keeps the
strided path. test-backend-ops perf -o SWIGLU on an Arc Pro B70: split
+14% f16 and +4% f32, fused unchanged.
huaxel pushed a commit to huaxel/CachyLLama that referenced this pull request Aug 12, 2026
* tests: add SWIGLU perf cases

perf mode had no GLU coverage. Adds SWIGLU at 17408 columns, 512 and
2048 tokens, f16 and f32, with the operands both fused and split.

* sycl: consolidate fused-GLU kernels

They differed only in which op_* they called, so take the op as an argument and share a common launcher.
Their block sizes were all 256, so launch geometry is unchanged;
SYCL_GELU_BLOCK_SIZE and SYCL_SILU_BLOCK_SIZE lose their last users so are dropped.

* sycl: contiguous fast path for the fused GLU ops

o0 == n and o1 == n collapse the de-interleave index math to the
identity, so dispatch a flat kernel in that case. It fires for
ggml_glu_split with packed operands; a fused [gate|up] tensor keeps the
strided path. test-backend-ops perf -o SWIGLU on an Arc Pro B70: split
+14% f16 and +4% f32, fused unchanged.
brittlewis12 pushed a commit to brittlewis12/llama.cpp that referenced this pull request Aug 17, 2026
* tests: add SWIGLU perf cases

perf mode had no GLU coverage. Adds SWIGLU at 17408 columns, 512 and
2048 tokens, f16 and f32, with the operands both fused and split.

* sycl: consolidate fused-GLU kernels

They differed only in which op_* they called, so take the op as an argument and share a common launcher.
Their block sizes were all 256, so launch geometry is unchanged;
SYCL_GELU_BLOCK_SIZE and SYCL_SILU_BLOCK_SIZE lose their last users so are dropped.

* sycl: contiguous fast path for the fused GLU ops

o0 == n and o1 == n collapse the de-interleave index math to the
identity, so dispatch a flat kernel in that case. It fires for
ggml_glu_split with packed operands; a fused [gate|up] tensor keeps the
strided path. test-backend-ops perf -o SWIGLU on an Arc Pro B70: split
+14% f16 and +4% f32, fused unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge. SYCL https://en.wikipedia.org/wiki/SYCL - GPU programming language testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants