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
20 changes: 14 additions & 6 deletions python/sglang/srt/lora/mem_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,23 @@ def get_lora_A_shape(
"num_local_experts",
getattr(self.base_hf_config, "num_experts", 0),
)
# Allocate all MoE buffers with the same maximum rank dimension
# to ensure consistent kernel compilation. The maximum stacking factor is 2.
max_rank_dim = (
max_lora_dim * 2
) # Accommodate maximum stacking (gate_up_proj)
# # Allocate all MoE buffers with the same maximum rank dimension
# # to ensure consistent kernel compilation. The maximum stacking factor is 2.
# max_rank_dim = (
# max_lora_dim * 2
# ) # Accommodate maximum stacking (gate_up_proj)
# return (
# self.max_loras_per_batch,
# num_experts,
# max_rank_dim,
# input_dim,
# )
if self.is_moe_module(module_name):
c = get_stacked_multiply(module_name) # gate_up_proj_moe=2, down_proj_moe=1
return (
self.max_loras_per_batch,
num_experts,
max_rank_dim,
max_lora_dim * c, # according to the actual module to allocate
input_dim,
Comment on lines +172 to 189

Copilot AI Jan 28, 2026

Copy link

Choose a reason for hiding this comment

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

This change leaves a sizable commented-out alternative implementation/return block in get_lora_A_shape, and also includes a redundant nested if self.is_moe_module(module_name) inside an already-true MoE branch. Please remove the commented-out block and simplify the control flow (compute c = get_stacked_multiply(module_name) once) to keep the allocator logic clear.

Copilot uses AI. Check for mistakes.
)
else:
Expand Down
Loading
Loading