[Mini-VLLM] Remove the ROCm device path, debug routes and arch-gated tests
- Delete csrc/rocm, hipify, the _rocm_C extension and the setup.py rocm target path; drop the rocm requirement files - Delete the aiter, rdna3, skinny-gemm and ROCm fused-MoE kernel modules and retarget the linear kernel registries away from them - Reduce platforms/rocm.py to the GCN architecture predicates that live code still imports, and delete the RocmPlatform class and plugin - Drop the VLLM_SERVER_DEV_MODE debug surface: reset, collective_rpc, server_info and sleep routes plus the log_error_stack flag - Delete lm-format-enforcer, lark and otel-semantic-conventions-ai pins; the live server process maps none of them - Delete tests that only build architectures this fork no longer registers, and test directories left without any test file - Restore the tests/v1/kv_connector mock helpers that scheduler tests import at module level Co-authored-by: Hinata <hinata@idihore.id> Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
@@ -1,146 +0,0 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""vLLM-owned wrapper over AITER's ``CustomAllreduce``.
|
||||
|
||||
vLLM's ``CudaCommunicator`` stores one of these as ``aiter_ar_comm`` (when
|
||||
``VLLM_ROCM_USE_AITER_CUSTOM_AR`` is set) so the plain allreduce and
|
||||
the fused allreduce+RMSNorm path share a single AITER instance with its IPC buffers.
|
||||
|
||||
"""
|
||||
|
||||
import torch
|
||||
from torch.distributed import ProcessGroup
|
||||
|
||||
from vllm.logger import init_logger
|
||||
|
||||
logger = init_logger(__name__)
|
||||
|
||||
|
||||
class AiterCustomAllreduce:
|
||||
# Default IPC buffer size for AITER's CustomAllreduce.
|
||||
MAX_SIZE: int = 8192 * 1024 * 8 * 2
|
||||
|
||||
@classmethod
|
||||
def effective_max_size(cls) -> int:
|
||||
"""Max input byte size eligible for AITER custom allreduce."""
|
||||
return cls.MAX_SIZE // 2
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
group: ProcessGroup,
|
||||
device: int | str | torch.device,
|
||||
max_size: int | None = None,
|
||||
*,
|
||||
register_graph_buffers: bool = True,
|
||||
):
|
||||
from aiter.dist.device_communicators.custom_all_reduce import (
|
||||
CustomAllreduce as _AiterCustomAllreduce,
|
||||
)
|
||||
|
||||
if max_size is None:
|
||||
max_size = self.MAX_SIZE
|
||||
|
||||
kwargs = {}
|
||||
if not register_graph_buffers:
|
||||
kwargs["enable_register_for_capturing"] = False
|
||||
self._impl = _AiterCustomAllreduce(group, device, max_size=max_size, **kwargs)
|
||||
|
||||
@property
|
||||
def aiter_ca(self):
|
||||
return self._impl
|
||||
|
||||
@property
|
||||
def disabled(self) -> bool:
|
||||
return self._impl.disabled
|
||||
|
||||
def should_custom_ar(self, inp: torch.Tensor) -> bool:
|
||||
return self._impl.should_custom_ar(inp)
|
||||
|
||||
def custom_all_reduce(self, inp: torch.Tensor) -> torch.Tensor | None:
|
||||
return self._impl.custom_all_reduce(inp)
|
||||
|
||||
def should_custom_ag(self, inp: torch.Tensor) -> bool:
|
||||
return self._impl.should_custom_ag(inp)
|
||||
|
||||
def should_custom_rs(self, inp: torch.Tensor, dim: int) -> bool:
|
||||
return self._impl.should_custom_rs(inp, dim)
|
||||
|
||||
def custom_all_gather(self, inp: torch.Tensor, dim: int = 0) -> torch.Tensor | None:
|
||||
return self._impl.custom_all_gather(inp, dim=dim)
|
||||
|
||||
def custom_reduce_scatter(
|
||||
self, inp: torch.Tensor, out: torch.Tensor, dim: int = 0
|
||||
) -> torch.Tensor | None:
|
||||
return self._impl.custom_reduce_scatter(inp, out, dim=dim)
|
||||
|
||||
def use_1stage_fused_ar_rms(self, inp: torch.Tensor) -> bool:
|
||||
"""Whether AITER's fused allreduce+RMSNorm runs as its one-stage kernel.
|
||||
|
||||
Mirrors the launcher contract of aiter's ``fused_allreduce_rmsnorm``
|
||||
(csrc/include/custom_all_reduce.cuh): rows of 16-byte packs, at most
|
||||
1024 packs per row, at most 80 tokens, and the byte cap of the
|
||||
one-stage custom allreduce for this TP size and topology. Outside it
|
||||
the fused op runs the two-stage variant (cross-device reduce-scatter
|
||||
+ local norm), which is slower than an explicit ``all_reduce`` + norm,
|
||||
so callers that can fall back should require this. Capture-static:
|
||||
depends only on shape, dtype, TP size and topology.
|
||||
"""
|
||||
hidden_dim = inp.shape[-1]
|
||||
# Token cap first: prefill-sized inputs leave here with one comparison.
|
||||
if inp.numel() // hidden_dim > 80:
|
||||
return False
|
||||
if inp.dtype not in (torch.bfloat16, torch.float16):
|
||||
return False
|
||||
pack_size = 16 // inp.element_size()
|
||||
if hidden_dim % pack_size != 0 or hidden_dim // pack_size > 1024:
|
||||
return False
|
||||
ca = self._impl
|
||||
world_size = ca.world_size
|
||||
if world_size == 2:
|
||||
return True
|
||||
if not ca.fully_connected:
|
||||
return False
|
||||
total_bytes = inp.numel() * inp.element_size()
|
||||
if world_size <= 4:
|
||||
return total_bytes < 256 * 1024
|
||||
if world_size <= 8:
|
||||
return total_bytes < 128 * 1024
|
||||
return False
|
||||
|
||||
def capture(self):
|
||||
return self._impl.capture()
|
||||
|
||||
def close(self) -> None:
|
||||
self._impl.close()
|
||||
|
||||
@property
|
||||
def supports_dynamic_hidden_dim(self) -> bool:
|
||||
"""Aiter's fused_allreduce_rmsnorm kernel dispatches on hidden_dim.
|
||||
Before aiter v0.1.12 the launcher was template-specialized on HIDDEN_DIM
|
||||
and silently no-op'd for sizes outside {512, 1024, 2048, 4096}. From v0.1.12
|
||||
hidden_dim is a runtime argument. Older builds are detected via
|
||||
AiterCustomAllreduce.supports_dynamic_hidden_dim; This function is used to
|
||||
skip fusion for unsupported sizes on them.
|
||||
Ref (old kernel): https://github.com/ROCm/aiter/blob/6a0e7b26ccf33164785531212cc2ec2cde0b9243/csrc/include/custom_all_reduce.cuh#L2590
|
||||
"""
|
||||
return hasattr(self._impl, "_pool")
|
||||
|
||||
@staticmethod
|
||||
def build_supports_per_group_quant() -> bool:
|
||||
"""True if the running AITER build exposes the per-group AR+RMS+quant
|
||||
kernel (added in ROCm/aiter PR #2823).
|
||||
|
||||
The pattern registration in ``RocmAiterAllReduceFusionPass`` keys off
|
||||
this so vLLM degrades to the AR+RMS-only fusion when run against an
|
||||
older aiter that lacks the per-group launcher.
|
||||
"""
|
||||
from aiter.dist.device_communicators.custom_all_reduce import (
|
||||
CustomAllreduce as _AiterCustomAllreduce,
|
||||
)
|
||||
|
||||
return hasattr(_AiterCustomAllreduce, "fused_ar_rms_per_group_quant")
|
||||
|
||||
# TODO(frida-andersson): drop once vLLM pins AITER >= 0.1.14 (ROCm/aiter#2823).
|
||||
@property
|
||||
def supports_per_group_quant(self) -> bool:
|
||||
return self.build_supports_per_group_quant()
|
||||
@@ -22,7 +22,6 @@ from vllm.logger import init_logger
|
||||
from vllm.platforms import current_platform
|
||||
|
||||
from ..utils import StatelessProcessGroup
|
||||
from .aiter_custom_all_reduce import AiterCustomAllreduce
|
||||
from .base_device_communicator import DeviceCommunicatorBase
|
||||
|
||||
logger = init_logger(__name__)
|
||||
@@ -117,7 +116,7 @@ class CudaCommunicator(DeviceCommunicatorBase):
|
||||
self.symm_mem_comm: SymmMemCommunicator | None = None
|
||||
self.fi_ar_comm: FlashInferAllReduce | None = None
|
||||
self.fi_pcie_ipc_ar_comm: FlashInferPcieIpcAllReduce | None = None
|
||||
self.aiter_ar_comm: AiterCustomAllreduce | None = None
|
||||
self.aiter_ar_comm = None
|
||||
self.use_aiter_ag_rs: bool = False
|
||||
|
||||
# cuMem graph buffers cannot be IPC-registered; capture copies them instead.
|
||||
@@ -147,12 +146,6 @@ class CudaCommunicator(DeviceCommunicatorBase):
|
||||
device=self.device,
|
||||
)
|
||||
|
||||
if self.use_aiter_allreduce and self.world_size > 1:
|
||||
self.aiter_ar_comm = AiterCustomAllreduce(
|
||||
group=self.cpu_group,
|
||||
device=self.device,
|
||||
register_graph_buffers=register,
|
||||
)
|
||||
|
||||
if use_custom_allreduce and self.aiter_ar_comm is None and self.world_size > 1:
|
||||
# Initialize a custom fast all-reduce implementation.
|
||||
@@ -165,22 +158,6 @@ class CudaCommunicator(DeviceCommunicatorBase):
|
||||
register_graph_buffers=register,
|
||||
)
|
||||
|
||||
# AITER custom all-gather/reduce-scatter DP-attention dispatch/combine
|
||||
if (
|
||||
"dp" in unique_name
|
||||
and self.world_size in (2, 4, 8)
|
||||
and current_platform.is_rocm()
|
||||
and rocm_aiter_ops.is_custom_all_reduce_enabled()
|
||||
):
|
||||
self.aiter_ar_comm = AiterCustomAllreduce(
|
||||
group=self.cpu_group,
|
||||
device=self.device,
|
||||
register_graph_buffers=register,
|
||||
)
|
||||
if self.aiter_ar_comm.disabled:
|
||||
self.aiter_ar_comm = None
|
||||
else:
|
||||
self.use_aiter_ag_rs = True
|
||||
|
||||
if (
|
||||
use_custom_allreduce
|
||||
|
||||
@@ -28,7 +28,7 @@ from vllm.distributed.utils import is_weak_contiguous # noqa: E402, F401
|
||||
|
||||
|
||||
class QuickReduceRegime(Enum):
|
||||
# Keep integer ids aligned with csrc/rocm/quickreduce/quick_reduce.h
|
||||
# Keep integer ids aligned with the quick_reduce kernel
|
||||
FP = 0
|
||||
INT8 = 1
|
||||
INT6 = 2
|
||||
|
||||
Reference in New Issue
Block a user