Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Significant performance drop on CPUs with --num-scheduler-steps > 1 #11794

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions vllm/engine/arg_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,12 @@ def create_engine_config(self,
if self.enable_chunked_prefill and self.pipeline_parallel_size > 1:
raise ValueError("Multi-Step Chunked-Prefill is not supported "
"for pipeline-parallel-size > 1")
from vllm.platforms import current_platform
if current_platform.is_cpu():
logger.warning("Multi-Step (--num-scheduler-steps > 1) is "
"currently not supported for CPUs and has been "
"disabled.")
self.num_scheduler_steps = 1
Comment on lines +1162 to +1165
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically it's supported because it won't crash. It's fair to have a warning about performance regression, but I don't think we should force disabling multi-step on CPU.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically it's supported because it won't crash. It's fair to have a warning about performance regression, but I don't think we should force disabling multi-step on CPU.

Thanks @comaniac for the review.

CPU doesn't support multi-step scheduling.
Please see the code here: https://github.com/vllm-project/vllm/blob/main/vllm/worker/cpu_model_runner.py#L516

Thanks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, then why you said "Significant performance drop was observed on CPUs with --num-scheduler-steps > 1"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because the multi-step logic has been implemented in the scheduler (which is platform independent).

However, the cpu_model_runner (the platform dependent part) doesn't support it yet, which is the root cause of the performance degradation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although cpu can still run with --num-scheduler-steps > 1, it doesn't run as the design of multi-step scheduling like GPU due to the missing implementation in cpu_model_runner.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't call it "performance degradation" if it cannot work out of box (hitting to the exception you pointed out). Anyways the change looks fine.

Copy link
Contributor Author

@DamonFool DamonFool Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't call it "performance degradation" if it cannot work out of box (hitting to the exception you pointed out).

No. It won't hit the exception on CPUs. vLLM will still run but very slow.


# make sure num_lookahead_slots is set the higher value depending on
# if we are using speculative decoding or multi-step
Expand Down
Loading