- Notifications
You must be signed in to change notification settings - Fork14.5k
[llvm-profgen] Extend llvm-profgen to generate vtable profiles with data access events.#148013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:users/mingmingl-llvm/samplefdo-profile-format
Are you sure you want to change the base?
Conversation
…enerate vtable profiles for non context-sensitive AFDO profiles
@llvm/pr-subscribers-pgo Author: Mingming Liu (mingmingl-llvm) ChangesAn RFC is inhttps://discourse.llvm.org/t/rfc-vtable-type-profiling-for-samplefdo/87283 This change extends to process perf data with IntelMEM_INST_RETIRED.ALL_LOADS samples and produce sample profiles with vtable information for non context-sensitive SampleFDO profiles.
Patch is 186.37 KiB, truncated to 20.00 KiB below, full version:https://github.com/llvm/llvm-project/pull/148013.diff 10 Files Affected:
diff --git a/llvm/test/tools/llvm-profgen/Inputs/dap-perf-trace.txt b/llvm/test/tools/llvm-profgen/Inputs/dap-perf-trace.txtnew file mode 100644index 0000000000000..28f15b1ff199d--- /dev/null+++ b/llvm/test/tools/llvm-profgen/Inputs/dap-perf-trace.txt@@ -0,0 +1,37 @@+0 0x7b10 [0x88]: PERF_RECORD_MMAP2 3446532/3446532: [0x200000(0x60000) @ 0 08:01 527501 0]: r--p /path/to/dap.perfbin+0 0x7b98 [0x88]: PERF_RECORD_MMAP2 3446532/3446532: [0x260000(0x153000) @ 0x5f000 08:01 527501 0]: r-xp /path/to/dap.perfbin+0 0x7c20 [0x88]: PERF_RECORD_MMAP2 3446532/3446532: [0x3b3000(0xc000) @ 0x1b1000 08:01 527501 0]: r--p /path/to/dap.perfbin+0 0x7ca8 [0x88]: PERF_RECORD_MMAP2 3446532/3446532: [0x3bf000(0x3000) @ 0x1bc000 08:01 527501 0]: rw-p /path/to/dap.perfbin+1282514021937402 0x8660 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70+1282514022939813 0x87b0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3fb0+1282514023932029 0x8a00 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3fb0+1282514024937981 0x8d48 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3fb0+1282514028925828 0x94c0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3fb0+1282514028934870 0x9678 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3fc0+1282514029934094 0x9830 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3fb0+1282514040934785 0xb1d0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3fc0+1282514052924510 0xcbb8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70+1282514053932406 0xcfb0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3fc0+1282514063928248 0xe5c8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70+1282514073928057 0xfd20 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70+1282514081925013 0x10f28 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70+1282514084927335 0x11678 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70+1282514088926926 0x11f90 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70+1282514089929492 0x12270 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70+1282514119919997 0x16610 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70+1282514120924169 0x16920 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70+1282514145923603 0x1a338 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70+1282514146917708 0x1a428 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70+1282514173914003 0x1e1b0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70+1282514188915199 0x20488 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70+1282514210915866 0x236d8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70+1282514212908181 0x23a50 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70+1282514480886012 0x4a098 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80+1282514840855333 0x7dd48 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80+1282514955835364 0x8e380 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80+1282514967839429 0x8fef8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80+1282515023830209 0x97f98 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80+1282515356804308 0xc7b28 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80+1282515410794371 0xcf590 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80+1282515541786485 0xe2280 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80+1282515703761203 0xf93c0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80diff --git a/llvm/test/tools/llvm-profgen/Inputs/dap.perfbin b/llvm/test/tools/llvm-profgen/Inputs/dap.perfbinnew file mode 100755index 0000000000000..e69de29bb2d1ddiff --git a/llvm/test/tools/llvm-profgen/Inputs/lbr-perf-for-dap.script b/llvm/test/tools/llvm-profgen/Inputs/lbr-perf-for-dap.scriptnew file mode 100644index 0000000000000..34a2f5121b3c6--- /dev/null+++ b/llvm/test/tools/llvm-profgen/Inputs/lbr-perf-for-dap.script@@ -0,0 +1,175 @@+PERF_RECORD_MMAP2 3446532/3446532: [0x260000(0x153000) @ 0x5f000 08:01 527501 0]: r-xp /path/to/dap.perfbin+PERF_RECORD_MMAP2 3446532/3446532: [0x7fff5ff28000(0x2000) @ 0 00:00 0 0]: r-xp [vdso]+PERF_RECORD_MMAP2 3446532/3446532: [0xffffffffff600000(0x1000) @ 0 00:00 0 0]: --xp [vsyscall]+ 350fd4 0x260832/0x260894/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//-+ 260884 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26087a/0x260be0/P/-/-/2//- 0x2608ac/0x260870/P/-/-/1//- 0x2607fc/0x2608a4/P/-/-/2//- 0x2608a2/0x2607f0/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x260c52/0x260827/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/2//-+ 2608a4 0x260c47/0x350850/P/-/-/2//- 0x260822/0x260c30/P/-/-/1//- 0x260808/0x26081d/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//-+ 35104c 0x2608ac/0x260850/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//-+ 260800 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26087a/0x260be0/P/-/-/2//- 0x2608ac/0x260870/P/-/-/1//- 0x2607fc/0x2608a4/P/-/-/2//- 0x2608a2/0x2607f0/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x260c52/0x260827/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/2//- 0x260822/0x260c30/P/-/-/1//- 0x260808/0x26081d/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//-+ 2608a4 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//-+ 35109d 0x26085a/0x260be0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26087a/0x260be0/P/-/-/2//- 0x2608ac/0x260870/P/-/-/1//- 0x2607fc/0x2608a4/P/-/-/2//- 0x2608a2/0x2607f0/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x260c52/0x260827/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/2//- 0x260822/0x260c30/P/-/-/1//- 0x260808/0x26081d/P/-/-/1//-+ 260c30 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//-+ 260bf0 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//-+ 2608af 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26087a/0x260be0/P/-/-/2//- 0x2608ac/0x260870/P/-/-/1//- 0x2607fc/0x2608a4/P/-/-/2//- 0x2608a2/0x2607f0/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x260c52/0x260827/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/2//- 0x260822/0x260c30/P/-/-/1//- 0x260808/0x26081d/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//-+ 350866 0x351059/0x351098/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//-+ 350f40 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26087a/0x260be0/P/-/-/2//- 0x2608ac/0x260870/P/-/-/1//- 0x2607fc/0x2608a4/P/-/-/2//- 0x2608a2/0x2607f0/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x260c52/0x260827/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/2//- 0x260822/0x260c30/P/-/-/1//- 0x260808/0x26081d/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//-+ 26090f 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//-+ 260814 0x26090a/0x260880/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26087a/0x260be0/P/-/-/2//- 0x2608ac/0x260870/P/-/-/1//- 0x2607fc/0x2608a4/P/-/-/2//-+ 350f57 0x350879/0x350887/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/2//- 0x260822/0x260c30/P/-/-/1//- 0x260808/0x26081d/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//-+ 260880 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350...[truncated] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Mostly cosmetic comments..
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
// Parse a single line of a PERF_RECORD_MMAP event looking for a | ||
// mapping between the binary name and its memory layout. | ||
static bool extractMMapEventForBinary(ProfiledBinary *Binary, StringRef Line, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It's a bit strange to use a static method from the inherited class in the base class. Can you make this a base class method and update the usage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Sure. How does it sound if I do this in a separate change to minimize the code diff? Added a TODO in the comment if that's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Sounds good to cleanup after.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
@@ -0,0 +1,18 @@ | |||
RUN: llvm-profgen --perfscript=%p/Inputs/lbr-perf-for-dap.script --data-access-profile=%p/Inputs/dap-perf-trace.txt \ | |||
RUN: --binary=%p/Inputs/dap.perfbin --format=text --pid=3446532 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Maybe rename dap.perfbin to just dap.bin.perfbin
made me think that it was the binary file obtained from the perf record command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
done.
Somehow my previous commit left thedap.bin
executable as an empty file. Luckily I found the executable in one of the working directory so just copied it here.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
thanks for reviews! PTAL.
@@ -67,6 +67,11 @@ static cl::opt<std::string> DebugBinPath( | |||
"from it instead of the executable binary."), | |||
cl::cat(ProfGenCategory)); | |||
static cl::opt<std::string> DataAccessProfileFilename( | |||
"data-access-profile", cl::value_desc("data-access-profile"), | |||
cl::desc("Path of the data access profile to be generated."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
done.
} | ||
// Given a runtime address, canonicalize it to the virtual address in the | ||
// binary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Updated the comment to mention 'non-text' and added a TODO to consider unifying text vs non-text. I think it should be possible to do some refactoring, but not sure if we can completely get rid of a data-vs-text hint from caller side (e.g. executable's linking option may affect the code/data to segment mapping).
Uh oh!
There was an error while loading.Please reload this page.
Symbolizer->symbolizeData(SymbolizerPath.str(), {Address, 0}), | ||
SymbolizerPath); | ||
auto It = NameStrings.insert(DataDIGlobal.Name); | ||
return StringRef(*It.first); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
hmm not really. The originalIt
is actually of typepair<decltype(NameStrings)::iterator, bool>
, I revised the code slightly to make the types and names more explicit.
@@ -946,6 +978,14 @@ SampleContextFrameVector ProfiledBinary::symbolize(const InstructionPointer &IP, | |||
return CallStack; | |||
} | |||
StringRef ProfiledBinary::symbolizeDataAddress(uint64_t Address) { | |||
DIGlobal DataDIGlobal = unwrapOrError( | |||
Symbolizer->symbolizeData(SymbolizerPath.str(), {Address, 0}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LLVMSymbolizer's symbolize* interfaces [1] require a struct ofobject::SectionedAddress
[2] to symbolize an address, like, they don't take an integer of address alone. Chasing down the calls [3],sectionIndex
field isn't used so its value doesn't matter [4].
Upon this question, it's better to useUndefSection
[5] here. Added a static helper functiongetSectionedAddress
for this purpose, and use it for both code and data insideProfiledBinary
class.
[2]
llvm-project/llvm/include/llvm/Object/ObjectFile.h
Lines 146 to 151 in13f7786
structSectionedAddress { | |
conststaticuint64_t UndefSection = UINT64_MAX; | |
uint64_t Address =0; | |
uint64_t SectionIndex = UndefSection; | |
}; |
[3]
llvm-project/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
Lines 155 to 178 in13f7786
LLVMSymbolizer::symbolizeDataCommon(const T &ModuleSpecifier, | |
object::SectionedAddress ModuleOffset) { | |
auto InfoOrErr =getOrCreateModuleInfo(ModuleSpecifier); | |
if (!InfoOrErr) | |
return InfoOrErr.takeError(); | |
SymbolizableModule *Info = *InfoOrErr; | |
// A null module means an error has already been reported. Return an empty | |
// result. | |
if (!Info) | |
returnDIGlobal(); | |
// If the user is giving us relative addresses, add the preferred base of | |
// the object to the offset before we do the query. It's what DIContext | |
// expects. | |
if (Opts.RelativeAddresses) | |
ModuleOffset.Address += Info->getModulePreferredBase(); | |
DIGlobal Global = Info->symbolizeData(ModuleOffset); | |
if (Opts.Demangle) | |
Global.Name =DemangleName(Global.Name, Info); | |
return Global; | |
} |
[4]
llvm-project/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
Lines 1753 to 1766 in13f7786
std::optional<DILineInfo> | |
DWARFContext::getLineInfoForDataAddress(object::SectionedAddress Address) { | |
DILineInfo Result; | |
DWARFCompileUnit *CU =getCompileUnitForDataAddress(Address.Address); | |
if (!CU) | |
return Result; | |
if (DWARFDie Die = CU->getVariableForAddress(Address.Address)) { | |
Result.FileName = Die.getDeclFile(FileLineInfoKind::AbsoluteFilePath); | |
Result.Line = Die.getDeclLine(); | |
} | |
return Result; | |
} |
[5]
llvm-project/llvm/include/llvm/Object/ObjectFile.h
Lines 146 to 147 in13f7786
structSectionedAddress { | |
conststaticuint64_t UndefSection = UINT64_MAX; |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
@@ -0,0 +1,18 @@ | |||
RUN: llvm-profgen --perfscript=%p/Inputs/lbr-perf-for-dap.script --data-access-profile=%p/Inputs/dap-perf-trace.txt \ | |||
RUN: --binary=%p/Inputs/dap.perfbin --format=text --pid=3446532 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
done.
Somehow my previous commit left thedap.bin
executable as an empty file. Luckily I found the executable in one of the working directory so just copied it here.
// Parse a single line of a PERF_RECORD_MMAP event looking for a | ||
// mapping between the binary name and its memory layout. | ||
static bool extractMMapEventForBinary(ProfiledBinary *Binary, StringRef Line, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Sure. How does it sound if I do this in a separate change to minimize the code diff? Added a TODO in the comment if that's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
A couple of requests regarding testing --
- I think the current dap.bin is non-PIE, can you add a PIE variant test case too?
- Can you trim the lbr-perf-for-dap.script test input to preserve only whats needed for a minimal test. I think a lot of the samples are repeated and we can just test for a lower count.
// A perf_record_sample line is like | ||
// . 1282514022939813 0x87b0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): | ||
// 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3fb0 | ||
constexpr static const char *const DataAccessSamplePattern = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can this beconstexpr StringRef DataAccessSamplePattern = ...
?
SmallVector<StringRef> Fields; | ||
if (logRegex.match(Line, &Fields)) { | ||
int32_t PID = 0; | ||
Fields[1].getAsInteger(0, PID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We know the radix in the format so let's not do additional work to infer it each time and pass it in as the first argument. Also check the return bool here in there is malformed input?
Same for the getAsInteger call below.
// Parse a single line of a PERF_RECORD_MMAP event looking for a | ||
// mapping between the binary name and its memory layout. | ||
static bool extractMMapEventForBinary(ProfiledBinary *Binary, StringRef Line, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Sounds good to cleanup after.
Uh oh!
There was an error while loading.Please reload this page.
An RFC is inhttps://discourse.llvm.org/t/rfc-vtable-type-profiling-for-samplefdo/87283
This change extends to process perf data with IntelMEM_INST_RETIRED.ALL_LOADS samples and produce sample profiles with vtable information for non context-sensitive SampleFDO profiles.