From acf7a5fe391d37d18cfa7769a571678b56476689 Mon Sep 17 00:00:00 2001 From: Vlad Penkin Date: Thu, 24 Oct 2024 21:31:57 +0000 Subject: [PATCH 1/2] [ENH] Improve packaging of benchmarks Add proper versioning and install requirements. --- benchmarks/setup.py | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/benchmarks/setup.py b/benchmarks/setup.py index 7497f02585..e859fa11d7 100644 --- a/benchmarks/setup.py +++ b/benchmarks/setup.py @@ -125,11 +125,33 @@ 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 "+git{}".format(subprocess.check_output(cmd).strip().decode("utf-8")) + except Exception: + return "" + + +def get_install_requires(): + install_requires = ["torch", "matplotlib", "pandas", "tabulate"] # yapf: disable + return install_requires + + +setup( + name="triton-kernels-benchmark", + version="3.1.0" + get_git_commit_hash(), + packages=["triton_kernels_benchmark"], + install_requires=get_install_requires(), + 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"] + }, +) From 25d15981d61771ccc39c3763ed605933036186ef Mon Sep 17 00:00:00 2001 From: Vlad Penkin Date: Thu, 24 Oct 2024 22:27:10 +0000 Subject: [PATCH 2/2] [FIX] Benchmarks setup.py - remediate pylint and yapf is --- benchmarks/setup.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/benchmarks/setup.py b/benchmarks/setup.py index e859fa11d7..1692415507 100644 --- a/benchmarks/setup.py +++ b/benchmarks/setup.py @@ -128,21 +128,25 @@ def run(self): def get_git_commit_hash(length=8): try: cmd = ["git", "rev-parse", f"--short={length}", "HEAD"] - return "+git{}".format(subprocess.check_output(cmd).strip().decode("utf-8")) - except Exception: + return f"+git{subprocess.check_output(cmd).strip().decode('utf-8')}" + except ( + FileNotFoundError, + subprocess.CalledProcessError, + subprocess.TimeoutExpired, + ): return "" -def get_install_requires(): - install_requires = ["torch", "matplotlib", "pandas", "tabulate"] # yapf: disable - return install_requires - - setup( name="triton-kernels-benchmark", version="3.1.0" + get_git_commit_hash(), packages=["triton_kernels_benchmark"], - install_requires=get_install_requires(), + install_requires=[ + "torch", + "pandas", + "tabulate", + "matplotlib", + ], package_dir={"triton_kernels_benchmark": "triton_kernels_benchmark"}, package_data={"triton_kernels_benchmark": ["xetla_kernel.cpython-*.so"]}, cmdclass={ @@ -152,6 +156,6 @@ def get_install_requires(): ext_modules=[CMakeExtension("triton_kernels_benchmark")], extra_require={ "ipex": ["numpy<=2.0", "intel-extension-for-pytorch=2.1.10"], - "pytorch": ["torch>=2.6"] + "pytorch": ["torch>=2.6"], }, )