ucm layerwise support MiniMax-m3 - #1090
Open
snoopyri wants to merge 1 commit into
Open
Conversation
snoopyri
requested review from
FangRun2,
Infinite666,
Tarrei,
harrisonyhq,
mag1c-h,
qyh111 and
ygwpz
as code owners
July 13, 2026 03:44
snoopyri
force-pushed
the
feat/minimax-m3-model-adaptation
branch
4 times, most recently
from
July 20, 2026 00:56
883a1db to
680d33e
Compare
snoopyri
force-pushed
the
feat/minimax-m3-model-adaptation
branch
6 times, most recently
from
July 24, 2026 07:15
69e1230 to
3c96fbe
Compare
snoopyri
force-pushed
the
feat/minimax-m3-model-adaptation
branch
from
July 25, 2026 01:03
3c96fbe to
de18b42
Compare
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.
Purpose
Add layerwise KV-cache support for MiniMax-M3 on Ascend, whose dense and sparse layers use heterogeneous K/V cache layouts. Ensure transfer paths can safely handle padding entries introduced by the unified layout.
Modifications
Modifications
Detect MiniMax-M3 sparse-attention models and select a dedicated AscendMiniMaxM3Layout when running on Ascend with layerwise transfer enabled.
Add AscendMiniMaxM3Layout to normalize per-layer KV cache layouts into three logical components:
Validate KV tensor types, shapes, and strides before constructing the layout.
Preserve per-component base addresses, buffer sizes, copy sizes, and physical block strides for correct layerwise addressing.
Update generic stream and Ascend SDMA-direct transfer paths to skip null/zero-sized device buffers.
Zero-fill host-side padding regions during device-to-host transfers, ensuring deterministic serialized cache blocks for dense-layer padding.
Test