diff --git a/devops/scripts/benchmarks/benches/compute.py b/devops/scripts/benchmarks/benches/compute.py index bdd07b430f40..a5a71fde9747 100644 --- a/devops/scripts/benchmarks/benches/compute.py +++ b/devops/scripts/benchmarks/benches/compute.py @@ -121,12 +121,16 @@ def additional_metadata(self) -> dict[str, BenchmarkMetadata]: def benchmarks(self) -> list[Benchmark]: benches = [] + # hand-picked value so that total execution time of the benchmark is + # similar on all architectures + long_kernel_exec_time = 200 if "bmg" in options.device_architecture else 20 + for runtime in list(RUNTIMES): # Add SubmitKernel benchmarks using loops for in_order_queue in [0, 1]: for measure_completion in [0, 1]: for use_events in [0, 1]: - for kernel_exec_time in [1, 20]: + for kernel_exec_time in [1, long_kernel_exec_time]: benches.append( SubmitKernel( self, diff --git a/devops/scripts/benchmarks/main.py b/devops/scripts/benchmarks/main.py index d90824bbb8c3..f5fba0b9dc43 100755 --- a/devops/scripts/benchmarks/main.py +++ b/devops/scripts/benchmarks/main.py @@ -661,6 +661,15 @@ def validate_and_parse_env_args(env_args): benchmark_filter = re.compile(args.filter) if args.filter else None + try: + options.device_architecture = get_device_architecture(additional_env_vars) + except Exception as e: + options.device_architecture = "" + print(f"Warning: Failed to fetch device architecture: {e}") + print("Defaulting to generic benchmark parameters.") + + print(options.device_architecture) + main( args.benchmark_directory, additional_env_vars, diff --git a/devops/scripts/benchmarks/options.py b/devops/scripts/benchmarks/options.py index 04a7e76be43e..c6486349ce63 100644 --- a/devops/scripts/benchmarks/options.py +++ b/devops/scripts/benchmarks/options.py @@ -70,6 +70,7 @@ class Options: preset: str = "Full" build_jobs: int = multiprocessing.cpu_count() exit_on_failure: bool = False + device_architecture: str = "" # Options intended for CI: regression_threshold: float = 0.05 diff --git a/devops/scripts/benchmarks/utils/utils.py b/devops/scripts/benchmarks/utils/utils.py index ef2a1222a718..d8284e3f5623 100644 --- a/devops/scripts/benchmarks/utils/utils.py +++ b/devops/scripts/benchmarks/utils/utils.py @@ -7,6 +7,7 @@ import os import shutil import subprocess +import re import tarfile from options import options @@ -174,3 +175,23 @@ def download(dir, url, file, untar=False, unzip=False, checksum=""): else: print(f"{data_file} exists, skipping...") return data_file + + +def get_device_architecture(additional_env_vars): + sycl_ls_output = run( + ["sycl-ls", "--verbose"], add_sycl=True, env_vars=additional_env_vars + ).stdout.decode() + + architectures = set() + for line in sycl_ls_output.splitlines(): + if re.match(r" *Architecture:", line): + _, architecture = line.strip().split(":", 1) + architectures.add(architecture.strip()) + + if len(architectures) != 1: + raise ValueError( + f"Expected exactly one device architecture, but found {len(architectures)}: {architectures}." + "Set ONEAPI_DEVICE_SELECTOR=backend:device_id to specify a single device." + ) + + return architectures.pop()