Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
set mamba_size for HybridMambaDecodeReqToTokenPool
  • Loading branch information
Yangmin Li committed Feb 19, 2026
commit 0270147e66d9ba85be1a3418cbe3127c426fd153
4 changes: 3 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)

Copy link
Collaborator

Choose a reason for hiding this comment

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

In that case, should we rename size to max_num_reqs or kvpool_size to differentiate it from mamba_size? size is too general.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, the name size is a bit generic. Maybe can we keep this PR focused and do the renaming in a separate refactor PR later if needed, since it will change a lot of other call sites.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure. I think only HybridMambaDecodeReqToTokenPool and HybridReqToTokenPool need to be changed.

):
DecodeReqToTokenPool.__init__(
self,
Expand All @@ -172,8 +173,9 @@ 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