[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:
co-authored by
Claude Opus 5
parent
1085b64425
commit
651a88c09a
@@ -472,8 +472,7 @@ class CopyRun:
|
||||
"""A strided byte correspondence between this worker's physical page and
|
||||
a canonical page: for i in range(num_fragments), fragment i spans
|
||||
[local_offset + i * local_stride, +fragment_size) in the worker's page and
|
||||
[canonical_offset + i * canonical_stride, +fragment_size) canonically.
|
||||
"""
|
||||
[canonical_offset + i * canonical_stride, +fragment_size) canonically."""
|
||||
|
||||
local_offset: int
|
||||
canonical_offset: int
|
||||
@@ -554,8 +553,7 @@ class TransferResult:
|
||||
class OffloadingWorker(ABC):
|
||||
"""Runs in the worker process. Performs async KV transfers for ONE
|
||||
offloaded medium (e.g. CPU). Direction is explicit via submit_store /
|
||||
submit_load, so there is no (src_medium, dst_medium) routing.
|
||||
"""
|
||||
submit_load, so there is no (src_medium, dst_medium) routing."""
|
||||
|
||||
@abstractmethod
|
||||
def submit_store(
|
||||
|
||||
@@ -126,8 +126,7 @@ def compute_sub_block_ptrs(
|
||||
class CopyPlan(NamedTuple):
|
||||
"""Precomputed fragment-copy template for one data ref under the canonical
|
||||
CPU layout, unrolled from the ref's mapped runs. Offsets are relative to
|
||||
the per-block base pointers on each side.
|
||||
"""
|
||||
the per-block base pointers on each side."""
|
||||
|
||||
frag_offsets_src: np.ndarray
|
||||
frag_offsets_dst: np.ndarray
|
||||
@@ -165,8 +164,7 @@ def _canonical_page_ids(
|
||||
) -> np.ndarray:
|
||||
"""Global canonical page ids matching compute_sub_block_ptrs' enumeration.
|
||||
These identify canonical pages consistently across ranks, so they key
|
||||
CanonicalPageMapping.is_writer rotation.
|
||||
"""
|
||||
CanonicalPageMapping.is_writer rotation."""
|
||||
if blocks_per_chunk == 1:
|
||||
return block_ids[:count]
|
||||
flat = (
|
||||
@@ -179,8 +177,7 @@ def _canonical_block_sizes(
|
||||
layer_refs_per_group: list[list[CanonicalKVCacheRef]], num_tensors: int
|
||||
) -> list[int]:
|
||||
"""Canonical CPU bytes per GPU block for each tensor, taken from the refs'
|
||||
mappings. Requires every ref to carry a mapping.
|
||||
"""
|
||||
mappings. Requires every ref to carry a mapping."""
|
||||
canonical_bytes_per_block = [0] * num_tensors
|
||||
for layer_refs in layer_refs_per_group:
|
||||
for ref in layer_refs:
|
||||
@@ -343,8 +340,7 @@ class SingleDirectionOffloadingHandler:
|
||||
"""Upper bound on the number of copy descriptors for a transfer.
|
||||
|
||||
Exact for the direct layout. The canonical path may fill fewer:
|
||||
writer rotation later drops the blocks this rank does not write.
|
||||
"""
|
||||
writer rotation later drops the blocks this rank does not write."""
|
||||
num_copy_ops = 0
|
||||
for g_idx, (group_size, layer_refs) in enumerate(
|
||||
zip(group_sizes, self.layer_refs_per_group)
|
||||
@@ -373,8 +369,7 @@ class SingleDirectionOffloadingHandler:
|
||||
"""Fill one group's copy descriptors for the direct (worker-private)
|
||||
layout: one whole-page copy per (block, ref).
|
||||
|
||||
Returns (op_idx past the filled descriptors, bytes added).
|
||||
"""
|
||||
Returns (op_idx past the filled descriptors, bytes added)."""
|
||||
num_bytes = 0
|
||||
for data_ref in self.layer_refs_per_group[g_idx]:
|
||||
t_idx = data_ref.tensor_idx
|
||||
@@ -417,8 +412,7 @@ class SingleDirectionOffloadingHandler:
|
||||
scatter each block through the ref's precomputed CopyPlan, keeping
|
||||
only the blocks this rank writes.
|
||||
|
||||
Returns (op_idx past the filled descriptors, bytes added).
|
||||
"""
|
||||
Returns (op_idx past the filled descriptors, bytes added)."""
|
||||
assert self._canonical_copy_plans is not None
|
||||
# Zero-copy reinterpretation for pointer arithmetic: uint64 and the
|
||||
# buffers' int64 are bit-equivalent for addresses
|
||||
@@ -505,8 +499,7 @@ class SingleDirectionOffloadingHandler:
|
||||
) -> tuple[np.ndarray, np.ndarray]:
|
||||
"""Keep only the blocks this rank writes: replicated ranks take turns
|
||||
writing shared canonical pages, keyed by the rank-consistent CPU-side
|
||||
canonical page id.
|
||||
"""
|
||||
canonical page id."""
|
||||
cpu_page_ids = _canonical_page_ids(
|
||||
group_dst,
|
||||
self.dst_blocks_per_chunk,
|
||||
|
||||
@@ -28,8 +28,7 @@ def _all_workers_barrier() -> None:
|
||||
"""Block until every worker rank has reached this point (gloo cpu group).
|
||||
|
||||
A superset of the node-local mmap openers suffices: once the barrier
|
||||
releases, every worker sharing the region file has mapped it.
|
||||
"""
|
||||
releases, every worker sharing the region file has mapped it."""
|
||||
from vllm.distributed.parallel_state import (
|
||||
get_inner_dp_world_group,
|
||||
get_world_group,
|
||||
@@ -162,8 +161,7 @@ class CPUOffloadingSpec(OffloadingSpec):
|
||||
|
||||
def _uses_shared_region(self) -> bool:
|
||||
"""Whether the worker CPU buffer is the shared mmap region (vs a private
|
||||
per-rank tensor); replicated-layout dedup is gated on this being True.
|
||||
"""
|
||||
per-rank tensor); replicated-layout dedup is gated on this being True."""
|
||||
return current_platform.is_cuda_alike()
|
||||
|
||||
def create_worker(self, kv_caches: CanonicalKVCaches) -> CPUOffloadingWorker:
|
||||
|
||||
@@ -216,8 +216,7 @@ class AsyncLookupManager(ABC):
|
||||
def mark_miss(self, keys: Collection[OffloadKey]) -> None:
|
||||
"""Force the cached verdict for ``keys`` to False after a failed load, so
|
||||
the scheduler stops re-issuing the doomed promotion (livelock, #49176).
|
||||
Keys with no cached entry are skipped.
|
||||
"""
|
||||
Keys with no cached entry are skipped."""
|
||||
for key in keys:
|
||||
state = self._lookup_state.get(key)
|
||||
if state is not None:
|
||||
|
||||
@@ -168,8 +168,7 @@ class ExampleSecondaryTierManager(SecondaryTierManager):
|
||||
@override
|
||||
def drain_jobs(self) -> None:
|
||||
"""Synchronous tier — submit_*() returns only after the operation
|
||||
completes, so there is nothing to wait for.
|
||||
"""
|
||||
completes, so there is nothing to wait for."""
|
||||
return
|
||||
|
||||
def get_num_chunks(self) -> int:
|
||||
|
||||
@@ -139,8 +139,7 @@ def _load_block(
|
||||
) -> None:
|
||||
"""Read one KV block from disk; remove the file only on a provable short
|
||||
read (a too-short file is genuine corruption) and leave it untouched on any
|
||||
other error.
|
||||
"""
|
||||
other error."""
|
||||
fd: int | None = None
|
||||
view_slice = view.cast("B")[offset : offset + block_size]
|
||||
o_direct = O_DIRECT if use_o_direct else 0
|
||||
|
||||
@@ -269,8 +269,7 @@ class FileSystemTierManager(SecondaryTierManager):
|
||||
@override
|
||||
def get_finished_jobs(self) -> Iterable[JobResult]:
|
||||
"""Collect finished jobs; a failed promotion marks only its failed keys
|
||||
as a miss here (scheduler thread).
|
||||
"""
|
||||
as a miss here (scheduler thread)."""
|
||||
results = []
|
||||
for job_id, success, transfer_time in self._pool.get_finished():
|
||||
if self.events is not None:
|
||||
|
||||
@@ -143,8 +143,7 @@ class CPUPrimaryTierOffloadingManager(CPUOffloadingManager):
|
||||
|
||||
class _SecondaryTierFacingParent(ParentManager):
|
||||
"""Wrapper that implements ParentManager by delegating to the
|
||||
TieringOffloadingManager with exclude_tier_idx set to the origin tier.
|
||||
"""
|
||||
TieringOffloadingManager with exclude_tier_idx set to the origin tier."""
|
||||
|
||||
__slots__ = ("_m", "_origin_idx")
|
||||
|
||||
|
||||
@@ -308,8 +308,7 @@ class ObjectStoreSecondaryTierManager(SecondaryTierManager):
|
||||
|
||||
def _poll_active_transfers(self) -> None:
|
||||
"""Poll all in-flight transfers once; move newly-completed (success or
|
||||
failure) into ``_pending_results`` and release their NIXL handles.
|
||||
"""
|
||||
failure) into ``_pending_results`` and release their NIXL handles."""
|
||||
for job_id, entry in list(self._transfers.items()):
|
||||
try:
|
||||
state = self._agent.check_xfer_state(entry.xfer_handle)
|
||||
@@ -364,8 +363,7 @@ class ObjectStoreSecondaryTierManager(SecondaryTierManager):
|
||||
|
||||
def get_finished_jobs(self) -> Iterable[JobResult]:
|
||||
"""Poll transfers; a failed promotion marks its cached verdicts False
|
||||
here (scheduler thread).
|
||||
"""
|
||||
here (scheduler thread)."""
|
||||
self._poll_active_transfers()
|
||||
results = self._pending_results
|
||||
self._pending_results = []
|
||||
|
||||
@@ -134,8 +134,7 @@ class P2PDestInfo:
|
||||
|
||||
def _parse_source(kv_params: dict | None) -> P2PSourceInfo | None:
|
||||
"""Parse the consumer sub-dict (PD ``remote_prefiller`` or symmetric
|
||||
``remote_kv_source``) into a ``P2PSourceInfo``, or None if absent/incomplete.
|
||||
"""
|
||||
``remote_kv_source``) into a ``P2PSourceInfo``, or None if absent/incomplete."""
|
||||
role = _remote_prefiller_params(kv_params)
|
||||
do_probe = False
|
||||
if role is None:
|
||||
@@ -156,8 +155,7 @@ def _parse_source(kv_params: dict | None) -> P2PSourceInfo | None:
|
||||
|
||||
def _parse_dest(kv_params: dict | None) -> P2PDestInfo | None:
|
||||
"""Parse the producer ``remote_decoder`` sub-dict into a ``P2PDestInfo``,
|
||||
or None if the block is absent (not a remote-decode request).
|
||||
"""
|
||||
or None if the block is absent (not a remote-decode request)."""
|
||||
role = _remote_decoder_params(kv_params)
|
||||
if role is None:
|
||||
return None
|
||||
|
||||
@@ -414,8 +414,7 @@ class TieringOffloadingSpec(CPUOffloadingSpec):
|
||||
"""Require a mapping on every ref and record layer portability.
|
||||
|
||||
Fails loudly rather than persist direct-layout bytes under a
|
||||
canonical format identity.
|
||||
"""
|
||||
canonical format identity."""
|
||||
all_refs = [
|
||||
ref for group_refs in kv_caches.group_data_refs for ref in group_refs
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user