@@ -19,7 +19,7 @@ def setup(self):
19
19
if options .sycl is None :
20
20
return
21
21
22
- repo_path = git_clone (self .directory , "compute-benchmarks-repo" , "https://github.com/intel/compute-benchmarks.git" , "c80ddec9f0b4905bcbeb0f264f710093dc70340d " )
22
+ repo_path = git_clone (self .directory , "compute-benchmarks-repo" , "https://github.com/intel/compute-benchmarks.git" , "XXX " )
23
23
build_path = create_build_path (self .directory , 'compute-benchmarks-build' )
24
24
25
25
configure_command = [
@@ -71,17 +71,20 @@ def benchmarks(self) -> list[Benchmark]:
71
71
72
72
if options .ur is not None :
73
73
benches += [
74
- SubmitKernelUR (self , 0 ),
75
- SubmitKernelUR (self , 1 ),
74
+ SubmitKernelURWithTime (self , 0 ),
75
+ SubmitKernelURWithTime (self , 1 ),
76
+ SubmitKernelURWithCPUCounter (self , 0 ),
77
+ SubmitKernelURWithCPUCounter (self , 1 ),
76
78
]
77
79
78
80
return benches
79
81
80
82
class ComputeBenchmark (Benchmark ):
81
- def __init__ (self , bench , name , test ):
83
+ def __init__ (self , bench , name , test , unit = "time [us]" ):
82
84
self .bench = bench
83
85
self .bench_name = name
84
86
self .test = test
87
+ self .unitType = unit
85
88
super ().__init__ (bench .directory )
86
89
87
90
def bin_args (self ) -> list [str ]:
@@ -91,7 +94,7 @@ def extra_env_vars(self) -> dict:
91
94
return {}
92
95
93
96
def unit (self ):
94
- return " μs"
97
+ return { "time [us]" : " μs", "hw instructions [count]" : "CPU instructions count" }[ self . unitType ]
95
98
96
99
def setup (self ):
97
100
self .benchmark_bin = os .path .join (self .bench .directory , 'compute-benchmarks-build' , 'bin' , self .bench_name )
@@ -108,30 +111,41 @@ def run(self, env_vars) -> list[Result]:
108
111
env_vars .update (self .extra_env_vars ())
109
112
110
113
result = self .run_bench (command , env_vars )
111
- (label , mean ) = self .parse_output (result )
112
- return [ Result (label = self .name (), value = mean , command = command , env = env_vars , stdout = result ) ]
114
+ parsed_results = self .parse_output (result )
115
+ ret = []
116
+ for label , mean , unit in parsed_results :
117
+ if self .unitType in unit :
118
+ extra_label = " CPU count" if self .unitType == "hw instructions [count]" else ""
119
+ ret .append (Result (label = label + extra_label , value = mean , command = command , env = env_vars , stdout = result ))
120
+ return ret
113
121
114
122
def parse_output (self , output ):
115
123
csv_file = io .StringIO (output )
116
124
reader = csv .reader (csv_file )
117
125
next (reader , None )
118
- data_row = next (reader , None )
119
- if data_row is None :
126
+ results = []
127
+ while True :
128
+ data_row = next (reader , None )
129
+ if data_row is None :
130
+ break
131
+ try :
132
+ label = data_row [0 ]
133
+ mean = float (data_row [1 ])
134
+ unit = data_row [7 ]
135
+ results .append ((label , mean , unit ))
136
+ except (ValueError , IndexError ) as e :
137
+ raise ValueError (f"Error parsing output: { e } " )
138
+ if len (results ) == 0 :
120
139
raise ValueError ("Benchmark output does not contain data." )
121
- try :
122
- label = data_row [0 ]
123
- mean = float (data_row [1 ])
124
- return (label , mean )
125
- except (ValueError , IndexError ) as e :
126
- raise ValueError (f"Error parsing output: { e } " )
140
+ return results
127
141
128
142
def teardown (self ):
129
143
return
130
144
131
145
class SubmitKernelSYCL (ComputeBenchmark ):
132
146
def __init__ (self , bench , ioq ):
133
147
self .ioq = ioq
134
- super ().__init__ (bench , "api_overhead_benchmark_sycl" , "SubmitKernel" )
148
+ super ().__init__ (bench , "api_overhead_benchmark_sycl" , "SubmitKernel" , "time [us]" )
135
149
136
150
def name (self ):
137
151
order = "in order" if self .ioq else "out of order"
@@ -148,14 +162,35 @@ def bin_args(self) -> list[str]:
148
162
"--KernelExecTime=1"
149
163
]
150
164
151
- class SubmitKernelUR (ComputeBenchmark ):
165
+ class SubmitKernelURWithTime (ComputeBenchmark ):
152
166
def __init__ (self , bench , ioq ):
153
167
self .ioq = ioq
154
- super ().__init__ (bench , "api_overhead_benchmark_ur" , "SubmitKernel" )
168
+ super ().__init__ (bench , "api_overhead_benchmark_ur" , "SubmitKernel" , "time [us]" )
155
169
156
170
def name (self ):
157
171
order = "in order" if self .ioq else "out of order"
158
- return f"api_overhead_benchmark_ur SubmitKernel { order } "
172
+ return f"api_overhead_benchmark_ur SubmitKernel { order } time"
173
+
174
+ def bin_args (self ) -> list [str ]:
175
+ return [
176
+ f"--Ioq={ self .ioq } " ,
177
+ "--DiscardEvents=0" ,
178
+ "--MeasureCompletion=0" ,
179
+ "--iterations=100000" ,
180
+ "--Profiling=0" ,
181
+ "--NumKernels=10" ,
182
+ "--KernelExecTime=1"
183
+ ]
184
+
185
+
186
+ class SubmitKernelURWithCPUCounter (ComputeBenchmark ):
187
+ def __init__ (self , bench , ioq ):
188
+ self .ioq = ioq
189
+ super ().__init__ (bench , "api_overhead_benchmark_ur" , "SubmitKernel" , "hw instructions [count]" )
190
+
191
+ def name (self ):
192
+ order = "in order" if self .ioq else "out of order"
193
+ return f"api_overhead_benchmark_ur SubmitKernel { order } CPU count"
159
194
160
195
def bin_args (self ) -> list [str ]:
161
196
return [
@@ -175,7 +210,7 @@ def __init__(self, bench, ioq, isCopyOnly, source, destination, size):
175
210
self .source = source
176
211
self .destination = destination
177
212
self .size = size
178
- super ().__init__ (bench , "api_overhead_benchmark_sycl" , "ExecImmediateCopyQueue" )
213
+ super ().__init__ (bench , "api_overhead_benchmark_sycl" , "ExecImmediateCopyQueue" , "time [us]" )
179
214
180
215
def name (self ):
181
216
order = "in order" if self .ioq else "out of order"
@@ -198,7 +233,7 @@ def __init__(self, bench, isCopyOnly, source, destination, size):
198
233
self .source = source
199
234
self .destination = destination
200
235
self .size = size
201
- super ().__init__ (bench , "memory_benchmark_sycl" , "QueueInOrderMemcpy" )
236
+ super ().__init__ (bench , "memory_benchmark_sycl" , "QueueInOrderMemcpy" , "time [us]" )
202
237
203
238
def name (self ):
204
239
return f"memory_benchmark_sycl QueueInOrderMemcpy from { self .source } to { self .destination } , size { self .size } "
@@ -218,7 +253,7 @@ def __init__(self, bench, source, destination, size):
218
253
self .source = source
219
254
self .destination = destination
220
255
self .size = size
221
- super ().__init__ (bench , "memory_benchmark_sycl" , "QueueMemcpy" )
256
+ super ().__init__ (bench , "memory_benchmark_sycl" , "QueueMemcpy" , "time [us]" )
222
257
223
258
def name (self ):
224
259
return f"memory_benchmark_sycl QueueMemcpy from { self .source } to { self .destination } , size { self .size } "
@@ -236,7 +271,7 @@ def __init__(self, bench, type, size, placement):
236
271
self .type = type
237
272
self .size = size
238
273
self .placement = placement
239
- super ().__init__ (bench , "memory_benchmark_sycl" , "StreamMemory" )
274
+ super ().__init__ (bench , "memory_benchmark_sycl" , "StreamMemory" , "time [us]" )
240
275
241
276
def name (self ):
242
277
return f"memory_benchmark_sycl StreamMemory, placement { self .placement } , type { self .type } , size { self .size } "
@@ -253,7 +288,7 @@ def bin_args(self) -> list[str]:
253
288
254
289
class VectorSum (ComputeBenchmark ):
255
290
def __init__ (self , bench ):
256
- super ().__init__ (bench , "miscellaneous_benchmark_sycl" , "VectorSum" )
291
+ super ().__init__ (bench , "miscellaneous_benchmark_sycl" , "VectorSum" , "time [us]" )
257
292
258
293
def name (self ):
259
294
return f"miscellaneous_benchmark_sycl VectorSum"
@@ -274,7 +309,7 @@ def __init__(self, bench, numOpsPerThread, numThreads, allocSize, iterations, sr
274
309
self .iterations = iterations
275
310
self .srcUSM = srcUSM
276
311
self .dstUSM = dstUSM
277
- super ().__init__ (bench , "multithread_benchmark_ur" , "MemcpyExecute" )
312
+ super ().__init__ (bench , "multithread_benchmark_ur" , "MemcpyExecute" , "time [us]" )
278
313
279
314
def name (self ):
280
315
return f"multithread_benchmark_ur MemcpyExecute opsPerThread:{ self .numOpsPerThread } , numThreads:{ self .numThreads } , allocSize:{ self .allocSize } srcUSM:{ self .srcUSM } dstUSM:{ self .dstUSM } "
0 commit comments