[llvm-dev] Error with perf2bolt in LLVM BOLT

Rafael Auler via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 8 10:46:20 PDT 2020

Hi Venugopal,

perf2bolt has strict demands on its inputs when generating the profile data file. The input binary to perf2bolt must be the same that was running when you launched perf record, and it will try to verify that by checking the build id, if the binary has one. It also assumes this will be the binary you will later optimize. Ordinarily, BOLT doesn’t optimize a binary that was already optimized by BOLT itself. That’s the message you are getting. You should try collecting data on a binary that you did not already optimize with BOLT.

That said, if you really want it, it is possible to collect data in binaries that were already bolted, but you need some non-standard flags for that. You need to use -enable-bat when generating that binary. This flag will embed a translation table in your binary that perf2bolt uses to build the profile data suitable to be consumed in the original binary. This is non-standard because it is only really necessary in some large scale deployments where collecting the data in a special “no bolt” configuration can be inconvenient.


From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Venugopal Raghavan via llvm-dev <llvm-dev at lists.llvm.org>
Reply-To: Venugopal Raghavan <venur2005 at gmail.com>
Date: Tuesday, April 7, 2020 at 10:53 PM
To: "llvm-dev at lists.llvm.org" <llvm-dev at lists.llvm.org>
Subject: [llvm-dev] Error with perf2bolt in LLVM BOLT


I was interested in trying out LLVM BOLT and generated profile data using Linux perf using the following:

perf record -e cycles:u -o perf.data <command>

This is without the use of LBR so I understand the performance improvements may not be much but this was more for becoming familiar with BOLT's commands.

I then run:

perf2bolt -nl -p perf.data -o perf.fdata <binary>

and I get the following:

PERF2BOLT: Starting data aggregation job for perf.data
PERF2BOLT: spawning perf job to read events without LBR
PERF2BOLT: spawning perf job to read mem events
PERF2BOLT: spawning perf job to read process events
PERF2BOLT: spawning perf job to read task events
BOLT-INFO: Target architecture: x86_64
BOLT-ERROR: input file was processed by BOLT. Cannot re-optimize.

Not sure why I get the above error. Can someone who has used BOLT help me?


Venugopal Raghavan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200408/f39683d3/attachment-0001.html>

More information about the llvm-dev mailing list