[LLVMdev] how to get path profile information ?

erkan diken
Wed, 18 Apr 2012 11:51:58 -0000

Hi,

Currently, I am working with version 3.0. I think it would be useful to
make it work with new versions.

What i want to do is to apply edge and path profiling as it is explained in
this report: http://llvm.org/pubs/2010-12-Preuss-PathProfiling.html

Regarding the

1) naive edge profiling: (with -insert-edge-profiling)

opt -insert-edge-profiling -o matmul.ep.bc matmul.bc
lli -load ../lvm_build/Debug+Asserts/lib/libprofile_rt.so matmul.ep.bc
llvm-prof -annotated-llvm matmul.ep.bc

It seems ok. If you check output, you will see edge annotations are
inserted in llvm-ir code. I do not think there is a formatted output for
edge profiling ? (even though it says that there is a pass called
-dot-edge-numbers (suppose to provide dot graph with edge annotations) in
the document, the pass is not in current llvm dist. )

Or alternatively, one can run profile.pl script:
profile.pl-annotated-llvm matmul.bc

2) optimal edge profiling

opt -insert-optimal-edge-profiling -o matmul.oep.bc matmul.bc
lli -load ../lvm_build/Debug+Asserts/lib/libprofile_rt.so matmul.oep.bc
llvm-prof -annotated-llvm matmul.oep.bc

or alternatively profile.pl -annotated-llvm matmul.bc, but before running
script, i modified the pass as

my $ProfilePass = "-insert-optimal-edge-profiling";

both seems working well.

3) Path profiling:

If i try to apply the command as i applied for edge profiling

opt -insert-path-profiling -o matmul.pp.bc matmul.bc
lli -load ../llvm_build/Debug+Asserts/lib/libprofile_rt.so matmul.pp.bc
(produces llvmprof.out successfully)
llvm-prof matmul.pp.bc
llvm-prof: Unknown packet type #5!

I searched that line in the code, and found out that it is in
llvm/lib/Analysis/ProfileInfoLoader.cpp

default:
      errs() << ToolName << ": Unknown packet type #"
<< PacketType <<
"!\n";
      exit(1);

This is where i stuck!

Furthermore, opt has some passes like:

-path-profile-loader                      - Load path profile information
from file
-path-profile-verifier                     - Compare the path profile
derived edge profile against the edge profile.

I have tried to use them, but, indeed, I am not sure how to use them.

I hope i made it clear enough my problem, your comments are very welcome.

Thanks.
Erkan.

On Wed, Apr 18, 2012 at 12:15 PM, #ALOK PRAKASH# <ALOK0001 at
e.ntu.edu.sg>wrote:

>  What version of LLVM are you using? The profiling framework is
> completely messed up in the newer versions of LLVM.. I used to work with
> profiling in 2.5 some time ago, and it seemed to work fine.. If you really
> need this to work quickly, you might want to just get the old version and
> get on with it..
>
>  The newer versions of LLVM need to get the profiling part fixed soon..It
> is messing up my work as well..I am trying to fix it now.. If you could
> give me the exact details of the error and your steps, I might be able to
> work it out...
>
>  Cheers,
> Alok
>
>
>  ------------------------------
> *From:* llvmdev-bounces at cs.uiuc.edu [llvmdev-bounces at cs.uiuc.edu] on
> behalf of erkan diken [erkandiken at gmail.com]
> *Sent:* Wednesday, 18 April, 2012 5:15:42 PM
> *To:* llvmdev at cs.uiuc.edu
> *Subject:* [LLVMdev] how to get path profile information ?
>
>  Dear all,
>
> I have already checked some related posted messages, such as:
>
> http://lists.cs.uiuc.edu/pipermail/llvmdev/2008-January/012315.html and
> http://lists.cs.uiuc.edu/pipermail/llvmdev/2008-February/012466.html
>
> After getting rid of some error messages, I was able to run the following
> commands:
>
> 1) opt -insert-path-profiling matmul.bc -o matmul.pp.bc
> 2) lli -load ../llvm_build/Debug+Asserts/lib/libprofile_rt.so matmul.pp.bc
> (generates llvmprof.out file)
>
> and as a last command:
> 3) opt -path-profile-loader -profile-info-file=llvmprof.out matmul.pp.bc
> -analyze
>
> which provides the following output:
>
> Printing analysis 'Load path profile information from file':
> Pass::print not implemented for pass: 'Path Profiling Information
Loader'!
>
> After trying several options, this is where i was able to reach, but still
> it does not provide what i need.
>
> I am a bit confused about which commands to apply and in which order and
> with which parameters.
> Maybe someone who is already using path profiling can provide me some
> useful information.
>
> Thanks in advance.
> Erkan.
>
>


--
Best Regards,
Erkan Diken
------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20120418/58f3fa3f/attachment.html>