Tuning quality-of-life improvements - #2451
Conversation
- Use llvm::scope_exit instead of deprecated llvm::make_scope_exit - Report measurements and stats in nanoseconds, like the final result - Name the offending perf config when compilation crashes - Write stats instead of per-iteration measurements to the debug file - Accept the legacy doubled CU count recorded on WGP-mode chips - Default the output path to the configs file name with a .tsv suffix
There was a problem hiding this comment.
Pull request overview
Improves tuning diagnostics, output consistency, legacy device-data reuse, and argument handling.
Changes:
- Reports timing statistics in nanoseconds and adds crashing perf-config diagnostics.
- Reuses and migrates legacy WGP CU-count results/state.
- Derives output paths from config files and consolidates argument validation.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
mlir/utils/performance/tuningRunner.py |
Updates state migration, statistics, output naming, and parsing. |
mlir/utils/performance/tests/test_tuningRunner.py |
Tests legacy CU handling and output defaults. |
mlir/utils/performance/perfRunner.py |
Adds WGP-mode detection. |
mlir/utils/performance/tests/test_perfRunner.py |
Tests WGP-mode detection. |
mlir/tools/rocmlir-tuning-driver/rocmlir-tuning-driver.cpp |
Updates timing units, scope guards, and crash diagnostics. |
mlir/test/perf-scripts/runtime/tuningRunner-gemm.py |
Updates debug-output checks for statistics. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Verdict: COMMENT · Findings: 2 (0 Critical, 1 Major, 1 Minor)
Scope
Tuning quality-of-life changes across rocmlir-tuning-driver.cpp, tuningRunner.py, perfRunner.py, their pytest suites, and one lit test: swap deprecated llvm::make_scope_exit for the llvm::scope_exit constructor, report measurements/stats in nanoseconds, name the offending perf config on a compilation crash, write per-config stats instead of raw per-iteration arrays to the .debug file, accept the legacy (doubled) CU count on WGP-mode chips, derive the default --output from --configs-file, and consolidate argument validation into TuningArgumentParser.
Findings
mlir/utils/performance/tuningRunner.py:1969—default_output_path()returns the input path unchanged when--configs-filealready ends in.tsv; the writer then appends result rows to the user's own configs file. (Copilot raised the same point; repeating it because it is genuine and unaddressed.)mlir/tools/rocmlir-tuning-driver/rocmlir-tuning-driver.cpp:722—llvm::errs()is used from both a fatal-error handler and a signal handler, which is the one context LLVM deliberately avoidsraw_ostreamin.
Notes
- Verified the
scope_exitswap:external/llvm-project/llvm/include/llvm/ADT/ScopeExit.h:47supplies the CTAD deduction guide and line 56 marksmake_scope_exitLLVM_DEPRECATED, so the mechanical change is correct and the[[nodiscard]]class is still bound to a named variable everywhere. - The ms→ns move is consistent:
measureSmallKernelpushes exactly one measurement, so the small-kernel--show-statspath still emits exactly one JSON field andfind_best_perfconfig'slen(parts) == 3test continues to hold. The lifetime comment oncompilingConfigalso checks out —configsis declared beforethreads/threadCleanupin the same iteration scope, so it outlives the joins on every exit path. --show-all-measurementsnow has no in-repo caller. Itscl::desc(and--show-stats') still do not state a unit, which is now nanoseconds; since unit clarity is the point of this PR, a one-line desc update on both options would be worth folding in.matches_current_num_cu()cannot distinguish a legacy record of this device from a genuine record of a same-gfxSKU with exactly twice the WGP count. No such pair looks likely today, but if you want to bound it, preferring exact-CU rows and only falling back to doubled rows for test vectors with no exact match would narrow the window.
CI status
No non-self check is failing. The review FAILURE entry is this auto-review pipeline's own check. Jenkins (Build and Test, MIGraphX, Parameter sweeps, Code coverage) is still pending; the Python format/lint, Python performance script tests, and C/C++ premerge checks have all passed.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2451 +/- ##
===========================================
+ Coverage 82.57% 83.49% +0.93%
===========================================
Files 120 121 +1
Lines 42852 43182 +330
Branches 7110 7181 +71
===========================================
+ Hits 35381 36053 +672
+ Misses 4815 4520 -295
+ Partials 2656 2609 -47
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Motivation
Assorted tuning quality-of-life improvements.
Technical Details
llvm::scope_exitinstead of the deprecatedllvm::make_scope_exitin rocmlir-tuning-driver, silencing the compiler warnings.--benchmark-configflag that reproduces it, instead of leaving an unattributable stack trace.--configs-filepath with a '.tsv' extension, falling back to tuning_results_local.tsv when there is nothing to derive it from (--config,--test-diror stdin).--gpu-run-timeoutcheck in with the rest of the validation in TuningArgumentParser.Submission Checklist