vllm.models.kimi_k3.nvidia.kv_balanced_mla.helpers
¶
Classes:
-
MLAStaticTileScheduler– -
MLAStaticTileSchedulerParams– -
MLAWorkListTileScheduler–Persistent tile scheduler over a device work list (added for the Kimi K3
Functions:
-
compute_q_tile_layout–Return total rows, tile count and valid rows in the final query tile.
-
get_mla_decode_arch–Return the CuTe architecture name for a supported MLA decode device.
-
get_mla_decode_fold_sq_factor–Return the largest query-token fold factor that exactly divides seq_len_q.
-
select_mla_decode_tilers–Select decode MMA tile shapes from runtime head/q_len configuration.
MLAStaticTileScheduler
¶
Methods:
-
__init__–The static tile scheduler for MLA split kv kernel.
Source code in vllm/models/kimi_k3/nvidia/kv_balanced_mla/helpers.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | |
__init__(params, current_work_linear_idx, blk_coord, grid_shape, *, is_valid=True, loc=None, ip=None)
¶
The static tile scheduler for MLA split kv kernel.
Based on is_persistent, it provides 2 modes for use:
- Persistent mode: Launch fixed blocks and reschedule the data blocks.
- Non-persistent mode: Launch dynamic blocks and exit when the current work is done.
:param params: The static tile scheduler parameters :type params: MLAStaticTileSchedulerParams :param current_work_linear_idx: The linear index of the current work :type current_work_linear_idx: cutlass.Int32 :param blk_coord: The coordinate of the current work :type blk_coord: cute.Coord :param grid_shape: The shape of the grid :type grid_shape: cute.Shape :param is_valid: Whether the current work is valid :type is_valid: bool
Source code in vllm/models/kimi_k3/nvidia/kv_balanced_mla/helpers.py
MLAStaticTileSchedulerParams
¶
Methods:
-
__init__–The static tile scheduler parameters prepared for MLA static tile scheduler.
Source code in vllm/models/kimi_k3/nvidia/kv_balanced_mla/helpers.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
__init__(is_persistent, problem_shape_b, problem_shape_s, cluster_shape_mnk, split_kv, *, problem_shape_b_fdd=None, problem_shape_s_fdd=None, split_kv_fdd=None, loc=None, ip=None)
¶
The static tile scheduler parameters prepared for MLA static tile scheduler.
:param is_persistent: Whether to use persistent kernel mode :type is_persistent: bool :param problem_shape_b: The shape of the problem :type problem_shape_b: cute.Int32 :param problem_shape_s: The shape of the problem in sequence length Q dimension :type problem_shape_s: cute.Int32 :param cluster_shape_mnk: The shape of the cluster :type cluster_shape_mnk: cute.Shape :param split_kv: The scalar factor for split KV
Source code in vllm/models/kimi_k3/nvidia/kv_balanced_mla/helpers.py
MLAWorkListTileScheduler
¶
Persistent tile scheduler over a device work list (added for the Kimi K3
KV-balanced MLA decode). CTA i of the grid walks clusters i // cluster,
then every grid / cluster further; entry c of the list is
(q_tile * B + batch) << 8 | split, or < 0. The valid entries are a prefix
followed by at least one wave of negative entries, so every walk ends inside
the list.
Source code in vllm/models/kimi_k3/nvidia/kv_balanced_mla/helpers.py
compute_q_tile_layout(num_heads, seq_len_q, m_tile)
¶
Return total rows, tile count and valid rows in the final query tile.
num_heads is the positive head count per query, seq_len_q is the
positive query length, and m_tile is the positive MMA row capacity.
Heads must fit within one MMA tile. Following FlashInfer PR #4178,
consecutive rows represent query_token * num_heads + head and may
cross query boundaries. The returned tail is in [1, m_tile].
Source code in vllm/models/kimi_k3/nvidia/kv_balanced_mla/helpers.py
get_mla_decode_arch(compute_capability)
¶
Return the CuTe architecture name for a supported MLA decode device.
Source code in vllm/models/kimi_k3/nvidia/kv_balanced_mla/helpers.py
get_mla_decode_fold_sq_factor(num_heads, seq_len_q, mma_m_tile=128)
¶
Return the largest query-token fold factor that exactly divides seq_len_q.
Source code in vllm/models/kimi_k3/nvidia/kv_balanced_mla/helpers.py
select_mla_decode_tilers(num_heads, seq_len_q, *, is_fp8, compute_capability)
¶
Select decode MMA tile shapes from runtime head/q_len configuration.
FP16/BF16 path currently supports only M=128 kernels. FP8 path supports an additional M=64 kernel family on SM100 for the tuned H=16, S_q=4 decode shape.