Skip to content

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

Closed
AIalliAI wants to merge 1 commit into
timkhronos:GLM5.3-Flashfrom
AIalliAI:fix/glm5-kpool-softmax-grid-y
Closed

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

Conversation

@AIalliAI

Copy link
Copy Markdown

Overview

Fixes CUDA SOFT_MAX crash during k-pool indexer prefill at n_kv >= 262144, reported in ggml-org#27773.

Additional information

The k-pool gate softmax builds [kpool, head_dim, n_new]. CUDA maps ne[2] to gridDim.y (65535 cap). At 262k context with kpool=4, n_new hits 65536 and the launch fails.

Reshape logits to [kpool, head_dim * n_new] before softmax, then reshape probs back. Same idea as the block-count reshape in qwen4exp.cpp for the rms_norm gridDim.y cap.

Related sibling issue for the same 262144 threshold: ggml-org#27901 (rms_norm in norm.cu). Fix there is tracked in ggml-org#28175 / ggml-org#28039.

CC @timkhronos @ggerganov @CISC @ngxson

Requirements

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

Closing - pursuing local Strix Halo testing instead.

@AIalliAI AIalliAI closed this Sep 11, 2026
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