Repository navigation
hexagon: handle multi-sequence in concat_2d - #29344
Merged
max-krasnyansky merged 1 commit intoSep 24, 2026
Merged
Conversation
max-krasnyansky
approved these changes
Sep 24, 2026
Member
|
@lhez please review/ack |
lhez
approved these changes
Sep 24, 2026
1 task
frostyautumnleaf
pushed a commit
to frostyautumnleaf/llama.cpp
that referenced
this pull request
Oct 5, 2026
edwardyoon
pushed a commit
to edwardyoon/focus-llama
that referenced
this pull request
Oct 7, 2026
(cherry picked from commit a02c7f5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Currently the
op_concatin ggml-hexagon will fallback from 2d transposed to generic path when n_seqs greater than 1, especially in qwen35.cpp, which it will be slower than the fast path on PP. (See the CONCAT numbers in Additional information)Since each plane is an independent 2D transposed concat, we should be able to iterate them instead of falling back to generic.
Additional information
Test on IQ-9075, run two models (that cover the path) with
llama-batched-bench --device HTP0:0 -ngl 99 -fa on -t 6 --cpu-mask 0xfc -c 4096 -b 512 -ub 256 -npp 128 -ntg 32 -npl 1,2,4:Per-call CONCAT time (GGML_HEXAGON_PROFILE=1, one run per npl)
3:8192 x 256:8192 -> 259:81923:8192 x 1:8192 -> 4:81923:8192:2:1 x 128:8192:2:1 -> 131:8192:2:13:8192:2:1 x 1:8192:2:1 -> 4:8192:2:13:8192:4:1 x 64:8192:4:1 -> 67:8192:4:13:8192:4:1 x 1:8192:4:1 -> 4:8192:4:13:4352 x 256:4352 -> 259:43523:4352 x 1:4352 -> 4:43523:4352:2:1 x 128:4352:2:1 -> 131:4352:2:13:4352:2:1 x 1:4352:2:1 -> 4:4352:2:13:4354352:4:13:43552:4:1The remaining gap I found for qwen35 so far is ssm_out MUL_MAT. In #29197, it uses MATMUL_4D_REPACKED_IMPL instead of falling back to CPU. In my experiments, flatten to 2D and use HMX could be more faster.
Requirements