Skip to content
New issue

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

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

Already on GitHub? # to your account

[Feature] Pluggable platform-specific scheduler #13161

Merged
merged 9 commits into from
Feb 19, 2025

Conversation

yannicks1
Copy link
Contributor

@yannicks1 yannicks1 commented Feb 12, 2025

This PR enables different platforms to plugin their (hardware) specific scheduler class in vLLM version V0 and therefore addresses the scheduler part of this RFC #11162. A pluggable scheduler is needed to add support for the IBM Spyre accelerator #9652.
Note that this feature is under development for V1 but missing in the current V0.

Changes

  • added attribute scheduler_cls to class SchedulerConfig in vllm/config.py. Attribute can be a string containing the path to the scheduler class or the class itself.
  • added scheduler_cls to EngineArgs and add_cli_args() argparser
  • loading scheduler based on scheduler_cls in vllm/engine/llm_engine.py
  • added test to verify functionality: tests/plugins_tests/test_scheduler_plugins.py and appended it to the test pipeline (.buildkite/test-pipeline.yaml)

Remarks

  • since the scheduler_cls is initialized with "vllm.core.scheduler.Scheduler", the default behaviour does not change. However, the change allows to point to a (hardware) specific scheduler class in platforms.
  • I opted for initialization with "vllm.core.scheduler.Scheduler" and not "auto" as it is done for attribute worker_cls to have minimal changes (Otherwise I would have to overwrite "auto" for all platforms using the default scheduler).

Signed-off-by: Yannick Schnider <yannick.schnider1@ibm.com>
Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

@yannicks1 yannicks1 marked this pull request as ready for review February 12, 2025 16:41
@comaniac
Copy link
Collaborator

While we need more discussions about this feature in v1, I think it's ok for v0 to have it. Could you add a unit test with a dummy scheduler to 1) test the functionality, and 2) be an example?

Signed-off-by: Yannick Schnider <Yannick.Schnider1@ibm.com>
@yannicks1 yannicks1 force-pushed the ysc-pluggable-scheduler branch from e0beefe to 835e97b Compare February 14, 2025 14:58
@yannicks1
Copy link
Contributor Author

Thanks for your feedback @comaniac ! I have added a test which validates the functionality.

vllm/config.py Outdated
@@ -1338,6 +1338,7 @@ class ParallelConfig:
# will be determined based on the platform.
worker_cls: str = "auto"
sd_worker_cls: str = "auto"
scheduler_cls: str = "vllm.core.scheduler.Scheduler"
Copy link
Member

Choose a reason for hiding this comment

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

I think you can make the type either a string (qualname) or a type directly, similar to distributed_executor_backend that can directly be a class object. then you can easily test it, similar to https://github.com/vllm-project/vllm/blob/main/tests/engine/test_executor.py

@@ -346,6 +346,8 @@ def get_tokenizer_for_seq(sequence: Sequence) -> AnyTokenizer:
# Create the scheduler.
# NOTE: the cache_config here have been updated with the numbers of
# GPU and CPU blocks, which are profiled in the distributed executor.
Scheduler = resolve_obj_by_qualname(
Copy link
Member

Choose a reason for hiding this comment

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

if it is a string, use resolve_obj_by_qualname .

if not, it should be directly used as a class (and maybe assert it inherits from a base class?)

@wangxiyuan wangxiyuan mentioned this pull request Feb 17, 2025
1 task
Signed-off-by: Yannick Schnider <Yannick.Schnider1@ibm.com>
…actoring

allow scheduler_cls to be string or class directly, update testing
@yannicks1
Copy link
Contributor Author

Thanks for your feedback @youkaichao and @comaniac . I addressed it, please review again

@comaniac comaniac added the ready ONLY add when PR is ready to merge/full CI is needed label Feb 17, 2025
@youkaichao youkaichao removed the ready ONLY add when PR is ready to merge/full CI is needed label Feb 18, 2025
enforce_eager=True, # reduce test time
)
vllm_config = engine_args.create_engine_config()
vllm_config.parallel_config.scheduler_cls = DummyScheduler
Copy link
Member

Choose a reason for hiding this comment

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

we should have a top-level argument for it, e.g. from --scheduler_cls "mod.name" or EngineArgs(scheduler_cls="mod.name")

vllm/config.py Outdated
@@ -1338,6 +1338,7 @@ class ParallelConfig:
# will be determined based on the platform.
worker_cls: str = "auto"
sd_worker_cls: str = "auto"
scheduler_cls: Union[str, Type[object]] = "vllm.core.scheduler.Scheduler"
Copy link
Member

Choose a reason for hiding this comment

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

please add it in the SchedulerConfig ?

Signed-off-by: Yannick Schnider <Yannick.Schnider1@ibm.com>
Signed-off-by: Yannick Schnider <Yannick.Schnider1@ibm.com>
Signed-off-by: Yannick Schnider <Yannick.Schnider1@ibm.com>
…-argument

move scheduler_cls to SchedulerConfig and add it to EngineArgs
Copy link

mergify bot commented Feb 18, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @yannicks1.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Feb 18, 2025
@mergify mergify bot removed the needs-rebase label Feb 18, 2025
@yannicks1
Copy link
Contributor Author

thanks for reviewing again @youkaichao , @comaniac . I have incorporated your feedback.

Copy link
Member

@youkaichao youkaichao left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the contribution!

@youkaichao youkaichao merged commit 4233302 into vllm-project:main Feb 19, 2025
18 checks passed
xjpang pushed a commit to xjpang/vllm that referenced this pull request Feb 20, 2025
Signed-off-by: Yannick Schnider <yannick.schnider1@ibm.com>
Signed-off-by: Yannick Schnider <Yannick.Schnider1@ibm.com>
kerthcet pushed a commit to kerthcet/vllm that referenced this pull request Feb 21, 2025
Signed-off-by: Yannick Schnider <yannick.schnider1@ibm.com>
Signed-off-by: Yannick Schnider <Yannick.Schnider1@ibm.com>
Akshat-Tripathi pushed a commit to krai/vllm that referenced this pull request Mar 3, 2025
Signed-off-by: Yannick Schnider <yannick.schnider1@ibm.com>
Signed-off-by: Yannick Schnider <Yannick.Schnider1@ibm.com>
lk-chen pushed a commit to lk-chen/vllm that referenced this pull request Mar 5, 2025
Signed-off-by: Yannick Schnider <yannick.schnider1@ibm.com>
Signed-off-by: Yannick Schnider <Yannick.Schnider1@ibm.com>
Signed-off-by: Linkun Chen <github@lkchen.net>
Said-Akbar pushed a commit to Said-Akbar/vllm-rocm that referenced this pull request Mar 7, 2025
Signed-off-by: Yannick Schnider <yannick.schnider1@ibm.com>
Signed-off-by: Yannick Schnider <Yannick.Schnider1@ibm.com>
Signed-off-by: saeediy <saidakbarp@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants