Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BOLT] Add pre-parsed perf script support#163785

Merged
kaadam merged 12 commits into
llvm:mainfrom
kaadam:perfscript
Jun 4, 2026
Merged

[BOLT] Add pre-parsed perf script support#163785
kaadam merged 12 commits into
llvm:mainfrom
kaadam:perfscript

Conversation

@kaadam
Copy link
Copy Markdown
Contributor

@kaadam kaadam commented Oct 16, 2025

This PR implements the functionality to read and parse a pre-paresed
perf-script profile which was made by Perf2bolt's
'--profile-format=perfscript' option.

It helps to add support for large ARM Spe end-to-end tests.

Why does the test need to have a textual format Spe profile?

  • To collect an Arm Spe profile by Linux Perf, it needs to have
    an arm developer device which has Spe support.
  • To decode Spe data, it also needs to have the proper version of
    Linux Perf.
    The minimum required version of Linux Perf is v6.15.

Bypassing these technical difficulties, that easier to prove
a pre-generated perfscript profile format.

How should generate this type of profile?

  1. You can use Perf2bolt itself to generate a pre-parsed perf-script profile
    in textual format.
    $ perf2bolt BINARY -p perf.data -o test.text --spe --profile-format=perfscript

  2. Perf2bolt is able to work with this type of profile:
    $ perf2bolt BINARY -o test.fdata -p test.text --spe -ps

@kaadam kaadam marked this pull request as ready for review October 21, 2025 09:55
@llvmbot llvmbot added the BOLT label Oct 21, 2025
@llvmbot
Copy link
Copy Markdown
Member

llvmbot commented Oct 21, 2025

@llvm/pr-subscribers-bolt

Author: Ádám Kallai (kaadam)

Changes

Extend perf2bolt functionality by adding a new option to read perf-script output in textual format which created by Linux Perf with using 'script' command.

This option helps to add a large Spe test into the 'bolt-tests' repository to cover Arm Spe aggregation.

Why does the test need to have a textual format Spe profile?

  • To collect an Arm Spe profile by Linux Perf, it needs to have an arm developer device which has Spe support.
  • To decode Spe data, it also needs to have the proper version of Linux Perf.
    • The minimum required version of Linux Perf is v6.15.

To bypass these technical difficulties, that's easier to provide a pre-generated textual profile format.

How should generate this type of profile?

  1. Gather profile by using Linux Perf:
    $ perf record -e 'arm_spe_0/branch_filter=1/u' -- BINARY

  2. Generate a textual format profile by using Linux Perf's script command:
    $ perf script --show-mmap-events -F pid,brstack --itrace=bl -i perf.data


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

2 Files Affected:

  • (modified) bolt/include/bolt/Profile/DataAggregator.h (+26)
  • (modified) bolt/lib/Profile/DataAggregator.cpp (+86-3)
diff --git a/bolt/include/bolt/Profile/DataAggregator.h b/bolt/include/bolt/Profile/DataAggregator.h
index cb1b87f8d0d65..de88a8bb8ad1e 100644
--- a/bolt/include/bolt/Profile/DataAggregator.h
+++ b/bolt/include/bolt/Profile/DataAggregator.h
@@ -440,6 +440,32 @@ class DataAggregator : public DataReader {
   /// B 4b196f 4b19e0 2 0
   void parsePreAggregated();
 
+  /// Detect whether the parsed line is an mmap event or not.
+  bool isMMapEvent(StringRef Line);
+
+  /// Coordinate reading and parsing a hybrid perf-script trace created by
+  /// the following Linux perf script command:
+  /// 'perf script --show-mmap-events -F pid,brstack --itrace=bl -i perf.data'
+  ///
+  /// Note:
+  /// The original perf.data should be profiled with '-b' or 'Arm Spe'.
+  ///
+  /// How the output of this command looks like:
+  /// {<name> .* <sec>.<usec>: }PERF_RECORD_MMAP2 <pid>/<tid>: .* <file_name>
+  /// {<name> .* <sec>.<usec>: }PERF_RECORD_MMAP2 <pid>/<tid>: .* <file_name>
+  ///  PID  {FROM/TO/P/-/-/1/COND/-}+
+  ///  PID  {FROM/TO/P/-/-/1/COND/-}+
+  ///
+  /// The hybrid profile means it contains mmap events along with branch events.
+  /// An mmap event might appear among the branch events, therefore
+  /// Bolt will read this hybrid profile, selects the mmap events, the other
+  /// events treat as branch event.
+  /// Then it prepares the ParsingBuf based on the classification and
+  /// call the proper functions like parseMMapEvents() or parseBranchEvents().
+  ///
+  /// This option is only for testing purposes.
+  void parsePerfScriptEvents();
+
   /// Parse the full output of pre-aggregated LBR samples generated by
   /// an external tool.
   std::error_code parsePreAggregatedLBRSamples();
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index c13fa6dbe582b..8a2119480d49b 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -115,6 +115,12 @@ cl::opt<std::string>
                             "perf-script output in a textual format"),
                    cl::ReallyHidden, cl::init(""), cl::cat(AggregatorCategory));
 
+cl::opt<bool>
+    ReadPerfScript("perfscript",
+                   cl::desc("skip perf and read perf-script trace created by "
+                            "Linux perf tool with script command"),
+                   cl::ReallyHidden, cl::cat(AggregatorCategory));
+
 static cl::opt<bool>
 TimeAggregator("time-aggr",
   cl::desc("time BOLT aggregator"),
@@ -184,7 +190,8 @@ void DataAggregator::start() {
 
   // Don't launch perf for pre-aggregated files or when perf input is specified
   // by the user.
-  if (opts::ReadPreAggregated || !opts::ReadPerfEvents.empty())
+  if (opts::ReadPreAggregated || opts::ReadPerfScript ||
+      !opts::ReadPerfEvents.empty())
     return;
 
   findPerfExecutable();
@@ -226,7 +233,7 @@ void DataAggregator::start() {
 }
 
 void DataAggregator::abort() {
-  if (opts::ReadPreAggregated)
+  if (opts::ReadPreAggregated || opts::ReadPerfScript)
     return;
 
   std::string Error;
@@ -326,7 +333,7 @@ void DataAggregator::processFileBuildID(StringRef FileBuildID) {
 }
 
 bool DataAggregator::checkPerfDataMagic(StringRef FileName) {
-  if (opts::ReadPreAggregated)
+  if (opts::ReadPreAggregated || opts::ReadPerfScript)
     return true;
 
   Expected<sys::fs::file_t> FD = sys::fs::openNativeFileForRead(FileName);
@@ -372,6 +379,80 @@ void DataAggregator::parsePreAggregated() {
   }
 }
 
+bool DataAggregator::isMMapEvent(StringRef Line) {
+  // Short cut to avoid string find is possible.
+  if (Line.empty() || Line.size() < 50)
+    return false;
+
+  // Check that PERF_RECORD_MMAP2 or PERF_RECORD_MMAP appear in the line.
+  return Line.contains("PERF_RECORD_MMAP");
+}
+
+void DataAggregator::parsePerfScriptEvents() {
+  outs() << "PERF2BOLT: parsing a hybrid perf-script events...\n";
+  NamedRegionTimer T("parsePerfScriptEvents", "Parsing perf-script events",
+                     TimerGroupName, TimerGroupDesc, opts::TimeAggregator);
+
+  ErrorOr<std::unique_ptr<MemoryBuffer>> MB =
+      MemoryBuffer::getFileOrSTDIN(Filename);
+  if (std::error_code EC = MB.getError()) {
+    errs() << "PERF2BOLT-ERROR: cannot open " << Filename << ": "
+           << EC.message() << "\n";
+    exit(1);
+  }
+
+  FileBuf = std::move(*MB);
+  ParsingBuf = FileBuf->getBuffer();
+  Col = 0;
+  Line = 1;
+  std::string MMapEvents = "";
+  std::string BranchEvents = "";
+
+  if (!hasData())
+    return;
+
+  while (hasData()) {
+
+    size_t LineEnd = ParsingBuf.find_first_of("\n");
+    if (LineEnd == StringRef::npos) {
+      reportError("expected rest of line");
+      errs() << "Found: " << ParsingBuf << "\n";
+    }
+    StringRef Event = ParsingBuf.substr(0, LineEnd);
+
+    if (isMMapEvent(Event)) {
+      MMapEvents += Event.str();
+      MMapEvents += "\n";
+    } else {
+      BranchEvents += Event.str();
+      BranchEvents += '\n';
+    }
+
+    ParsingBuf = ParsingBuf.drop_front(LineEnd + 1);
+    Col = 0;
+    Line += 1;
+  }
+
+  // Set ParsingBuf for MMapEvents
+  ParsingBuf = StringRef(MMapEvents);
+  Col = 0;
+  Line = 1;
+  if (!ParsingBuf.empty() && parseMMapEvents()) {
+    errs() << "PERF2BOLT: failed to parse mmap events from the perf-script "
+              "file.\n";
+    exit(1);
+  }
+
+  // Set ParsingBuf for BranchEvents
+  ParsingBuf = StringRef(BranchEvents);
+  Col = 0;
+  Line = 1;
+  if (!ParsingBuf.empty() && parseBranchEvents()) {
+    errs() << "PERF2BOLT: failed to parse samples from perf-script file.\n";
+    exit(1);
+  }
+}
+
 void DataAggregator::filterBinaryMMapInfo() {
   if (opts::FilterPID) {
     auto MMapInfoIter = BinaryMMapInfo.find(opts::FilterPID);
@@ -606,6 +687,8 @@ Error DataAggregator::preprocessProfile(BinaryContext &BC) {
 
   if (opts::ReadPreAggregated) {
     parsePreAggregated();
+  } else if (opts::ReadPerfScript) {
+    parsePerfScriptEvents();
   } else {
     parsePerfData(BC);
   }

Copy link
Copy Markdown
Contributor

@aaupov aaupov left a comment

Choose a reason for hiding this comment

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

Thank you for working on this, I think it's useful outside just testing. Please see couple of comments inline.
Additionally, we have opts::ReadPerfEvents with a similar purpose and similarly used in testing, can we unify the two options?

Comment thread bolt/include/bolt/Profile/DataAggregator.h Outdated
Comment thread bolt/include/bolt/Profile/DataAggregator.h Outdated
Comment thread bolt/include/bolt/Profile/DataAggregator.h Outdated
Comment thread bolt/lib/Profile/DataAggregator.cpp Outdated
@paschalis-mpeis
Copy link
Copy Markdown
Member

Additionally, we have opts::ReadPerfEvents with a similar purpose and similarly used in testing, can we unify the two options?

@aaupov that's the plan, to eventually replace my half-baked ReadPerfEvents flag :)

Copy link
Copy Markdown
Contributor

@aaupov aaupov left a comment

Choose a reason for hiding this comment

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

Some more thoughts on this functionality (not blocking but please consider as follow-up items):

  1. A note on constructing MMapEvents and BranchEvents strings - see inline comment.
  2. In the general case we also need task events and buildid-list output. We should include that into perf script input as well.
  3. Extra profile support: basic samples and mem profile.
  4. If all of the above is implemented, the functionality should be unified with parsePerfData as the input would be the same (except coming from a pre-parsed file).

Comment thread bolt/lib/Profile/DataAggregator.cpp Outdated
@aaupov
Copy link
Copy Markdown
Contributor

aaupov commented Nov 5, 2025

Please also retitle as e.g. "[BOLT] Add pre-parsed perf script support"

Copy link
Copy Markdown
Member

@paschalis-mpeis paschalis-mpeis left a comment

Choose a reason for hiding this comment

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

Hi Adam,

Thanks for your work! A couple of high-level thoughts after a quick pass:

(1) For the new flag, my thinking was to provide a textual replacement for perf.data:
whatever perf2bolt would invoke, we run it beforehand outselves (ie perf script ..) and pass the result to the tool.

Are there actual limitations to using --perfscript with basic samples?

Why not call parseBranchEvents or parseBasicEvents, depending on BasicAggregation?
parseBranchEvents would only process the brstack events (ie PerfBranchSample) anyway, right?

(2) The flag is currently a toggle: if set, we treat -p/-perfdata as textual format, right?
We could fully align with llvm-profgen if we want and use -ps/-perfscript as a filename instead. Ofc we'll need to adjust the logic, likely in places like this. (not a strong opinion)

@kaadam, @aaupov please let me know of your thoughts.

Comment thread bolt/include/bolt/Profile/DataAggregator.h Outdated
Comment thread bolt/lib/Profile/DataAggregator.cpp Outdated
ReadPerfScript("perfscript",
cl::desc("skip perf and read perf-script trace created by "
"Linux perf tool with script command"),
cl::ReallyHidden, cl::cat(AggregatorCategory));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
cl::ReallyHidden, cl::cat(AggregatorCategory));
cl::Hidden, cl::cat(AggregatorCategory));

I believe we could make the new flag just Hidden instead, so it can appear with the below?

 perf2bolt --help-list-hidden

The old flag (ReadPerfEvents) was never really used from the CLI, only in a single unit test (PerfSpeEvents), since it was never fully implemented.

We could replace it and drop the old flag, given that we hardcode the parsing buffer to the values used by the relevant unit test? We could do a follow-up patch on this.

@kaadam
Copy link
Copy Markdown
Contributor Author

kaadam commented Nov 7, 2025

@paschalis-mpeis, thanks for your comment.
My basic idea was the following:

  1. Users is constructing the proper perf input by 'perf script' manually, based on the aggregation type (brstack) what they want to run.
  2. If '--perfscript' set, Bolt will treat -p/-perfdata as textual format (similarly as Bolt does with pre-aggregated format), and process the text file based on the aggregation type.

Are there actual limitations to using --perfscript with basic samples?

There shouldn't be any limitation, it should depend on the input. However the current implementation covers only BranchEvent aggregation.

Why not call parseBranchEvents or parseBasicEvents, depending on BasicAggregation? parseBranchEvents would only process the brstack events (ie PerfBranchSample) anyway, right?

Yes, it only process branch events, in all other cases it throws an error.

(2) The flag is currently a toggle: if set, we treat -p/-perfdata as textual format, right? We could fully align with llvm-profgen if we want and use -ps/-perfscript as a filename instead. Ofc we'll need to adjust the logic, likely in places like this. (not a strong opinion)

Yes, we can use --perfscript as filename, I tried to do minimal changes here, that's why I followed the --pa logic.

@kaadam
Copy link
Copy Markdown
Contributor Author

kaadam commented Nov 21, 2025

Hi, @aaupov @paschalis-mpeis
Based on our last discussion on officehours, I would like to share my plan about supporting pre-parsed perf data.
The basic idea is to create a hybrid text based profile. Where all of the required 'perf scripts' outputs are merged in a single file. The file will contain a table of content where all events are represented with their sizes (BUILDID:SIZE ... MMAP:SIZE ...). Based on this data perf2bolt loads only the necessary slice from the file.

perf2bolt would be the file generator, for example this command below generates a perf.text hybrid profile for 'BasicAggregation'. Or with '-spe' for 'BranchAggregation'.

perf2bolt binary -p perf.data -o perf.text --ba -generate-perf-text-data

In the test phase we can use this pre-parsed perf profile.

perf2bolt binary -p perf.text -o perf.fdata --ba -perf-text-data

Is that something sounds reasonable for you?

@aaupov
Copy link
Copy Markdown
Contributor

aaupov commented Nov 21, 2025

@kaadam, yes, the plan sounds good to me.

@paschalis-mpeis
Copy link
Copy Markdown
Member

I discussed this offline with Adam last week, and I liked his idea provided Amir approves as well.
Great, we can go ahead then!

@kaadam kaadam marked this pull request as draft December 8, 2025 16:30
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 8, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 8, 2025

🐧 Linux x64 Test Results

  • 672 tests passed
  • 59 tests skipped

✅ The build succeeded and all tests passed.

@kaadam kaadam changed the title [Bolt] Add a new hidden option to perf2bolt for testing purpose [BOLT] Add pre-parsed perf script support Dec 10, 2025
@kaadam kaadam marked this pull request as ready for review December 10, 2025 16:07
@kaadam
Copy link
Copy Markdown
Contributor Author

kaadam commented Dec 10, 2025

FYI: This PR depends on #171144

Comment thread bolt/lib/Profile/DataAggregator.cpp Outdated
cl::desc("skip perf event collection by supplying a "
"perf-script output in a textual format"),
cl::ReallyHidden, cl::init(""), cl::cat(AggregatorCategory));
cl::opt<bool> ReadPerfTextProfile(
Copy link
Copy Markdown
Contributor

@Jinjie-Huang Jinjie-Huang May 21, 2026

Choose a reason for hiding this comment

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

I guess a more user-friendly way might be to auto-detect the format, and set ReadPerfTextProfile true, since we already have PerfTextMagicStr. Alternatively, could we adopt a behavior similar to llvm-profgen, where we pass the filename directly to this option without needing the -p flag at all?

Copy link
Copy Markdown
Contributor Author

@kaadam kaadam May 22, 2026

Choose a reason for hiding this comment

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

Yes, I agree. The main reason for adding the magic string to the generated file was indeed to enable better format auto-detection in the future. However, for this initial patch, I wanted to stick to the existing logic and focus solely on adding the "new" aggregation type in isolation, similar to 'pre-Aggregated' format.

Currently, the -p option is mandatory for 'perf2bolt', and the aggregation type must be explicitly defined if we alter the default aggregation. There is probably room for improvement here, changing this core behavior was out of scope for this task.
Thanks for the heads-up! That's a great thought for a follow-up patch to improve the user experience.

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.

I agree with the request above: we can auto-sense perf-script format. Since perf script will be passed as -p arg, this will be handled by DataAggregator. -pa is used to drive pre-aggregated parsing. We can read the header to decide if it's pre-aggregated or perf-script format. You can add -ps (perf-script) as alias to -pa.
Does this sound reasonable to you?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@aaupov @Jinjie-Huang I've added the -ps option as an alias for -pa and merged the names of the 'cl::opts'. I also introduced a magic detection method to automatically determine which aggregation format to run. Could you please take another look?

Comment thread bolt/lib/Profile/DataAggregator.cpp Outdated
TimerGroupName, TimerGroupDesc, opts::TimeAggregator);
if (!Filename.empty()) {
ErrorOr<std::unique_ptr<MemoryBuffer>> MB =
MemoryBuffer::getFileOrSTDIN(Filename);
Copy link
Copy Markdown
Contributor

@Jinjie-Huang Jinjie-Huang May 21, 2026

Choose a reason for hiding this comment

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

Maybe we shouldn't map the full file here just for the header parsing. Could we also use getFileSlice to fetch just the first 133 bytes for the header? In some cases I've encountered, perf script files grow to several tens of GBs, so mapping the whole file could be quite heavy.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's good point. Updating that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@Jinjie-Huang
Copy link
Copy Markdown
Contributor

@kaadam Thanks for the contribution! Overall, LGTM. A test case covering the full functionality would be great here.

@kaadam
Copy link
Copy Markdown
Contributor Author

kaadam commented May 22, 2026

@Jinjie-Huang Thanks for your review. Yes, a test case is definitely necessary. I had an offline discussion with @paschalis-mpeis, and I'm adding a unit test for this functionality at this stage. The main purpose of this feature is to support end-to-end testing for large binaries, and the plan is to further improve test coverage with 'perf-tests' later on.

Copy link
Copy Markdown
Contributor

@aaupov aaupov left a comment

Choose a reason for hiding this comment

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

I have one concern about the use of "event". This PR makes the term ambiguous: currently it means HW sampling event (perf record -e <event>), but here it's used in a sense of perf script invocations: "branch events" is fine, but "buildid events" doesn't make sense to me. Part or group is perhaps a better term. WDYT?

Comment thread bolt/include/bolt/Profile/DataAggregator.h
Comment thread bolt/include/bolt/Profile/DataAggregator.h Outdated
Comment thread bolt/lib/Profile/DataAggregator.cpp Outdated
cl::desc("skip perf event collection by supplying a "
"perf-script output in a textual format"),
cl::ReallyHidden, cl::init(""), cl::cat(AggregatorCategory));
cl::opt<bool> ReadPerfTextProfile(
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.

same here:

Suggested change
cl::opt<bool> ReadPerfTextProfile(
cl::opt<bool> ReadPerfScript(

Comment thread bolt/lib/Profile/DataAggregator.cpp Outdated
Comment on lines +127 to +128
cl::desc("skip perf event collection by reading a "
"pre-parsed perf-script output in a textual format"),
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.

Suggested change
cl::desc("skip perf event collection by reading a "
"pre-parsed perf-script output in a textual format"),
cl::desc("read pre-parsed perf script output"),

Comment thread bolt/lib/Profile/DataAggregator.cpp Outdated
Comment thread bolt/include/bolt/Profile/DataAggregator.h Outdated
Comment thread bolt/lib/Profile/DataAggregator.cpp Outdated
@kaadam
Copy link
Copy Markdown
Contributor Author

kaadam commented May 27, 2026

I have one concern about the use of "event". This PR makes the term ambiguous: currently it means HW sampling event (perf record -e <event>), but here it's used in a sense of perf script invocations: "branch events" is fine, but "buildid events" doesn't make sense to me. Part or group is perhaps a better term. WDYT?

Thanks for the review. Yes, I understand your concern about these terms. I will revisit all of them. I originally used 'event' as a generic term for naming variables as well, but you are right: a buildid is definitely not a hardware event.

kaadam added 8 commits June 2, 2026 10:45
This PR implements the functionality to read and parse a pre-paresed
perf-script profile which was made by Perf2bolt's
'--generate-perf-text-data' option.

It helps to add support for large ARM Spe end-to-end tests.

Why does the test need to have a textual format Spe profile?
- To collect an Arm Spe profile by Linux Perf, it needs to have
  an arm developer device which has Spe support.
- To decode Spe data, it also needs to have the proper version of
  Linux Perf.
  The minimum required version of Linux Perf is v6.15.

Bypassing these technical difficulties, that easier to prove
a pre-generated textual profile format.

How should generate this type of profile?

 1) You can use Perf2bolt itself to generate a pre-parsed perf-script profile
    in textual format.
    $ perf2bolt BINARY -p perf.data -o test.text --spe --generate-perf-script

 2) Perf2bolt is able to work with this type of profile:
    $ perf2bolt BINARY -o test.fdata  -p test.text --spe -perf-script
@kaadam
Copy link
Copy Markdown
Contributor Author

kaadam commented Jun 2, 2026

@aaupov Thanks for the review.
I've also added a unit test for parsing the perfscript header.
Another test plan: I plan to add a perf-test that covers both 'perfscript' generation and the parse. What do you think, is that good for you to do in a separate PR?

Copy link
Copy Markdown
Contributor

@aaupov aaupov left a comment

Choose a reason for hiding this comment

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

Thank you, this looks very good. I've left a couple of comments, please take a look. I also realize that #200476 might cause some churn for this PR as well – I'm OK with landing it after this, WDYT? Would also appreciate you reviewing it.

Comment thread bolt/include/bolt/Profile/DataAggregator.h Outdated
Comment thread bolt/lib/Profile/DataAggregator.cpp Outdated
Comment thread bolt/lib/Profile/DataAggregator.cpp Outdated
@kaadam
Copy link
Copy Markdown
Contributor Author

kaadam commented Jun 3, 2026

Thank you, this looks very good. I've left a couple of comments, please take a look. I also realize that #200476 might cause some churn for this PR as well – I'm OK with landing it after this, WDYT? Would also appreciate you reviewing it.

Thanks for your review. I'm updating the PR based on your suggestions. That would be nice, if we could land this soon. :) I will also take a look at #200476.

Comment thread bolt/lib/Profile/DataAggregator.cpp
Copy link
Copy Markdown
Contributor

@aaupov aaupov left a comment

Choose a reason for hiding this comment

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

LGTM with one nit

Comment thread bolt/lib/Profile/DataAggregator.cpp Outdated
Comment on lines 859 to 867
if (opts::ReadPreAggregated &&
checkInputFileMagic(Filename, PerfTextMagicStr)) {
if (Error Err = parsePerfScript()) {
errs() << "PERF2BOLT-ERROR: failed to parse perfscript profile"
<< llvm::toString(std::move(Err)) << "\n";
exit(1);
}
} else if (opts::ReadPreAggregated) {
parsePreAggregated();
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.

Move checkInputFileMagic into if (opts::ReadPreAggregated)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@kaadam
Copy link
Copy Markdown
Contributor Author

kaadam commented Jun 4, 2026

@aaupov Thanks for the approval! Please let me know if it's good to be merge. I will go ahead and merge it then unless there are any final objections.
@paschalis-mpeis Do you have any additional suggestion?

Copy link
Copy Markdown
Member

@paschalis-mpeis paschalis-mpeis left a comment

Choose a reason for hiding this comment

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

No further suggestions.

Feel free to proceed with merging. Great work Adam!

Copy link
Copy Markdown
Contributor

@Jinjie-Huang Jinjie-Huang left a comment

Choose a reason for hiding this comment

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

Thanks

@kaadam kaadam merged commit 3e44733 into llvm:main Jun 4, 2026
10 checks passed
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.

5 participants