Skip to content

vllm.model_executor.layers.fusion.fused_act_quant

Producer side of the QuantizedActivation contract for activation layers.

Given an activation module and the downstream linear it feeds, fuse the activation with that linear's input quantization into a single kernel when the linear advertises a consumable input quantization key (see quant_activation.py). Falls back to the plain activation when nothing matches, so a model forward can always call maybe_fused_act_quant unconditionally.

This is the manual-fusion counterpart to ActivationQuantFusionPass: when fusion fires here, the activation and quantization are already consumed, so a compiler pass cannot fuse the same boundary again.

Functions:

_act_nvfp4_quant_supported(act_fn, x, linear)

Return whether the Triton act + NVFP4 producer can consume this input.

_relu_squared_static_fp8_quant_supported(act_fn, x, linear)

Return whether the ReLU2 static-FP8 producer can consume this input.

_silu_and_mul_fp8_dynamic_128(x, linear)

SiluAndMul + FP8 dynamic per-group (group=128) quantization.

_silu_and_mul_fp8_dynamic_block(x, linear, group_size, quant_key)

SiluAndMul + FP8 dynamic per-block quantization.

_silu_and_mul_fp8_static(x, linear)

SiluAndMul + FP8 static per-tensor quantization.

_silu_and_mul_nvfp4_dynamic(x, linear)

SiluAndMul + NVFP4 dynamic quantization.

maybe_fused_act_quant(act_fn, x, linear)

Apply act_fn, fusing the downstream linear's input quant when possible.

Returns a QuantizedActivation when a fused kernel matches the activation and the consumer's effective input quantization key, else the plain activation.