SPMI: per-context tpdiff examples#129948
Conversation
Add a "top method regressions / improvements" section to the tpdiff markdown summary, mirroring how asmdiffs surfaces specific contexts. The per-context data already lives in the details CSV; aggregate it once and emit FullOpts/MinOpts top-N tables by PDIFF %. Release JITs don't currently report `MethodFullName`, so the table also shows the SPMI context number for fallback lookup via `mcs -dumpMap` or `superpmi -c N`. Fixes dotnet#85755. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@jakobbotsch PTAL Sample outputExisting pivot section (unchanged): Overall (-4.84%)
FullOpts (-4.82%)
New per-context section (trimmed here to top 5 of each; the actual report shows top 20): Top method regressions (FullOpts, by PDIFF %)
Top method improvements (FullOpts, by PDIFF %)
The Method column is empty here because Release JITs (what tpdiff uses) don't currently |
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Pull request overview
Adds per-context throughput “examples” to SuperPMI tpdiff markdown summaries by extracting per-context instruction deltas from the existing details CSV and emitting top-N regression/improvement tables (split by FullOpts/MinOpts). Also updates the tuple shape flowing through aggregate_diff_metrics/tpdiff reporting and makes the markdown writer tolerant of older 3-tuple JSON summaries.
Changes:
- Extend
aggregate_diff_metrics()to collect per-context throughput diffs (base vs diff instruction counts) and return them to callers. - Plumb per-context throughput data through
replay_with_throughput_diff()and into markdown summary generation. - Add a new markdown section that lists top per-context regressions/improvements (FullOpts and MinOpts) by PDIFF%.
| # Per-context throughput diffs (rows where PIN measured base != diff | ||
| # instruction count). Used by tpdiff to surface specific method examples. | ||
| tp_diffs_fields = ["Context", "Method full name", "MinOpts", "Base instructions", "Diff instructions"] | ||
| tp_diffs = [] | ||
|
|
| # Release JITs don't report MethodFullName; fall back to context number. | ||
| method = r["Method full name"] or "<no name reported by JIT>" | ||
| write_fh.write("|{}|{}|{}|{:,d}|{:,d}|{}|\n".format( | ||
| r["Collection"], | ||
| r["Context"], | ||
| method, | ||
| r["Base instructions"], | ||
| r["Diff instructions"], | ||
| compute_and_format_pct(r["Base instructions"], r["Diff instructions"]))) |
Add a "top method regressions / improvements" section to the tpdiff markdown summary, mirroring how asmdiffs surfaces specific contexts. The per-context data already lives in the details CSV; aggregate it once and emit FullOpts/MinOpts top-N tables by PDIFF %.
Release JITs don't currently report
MethodFullName, so the table also shows the SPMI context number for fallback lookup viamcs -dumpMaporsuperpmi -c N.Fixes #85755.