Expand description
2026-09-25: Host launch of the Kimi K3 MLA decode kernels (PTX module MODULE) for one token.
Two launches per token: ROPE_ENTRY rotates the rope slice of q and k
(it returns without rotating when mla_use_nope is set), then
SDPA_ENTRY attends over the cached KV and applies the sigmoid output
gate when mla_use_output_gate is set. The CPU reference is
mla_decode_token.
Decode uses launch_k3_mla_decode_token_on_device unless K3_CUDA_MLA=0.
Owner: model-arch, Kimi K3. Invariants:
- Every temporary device buffer a launch allocates gets a
freecall before it returns, on success and on error; a failedfreeis ignored. MlaDeviceKv::allocandMlaDeviceKv::alloc_and_upload, when they fail, callfreeon what they allocated, ignoring a failedfree.
Structs§
- K3Mla
Decode Kernels - MlaDevice
Kv - 2026-09-25: One sequence’s MLA K and V on the device, allocated for
captokens. A decode token appends one row (K device to device after rope, V from the host) and attention reads the buffers in place;downloadcopies the history to a hostMlaKv.
Constants§
- MODULE
- 2026-09-25: Built from
kernels/gb10/kimi-k3/bf16/mla_decode.cu. - ROPE_
ENTRY - SDPA_
ENTRY
Functions§
- launch_
k3_ mla_ decode_ token - 2026-09-25: One decode token against a host
MlaKv: writes the ropedq/kback, appends tokv, and uploads the whole KV history. - launch_
k3_ mla_ decode_ token_ on_ device - 2026-09-25: One decode token against an
MlaDeviceKv: rope stays on the device, the append is one row, and only the output is copied back.