Skip to content

Repin GLM-5-Next onto the head carrying the indexer softmax fix - #217

Merged
danielhanchen merged 1 commit into
masterfrom
repin-27754-softmax
Sep 16, 2026
Merged

danielhanchen merged 1 commit into
masterfrom
repin-27754-softmax

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Why

#214 merged into glm5next/upstream after #216 was cut, so the pin that #216 landed (e2738e07) is now one commit behind the PR head. It still merges, but it ships without the indexer softmax fix.

86ebfef2 is #214 squashed on top of e2738e07. It reshapes the k-pool gate logits to 2D before ggml_soft_max, so n_new_max no longer maps to gridDim.y:

ggml_tensor * probs = ggml_soft_max(ctx0, ggml_reshape_2d(ctx0, gate_t, r, d_idx*n_new_max*n_stream));
probs = ggml_reshape_4d(ctx0, probs, r, d_idx, n_new_max, n_stream);

ggml-cuda/softmax.cu launches with block_nums(ne01, ne02, ne03) and CUDA caps gridDim.y at 65535, so at n_kv >= 262144 with kpool = 4 the launch was rejected outright.

Verified

Reproduced the crash and the fix on a B200 with a standalone ggml program, no weights:

case ne2 result
unpatched control 65535 SUCCESS
unpatched 65538 SOFT_MAX failed / CUDA error: invalid argument
with the fix 65538 SUCCESS

Softmax is row-wise over ne0 and the reshape leaves ne0 alone, so the values are unchanged: max abs diff between the control row and the fixed row is 0.0, both rows sum to 1.0.

Replayed the resolve merge loop from unsloth-prebuilt.yml on b10994, the tag tonight's run selects:

  • 11 pins merge clean, 2 resolved by additive_merge.py, 0 hard fails
  • merge_checks.py clean
  • pin_contract.py: all 13 pins intact in the merged tree
  • compile gate (llama + mtmd) passed
  • test-llama-archs: 316 rows, 0 failures

Only the pin line changes.

#214 landed on glm5next/upstream after #216 was cut, so e2738e0 is no
longer the head. 86ebfef is that squash on top of it: the k-pool gate logits are
reshaped to 2D before ggml_soft_max so n_new_max stops mapping to gridDim.y,
which CUDA caps at 65535 and which aborted the launch at n_kv >= 262144 with
kpool = 4.

Replayed the resolve loop on b10994 with the new pin: 11 clean, 2 additive, 0
hard fails; merge_checks clean, all 13 pins intact, llama + mtmd compile gate
passed, test-llama-archs 316 rows 0 failures.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-16T13:51:47.479190Z d40e5f6 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen
danielhanchen merged commit b1dd493 into master Sep 16, 2026
0 of 5 checks passed
@danielhanchen
danielhanchen deleted the repin-27754-softmax branch September 16, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant