microbenchmarks: use pytest as execution backend - #726
Open
matthiasdiener wants to merge 5 commits into
Open
Conversation
matthiasdiener
requested review from
Micky774 and
alextmagro
and
a lite review from Copilot
September 1, 2026 20:37
matthiasdiener
marked this pull request as ready for review
September 1, 2026 20:37
matthiasdiener
requested review from
ipanfilo,
wangye805 and
wenchenvincent
as code owners
September 1, 2026 20:37
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the microbenchmark suite under benchmarks/microbenchmarks/ from standalone argparse runners to a pytest-driven execution model, enabling selection/filtering via pytest (-k, markers) while still producing CSV/samples/kernel-profile outputs for downstream benchmarking workflows.
Changes:
- Add pytest integration (
conftest.py) with amicrobenchfixture and session-level result collection/printing/output writing. - Introduce shared pytest-oriented helpers in
utils.py(case recording, CSV/samples writers, formatted summary table). - Convert several benchmark modules (GEMM, grouped GEMM, casting, normalization) to parametrized pytest tests with backend/direction sweep axes.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| benchmarks/microbenchmarks/utils.py | Adds pytest execution support helpers (result store, output writers, summary formatter) and refactors rotating-buffer configuration. |
| benchmarks/microbenchmarks/conftest.py | Implements pytest hooks/options and the microbench fixture to run/record benchmarks and emit outputs. |
| benchmarks/microbenchmarks/benchmark_gemm.py | Converts dense GEMM benchmark to parametrized pytest tests with backend + direction axes. |
| benchmarks/microbenchmarks/benchmark_grouped_gemm.py | Converts grouped GEMM benchmark to parametrized pytest tests with backend + direction axes and skip rules. |
| benchmarks/microbenchmarks/benchmark_casting.py | Converts casting benchmark to parametrized pytest tests with backend axis and case generation refactor. |
| benchmarks/microbenchmarks/benchmark_normalization.py | Converts normalization benchmark to parametrized pytest tests with backend axis and case generation refactor. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
argparsescripts to a pytest runner; each benchmark becomes a (parametrized) pytest, replacing therun_benchmarks()driverparametrizeaxes, filterable via-k/-m(e.g.-k "mxfp8 and hipkittens",-k "bwd and QKV")torch.utils.benchmarktiming, rotating input buffers, and CSV schema (with added columns)Type of change
Changes
Please list the changes introduced in this PR:
Checklist: