[llvm] [llvm-profgen] Support COFF binary (PR #83972)

Haohai Wen via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 23:32:40 PST 2024


HaohaiWen wrote:

> > I think this looks great! Can the current version of intel vtune already generate this file, or does it require a specific unreleased version?
> > I think this needs a release note, and maybe some update to llvm-profgen documentation on how it can be used with vtune for windows binaries.
> 
> I'm using VTune 2024.0. Here's my cmd (refer to [link](https://www.intel.com/content/www/us/en/docs/dpcpp-cpp-compiler/developer-guide-reference/2024-0/hardware-profile-guided-optimization.html)):
> 
> ```
> # Open "Intel oneAPI command prompt for Intel 64 for Visual Studio 2022"
> sep -start -out app.tb7 -lbr no_filter:usr -perf-script event,ip,brstack -ec BR_INST_RETIRED.NEAR_TAKEN:PRECISE=YES:SA=1000003:pdir:lbr:USR=YES -app coff-profile.exe
> ```
> 
> sep will generate a app.perf.data.script file. Each line of lbr records starts with "event name which triggered lbr collection" and "address" e.g. I just deleted the prefix "BR_INST_RETIRED.NEAR_TAKEN:pdir: 7ff70a1b1482" so that llvm-profgen can directly use it.
> 
> ```
> BR_INST_RETIRED.NEAR_TAKEN:pdir:    7ff70a1b1482 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/P/-/A/0 0x7ff70a1b1482/0x7ff70a1b1430/-/X/A/0
> ```
> 
> Currently, -perf-script is not listed in sep -help but we can use it.


I' like to correct a mistake.
Sep is able to generate perf-script which is completely compatible with llvm-profgen.
Just specify -perf-script brstack to sep cmd.
e.g.
```
 # Open "Intel oneAPI command prompt for Intel 64 for Visual Studio 2022"
 sep -start -out app.tb7 -lbr no_filter:usr -perf-script brstack -ec BR_INST_RETIRED.NEAR_TAKEN:PRECISE=YES:SA=1000003:pdir:lbr:USR=YES -app coff-profile.exe
 ```

https://github.com/llvm/llvm-project/pull/83972


More information about the llvm-commits mailing list