Skip to content

Commit 20a2870

Browse files
fix: fix ci tests (#97)
This PR added several marks in ci tests. Now ci tests can run successfully with Python 3.10+. However, ci test will still fail with Python 3.9, and it seems to be [a compatibility problem in Flashinfer](flashinfer-ai/flashinfer#1964), and a possible solution is to downgrade Flashinfer to 0.2.6. `test_rmsnorm.py` is modified by pre-commit. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Benchmark tests now detect when CUDA devices are unavailable and are automatically skipped to avoid false failures on non-GPU systems. * Minor formatting cleanup in an integration test import to improve code consistency and readability. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Yuchuan <yuchuan.7streams@gmail.com>
1 parent 458106e commit 20a2870

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

tests/bench/test_benchmark.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
)
2626

2727

28+
@pytest.mark.skipif(
29+
__import__("torch").cuda.device_count() == 0, reason="CUDA devices not available"
30+
)
2831
def test_run_all_empty_traceset(tmp_path: Path):
2932
"""Test run_all with completely empty trace set."""
3033
trace_set = TraceSet(root=str(tmp_path), definitions={}, solutions={}, workloads={}, traces={})
@@ -38,6 +41,9 @@ def test_run_all_empty_traceset(tmp_path: Path):
3841
assert len(result.traces) == 0
3942

4043

44+
@pytest.mark.skipif(
45+
__import__("torch").cuda.device_count() == 0, reason="CUDA devices not available"
46+
)
4147
def test_run_all_no_solutions(tmp_path: Path, caplog):
4248
"""Test run_all with definitions but no solutions."""
4349
# Create definition
@@ -70,6 +76,9 @@ def test_run_all_no_solutions(tmp_path: Path, caplog):
7076
assert len(result.traces) == 0
7177

7278

79+
@pytest.mark.skipif(
80+
__import__("torch").cuda.device_count() == 0, reason="CUDA devices not available"
81+
)
7382
def test_run_all_no_workloads(tmp_path: Path):
7483
"""Test run_all with definitions and solutions but no workloads."""
7584
# Create definition
@@ -109,6 +118,9 @@ def test_run_all_no_workloads(tmp_path: Path):
109118
assert len(result.traces) == 0
110119

111120

121+
@pytest.mark.skipif(
122+
__import__("torch").cuda.device_count() == 0, reason="CUDA devices not available"
123+
)
112124
def test_dump_traces_false(tmp_path: Path):
113125
"""Test run_all with dump_traces=False."""
114126
trace_set = TraceSet(root=str(tmp_path), definitions={}, solutions={}, workloads={}, traces={})

tests/integration/flashinfer/test_rmsnorm.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import torch
32

43
from flashinfer_bench.apply import ApplyConfig, ApplyRuntime, set_apply_runtime

0 commit comments

Comments
 (0)