-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
[Bugfix][Model] Fix Mllama SDPA illegal memory access for batched multi-image #9626
Conversation
👋 Hi! Thank you for contributing to the vLLM project. 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:
🚀 |
Signed-off-by: mgoin <[email protected]>
d1398b4
to
c82a070
Compare
LGTM. Thanks for this bug fix! |
From more testing it does seem to decrease performance, but I think this is worth it for sanity at the moment |
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 fixing!
…ti-image (vllm-project#9626) Signed-off-by: mgoin <[email protected]> Signed-off-by: Alvant <[email protected]>
…ti-image (vllm-project#9626) Signed-off-by: mgoin <[email protected]> Signed-off-by: Erkin Sagiroglu <[email protected]>
…ti-image (vllm-project#9626) Signed-off-by: mgoin <[email protected]> Signed-off-by: Shanshan Wang <[email protected]>
…ti-image (vllm-project#9626) Signed-off-by: mgoin <[email protected]> Signed-off-by: Shanshan Wang <[email protected]>
…ti-image (vllm-project#9626) Signed-off-by: mgoin <[email protected]> Signed-off-by: qishuai <[email protected]>
…ti-image (vllm-project#9626) Signed-off-by: mgoin <[email protected]> Signed-off-by: NickLucche <[email protected]>
…ti-image (vllm-project#9626) Signed-off-by: mgoin <[email protected]> Signed-off-by: NickLucche <[email protected]>
…ti-image (vllm-project#9626) Signed-off-by: mgoin <[email protected]> Signed-off-by: Sumit Dubey <[email protected]>
Mllama could trigger a CUDA error for illegal memory access within the cross-attention SDPA during inference or even profile run when running batch multi-image requests.
When inspecting the inputs to the SDPA, I noticed that the Q/K/V states were not contiguous in all cases (
attention_mask
is contiguous). Once forcing all of them to be contiguous, I found this issue went away.vllm/vllm/model_executor/models/mllama.py
Lines 810 to 814 in fd0e2cf
Script used for testing:
Error when running with
CUDA_LAUNCH_BLOCKING=1
:Output when running with this PR: