From e0d08797944277090699da03e29e8a3c0739e0f4 Mon Sep 17 00:00:00 2001 From: andyluo7 <43718156+andyluo7@users.noreply.github.com> Date: Tue, 8 Sep 2026 22:48:08 -0700 Subject: [PATCH] [Bugfix][Magi2] Allow import without an active Triton driver (#7239) Signed-off-by: andyluo7 --- vllm_omni/diffusion/models/magi2/mh_moe.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/vllm_omni/diffusion/models/magi2/mh_moe.py b/vllm_omni/diffusion/models/magi2/mh_moe.py index 6419cfae8..9e1e0788a 100644 --- a/vllm_omni/diffusion/models/magi2/mh_moe.py +++ b/vllm_omni/diffusion/models/magi2/mh_moe.py @@ -21,7 +21,7 @@ from typing import Literal import torch import torch.nn as nn import torch.nn.functional as F -from vllm.triton_utils import tl, triton +from vllm.triton_utils import HAS_TRITON, tl, triton from vllm_omni.platforms import current_omni_platform @@ -133,9 +133,10 @@ def torch_mh_moe_forward( return output -_SWIGLU7_ALPHA = tl.constexpr(1.702) -_SWIGLU7_LIMIT = tl.constexpr(7.0) -_SWIGLU7_BIAS = tl.constexpr(1.0) +# vLLM's no-Triton placeholder exposes ``tl.constexpr`` as ``None``. +_SWIGLU7_ALPHA = tl.constexpr(1.702) if HAS_TRITON else 1.702 +_SWIGLU7_LIMIT = tl.constexpr(7.0) if HAS_TRITON else 7.0 +_SWIGLU7_BIAS = tl.constexpr(1.0) if HAS_TRITON else 1.0 @triton.jit @@ -198,7 +199,7 @@ def _mh_moe_kernel( block_t: tl.constexpr, block_dh: tl.constexpr, block_de: tl.constexpr, - acc_dtype: tl.constexpr = tl.float32, + acc_dtype: tl.constexpr, deterministic: tl.constexpr = False, ): tile_id = tl.program_id(0)