Add pydocstyle to the ruff rules (#52136)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <hej.mellor@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Harry Mellor
2026-09-16 16:44:29 +00:00
committed by GitHub
co-authored by Claude Opus 5
parent 804e5377aa
commit 8c1557a79c
2002 changed files with 15024 additions and 14269 deletions
+2 -1
View File
@@ -63,7 +63,8 @@ _SPLIT_OCCUPANCY_MULTIPLIER = 2
def _compute_num_kv_splits(max_seq_len: int, num_threads: int) -> int:
"""Mirrors TritonMLAImpl's _compute_num_kv_splits, using the CPU thread
count in place of SM count."""
count in place of SM count.
"""
ideal_splits = 1
while ideal_splits < max(1, max_seq_len // _MIN_WORK_PER_SPLIT):
ideal_splits *= 2
@@ -437,7 +437,6 @@ class FlashMLASparseMetadataBuilder(
be the full batch or only decodes when prefills use dense MHA. This avoids
the BF16 prefill kernel's head-padding overhead at high TP.
"""
scheduler_metadata, _ = get_mla_metadata()
return FlashMLASparseMetadata.FP8KernelMetadata(
scheduler_metadata=scheduler_metadata,
@@ -848,7 +847,8 @@ class FlashMLASparseImpl(SparseMLACommonImpl[FlashMLASparseMetadata]):
prefill_meta: "FlashMLASparseMetadata.FP8SeparatePrefillDecode.Prefill",
) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
"""All-gather this rank's upconverted KV shard so the chunk's rows attend
the whole context, and map their top-k onto the rank-major result."""
the whole context, and map their top-k onto the rank-major result.
"""
shard_rows = int(chunk.chunk_tot_seqlen)
assert self.gathered_kv_workspace is not None
gathered_kv = self.gathered_kv_workspace[: self.dcp_world_size * shard_rows]
+2 -1
View File
@@ -1118,7 +1118,8 @@ class DeepseekV32IndexerMetadataBuilder(AttentionMetadataBuilder):
def _prefill_split_seq_lens(self, seq_lens_cpu: torch.Tensor) -> torch.Tensor:
"""Per-request KV lengths the prefill chunker budgets logits with;
subclasses whose logits rows are wider than the context override."""
subclasses whose logits rows are wider than the context override.
"""
return seq_lens_cpu
@staticmethod
@@ -24,7 +24,7 @@ if TYPE_CHECKING:
class AiterFlashAttnPrefillBackend(MLAPrefillBackend):
"""AITER FlashAttention backend for MLA prefill"""
"""AITER FlashAttention backend for MLA prefill."""
@staticmethod
def get_name() -> str:
@@ -70,7 +70,8 @@ class MLAPrefillBackend(ABC):
def supports_quant_output(self, quant_key: "QuantKey") -> bool:
"""Whether `run_prefill_new_tokens` can write quantized output
directly (fused) for the given quant key, skipping the post-quant
pass. Overridden by backends that support it."""
pass. Overridden by backends that support it.
"""
return False
def supports_out(self) -> bool:
@@ -65,6 +65,7 @@ class MLAPrefillBackendEnum(Enum, metaclass=_MLAPrefillBackendEnumMeta):
Raises:
ValueError: If Backend.CUSTOM is used without being registered
"""
path = _MLA_PREFILL_OVERRIDES.get(self, self.value)
if not path:
@@ -85,6 +86,7 @@ class MLAPrefillBackendEnum(Enum, metaclass=_MLAPrefillBackendEnumMeta):
Raises:
ImportError: If the backend class cannot be imported
ValueError: If CUSTOM is used without being registered
"""
return resolve_obj_by_qualname(self.get_path())
@@ -130,6 +132,7 @@ def register_mla_prefill_backend(
MLAPrefillBackendEnum.CUSTOM,
"my.module.MyCustomPrefillBackend"
)
"""
def decorator(cls: type) -> type:
@@ -57,6 +57,7 @@ def _get_mla_prefill_backend_priorities(
Returns:
List of backends in priority order (highest priority first).
"""
from vllm.platforms import current_platform
@@ -104,6 +105,7 @@ def get_mla_prefill_backend(
Returns:
The selected prefill backend class.
"""
from vllm.platforms import current_platform
@@ -173,6 +175,7 @@ def _auto_select_mla_prefill_backend(
Returns:
The selected prefill backend class.
"""
priorities = _get_mla_prefill_backend_priorities(
device_capability,
@@ -710,6 +710,7 @@ class AiterMLAMetadataBuilder(MLACommonMetadataBuilder[AiterMLAMetadata]):
attn_out_dtype: Dtype of the attention output buffer, used to size
the padded-head output scratch (small head counts only).
device: Target device for the buffers.
"""
from aiter import get_ps_metadata_info_v1
@@ -1328,8 +1329,7 @@ def _expand_page_indices_kernel(
class AiterMLAHelper:
"""
AITER MLA persistent (asm) decode requires a multiple of 16 heads. Unaligned
"""AITER MLA persistent (asm) decode requires a multiple of 16 heads. Unaligned
head counts through 128 are padded to the next multiple of 16 by tiling the
query heads and slicing to the padded size. Native H24 AITER builds bypass
that padding. Small divisors of 16 retain the existing repeat_interleave and
@@ -167,8 +167,7 @@ def triton_convert_req_index_to_global_index(
NUM_TOPK_TOKENS: int = 2048,
BLOCK_N: int = 128, # tile width along columns
):
"""
out[token_id, indice_id] =
"""out[token_id, indice_id] =
block_table[req_id[token_id],
token_indices[token_id, indice_id] // BLOCK_SIZE] * BLOCK_SIZE
+ token_indices[token_id, indice_id] % BLOCK_SIZE
@@ -426,6 +426,7 @@ def _remap_tiling(
Returns:
(single_tile, block_n, tiles_per_row, num_warps)
"""
single_tile = (
count_valid and triton.next_power_of_2(NUM_TOPK_TOKENS) == NUM_TOPK_TOKENS
@@ -454,8 +455,7 @@ def triton_convert_req_index_to_global_index(
out: torch.Tensor | None = None,
valid_counts_out: torch.Tensor | None = None,
) -> torch.Tensor | tuple[torch.Tensor, torch.Tensor]:
"""
out[token_id, indice_id] =
"""out[token_id, indice_id] =
block_table[req_id[token_id],
token_indices[token_id, indice_id] // BLOCK_SIZE] * BLOCK_SIZE
+ token_indices[token_id, indice_id] % BLOCK_SIZE