Skip to content

[CI][Benchmarks] Refactor Compute Runtime builds #19303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: sycl
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion devops/scripts/benchmarks/benches/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ def benchmarks(self) -> list[Benchmark]:
def name(self) -> str:
pass

def setup(self):
@abstractmethod
def setup(self) -> None:
return

def additional_metadata(self) -> dict[str, BenchmarkMetadata]:
Expand Down
2 changes: 1 addition & 1 deletion devops/scripts/benchmarks/benches/benchdnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def benchmarks(self) -> list:
)
return benchmarks

def setup(self):
def setup(self) -> None:
if options.sycl is None:
return

Expand Down
2 changes: 1 addition & 1 deletion devops/scripts/benchmarks/benches/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def git_url(self) -> str:
def git_hash(self) -> str:
return "83b9ae3ebb3563552409f3a317cdc1cf3d3ca6bd"

def setup(self):
def setup(self) -> None:
if options.sycl is None:
return

Expand Down
2 changes: 1 addition & 1 deletion devops/scripts/benchmarks/benches/gromacs.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def benchmarks(self) -> list[Benchmark]:
# GromacsBenchmark(self, "0192", "rf", "eager"),
]

def setup(self):
def setup(self) -> None:
self.gromacs_src = git_clone(
self.directory,
"gromacs-repo",
Expand Down
2 changes: 1 addition & 1 deletion devops/scripts/benchmarks/benches/llamacpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def git_url(self) -> str:
def git_hash(self) -> str:
return "916c83bfe7f8b08ada609c3b8e583cf5301e594b"

def setup(self):
def setup(self) -> None:
if options.sycl is None:
return

Expand Down
2 changes: 1 addition & 1 deletion devops/scripts/benchmarks/benches/syclbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def git_url(self) -> str:
def git_hash(self) -> str:
return "31fc70be6266193c4ba60eb1fe3ce26edee4ca5b"

def setup(self):
def setup(self) -> None:
if options.sycl is None:
return

Expand Down
2 changes: 1 addition & 1 deletion devops/scripts/benchmarks/benches/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TestSuite(Suite):
def __init__(self):
return

def setup(self):
def setup(self) -> None:
return

def name(self) -> str:
Expand Down
4 changes: 2 additions & 2 deletions devops/scripts/benchmarks/benches/umf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def __init__(self, directory):
def name(self) -> str:
return "UMF"

def setup(self):
def setup(self) -> None:
if not isUMFAvailable():
return []
return
self.built = True

def benchmarks(self) -> list[Benchmark]:
Expand Down
2 changes: 1 addition & 1 deletion devops/scripts/benchmarks/benches/velocity.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def git_url(self) -> str:
def git_hash(self) -> str:
return "b22215c16f789100449c34bf4eaa3fb178983d69"

def setup(self):
def setup(self) -> None:
if options.sycl is None:
return

Expand Down
52 changes: 52 additions & 0 deletions devops/scripts/benchmarks/git_project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright (C) 2025 Intel Corporation
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
# See LICENSE.TXT
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

from abc import ABC, abstractmethod
from pathlib import Path

from utils.utils import git_clone, run

class GitProject(ABC):
def __init__(self, directory: Path, src_dir: Path, build_dir: Path, install_dir: Path):
self.directory = directory
self.src_dir = src_dir
self.build_dir = build_dir
self.install_dir = install_dir
self.git_url = git_url
self.git_hash = git_hash

@abstractmethod
def setup(self) -> None:
"""Sets up the project environment: checks if the project needs to be cloned
or updated, and prepares the build.
"""
repo_updated = git_clone(self.src_dir, self.git_url, self.git_hash)
repo_installed = self.check_install()
if repo_updated or not repo_installed:
self.rebuild()

def rebuild(self) -> None:
"""Rebuilds the project."""
self.configure()
self.build()
self.install()

def configure(self) -> None:
"""Configures the project."""
run(f"cmake -S {self.src_dir} -B build", cwd=self.src_dir)

def build(self) -> None:
"""Builds the project."""
run(f"cmake --build {self.build_dir}", cwd=self.src_dir)

def install(self) -> None:
"""Installs the project."""
run(f"cmake --install {self.install_dir}", cwd=self.src_dir)

def check_install(self) -> bool:
"""Checks if the project is already installed
by searching for files in the install directory.
"""
return self.install_dir.exists() and any(item.is_file() for item in self.install_dir.iterdir())
Loading
Loading