[LLVMdev] Re: Questions about LLVM PGO and autoFDO

猫妖 spcatman at qq.com
Thu May 15 09:05:06 PDT 2014


On Monday, May 12, 2014, 猫妖 <spcatman at qq.com> wrote:
Hi, all
 

  Recently I'm trying to use LLVM PGO and autoFDO. However I have some problems in the process. 
  LLVM source code is updated on April 9th. Operating system  is SUSE x86_64

 
  1. Problems in instrumentation based PGO:
  clang -O2 -fprofile-instr-generate test.c -o a.out
  ./a.out     (then default.profraw is generated)
  clang -O2 -fprofile-instr-use=default.profraw test.c -o a.out
   error: pgo data file has malformed function entry
  I found that the run-time function "writeFile" in InstrProfilingFile.cpp didn't write '\n'. 
  But when parsing the profile data,  in CodeGenPGO.cpp line 56, it tried to find '\n' like below:
   CurPtr = strchr(CurPtr, '\n');
  if (!CurPtr) {
    ReportBadPGOData(CGM, "pgo data file has malformed function entry");
    return;
  }

 

>>Sorry that this isn't documented very well. I'm working on some documentation for the instrumentation 
>>based profiling that should make this less of a guessing game.


>>You need to run `llvm-profdata merge` on the raw profile data to generate the format that clang 
>>understands. Something like:


>>  llvm-profdata merge default.profraw -o default.profdata

 
>>Then use default.profdata as the input to -fprofile-instr-use.


     It has worked well after I do as you say. Thank you!
     And I want to confirm what passes benefits from profdata-guided feedback currently.
     Is the profiledata feeded back to all of basicblock replacement, function inline, register allocation
     and loop-unroll, or only basicblock replacement ?
     
     I'll test performance improvement of PGO on some benchmarks.
     I think you already have some test results.


     Thanks,
     Kaidong Chen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140516/aafe5529/attachment.html>


More information about the llvm-dev mailing list