[llvm-dev] Android kernel PGO with LLVM

Xinliang David Li via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 28 22:23:16 PDT 2020


For kernel PGO, you will probably need to invoke the buffer API to dump the
profile data: __llvm_profile_write_buffer. Before that call, try to get the
buffer size with __llvm_profile_get_size_for_buffer() and allocate memory
with that size.

Note the buffer API will ignore value profile data, so you should also
disable value profiling in build with --mllvm -disable-vp option to avoid
the unsats at link time.

David

On Tue, Apr 28, 2020 at 9:24 PM <mayi.rjpt at vivo.com> wrote:

> Hi David,
>
>
>
> Thank you for replying! I have checked the symbol of libclang_rt.profile-
>
> aarch64-android.a file. This archive library contains
> InstrProfilingValue.o
>
> as well as the symbol of '__llvm_profile_instrument_target' that i
> need(see
>
> https://pastebin.com/7LqpFtkP ). So I have tried to add this archive
>
> library as a link-time library when building the Android kernel. But the
>
> error still remains. I think the Android kernel may not be able to call
>
> libraries outside the kernel source tree when linking and running. So I'm
>
> porting pgo-related files (compiler-rt/lib/profile/) from compiler-rt to
>
> Android kernel source tree. Is this the right and feasible way?
>
>
>
> Yi Ma
>
> *From:* Xinliang David Li <xinliangli at gmail.com>
> *Sent:* Wednesday, April 29, 2020 1:09 AM
> *To:* Yi Ma <mayi.rjpt at vivo.com>
> *Cc:* llvm-dev <llvm-dev at lists.llvm.org>
> *Subject:* Re: [llvm-dev] Android kernel PGO with LLVM
>
>
>
> The entry point  is for value profiling and should be defined in
> InstrProfilingValue.o in the archive library. Can you check the symbol
> table of the .a file?
>
>
>
> David
>
>
>
> On Tue, Apr 28, 2020 at 4:25 AM Yi Ma via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
> Hello,
>
> I'm working on Android kernel profile-guided optimization to figure out
> whether pgo can improve the performance of Android kernel. I have tried
> to added '-fprofile-generate' option to build Android kernel(msm-4.19).
> But error occurs during building: "undefined reference to
> '__llvm_profile_instrument_target'".
> I have tried to add libclang_rt.profile-aarch64-android.a as a library
> when building Android kernel, but the error still shows up. I think the
> kernel may not be able to call libraries outside the kernel source tree,
> so I was porting pgo-related files(compiler-rt/lib/profile/) from
> compiler-rt to Android kernel source tree.
>
> Do you know why did this error occurs? And am I doing the right thing?
> Is it possible to improve the performance of Android kernel with llvm
> pgo mechanism?
>
> Thanks,
> Yi Ma
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200428/1ae8da6a/attachment-0001.html>


More information about the llvm-dev mailing list