[Bugfix][Magi2] Allow import without an active Triton driver (#7239)

Signed-off-by: andyluo7 <andy.luo@amd.com>
This commit is contained in:
andyluo7 authored and GitHub committed 2026-09-08 22:48:08 -07:00
1 parent 09b720b0d2
commit e0d0879794
1 file changed
+6 -5
+6 -5
View File
@@ -21,7 +21,7 @@ from typing import Literal
import torch import torch
import torch.nn as nn import torch.nn as nn
import torch.nn.functional as F 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 from vllm_omni.platforms import current_omni_platform
@@ -133,9 +133,10 @@ def torch_mh_moe_forward(
return output return output
_SWIGLU7_ALPHA = tl.constexpr(1.702) # vLLM's no-Triton placeholder exposes ``tl.constexpr`` as ``None``.
_SWIGLU7_LIMIT = tl.constexpr(7.0) _SWIGLU7_ALPHA = tl.constexpr(1.702) if HAS_TRITON else 1.702
_SWIGLU7_BIAS = tl.constexpr(1.0) _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 @triton.jit
@@ -198,7 +199,7 @@ def _mh_moe_kernel(
block_t: tl.constexpr, block_t: tl.constexpr,
block_dh: tl.constexpr, block_dh: tl.constexpr,
block_de: tl.constexpr, block_de: tl.constexpr,
acc_dtype: tl.constexpr = tl.float32, acc_dtype: tl.constexpr,
deterministic: tl.constexpr = False, deterministic: tl.constexpr = False,
): ):
tile_id = tl.program_id(0) tile_id = tl.program_id(0)