[AMD] Enable dual-stream MoE on ROCm (#24005)
Signed-off-by: inkcherry <mingzhi.liu@amd.com>
This commit is contained in:
@@ -325,6 +325,9 @@ class Envs:
|
||||
SGLANG_ROCM_FUSED_DECODE_MLA = EnvBool(False)
|
||||
SGLANG_ROCM_DISABLE_LINEARQUANT = EnvBool(False)
|
||||
SGLANG_MORI_NUM_MAX_DISPATCH_TOKENS_PER_RANK = EnvInt(4096)
|
||||
# Enable dual-stream MoE (shared experts vs routed experts) on the
|
||||
# ROCm/AITER path. Requires GPU_MAX_HW_QUEUES>=5 to avoid HW-queue serialization.
|
||||
SGLANG_ROCM_USE_MULTI_STREAM = EnvBool(False)
|
||||
|
||||
# MPS (Apple Silicon)
|
||||
SGLANG_USE_MLX = EnvBool(False)
|
||||
|
||||
@@ -932,6 +932,18 @@ class MoriEPDispatcher(BaseDispatcher):
|
||||
|
||||
self.deepep_mode = deepep_mode
|
||||
|
||||
async_mode = self.deepep_mode.enable_low_latency()
|
||||
if get_bool_env_var("SGLANG_ROCM_USE_MULTI_STREAM") and not async_mode:
|
||||
logger.warning_once(
|
||||
"SGLANG_ROCM_USE_MULTI_STREAM=1 is set but Mori AsyncLL is "
|
||||
"not enabled (--deepep-mode=%s). The alt-stream overlap only "
|
||||
"frees up CUs when dispatch/combine runs on the AsyncLL "
|
||||
"copy-engine kernel; otherwise it stays on CUs and competes "
|
||||
"with the alt-stream work. Pass --deepep-mode low_latency "
|
||||
"(or auto) to enable the AsyncLL kernel.",
|
||||
self.deepep_mode.value,
|
||||
)
|
||||
|
||||
common_kwargs = dict(
|
||||
group=group,
|
||||
router_topk=router_topk,
|
||||
|
||||
@@ -1921,7 +1921,12 @@ class DeepseekV2Model(nn.Module):
|
||||
|
||||
self.alt_stream = (
|
||||
torch.cuda.Stream()
|
||||
if _is_cuda or _is_musa or envs.SGLANG_NPU_USE_MULTI_STREAM.get()
|
||||
if (
|
||||
_is_cuda
|
||||
or _is_musa
|
||||
or envs.SGLANG_NPU_USE_MULTI_STREAM.get()
|
||||
or envs.SGLANG_ROCM_USE_MULTI_STREAM.get()
|
||||
)
|
||||
else None
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user