vllm.models.deepseek_v41.nvidia.specialized_decode.attention.mxfp8
¶
MXFP8 attention projections.
At up to LOW_BATCH_MAX_ROWS rows the executor runs fused_wqa_wkv,
wq_b and wo_b on FlashInfer mm_mxfp8 with its
cutedsl_low_latency backend whenever their input is already MXFP8; the
stock layers keep cute-dsl. Both backends read the same weights, weight
scales and F8_128x4 activation scales.
The backend's tactics are close when tuned in isolation, but split-K tactics are slower inside the back-to-back PDL chain of a decode step, so the 5-8-row bucket of the GB300 TP4 shapes is tuned over one pinned tactic.
Up to WIDE_LOW_LATENCY_MAX_ROWS rows the GB300 TP4 shapes keep the
low-latency kernel, which the backend's runner offers only with an 8-row
activation tile: this module compiles FlashInfer's kernel class itself with a
16-, 32- or 48-row tile and a fixed tactic per tile. The kernel loads the
weights before its programmatic grid wait and lets its dependents launch once
its weight loads are issued, so in the PDL chain of a decode step the weight
read overlaps the previous kernel; cute-dsl waits before any load.
Above that, the projections stay on cute-dsl, whose tuner picks a tactic
per power-of-two row bucket at every server start. Timed in isolation the
candidates are close, so the pick varies from start to start, and inside a
decode step one start's pick can be much slower than another's. The GB300
TP4 shapes therefore run a fixed tactic per row range, chosen in the chain of
the three projections, and skip the tuner.
Functions:
-
compile_low_latency–gemm, a FlashInferLowLatencyBlockscaledGemmKernelwith a -
compile_pinned–Compile
linear's pinnedcute-dsltactics, each at the largest -
launch_low_latency–Launch a compiled low-latency GEMM on the current stream:
out= -
low_latency_mm–layer's GEMM ofxoncutedsl_low_latencyfor an eligible -
mxfp8_eligible–Whether
layeris acute-dslMXFP8 linear whose weights the -
mxfp8_mm–layer's GEMM oncutedsl_low_latency. -
pinned_mm–layer'scute-dslGEMM ofxwith the pinned tactic of its -
pinned_tactics–Offer FlashInfer's tuner only the pinned tactic for pinned problems. The
-
projection_mm–An eligible
layer's GEMM ofx: oncutedsl_low_latencyin a -
run_zeros–Call
linearoncutedsl_low_latencyon a zero input. -
shape_representatives–One eligible linear per distinct (N, K), in a rank-independent order.
-
wide_mm–layer's low-latency GEMM ofxwith a wide activation tile, -
wide_or_pinned_mm–An eligible
layer's GEMM ofxaboveLOW_BATCH_MAX_ROWS -
wide_tactic–(activation tile, tactic) of the wide low-latency GEMM of an (N, K)
_cute_dsl_runner(out_dtype)
cached
¶
mm_mxfp8's cute-dsl runner (with PDL), when this device and
FlashInfer are the ones the pinned tactics were chosen on.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/mxfp8.py
_mxfp8_kernel(layer)
¶
layer's kernel when it is exactly the cute-dsl MXFP8 one.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/mxfp8.py
_wide_kernel(tactic, tile, device)
¶
The low-latency GEMM of tactic with a tile-row activation
tile, compiled once per device.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/mxfp8.py
_wide_supported()
cached
¶
Whether this device and FlashInfer are the ones the wide tactics were chosen on and the low-latency kernel class was checked against.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/mxfp8.py
_zeros(linear, rows)
¶
An input of linear laid out like the fused quantize producers'.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/mxfp8.py
compile_low_latency(gemm, tile, cta_k, device)
¶
gemm, a FlashInfer LowLatencyBlockscaledGemmKernel with a
tile-row activation tile, compiled for MXFP8 operands and a BF16
output without scale or bias, as FlashInfer's runner compiles it.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/mxfp8.py
compile_pinned(linear)
¶
Compile linear's pinned cute-dsl tactics, each at the largest
row count of its range, and its wide low-latency GEMMs.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/mxfp8.py
launch_low_latency(compiled, weight, weight_scale, a, a_scale, out)
¶
Launch a compiled low-latency GEMM on the current stream: out =
a (rows x K, F8_128x4 scales) times the column-major [K, N]
weight. The kernel computes out.T: its M is the weight's N.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/mxfp8.py
low_latency_mm(layer, x)
¶
layer's GEMM of x on cutedsl_low_latency for an eligible
layer, or None when x is not an MXFP8 input of the backend's layout.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/mxfp8.py
mxfp8_eligible(layer)
¶
Whether layer is a cute-dsl MXFP8 linear whose weights the
low-latency backend also takes.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/mxfp8.py
mxfp8_mm(layer, qa)
¶
layer's GEMM on cutedsl_low_latency.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/mxfp8.py
pinned_mm(layer, x)
¶
layer's cute-dsl GEMM of x with the pinned tactic of its
shape and row count, quantizing a BF16 x as the layer does; None when
no tactic is pinned for them.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/mxfp8.py
pinned_tactics()
¶
Offer FlashInfer's tuner only the pinned tactic for pinned problems. The
tuner's tactic list is a FlashInfer internal: when it has no
autotune_tactics or does not list a pinned tactic, every tactic is
tuned.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/mxfp8.py
projection_mm(layer, x, low_batch)
¶
An eligible layer's GEMM of x: on cutedsl_low_latency in a
step of up to LOW_BATCH_MAX_ROWS rows (low_batch), else
wide_or_pinned_mm; None where none applies.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/mxfp8.py
run_zeros(linear, rows)
¶
Call linear on cutedsl_low_latency on a zero input.
shape_representatives(linears)
¶
One eligible linear per distinct (N, K), in a rank-independent order.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/mxfp8.py
wide_mm(layer, x)
¶
layer's low-latency GEMM of x with a wide activation tile,
quantizing a BF16 x as the layer does; None where it does not run.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/mxfp8.py
wide_or_pinned_mm(layer, x)
¶
An eligible layer's GEMM of x above LOW_BATCH_MAX_ROWS
rows: on the wide low-latency GEMM, else with the pinned cute-dsl
tactic; None where neither applies.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/mxfp8.py
wide_tactic(n, k, rows)
¶
(activation tile, tactic) of the wide low-latency GEMM of an (N, K)
weight at rows rows; None where it does not run.