-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
[TPU][V1] Refine tpu_model_runner to mitigate future recompilation issues #16275
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
[TPU][V1] Refine tpu_model_runner to mitigate future recompilation issues #16275
Conversation
👋 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 🚀 |
I can't review rn sorry. Is it faster than main? |
Yes, both compilation and execution |
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.
Thanks for the PR, overall this lgtm, especially the from_input_batch
change.
I don't fully grasp where the optimization lies with the if/else branch as we're just forking two different graphs now, but that's about it.
If we use If we use
We need to compile two graphs for pred is True or False. The benefit is that we don't need to compute both A and B in execution. also cc @robertgshaw2-redhat , I remember you had similar questions. |
Ok I see the issue now. The simpler if/else solution fits our use-case surely better. Thanks for explaining! |
Eg. 3 requests, tensors padded to 4 | ||
temperature: [0.7, 0.2, 0.9]=>[0.7, 0.2, 0.9, 0.0] | ||
sample indices: [4, 10, 11]=>indices_do_sample: [4, 10, 11, 0] | ||
ops to CPU and produces tensors of fixed `padded_num_reqs` size. |
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.
nit: it seems that the impl directly uses the cpu tensor and move them to the xla device
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 think it aligns with the description?
Looks like the TPU V1 test is failing
|
Signed-off-by: Chengji Yao <[email protected]>
Signed-off-by: Chengji Yao <[email protected]>
Signed-off-by: Chengji Yao <[email protected]>
Signed-off-by: Chengji Yao <[email protected]>
Signed-off-by: Chengji Yao <[email protected]>
Signed-off-by: Chengji Yao <[email protected]>
Signed-off-by: Chengji Yao <[email protected]>
f2a4dfd
to
dc5c641
Compare
@mgoin thanks for reminding, it should be fixed now. BTW, can we make the TPU CI test not a soft-fail now? cc @robertgshaw2-redhat |
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.
Nice work, I feel this is a good path to go down! Thank you
forward
: total_bucket_size = token_bucket_numselect_hidden_states
: total_bucket_size = token_bucket_num * req_bucket_numsample_from_hidden
: total_bucket_size = req_bucket_num * 2TPUSupportedSamplingMetadata.from_input_batch
torch.where
toif else branches