mirror of
https://github.com/kvcache-ai/sglang.git
synced 2026-11-05 01:07:39 +00:00
[PR #68] fix(moe): sm_120 topk_sigmoid writes only 1408 rows of topk_weights — pure-torch routing fallback #67
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/sglang#67
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/sglang/pull/68
Author: @architehc
Created: 7/23/2026
Status: 🔄 Open
Base:
main← Head:sm120-topk-sigmoid-row-truncation📝 Commits (1)
994dab4fix(moe): pure-torch sigmoid routing fallback for sm_120 topk_sigmoid row truncation📊 Changes
1 file changed (+20 additions, -10 deletions)
View changed files
📝
python/sglang/srt/layers/moe/topk.py(+20 -10)📄 Description
Bug
`sgl_kernel.topk_sigmoid` (0.3.21) on sm_120 (RTX PRO 6000 Blackwell Workstation) writes `topk_weights` for only the first 1408 rows — `topk_ids` are fully written, so tail rows silently consume stale allocator memory as routing weights. Because the same-size buffer is recycled every layer, tail rows first reuse the previous layer's weights (finite → subtle quality degradation), then produce NaNs once poisoned memory rotates in (presents as `!!!!` output in long prefills).
Standalone kernel tests pass because fresh zero pages mask the unwritten rows; we reproduced the corruption byte-exact by pre-poisoning the output buffers before the call.
Fix
The real fix belongs in the sgl_kernel CUDA kernel's row coverage; this makes sglang correct on sm_120 meanwhile.
Validated serving GLM-5.2 at up to 1M context on the RTX PRO 6000 (full write-up: https://github.com/architehc/blackwell_ktransformers).
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.