Skip to content

Commit 9863664

Browse files
[Bench] Add TorchSlmSize benchmark (#20937)
and add verbose option to bench's integration tests.
1 parent 9b78f08 commit 9863664

File tree

2 files changed

+106
-16
lines changed

2 files changed

+106
-16
lines changed

devops/scripts/benchmarks/benches/compute.py

Lines changed: 73 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ def git_url(self) -> str:
6161
return "https://github.com/intel/compute-benchmarks.git"
6262

6363
def git_hash(self) -> str:
64-
# Nov 17, 2025
65-
return "932ae79f7cca7e156285fc10a59610927c769e89"
64+
# Dec 17, 2025
65+
return "420549188cd8900c27cf9b04fd859ebe81876a99"
6666

6767
def setup(self) -> None:
6868
if options.sycl is None:
@@ -182,7 +182,7 @@ def benchmarks(self) -> list[Benchmark]:
182182
GraphApiSinKernelGraph(self, runtime, with_graphs, num_kernels)
183183
)
184184

185-
# Add ULLS benchmarks
185+
# Add ULLS benchmarks
186186
for runtime in list(RUNTIMES):
187187
if runtime == RUNTIMES.SYCL:
188188
benches.append(
@@ -355,6 +355,36 @@ def createTorchMultiQueueBench(variant_name: str, **kwargs):
355355
),
356356
]
357357

358+
# Add TorchSlmSize benchmarks
359+
for runtime in filter(lambda x: x != RUNTIMES.UR, RUNTIMES):
360+
361+
def createTorchSlmSizeBench(variant_name: str, **kwargs):
362+
return TorchSlmSize(
363+
self,
364+
runtime,
365+
variant_name,
366+
PROFILERS.TIMER,
367+
**{**kwargs, "warmupIterations": 1},
368+
)
369+
370+
benches += [
371+
createTorchSlmSizeBench(
372+
"small",
373+
batchSize=512,
374+
slmNum=1,
375+
),
376+
createTorchSlmSizeBench(
377+
"medium",
378+
batchSize=512,
379+
slmNum=1024,
380+
),
381+
createTorchSlmSizeBench(
382+
"max",
383+
batchSize=512,
384+
slmNum=-1,
385+
),
386+
]
387+
358388
# Add UR-specific benchmarks
359389
benches += [
360390
# TODO: multithread_benchmark_ur fails with segfault
@@ -810,25 +840,31 @@ def _bin_args(self, run_trace: TracingType = TracingType.NONE) -> list[str]:
810840
return [f"--{k}={v}" for k, v in self._rr_params.items()]
811841

812842

813-
class TorchMultiQueue(ComputeBenchmark):
843+
class TorchBenchmark(ComputeBenchmark):
814844
def __init__(
815-
self, suite, runtime: RUNTIMES, variant_name: str, profiler_type, **kwargs
845+
self,
846+
suite,
847+
runtime: RUNTIMES,
848+
bench_name: str,
849+
variant_name: str,
850+
profiler_type,
851+
**kwargs,
816852
):
817853
self._variant_name = variant_name
818-
self._smq_params = kwargs
854+
self._torch_params = kwargs
819855
self._iterations_regular = 1000
820856
self._iterations_trace = 10
821857
super().__init__(
822858
suite,
823859
f"torch_benchmark_{runtime.value}",
824-
"KernelSubmitMultiQueue",
860+
bench_name,
825861
runtime,
826862
profiler_type,
827863
)
828864

829865
def name(self):
830866
ret = []
831-
for k, v in self._smq_params.items():
867+
for k, v in self._torch_params.items():
832868
ret.append(f"{k} {v}")
833869
ret.sort()
834870
return self._bench_name + " " + ", ".join(ret)
@@ -848,10 +884,38 @@ def _supported_runtimes(self) -> list[RUNTIMES]:
848884
def _bin_args(self, run_trace: TracingType = TracingType.NONE) -> list[str]:
849885
iters = self._get_iters(run_trace)
850886
return [f"--iterations={iters}"] + [
851-
f"--{k}={v}" for k, v in self._smq_params.items()
887+
f"--{k}={v}" for k, v in self._torch_params.items()
852888
]
853889

854890

891+
class TorchMultiQueue(TorchBenchmark):
892+
def __init__(
893+
self, suite, runtime: RUNTIMES, variant_name: str, profiler_type, **kwargs
894+
):
895+
super().__init__(
896+
suite,
897+
runtime,
898+
"KernelSubmitMultiQueue",
899+
variant_name,
900+
profiler_type,
901+
**kwargs,
902+
)
903+
904+
905+
class TorchSlmSize(TorchBenchmark):
906+
def __init__(
907+
self, suite, runtime: RUNTIMES, variant_name: str, profiler_type, **kwargs
908+
):
909+
super().__init__(
910+
suite,
911+
runtime,
912+
"KernelSubmitSlmSize",
913+
variant_name,
914+
profiler_type,
915+
**kwargs,
916+
)
917+
918+
855919
class QueueInOrderMemcpy(ComputeBenchmark):
856920
def __init__(self, bench, isCopyOnly, source, destination, size, profiler_type):
857921
self._is_copy_only = isCopyOnly

devops/scripts/benchmarks/tests/test_integration.py

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

6+
import argparse
67
import json
78
import os
89
import shutil
@@ -15,6 +16,7 @@
1516
sys.path.append(f"{os.path.dirname(__file__)}/../")
1617
from utils.workdir_version import INTERNAL_WORKDIR_VERSION
1718

19+
VERBOSE_LOGS = False
1820

1921
DataJson = namedtuple("DataJson", ["runs", "metadata", "tags", "names"])
2022
DataJsonRun = namedtuple("DataJsonRun", ["name", "results"])
@@ -65,7 +67,7 @@ def run_main(self, *args):
6567

6668
# TODO: not yet tested: "--detect-version", "sycl,compute_runtime"
6769

68-
procesResult = subprocess.run(
70+
proc = subprocess.run(
6971
[
7072
"./devops/scripts/benchmarks/main.py",
7173
self.WORKDIR_DIR,
@@ -86,13 +88,14 @@ def run_main(self, *args):
8688
"--stddev-threshold",
8789
"999999999.9",
8890
"--exit-on-failure",
91+
"--verbose" if VERBOSE_LOGS else "--log-level=info",
8992
*args,
9093
],
9194
capture_output=True,
9295
)
93-
print("MAIN_PY_STDOUT:\n" + procesResult.stdout.decode())
94-
print("MAIN_PY_STDERR:\n" + procesResult.stderr.decode())
95-
return procesResult.returncode
96+
print("MAIN_PY_STDOUT:\n" + proc.stdout.decode() if proc.stdout else "<empty>")
97+
print("MAIN_PY_STDERR:\n" + proc.stderr.decode() if proc.stderr else "<empty>")
98+
return proc.returncode
9699

97100
def get_output(self):
98101
with open(os.path.join(self.OUTPUT_DIR, "data.json")) as f:
@@ -136,9 +139,6 @@ def get_output(self):
136139
)
137140

138141

139-
# add "--verbose" for debug logs
140-
141-
142142
class TestE2E(unittest.TestCase):
143143
def setUp(self):
144144
# Load test data
@@ -194,20 +194,46 @@ def test_torch_l0(self):
194194
"KernelSubmitMultiQueue large",
195195
{"pytorch", "L0"},
196196
)
197+
self._checkCase(
198+
"torch_benchmark_l0 batchSize 512, slmNum 1, warmupIterations 1",
199+
"KernelSubmitSlmSize small",
200+
{"pytorch", "L0"},
201+
)
197202

198203
def test_torch_sycl(self):
199204
self._checkCase(
200205
"torch_benchmark_sycl kernelsPerQueue 10, workgroupCount 512, workgroupSize 256",
201206
"KernelSubmitMultiQueue medium",
202207
{"pytorch", "SYCL"},
203208
)
209+
self._checkCase(
210+
"torch_benchmark_sycl batchSize 512, slmNum -1, warmupIterations 1",
211+
"KernelSubmitSlmSize max",
212+
{"pytorch", "SYCL"},
213+
)
204214

205215
def test_torch_syclpreview(self):
206216
self._checkCase(
207217
"torch_benchmark_syclpreview kernelsPerQueue 4, workgroupCount 256, workgroupSize 124",
208218
"KernelSubmitMultiQueue small",
209219
{"pytorch", "SYCL"},
210220
)
221+
self._checkCase(
222+
"torch_benchmark_syclpreview batchSize 512, slmNum 1024, warmupIterations 1",
223+
"KernelSubmitSlmSize medium",
224+
{"pytorch", "SYCL"},
225+
)
226+
211227

212228
if __name__ == "__main__":
229+
parser = argparse.ArgumentParser(description="SYCL's benchmark test framework")
230+
parser.add_argument(
231+
"--verbose",
232+
help="Set benchmark framework's logging level to DEBUG.",
233+
action="store_true",
234+
)
235+
236+
args = parser.parse_args()
237+
VERBOSE_LOGS = args.verbose
238+
213239
unittest.main()

0 commit comments

Comments
 (0)