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:
co-authored by
Claude Opus 5
parent
804e5377aa
commit
8c1557a79c
@@ -245,8 +245,8 @@ def _dequantize_fp8_ds_mla_entry(
|
||||
Args:
|
||||
simulate_sm100_e8m0_scales: If True, simulate the SM100 kernel's
|
||||
float -> e8m0 -> bf16 scale conversion path.
|
||||
"""
|
||||
|
||||
"""
|
||||
# The first kv_lora_rank bytes store FP8 latent values with one scale per
|
||||
# 128 element tile written as float32 right after the latent payload.
|
||||
scales = cache_slice.view(torch.float32)[kv_lora_rank // 4 : kv_lora_rank // 4 + 4]
|
||||
@@ -283,8 +283,8 @@ def _quantize_dequantize_fp8_ds_mla(
|
||||
Args:
|
||||
simulate_sm100_e8m0_scales: If True, simulate the SM100 kernel's
|
||||
float -> e8m0 -> bf16 scale conversion in dequantization.
|
||||
"""
|
||||
|
||||
"""
|
||||
if kv_c.numel() == 0:
|
||||
return kv_c.clone(), k_pe.clone()
|
||||
|
||||
@@ -909,7 +909,8 @@ def test_index_group_convert_during_piecewise_capture():
|
||||
runs in the following eager break. The convert's side stream must not
|
||||
wait on ``logical_topk_ready`` there: an event recorded inside a captured
|
||||
segment is graph-local, and an eager wait on it raises
|
||||
cudaErrorInvalidValue."""
|
||||
cudaErrorInvalidValue.
|
||||
"""
|
||||
device = torch.device(DEVICE_TYPE)
|
||||
num_tokens, num_topk, num_requests, blocks_per_req, block_size = 8, 128, 4, 4, 16
|
||||
|
||||
@@ -1048,7 +1049,8 @@ def test_triton_convert_rejects_req_id_longer_than_token_indices():
|
||||
req_id but the output is allocated like token_indices, so a full-batch
|
||||
req_id combined with an MQA-subset token_indices wrote past the end of
|
||||
the output buffer. The wrapper must reject the length mismatch instead
|
||||
of corrupting memory."""
|
||||
of corrupting memory.
|
||||
"""
|
||||
device = torch.device(DEVICE_TYPE)
|
||||
num_topk_tokens = 128
|
||||
block_size = 64
|
||||
@@ -1103,7 +1105,8 @@ def test_flashmla_forward_bf16_kv_slices_req_id_to_mqa_tokens():
|
||||
is active, forward_mqa only receives the leading decode tokens, but
|
||||
_forward_bf16_kv passed the full-batch req_id_per_token to the index
|
||||
conversion, making it write past the end of its output buffer. The call
|
||||
site must slice req_id_per_token to the MQA tokens."""
|
||||
site must slice req_id_per_token to the MQA tokens.
|
||||
"""
|
||||
device = torch.device(DEVICE_TYPE)
|
||||
num_topk_tokens = 128
|
||||
block_size = 64
|
||||
@@ -1201,7 +1204,8 @@ def test_split_prefill_chunks(seq_lens, max_buf, expected):
|
||||
)
|
||||
def test_masked_mha_workspace_fits_single_request_boundary(max_query_len, expected):
|
||||
"""A 32K prefill needs the default workspace exactly; shrinking it would
|
||||
push a supported request onto MQA."""
|
||||
push a supported request onto MQA.
|
||||
"""
|
||||
assert (
|
||||
_masked_mha_workspace_fits(
|
||||
batch_size=1,
|
||||
@@ -1259,7 +1263,8 @@ def test_is_masked_mha_available_model_dims(
|
||||
):
|
||||
"""The allow-list gates masked MHA per exact model geometry: the DeepSeek-V3.2,
|
||||
GLM-5 and NoPE GLM-5.3-Flash layouts on an SM100-family GPU with FA4 and an
|
||||
unquantized KV cache, nothing else."""
|
||||
unquantized KV cache, nothing else.
|
||||
"""
|
||||
import vllm.model_executor.layers.attention.sparse_mla_attention as mod
|
||||
|
||||
monkeypatch.setattr(
|
||||
@@ -3599,7 +3604,8 @@ def test_fp8_mixed_batch_dcp_neutralizes_empty_rows(monkeypatch):
|
||||
"""A decode row whose top-k shard holds no local candidates (all -1) has
|
||||
undefined kernel out/lse; it must come back as (0, -inf), the identity of
|
||||
the cross-rank LSE merge, or a NaN would survive the merge even at zero
|
||||
weight (0 * NaN = NaN)."""
|
||||
weight (0 * NaN = NaN).
|
||||
"""
|
||||
num_tokens, num_heads, head_dim = 3, 2, 3
|
||||
q = torch.empty(num_tokens, num_heads, head_dim, device=DEVICE_TYPE)
|
||||
local_indices = torch.tensor(
|
||||
@@ -3772,7 +3778,8 @@ def test_hisparse_fp8_prefill_gather_uses_dedicated_stream(monkeypatch):
|
||||
def test_sparse_impl_observes_repointed_indexer_buffer():
|
||||
"""The MTP proposer repoints the draft's indexer at the target model's buffer
|
||||
after the backend impl is built, so the impl must resolve the buffer per read.
|
||||
Snapshotting it in __init__ leaves the layer reading indices nothing writes."""
|
||||
Snapshotting it in __init__ leaves the layer reading indices nothing writes.
|
||||
"""
|
||||
impl = object.__new__(FlashInferMLASparseImpl)
|
||||
own = torch.zeros(4, 8, dtype=torch.int32)
|
||||
target = torch.ones(4, 8, dtype=torch.int32)
|
||||
@@ -3788,7 +3795,8 @@ def test_sparse_impl_observes_repointed_indexer_buffer():
|
||||
|
||||
def test_explicit_topk_buffer_supersedes_indexer():
|
||||
"""Backbone skip-topk layers have no indexer, and the proposer also assigns the
|
||||
shared buffer directly onto draft submodules."""
|
||||
shared buffer directly onto draft submodules.
|
||||
"""
|
||||
impl = object.__new__(FlashInferMLASparseImpl)
|
||||
indexer = SimpleNamespace(
|
||||
topk_indices_buffer=torch.zeros(2, 2, dtype=torch.int32),
|
||||
@@ -3803,7 +3811,8 @@ def test_explicit_topk_buffer_supersedes_indexer():
|
||||
|
||||
def test_sparse_mla_common_impl_resolves_buffer_lazily():
|
||||
"""Guards the whole SparseMLACommonImpl family at once: a backend that
|
||||
snapshots the buffer instead silently loses MTP buffer sharing."""
|
||||
snapshots the buffer instead silently loses MTP buffer sharing.
|
||||
"""
|
||||
assert issubclass(SparseMLACommonImpl, SharedTopkIndicesBuffer)
|
||||
assert isinstance(SparseMLACommonImpl.topk_indices_buffer, property), (
|
||||
"topk_indices_buffer must stay a lazily-resolved property"
|
||||
|
||||
Reference in New Issue
Block a user