Skip to content

sycl: parallelize the non-contiguous concat kernel#25852

Draft
Titaniumtown wants to merge 3 commits into
ggml-org:masterfrom
Titaniumtown:pr/sycl-concat-parallelize
Draft

sycl: parallelize the non-contiguous concat kernel#25852
Titaniumtown wants to merge 3 commits into
ggml-org:masterfrom
Titaniumtown:pr/sycl-concat-parallelize

Conversation

@Titaniumtown

@Titaniumtown Titaniumtown commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Overview

The non-contiguous concat kernel launched a single-lane work-group (1, 1, 1), this PR changes it so that it will launch a (1, 1, SYCL_CONCAT_BLOCK_SIZE) one that can better utilize the hardware instead of having single-width iteration loops.

llama-bench (Arc Pro B70, Qwen3.6-27B-UD-Q4_K_XL, -fa on, q8_0 KV), on top of upstream master: pp2048 920 -> 1006 t/s (+9.4%)

Additional information

Should the 256 value that is shared among a bunch of macros in ggml/src/ggml-sycl/presets.hpp be dynamically set similar to #25205? I am wondering what the performance impact of setting that to 128 on Intel Alchemist hardware would be? May be faster due to 128 being the native work-group size.

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES, used Claude Opus 4.8 + Claude Fable 5 in a general auto-research loop that identified potential optimizations with access to an Intel Arc B70 and profiling ability. I then used Opus 4.8 to help me understand the codebase and the context of the code and debug issues.

@Titaniumtown
Titaniumtown requested a review from a team as a code owner July 18, 2026 04:37
@github-actions github-actions Bot added ggml changes relating to the ggml tensor library for machine learning SYCL https://en.wikipedia.org/wiki/SYCL - GPU programming language labels Jul 18, 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.

For Qwen3.6-27B-UD-Q5_K_XL-MTP.gguf on B60.
I find the performance is reduced.
Through the LLM is not the target of this PR, it won't be impacted negative.

Test fa Base t/s Primary t/s Increase Rate (Primary vs Base)
pp512 0 44.87 41.28 -8.00%
pp512 1 41.29 38.04 -7.87%
tg128 0 2.75 2.49 -9.45%
tg128 1 2.77 2.50 -9.75%

Of course, I will test with Qwen3.6-27B-UD-Q4_K_XL.gguf.
Could you share the whole cmd to show the benefit of this PR?

Launch geometry only: the non-contiguous concat kernel launched a single-lane
work-group (1, 1, 1), now it will launch a (1, 1, SYCL_CONCAT_BLOCK_SIZE) one.

SYCL_CONCAT_BLOCK_SIZE is defined in `ggml/src/ggml-sycl/presets.hpp`.

llama-bench (Arc Pro B70, Qwen3.6-27B-UD-Q4_K_XL, -fa on, q8_0 KV),
on top of upstream master: pp2048 920 -> 1006 t/s (+9.4%)
@Titaniumtown
Titaniumtown force-pushed the pr/sycl-concat-parallelize branch from 0553bf6 to e792674 Compare July 19, 2026 19:37
@Titaniumtown

Copy link
Copy Markdown
Contributor Author

@arthw It seems that you are offloading the model to system memory? Your tg128 is super low!

The command I used to get benchmarks was: llama-bench -m Qwen3.6-27B-UD-Q4_K_XL.gguf -fa 1 -ctk q8_0 -ctv q8_0 -p 512,2048 -n 128

I do not have a B60 to test, and I cannot repro the regression on my hardware. I believe it is due to oversubscribing the hardware when there isn't enough elements to fill up SYCL_CONCAT_BLOCK_SIZE. I just pushed a commit that may address your issue.

@arthw

arthw commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

With the latest update in the PR and Qwen3.6-27B-UD-Q4_K_XL.gguf on B60.
I got the following perf data.

./build/bin/llama-bench -m ../models/Qwen3.6-27B-UD-Q4_K_XL.gguf -fa 0,1

Test fa Base t/s Primary t/s Increase Rate (Primary vs Base)
pp512 0 48.79 42.55 -12.79%
pp512 1 44.82 39.09 -12.78%
tg128 0 3.30 2.83 -14.24%
tg128 1 3.32 2.85 -14.16%

./build/bin/llama-bench -m ../models/Qwen3.6-27B-UD-Q4_K_XL.gguf -fa 1 -ctk q8_0 -ctv q8_0 -p 512,2048 -n 128
I got following perf data change on B60:
P512: +4%
P2048 +3.6%
tg128 +1.8%.

A good performance optimization shouldn't reduce other cases' perf when increase the target case.

Please check it!

Thank you!

@Titaniumtown
Titaniumtown marked this pull request as draft July 20, 2026 13:03
@Titaniumtown

Copy link
Copy Markdown
Contributor Author

@arthw I still cannot reproduce the performance regression on my hardware. Could you try different values of this new environment variable I added: GGML_SYCL_CONCAT_BLOCK_SIZE, like 1, 128, 256 ? and see what those are? I have been tinkering and unable to reproduce anything you have shown.

@arthw

arthw commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@Titaniumtown
Yes, I will test and feedback.

What's your GPU and driver version?

lspci -nnk | grep -i vga -A3
dpkg -l | grep libze-intel-gpu1

@Titaniumtown

Titaniumtown commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

I'm on kernel 7.0.14 on NixOS

GPU: Intel Arc Pro B70 Graphics: PCI 8086:E223 (subsys 8086:1701)
intel-compute-runtime (aka libze-intel-gpu1): 26.18.38308.1
IGC: 2.34.4

@arthw

arthw commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@Titaniumtown
OK, your GPU driver should be OK.

Here is the test result on B60 with Qwen3.6-27B-UD-Q4_K_XL.gguf
All cases show increase perf.

case 1

Base:

./build/bin/llama-bench -m ..//models/Qwen3.6-27B-UD-Q4_K_XL.gguf -fa 1 -ctk q8_0 -ctv q8_0 -p 512,2048 -n 128

model size params backend ngl type_k type_v fa test t/s
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 q8_0 q8_0 1 pp512 183.55 ± 0.03
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 q8_0 q8_0 1 pp2048 179.63 ± 0.00
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 q8_0 q8_0 1 tg128 16.64 ± 0.01

PR:
export GGML_SYCL_CONCAT_BLOCK_SIZE=1

model size params backend ngl type_k type_v fa test t/s
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 q8_0 q8_0 1 pp512 188.80 ± 0.05
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 q8_0 q8_0 1 pp2048 184.70 ± 0.02
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 q8_0 q8_0 1 tg128 16.64 ± 0.00

build: 2709909 (10068)

export GGML_SYCL_CONCAT_BLOCK_SIZE=128

model size params backend ngl type_k type_v fa test t/s
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 q8_0 q8_0 1 pp512 188.97 ± 0.01
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 q8_0 q8_0 1 pp2048 184.84 ± 0.01
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 q8_0 q8_0 1 tg128 16.64 ± 0.00

build: 2709909 (10068)

export GGML_SYCL_CONCAT_BLOCK_SIZE=256

model size params backend ngl type_k type_v fa test t/s
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 q8_0 q8_0 1 pp512 188.94 ± 0.04
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 q8_0 q8_0 1 pp2048 184.78 ± 0.01
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 q8_0 q8_0 1 tg128 16.64 ± 0.01

case 2

./build/bin/llama-bench -m ..//models/Qwen3.6-27B-UD-Q4_K_XL.gguf -fa 1

base

model size params backend ngl fa test t/s
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 1 pp512 187.08 ± 0.02
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 1 tg128 16.89 ± 0.01

PR:
export GGML_SYCL_CONCAT_BLOCK_SIZE=1

model size params backend ngl fa test t/s
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 1 pp512 192.61 ± 0.06
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 1 tg128 16.89 ± 0.01

build: 2709909 (10068)

export GGML_SYCL_CONCAT_BLOCK_SIZE=128

model size params backend ngl fa test t/s
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 1 pp512 192.74 ± 0.06
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 1 tg128 16.86 ± 0.01

build: 2709909 (10068)

export GGML_SYCL_CONCAT_BLOCK_SIZE=256

model size params backend ngl fa test t/s
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 1 pp512 192.67 ± 0.03
qwen35 27B Q4_K - Medium 16.39 GiB 26.90 B SYCL -1 1 tg128 16.89 ± 0.01

@Titaniumtown

Copy link
Copy Markdown
Contributor Author

@arthw so your performance regression went away? Interesting. Maybe was transient?

@arthw

arthw commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Yes, the latest code increase the performance in the test.

@Titaniumtown

Copy link
Copy Markdown
Contributor Author

Glad to hear it! Let me know if there's anything else I can do for this PR!

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 SYCL https://en.wikipedia.org/wiki/SYCL - GPU programming language

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants