-
Notifications
You must be signed in to change notification settings - Fork 791
[Benchmarks] Metadata generator #20294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
43b0b80
[Benchmarks] Metadata generator
PatKamin ff00adc
Apply lslusarczyk's comments
PatKamin 988cb08
Update missing returned object info in docstring
PatKamin e315350
Be explicit about explicit_group format
PatKamin a918231
Apply linter
PatKamin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Copyright (C) 2025 Intel Corporation | ||
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. | ||
# See LICENSE.TXT | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
""" | ||
Metadata generator for Compute Benchmarks. | ||
|
||
This module provides centralized metadata generation for Compute Benchmark groups, | ||
ensuring consistency between benchmark group membership and group metadata definitions. | ||
""" | ||
|
||
from typing import Dict, List | ||
|
||
from utils.result import BenchmarkMetadata | ||
|
||
from .base import Benchmark | ||
|
||
|
||
class ComputeMetadataGenerator: | ||
""" | ||
Generates metadata for Compute Benchmark groups. | ||
|
||
This class keeps the logic for creating group metadata, ensuring that | ||
all possible benchmark group configurations have corresponding metadata entries. | ||
""" | ||
|
||
def __init__(self): | ||
# Base metadata for core groups | ||
self._base_group_metadata = { | ||
"SubmitKernel": { | ||
"description": "Measures CPU time overhead of submitting kernels through different APIs.", | ||
"notes": ( | ||
"Each layer builds on top of the previous layer, adding functionality and overhead.\n" | ||
"The first layer is the Level Zero API, the second is the Unified Runtime API, and the third is the SYCL API.\n" | ||
"The UR v2 adapter noticeably reduces UR layer overhead, also improving SYCL performance.\n" | ||
"Work is ongoing to reduce the overhead of the SYCL API\n" | ||
), | ||
"tags": ["submit", "micro", "SYCL", "UR", "L0"], | ||
lslusarczyk marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
"range_min": 0.0, | ||
}, | ||
"SinKernelGraph": { | ||
"unstable": "This benchmark combines both eager and graph execution, and may not be representative of real use cases.", | ||
"tags": ["submit", "memory", "proxy", "SYCL", "UR", "L0", "graph"], | ||
}, | ||
"SubmitGraph": {"tags": ["submit", "micro", "SYCL", "UR", "L0", "graph"]}, | ||
"FinalizeGraph": {"tags": ["finalize", "micro", "SYCL", "graph"]}, | ||
} | ||
|
||
def generate_metadata_from_benchmarks( | ||
self, benchmarks: List[Benchmark] | ||
) -> Dict[str, BenchmarkMetadata]: | ||
""" | ||
Generate group metadata based on actual benchmark configurations. | ||
|
||
Args: | ||
benchmarks: List of benchmark instances to analyze | ||
|
||
Returns: | ||
Dictionary mapping group names to their metadata | ||
""" | ||
metadata = {} | ||
# Discover all group names from actual benchmarks | ||
for benchmark in benchmarks: | ||
if hasattr(benchmark, "explicit_group") and callable( | ||
lslusarczyk marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
benchmark.explicit_group | ||
): | ||
group_name = benchmark.explicit_group() | ||
if group_name: | ||
self._generate_metadata(metadata, group_name) | ||
PatKamin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
return metadata | ||
|
||
def _generate_metadata( | ||
lslusarczyk marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
self, metadata: Dict[str, BenchmarkMetadata], group_name: str | ||
): | ||
base_metadata = self._base_group_metadata.get(group_name.split()[0], {}) | ||
lslusarczyk marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
lslusarczyk marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
metadata[group_name] = BenchmarkMetadata( | ||
type="group", | ||
description=base_metadata.get("description"), | ||
notes=base_metadata.get("notes"), | ||
lslusarczyk marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
unstable=base_metadata.get("unstable"), | ||
tags=base_metadata.get("tags", []), | ||
range_min=base_metadata.get("range_min"), | ||
range_max=base_metadata.get("range_max"), | ||
explicit_group=group_name, | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.