Skip to content

Commit 195fa3f

Browse files
committed
[MLIR][test] Check for ml_dtypes before running tests
1 parent 171d3ed commit 195fa3f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

mlir/test/python/execution_engine.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
from mlir.passmanager import *
66
from mlir.execution_engine import *
77
from mlir.runtime import *
8-
from ml_dtypes import bfloat16, float8_e5m2
8+
try:
9+
from ml_dtypes import bfloat16, float8_e5m2
10+
HAS_ML_DTYPES=True
11+
except ModuleNotFoundError:
12+
HAS_ML_DTYPES=False
13+
914

1015
MLIR_RUNNER_UTILS = os.getenv(
1116
"MLIR_RUNNER_UTILS", "../../../../lib/libmlir_runner_utils.so"
@@ -564,7 +569,8 @@ def testBF16Memref():
564569
log(npout)
565570

566571

567-
run(testBF16Memref)
572+
if HAS_ML_DTYPES:
573+
run(testBF16Memref)
568574

569575

570576
# Test f8E5M2 memrefs
@@ -603,7 +609,8 @@ def testF8E5M2Memref():
603609
log(npout)
604610

605611

606-
run(testF8E5M2Memref)
612+
if HAS_ML_DTYPES:
613+
run(testF8E5M2Memref)
607614

608615

609616
# Test addition of two 2d_memref

0 commit comments

Comments
 (0)