Skip to content

Conversation

njhill
Copy link
Member

@njhill njhill commented Apr 11, 2025

When stacking or concatenating, replace the original tensors with slices into the larger one.

cc @ywang96 @DarkLight1337

@njhill njhill added performance Performance-related issues v1 labels Apr 11, 2025
Copy link

👋 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 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 either: Add ready label to the PR or enable auto-merge.

🚀

Signed-off-by: Nick Hill <[email protected]>
@DarkLight1337
Copy link
Member

DarkLight1337 commented Apr 11, 2025

Do you know why the tensors couldn't be freed in the original code?

Ok I think I get it now. When _reduce_data is called, the original tensors are copied but they are still referenced via MultiModalFieldElem.data which prevents them from being garbage collected.

@DarkLight1337
Copy link
Member

I think we may need to abstract this a bit further since #15130 will introduce dim argument to concat which complicates things. Can we reuse the logic of build_elems to assign the slices back into the original tensors?

@njhill
Copy link
Member Author

njhill commented Apr 11, 2025

Thanks @DarkLight1337. it should be simple to generalize this for other dims, however that will result it non-contiguous slices and so could be detrimental depending on how we end up serializing things in #16432. I think if we can defer doing the "reduce" until later (i.e. only after they have been transferred) it would also solve that though.

@DarkLight1337
Copy link
Member

DarkLight1337 commented Apr 12, 2025

Thanks @DarkLight1337. it should be simple to generalize this for other dims, however that will result it non-contiguous slices and so could be detrimental depending on how we end up serializing things in #16432. I think if we can defer doing the "reduce" until later (i.e. only after they have been transferred) it would also solve that though.

This may take a bit of work. I would like to at least finish #15686 before attempting this as it helps simplifies the code (considering that multi-modal processor is used in both V0 and V1).

Copy link

This pull request has been automatically marked as stale because it has not had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this pull request should remain open. Thank you!

@github-actions github-actions bot added the stale Over 90 days of inactivity label Jul 13, 2025
Copy link

mergify bot commented Jul 13, 2025

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

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

@mergify mergify bot added the needs-rebase label Jul 13, 2025
@github-actions github-actions bot added unstale Recieved activity after being labelled stale and removed stale Over 90 days of inactivity labels Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multi-modality Related to multi-modality (#4194) needs-rebase performance Performance-related issues unstale Recieved activity after being labelled stale v1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants