From bc3ca3002330c7a391e01e1b99c523d6e2856881 Mon Sep 17 00:00:00 2001 From: Baidu-AIAK Date: Tue, 23 Dec 2025 12:43:33 +0800 Subject: [PATCH] [PD] Support fake decode for PD disaggregation without prefill node (#14628) Co-authored-by: sunhailiang --- python/sglang/srt/disaggregation/decode.py | 6 +++++- python/sglang/srt/managers/data_parallel_controller.py | 10 ++++++++++ python/sglang/srt/server_args.py | 8 ++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/disaggregation/decode.py b/python/sglang/srt/disaggregation/decode.py index 07059f594..b58f713a1 100644 --- a/python/sglang/srt/disaggregation/decode.py +++ b/python/sglang/srt/disaggregation/decode.py @@ -323,7 +323,11 @@ class DecodePreallocQueue: req.retraction_mb_id = None self.retracted_queue.append(req) else: - if req.bootstrap_host == FAKE_BOOTSTRAP_HOST: + # Auto enable FAKE mode if configured + if req.bootstrap_host == FAKE_BOOTSTRAP_HOST or ( + req.bootstrap_host is None + and self.scheduler.server_args.disaggregation_decode_enable_fake_auto + ): kv_receiver_class = get_kv_class( TransferBackend.FAKE, KVClassType.RECEIVER ) diff --git a/python/sglang/srt/managers/data_parallel_controller.py b/python/sglang/srt/managers/data_parallel_controller.py index ae8c2111a..df37be6cf 100644 --- a/python/sglang/srt/managers/data_parallel_controller.py +++ b/python/sglang/srt/managers/data_parallel_controller.py @@ -489,6 +489,16 @@ class DataParallelController: self.workers ) else: + # Set default bootstrap_room if in FAKE auto mode and room is None + if ( + req.bootstrap_room is None + and self.server_args.disaggregation_decode_enable_fake_auto + ): + req.bootstrap_room = self.round_robin_counter + self.round_robin_counter = (self.round_robin_counter + 1) % len( + self.workers + ) + assert ( req.bootstrap_room is not None ), "req.bootstrap_room should not be None. Do not send requests directly to prefill or decode instances, but send to the router instead." diff --git a/python/sglang/srt/server_args.py b/python/sglang/srt/server_args.py index d3033d5e1..43cbb376d 100644 --- a/python/sglang/srt/server_args.py +++ b/python/sglang/srt/server_args.py @@ -602,6 +602,8 @@ class ServerArgs: disaggregation_prefill_pp: Optional[int] = 1 disaggregation_ib_device: Optional[str] = None disaggregation_decode_enable_offload_kvcache: bool = False + # Enable auto FAKE mode for decode node testing, no need to pass bootstrap_host in request + disaggregation_decode_enable_fake_auto: bool = False num_reserved_decode_tokens: int = 512 # used for decode kv cache offload in PD # FIXME: hack to reduce ITL when decode bs is small disaggregation_decode_polling_interval: int = 1 @@ -4261,6 +4263,12 @@ class ServerArgs: action="store_true", help="Enable async KV cache offloading on decode server (PD mode).", ) + parser.add_argument( + "--disaggregation-decode-enable-fake-auto", + action="store_true", + help="Auto enable FAKE mode for decode node testing, " + "no need to pass bootstrap_host and bootstrap_room in request.", + ) parser.add_argument( "--num-reserved-decode-tokens", type=int,