On Monday, May 12, 2014, 猫妖 <<a href="mailto:spcatman@qq.com">spcatman@qq.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Hi, all</div>
<div><br></div><div> Recently I'm trying to use LLVM PGO and autoFDO. However I have some problems in the process. </div><div> LLVM source code is updated on April 9th. Operating system is SUSE x86_64</div><div><br>
</div><div> 1. Problems in instrumentation based PGO:</div><div> clang -O2 -fprofile-instr-generate test.c -o a.out</div><div> ./a.out (then default.profraw is generated)</div><div> clang -O2 -fprofile-instr-use=default.profraw test.c -o a.out</div>
<div> error: pgo data file has malformed function entry</div><div> I found that the run-time function "writeFile" in InstrProfilingFile.cpp didn't write '\n'. </div><div> But when parsing the profile data, in CodeGenPGO.cpp line 56, it tried to find '\n' like below:</div>
<div> CurPtr = strchr(CurPtr, '\n');</div><div> if (!CurPtr) {</div><div> ReportBadPGOData(CGM, "pgo data file has malformed function entry");</div><div> return;</div><div> }</div></div></blockquote>
<div><br></div><div>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.<br></div><div><br></div><div>
You need to run `llvm-profdata merge` on the raw profile data to generate the format that clang understands. Something like:</div><div><br></div><div> llvm-profdata merge default.profraw -o default.profdata</div><div><br>
</div><div>Then use default.profdata as the input to -fprofile-instr-use.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div> 2. Problems in autoFDO: </div>
<div> Actually the problem happened in using create_llvm_prof, transformation is failed.</div><div> clang -O2 -g test.c -o a.out</div><div> perf record -b ./a.out (perf version is 0.0.2, "-b" option is not recognized, why?)</div>
<div> change to: perf record ./a.out (so perf.data is generated)</div><div> create_llvm_prof --binary=./a.out --out=code.prof (it read a.out and perf.data)</div><div> error: Malformed .note.gnu.build-id section</div>
<div> no build id found in the binary</div><div> it seems that a.out has no build id.</div></div><div><br></div><div> Someone who can help me?</div><div><br></div><div> Thanks,</div><div> Kaidong Chen</div><div>
<br></div></blockquote>