[Bugfix][LoRA] Guard TrtLlm BF16 MoE LoRA gate on activation type (#51002)

Signed-off-by: Anh Tran <anhtra@nvidia.com>
Co-authored-by: Khang Ngo <khngo@nvidia.com>
This commit is contained in:
anhtra3889
2026-08-06 18:12:54 +08:00
committed by GitHub
co-authored by Khang Ngo
parent 2fa490470d
commit 872fd5973e
@@ -180,23 +180,21 @@ def map_unquantized_backend(runner_backend: MoEBackend) -> UnquantizedMoeBackend
def _trtllm_bf16_lora_supported(moe_config: FusedMoEConfig) -> bool: def _trtllm_bf16_lora_supported(moe_config: FusedMoEConfig) -> bool:
"""Gate for routing LoRA-enabled BF16 MoE to the FlashInfer TRT-LLM """Gate for routing LoRA-enabled BF16 MoE to the FlashInfer TRT-LLM
gemm1_lora_delta path (PR #3153). Conservative: device + routing method; gemm1_lora_delta path (PR #3153).
the experts class's own _supports_* checks and the modular_kernel LoRA
gate provide the final filtering.
""" """
from vllm.model_executor.layers.fused_moe.experts.trtllm_lora_moe import ( from vllm.model_executor.layers.fused_moe.experts.trtllm_lora_moe import (
TrtLlmBf16LoRAExperts, TrtLlmBf16LoRAExperts,
) )
if not TrtLlmBf16LoRAExperts._supports_current_device(): # LoRA path returns before the oracle loop; reuse is_supported_config here.
return False supported, _ = TrtLlmBf16LoRAExperts.is_supported_config(
if not TrtLlmBf16LoRAExperts._supports_routing_method( TrtLlmBf16LoRAExperts,
moe_config.routing_method, None, None moe_config,
): None,
return False None,
if not TrtLlmBf16LoRAExperts._supports_parallel_config( mk.FusedMoEActivationFormat.Standard,
moe_config.moe_parallel_config )
): if not supported:
return False return False
# The flashinfer trtllm fused-MoE kernel requires the per-partition # The flashinfer trtllm fused-MoE kernel requires the per-partition
# intermediate size to be a multiple of 128. Plain TP shards the MoE # intermediate size to be a multiple of 128. Plain TP shards the MoE