[Orchestrator] Implement cache reset RPC forwarding to AR stage engine cores (#6766)

Signed-off-by: Asthenia <asthenia0412@gmail.com>
Signed-off-by: Gao Han <hgaoaf@connect.ust.hk>
Co-authored-by: Asthenia <asthenia0412@gmail.com>
Co-authored-by: Gao Han <hgaoaf@connect.ust.hk>
This commit is contained in:
authored and GitHub committed 2026-09-24 15:32:07 +00:00
1 parent 535bd35b42
commit 0295eeb6f3
7 files changed
+497 -65

No files matched your search

+20 -6
View File
@@ -704,8 +704,21 @@ class OrchestratorBase:
results: list[Any] = []
stage_ids: list[int] = []
for pool in target_pools:
clear_sender = pool.stage_type != "diffusion" and (
method in ("reset_mm_cache", "sleep")
or (method == "pause_scheduler" and kwargs.get("clear_cache", args[1] if len(args) > 1 else True))
)
for replica_id in pool.live_replica_ids():
try:
if clear_sender:
processor = self._stage_input_processors.get(pool.stage_id)
if processor is not None:
clear = processor.renderer.clear_mm_cache_async()
if timeout is None:
await clear
else:
await asyncio.wait_for(clear, timeout=timeout)
clear_sender = False
stage_result = await pool.collective_rpc(
replica_id=replica_id,
method=method,
@@ -714,13 +727,14 @@ class OrchestratorBase:
kwargs=kwargs,
)
except Exception as exc:
if method not in ("pause_scheduler", "resume_scheduler"):
if (
method not in ("pause_scheduler", "resume_scheduler")
and method not in StagePool._CACHE_RESET_METHODS
):
raise
# A pause or resume that fails on one replica leaves the
# engine usable, so report it as this replica's result
# rather than out of the request handler; the caller
# reaches both through _engine_core_rpc, which raises on
# the error result and can then retry or resume.
# Administrative failures must reach the caller without
# terminating unrelated stages. _engine_core_rpc raises
# on this result; remaining replicas still receive the RPC.
stage_result = {"supported": False, "error": f"{type(exc).__name__}: {exc}"}
stage_ids.append(pool.stage_id)
results.append(stage_result)