-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Feature] support sequence parallelism using compilation pass #16155
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
Conversation
Signed-off-by: cascade812 <[email protected]>
Signed-off-by: cascade812 <[email protected]>
👋 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 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 🚀 |
nice! |
Signed-off-by: cascade812 <[email protected]>
Signed-off-by: cascade812 <[email protected]>
Signed-off-by: cascade812 <[email protected]>
Signed-off-by: cascade812 <[email protected]>
Signed-off-by: cascade812 <[email protected]>
I will take a closer look on Tuesday but my initial thoughts are that I agree we should improve the pass interface. At the same time, I like that currently all passes conform to the PyTorch I also think we should better separate the We should decide if we want to re-instantiate passes for different runtime shapes. It could be good if we want to register shape-dependent patterns upon initialization. But it might also mean a bunch of redundant work. Perhaps the best solution is to instantiate each pass per-shape and then at least reuse it in piecewise compilation. |
Signed-off-by: cascade812 <[email protected]>
There was a problem hiding this 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!
Signed-off-by: cascade812 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM when green, thanks for the excellent work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few notes on certain edge cases. We should at least add TODOs if we don't address them here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, sorry for the kinda-late review, I've been head-down on the attention-quant fusion pass.
This is a great PR! I had a few minor notes - I've submitted some above, and I had a few more notes on testing I thought of so submitting them now.
I'm happy to provide more explanation for the comments & discuss if I misunderstood something. Feel free to ping me on the vLLM Slack or here whether for discussion or if you've addressed the comments and want me to take another look.
Signed-off-by: cascade812 <[email protected]>
Signed-off-by: cascade812 <[email protected]>
Signed-off-by: cascade812 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a few more comments and a bunch more nits, thanks for addressing all of the comments so far.
A big question is whether the tp_world_size
can be different for two LLM instances, because this pass being a singleton means that it'll only use the tp_size that was present during the first initialization. @tlrmchlsmth do you know the answer to this?
I think we should be able to resolve this by checking the tp_world_size during the instance()
call, and then we can register more patterns on the same instance or maybe even return a new instance with the new tp_size (if that works). Or, because we clear _seen_patterns
, we could get rid of the singleton structure anyway (you'd have to verify it works).
Signed-off-by: cascade812 <[email protected]>
Signed-off-by: cascade812 <[email protected]>
Signed-off-by: cascade812 <[email protected]>
Good point. I tested two llm instances with both singleton and non-singleton setups, and both worked. That said, I agree non-singleton makes more sense here, so I’ve removed the singleton. |
Signed-off-by: cascade812 <[email protected]>
…roject#16155) Signed-off-by: cascade812 <[email protected]> Signed-off-by: Tyler Michael Smith <[email protected]> Co-authored-by: Tyler Michael Smith <[email protected]>
…roject#16155) Signed-off-by: cascade812 <[email protected]> Signed-off-by: Tyler Michael Smith <[email protected]> Co-authored-by: Tyler Michael Smith <[email protected]>
…roject#16155) Signed-off-by: cascade812 <[email protected]> Signed-off-by: Tyler Michael Smith <[email protected]> Co-authored-by: Tyler Michael Smith <[email protected]> Signed-off-by: Agata Dobrzyniewicz <[email protected]>
…roject#16155) Signed-off-by: cascade812 <[email protected]> Signed-off-by: Tyler Michael Smith <[email protected]> Co-authored-by: Tyler Michael Smith <[email protected]> Signed-off-by: Mu Huai <[email protected]>
…roject#16155) Signed-off-by: cascade812 <[email protected]> Signed-off-by: Tyler Michael Smith <[email protected]> Co-authored-by: Tyler Michael Smith <[email protected]> Signed-off-by: Yuqi Zhang <[email protected]>
Thanks for the great work! @cascade812 Just a simple question, I've noticed that you initialized the paramater rms_norm_weight with an empty 2D tensor during the middleRMSNorm and the lastRMSNorm SP pass, but on the CUDA kernel side, the function accepts it as a 1D tensor. Why wasn't it conflicted with each other? |
I think it's because pattern matcher is more flexible, it doesn't validate kernel implementation details - it just ensures the operation pattern is recognizable and shapes are broadcastable. |
…roject#16155) Signed-off-by: cascade812 <[email protected]> Signed-off-by: Tyler Michael Smith <[email protected]> Co-authored-by: Tyler Michael Smith <[email protected]> Signed-off-by: minpeter <[email protected]>
This PR support sequence parallelism using below compilation config