[CI] Ignore ruff D209, rejoin the docstrings it split, and silence incompatible-rule warnings (#57212)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Harry Mellor
2026-09-16 10:57:24 -07:00
committed by GitHub
co-authored by Claude Opus 5
parent 1085b64425
commit 651a88c09a
693 changed files with 2088 additions and 4171 deletions
@@ -1319,8 +1319,7 @@ def test_fp8_shared_expert_fse_allows_symmetric_ignored_layers() -> None:
def test_fp8_shared_expert_fse_expands_packed_projections() -> None:
"""Both shards of a fused projection ignored is symmetric within that
projection, so the mismatch reported is against the routed experts.
"""
projection, so the mismatch reported is against the routed experts."""
quant_config = _fp8_config(
ignored_layers=[
"model.layers.0.mlp.shared_experts.gate_proj",
@@ -1344,8 +1343,7 @@ def test_fp8_shared_expert_fse_expands_packed_projections() -> None:
def test_fp8_shared_expert_fse_propagates_partial_shard_exclusion() -> None:
"""Half a fused projection excluded is rejected by `is_layer_skipped`
itself, exactly as it is in `Fp8Config.get_quant_method`.
"""
itself, exactly as it is in `Fp8Config.get_quant_method`."""
quant_config = _fp8_config(
ignored_layers=["model.layers.0.mlp.shared_experts.gate_proj"]
)
@@ -346,8 +346,7 @@ def test_deepseek_v32_dispatches_selected_mha(
def test_select_candidate_blocks_tolerates_empty_rows():
"""Full-cudagraph decode pads the batch with seq_len-0 rows. The newest
block pin must not index -1 for them (device-side assert); they select
no candidate blocks and real rows still pin their newest block.
"""
no candidate blocks and real rows still pin their newest block."""
block_size, topk_blocks = 8, 3
logits = torch.zeros(3, 64, device="cuda")
logits[0, 3] = 5.0 # block 0 scores highest for row 0
@@ -458,8 +457,7 @@ def test_candidate_kernels_preserve_packed_bounds_and_padding(
def _make_candidates(lens: torch.Tensor, num_candidates: int, cbk: int):
"""Production-faithful candidates: top min(avail, K) blocks per row —
full coverage for lens <= K*cbk, a fixed-size subset beyond that.
"""
full coverage for lens <= K*cbk, a fixed-size subset beyond that."""
avail = ((lens.cpu() + cbk - 1) // cbk).tolist()
rows = []
for a in avail:
@@ -495,8 +493,7 @@ def _candidate_token_mask(
def _reference_topk(masked: torch.Tensor, topk: int) -> torch.Tensor:
"""Plain ``torch.topk`` over -inf-masked logits; slots past a row's valid
count are -1 (the indexer's "no token" sentinel).
"""
count are -1 (the indexer's "no token" sentinel)."""
values, indices = masked.topk(topk, dim=1)
return torch.where(values > float("-inf"), indices.int(), -1)
@@ -509,8 +506,7 @@ def _assert_same_selection(
) -> None:
"""Both top-k index sets must pick the same multiset of logit values per
row (-1 padding must match too). Indices themselves may differ: the
top-k kernels break ties among equal values in nondeterministic order.
"""
top-k kernels break ties among equal values in nondeterministic order."""
for r in range(logits.shape[0]):
base = int(row_starts[r]) if row_starts is not None else 0
g, e = got[r][got[r] >= 0], expected[r][expected[r] >= 0]
@@ -522,8 +518,7 @@ def _assert_same_selection(
def _sparse_scratch(rows: int, num_sparse: int, topk: int) -> dict:
"""Caller-owned buffers the sparse path writes into (the metadata builder
owns these in production).
"""
owns these in production)."""
i32 = dict(dtype=torch.int32, device="cuda")
return dict(
sparse_indices=torch.zeros(rows, num_sparse, **i32),
@@ -538,8 +533,7 @@ def _expand_candidates_reference(
"""PyTorch reference for `candidate_blocks_to_sparse_indices`: expand
each candidate block into ``cbk // sbk`` sparse blocks, keep those inside
``[0, ke - ks)``, sort ascending, anchor at ``ks // sbk``, pad by
repeating the last valid block, and count the valid sparse columns.
"""
repeating the last valid block, and count the valid sparse columns."""
ratio = cbk // sbk
rows, num_candidates = candidates.shape
num_sparse = num_candidates * ratio
@@ -565,8 +559,7 @@ def _expand_candidates_reference(
@pytest.mark.skipif(not torch.cuda.is_available(), reason="Triton kernel")
def test_candidate_blocks_to_sparse_indices_math():
"""Candidate->sparse-block expansion: ks anchoring, range filtering,
repeat-last padding, and the per-row valid column count (``end``).
"""
repeat-last padding, and the per-row valid column count (``end``)."""
from vllm.model_executor.kernels.attention.dsa.sparse_mqa_logits import (
candidate_blocks_to_sparse_indices,
)
@@ -618,8 +611,7 @@ def test_candidate_blocks_to_sparse_indices_math():
def test_candidate_blocks_to_sparse_indices_matches_reference(cbk: int, sbk: int):
"""The Triton expansion equals the PyTorch reference on production-shaped
random inputs, including strided (column-sliced) candidate rows and
strided output buffers.
"""
strided output buffers."""
from vllm.model_executor.kernels.attention.dsa.sparse_mqa_logits import (
candidate_blocks_to_sparse_indices,
)
@@ -689,8 +681,7 @@ def test_sparse_mqa_logits_prefill_matches_dense_masked(capture: bool):
``torch.topk`` over dense bf16 logits masked to the candidates (the two
DeepGEMM kernels agree bitwise on candidate columns), incl. under CUDA
graph capture, and a later layer reusing the step's expansion/schedule
selects the same values.
"""
selects the same values."""
deep_gemm = _skip_unless_sm100_sparse_kernels()
from vllm.model_executor.kernels.attention.dsa.sparse_mqa_logits import (
sparse_mqa_logits_prefill_chunk,
@@ -780,8 +771,7 @@ def test_sparse_mqa_logits_prefill_matches_dense_masked(capture: bool):
def _build_fp4_paged_cache(req_lens: torch.Tensor, page_kv: int, head_dim: int):
"""MXFP4 paged cache in DeepGEMM's fused layout: per page, all tokens'
fp4 data first, then their packed UE8M0 scales.
"""
fp4 data first, then their packed UE8M0 scales."""
device = req_lens.device
pages_per = (req_lens + page_kv - 1) // page_kv
num_pages, max_pages = int(pages_per.sum()), int(pages_per.max())
@@ -817,8 +807,7 @@ def test_sparse_mqa_logits_paged_matches_dense_masked(next_n: int, capture: bool
"""Paged sparse-MQA decode selects exactly the values ``torch.topk`` picks
from the dense bf16 masked logits, incl. MTP rows (next_n > 1 flattened to
one query row each), CUDA graph capture/replay and schedule reuse by a
later layer.
"""
later layer."""
deep_gemm = _skip_unless_sm100_sparse_kernels()
from vllm.model_executor.kernels.attention.dsa.sparse_mqa_logits import (
sparse_mqa_logits_paged_decode,
@@ -927,8 +916,7 @@ def test_sparse_mqa_logits_paged_matches_dense_masked(next_n: int, capture: bool
def test_sparse_mqa_logits_accuracy_vs_torch():
"""Sparse-kernel numerics vs a PyTorch fp32 reference on the dequantized
MXFP4 inputs.
"""
MXFP4 inputs."""
_skip_unless_sm100_sparse_kernels()
from deep_gemm.utils import cast_back_from_fp4