-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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][CPU] Multi-LoRA implementation for the CPU backend #11100
Changes from 1 commit
c8a8c5b
3545ac1
2b3c650
cc0bd6c
dc9091a
410b746
8eab6a6
5dfcf62
651dc04
d1026bb
2840445
41c518f
abb03e5
d212fc9
dcb1794
3a684b8
c9b9f63
acdb4e3
cfa082f
8eaf7ec
bd54243
21c3799
aeaf078
61c42cf
0d19f03
5af9cbb
202aca3
76444f4
64c700f
06399bc
69eb3dc
e208468
d8cb9af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,12 +7,8 @@ | |
import pytest | ||
import torch | ||
|
||
from vllm.lora.ops.bgmv_expand import bgmv_expand | ||
from vllm.lora.ops.bgmv_expand_slice import bgmv_expand_slice | ||
from vllm.lora.ops.bgmv_shrink import bgmv_shrink | ||
from vllm.lora.ops.sgmv_expand import sgmv_expand | ||
from vllm.lora.ops.sgmv_expand_slice import sgmv_expand_slice | ||
from vllm.lora.ops.sgmv_shrink import sgmv_shrink | ||
from vllm.lora.ops import (bgmv_expand, bgmv_expand_slice, bgmv_shrink, | ||
sgmv_expand, sgmv_expand_slice, sgmv_shrink) | ||
from vllm.platforms import current_platform | ||
|
||
from .utils import (generate_data, generate_data_for_expand_nslices, | ||
|
@@ -110,7 +106,10 @@ | |
MAX_RANKS = [32] | ||
SCALES = [0.5] | ||
SEED = [0] | ||
CUDA_DEVICES = [f"cuda:{0}"] | ||
|
||
CUDA_DEVICES = ["cuda:0"] | ||
CPU_DEVICES = ["cpu"] | ||
DEVICES = CUDA_DEVICES if current_platform.is_cuda_alike() else CPU_DEVICES | ||
|
||
|
||
def assert_close(a, b): | ||
|
@@ -130,7 +129,7 @@ def assert_close(a, b): | |
@pytest.mark.parametrize("dtype", DTYPES) | ||
@pytest.mark.parametrize("op_type", ["shrink", "expand"]) | ||
@pytest.mark.parametrize("seed", SEED) | ||
@pytest.mark.parametrize("device", CUDA_DEVICES) | ||
@pytest.mark.parametrize("device", DEVICES) | ||
def test_punica_sgmv( | ||
batches: int, | ||
num_loras: int, | ||
|
@@ -220,7 +219,7 @@ def test_punica_sgmv( | |
@pytest.mark.parametrize("dtype", DTYPES) | ||
@pytest.mark.parametrize("op_type", ["shrink", "expand"]) | ||
@pytest.mark.parametrize("seed", SEED) | ||
@pytest.mark.parametrize("device", CUDA_DEVICES) | ||
@pytest.mark.parametrize("device", DEVICES) | ||
def test_punica_bgmv( | ||
batches: int, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can have torch ops and triton ops validate each other,(even when torch ops are running on GPU), similar to how we test custom ops There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for forgetting submit these comments There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Akshat-Tripathi Could you modify this? If you're not free, I can finish this tomorrow There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep I agree, it would definitely speed up the op tests. I'm on holiday right now, but I've asked @mosalov to take over until I'm back There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jeejeelee Do your propose doing something like this:
and then calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, my idea is to have torch ops and triton ops validate each other. This way, other platforms won't need to duplicate these tests. |
||
num_loras: int, | ||
|
@@ -294,7 +293,7 @@ def test_punica_bgmv( | |
@pytest.mark.parametrize("dtype", DTYPES) | ||
@pytest.mark.parametrize("op_type", ["sgmv", "bgmv"]) | ||
@pytest.mark.parametrize("seed", SEED) | ||
@pytest.mark.parametrize("device", CUDA_DEVICES) | ||
@pytest.mark.parametrize("device", DEVICES) | ||
def test_punica_expand_nslices( | ||
batches: int, | ||
num_loras: int, | ||
|
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.
@DarkLight1337 Are our CPU vendor willing to provide hardware testing for these? Who should we contact?
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.
I remember there is no numa node restriction for CPU TP, so I think we can just change
VLLM_CPU_OMP_THREADS_BIND=48-92
to something likeVLLM_CPU_OMP_THREADS_BIND=48-70|71-92
to enable TP, even if these cores are on same numa node.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.
My bad, I meant to ask if the CPU LoRA testing should be placed here. If so, we might need to contact the CPU vendor?
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.
@jeejeelee Hi, I think it may be easier to run the offline lora case? Thus we don't need to download the weights file
https://github.com/vllm-project/vllm/blob/main/.buildkite/run-cpu-test.sh#L33
https://github.com/vllm-project/vllm/blob/main/examples/multilora_inference.py
CC @bigPYJ1151
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.
@zhouyuan Do you mean adding
multilora_inference.py
to https://github.com/vllm-project/vllm/blob/main/.buildkite/run-cpu-test.sh#L33?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.
Yes, the target is to enable a test to verify the lora code path on CPU backend