Files
vLLM/tests/v1/attention/test_rocm_aiter_mla_sparse.py
Sriram KumarDouglas Lehrmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2ce8012fa0 [ROCm][Perf] Skip cleaning sparse prefill MQA logits (#51314)
Signed-off-by: Sriram Kumar <sriramkumar.kishorekumar@amd.com>
Co-authored-by: Douglas Lehr <91553416+dllehr-amd@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2026-10-13 00:21:52 -05:00

55 lines
1.5 KiB
Python

# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from types import SimpleNamespace
import pytest
import torch
from vllm._aiter_ops import is_aiter_found_and_supported
from vllm.platforms import current_platform
if not current_platform.is_rocm() or not is_aiter_found_and_supported():
pytest.skip(
"ROCm AITER sparse indexer test requires ROCm with AITER.",
allow_module_level=True,
)
from vllm._aiter_ops import rocm_aiter_ops
from vllm.v1.attention.ops import rocm_aiter_mla_sparse as sparse_mod
def test_rocm_fp8_mqa_logits_disables_clean_logits(monkeypatch):
captured = {}
expected = torch.empty((1, 1))
def fake_fp8_mqa_logits(*args, clean_logits):
captured["clean_logits"] = clean_logits
return expected
monkeypatch.setattr(sparse_mod, "_ON_GFX942", False)
monkeypatch.setattr(rocm_aiter_ops, "is_enabled", lambda: True)
monkeypatch.setattr(
sparse_mod,
"mqa_logits_module",
lambda: SimpleNamespace(fp8_mqa_logits=fake_fp8_mqa_logits),
)
q = torch.empty((1, 1, 1))
k_fp8 = torch.empty((1, 1))
scale = torch.empty((1,))
weights = torch.empty((1, 1))
cu_seqlen_ks = torch.zeros((1,), dtype=torch.int32)
cu_seqlen_ke = torch.ones((1,), dtype=torch.int32)
result = sparse_mod.rocm_fp8_mqa_logits(
q,
(k_fp8, scale),
weights,
cu_seqlen_ks,
cu_seqlen_ke,
)
assert result is expected
assert captured["clean_logits"] is False