vllm.models.minimax_m3.common.indexer ¶
MiniMax M3 lightning indexer: side cache, metadata, and impl.
The indexer scores KV blocks with the index heads and selects the top-k blocks (plus fixed init/local blocks) that the main block-sparse attention (sparse_attention.py) then attends to. It owns its own side cache (MiniMaxM3IndexerCache, one index-key vector per token), metadata, and metadata builder, mirroring how DeepSeek V4 keeps the indexer separate from the main attention.
MiniMaxM3Indexer is the nn.Module the attention layer holds (like DeepseekV4Indexer); it picks a kernel impl in __init__ (via select_indexer_impl_cls) and delegates forward to it.
Classes:
-
MiniMaxM3Indexer–Indexer module held by the attention layer (like
DeepseekV4Indexer). -
MiniMaxM3IndexerBackend–Indexer side-cache backend (key-only).
-
MiniMaxM3IndexerCache–Side KV cache for the indexer's per-token index keys (key-only).
-
MiniMaxM3IndexerDecodeMetadata–Per-decode state (cudagraph-safe).
decode_query_lenis the uniform -
MiniMaxM3IndexerImpl–Abstract base for the indexer kernel impls.
-
MiniMaxM3IndexerMetadata–Indexer metadata, split into prefill and decode sub-metadata.
-
MiniMaxM3IndexerMetadataBuilder–Abstract base: shared setup only. The Triton and MSA builders are
-
MiniMaxM3IndexerPrefillMetadata–Per-prefill index-scoring state.
-
MiniMaxM3IndexerTritonImpl–Triton indexer score + top-k for both prefill and decode.
-
MiniMaxM3IndexerTritonMetadataBuilder–Triton indexer metadata: no SM100 fmha_sm100 plan.
Functions:
-
select_indexer_impl_cls–Pick the indexer impl off the platform, top-k count, and cache dtype.
MiniMaxM3Indexer ¶
Bases: Module
Indexer module held by the attention layer (like DeepseekV4Indexer).
Picks the kernel impl in __init__ (select_indexer_impl_cls) and delegates forward; exposes the impl's side cache via index_cache.
Source code in vllm/models/minimax_m3/common/indexer.py
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 | |
MiniMaxM3IndexerBackend ¶
Bases: AttentionBackend
Indexer side-cache backend (key-only).
Source code in vllm/models/minimax_m3/common/indexer.py
MiniMaxM3IndexerCache ¶
Bases: Module, AttentionLayerBase
Side KV cache for the indexer's per-token index keys (key-only).
Registers itself in the static forward context so the KV-cache manager allocates it (like DeepseekV32IndexerCache).
Source code in vllm/models/minimax_m3/common/indexer.py
MiniMaxM3IndexerDecodeMetadata dataclass ¶
Per-decode state (cudagraph-safe). decode_query_len is the uniform per-request query length (1, or 1 + num_speculative_tokens).
Source code in vllm/models/minimax_m3/common/indexer.py
MiniMaxM3IndexerImpl ¶
Bases: Module
Abstract base for the indexer kernel impls.
Each impl owns its side cache and reports its backend via indexer_backend_cls (so each gets its own builder). The Triton and MSA subclasses each own a full forward returning (decode_topk, prefill_topk) -- no shared forward code.
Methods:
-
forward–Return
(decode_topk, prefill_topk); implemented per kernel impl.
Source code in vllm/models/minimax_m3/common/indexer.py
forward(index_query) ¶
Return (decode_topk, prefill_topk); implemented per kernel impl.
MiniMaxM3IndexerMetadata dataclass ¶
Bases: AttentionMetadata
Indexer metadata, split into prefill and decode sub-metadata.
Source code in vllm/models/minimax_m3/common/indexer.py
MiniMaxM3IndexerMetadataBuilder ¶
Bases: AttentionMetadataBuilder[MiniMaxM3IndexerMetadata]
Abstract base: shared setup only. The Triton and MSA builders are parallel subclasses that each own their full build (no shared code).
Source code in vllm/models/minimax_m3/common/indexer.py
MiniMaxM3IndexerPrefillMetadata dataclass ¶
Per-prefill index-scoring state.
Source code in vllm/models/minimax_m3/common/indexer.py
MiniMaxM3IndexerTritonImpl ¶
Bases: MiniMaxM3IndexerImpl
Triton indexer score + top-k for both prefill and decode.
Source code in vllm/models/minimax_m3/common/indexer.py
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | |
MiniMaxM3IndexerTritonMetadataBuilder ¶
Bases: MiniMaxM3IndexerMetadataBuilder
Triton indexer metadata: no SM100 fmha_sm100 plan.
Source code in vllm/models/minimax_m3/common/indexer.py
select_indexer_impl_cls(*, topk_blocks, indexer_kv_dtype='bf16') ¶
Pick the indexer impl off the platform, top-k count, and cache dtype.
On Blackwell (SM100) with topk_blocks == 16 (the only width fmha_sm100's sparse_topk_select kernel supports), the fmha_sm100 score + top-k path is used for both bf16 and fp8 index caches. Everything else falls back to the Triton indexer (bf16 only).