vllm.models.kimi_k3.nvidia.low_latency_gemm ¶
Kimi-K3 decode GEMM selection for unquantized BF16 on SM90/SM100/SM103/SM107.
Dispatch is purely by local (N, K) shape and token count M — the module name plays no role. Each measured shape maps to a :class:ProjectionSpec holding the winning backend per token count. The static part of the decision is resolved once per module at install time into a small {M: call} plan, so the per-forward path is a single dict lookup.
The supported capabilities carry separate measured tables: :data:KIMI_K3_PROJECTIONS was tuned on B300 (SM103), :data:KIMI_K3_PROJECTIONS_SM100 on B200 (SM100), and :data:KIMI_K3_PROJECTIONS_SM90 on H200 (SM90). The per-(shape, M) winners genuinely differ between the parts, so the tables must not be merged. SM107 (Rubin) reuses the SM103 table: the plan was validated end-to-end on SM107 hardware, but the per-M crossovers have not been re-measured there and may deserve their own table once retuned.
Functions:
-
autotune_kda_qkvg–Autotune the FlashInfer QKVG GEMM before CUDA graph capture.
-
enable_kimi_k3_low_latency_gemm–Install shape-selected low-latency GEMMs and register CuTe warmups.
-
run_kda_projection_overlap–Run the TP8 KDA decode projection branches concurrently.
-
select_kimi_k3_backend–Backend for a local
(N, K)atnum_tokens, or None to fall back. -
try_low_latency_gemm–Run the shape-selected low-latency kernel, or None to fall back.
_KimiK3LowLatencyApply ¶
Mixin: try the precomputed plan, else defer to the base method.
Source code in vllm/models/kimi_k3/nvidia/low_latency_gemm.py
_low_latency_table() ¶
Measured dispatch table for the current device, or None if unsupported.
Source code in vllm/models/kimi_k3/nvidia/low_latency_gemm.py
autotune_kda_qkvg(model) ¶
Autotune the FlashInfer QKVG GEMM before CUDA graph capture.
Source code in vllm/models/kimi_k3/nvidia/low_latency_gemm.py
enable_kimi_k3_low_latency_gemm(module, dtype) ¶
Install shape-selected low-latency GEMMs and register CuTe warmups.
Modules are matched purely by type, an exactly-unquantized method, and a local (N, K) present in the current device's measured table (:data:KIMI_K3_PROJECTIONS on SM103, :data:KIMI_K3_PROJECTIONS_SM100 on SM100, :data:KIMI_K3_PROJECTIONS_SM90 on SM90).
Source code in vllm/models/kimi_k3/nvidia/low_latency_gemm.py
978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 | |
run_kda_projection_overlap(hidden_states, packed_weight, f_b_weight, aux_stream, events) ¶
Run the TP8 KDA decode projection branches concurrently.
Parameters:
-
(hidden_states¶Tensor) –Packed BF16 input with shape
[M, 7168]. -
(packed_weight¶Tensor) –Existing Q/K/V/G/F_A/beta/pad weight with shape
[6288, 7168]. -
(f_b_weight¶Tensor) –F_B weight with shape
[1536, 128]. -
(aux_stream¶Stream) –Stream for the F_A/beta then F_B branch.
-
(events¶tuple[Event, Event]) –Start and completion events for the stream fork and join.
Returns:
Source code in vllm/models/kimi_k3/nvidia/low_latency_gemm.py
719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 | |
select_kimi_k3_backend(num_tokens, n, k, *, has_residual=False) ¶
Backend for a local (N, K) at num_tokens, or None to fall back.
Source code in vllm/models/kimi_k3/nvidia/low_latency_gemm.py
try_low_latency_gemm(x, weight, residual=None) ¶
Run the shape-selected low-latency kernel, or None to fall back.
Resolves the plan from the shape table on each call; production installs a precomputed plan (see :func:enable_kimi_k3_low_latency_gemm) and does not use this path.