Skip to content

Commit 2ef5c79

Browse files
committed
Trigger benchamrks' cmake build only when needed
1 parent c6fe75b commit 2ef5c79

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

benchmarks/setup.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import sys
66

77
from setuptools import setup
8+
from setuptools.command.build_ext import build_ext as build_ext_orig
89

910
import torch
1011

@@ -85,11 +86,18 @@ def build_extension(self):
8586
subprocess.check_call(["cmake"] + install_args)
8687

8788

88-
cmake = CMakeBuild()
89-
cmake.run()
89+
class build_ext(build_ext_orig):
90+
91+
def run(self):
92+
cmake = CMakeBuild()
93+
cmake.run()
94+
super().run()
95+
9096

9197
setup(name="triton-kernels-benchmark", packages=[
9298
"triton_kernels_benchmark",
9399
], package_dir={
94100
"triton_kernels_benchmark": "triton_kernels_benchmark",
95-
}, package_data={"triton_kernels_benchmark": ["xetla_kernel.cpython-*.so"]})
101+
}, package_data={"triton_kernels_benchmark": ["xetla_kernel.cpython-*.so"]}, cmdclass={
102+
"build_ext": build_ext,
103+
})

0 commit comments

Comments
 (0)