[Dist][EP] Remove ETP/EP maintained in vllm-ascend (#1681)
### What this PR does / why we need it?
Remove ETP/EP maintained in branch main. We drop this as there is no
relevant scenarios to use ETP now, and we may subsequently advocate
implementing expert tensor parallelism in vLLM to support scenarios
where the expert is needed to be sliced
This is a part of #1422 backport.
Fixes https://github.com/vllm-project/vllm-ascend/issues/1396
https://github.com/vllm-project/vllm-ascend/issues/1154
### Does this PR introduce _any_ user-facing change?
We'll not maintain etp/ep in vllm-ascend anymore, and use the tp/ep in
vllm instead.
### How was this patch tested?
CI passed with new added and existing test.
- vLLM version: v0.9.2
- vLLM main:
fe8a2c544a
Signed-off-by: MengqingCao <cmq0113@163.com>
This commit is contained in:
@@ -1,77 +0,0 @@
|
||||
from typing import Optional
|
||||
|
||||
import torch
|
||||
from vllm.distributed.parallel_state import (GroupCoordinator, get_world_group,
|
||||
init_model_parallel_group)
|
||||
|
||||
# vllm-ascend will maintain its own EP GroupCoordinator and ETP GroupCoordinator for
|
||||
# customize parallel solution
|
||||
_EP: Optional[GroupCoordinator] = None
|
||||
_ETP: Optional[GroupCoordinator] = None
|
||||
|
||||
|
||||
def get_ep_group() -> GroupCoordinator:
|
||||
assert _EP is not None, ("expert model parallel group is not initialized")
|
||||
return _EP
|
||||
|
||||
|
||||
def get_etp_group() -> GroupCoordinator:
|
||||
assert _ETP is not None, (
|
||||
"expert tensor parallel group is not initialized")
|
||||
return _ETP
|
||||
|
||||
|
||||
def model_parallel_initialized():
|
||||
return (_ETP is not None and _EP is not None)
|
||||
|
||||
|
||||
def init_ascend_model_parallel(
|
||||
expert_parallel_size: int = 1,
|
||||
expert_tensor_parallel_size: int = 1,
|
||||
world_size: Optional[int] = None,
|
||||
backend: Optional[str] = None,
|
||||
):
|
||||
if model_parallel_initialized():
|
||||
return
|
||||
assert torch.distributed.is_initialized()
|
||||
world_size = world_size or torch.distributed.get_world_size()
|
||||
backend = backend or torch.distributed.get_backend(
|
||||
get_world_group().device_group)
|
||||
num_expert_parallel_groups = expert_tensor_parallel_size
|
||||
num_expert_tensor_parallel_groups = expert_parallel_size
|
||||
|
||||
global _EP
|
||||
group_ranks = []
|
||||
for i in range(num_expert_parallel_groups):
|
||||
ranks = list(range(i, world_size, num_expert_parallel_groups))
|
||||
group_ranks.append(ranks)
|
||||
|
||||
_EP = init_model_parallel_group(group_ranks,
|
||||
get_world_group().local_rank,
|
||||
backend,
|
||||
group_name="ep")
|
||||
|
||||
group_ranks = []
|
||||
global _ETP
|
||||
for i in range(num_expert_tensor_parallel_groups):
|
||||
ranks = list(
|
||||
range(i * expert_tensor_parallel_size,
|
||||
(i + 1) * expert_tensor_parallel_size))
|
||||
group_ranks.append(ranks)
|
||||
|
||||
_ETP = init_model_parallel_group(group_ranks,
|
||||
get_world_group().local_rank,
|
||||
backend,
|
||||
group_name="etp")
|
||||
|
||||
|
||||
def destory_ascend_model_parallel():
|
||||
global _EP
|
||||
if _EP:
|
||||
_EP.destroy()
|
||||
_EP = None
|
||||
|
||||
global _ETP
|
||||
if _ETP:
|
||||
_ETP.destroy()
|
||||
_ETP = None
|
||||
Reference in New Issue
Block a user