vllm.model_executor.models.transformers.fusers.packed_qkv
¶
Packed-QKV fuser: c_attn(x).split((q, kv, kv)) -> a QKVParallelLinear.
Also matches a packed projection sliced into q, k and v along the last dim.
Classes:
-
PackedQKVFuser–Fuser for attention with q, k and v packed into one projection.
PackedQKVFuser
dataclass
¶
Bases: RewriteFuser
Fuser for attention with q, k and v packed into one projection.
Methods:
-
update_forward–Rewrite the split sizes or slice bounds to the per-rank widths.
-
validate–Shapes must be compatible with a head-sharded packed GEMM.
_rewrite_slices(funcdef)
¶
Point the three qkv[..., a:b] slices at the per-rank sections.
_rewrite_split(funcdef)
¶
Point the unique self.<qkv_name>(...)....split((a, b, c), ...) at the
per-rank sections.
_sliced_sizes(node)
staticmethod
¶
(q, kv) if the output of node is only sliced into q, k and v.
The three users must be x[..., :q], x[..., q:q + kv] and
x[..., q + kv:] on node itself, so slices of anything derived from
it (e.g. rotary) never match.
_split_sizes(node)
staticmethod
¶
(q, kv) from a split((q, kv, kv), ...) call, if it is one.
update_forward(module)
¶
Rewrite the split sizes or slice bounds to the per-rank widths.
validate(module, vllm_config)
¶
Shapes must be compatible with a head-sharded packed GEMM.