Skip to content

model : fix k-pool indexer softmax gridDim.y overflow - #11

Open
AIalliAI wants to merge 2 commits into
timkhronos:GLM5.3-Flashfrom
AIalliAI:fix/glm5-kpool-softmax-grid-y
Open

model : fix k-pool indexer softmax gridDim.y overflow#11
AIalliAI wants to merge 2 commits into
timkhronos:GLM5.3-Flashfrom
AIalliAI:fix/glm5-kpool-softmax-grid-y

Conversation

@AIalliAI

@AIalliAI AIalliAI commented Sep 11, 2026

Copy link
Copy Markdown

Overview

Reshape k-pool gate logits before ggml_soft_max so n_new does not map to gridDim.y, which is capped at 65535 on CUDA. During k-pool indexer prefill at n_kv >= 262144, the gate softmax is shaped [kpool, head_dim, n_new] and trips the launch at kpool = 4.

Reshape to [kpool, head_dim * n_new] before softmax, reshape back after. Same pattern as the comment in qwen4exp.cpp.

Stacked on ggml-org#27773.

Additional information

Related: ggml-org#27754, unslothai#214, ggml-org#27901, ggml-org#28175. Separate from #9 (tensor naming).

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES - assisted implementation and review; I understand the change and can maintain it.

Reshape the k-pool gate logits before softmax so n_new does not map to
gridDim.y, which is capped at 65535 on CUDA. Fixes prompt processing
abort at n_kv >= 262144 reported in ggml-org#27773.

Assisted-by: Cursor
@AIalliAI

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant