vllm.models.kimi_k3.nvidia.index_rope
¶
Triton RoPE for the Kimi K3.1 DSA indexer.
Applies rope to the leading rope_dim dims of each indexer head, using the
leading rope_dim // 2 frequencies sliced from the main attention's
cos_sin_cache (training reuses the leading freqs of the main freqs_cis for
the indexer). Compute is fp32 with a cast back to the input dtype.
dim >= rope_dim is left untouched (in-place).
Two pairing layouts (same frequencies, different dim pairing): * neox half-split (interleave=False, default): dim i pairs with dim i+half; * GPT-J interleave (interleave=True, GLM native weight layout): dim 2i pairs with dim 2i+1, cos/sin broadcast per pair.
Functions:
-
index_rope–In-place RoPE on the leading rope_dim dims of each indexer head.
index_rope(index_q, index_k, positions, cos_sin_cache, rope_dim, interleave)
¶
In-place RoPE on the leading rope_dim dims of each indexer head.
fp32 compute, neox half-split / GPT-J interleaved pairing; dims >= rope_dim are untouched, q/k done in a single launch. Replaces the former handwritten torch composition (~20 small kernels in eager).