[Core][KV Connector] Start async KV loads after the forward launch when no sync loads are scheduled (#53333)
Signed-off-by: Summer Yang <girasoleyang@gmail.com> Signed-off-by: Nick Hill <nickhill123@gmail.com> Co-authored-by: Nick Hill <nickhill123@gmail.com>
This commit is contained in:
@@ -262,6 +262,10 @@ class SchedulerOutput:
|
||||
# KV Cache Connector metadata.
|
||||
kv_connector_metadata: KVConnectorMetadata | None = None
|
||||
|
||||
# Whether any scheduled request consumes KV that the connector loads
|
||||
# synchronously during this step (load_async=False).
|
||||
has_sync_kv_loads: bool = False
|
||||
|
||||
# EC Cache Connector metadata
|
||||
ec_connector_metadata: ECConnectorMetadata | None = None
|
||||
# EC Cache Manager metadata
|
||||
|
||||
@@ -532,6 +532,8 @@ class Scheduler(SchedulerInterface):
|
||||
scheduled_spec_decode_tokens: dict[str, list[int]] = {}
|
||||
# Whether the running batch contains any prefill requests.
|
||||
prefill_scheduled = False
|
||||
# Whether any scheduled request has a synchronous connector KV load.
|
||||
has_sync_kv_loads = False
|
||||
|
||||
# For logging.
|
||||
scheduled_timestamp = time.monotonic()
|
||||
@@ -1142,6 +1144,9 @@ class Scheduler(SchedulerInterface):
|
||||
continue
|
||||
|
||||
self.running.append(request)
|
||||
if num_external_computed_tokens > 0:
|
||||
# load_kv_async is False here
|
||||
has_sync_kv_loads = True
|
||||
if self.log_stats:
|
||||
request.record_event(
|
||||
EngineCoreEventType.SCHEDULED, scheduled_timestamp
|
||||
@@ -1318,6 +1323,7 @@ class Scheduler(SchedulerInterface):
|
||||
finished_req_ids=self.finished_req_ids,
|
||||
free_encoder_mm_hashes=self.encoder_cache_manager.get_freed_mm_hashes(),
|
||||
new_block_ids_to_zero=self._get_new_block_ids_to_zero(),
|
||||
has_sync_kv_loads=has_sync_kv_loads,
|
||||
kv_cache_block_copies=pending_kv_cache_block_copies,
|
||||
partial_tail_offloads=pending_partial_tail_offloads,
|
||||
num_spec_tokens_to_schedule=num_spec_tokens_to_schedule,
|
||||
|
||||
Reference in New Issue
Block a user