diff --git a/benchmarks/setup.py b/benchmarks/setup.py index 7497f02585..1692415507 100644 --- a/benchmarks/setup.py +++ b/benchmarks/setup.py @@ -125,11 +125,37 @@ def run(self): super().run() -setup(name="triton-kernels-benchmark", packages=[ - "triton_kernels_benchmark", -], package_dir={ - "triton_kernels_benchmark": "triton_kernels_benchmark", -}, package_data={"triton_kernels_benchmark": ["xetla_kernel.cpython-*.so"]}, cmdclass={ - "build_ext": build_ext, - "clean": clean, -}, ext_modules=[CMakeExtension("triton_kernels_benchmark")]) +def get_git_commit_hash(length=8): + try: + cmd = ["git", "rev-parse", f"--short={length}", "HEAD"] + return f"+git{subprocess.check_output(cmd).strip().decode('utf-8')}" + except ( + FileNotFoundError, + subprocess.CalledProcessError, + subprocess.TimeoutExpired, + ): + return "" + + +setup( + name="triton-kernels-benchmark", + version="3.1.0" + get_git_commit_hash(), + packages=["triton_kernels_benchmark"], + install_requires=[ + "torch", + "pandas", + "tabulate", + "matplotlib", + ], + package_dir={"triton_kernels_benchmark": "triton_kernels_benchmark"}, + package_data={"triton_kernels_benchmark": ["xetla_kernel.cpython-*.so"]}, + cmdclass={ + "build_ext": build_ext, + "clean": clean, + }, + ext_modules=[CMakeExtension("triton_kernels_benchmark")], + extra_require={ + "ipex": ["numpy<=2.0", "intel-extension-for-pytorch=2.1.10"], + "pytorch": ["torch>=2.6"], + }, +)