Skip to content

[BOLT][NFC] Unify perf data setting - #199322

Merged
aaupov merged 4 commits into
mainfrom
users/aaupov/spr/boltnfc-unify-perf-data-setting
May 27, 2026
Merged

aaupov merged 4 commits into
mainfrom
users/aaupov/spr/boltnfc-unify-perf-data-setting

Conversation

@aaupov

@aaupov aaupov commented May 23, 2026

Copy link
Copy Markdown
Contributor

Combine opts::PerfData handling into one place per driver (llvm-bolt and
heatmap).

Test Plan: NFC

aaupov added 2 commits May 22, 2026 21:47
Created using spr 1.3.4
@aaupov
aaupov marked this pull request as ready for review May 23, 2026 05:08
@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-bolt

Author: Amir Ayupov (aaupov)

Changes

Combine opts::PerfData handling into one place per driver (llvm-bolt and
heatmap).

  • Allow using perf data directly after DataAggregator/DataReader
    unification in #195986.
  • Drop redundant perf data checks in perf2boltMode done by setProfile.

Test Plan: NFC


Full diff: https://github.com/llvm/llvm-project/pull/199322.diff

1 Files Affected:

  • (modified) bolt/tools/driver/llvm-bolt.cpp (+3-22)
diff --git a/bolt/tools/driver/llvm-bolt.cpp b/bolt/tools/driver/llvm-bolt.cpp
index cf1b31f8c0c66..2cd5151bed49a 100644
--- a/bolt/tools/driver/llvm-bolt.cpp
+++ b/bolt/tools/driver/llvm-bolt.cpp
@@ -109,21 +109,10 @@ void perf2boltMode(int argc, char **argv) {
       argc, argv,
       "perf2bolt - BOLT data aggregator\n"
       "\nEXAMPLE: perf2bolt -p=perf.data executable -o data.fdata\n");
-  if (opts::PerfData.empty()) {
-    errs() << ToolName << ": expected -perfdata=<filename> option.\n";
-    exit(1);
-  }
   if (!opts::InputDataFilename.empty()) {
     errs() << ToolName << ": unknown -data option.\n";
     exit(1);
   }
-  if (!sys::fs::exists(opts::PerfData))
-    report_error(opts::PerfData, errc::no_such_file_or_directory);
-  if (!DataAggregator::checkPerfDataMagic(opts::PerfData)) {
-    errs() << ToolName << ": '" << opts::PerfData
-           << "': expected valid perf.data file.\n";
-    exit(1);
-  }
   if (opts::OutputFilename.empty()) {
     errs() << ToolName << ": expected -o=<output file> option.\n";
     exit(1);
@@ -245,24 +234,16 @@ int main(int argc, char **argv) {
       }
 
       if (!opts::PerfData.empty()) {
-        if (!opts::AggregateOnly) {
-          errs() << ToolName
-                 << ": WARNING: reading perf data directly is unsupported, "
-                    "please use "
-                    "-aggregate-only or perf2bolt.\n!!! Proceed on your own "
-                    "risk. !!!\n";
-        }
         if (Error E = RI.setProfile(opts::PerfData))
           report_error(opts::PerfData, std::move(E));
+      } else if (opts::AggregateOnly) {
+        errs() << ToolName << ": missing required -perfdata option.\n";
+        exit(1);
       }
       if (!opts::InputDataFilename.empty()) {
         if (Error E = RI.setProfile(opts::InputDataFilename))
           report_error(opts::InputDataFilename, std::move(E));
       }
-      if (opts::AggregateOnly && opts::PerfData.empty()) {
-        errs() << ToolName << ": missing required -perfdata option.\n";
-        exit(1);
-      }
 
       if (Error E = RI.run())
         report_error(opts::InputFilename, std::move(E));

@rafaelauler rafaelauler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

@yozhu yozhu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

Created using spr 1.3.8-beta.1
Created using spr 1.3.8-beta.1
@aaupov
aaupov changed the base branch from users/aaupov/spr/main.boltnfc-unify-perf-data-setting to main May 27, 2026 07:23
@aaupov
aaupov merged commit 4c9296d into main May 27, 2026
0 of 3 checks passed
@aaupov
aaupov deleted the users/aaupov/spr/boltnfc-unify-perf-data-setting branch May 27, 2026 07:23
llvm-upstreamsync Bot pushed a commit to qualcomm/cpullvm-toolchain that referenced this pull request May 27, 2026
Combine opts::PerfData handling into one place per driver (llvm-bolt and
heatmap).
* Allow using perf data directly after DataAggregator/DataReader
  unification in #195986.
* Drop redundant perf data checks in perf2boltMode done by setProfile.

Test Plan: NFC

Reviewers:
ritter-x2a, david-salinas, grypp, Pierre-vh, dcaballe, aartbik, adam-smnk, fabianmcg, yota9, JDevlieghere, banach-space, xlauko, nikic, #reviewers-libcxx, rafaelauler, Moxinilian, nicolasvasilache, yozhu, ayermolo, paschalis-mpeis, lamb-j, andykaylor, #reviewers-libc, vangthao95, bcardosolopes, yavtuk, aaronmondal, rupprecht, matthias-springer, keith, maksfb, lanza, Jianhui-Li, charithaintc

Reviewed By: yozhu, rafaelauler

Pull Request: llvm/llvm-project#199322
llvm-sync Bot pushed a commit to arm/arm-toolchain that referenced this pull request May 27, 2026
Combine opts::PerfData handling into one place per driver (llvm-bolt and
heatmap).
* Allow using perf data directly after DataAggregator/DataReader
  unification in #195986.
* Drop redundant perf data checks in perf2boltMode done by setProfile.

Test Plan: NFC

Reviewers:
ritter-x2a, david-salinas, grypp, Pierre-vh, dcaballe, aartbik, adam-smnk, fabianmcg, yota9, JDevlieghere, banach-space, xlauko, nikic, #reviewers-libcxx, rafaelauler, Moxinilian, nicolasvasilache, yozhu, ayermolo, paschalis-mpeis, lamb-j, andykaylor, #reviewers-libc, vangthao95, bcardosolopes, yavtuk, aaronmondal, rupprecht, matthias-springer, keith, maksfb, lanza, Jianhui-Li, charithaintc

Reviewed By: yozhu, rafaelauler

Pull Request: llvm/llvm-project#199322
aaupov added a commit that referenced this pull request Jun 1, 2026
Allow multiple -p/-perfdata args (comma-separated and repeated).
Process them in parallel with `--perfdata-jobs/-pj` (default 4,
0 for all available hardware threads). Keep YAML/DataReader
inputs single-profile only.

This also enables density computation with multiple perf files.
Prior to that, it was impossible to compute total density as
it wasn't computed from symbolized profiles.

Depends on
#199323
#199322
#199321
#199320

Test Plan:
Updated pre-aggregated-perf.test and perf_test

For a large binary (300MB text) and 7 ETM perf data files
(6GB each), compared to parallel perf2bolt + merge-fdata:
* processing time is equal: 670+3s -> 669s (within noise),
* output is equivalent: sorted fdata is equal.

Reviewers:
paschalis-mpeis, rafaelauler, yozhu, ayermolo, yavtuk, maksfb, yota9

Reviewed By: paschalis-mpeis, rafaelauler

Pull Request: #199324
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants