Skip to content

vllm.compilation.passes.fusion.mla_attn_quant_fusion

Classes:

MLAAttnFp8GroupQuantPattern

Bases: VllmPatternReplacement[..., tuple[Tensor, Tensor]]

Fusion for MLA Attention+Fp8GroupQuant (per-group dynamic FP8).

Matches the pattern: MLA attention -> per_token_group_fp8_quant, and replaces it with MLA attention(output_block_scale=group_scale_buffer). Used by models with block FP8 quantization (e.g. DeepSeek V3).

MLAAttnFp8StaticQuantPattern

Bases: VllmPatternReplacement[..., Tensor | tuple[Tensor, Tensor]]

Fusion for MLA Attention+Fp8StaticQuant.

Matches the pattern: MLA attention -> static FP8 quant, and replaces it with MLA attention(output_scale=scale, output=fp8_buffer).

MLAAttnNvfp4QuantPattern

Bases: VllmPatternReplacement[..., tuple[Tensor, Tensor]]

Fusion for MLA Attention+Nvfp4Quant.

Matches the pattern: MLA attention -> NVFP4 quant, and replaces it with MLA attention(output_scale=scale, output_block_scale=block_scale, output=fp4_buffer).

MLAAttnQuantFusionPass

Bases: VllmFusionPatternMatcherPass

This pass fuses post-attention quantization onto MLA attention if supported.

It uses the pattern matcher and matches each MLA layer manually, as strings cannot be wildcarded. This also lets us check support on attention layers upon registration instead of during pattern matching.

RocmMLAAttnFp8StaticQuantPattern

Bases: MLAAttnFp8StaticQuantPattern

Fuse AITER static quantization while preserving its scale output.