From ff769c174cc87c8a83cbffb9418ed624c59acf30 Mon Sep 17 00:00:00 2001 From: amd-fuweiy Date: Wed, 14 Oct 2026 03:43:10 +0000 Subject: [PATCH] fix(vllm): default attention backend to TRITON_ATTN on ROCm create_async_llm defaults attention_config.backend to FLASH_ATTN when the caller passes none. On ROCm that backend relies on the CUDA-only vllm_flash_attn package: get_flash_attn_version() returns None there, so every engine fails during profile_run with "AssertionError: FlashAttention version not detected." Keep FLASH_ATTN on other platforms and use TRITON_ATTN on ROCm. An explicit attention_config from the caller still takes precedence. Co-authored-by: Cursor --- roll/third_party/vllm/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/roll/third_party/vllm/__init__.py b/roll/third_party/vllm/__init__.py index 1f5ec1adc..243a30fa9 100644 --- a/roll/third_party/vllm/__init__.py +++ b/roll/third_party/vllm/__init__.py @@ -84,7 +84,12 @@ async def create_async_llm(resource_placement_groups: List[Dict], headless: bool kwargs["enable_sleep_mode"] = True if "attention_config" not in kwargs and "attention_config" in engine_arg_names: # vllm<=0.12.0 does not have attention_config in AsyncEngineArgs. - kwargs["attention_config"] = {"backend": "FLASH_ATTN"} + # FLASH_ATTN needs the CUDA-only vllm_flash_attn package, so on ROCm it fails every engine + # at init with "AssertionError: FlashAttention version not detected." vLLM's own gfx942 + # priority list does not contain FLASH_ATTN at all; TRITON_ATTN is the Triton + # FlashAttention implementation it ships for ROCm. + default_backend = "TRITON_ATTN" if current_platform.is_rocm() else "FLASH_ATTN" + kwargs["attention_config"] = {"backend": default_backend} if "moe_backend" not in kwargs and "moe_backend" in engine_arg_names: # vLLM0.20.0, remove this while >= 0.29: https://github.com/vllm-project/vllm/issues/45447