Repository navigation
Conversation
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
Cont #29344 (mentioned about ssm_out MUL_MAT). Flatten 3d src1/dst (original use HVX
MATMUL_4D_REPACKED_IMPL) into 2d to use HMX, which is faster on n_seqs > 1. If the rows of dims 1..3 can be walked with one stride and src0 not batched, the flattening is possible.Based on my investigation, models like
lfm2.cpp,mamba-base.cpp(mamba, jamba build_mamba_layer),qwen35|qwen3next|qwen35moe|qwen4exp.cpp(ssm_out),plamo2.cppwill cover the path. (or maybeminimax-01.cppand more)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 MUL_MAT time with a batched src1 (GGML_HEXAGON_PROFILE=1, npl 2, one run)
2048:2048 x 2048:128:2:1 -> 2048:128:2:12048:2048 x 2048:1:2:1 -> 2048:1:2:12048:6144 x 2048:128:2:1 -> 6144:128:2:12048:2048 x 2048:128:2:1 -> 2048:128:2:12048:6144 x 2048:1:2:1 -> 6144:1:2:12048:2048 x 2048:1:2:1 -> 2048:1:2:1Requirements