Skip to content

Commit 73450f8

Browse files
committed
Refactor compute bench metadata
Simplify SubmitGraph and SubmitKernel benchmarks metadata creation.
1 parent 61bb39e commit 73450f8

File tree

1 file changed

+21
-36
lines changed

1 file changed

+21
-36
lines changed

devops/scripts/benchmarks/benches/compute.py

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -110,71 +110,56 @@ def setup(self) -> None:
110110

111111
def additional_metadata(self) -> dict[str, BenchmarkMetadata]:
112112
metadata = {
113-
"SubmitKernel": BenchmarkMetadata(
114-
type="group",
115-
description="Measures CPU time overhead of submitting kernels through different APIs.",
116-
notes="Each layer builds on top of the previous layer, adding functionality and overhead.\n"
117-
"The first layer is the Level Zero API, the second is the Unified Runtime API, and the third is the SYCL API.\n"
118-
"The UR v2 adapter noticeably reduces UR layer overhead, also improving SYCL performance.\n"
119-
"Work is ongoing to reduce the overhead of the SYCL API\n",
120-
tags=["submit", "micro", "SYCL", "UR", "L0"],
121-
range_min=0.0,
122-
),
123113
"SinKernelGraph": BenchmarkMetadata(
124114
type="group",
125115
unstable="This benchmark combines both eager and graph execution, and may not be representative of real use cases.",
126116
tags=["submit", "memory", "proxy", "SYCL", "UR", "L0", "graph"],
127117
),
128-
"SubmitGraph": BenchmarkMetadata(
129-
type="group", tags=["submit", "micro", "SYCL", "UR", "L0", "graph"]
130-
),
131118
"FinalizeGraph": BenchmarkMetadata(
132119
type="group", tags=["finalize", "micro", "SYCL", "graph"]
133120
),
134121
}
135122

136123
# Add metadata for all SubmitKernel group variants
137-
base_metadata = metadata["SubmitKernel"]
138-
124+
submit_kernel_metadata = BenchmarkMetadata(
125+
type="group",
126+
notes="Each layer builds on top of the previous layer, adding functionality and overhead.\n"
127+
"The first layer is the Level Zero API, the second is the Unified Runtime API, and the third is the SYCL API.\n"
128+
"The UR v2 adapter noticeably reduces UR layer overhead, also improving SYCL performance.\n"
129+
"Work is ongoing to reduce the overhead of the SYCL API\n",
130+
tags=["submit", "micro", "SYCL", "UR", "L0"],
131+
range_min=0.0,
132+
)
139133
for order in ["in order", "out of order"]:
140134
for completion in ["", " with completion"]:
141135
for events in ["", " using events"]:
142136
group_name = f"SubmitKernel {order}{completion}{events} long kernel"
143-
metadata[group_name] = BenchmarkMetadata(
144-
type="group",
145-
description=f"Measures CPU time overhead of submitting {order} kernels with longer execution times through different APIs.",
146-
notes=base_metadata.notes,
147-
tags=base_metadata.tags,
148-
range_min=base_metadata.range_min,
137+
metadata[group_name] = copy.deepcopy(submit_kernel_metadata)
138+
metadata[group_name].description = (
139+
f"Measures CPU time overhead of submitting {order} kernels with longer execution times through different APIs."
149140
)
150-
151141
# CPU count variants
152142
cpu_count_group = f"{group_name}, CPU count"
153-
metadata[cpu_count_group] = BenchmarkMetadata(
154-
type="group",
155-
description=f"Measures CPU time overhead of submitting {order} kernels with longer execution times through different APIs.",
156-
notes=base_metadata.notes,
157-
tags=base_metadata.tags,
158-
range_min=base_metadata.range_min,
143+
metadata[cpu_count_group] = copy.deepcopy(submit_kernel_metadata)
144+
metadata[cpu_count_group].description = (
145+
f"Measures CPU instructions count overhead of submitting {order} kernels with longer execution times through different APIs."
159146
)
160147

161148
# Add metadata for all SubmitGraph group variants
162-
base_metadata = metadata["SubmitGraph"]
149+
submit_graph_metadata = BenchmarkMetadata(
150+
type="group", tags=["submit", "micro", "SYCL", "UR", "L0", "graph"]
151+
)
163152
for order in ["in order", "out of order"]:
164153
for completion in ["", " with completion"]:
165154
for events in ["", " using events"]:
166155
for num_kernels in self.submit_graph_num_kernels:
167156
for host_tasks in ["", " use host tasks"]:
168157
group_name = f"SubmitGraph {order}{completion}{events}{host_tasks}, {num_kernels} kernels"
169-
metadata[group_name] = BenchmarkMetadata(
170-
type="group",
171-
tags=base_metadata.tags,
172-
)
158+
metadata[group_name] = copy.deepcopy(submit_graph_metadata)
173159
# CPU count variants
174160
cpu_count_group = f"{group_name}, CPU count"
175-
metadata[cpu_count_group] = BenchmarkMetadata(
176-
type="group",
177-
tags=base_metadata.tags,
161+
metadata[cpu_count_group] = copy.deepcopy(
162+
submit_graph_metadata
178163
)
179164
return metadata
180165

0 commit comments

Comments
 (0)