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.
We meet this issue when mearsure the decod performance with
llama-bench.Overview
On the NPU, the first graph that the backend computes decides how the static prefill/decode pair is built. When that graph has one token, the prefill model of the pair is built from it and padded to the prefill chunk size. With a MoE model, its translation fails:
llama-bench -p 0 -n N -d Dhits it at once: its generation warmup decodes one token into an empty context.llama-cli,llama-serverandllama-perplexitystart with a longer prompt and do not.build_moe_ffnreshapes the MUL_MAT_ID activations from[n_embd, n_tokens]to[n_embd, 1, n_tokens]. The decoder gives this RESHAPE case 1, which puts the tokens in dim 2. Buttranslate_reshapereturns its input unchanged when the ggml input and output shapes are the same, and with one token they are:[n_embd, 1, 1, 1]both. The static model pads that input to 128 tokens in dim 1, the reshape keeps them there, and MUL_MAT_ID gets[n_tokens, n_used, k] = [1, 128, 2048]instead of[128, 1, 2048]. With more than one token the shapes differ, the reshape runs, and the graph is correct.translate_reshapeno longer takes the same-shape shortcut for case 1. The reshape is then always[1, -1, 1, n_embd], which puts the padded tokens in dim 2.Additional information
PTL NPU, Windows, Qwen3.6-35B-A3B Q4_0 (MoE on the NPU needs PR 444),
GGML_OPENVINO_PREFILL_CHUNK_SIZE=128:llama-bench -fa 1 -p 0 -n 32 -d 1024-r 5)--no-warmupRequirements
YES, AI help analysis this issue.