[Feature] support aclgraph for model runner v2 (#7110)
### What this PR does / why we need it?
This PR aims to support aclgraph for model runner v2, please see RFC
#5208. The PR contains these modifications:
- adapt to newest commit of vllm main branch.
- supply a unified interface of extra forward context for both model
runner v1 and model runner v2.
- implement graph mode for main model.
### Does this PR introduce _any_ user-facing change?
no
### How was this patch tested?
- vLLM version: v0.16.0
- vLLM main:
4034c3d32e
---------
Signed-off-by: Ronald1995 <ronaldautomobile@163.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import torch.distributed as dist
|
||||
from vllm.distributed.parallel_state import GroupCoordinator, get_dp_group
|
||||
from vllm.forward_context import get_forward_context
|
||||
|
||||
from vllm_ascend.ascend_forward_context import _EXTRA_CTX
|
||||
from vllm_ascend.distributed.parallel_state import get_fc3_quant_x_group
|
||||
|
||||
|
||||
@@ -16,7 +17,7 @@ def fc3_all_gather_and_maybe_unpad_impl(
|
||||
x = get_fc3_quant_x_group().all_gather(x, 0)
|
||||
dp_metadata = forward_context.dp_metadata
|
||||
if dp_metadata is None:
|
||||
pad_size = forward_context.pad_size
|
||||
pad_size = _EXTRA_CTX.pad_size
|
||||
if pad_size > 0:
|
||||
x = x[:-pad_size]
|
||||
else:
|
||||
@@ -24,7 +25,7 @@ def fc3_all_gather_and_maybe_unpad_impl(
|
||||
num_tokens_across_dp_cpu = dp_metadata.num_tokens_across_dp_cpu
|
||||
result = torch.empty((num_tokens_across_dp_cpu.sum(), *x.shape[1:]), device=x.device, dtype=x.dtype)
|
||||
dp_size = get_dp_group().world_size
|
||||
x = x.view(dp_size, forward_context.padded_length, *x.shape[1:])
|
||||
x = x.view(dp_size, _EXTRA_CTX.padded_length, *x.shape[1:])
|
||||
offset = 0
|
||||
for idx in range(dp_size):
|
||||
num_tokens_dp = num_tokens_across_dp_cpu[idx]
|
||||
|
||||
Reference in New Issue
Block a user