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

[Hardware][Intel-Gaudi] Enable LoRA support for Intel Gaudi (HPU) #10565

Merged
merged 3 commits into from
Dec 12, 2024

Conversation

SanjuCSudhakaran
Copy link
Contributor

@SanjuCSudhakaran SanjuCSudhakaran commented Nov 22, 2024

This PR enables support for LoRA on Intel Gaudi by adding HPU specific kernels in PunicaWrapperHPU to handle LoRA computations more efficiently on the hardware.

Copy link

👋 Hi! Thank you for contributing to the vLLM project.
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 do one of these:

  • Add ready label to the PR
  • Enable auto-merge.

🚀

@SanjuCSudhakaran SanjuCSudhakaran marked this pull request as ready for review November 22, 2024 06:23
@jeejeelee
Copy link
Collaborator

Can we do it like CustomOp, where the punicawrapper remains unchanged, and we decide which ops to call based on the hardware? I think if we do it this way, it might have better extensibility.

@SanjuCSudhakaran
Copy link
Contributor Author

SanjuCSudhakaran commented Nov 22, 2024

GaudiPunicaWrapper is a class inherited from PunicaWrapper which does the following.

  1. Overrides the functions add_lora, add_lora_packed_nslice and add_lora_logits.
  2. Adds add_lora_embedding instead of add_expand to handle LoRA B embedding computation.

I'd to get a little more clarity on CustomOp .

I see that classes like RotaryEmbedding using CustomOp to automatically handle the forward pass based on the backend device. Here RotaryEmbedding is inherited from torch.nn.Module and CustomOp handles which forward pass to call.

But here neither PunicaWrapper nor the ops in it are torch.nn.modules. So to use CustomOp the ops in PunicaWrapper would have to be rewritten to torch.nn.Modules which requires a lot of refactoring.

@jeejeelee Please correct if I am missing something here.

@jeejeelee
Copy link
Collaborator

@SanjuCSudhakaran Thanks for your feedback.
I'm mainly considering that other hardware may need to support LoRA in the future. If we support it in your current way, it might lead to a lot of redundant conditionals. IMHO, the main difference between different hardware should be in the implementation of the 6 LoRA ops.
BTW, I actually have ideas and plans for extending LoRA support to other hardware. If you're interested, we can discuss this on Slack.

@SanjuCSudhakaran
Copy link
Contributor Author

SanjuCSudhakaran commented Nov 26, 2024

@jeejeelee Can you please confirm whether this is the slack you mentioned https://communityinviter.com/apps/vllm-dev/join-vllm-developers-slack

It looks like this is it

@jeejeelee jeejeelee self-requested a review November 27, 2024 12:59
Copy link

mergify bot commented Dec 2, 2024

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

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

Copy link
Collaborator

@jeejeelee jeejeelee left a comment

Choose a reason for hiding this comment

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

Some minor changes. Thank you very much for your contribution and patience.

vllm/lora/layers.py Show resolved Hide resolved
vllm/lora/punica_wrapper/punica_hpu.py Show resolved Hide resolved
Copy link
Collaborator

@jeejeelee jeejeelee left a comment

Choose a reason for hiding this comment

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

Thank you very much for your contribution, and I especially appreciate your willingness to discuss the refactoring of the punicawrapper together

@jeejeelee jeejeelee added the ready ONLY add when PR is ready to merge/full CI is needed label Dec 11, 2024
@jeejeelee
Copy link
Collaborator

@SanjuCSudhakaran could you plz sync main?

@jeejeelee jeejeelee enabled auto-merge (squash) December 12, 2024 07:32
@jeejeelee jeejeelee merged commit 8195824 into vllm-project:main Dec 12, 2024
76 checks passed
Akshat-Tripathi pushed a commit to krai/vllm that referenced this pull request Dec 12, 2024
sleepwalker2017 pushed a commit to sleepwalker2017/vllm that referenced this pull request Dec 13, 2024
BKitor pushed a commit to BKitor/vllm that referenced this pull request Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/build ready ONLY add when PR is ready to merge/full CI is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants