[BugFix][v0.18.0] Gate recompute/balance/fused_mc2 by PD mode (#8374)
<!-- Thanks for sending a pull request! BEFORE SUBMITTING, PLEASE READ https://docs.vllm.ai/en/latest/contributing/overview.html --> ### What this PR does / why we need it? - Enforce recompute scheduler only in PD-disaggregated mode. - Enforce balance scheduling only in PD-mixed mode. - Enforce fused MC2 only on PD-disaggregated D-side (kv_consumer). <!-- - Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. If possible, please consider writing useful notes for better and faster reviews in your PR. - Please clarify why the changes are needed. For instance, the use case and bug description. - Fixes # --> ### Does this PR introduce _any_ user-facing change? No <!-- Note that it means *any* user-facing change including all aspects such as API, interface or other behavior changes. Documentation-only updates are not considered user-facing changes. --> ### How was this patch tested? By ci <!-- CI passed with new added/existing test. If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future. If tests were not added, please describe why they were not added and/or why it was difficult to add. --> --------- Signed-off-by: wangxiaoteng <wangxiaoteng@huawei.com>
This commit is contained in:
@@ -448,7 +448,36 @@ class NPUPlatform(Platform):
|
||||
if get_ascend_device_type() != AscendDeviceType._310P:
|
||||
compilation_config.custom_ops = ["all"]
|
||||
|
||||
if envs_ascend.VLLM_ASCEND_ENABLE_FUSED_MC2:
|
||||
kv_transfer_config = vllm_config.kv_transfer_config
|
||||
kv_role = getattr(kv_transfer_config, "kv_role", None)
|
||||
if kv_transfer_config is None or kv_role != "kv_consumer":
|
||||
raise ValueError(
|
||||
"VLLM_ASCEND_ENABLE_FUSED_MC2 (fused mc2) only supports PD-disaggregated "
|
||||
"decode nodes (D-side) with kv_role='kv_consumer'. It is not supported "
|
||||
"in PD-mixed mode (no kv_transfer_config / kv_role='kv_both') nor on "
|
||||
"prefill nodes (P-side) with kv_role='kv_producer'."
|
||||
)
|
||||
|
||||
if envs_ascend.VLLM_ASCEND_BALANCE_SCHEDULING:
|
||||
kv_transfer_config = vllm_config.kv_transfer_config
|
||||
kv_role = getattr(kv_transfer_config, "kv_role", None)
|
||||
if kv_transfer_config is not None and kv_role != "kv_both":
|
||||
raise ValueError(
|
||||
"VLLM_ASCEND_BALANCE_SCHEDULING (balance scheduling) only supports PD-mixed mode "
|
||||
"(kv_role='kv_both' or no kv_transfer_config), and is not supported in "
|
||||
"PD-disaggregated mode (kv_role='kv_producer'/'kv_consumer')."
|
||||
)
|
||||
|
||||
if ascend_config.recompute_scheduler_enable:
|
||||
kv_transfer_config = vllm_config.kv_transfer_config
|
||||
kv_role = getattr(kv_transfer_config, "kv_role", None)
|
||||
if kv_transfer_config is None or kv_role == "kv_both":
|
||||
raise ValueError(
|
||||
"recompute_scheduler_enable can only be enabled in PD-disaggregated mode "
|
||||
"(kv_role='kv_producer' or 'kv_consumer'), and is not supported in PD-mixed mode."
|
||||
)
|
||||
|
||||
from vllm_ascend.core.recompute_scheduler import RecomputeSchedulerConfig
|
||||
|
||||
recompute_scheduler_config = RecomputeSchedulerConfig.initialize_from_config(vllm_config)
|
||||
|
||||
Reference in New Issue
Block a user