google / google/llvm-propeller
Processing profile for Linux Kernel fails when Kernel is built using `CONFIG_LTO_CLANG_THIN_DIST` or `CONFIG_LTO_CLANG_FULL`
- Dominant language
- C++
- Stars
- 543
- Forks
- 49
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 9
Description
I'm having a problem attempting to use either `create_llvm_prof` or `generate_propeller_profiles`, when it comes to processing a profile recorded for the Linux Kernel, built using `CONFIG_LTO_CLANG_THIN_DIST` or `CONFIG_LTO_CLANG_FULL`, into usable Propeller files.
I had previously profiled for AutoFDO/Propeller just fine while `CONFIG_LTO_CLANG_THIN` had been set, but for some odd reason, BOLT would create an unbootable vmlinux binary while using ThinLTO, so I attempted to reprofile using `CONFIG_LTO_CLANG_THIN_DIST`/`CONFIG_LTO_CLANG_FULL`, which was fine while processing for AutoFDO (using `llvm-profgen`), but came across these problems during the Propeller processing stages.
**`Unable to create edges from branch profile: Fewer than 0.05% recorded jumps are convertedinto CFG edges, probably because of source drift.`**
[My Kernel config](https://github.com/user-attachments/files/21090065/kernel.txt)
**To record the profile itself:**
`perf record --pfm-events RETIRED_TAKEN_BRANCH_INSTRUCTIONS:k -a -N -b -c 49999 -o kernel.data -- bash -c /root/cachyos-benchmarker/kernel-autofdo.sh`
**To convert the profile:**
`create_llvm_prof --binary=/usr/src/linux/vmlinux --profile=/usr/src/propeller/kernel.data --format=propeller --propeller_output_module_name --out=/usr/src/propeller/propeller_cc_profile.txt --propeller_symorder=/usr/src/propeller/propeller_ld_profile.txt`
[create_llvm_prof output](https://github.com/user-attachments/files/21090084/create_llvm_prof.txt)
**To convert using generate_propeller_profiles:**
`generate_propeller_profiles --binary=/usr/src/linux/vmlinux --profile=kernel.data --cc_profile=cc_profile.txt --ld_profile=ld_profile.txt`
[generate_propeller_profiles output](https://github.com/user-attachments/files/21090121/generate_propeller_profiles.txt)
I'm not 100% sure if Propeller actually supports full LTO at all, and I hadn't seen the `CONFIG_LTO_CLANG_THIN_DIST` option until very recently so I haven't really looked into what is different about it.
Contributor guide
Assessment
This issue has not been assessed yet.