[Attention] Implement universal BACKEND_MAP (#25900)

Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
This commit is contained in:
Matthew Bonanni
2025-10-08 12:00:25 -07:00
committed by GitHub
parent b25d7b5657
commit 76879cc160
12 changed files with 119 additions and 75 deletions
@@ -34,7 +34,7 @@ DEVICE_MLA_BACKENDS = {
DEVICE_REGULAR_ATTN_BACKENDS = {
"cuda": ["XFORMERS", "FLASHINFER", "FLASH_ATTN"],
"hip": ["ROCM_FLASH"],
"hip": ["ROCM_ATTN"],
"cpu": ["TORCH_SDPA"],
}
@@ -122,7 +122,7 @@ def test_env(
backend = get_attn_backend(
16, torch.float16, None, block_size, use_mla=use_mla
)
expected = "TRITON_ATTN"
expected = "ROCM_ATTN"
assert backend.get_name() == expected
elif device == "cuda":
@@ -18,7 +18,7 @@ def clear_cache():
@pytest.mark.skip(reason="Skipped for now. Should be revisited.")
def test_selector(monkeypatch: pytest.MonkeyPatch):
with monkeypatch.context() as m:
m.setenv(STR_BACKEND_ENV_VAR, "ROCM_FLASH")
m.setenv(STR_BACKEND_ENV_VAR, "ROCM_ATTN")
# Set the current platform to ROCm using monkeypatch
monkeypatch.setattr("vllm.attention.selector.current_platform", RocmPlatform())