[MyPy][3/N] Fix MyPy errors in test groups (part 3) (#55939)

Signed-off-by: Taimys <ffy2281693949@gmail.com>
Signed-off-by: Luyi Xiao <81631911+luyixiao95@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Luyi Xiao <81631911+luyixiao95@users.noreply.github.com>
Co-authored-by: Taimys <ffy2281693949@gmail.com>
Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Taimys
2026-09-30 11:06:07 +00:00
committed by GitHub
co-authored by Codex Luyi Xiao Taimys Harry Mellor Claude Opus 5.5
parent c4fa6f36a7
commit 5225f1bacb
118 changed files with 948 additions and 605 deletions
@@ -2,6 +2,7 @@
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from contextlib import contextmanager
from typing import Literal
from unittest.mock import MagicMock, patch
import pytest
@@ -14,6 +15,7 @@ from vllm.config import (
VllmConfig,
set_current_vllm_config,
)
from vllm.config.cache import CacheDType
from vllm.platforms import current_platform
from vllm.platforms.cpu import CpuPlatform
from vllm.platforms.interface import DeviceCapability
@@ -21,12 +23,12 @@ from vllm.platforms.interface import DeviceCapability
if current_platform.is_cuda():
from vllm.platforms.cuda import CudaPlatform
else:
CudaPlatform = None
CudaPlatform = None # type: ignore[assignment] # Unavailable platform import.
if current_platform.is_rocm():
from vllm.platforms.rocm import RocmPlatform
else:
RocmPlatform = None
RocmPlatform = None # type: ignore[misc, assignment] # Unavailable platform import.
from vllm.v1.attention.backend import AttentionType
from vllm.v1.attention.backends.registry import AttentionBackendEnum
@@ -354,14 +356,14 @@ def test_invalid_backend():
def test_auto_backend_string(auto_value: str):
"""Test that 'auto' string value triggers automatic backend selection."""
# Using "auto" should result in backend=None (automatic selection)
attention_config = AttentionConfig(backend=auto_value)
attention_config = AttentionConfig(backend=auto_value) # type: ignore[arg-type]
assert attention_config.backend is None
def test_auto_backend_selection_behavior():
"""Test that 'auto' backend behaves same as None (automatic selection)."""
# Create config with explicit "auto"
auto_config = AttentionConfig(backend="auto")
auto_config = AttentionConfig(backend="auto") # type: ignore[arg-type]
# Create config with None (default)
none_config = AttentionConfig(backend=None)
@@ -406,7 +408,7 @@ def test_auto_backend_selection_behavior():
reason="Attention backend FA3 is not supported on ROCm. This test can't succeed.",
)
def test_per_head_quant_scales_backend_selection(
backend_name: str, flash_attn_version: int | None, should_succeed: bool
backend_name: str, flash_attn_version: Literal[2, 3, 4] | None, should_succeed: bool
):
"""Test backend selection when use_per_head_quant_scales=True."""
# Clear cache to ensure fresh backend selection
@@ -559,7 +561,7 @@ def test_non_causal_autoselect_backend():
"int8_per_token_head",
],
)
def test_flash_attn_rejects_unhandled_kv_cache_dtypes(kv_cache_dtype: str):
def test_flash_attn_rejects_unhandled_kv_cache_dtypes(kv_cache_dtype: CacheDType):
"""FlashAttentionBackend must not claim support for kv_cache dtypes
that it cannot handle."""
from vllm.v1.attention.backends.flash_attn import FlashAttentionBackend
@@ -569,7 +571,7 @@ def test_flash_attn_rejects_unhandled_kv_cache_dtypes(kv_cache_dtype: str):
@pytest.mark.parametrize("kv_cache_dtype", ["fp8", "fp8_e4m3"])
def test_flash_attn_accepts_handled_fp8_variants(
kv_cache_dtype: str, monkeypatch: pytest.MonkeyPatch
kv_cache_dtype: CacheDType, monkeypatch: pytest.MonkeyPatch
):
"""FlashAttentionBackend must accept the two fp8 dtypes it can actually
handle: 'fp8' (alias for fp8_e4m3fn) and 'fp8_e4m3'."""
@@ -876,7 +878,9 @@ def test_rswa_selection_does_not_reuse_causal_result(blackwell_selection):
config = EngineArgs(
model="google/gemma-4-31B-it",
dtype="bfloat16",
attention_config={"backend": "TRITON_FLASHINFER"},
attention_config=AttentionConfig(
backend=AttentionBackendEnum.TRITON_FLASHINFER
),
).create_engine_config()
with set_current_vllm_config(config):
assert (
@@ -151,7 +151,7 @@ def test_cascade(
max_seqlen_k=max_kv_len,
softmax_scale=scale,
causal=True,
window_size=window_size,
window_size=list(window_size),
block_table=block_tables,
softcap=soft_cap if soft_cap is not None else 0,
)
+1 -1
View File
@@ -836,7 +836,7 @@ def varlen_encoder_zentorch_sdpa(
key,
value,
output,
SimpleNamespace(query_start_loc=query_start_loc, causal=False),
SimpleNamespace(query_start_loc=query_start_loc, causal=False), # type: ignore[arg-type]
scale,
sliding_window if sliding_window is not None else -1,
alibi_slopes,
+2 -2
View File
@@ -187,7 +187,7 @@ def test_varlen_with_paged_kv(
max_seqlen_k=max_kv_len,
softmax_scale=scale,
causal=True,
window_size=window_size,
window_size=list(window_size),
block_table=block_tables,
softcap=soft_cap if soft_cap is not None else 0,
fa_version=fa_version,
@@ -274,7 +274,7 @@ def test_fa4_hd256_paged_call_shape(
max_seqlen_k=num_pages * block_size,
softmax_scale=scale,
causal=True,
window_size=window_size,
window_size=list(window_size),
block_table=block_tables[:, :num_pages],
num_splits=1,
fa_version=4,
@@ -197,11 +197,6 @@ def test_decode_concat_ignores_negative_slots_for_cache(cache_format: str) -> No
mixed_cache = initial_cache.clone()
reference_cache = _reference_cache(cache_format, inputs, initial_cache, slots)
scale_inv = torch.ones(1, device="cuda", dtype=torch.float32)
kwargs = {
"ds_mla": cache_format == "fp8_ds_mla",
"q_scale_inv": scale_inv if cache_format == "fp8" else None,
"cache_scale_inv": scale_inv if cache_format == "fp8" else None,
}
output = fused_mla_decode_q_concat_kv_cache_insert(
inputs["ql_nope"],
@@ -210,7 +205,9 @@ def test_decode_concat_ignores_negative_slots_for_cache(cache_format: str) -> No
inputs["k_pe"],
mixed_cache,
slots,
**kwargs,
ds_mla=cache_format == "fp8_ds_mla",
q_scale_inv=scale_inv if cache_format == "fp8" else None,
cache_scale_inv=scale_inv if cache_format == "fp8" else None,
)
expected = _latent_query(inputs["ql_nope"], inputs["q_pe"])
+4 -4
View File
@@ -277,7 +277,7 @@ def test_mha_attn_varlen_forward_flashinfer(
# Override vllm config so get_vit_attn_backend returns FLASHINFER (simulates
# --mm-encoder-attn-backend=FLASHINFER).
vllm_config = get_current_vllm_config()
old_model_config = getattr(vllm_config, "model_config", None)
old_model_config = vllm_config.model_config
minimal_model_config = type(
"MinimalModelConfig",
(),
@@ -376,7 +376,7 @@ def test_mha_attn_varlen_forward_aiter_fp8(
torch.set_default_dtype(dtype)
vllm_config = get_current_vllm_config()
old_model_config = getattr(vllm_config, "model_config", None)
old_model_config = vllm_config.model_config
minimal_model_config = type(
"MinimalModelConfig",
(),
@@ -442,7 +442,7 @@ def test_mha_attn_varlen_forward_aiter_fp8(
)
def test_mha_attn_aiter_fp8_rejects_unsupported_arch(default_vllm_config):
vllm_config = get_current_vllm_config()
old_model_config = getattr(vllm_config, "model_config", None)
old_model_config = vllm_config.model_config
vllm_config.model_config = type(
"MinimalModelConfig",
(),
@@ -468,7 +468,7 @@ def test_mha_attn_aiter_fp8_rejects_unsupported_arch(default_vllm_config):
)
def test_mha_attn_fp8_rejects_wrong_backend(default_vllm_config):
vllm_config = get_current_vllm_config()
old_model_config = getattr(vllm_config, "model_config", None)
old_model_config = vllm_config.model_config
vllm_config.model_config = type(
"MinimalModelConfig",
(),
+17 -12
View File
@@ -1689,8 +1689,10 @@ def test_aiter_sparse_pa_layout_contract(monkeypatch, layout):
)
backend = sparse_attn_mod.MiniMaxM3SparseBackend
assert KVCacheLayout.LHBNC in backend.supported_kv_cache_layouts()
assert KVCacheLayout.LBHNC in backend.supported_kv_cache_layouts()
layouts = backend.supported_kv_cache_layouts()
assert layouts is not None
assert KVCacheLayout.LHBNC in layouts
assert KVCacheLayout.LBHNC in layouts
nb, h = 3, 1
cache_dtype = current_platform.fp8_dtype()
@@ -1772,19 +1774,22 @@ def test_aiter_indexer_requires_the_aiter_attend(monkeypatch):
import vllm.models.minimax_m3.amd.indexer_aiter as indexer_aiter_mod
monkeypatch.setattr(indexer_aiter_mod.current_platform, "is_rocm", lambda: True)
kwargs = dict(
topk_blocks=TOPK,
sparse_block_size=BLOCK_SIZE,
num_index_heads=1,
index_head_dim=HEAD_DIM,
indexer_kv_dtype="fp8_e4m3",
max_model_len=8192,
)
def unsupported_reason() -> str | None:
return indexer_aiter_mod.aiter_indexer_unsupported_reason(
topk_blocks=TOPK,
sparse_block_size=BLOCK_SIZE,
num_index_heads=1,
index_head_dim=HEAD_DIM,
# The implementation also accepts this legacy fp8 alias.
indexer_kv_dtype="fp8_e4m3", # type: ignore[arg-type]
max_model_len=8192,
)
monkeypatch.setattr(
indexer_aiter_mod, "_minimax_m3_aiter_sparse_pa_requested", lambda: False
)
reason = indexer_aiter_mod.aiter_indexer_unsupported_reason(**kwargs)
reason = unsupported_reason()
assert reason is not None and "AITER sparse PA attend" in reason
# With the attend asked for, the gate moves on to the kernel-contract
@@ -1792,7 +1797,7 @@ def test_aiter_indexer_requires_the_aiter_attend(monkeypatch):
monkeypatch.setattr(
indexer_aiter_mod, "_minimax_m3_aiter_sparse_pa_requested", lambda: True
)
reason = indexer_aiter_mod.aiter_indexer_unsupported_reason(**kwargs)
reason = unsupported_reason()
assert reason is None or "AITER sparse PA attend" not in reason
@@ -235,14 +235,14 @@ def test_msa_metadata_builder_prepares_cutlass_for_regular_decode(
builder.num_q_heads = 64
builder.num_kv_heads = 4
builder.topk_blocks = TOPK
builder.kv_cache_spec = SimpleNamespace(num_kv_heads=4)
builder.kv_cache_spec = SimpleNamespace(num_kv_heads=4) # type: ignore[assignment]
builder.kv_cache_dtype = "fp8_e4m3"
builder.decode_backend = "cutlass"
builder.msa_cutlass_plan_cache = object()
builder.msa_cutlass_plan_cache = object() # type: ignore[assignment] # Mocked plan-cache sentinel.
metadata = builder.build(
0,
SimpleNamespace(
SimpleNamespace( # type: ignore[arg-type]
seq_lens_cpu_upper_bound=torch.full((batch,), 257, dtype=torch.int32)
),
)
@@ -377,7 +377,7 @@ def test_query_fp8_stays_valid_when_cutlass_plan_appears_on_replay(
with torch.cuda.stream(stream), override_forward_context(forward_context):
capture = BreakableCUDAGraphCapture()
with capture:
query_fp8 = MiniMaxM3SparseAttention._allocate_query_fp8(attention, qkv)
query_fp8 = MiniMaxM3SparseAttention._allocate_query_fp8(attention, qkv) # type: ignore[arg-type]
if query_fp8 is not None:
query_fp8.zero_()
run_attention(query_fp8)
@@ -783,6 +783,9 @@ def test_aiter_fa_shared_kv_matches_reference(
32 * BLOCK_SIZE, num_kv_heads, head_size, dtype=torch.bfloat16
)
value = torch.randn_like(key)
from vllm.v1.attention.backends.rocm_aiter_fa import AiterFlashAttentionImpl
assert isinstance(target.impl, AiterFlashAttentionImpl)
target.impl.do_kv_cache_update(
target,
key,
@@ -82,6 +82,7 @@ def _run_verify_block():
)
from vllm.config import SpeculativeConfig
from vllm.config.vllm import set_current_vllm_config
from vllm.v1.attention.backends.mla.rocm_aiter_mla import AiterMLAImpl
from vllm.v1.attention.backends.registry import AttentionBackendEnum
from vllm.v1.kv_cache_interface import MLAAttentionSpec
from vllm.v1.worker.workspace import init_workspace_manager
@@ -106,7 +107,7 @@ def _run_verify_block():
vllm_config.speculative_config = SpeculativeConfig(
method="ngram", num_speculative_tokens=QLEN - 1
)
vllm_config.model_config.get_num_attention_heads = types.MethodType(
vllm_config.model_config.get_num_attention_heads = types.MethodType( # type: ignore[method-assign]
lambda self, parallel_config, arch_config=None: NUM_QUERY_HEADS,
vllm_config.model_config,
)
@@ -202,7 +203,8 @@ def _run_verify_block():
lambda: spy,
),
):
impl.forward_mqa((q_nope, q_pe), kv_cache, metadata, layer=None)
assert isinstance(impl, AiterMLAImpl)
impl.forward_mqa((q_nope, q_pe), kv_cache, metadata, layer=None) # type: ignore[arg-type] # Spy decode path does not read layer.
return metadata, captured
@@ -121,7 +121,7 @@ def _build_prefill_metadata(
builder = object.__new__(AiterMLAMetadataBuilder)
builder.num_heads = num_heads
builder.mla_dims = SimpleNamespace(v_head_dim=V_HEAD_DIM)
builder.mla_dims = SimpleNamespace(v_head_dim=V_HEAD_DIM) # type: ignore[assignment]
builder._init_fp8_prefill_ps_buffers(
max_num_reqs=len(seq_lens),
max_prefill_qlen=max_q,
@@ -136,7 +136,7 @@ def _build_prefill_metadata(
prefill = SimpleNamespace(query_start_loc=qo_indptr, max_query_len=max_q)
metadata = SimpleNamespace(prefill=prefill, num_decodes=0)
common = SimpleNamespace(query_start_loc_cpu=qo_indptr_cpu)
builder._build_fp8_prefill_ps_metadata(metadata, common)
builder._build_fp8_prefill_ps_metadata(metadata, common) # type: ignore[arg-type]
return metadata, total_q, builder
@@ -167,7 +167,10 @@ def test_sparse_mla_sink_matches_ragged_reference(
impl.sinks = sinks
output, lse = impl._forward_mla(
SimpleNamespace(_q_scale=q_scale, _k_scale=kv_scale), q, kv, metadata
SimpleNamespace(_q_scale=q_scale, _k_scale=kv_scale),
q,
kv,
metadata, # type: ignore[arg-type]
)
kv_flat = kv_ref[:, 0]
references = []
@@ -241,7 +244,7 @@ def test_sparse_mla_sink_rejects_unsupported_aiter_dtypes(
SimpleNamespace(_q_scale=None, _k_scale=None),
torch.empty(1, 16, Q_HEAD_DIM, dtype=q_dtype),
torch.empty(1, 1, Q_HEAD_DIM, dtype=kv_dtype),
metadata,
metadata, # type: ignore[arg-type]
)
@@ -381,7 +384,7 @@ def test_sparse_mla_sink_matches_dense_attention_with_empty_rows_and_paged_cache
paged_kv_indices=torch.tensor(indices, dtype=torch.int32, device="cuda"),
paged_kv_indptr=lengths.cumsum(0).to(device="cuda", dtype=torch.int32),
)
impl = ROCMAiterMLASparseImpl.__new__(ROCMAiterMLASparseImpl)
impl = ROCMAiterMLASparseImpl.__new__(ROCMAiterMLASparseImpl) # type: ignore[arg-type]
impl.num_heads = num_heads
impl.head_size = head_dim
impl.kv_lora_rank = value_dim
@@ -438,9 +441,9 @@ def test_sparse_mla_backend_resolves_only_contiguous_layer_layouts(monkeypatch,
]
if layout == "BLNHC":
with pytest.raises(ValueError, match="does not satisfy"):
resolve_kv_cache_layout(config, supported)
resolve_kv_cache_layout(config, supported) # type: ignore[arg-type]
else:
assert resolve_kv_cache_layout(config, supported).name == layout
assert resolve_kv_cache_layout(config, supported).name == layout # type: ignore[arg-type]
@pytest.mark.parametrize("dtype", [torch.bfloat16, torch.float16])
@@ -491,7 +494,7 @@ def test_sparse_mla_sink_forward_mqa_preserves_split_query(dtype):
actual, _ = impl.forward_mqa(
(q[..., :V_HEAD_DIM], q[..., V_HEAD_DIM:]),
kv,
metadata,
metadata, # type: ignore[arg-type]
SimpleNamespace(_q_scale=None, _k_scale=None),
)
references = [
@@ -39,10 +39,10 @@ def _make_builder():
topk_tokens = 4
builder.device = torch.device("cpu")
builder.kv_cache_spec = SimpleNamespace(block_size=1)
builder.kv_cache_spec = SimpleNamespace(block_size=1) # type: ignore[assignment]
builder.model_dtype = torch.bfloat16
builder.kv_cache_dtype = "fp8"
builder.mla_dims = SimpleNamespace(kv_lora_rank=512, qk_rope_head_dim=64)
builder.mla_dims = SimpleNamespace(kv_lora_rank=512, qk_rope_head_dim=64) # type: ignore[assignment]
builder.topk_tokens = topk_tokens
builder.req_id_per_token_buffer = torch.zeros(
max_num_batched_tokens, dtype=torch.int32, device="cpu"
@@ -227,7 +227,9 @@ def _decode_metadata(case, rows, ratio, query_lens):
num_decode_tokens=len(rows),
num_prefills=0,
num_prefill_tokens=0,
decode=types.SimpleNamespace(block_table=block_table, seq_lens=lens[:, None]),
decode=types.SimpleNamespace( # type: ignore[arg-type]
block_table=block_table, seq_lens=lens[:, None]
),
decode_row_lens=lens,
decode_block_ends=(lens + CAND_BLOCK - 1) // CAND_BLOCK,
decode_native=native,
@@ -278,7 +280,7 @@ def _prefill_metadata(
num_decode_tokens=0,
num_prefills=len(case.seq_lens),
num_prefill_tokens=len(rows),
prefill=types.SimpleNamespace(chunks=chunks),
prefill=types.SimpleNamespace(chunks=chunks), # type: ignore[arg-type]
prefill_plans=plans,
gather_launches=plan_gather_launches(chunks, plans, gather_rows),
)
@@ -955,7 +955,7 @@ def test_rocm_capture_metadata_sets_adaptive_marker(monkeypatch) -> None:
)
builder = object.__new__(rocm_mod.DeepseekV4ROCMAiterMLASparseMetadataBuilder)
actual = builder.build_for_cudagraph_capture(SimpleNamespace())
actual = builder.build_for_cudagraph_capture(SimpleNamespace()) # type: ignore[arg-type] # Patched base method ignores metadata.
assert actual is metadata
assert actual.for_cudagraph_capture is _on_gfx950()
@@ -1563,7 +1563,7 @@ def test_dsv4_adaptive_mla_swa_metadata_graph_replay(monkeypatch) -> None:
"sliding_window": window_size,
},
)
vllm_config.speculative_config = SimpleNamespace(
vllm_config.speculative_config = SimpleNamespace( # type: ignore[assignment]
num_speculative_tokens=upper_query_len - 1,
parallel_drafting=False,
enable_adaptive_verification=True,
@@ -153,6 +153,7 @@ def test_triton_unified_attn_diffkv_vs_reference(
else:
from vllm.v1.attention.backends.fa_utils import flash_attn_varlen_func
assert fa_version is not None
# FA's TMA path needs aligned singleton strides (num_kv_heads == 1).
fa_k = canonicalize_singleton_dim_strides(key_cache)
fa_v = canonicalize_singleton_dim_strides(value_cache)
+1 -1
View File
@@ -79,7 +79,7 @@ class TestConfigSet:
config_set = ConfigSet("test_kernel")
with pytest.raises(KeyError, match="platform 'h100' not found"):
config_set.get_config("h100", "nonexistent")
config_set.get_config("h100", CaseKey({"batch": 32}))
config_data = {"num_warps": 8, "num_stages": 4}
data = {
@@ -81,7 +81,7 @@ class TestDynamicPerTokenScaledFp8QuantConfigPicker:
assert selected_key == CaseKey({"hidden_size": 2048, "num_tokens": 32})
def test_config_picker_no_configs(self):
config_keys: list[dict] = []
config_keys: list[CaseKey] = []
args = _generate_fake_input(16, 4096)
selected_key = pick_config(args, config_keys)
@@ -127,7 +127,7 @@ class TestFusedQkNormRopeConfigPicker:
)
def test_config_picker_no_configs(self):
config_keys: list[dict] = []
config_keys: list[CaseKey] = []
args = _generate_fake_input(16, 4096, 128)
selected_key = pick_config(args, config_keys)
@@ -38,6 +38,7 @@ from torch._inductor.pattern_matcher import (
)
from torch.fx.experimental.proxy_tensor import make_fx
from vllm.kernels.helion.case_key import CaseKey
from vllm.kernels.helion.config_manager import ConfigManager
from vllm.kernels.helion.register import HelionKernelWrapper
@@ -45,7 +46,7 @@ from vllm.kernels.helion.register import HelionKernelWrapper
@contextlib.contextmanager
def _helion_mock_context():
configs = {
"default": helion.Config(block_sizes=[64], num_warps=2, num_stages=2),
CaseKey.default(): helion.Config(block_sizes=[64], num_warps=2, num_stages=2),
}
mock_config_manager = Mock(spec=ConfigManager)
mock_config_manager.get_platform_configs = Mock(return_value=configs)
@@ -88,7 +89,7 @@ class TestMakeFxHop:
raw_kernel_func=raw_add_scale,
op_name="test_make_fx",
fake_impl=lambda *a, **kw: None,
config_picker=lambda args, keys: "default",
config_picker=lambda args, keys: CaseKey.default(),
)
def fn(x, y):
@@ -145,7 +146,7 @@ class TestMakeFxHop:
raw_kernel_func=raw_silu_mul,
op_name="test_pm_silu_mul",
fake_impl=lambda *a, **kw: None,
config_picker=lambda args, keys: "default",
config_picker=lambda args, keys: CaseKey.default(),
)
def pattern(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
@@ -107,7 +107,7 @@ class TestPerTokenGroupFp8QuantConfigPicker:
)
def test_config_picker_no_configs(self):
config_keys: list[dict] = []
config_keys: list[CaseKey] = []
args = _generate_fake_input(16, 4096, 128)
selected_key = pick_config(args, config_keys)
+1
View File
@@ -397,6 +397,7 @@ class TestHelionKernelWrapper:
)
assert wrapper._disabled is True
assert wrapper._disabled_reason is not None
assert "No configs available" in wrapper._disabled_reason
def test_disabled_wrapper_raises_on_call(self, sample_kernel):
@@ -89,7 +89,7 @@ class TestRmsNormDynamicPerTokenQuantConfigPicker:
assert selected_key == CaseKey({"hidden_size": 2048, "num_tokens": 32})
def test_config_picker_no_configs(self):
config_keys: list[dict] = []
config_keys: list[CaseKey] = []
args = _generate_fake_input(16, 4096)
selected_key = pick_config(args, config_keys)
@@ -112,7 +112,7 @@ class TestRmsNormPerBlockQuantConfigPicker:
)
def test_config_picker_no_configs(self):
config_keys: list[dict] = []
config_keys: list[CaseKey] = []
args = _generate_fake_input(16, 4096, 128)
selected_key = pick_config(args, config_keys)
@@ -96,7 +96,7 @@ class TestSiluAndMulPerBlockQuantConfigPicker:
)
def test_config_picker_no_configs(self):
config_keys: list[dict] = []
config_keys: list[CaseKey] = []
args = _generate_fake_input(16, 4096, 128)
selected_key = pick_config(args, config_keys)
+2 -1
View File
@@ -83,7 +83,7 @@ class TestSiluMulFp8ConfigPicker:
assert selected_key == CaseKey({"intermediate": 4096, "numtokens": 256})
def test_config_picker_no_configs(self):
config_keys: list[dict] = []
config_keys: list[CaseKey] = []
input_tensor = torch.randn(32, 4096, dtype=torch.bfloat16, device="cuda")
scale = torch.tensor([0.5], dtype=torch.float32, device="cuda")
@@ -355,6 +355,7 @@ class TestSiluMulFp8Integration:
registered_kernels = get_registered_kernels()
kernel_wrapper = registered_kernels["silu_mul_fp8"]
fake_impl = kernel_wrapper._fake_impl
assert fake_impl is not None
fake_output = fake_impl(input_tensor, scale)