Skip to content

Commit 67af0b1

Browse files
committed
build: Add guard for entering triton_kernels.py
Signed-off-by: Brandon Groth <[email protected]>
1 parent c5a4f44 commit 67af0b1

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

fms_mo/custom_ext_kernels/triton_kernels.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,23 @@
1515
"""This file contains external kernels for FP and INT8 matmul written in triton."""
1616

1717
# Third Party
18-
from triton.language.extra import libdevice
1918
import torch
19+
20+
# First Party
21+
from fms_mo.utils.import_utils import available_packages
22+
23+
# Assume any calls to the file are requesting triton
24+
if not available_packages["triton"]:
25+
raise ImportError(
26+
"triton python package is not avaialble, please check your installation."
27+
)
28+
29+
# Third Party
30+
from triton.language.extra import libdevice
2031
import triton
2132
import triton.language as tl
2233

34+
2335
DTYPE_I8 = [torch.int8]
2436
DTYPE_F8 = [torch.float8_e4m3fn, torch.float8_e5m2]
2537
DTYPE_8BIT = DTYPE_I8 + DTYPE_F8

0 commit comments

Comments
 (0)