Skip to content

v1: Pass KVConnectorOutput to scheduler-side#22157

Merged
vllm-bot merged 1 commit intovllm-project:mainfrom
orozery:update-kv-connector-output
Aug 9, 2025
Merged

v1: Pass KVConnectorOutput to scheduler-side#22157
vllm-bot merged 1 commit intovllm-project:mainfrom
orozery:update-kv-connector-output

Conversation

@orozery
Copy link
Collaborator

@orozery orozery commented Aug 3, 2025

This PR adds a new scheduler-side connector v1 API function to notify the scheduler-side connector on output from the worker-side connectors. In particular, it allows the scheduler-side connector to track the finished requests.

Part of the work described in RFC #19854

@github-actions
Copy link

github-actions bot commented Aug 3, 2025

👋 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.

🚀

@orozery
Copy link
Collaborator Author

orozery commented Aug 3, 2025

cc @njhill

@mergify mergify bot added the v1 label Aug 3, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new scheduler-side connector API, update_connector_output, to allow the connector to process outputs from worker-side connectors. The changes are well-contained and logically sound. I have one suggestion to improve the robustness of the new API by clarifying its contract in the docstring to prevent potential issues in future implementations.

Comment on lines 291 to 292
Copy link
Contributor

Choose a reason for hiding this comment

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

high

It's good practice to clarify the contract of this method regarding modifications to the connector_output object. The _update_from_kv_xfer_finished method in scheduler.py iterates over connector_output.finished_recving and connector_output.finished_sending after calling this method. If an implementation of update_connector_output were to modify these fields (e.g., clear them), the scheduler would miss these finished transfers, leading to bugs like requests getting stuck or memory leaks.

A similar method, build_connector_meta, has a note in its docstring: This function should NOT modify fields in the scheduler_output.

I recommend adding a similar note here to prevent potential issues with future connector implementations.

Suggested change
Update KVConnector state from worker-side connectors output.
Update KVConnector state from worker-side connectors output.
NOTE: This function should not modify the `connector_output` object,
as its fields may be used by the scheduler after this call.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm actually thinking on allowing this...
but waiting for human feedback on that

Copy link
Contributor

Choose a reason for hiding this comment

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

I actually agree with the bot here. See my other comment below for more details.

@orozery orozery force-pushed the update-kv-connector-output branch from 1e62275 to 7a9122e Compare August 3, 2025 18:13
Copy link
Member

@njhill njhill left a comment

Choose a reason for hiding this comment

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

Thanks @orozery.

cc @ApostaC

@njhill njhill requested a review from ApostaC August 5, 2025 21:52
Copy link
Member

@njhill njhill left a comment

Choose a reason for hiding this comment

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

Oh @orozery I think we'll also need to update MultiConnector for this

This commit adds a new scheduler-side connector v1 API function
to notify the scheduler-side connector on output from the worker-side connectors.
In particular, it allows the scheduler-side connector to track the finished requests.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
@orozery orozery force-pushed the update-kv-connector-output branch from 7a9122e to c92e866 Compare August 6, 2025 14:12
@orozery
Copy link
Collaborator Author

orozery commented Aug 6, 2025

Oh @orozery I think we'll also need to update MultiConnector for this

Good point.
Added now (also for the other PR).

@njhill njhill added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 8, 2025
@vllm-bot vllm-bot merged commit 7ad7adb into vllm-project:main Aug 9, 2025
48 of 54 checks passed

assert self.connector is not None
self.connector.update_connector_output(kv_connector_output)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think update_connector_output should be invoked directly from update_from_output rather than from _update_from_kv_xfer_finished.

The issue is that _update_from_kv_xfer_finished only processes finished requests, while other (future) parts of kv_connector_output may be handled elsewhere in update_from_output — for example, invalid_block_ids in the KV load failure recovery PR (#19330).

Invoking update_connector_output independently would keep responsibilities clearer and help avoid unexpected side effects. For the same reason, I think kv_connector_output should remain unmodified by update_connector_output.

@orozery @njhill

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@sdavidbd I agree.
I was trying to recall why in the first place I wanted to be able to modify the connector output.
I think it was because I was targeting a case where my workers will report block-wise results, and I wanted my scheduler-side connector to aggregate and produce request-based results to the scheduler.
But I think we all lean towards making the scheduler itself block-based. Then we don't need it.
So anyhow, I'm also good with changing this function to not allow to update the output (is there anything better than adding a comment?)

paulpak58 pushed a commit to paulpak58/vllm that referenced this pull request Aug 13, 2025
Signed-off-by: Or Ozeri <oro@il.ibm.com>
Signed-off-by: Paul Pak <paulpak58@gmail.com>
diegocastanibm pushed a commit to diegocastanibm/vllm that referenced this pull request Aug 15, 2025
Signed-off-by: Or Ozeri <oro@il.ibm.com>
Signed-off-by: Diego-Castan <diego.castan@ibm.com>
yiliu30 pushed a commit to yiliu30/vllm-fork that referenced this pull request Aug 19, 2025
epwalsh pushed a commit to epwalsh/vllm that referenced this pull request Aug 28, 2025
xiao-llm pushed a commit to xiao-llm/vllm that referenced this pull request Aug 28, 2025
Signed-off-by: Or Ozeri <oro@il.ibm.com>
Signed-off-by: Xiao Yu <xiao.yu@amd.com>
zhewenl pushed a commit to zhewenl/vllm that referenced this pull request Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants