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
@@ -415,8 +415,7 @@ def postprocess_mamba_fused_kernel(
|
||||
# the existing 2D-grid contract.
|
||||
TEMPORAL_TILES: tl.constexpr = 1,
|
||||
):
|
||||
"""
|
||||
Fused GPU kernel for postprocess_mamba that computes decisions AND performs
|
||||
"""Fused GPU kernel for postprocess_mamba that computes decisions AND performs
|
||||
mamba state copies without any CPU-GPU synchronization.
|
||||
|
||||
Grid: (num_reqs, num_states [, TEMPORAL_TILES])
|
||||
@@ -769,8 +768,7 @@ class MambaCopyBuffers:
|
||||
|
||||
@dataclasses.dataclass
|
||||
class MambaSpecDecodeGPUContext:
|
||||
"""
|
||||
Context for GPU-side Mamba state copy operations during the
|
||||
"""Context for GPU-side Mamba state copy operations during the
|
||||
fused postprocess path.
|
||||
|
||||
Only used when speculative decoding is enabled on a hybrid model
|
||||
@@ -927,8 +925,7 @@ class MambaSpecDecodeGPUContext:
|
||||
mamba_state_copy_funcs: MambaStateCopyFuncsByType,
|
||||
block_tables: list[torch.Tensor],
|
||||
) -> None:
|
||||
"""
|
||||
Extract and cache memory layout metadata from Mamba state tensors.
|
||||
"""Extract and cache memory layout metadata from Mamba state tensors.
|
||||
|
||||
This method populates the pre-allocated metadata tensors with information
|
||||
needed by `postprocess_mamba_fused_kernel` to perform state copies entirely
|
||||
@@ -960,6 +957,7 @@ class MambaSpecDecodeGPUContext:
|
||||
block_tables: per-mamba-group persistent block-table tensors, in
|
||||
the same order as `mamba_group_ids`. Their `data_ptr()` /
|
||||
`stride(0)` are captured once for the kernel to index into.
|
||||
|
||||
"""
|
||||
if self.is_initialized:
|
||||
return
|
||||
@@ -1096,7 +1094,7 @@ class MambaSpecDecodeGPUContext:
|
||||
seq_lens: torch.Tensor,
|
||||
num_reqs: int,
|
||||
) -> torch.Tensor:
|
||||
"""compute every Mamba group's aligned physical state IDs in one launch."""
|
||||
"""Compute every Mamba group's aligned physical state IDs in one launch."""
|
||||
assert self.is_initialized
|
||||
assert seq_lens.is_cuda
|
||||
assert 0 <= num_reqs <= seq_lens.shape[0]
|
||||
@@ -1137,8 +1135,7 @@ class MambaSpecDecodeGPUContext:
|
||||
num_computed_tokens_gpu: torch.Tensor,
|
||||
num_draft_tokens_gpu: torch.Tensor,
|
||||
) -> None:
|
||||
"""
|
||||
Run the fused postprocess_mamba kernel on GPU.
|
||||
"""Run the fused postprocess_mamba kernel on GPU.
|
||||
|
||||
This computes decisions and performs mamba state copies entirely on GPU,
|
||||
eliminating the CPU-GPU sync that was previously needed.
|
||||
@@ -1150,6 +1147,7 @@ class MambaSpecDecodeGPUContext:
|
||||
num_scheduled_tokens_gpu: [num_reqs] scheduled token counts
|
||||
num_computed_tokens_gpu: [num_reqs] computed token counts
|
||||
num_draft_tokens_gpu: [num_reqs] draft token counts
|
||||
|
||||
"""
|
||||
if num_reqs == 0 or not self.is_initialized:
|
||||
return
|
||||
@@ -1205,6 +1203,7 @@ class MambaSpecDecodeGPUContext:
|
||||
token_bias_gpu: [max_reqs] accepted-token bias (num_accepted - 1).
|
||||
idx_mapping: optional [num_reqs] batch_idx -> req_state_idx.
|
||||
None means V1 batch order already equals request state order.
|
||||
|
||||
"""
|
||||
if num_reqs == 0 or not self.is_initialized:
|
||||
return
|
||||
@@ -1442,8 +1441,7 @@ def preprocess_mamba(
|
||||
copy_bufs: MambaCopyBuffers,
|
||||
align_ctx: MambaSpecDecodeGPUContext | None = None,
|
||||
):
|
||||
"""
|
||||
Copy the mamba state of previous step to the last
|
||||
"""Copy the mamba state of previous step to the last
|
||||
(1 + num_speculative_blocks) block.
|
||||
"""
|
||||
fused = _resolve_fused_precopy(align_ctx)
|
||||
|
||||
Reference in New Issue
Block a user