[3/N][warmup][DSv4] Migrate FA4 MLA and shared CuTeDSL kernels (#53565)

Signed-off-by: LopezCastroRoberto <rocastro@redhat.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Roberto L. Castro
2026-09-07 09:36:35 -04:00
committed by GitHub
co-authored by Codex mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 1713b9866a
commit 42801b3a6b
8 changed files with 52 additions and 67 deletions
@@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Correctness test for the Inkling FA4 relative-attention score-mod kernel.
Checks ``INKLING_FA4_REL_ATTENTION_KERNEL`` against a pure-PyTorch reference
Checks ``_INKLING_FA4_REL_ATTENTION_KERNEL`` against a pure-PyTorch reference
that implements the relative bias exactly as documented in the Inkling architecture
guide::
@@ -23,7 +23,7 @@ from vllm.models.inkling.nvidia.attention import (
compute_log_scaling_tau,
)
from vllm.models.inkling.nvidia.ops.fa4_rel_attention import (
INKLING_FA4_REL_ATTENTION_KERNEL,
_INKLING_FA4_REL_ATTENTION_KERNEL,
_use_sheared_bias,
inkling_fa4_num_splits,
)
@@ -279,7 +279,7 @@ def _run_case(seq_lens, num_heads, num_kv_heads, rel_extent, window_left, seed=0
num_kv_heads=num_kv_heads,
max_kv_len=max(kv_lens),
)
out = INKLING_FA4_REL_ATTENTION_KERNEL(
out = _INKLING_FA4_REL_ATTENTION_KERNEL(
q,
key_cache,
value_cache,
@@ -10,6 +10,7 @@ Covers two things:
+ standalone static-FP8-quant path it replaces (GPU-only, SM100/SM110).
"""
from types import SimpleNamespace
from unittest.mock import patch
import pytest
@@ -99,6 +100,38 @@ def test_flash_attn_supports_quant_output_unknown_device():
assert backend.supports_quant_output(kFp8StaticTensorSym) is False
@pytest.mark.parametrize(
("version", "enable_jit_warmup", "expected_calls"),
[(4, True, 1), (4, False, 0), (3, True, 0)],
)
def test_flash_attn_registers_warmup_only_for_fa4(
version: int,
enable_jit_warmup: bool,
expected_calls: int,
):
vllm_config = SimpleNamespace(
kernel_config=SimpleNamespace(enable_jit_warmup=enable_jit_warmup)
)
with (
patch(f"{_FA_MODULE}.flash_attn_varlen_func"),
patch(f"{_FA_MODULE}.get_flash_attn_version", return_value=version),
patch(f"{_FA_MODULE}._FA4_MLA_PREFILL_KERNEL.register_warmup") as register,
patch(f"{_FA_MODULE}.current_platform") as platform,
):
platform.get_device_capability.return_value = DeviceCapability(10, 0)
FlashAttnPrefillBackend(
num_heads=16,
scale=1.0,
kv_lora_rank=512,
qk_nope_head_dim=128,
qk_rope_head_dim=64,
v_head_dim=128,
vllm_config=vllm_config,
)
assert register.call_count == expected_calls
def test_flash_attn_prefill_backend_signature_accepts_fused_kwargs():
"""run_prefill_new_tokens must accept out/output_scale so the direct
(non-**kwargs) call in forward_mha type- and runtime-checks."""