vllm.v1.attention.backends.composite
¶
Reusable attention backend composition and routing policies.
Classes:
-
CompositeAttentionRouting–Select a child backend and declare routing constraints for composition.
-
MMPrefixAttentionRouting–Route image masks to variant zero and causal queries to variant one.
Functions:
-
create_composite_attention_backend–Compose two backends with shared storage and an explicit routing policy.
CompositeAttentionRouting
¶
Bases: Protocol
Select a child backend and declare routing constraints for composition.
Methods:
-
get_cudagraph_support–Limit graph support to batches whose routing stays invariant.
-
select–Return 0 for the first child or 1 for the second child.
-
variant_uses_mm_prefix–Whether this child must support the model's image-mask requirement.
Attributes:
-
capture_variant(int) –Child used during graph capture; replay must select the same child.
capture_variant
class-attribute
¶
Child used during graph capture; replay must select the same child.
get_cudagraph_support(vllm_config, kv_cache_spec)
staticmethod
¶
Limit graph support to batches whose routing stays invariant.
select(metadata)
¶
Return 0 for the first child or 1 for the second child.
variant_uses_mm_prefix(variant)
staticmethod
¶
Whether this child must support the model's image-mask requirement.
MMPrefixAttentionRouting
¶
Bases: CompositeAttentionRouting
Route image masks to variant zero and causal queries to variant one.
create_composite_attention_backend(general_backend, causal_backend, *, name, backend_name, module, routing_policy, head_sizes=(), kernel_block_sizes=(), device_major=None)
cached
¶
Compose two backends with shared storage and an explicit routing policy.