Repository navigation
[EPD] Add ECMooncakeConnector for encoder cache over Mooncake TransferEngine - #41567
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements the ECMooncakeConnector, enabling RDMA-backed encoder-cache transfers via the Mooncake TransferEngine for disaggregated vLLM deployments. The implementation includes a new connector class, factory registration, and comprehensive integration tests. Feedback highlights critical performance and resource management concerns: the inefficient per-item initialization of ZMQ resources, a memory leak caused by the lack of a cleanup strategy for registered tensors, and the introduction of synchronous HTTP calls within the scheduler's critical path.
| ctx = zmq.Context() | ||
| sock = ctx.socket(zmq.REQ) | ||
| sock.setsockopt(zmq.RCVTIMEO, 120_000) | ||
| sock.connect(spec.producer_zmq) | ||
| try: | ||
| sock.send_json(pull) | ||
| resp = sock.recv_json() | ||
| finally: | ||
| sock.close(linger=0) | ||
| ctx.term() |
There was a problem hiding this comment.
Creating a new ZMQ context and socket for every item in metadata.loads is extremely inefficient. ZMQ contexts are heavy resources that should be initialized once (e.g., in __init__) and reused across the lifetime of the connector. Furthermore, if multiple items are being pulled from the same producer, you should reuse the socket instead of repeatedly connecting and disconnecting.
| if ret != 0: | ||
| raise RuntimeError("Mooncake EC batch_register_memory failed on producer.") | ||
| with self._tensor_lock: | ||
| self._tensor_by_hash[mm_hash] = tensor |
There was a problem hiding this comment.
The _tensor_by_hash dictionary in the producer grows indefinitely as new multimodal items are processed, and tensors are registered with the TransferEngine (via batch_register_memory) without ever being unregistered. This leads to both a Python memory leak and a leak of registered memory resources on the RDMA device. You should implement a cleanup strategy to evict items from _tensor_by_hash and unregister them when they are no longer needed (e.g., by leveraging the free_encoder_mm_hashes provided by the scheduler).
| assert self._remote_registry_url is not None | ||
| url = self._remote_registry_url.rstrip("/") + f"/ec/info/{identifier}" | ||
| try: | ||
| r = httpx.get(url, timeout=5.0) |
There was a problem hiding this comment.
Performing a synchronous HTTP GET request in has_cache_item is a major performance bottleneck because this method runs within the scheduler's critical path. This blocks the entire scheduling loop for up to 5 seconds per multimodal item if the registry is slow or unreachable. At a minimum, you should use a persistent httpx.Client initialized in __init__ to avoid the overhead of creating a new connection pool for every call, and consider a shorter timeout or an asynchronous status tracking mechanism.
|
This pull request has merge conflicts that must be resolved before it can be |
|
Documentation preview: https://vllm--41567.org.readthedocs.build/en/41567/ |
a00d36f to
74dc45e
Compare
|
This pull request has merge conflicts that must be resolved before it can be |
There was a problem hiding this comment.
Is the change in this file related to ECMooncakeConnector?
There was a problem hiding this comment.
Please separate the unrelated changes into a new PR.
|
Thanks for the great work. Maybe we can move forward together with #47302. |
|
/ci run |
|
β
Triggered Buildkite CI #87472 for commit |
Use the same configured host for the consumer bind address and proxy ZMQ endpoint, defaulting to IPv4 loopback. Format endpoints with make_zmq_path to preserve explicit IPv6 support. Validation: bash syntax and applicable pre-commit checks passed. Script argument capture reproduces the previous mismatch; default IPv4, custom IPv4, and IPv6 pass real ZMQ peers/event_port handshakes. Full Buildkite E2E rerun is pending. Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Tianyu Guo <guoty@inferact.ai>
Head branch was pushed to by a user without write access
|
/ci run |
|
β
Triggered Buildkite CI #87482 for commit |
β¦rEngine (vllm-project#41567) Signed-off-by: Teng Ma <sima.mt@alibaba-inc.com> Signed-off-by: Tianyu Guo <guoty@inferact.ai> Signed-off-by: Zhou ziheng <jiaranran2@gmail.com> Signed-off-by: jiangkuaixue123 <jiangxiaozhou111@163.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Tianyu Guo <guoty@inferact.ai> Co-authored-by: Zhou ziheng <jiaranran2@gmail.com> Co-authored-by: jiangkuaixue123 <jiangxiaozhou111@163.com> Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Jyotirmoy Roy <jyotirmoyroy649@gmail.com>
#16124) ### What this PR does / why we need it Refs #15898. This PR adds Ascend support for the upstream `ECMooncakeConnector` introduced by vllm-project/vllm#41567, enabling multimodal encoder outputs to be transferred from an Encoder instance to a PD instance through Mooncake Ascend Direct. #### Architecture The implementation keeps the common ECMooncake control plane in upstream vLLM, including the scheduler, consumer reservations, producer push management, and transfer metadata. `AscendECMooncakeConnector` is registered under the standard `ECMooncakeConnector` name and selects an Ascend worker while reusing the upstream scheduler. ```text Router / proxy Encoder / producer PD / consumer | | | |--------image request--------->| | |<-------image metadata---------| | |----------------------metadata-only decode----------------------->| | |-------reserve destination------->| | |<-------session + address---------| | |======Mooncake batch write=======>| | v PD model runner ``` The Ascend worker supplies the NPU-specific data path: - Allocates and registers 2 MiB-aligned NPU memory for the producer staging pool and consumer pool. - Tries the producer staging pool first. When an encoder output cannot fit there, it registers the source memory for direct transfer and uses a shared bounce arena for any bytes that cannot be transferred directly. - Packs source fragments into transfer waves and submits batched Mooncake writes. Registrations, bounce leases, and source tensors remain valid until their transfers finish, including failure and shutdown paths. - Initializes the Ascend Mooncake TransferEngine, validates the `ascend` protocol and NPU buffer device, and integrates worker-service startup and shutdown with the Ascend worker lifecycle. ```text Producer NPU allocation (registered once) +----------------------+-----------+---------------------+ | Staging pool | alignment | shared bounce arena | | | padding | | +----------------------+-----------+---------------------+ NORMAL: the output batch fits in staging encoder output -> copy into staging -> Mooncake write -> PD EC pool FALLBACK: the output batch does not fit in staging encoder output | +-------------+-------------+ | | prefix (if any) remainder (if any) | | copy to bounce arena register original NPU storage | | +-------------+-------------+ | v batched Mooncake write | v PD EC pool (original order) ``` The bounce arena is a reusable part of the producer's registered allocation. In the fallback path, it carries only a source prefix that cannot be covered by a valid aligned registration; the remaining bytes transfer directly from the original NPU storage. Both fragments join the same batched write. ### Does this PR introduce any user-facing change? Yes. Encoder and PD instances can select `ECMooncakeConnector` with an NPU EC buffer and the Ascend Mooncake protocol. For example, the measured EPD configuration used the following `--ec-transfer-config` values: Encoder (`ec_producer`): ```bash --ec-transfer-config \ '{"ec_connector":"ECMooncakeConnector","ec_role":"ec_producer","ec_buffer_size":3221225472,"ec_buffer_device":"npu","ec_connector_extra_config":{"mooncake_protocol":"ascend"}}' ``` The producer can also set `ascend_mooncake_bounce_arena_size` in `ec_connector_extra_config` to size the shared bounce arena in bytes. It is additional registered NPU memory, separate from the `ec_buffer_size` staging pool. For example, to request a 64 MiB arena, set the producer's `ec_connector_extra_config` to: ```json {"mooncake_protocol":"ascend","ascend_mooncake_bounce_arena_size":67108864} ``` PD (`ec_consumer`; use a distinct `ec_port` for each PD instance): ```bash --ec-transfer-config \ '{"ec_connector":"ECMooncakeConnector","ec_role":"ec_consumer","ec_ip":"127.0.0.1","ec_port":8301,"ec_buffer_size":3221225472,"ec_buffer_device":"npu","ec_connector_extra_config":{"mooncake_protocol":"ascend"}}' ``` The E2E and benchmark runs used Model Runner V2. ### How was this patch tested? #### Model Runner V2 E2E validation On Ascend hardware, the E+PD E2E test passed both cases: a normal staging transfer and a forced fallback transfer with a one-byte staging pool. The latter repeats requests to exercise direct registration, bounce-buffer transfer, and resource reuse. The test checks single-image and two-image responses against a single-server baseline. #### Multi-image performance comparison The benchmark used two 910C with the model `Qwen3.6-35B-A3B-w8a8`. The three deployments processed the same 750 MMIU multi-image requests in the same order. Each had separate warm-up requests, eight client processes, concurrency 96, identical generation settings, and prefix caching disabled. Graph execution was enabled. The ECMooncake runs used 3 GiB producer and consumer EC pools. All three runs completed 750/750 measured requests with HTTP 200 and zero client failures. | Metric | 1E3PD, ECMooncake | 2E2PD, ECMooncake | DP4EP4 baseline | |---|---:|---:|---:| | Request throughput | 1.692 req/s | **3.022 req/s** | 2.107 req/s | | P50 TTFT | 52.68 s | **28.93 s** | 41.18 s | | P95 TTFT | 103.21 s | 62.85 s | **57.30 s** | | P50 end-to-end latency | 52.96 s | **28.99 s** | 48.33 s | | P95 end-to-end latency | 103.22 s | **62.87 s** | 66.03 s | | Accuracy in this benchmark | 54.93% | 55.73% | 55.73% | Under this workload, 2E2PD achieved 78.6% more request throughput than 1E3PD and 43.5% more than the monolithic DP4EP4 baseline. It also had the lowest median TTFT and end-to-end latency. DP4EP4 had the lowest P95 TTFT. Accuracy is the benchmark's parsed-choice score over all measured requests; responses without a parsed choice count as incorrect. It is specific to this test configuration. - vLLM main: vllm-project/vllm@c4df37d --------- Signed-off-by: Akine-Ko <2923601304@qq.com>
vllm-project#16124) ### What this PR does / why we need it Refs vllm-project#15898. This PR adds Ascend support for the upstream `ECMooncakeConnector` introduced by vllm-project/vllm#41567, enabling multimodal encoder outputs to be transferred from an Encoder instance to a PD instance through Mooncake Ascend Direct. #### Architecture The implementation keeps the common ECMooncake control plane in upstream vLLM, including the scheduler, consumer reservations, producer push management, and transfer metadata. `AscendECMooncakeConnector` is registered under the standard `ECMooncakeConnector` name and selects an Ascend worker while reusing the upstream scheduler. ```text Router / proxy Encoder / producer PD / consumer | | | |--------image request--------->| | |<-------image metadata---------| | |----------------------metadata-only decode----------------------->| | |-------reserve destination------->| | |<-------session + address---------| | |======Mooncake batch write=======>| | v PD model runner ``` The Ascend worker supplies the NPU-specific data path: - Allocates and registers 2 MiB-aligned NPU memory for the producer staging pool and consumer pool. - Tries the producer staging pool first. When an encoder output cannot fit there, it registers the source memory for direct transfer and uses a shared bounce arena for any bytes that cannot be transferred directly. - Packs source fragments into transfer waves and submits batched Mooncake writes. Registrations, bounce leases, and source tensors remain valid until their transfers finish, including failure and shutdown paths. - Initializes the Ascend Mooncake TransferEngine, validates the `ascend` protocol and NPU buffer device, and integrates worker-service startup and shutdown with the Ascend worker lifecycle. ```text Producer NPU allocation (registered once) +----------------------+-----------+---------------------+ | Staging pool | alignment | shared bounce arena | | | padding | | +----------------------+-----------+---------------------+ NORMAL: the output batch fits in staging encoder output -> copy into staging -> Mooncake write -> PD EC pool FALLBACK: the output batch does not fit in staging encoder output | +-------------+-------------+ | | prefix (if any) remainder (if any) | | copy to bounce arena register original NPU storage | | +-------------+-------------+ | v batched Mooncake write | v PD EC pool (original order) ``` The bounce arena is a reusable part of the producer's registered allocation. In the fallback path, it carries only a source prefix that cannot be covered by a valid aligned registration; the remaining bytes transfer directly from the original NPU storage. Both fragments join the same batched write. ### Does this PR introduce any user-facing change? Yes. Encoder and PD instances can select `ECMooncakeConnector` with an NPU EC buffer and the Ascend Mooncake protocol. For example, the measured EPD configuration used the following `--ec-transfer-config` values: Encoder (`ec_producer`): ```bash --ec-transfer-config \ '{"ec_connector":"ECMooncakeConnector","ec_role":"ec_producer","ec_buffer_size":3221225472,"ec_buffer_device":"npu","ec_connector_extra_config":{"mooncake_protocol":"ascend"}}' ``` The producer can also set `ascend_mooncake_bounce_arena_size` in `ec_connector_extra_config` to size the shared bounce arena in bytes. It is additional registered NPU memory, separate from the `ec_buffer_size` staging pool. For example, to request a 64 MiB arena, set the producer's `ec_connector_extra_config` to: ```json {"mooncake_protocol":"ascend","ascend_mooncake_bounce_arena_size":67108864} ``` PD (`ec_consumer`; use a distinct `ec_port` for each PD instance): ```bash --ec-transfer-config \ '{"ec_connector":"ECMooncakeConnector","ec_role":"ec_consumer","ec_ip":"127.0.0.1","ec_port":8301,"ec_buffer_size":3221225472,"ec_buffer_device":"npu","ec_connector_extra_config":{"mooncake_protocol":"ascend"}}' ``` The E2E and benchmark runs used Model Runner V2. ### How was this patch tested? #### Model Runner V2 E2E validation On Ascend hardware, the E+PD E2E test passed both cases: a normal staging transfer and a forced fallback transfer with a one-byte staging pool. The latter repeats requests to exercise direct registration, bounce-buffer transfer, and resource reuse. The test checks single-image and two-image responses against a single-server baseline. #### Multi-image performance comparison The benchmark used two 910C with the model `Qwen3.6-35B-A3B-w8a8`. The three deployments processed the same 750 MMIU multi-image requests in the same order. Each had separate warm-up requests, eight client processes, concurrency 96, identical generation settings, and prefix caching disabled. Graph execution was enabled. The ECMooncake runs used 3 GiB producer and consumer EC pools. All three runs completed 750/750 measured requests with HTTP 200 and zero client failures. | Metric | 1E3PD, ECMooncake | 2E2PD, ECMooncake | DP4EP4 baseline | |---|---:|---:|---:| | Request throughput | 1.692 req/s | **3.022 req/s** | 2.107 req/s | | P50 TTFT | 52.68 s | **28.93 s** | 41.18 s | | P95 TTFT | 103.21 s | 62.85 s | **57.30 s** | | P50 end-to-end latency | 52.96 s | **28.99 s** | 48.33 s | | P95 end-to-end latency | 103.22 s | **62.87 s** | 66.03 s | | Accuracy in this benchmark | 54.93% | 55.73% | 55.73% | Under this workload, 2E2PD achieved 78.6% more request throughput than 1E3PD and 43.5% more than the monolithic DP4EP4 baseline. It also had the lowest median TTFT and end-to-end latency. DP4EP4 had the lowest P95 TTFT. Accuracy is the benchmark's parsed-choice score over all measured requests; responses without a parsed choice count as incorrect. It is specific to this test configuration. - vLLM main: vllm-project/vllm@c4df37d --------- Signed-off-by: Akine-Ko <2923601304@qq.com>
β¦rEngine (vllm-project#41567) Signed-off-by: Teng Ma <sima.mt@alibaba-inc.com> Signed-off-by: Tianyu Guo <guoty@inferact.ai> Signed-off-by: Zhou ziheng <jiaranran2@gmail.com> Signed-off-by: jiangkuaixue123 <jiangxiaozhou111@163.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Tianyu Guo <guoty@inferact.ai> Co-authored-by: Zhou ziheng <jiaranran2@gmail.com> Co-authored-by: jiangkuaixue123 <jiangxiaozhou111@163.com> Co-authored-by: OpenAI Codex <codex@openai.com>
vllm-project#16124) ### What this PR does / why we need it Refs vllm-project#15898. This PR adds Ascend support for the upstream `ECMooncakeConnector` introduced by vllm-project/vllm#41567, enabling multimodal encoder outputs to be transferred from an Encoder instance to a PD instance through Mooncake Ascend Direct. #### Architecture The implementation keeps the common ECMooncake control plane in upstream vLLM, including the scheduler, consumer reservations, producer push management, and transfer metadata. `AscendECMooncakeConnector` is registered under the standard `ECMooncakeConnector` name and selects an Ascend worker while reusing the upstream scheduler. ```text Router / proxy Encoder / producer PD / consumer | | | |--------image request--------->| | |<-------image metadata---------| | |----------------------metadata-only decode----------------------->| | |-------reserve destination------->| | |<-------session + address---------| | |======Mooncake batch write=======>| | v PD model runner ``` The Ascend worker supplies the NPU-specific data path: - Allocates and registers 2 MiB-aligned NPU memory for the producer staging pool and consumer pool. - Tries the producer staging pool first. When an encoder output cannot fit there, it registers the source memory for direct transfer and uses a shared bounce arena for any bytes that cannot be transferred directly. - Packs source fragments into transfer waves and submits batched Mooncake writes. Registrations, bounce leases, and source tensors remain valid until their transfers finish, including failure and shutdown paths. - Initializes the Ascend Mooncake TransferEngine, validates the `ascend` protocol and NPU buffer device, and integrates worker-service startup and shutdown with the Ascend worker lifecycle. ```text Producer NPU allocation (registered once) +----------------------+-----------+---------------------+ | Staging pool | alignment | shared bounce arena | | | padding | | +----------------------+-----------+---------------------+ NORMAL: the output batch fits in staging encoder output -> copy into staging -> Mooncake write -> PD EC pool FALLBACK: the output batch does not fit in staging encoder output | +-------------+-------------+ | | prefix (if any) remainder (if any) | | copy to bounce arena register original NPU storage | | +-------------+-------------+ | v batched Mooncake write | v PD EC pool (original order) ``` The bounce arena is a reusable part of the producer's registered allocation. In the fallback path, it carries only a source prefix that cannot be covered by a valid aligned registration; the remaining bytes transfer directly from the original NPU storage. Both fragments join the same batched write. ### Does this PR introduce any user-facing change? Yes. Encoder and PD instances can select `ECMooncakeConnector` with an NPU EC buffer and the Ascend Mooncake protocol. For example, the measured EPD configuration used the following `--ec-transfer-config` values: Encoder (`ec_producer`): ```bash --ec-transfer-config \ '{"ec_connector":"ECMooncakeConnector","ec_role":"ec_producer","ec_buffer_size":3221225472,"ec_buffer_device":"npu","ec_connector_extra_config":{"mooncake_protocol":"ascend"}}' ``` The producer can also set `ascend_mooncake_bounce_arena_size` in `ec_connector_extra_config` to size the shared bounce arena in bytes. It is additional registered NPU memory, separate from the `ec_buffer_size` staging pool. For example, to request a 64 MiB arena, set the producer's `ec_connector_extra_config` to: ```json {"mooncake_protocol":"ascend","ascend_mooncake_bounce_arena_size":67108864} ``` PD (`ec_consumer`; use a distinct `ec_port` for each PD instance): ```bash --ec-transfer-config \ '{"ec_connector":"ECMooncakeConnector","ec_role":"ec_consumer","ec_ip":"127.0.0.1","ec_port":8301,"ec_buffer_size":3221225472,"ec_buffer_device":"npu","ec_connector_extra_config":{"mooncake_protocol":"ascend"}}' ``` The E2E and benchmark runs used Model Runner V2. ### How was this patch tested? #### Model Runner V2 E2E validation On Ascend hardware, the E+PD E2E test passed both cases: a normal staging transfer and a forced fallback transfer with a one-byte staging pool. The latter repeats requests to exercise direct registration, bounce-buffer transfer, and resource reuse. The test checks single-image and two-image responses against a single-server baseline. #### Multi-image performance comparison The benchmark used two 910C with the model `Qwen3.6-35B-A3B-w8a8`. The three deployments processed the same 750 MMIU multi-image requests in the same order. Each had separate warm-up requests, eight client processes, concurrency 96, identical generation settings, and prefix caching disabled. Graph execution was enabled. The ECMooncake runs used 3 GiB producer and consumer EC pools. All three runs completed 750/750 measured requests with HTTP 200 and zero client failures. | Metric | 1E3PD, ECMooncake | 2E2PD, ECMooncake | DP4EP4 baseline | |---|---:|---:|---:| | Request throughput | 1.692 req/s | **3.022 req/s** | 2.107 req/s | | P50 TTFT | 52.68 s | **28.93 s** | 41.18 s | | P95 TTFT | 103.21 s | 62.85 s | **57.30 s** | | P50 end-to-end latency | 52.96 s | **28.99 s** | 48.33 s | | P95 end-to-end latency | 103.22 s | **62.87 s** | 66.03 s | | Accuracy in this benchmark | 54.93% | 55.73% | 55.73% | Under this workload, 2E2PD achieved 78.6% more request throughput than 1E3PD and 43.5% more than the monolithic DP4EP4 baseline. It also had the lowest median TTFT and end-to-end latency. DP4EP4 had the lowest P95 TTFT. Accuracy is the benchmark's parsed-choice score over all measured requests; responses without a parsed choice count as incorrect. It is specific to this test configuration. - vLLM main: vllm-project/vllm@c4df37d --------- Signed-off-by: Akine-Ko <2923601304@qq.com>
β¦t handling The DyntraLB and Balance schedulers keep a local copy of schedule() that still unpacks four values from _try_schedule_encoder_inputs. vllm-project/vllm#59942 added a fifth, the duplicate encoder inputs, so on vLLM 0.32 and later every multimodal request raised "too many values to unpack" in these schedulers. Take the fifth value and allocate through _allocate_encoder_inputs as upstream does, which also keeps the cache reference of a repeated image. DyntraLB still accepts the v0.26 contract; the Recompute scheduler already followed upstream. vllm-project/vllm#57368 lets the scheduler tell the MRV2 worker to drop a multimodal input's CPU payload once its placeholder range is confirmed, and to send it back when a rewind needs it encoded again. None of the copies, Recompute included, filled SchedulerOutput.encoder_input_updates, so the worker kept every request's pixels until the request finished. Forward the upstream helper's result from each copy. vllm-project/vllm#41567 holds back a request while the EC connector is still transferring one of its encoder outputs. Besides new waiting requests, it checks running chunks and waiting requests that resume with computed tokens, after an async KV load or a streaming-input chunk. The DyntraLB and Balance copies only checked new waiting requests, so with an asynchronous connector such as ECMooncakeConnector they could schedule an input whose encoder output had not arrived. Add the two checks; the Recompute copy already has them. The connector hooks the same change added to update_from_output() and to freeing are inherited unchanged. With the running check, the scheduler asks the EC connector about every running multimodal request on every step. ECMemcacheConnector ignored the num_computed_tokens it is given and forgets its hits at the end of each step, so each decode step queried memcache again for inputs that were consumed long ago and counted each answer as another hit in hit_rate. Skip inputs whose placeholder range ends before num_computed_tokens, as ECMooncakeConnector does, and remember the keys memcache reported missing in the current step so has_cache_item does not query them a second time. A failed lookup is not remembered and is retried there. Both sets are cleared when the step's connector metadata is built, because a missing key may be saved by this step's encode. Signed-off-by: wenshanchao <wenshanchao@huawei.com>
β¦t handling The DyntraLB and Balance schedulers keep a local copy of schedule() that still unpacks four values from _try_schedule_encoder_inputs. vllm-project/vllm#59942 added a fifth, the duplicate encoder inputs, so on vLLM 0.32 and later every multimodal request raised "too many values to unpack" in these schedulers. Take the fifth value and allocate through _allocate_encoder_inputs as upstream does, which also keeps the cache reference of a repeated image. DyntraLB still accepts the v0.26 contract; the Recompute scheduler already followed upstream. vllm-project/vllm#57368 lets the scheduler tell the MRV2 worker to drop a multimodal input's CPU payload once its placeholder range is confirmed, and to send it back when a rewind needs it encoded again. None of the copies, Recompute included, filled SchedulerOutput.encoder_input_updates, so the worker kept every request's pixels until the request finished. Forward the upstream helper's result from each copy. vllm-project/vllm#41567 holds back a request while the EC connector is still transferring one of its encoder outputs. Besides new waiting requests, it checks running chunks and waiting requests that resume with computed tokens, after an async KV load or a streaming-input chunk. The DyntraLB and Balance copies only checked new waiting requests, so with an asynchronous connector such as ECMooncakeConnector they could schedule an input whose encoder output had not arrived. Add the two checks; the Recompute copy already has them. The connector hooks the same change added to update_from_output() and to freeing are inherited unchanged. With the running check, the scheduler asks the EC connector about every running multimodal request on every step. ECMemcacheConnector ignored the num_computed_tokens it is given and forgets its hits at the end of each step, so each decode step queried memcache again for inputs that were consumed long ago and counted each answer as another hit in hit_rate. Skip inputs whose placeholder range ends before num_computed_tokens, as ECMooncakeConnector does. Signed-off-by: wenshanchao <wenshanchao@huawei.com>
β¦t handling The DyntraLB and Balance schedulers keep a local copy of schedule() that still unpacks four values from _try_schedule_encoder_inputs. vllm-project/vllm#59942 added a fifth, the duplicate encoder inputs, so on vLLM 0.32 and later every multimodal request raised "too many values to unpack" in these schedulers. Take the fifth value and allocate through _allocate_encoder_inputs as upstream does, which also keeps the cache reference of a repeated image. DyntraLB still accepts the v0.26 contract; the Recompute scheduler already followed upstream. vllm-project/vllm#57368 lets the scheduler tell the MRV2 worker to drop a multimodal input's CPU payload once its placeholder range is confirmed, and to send it back when a rewind needs it encoded again. None of the copies, Recompute included, filled SchedulerOutput.encoder_input_updates, so the worker kept every request's pixels until the request finished. Forward the upstream helper's result from each copy. vllm-project/vllm#41567 has the scheduler ask the EC connector before each running chunk and before a waiting request that resumes with computed tokens, after an async KV load or a streaming-input chunk. The call is where ECMooncakeConnector starts a load; has_cache_item only reports whether an item can be served. The DyntraLB and Balance copies asked only for new waiting requests. When an encoder output that was in the local cache at admission is evicted before a later chunk needs it, or a resumed request brings an input whose output the Encoder has pushed but nobody has loaded, Mooncake still reports the item as available. The copies then scheduled it as an external load without dispatching the load, so the model runner would find no encoder output for it ("Encoder cache miss"). Add the two checks; the Recompute copy already has them. The connector hooks the same change added to update_from_output() and to freeing are inherited unchanged. With the running check, the scheduler asks the EC connector about every running multimodal request on every step. ECMemcacheConnector ignored the num_computed_tokens it is given and forgets its hits at the end of each step, so each decode step queried memcache again for inputs that were consumed long ago and counted each answer as another hit in hit_rate. Skip inputs whose placeholder range ends before num_computed_tokens, as ECMooncakeConnector does. Signed-off-by: wenshanchao <wenshanchao@huawei.com>
β¦t handling The DyntraLB and Balance schedulers keep a local copy of schedule() that still unpacks four values from _try_schedule_encoder_inputs. vllm-project/vllm#59942 added a fifth, the duplicate encoder inputs, so on vLLM 0.32 and later every multimodal request raised "too many values to unpack" in these schedulers. Take the fifth value and allocate through _allocate_encoder_inputs as upstream does, which also keeps the cache reference of a repeated image. The Recompute scheduler already followed upstream. vllm-project/vllm#57368 lets the scheduler tell the MRV2 worker to drop a multimodal input's CPU payload once its placeholder range is confirmed, and to send it back when a rewind needs it encoded again. None of the copies, Recompute included, filled SchedulerOutput.encoder_input_updates, so the worker kept every request's pixels until the request finished. Forward the upstream helper's result from each copy. vllm-project/vllm#41567 has the scheduler ask the EC connector before each running chunk and before a waiting request that resumes with computed tokens, after an async KV load or a streaming-input chunk. The call is where ECMooncakeConnector starts a load; has_cache_item only reports whether an item can be served. The DyntraLB and Balance copies asked only for new waiting requests. When an encoder output that was in the local cache at admission is evicted before a later chunk needs it, or a resumed request brings an input whose output the Encoder has pushed but nobody has loaded, Mooncake still reports the item as available. The copies then scheduled it as an external load without dispatching the load, so the model runner would find no encoder output for it ("Encoder cache miss"). Add the two checks; the Recompute copy already has them. The connector hooks the same change added to update_from_output() and to freeing are inherited unchanged. With the running check, the scheduler asks the EC connector about every running multimodal request on every step. ECMemcacheConnector ignored the num_computed_tokens it is given and forgets its hits at the end of each step, so each decode step queried memcache again for inputs that were consumed long ago and counted each answer as another hit in hit_rate. Skip inputs whose placeholder range ends before num_computed_tokens, as ECMooncakeConnector does. Signed-off-by: wenshanchao <wenshanchao@huawei.com>
β¦t handling The DyntraLB and Balance schedulers keep a local copy of schedule() that still unpacks four values from _try_schedule_encoder_inputs. vllm-project/vllm#59942 added a fifth, the duplicate encoder inputs, so on vLLM 0.32 and later every multimodal request raised "too many values to unpack" in these schedulers. Take the fifth value and allocate through _allocate_encoder_inputs as upstream does, which also keeps the cache reference of a repeated image. The Recompute scheduler already followed upstream. vllm-project/vllm#57368 lets the scheduler tell the MRV2 worker to drop a multimodal input's CPU payload once its placeholder range is confirmed, and to send it back when a rewind needs it encoded again. None of the copies, Recompute included, filled SchedulerOutput.encoder_input_updates, so the worker kept every request's pixels until the request finished. Forward the upstream helper's result from each copy. vllm-project/vllm#41567 has the scheduler ask the EC connector before each running chunk and before a waiting request that resumes with computed tokens, after an async KV load or a streaming-input chunk. The call is where ECMooncakeConnector starts a load; has_cache_item only reports whether an item can be served. The DyntraLB and Balance copies asked only for new waiting requests. When an encoder output that was in the local cache at admission is evicted before a later chunk needs it, or a resumed request brings an input whose output the Encoder has pushed but nobody has loaded, Mooncake still reports the item as available. The copies then scheduled it as an external load without dispatching the load, so the model runner would find no encoder output for it ("Encoder cache miss"). Add the two checks; the Recompute copy already has them. The connector hooks the same change added to update_from_output() and to freeing are inherited unchanged. With the running check, the scheduler asks the EC connector about every running multimodal request on every step. ECMemcacheConnector ignored the num_computed_tokens it is given and forgets its hits at the end of each step, so each decode step queried memcache again for inputs that were consumed long ago and counted each answer as another hit in hit_rate. Skip inputs whose placeholder range ends before num_computed_tokens, as ECMooncakeConnector does. Signed-off-by: wenshanchao <wenshanchao@huawei.com>
β¦t handling The DyntraLB and Balance schedulers keep a local copy of schedule() that still unpacks four values from _try_schedule_encoder_inputs. vllm-project/vllm#59942 added a fifth, the duplicate encoder inputs, so on vLLM 0.32 and later every multimodal request raised "too many values to unpack" in these schedulers. Take the fifth value and allocate through _allocate_encoder_inputs as upstream does, which also keeps the cache reference of a repeated image. The Recompute scheduler already followed upstream. vllm-project/vllm#57368 lets the scheduler tell the MRV2 worker to drop a multimodal input's CPU payload once its placeholder range is confirmed, and to send it back when a rewind needs it encoded again. None of the copies, Recompute included, filled SchedulerOutput.encoder_input_updates, so the worker kept every request's pixels until the request finished. Forward the upstream helper's result from each copy. vllm-project/vllm#41567 has the scheduler ask the EC connector before each running chunk and before a waiting request that resumes with computed tokens, after an async KV load or a streaming-input chunk. The call is where ECMooncakeConnector starts a load; has_cache_item only reports whether an item can be served. The DyntraLB and Balance copies asked only for new waiting requests. When an encoder output that was in the local cache at admission is evicted before a later chunk needs it, or a resumed request brings an input whose output the Encoder has pushed but nobody has loaded, Mooncake still reports the item as available. The copies then scheduled it as an external load without dispatching the load, so the model runner would find no encoder output for it ("Encoder cache miss"). Add the two checks; the Recompute copy already has them. The connector hooks the same change added to update_from_output() and to freeing are inherited unchanged. With the running check, the scheduler asks the EC connector about every running multimodal request on every step. ECMemcacheConnector ignored the num_computed_tokens it is given and forgets its hits at the end of each step, so each decode step queried memcache again for inputs that were consumed long ago and counted each answer as another hit in hit_rate. Skip inputs whose placeholder range ends before num_computed_tokens, as ECMooncakeConnector does. Signed-off-by: wenshanchao <wenshanchao@huawei.com>
β¦t handling The DyntraLB and Balance schedulers keep a local copy of schedule() that still unpacks four values from _try_schedule_encoder_inputs. vllm-project/vllm#59942 added a fifth, the duplicate encoder inputs, so on vLLM 0.32 and later every multimodal request raised "too many values to unpack" in these schedulers. Take the fifth value and allocate through _allocate_encoder_inputs as upstream does, which also keeps the cache reference of a repeated image. The Recompute scheduler already followed upstream. vllm-project/vllm#57368 lets the scheduler tell the MRV2 worker to drop a multimodal input's CPU payload once its placeholder range is confirmed, and to send it back when a rewind needs it encoded again. None of the copies, Recompute included, filled SchedulerOutput.encoder_input_updates, so the worker kept every request's pixels until the request finished. Forward the upstream helper's result from each copy. vllm-project/vllm#41567 has the scheduler ask the EC connector before each running chunk and before a waiting request that resumes with computed tokens, after an async KV load or a streaming-input chunk. The call is where ECMooncakeConnector starts a load; has_cache_item only reports whether an item can be served. The DyntraLB and Balance copies asked only for new waiting requests. When an encoder output that was in the local cache at admission is evicted before a later chunk needs it, or a resumed request brings an input whose output the Encoder has pushed but nobody has loaded, Mooncake still reports the item as available. The copies then scheduled it as an external load without dispatching the load, so the model runner would find no encoder output for it ("Encoder cache miss"). Add the two checks; the Recompute copy already has them. The connector hooks the same change added to update_from_output() and to freeing are inherited unchanged. With the running check, the scheduler asks the EC connector about every running multimodal request on every step. ECMemcacheConnector ignored the num_computed_tokens it is given and forgets its hits at the end of each step, so each decode step queried memcache again for inputs that were consumed long ago and counted each answer as another hit in hit_rate. Skip inputs whose placeholder range ends before num_computed_tokens, as ECMooncakeConnector does. Signed-off-by: wenshanchao <wenshanchao@huawei.com>
β¦t handling (#22206) ### What this PR does / why we need it? The Balance (`patch_balance_schedule.py`), DyntraLB and Recompute schedulers each keep a local copy of upstream `Scheduler.schedule()`, so upstream fixes inside that method do not reach them. This PR syncs three upstream changes into the copies and fixes one connector side effect they expose. - **vllm-project/vllm#59942** made `_try_schedule_encoder_inputs` return a fifth value (duplicate encoder inputs) and added `_allocate_encoder_inputs`. The Balance and DyntraLB copies still unpacked four values, so on vLLM 0.32 and later every multimodal request raised `ValueError: too many values to unpack (expected 4)` and killed EngineCore. Text-only requests never reach that line, which is why it went unnoticed. The copies now take the fifth value and allocate through the upstream helper, which also keeps the cache reference of a repeated image. Recompute already followed upstream. - **vllm-project/vllm#57368** lets the scheduler tell the Model Runner V2 worker to drop a multimodal input's CPU payload once its placeholder range is consumed, and to reinstall it when a rewind needs it again. None of the copies, Recompute included, filled `SchedulerOutput.encoder_input_updates`, so the worker kept every request's pixels until the request finished. Each copy now forwards `_get_encoder_input_updates()`. - **vllm-project/vllm#41567** asks the EC connector (`ensure_cache_available`) before each running chunk and before a waiting request that resumes with computed tokens, not only for new waiting requests. With `ECMooncakeConnector` that call is what starts a load; `has_cache_item` also answers True for an item that is available on the Encoder but not loaded. The Balance and DyntraLB copies only checked new waiting requests, so an image whose encoder output was evicted from the local cache between prefill chunks was scheduled as an external load that no worker load served, and the model runner raised `Encoder cache miss`. The two checks are added; Recompute already had them. The connector hooks that change added to `update_from_output()` and freeing are inherited unchanged. - **`ECMemcacheConnector`**: with the running check above, the scheduler asks the EC connector about every running multimodal request on every step. `ECMemcacheConnector.ensure_cache_available` ignored `num_computed_tokens` and forgets its hits each step, so each decode step queried memcache again for inputs consumed long ago and counted every answer as a hit. It now skips inputs whose placeholder range ends before `num_computed_tokens`, as `ECMooncakeConnector` does. This already happened with the default upstream scheduler, which has had the running check since #41567. ### Does this PR introduce _any_ user-facing change? Bug fixes only; see `release_notes/fragments/22206.yaml`. No new options or default changes. ### How was this patch tested? **Unit tests** (CPU mode, vLLM v0.33.0): the 16 affected files under `tests/ut/core`, `tests/ut/patch/platform` and `tests/ut/distributed` pass (442 passed, 1 skipped; the skip also happens on main). New tests in `tests/ut/core/test_scheduler_encoder_inputs.py` run against every copied scheduler class: - repeated-image cache references for waiting and running requests; - CPU payload released after prefill and reinstalled after preemption; - an evicted encoder output and a resumed waiting request, driven through the real `AscendECMooncakeScheduler` consumer: the request is deferred and a load is dispatched. With the Balance and DyntraLB checks reverted, exactly those 6 cases fail; Balance then schedules the request with no load dispatched for the image. **End-to-end on Atlas A3** (Qwen2.5-VL-7B-Instruct, Balance with DP=2, `--enforce-eager`, vLLM v0.33.0): | Check | Before | After | | --- | --- | --- | | #59942: one text and one image request through Balance | text OK; image request returns HTTP 500, EngineCore dies with `too many values to unpack (expected 4)` at `patch_balance_schedule.py` `schedule()` | both OK, server alive; outputs match the default scheduler token for token | | #57368: worker `update_encoder_inputs` traced | with the three `encoder_input_updates` lines removed from Balance: no release | one `{0: None}` per image request after prefill; under forced preemption (2560-token KV cache, 8 concurrent image requests) the 2 preempted requests are reinstalled and released again, all 8 complete | | #41567: E + PD with `ECMooncakeConnector` (`mooncake_protocol: ascend`, HCCS), Balance DP=2 on PD. Image B is warm in the PD cache, request R = image A + ~4.5k tokens + image B is chunked 64 tokens per step, and a request with 6 new images evicts B mid-prefill | with the Balance checks reverted: PD raises `Encoder cache miss` for B and EngineCore dies | R reloads B from the Encoder at computed=2816 and answers correctly | Not covered: DyntraLB and Recompute end to end (they run on PD-disaggregated D nodes, which the EPD guide does not give an EC connector; covered by the unit tests above), the streaming-input path of the resumed-waiting check (unit test only), and the unit tests against the pinned vLLM main commit (CI runs them). Note: `/reset_encoder_cache` cannot be used to reproduce the #41567 case on v0.33.0. That version does not reset the Mooncake connector on it and crashes with `Encoder cache miss` with or without this PR; upstream fixed that separately in vllm-project/vllm#66846. --- ### Checklist #### Testing - [x] **Boundary / edge-case coverage**: I reviewed whether this change involves boundary conditions (e.g. empty input, single/zero element, min/max values, off-by-one, sequence-length limits, integer overflow). Where applicable, I added unit tests covering these edge cases in `tests/ut/` or `tests/e2e/`. - [x] **Regression test**: If this PR fixes a bug, I added a regression test that would fail without the fix. - [x] **Error / failure path coverage**: I covered abnormal paths (exceptions, timeouts, out-of-range, division by zero) in addition to the happy path. - [x] **Meaningful & reliable tests**: New tests assert real behavior and are not written merely to satisfy CI. - [ ] **Performance impact**: If this PR touches a performance-sensitive path, I attached benchmark results and added performance regression tests. - vLLM main: vllm-project/vllm@c410543 Signed-off-by: wenshanchao <wenshanchao@huawei.com>
Wire factory and ec_transfer config; add two-process e2e test, EPD full-pipeline script, and README notes.
Purpose
ECMooncakeConnector: encoder-cache (EC) transfer over Mooncake TransferEngine (HTTP registry + ZMQ coordination + pull path), for disaggregated setups where consumers load EC tensors without relying on shared filesystem.ECConnectorFactoryand documentECTransferConfig.ec_connectoroptions (ECExampleConnectorvsECMooncakeConnector, extra config expectations).test_ec_mooncake_transfer_e2e.py): producer oncuda:0, consumer oncuda:1, registry + tensor equality check.run_epd_mooncake_ec_full_pipeline.sh): baseline vs 1E+1PD with Mooncake EC + proxy (optional/heavy path).Test Plan
Lightweight (connector transfer only)
mooncake-transfer-engine,pyzmq,httpx,fastapi,uvicorn, and a built vLLM (import vllm/vllm._Cavailable).