Skip to content

Commit 3ddc8bc

Browse files
committed
remove GPU dependencies in test_autotune_add.py
1 parent 76d3188 commit 3ddc8bc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test_autotune_add.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99

1010
cfg.sanitizer_backend = "symexec"
1111

12+
# skip benchmarking in CPU-only environments,
13+
# as do_bench relies on GPUs
14+
if not torch.backends.cuda.is_built():
15+
import triton.testing
16+
triton.testing.do_bench = lambda *_, **__: [0.0, 0.0, 0.0]
17+
from triton.runtime import autotuner
18+
orig_init = autotuner.Autotuner.__init__
19+
def patched_init(self, *args, **kwargs):
20+
orig_init(self, *args, **kwargs)
21+
self.do_bench = lambda *_, **__: [0.0, 0.0, 0.0]
22+
autotuner.Autotuner.__init__ = patched_init
1223

1324
@triton.autotune(
1425
configs=[

0 commit comments

Comments
 (0)