1- # Copyright (C) 2024 Intel Corporation
1+ # Copyright (C) 2024-2025 Intel Corporation
22# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
33# See LICENSE.TXT
44# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55
6+ from dataclasses import dataclass
67import os
78import shutil
89from pathlib import Path
9- from .result import Result
10+ from utils .result import BenchmarkMetadata , BenchmarkTag , Result
1011from options import options
1112from utils .utils import download , run
12- import urllib .request
13- import tarfile
13+
14+ benchmark_tags = [
15+ BenchmarkTag ("SYCL" , "Benchmark uses SYCL runtime" ),
16+ BenchmarkTag ("UR" , "Benchmark uses Unified Runtime API" ),
17+ BenchmarkTag ("L0" , "Benchmark uses Level Zero API directly" ),
18+ BenchmarkTag ("UMF" , "Benchmark uses Unified Memory Framework directly" ),
19+ BenchmarkTag ("micro" , "Microbenchmark focusing on a specific functionality" ),
20+ BenchmarkTag ("application" , "Real application-based performance test" ),
21+ BenchmarkTag ("proxy" , "Benchmark that simulates real application use-cases" ),
22+ BenchmarkTag ("submit" , "Tests kernel submission performance" ),
23+ BenchmarkTag ("math" , "Tests math computation performance" ),
24+ BenchmarkTag ("memory" , "Tests memory transfer or bandwidth performance" ),
25+ BenchmarkTag ("allocation" , "Tests memory allocation performance" ),
26+ BenchmarkTag ("graph" , "Tests graph-based execution performance" ),
27+ BenchmarkTag ("latency" , "Measures operation latency" ),
28+ BenchmarkTag ("throughput" , "Measures operation throughput" ),
29+ BenchmarkTag ("inference" , "Tests ML/AI inference performance" ),
30+ BenchmarkTag ("image" , "Image processing benchmark" ),
31+ BenchmarkTag ("simulation" , "Physics or scientific simulation benchmark" ),
32+ ]
33+
34+ benchmark_tags_dict = {tag .name : tag for tag in benchmark_tags }
1435
1536
1637class Benchmark :
@@ -55,19 +76,25 @@ def create_data_path(self, name, skip_data_dir=False):
5576 data_path = os .path .join (self .directory , name )
5677 else :
5778 data_path = os .path .join (self .directory , "data" , name )
58- if options .rebuild and Path (data_path ).exists ():
79+ if options .redownload and Path (data_path ).exists ():
5980 shutil .rmtree (data_path )
6081
6182 Path (data_path ).mkdir (parents = True , exist_ok = True )
6283
6384 return data_path
6485
65- def download (self , name , url , file , untar = False , unzip = False , skip_data_dir = False ):
86+ def download (
87+ self ,
88+ name ,
89+ url ,
90+ file ,
91+ untar = False ,
92+ unzip = False ,
93+ skip_data_dir = False ,
94+ checksum = "" ,
95+ ):
6696 self .data_path = self .create_data_path (name , skip_data_dir )
67- return download (self .data_path , url , file , untar , unzip )
68-
69- def name (self ):
70- raise NotImplementedError ()
97+ return download (self .data_path , url , file , untar , unzip , checksum )
7198
7299 def lower_is_better (self ):
73100 return True
@@ -87,6 +114,30 @@ def stddev_threshold(self):
87114 def get_suite_name (self ) -> str :
88115 return self .suite .name ()
89116
117+ def name (self ):
118+ raise NotImplementedError ()
119+
120+ def description (self ):
121+ return ""
122+
123+ def notes (self ) -> str :
124+ return None
125+
126+ def unstable (self ) -> str :
127+ return None
128+
129+ def get_tags (self ) -> list [str ]:
130+ return []
131+
132+ def get_metadata (self ) -> BenchmarkMetadata :
133+ return BenchmarkMetadata (
134+ type = "benchmark" ,
135+ description = self .description (),
136+ notes = self .notes (),
137+ unstable = self .unstable (),
138+ tags = self .get_tags (),
139+ )
140+
90141
91142class Suite :
92143 def benchmarks (self ) -> list [Benchmark ]:
@@ -97,3 +148,6 @@ def name(self) -> str:
97148
98149 def setup (self ):
99150 return
151+
152+ def additionalMetadata (self ) -> dict [str , BenchmarkMetadata ]:
153+ return {}
0 commit comments