Skip to content

Commit 0ed1599

Browse files
committed
Merge branch 'unify-benchmark-ci' of https://github.com/intel/llvm into unify-benchmark-ci
2 parents 78fd037 + e15b94f commit 0ed1599

File tree

7 files changed

+78
-72
lines changed

7 files changed

+78
-72
lines changed

.github/workflows/ur-benchmarks-reusable.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,13 @@ jobs:
8080
git checkout origin/pr/${{ inputs.pr_no }}/merge
8181
git rev-parse origin/pr/${{ inputs.pr_no }}/merge
8282
83-
- name: Install pip packages
83+
- name: Create virtual environment
84+
run: python -m venv .venv
85+
86+
- name: Activate virtual environment and install pip packages
8487
run: |
85-
pip install --force-reinstall -r ${{github.workspace}}/sycl-repo/devops/scripts/benchmarks/requirements.txt
88+
source .venv/bin/activate
89+
pip install -r ${{github.workspace}}/sycl-repo/devops/scripts/benchmarks/requirements.txt
8690
8791
- name: Configure SYCL
8892
run: >
@@ -139,6 +143,7 @@ jobs:
139143
working-directory: ${{ github.workspace }}
140144
id: benchmarks
141145
run: >
146+
source .venv/bin/activate &&
142147
taskset -c "${{ env.CORES }}" ${{ github.workspace }}/sycl-repo/devops/scripts/benchmarks/main.py
143148
~/llvm_bench_workdir
144149
--sycl ${{ github.workspace }}/sycl_build

devops/scripts/benchmarks/html/data.js

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

devops/scripts/benchmarks/html/scripts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// Core state
77
let activeRuns = new Set(defaultCompareNames);
88
let chartInstances = new Map();
9+
let suiteNames = new Set();
910
let timeseriesData, barChartsData, allRunNames;
1011

1112
// DOM Elements
@@ -306,7 +307,7 @@ function updateURL() {
306307
url.searchParams.delete('regex');
307308
}
308309

309-
if (activeSuites.length > 0) {
310+
if (activeSuites.length > 0 && activeSuites.length != suiteNames.size) {
310311
url.searchParams.set('suites', activeSuites.join(','));
311312
} else {
312313
url.searchParams.delete('suites');
@@ -444,7 +445,6 @@ function setupRunSelector() {
444445
function setupSuiteFilters() {
445446
suiteFiltersContainer = document.getElementById('suite-filters');
446447

447-
const suiteNames = new Set();
448448
benchmarkRuns.forEach(run => {
449449
run.results.forEach(result => {
450450
suiteNames.add(result.suite);

devops/scripts/benchmarks/main.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from history import BenchmarkHistory
1818
from utils.utils import prepare_workdir
1919
from utils.compute_runtime import *
20-
from presets import preset_get_by_name, presets
20+
from presets import enabled_suites, presets
2121

2222
import argparse
2323
import re
@@ -164,7 +164,7 @@ def main(directory, additional_env_vars, save_name, compare_names, filter):
164164
failures = {}
165165

166166
for s in suites:
167-
if s.name() not in options.preset.suites():
167+
if s.name() not in enabled_suites(options.preset):
168168
continue
169169

170170
suite_benchmarks = s.benchmarks()
@@ -242,7 +242,10 @@ def main(directory, additional_env_vars, save_name, compare_names, filter):
242242
if not options.dry_run:
243243
chart_data = {this_name: results}
244244

245-
history = BenchmarkHistory(directory)
245+
results_dir = directory
246+
if options.custom_results_dir:
247+
results_dir = Path(options.custom_results_dir)
248+
history = BenchmarkHistory(results_dir)
246249
# limit how many files we load.
247250
# should this be configurable?
248251
history.load(1000)
@@ -440,9 +443,15 @@ def validate_and_parse_env_args(env_args):
440443
parser.add_argument(
441444
"--preset",
442445
type=str,
443-
choices=[p.name() for p in presets],
446+
choices=[p for p in presets.keys()],
444447
help="Benchmark preset to run.",
445-
default=options.preset.name(),
448+
default=options.preset,
449+
)
450+
parser.add_argument(
451+
"--results-dir",
452+
type=str,
453+
help="Specify a custom results directory",
454+
default=options.custom_results_dir,
446455
)
447456

448457
args = parser.parse_args()
@@ -469,7 +478,8 @@ def validate_and_parse_env_args(env_args):
469478
options.current_run_name = args.relative_perf
470479
options.cudnn_directory = args.cudnn_directory
471480
options.cublas_directory = args.cublas_directory
472-
options.preset = preset_get_by_name(args.preset)
481+
options.preset = args.preset
482+
options.custom_results_dir = args.results_dir
473483

474484
if args.build_igc and args.compute_runtime is None:
475485
parser.error("--build-igc requires --compute-runtime to be set")

devops/scripts/benchmarks/options.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from dataclasses import dataclass, field
22
from enum import Enum
3-
from presets import Preset, presets
43

4+
from presets import presets
55

66
class Compare(Enum):
77
LATEST = "latest"
@@ -40,7 +40,8 @@ class Options:
4040
compute_runtime_tag: str = "25.05.32567.18"
4141
build_igc: bool = False
4242
current_run_name: str = "This PR"
43-
preset: Preset = presets[0]
43+
preset: str = "Full"
44+
custom_results_dir = None
4445

4546

4647
options = Options()

devops/scripts/benchmarks/output_html.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
def generate_html(benchmark_runs: list, compare_names: list[str]):
1212
# create path to data.js in html folder
1313
html_path = os.path.join(os.path.dirname(__file__), "html")
14+
benchmark_runs.sort(key=lambda run: run.date, reverse=True)
1415

1516
if options.output_html == "local":
1617
data_path = os.path.join(html_path, "data.js")
@@ -40,7 +41,7 @@ def generate_html(benchmark_runs: list, compare_names: list[str]):
4041
if i > 0:
4142
f.write(",\n")
4243
f.write(run.to_json())
43-
f.write("\n];\n")
44+
f.write("\n]\n")
4445

4546
print(
4647
f"Upload {data_path} to a location set in config.js remoteDataUrl argument."

devops/scripts/benchmarks/presets.py

Lines changed: 32 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3,63 +3,36 @@
33
# See LICENSE.TXT
44
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

6-
from typing import List, Type
6+
presets: dict[str, list[str]] = {
7+
"Full": [
8+
"Compute Benchmarks",
9+
"llama.cpp bench",
10+
"SYCL-Bench",
11+
"Velocity Bench",
12+
"UMF",
13+
],
14+
"SYCL": [
15+
"Compute Benchmarks",
16+
"llama.cpp bench",
17+
"SYCL-Bench",
18+
"Velocity Bench",
19+
],
20+
"Minimal": [
21+
"Compute Benchmarks",
22+
],
23+
"Normal": [
24+
"Compute Benchmarks",
25+
"llama.cpp bench",
26+
"Velocity Bench",
27+
],
28+
"Test": [
29+
"Test Suite",
30+
],
31+
}
32+
33+
def enabled_suites(preset: str) -> list[str]:
34+
try:
35+
return presets[preset]
36+
except KeyError:
37+
raise ValueError(f"Preset '{preset}' not found.")
738

8-
class Preset:
9-
def description(self) -> str:
10-
raise NotImplementedError
11-
12-
def name(self) -> str:
13-
return self.__class__.__name__
14-
15-
def suites(self) -> List[str]:
16-
raise NotImplementedError
17-
18-
class Full(Preset):
19-
def description(self) -> str:
20-
return "All available benchmarks."
21-
22-
def suites(self) -> List[str]:
23-
return [
24-
"Compute Benchmarks",
25-
"llama.cpp bench",
26-
"SYCL-Bench",
27-
"Velocity Bench",
28-
"UMF",
29-
]
30-
31-
class SYCL(Preset):
32-
def description(self) -> str:
33-
return "All available benchmarks related to SYCL."
34-
35-
def suites(self) -> List[str]:
36-
return ["Compute Benchmarks", "llama.cpp bench", "SYCL-Bench", "Velocity Bench"]
37-
38-
class Minimal(Preset):
39-
def description(self) -> str:
40-
return "Short microbenchmarks."
41-
42-
def suites(self) -> List[str]:
43-
return ["Compute Benchmarks"]
44-
45-
class Normal(Preset):
46-
def description(self) -> str:
47-
return "Comprehensive mix of microbenchmarks and real applications."
48-
49-
def suites(self) -> List[str]:
50-
return ["Compute Benchmarks", "llama.cpp bench", "Velocity Bench"]
51-
52-
class Test(Preset):
53-
def description(self) -> str:
54-
return "Noop benchmarks for framework testing."
55-
56-
def suites(self) -> List[str]:
57-
return ["Test Suite"]
58-
59-
presets = [Full(), SYCL(), Minimal(), Normal(), Test()]
60-
61-
def preset_get_by_name(name: str) -> Preset:
62-
for p in presets:
63-
if p.name().upper() == name.upper():
64-
return p
65-
raise ValueError(f"Preset '{name}' not found.")

0 commit comments

Comments
 (0)