[vllm, rollout] fix: implement deferred ZMQ futures for non-blocking executor calls #4875
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes the
non_block=Truebehavior inExternalZeroMQDistributedExecutorto properly implement the vLLM executor contract.The previous implementation immediately called
recv()and wrapped the result in an already-resolvedFuture. This PR adds a_DeferredZmqFuturethat defersrecv()untilresult()is called, allowing vLLM's EngineCore to overlap work (e.g., grammar bitmask computation for structured output) with remote model execution.Related: #3934 added
non_blockparameter compatibility but didn't implement actual non-blocking behavior.Checklist Before Starting
[{modules}] {type}: {description}(This will be checked by the CI)Test
The
non_block=Truecode path is called by vLLM v1's EngineCore (seevllm/v1/engine/core.py). Existing CI tests that run vLLM v1 (tests/experimental/agent_loop,test_vllm_abort.py) exercise this code path through the full inference stack.API and Usage Example
No API changes. Internal behavior change only.
Design & Code Changes
_DeferredZmqFutureclass that stores sockets and defersrecv()untilresult()is callednon_blockandunique_reply_rankparameters tocollective_rpc()max_concurrent_batches=1(required for thread-safe ZMQ REQ/REP)Checklist Before Submitting
pre-commit install && pre-commit run --all-files --show-diff-on-failure --color=alwaystests/experimental/agent_loop,test_vllm_abort.py)ci-requestchannel in theverlSlack workspace. (If not accessible, please try the Feishu group (飞书群).)