[ModelRunner V2] Support encoder-only attention (#49331)

Signed-off-by: Nick Hill <nickhill123@gmail.com>
Signed-off-by: Taneem Ibrahim <taneem.ibrahim@gmail.com>
Co-authored-by: Taneem Ibrahim <taneem.ibrahim@gmail.com>
This commit is contained in:
Nick Hill
2026-07-27 00:38:44 +00:00
committed by GitHub
co-authored by Taneem Ibrahim
parent 0934b26790
commit fdaa0d9e59
8 changed files with 276 additions and 4 deletions
+12
View File
@@ -46,6 +46,18 @@ class AttentionCGSupportInfo:
min_cg_support: AttentionCGSupport = AttentionCGSupport.ALWAYS
min_cg_attn_backend: str | None = None
def narrow(
self, support: AttentionCGSupport, backend: str | None
) -> "AttentionCGSupportInfo":
"""Return an info tightened by ``support`` if it is more restrictive.
Lets attention groups built outside ``init_attn_backend`` (e.g.
encoder-only layers) contribute to the runner's cudagraph decision.
"""
if support.value < self.min_cg_support.value:
return AttentionCGSupportInfo(support, backend)
return self
def get_kv_cache_spec(vllm_config: VllmConfig) -> dict[str, KVCacheSpec]:
kv_cache_spec: dict[str, KVCacheSpec] = {}