Merge remote-tracking branch 'origin/main' into lesj/qwen4exp-bugfixes

Both sides edited the same import block in the Qwen4Exp NVIDIA and AMD
models and nothing else collided. This branch adds
`from ..common.mtp import make_mtp_hidden_buffer`, the helper the MTP
buffer extraction calls; upstream ec4a3a5370 widened the `..config`
import to `ATTENTION_LAYER_TYPES, QSA_LAYER_TYPE, Qwen4ExpConfig` for the
layer-type constants it introduced. The two changes are independent, so
the resolution keeps both lines. Every symbol still has a use outside the
import in both files.

Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
This commit is contained in:
lesj0610
2026-09-17 08:16:59 +09:00
1729 changed files with 15443 additions and 16090 deletions
+5 -10
View File
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
Warmup deep_gemm kernels.
"""Warmup deep_gemm kernels.
DeepGEMM JIT's the kernels. The warmup aims to JIT all the kernels that would
be used during model execution beforehand.
"""
@@ -36,16 +35,15 @@ from vllm.utils.platform_utils import num_compute_units
def _generate_optimal_warmup_m_values(
max_tokens: int, n: int, device: torch.device
) -> list[int]:
"""
Generate M values that cover all possible DeepGEMM kernel configurations.
"""Generate M values that cover all possible DeepGEMM kernel configurations.
Reference: https://github.com/deepseek-ai/DeepGEMM/blob/79f48ee15a82dd5fad5cd9beaa393c1f755e6b55/csrc/jit_kernels/heuristics/common.hpp
Args:
max_tokens: Maximum number of tokens to warmup for
n: The actual N dimension from the weight tensor
device: The torch device to get properties from.
"""
"""
# DeepGEMM's possible block sizes
block_ms = [64, 128, 256]
block_ns = list(range(16, min(257, n + 1), 16))
@@ -82,9 +80,7 @@ def _generate_optimal_warmup_m_values(
def _extract_data_from_fused_moe_module(
m_: torch.nn.Module,
) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, int]:
"""
Extract weights, weight scales and num_topk from MoERunner module.
"""
"""Extract weights, weight scales and num_topk from MoERunner module."""
assert isinstance(m_, MoERunner)
m = m_.routed_experts
w13 = m.w13_weight
@@ -111,8 +107,7 @@ def _extract_data_from_fused_moe_module(
def _deep_gemm_linear_data(
module: torch.nn.Module,
) -> tuple[torch.Tensor, torch.Tensor] | None:
"""
Return (weight, weight_scale) for a layer whose kernel stamped itself as
"""Return (weight, weight_scale) for a layer whose kernel stamped itself as
``deep_gemm_warmup_provider`` in ``process_weights_after_loading``, else None.
"""
provider = getattr(module, "deep_gemm_warmup_provider", None)
@@ -99,7 +99,6 @@ def compile_tilelang(jit_impl: Any, *args: Any, **kwargs: Any) -> None:
parsed key as ``__call__`` so runtime does not report a cache miss for an
already materialized specialization.
"""
with _quiet_tilelang_warmup_logs():
compiled = jit_impl.compile(*args, **kwargs)
func = getattr(jit_impl, "func", None)
+2 -4
View File
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
Warmup kernels used during model execution.
"""Warmup kernels used during model execution.
This is useful specifically for JIT'ed kernels as we don't want JIT'ing to
happen during model execution.
"""
@@ -369,8 +368,7 @@ def _run_flashinfer_autotune_dummy_runs(
def flashinfer_autotune(runner: "GPUModelRunner") -> None:
"""
Autotune FlashInfer operations.
"""Autotune FlashInfer operations.
FlashInfer have many implementations for the same operation,
autotuning runs benchmarks for each implementation and stores
the results. The results are cached transparently and
@@ -19,7 +19,6 @@ logger = init_logger(__name__)
def qwen4_exp_qsa_triton_warmup(worker: "Worker") -> None:
"""Warm every reachable QSA specialization: indexer decode-query-length
profiles plus the sparse attention split-K/merge configs."""
qsa_module = sys.modules.get("vllm.models.qwen4_exp.nvidia.indexer_qsa")
attn_module = sys.modules.get("vllm.models.qwen4_exp.nvidia.qsa")
if qsa_module is None or attn_module is None: