Skip to content

Commit 29b814c

Browse files
committed
perf: enable Mooncake shared KV read-ahead by default
Prefetch up to two shared source layers on eligible workers without an extra configuration key. Update the expected submission order and keep the guide and release fragment out of this PR. Signed-off-by: fangrongcan <17343701736@163.com>
1 parent 30cf329 commit 29b814c

4 files changed

Lines changed: 7 additions & 20 deletions

File tree

‎docs/source/user_guide/feature_guide/kv_cache_pool_ascend_store.md‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,15 +1596,12 @@ Refer to the verification operations in Steps 1-5 of Configuration Examples.
15961596
| `save_decode_cache` | bool | false | No | true / false | Save complete Decode KV blocks on a consumer. Prefill writes are skipped until Decode saving starts, when missing Prefill ancestors can be filled. Supports blockwise and layerwise transfer. |
15971597
| `enable_lookup` | bool | true on `kv_producer` and `kv_both`; false on `kv_consumer` | No | true / false | Whether this node queries KV Pool for reusable KV. |
15981598
| `use_layerwise` | bool | false | No | true / false | Layer-by-layer KV save/load, supported by both Mooncake and Memcache backends. Decode saving requires `save_decode_cache=true`. |
1599-
| `early_shared_loads` | bool | false | No | true / false | Prefetches up to two shared KV source layers ahead for Mooncake layerwise Prefill with persistent full-attention cache groups. Set on the `AscendStoreConnector` extra config. |
16001599
| `prefill_pp_size` | int | 1 | Required when Prefill PP + consumer writes | Positive integer | Prefill PP size. |
16011600
| `prefill_pp_layer_partition` | str | No default | No | Comma-separated layer numbers, e.g., "30,31" | Prefill PP layer partition. If not configured, layers are evenly divided by `prefill_pp_size`. |
16021601
| `qos_priority` | int | 0 | No | [0, 4] (integer, larger = higher priority) | KV Pool transfer QoS priority. |
16031602
16041603
Existing configurations must replace `consumer_is_to_load` with `enable_lookup` and `consumer_is_to_put` with `save_decode_cache`. The latter saves complete Decode KV blocks and fills missing Prefill ancestors when Decode saving starts; it does not save transferred Prefill KV during Prefill. The old options raise an error at startup.
16051604
1606-
For DeepSeek V4.1 Prefill, set `"backend": "mooncake"` and `"use_layerwise": true` in the `AscendStoreConnector` extra config. Use Model Runner V2 and eager execution (`--enforce-eager`). The connector prefetches shared KV according to `kv_source_layer_ids`. With SWA bounded replay enabled, the pool restores the prefix-cacheable KV and the model rebuilds private SWA state. When using `MooncakeConnectorV2` for P/D disaggregation, set its own `use_layerwise` option separately to select P/D Push.
1607-
16081605
**NOTE:** When using `AscendStoreConnector` together with `MooncakeConnector` (V1) or `MooncakeConnectorV2`, the current TCP port allocations may still overlap ports reserved by other workers or components. This includes V1 worker handshake ports and V2 scheduler control ports. Distinct DP indices do not guarantee disjoint TCP port ranges; check these allocations against worker and component port reservations before deployment. `lookup_rpc_port` only identifies the local IPC endpoint and does not resolve these TCP port conflicts.
16091606
16101607
### ASCEND_GLOBAL_RESOURCE_CONFIG

‎release_notes/fragments/22988.yaml‎

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎tests/ut/distributed/ascend_store/test_shared_source_layerwise.py‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,11 @@ def record(task, submitted=submitted, worker=worker, enqueue=enqueue):
336336
boundary_event.return_value.synchronize.assert_called_once()
337337
self.assertEqual(
338338
submitted,
339-
[(0, 2), (2, 8), (8, 14), (14, 20), (23, 24)]
339+
[(0, 2), (0, 8), (2, 14), (8, 20), (23, 24)]
340340
if bounded
341-
else [(0, layer) for layer in range(3)]
342-
+ [(2, layer) for layer in range(3, 9)]
343-
+ [(8, layer) for layer in range(9, 15)]
344-
+ [(14, layer) for layer in range(15, 21)]
341+
else [(0, layer) for layer in range(9)]
342+
+ [(2, layer) for layer in range(9, 15)]
343+
+ [(8, layer) for layer in range(15, 21)]
345344
+ [(20, 21), (21, 22), (22, 23), (23, 24)],
346345
)
347346
self.assertFalse(store.open_reads)
@@ -362,9 +361,8 @@ def test_failed_range_load_releases_sessions_before_attention(self):
362361
self.assertTrue(worker.get_block_ids_with_load_errors())
363362
self.assertFalse(store.open_reads)
364363

365-
def test_early_shared_loads_wait_for_compute_boundary_on_receive_thread(self):
364+
def test_shared_read_ahead_waits_for_compute_boundary_on_receive_thread(self):
366365
connector, worker, store, _ = self.make_connector(bounded=True, draft=False)
367-
worker._extra_config["early_shared_loads"] = True
368366
self.bind_step(connector, worker)
369367
self.forward(connector, worker)
370368
self.bind_step(connector, worker, load=True)

‎vllm_ascend/distributed/kv_transfer/kv_pool/ascend_store/layerwise/pool_worker.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,7 @@ def submit_layer_load(layer_id: int, boundary: torch.npu.Event | None) -> bool:
15991599
# Keep tail SWA and draft loads one layer ahead.
16001600
window_end += 1
16011601
elif self.current_layer == 0 or self.current_layer in source_layers:
1602-
# Submit the intervening SWA before the next shared source.
1602+
# Submit intervening SWA along with the shared sources in the window.
16031603
future_sources = [layer for layer in source_layers if layer > self.current_layer]
16041604
sources_ahead = 2 if self._shared_read_ahead_enabled() else 1
16051605
window_end = future_sources[min(sources_ahead, len(future_sources)) - 1]
@@ -1669,8 +1669,7 @@ def save_dflash_draft_kv(self, metadata: AscendConnectorMetadata) -> None:
16691669
def _shared_read_ahead_enabled(self) -> bool:
16701670
# Only extend the window for the persistent full-attention pages.
16711671
return (
1672-
getattr(self, "_extra_config", {}).get("early_shared_loads", False)
1673-
and self.has_shared_kv
1672+
self.has_shared_kv
16741673
and getattr(self._data_plane, "_retain_running_prefix", False)
16751674
and not self.prefetch_layer_map
16761675
)

0 commit comments

Comments
 (0)