Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion python/sglang/srt/disaggregation/decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def __init__(
speculative_num_draft_tokens: int,
enable_mamba_extra_buffer: bool,
pre_alloc_size: int,
mamba_size: int = None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is weird that we have a size and a mamba size for HybridMambaDecodeReqToTokenPool at the same time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had similar concern when I was trying to understand this, but I found its parent class HybridReqToTokenPool also takes both size and mamba_size as separate parameters — they represent different things (max_num_reqs for req-to-token vs max_mamba_cache_size for mamba state)

):
DecodeReqToTokenPool.__init__(
self,
Expand All @@ -172,8 +173,11 @@ def __init__(
)
self.enable_mamba_extra_buffer = enable_mamba_extra_buffer
self.enable_memory_saver = enable_memory_saver
effective_mamba_size = (
mamba_size if mamba_size is not None else size
) + pre_alloc_size
self._init_mamba_pool(
size=size + pre_alloc_size,
size=effective_mamba_size,
mamba_spec_state_size=size + pre_alloc_size,
cache_params=cache_params,
device=device,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ def init_memory_pool(self: ModelRunner, total_gpu_memory: int):
speculative_num_draft_tokens=self.server_args.speculative_num_draft_tokens,
enable_mamba_extra_buffer=self.server_args.enable_mamba_extra_buffer(),
pre_alloc_size=pre_alloc_size,
mamba_size=self.server_args.max_mamba_cache_size,
)
else:
self.req_to_token_pool = DecodeReqToTokenPool(
Expand Down
Loading