Moshtaghi, Alireza via llvm-dev
2017-Dec-19 18:26 UTC
[llvm-dev] Question about : lprofValueProfNodes
Hi
This array is defined in compiler-rt: InstrProfilingValue.c but I can’t find
where it is used?
And the comment on it does not say much about why we need it either.
Can someone explain why we need this and where it is used?
/* A shared static pool in addition to the vnodes statically
* allocated by the compiler. */
COMPILER_RT_VISIBILITY ValueProfNode
lprofValueProfNodes[INSTR_PROF_VNODE_POOL_SIZE]
COMPILER_RT_SECTION(COMPILER_RT_SEG INSTR_PROF_VNODES_SECT_NAME_STR);
Thanks
A
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20171219/ad63ed25/attachment.html>
Vedant Kumar via llvm-dev
2017-Dec-19 19:31 UTC
[llvm-dev] Question about : lprofValueProfNodes
Hi,> On Dec 19, 2017, at 10:26 AM, Moshtaghi, Alireza via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi > This array is defined in compiler-rt: InstrProfilingValue.c but I can’t find where it is used?It's used in allocateOneNode(). Incrementing the current vnode pointer gives a fresh node (possibly backed by the shared pool).> And the comment on it does not say much about why we need it either.It's used to avoid calling malloc(), which David (CC'd) found to be a performance improvement. best, vedant> Can someone explain why we need this and where it is used? > > /* A shared static pool in addition to the vnodes statically > * allocated by the compiler. */ > COMPILER_RT_VISIBILITY ValueProfNode > lprofValueProfNodes[INSTR_PROF_VNODE_POOL_SIZE] COMPILER_RT_SECTION(COMPILER_RT_SEG INSTR_PROF_VNODES_SECT_NAME_STR); > > Thanks > A > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://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/20171219/1a6801b9/attachment.html>
Xinliang David Li via llvm-dev
2017-Dec-19 19:46 UTC
[llvm-dev] Question about : lprofValueProfNodes
On Tue, Dec 19, 2017 at 11:31 AM, Vedant Kumar via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi, > > > On Dec 19, 2017, at 10:26 AM, Moshtaghi, Alireza via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > Hi > This array is defined in compiler-rt: InstrProfilingValue.c but I can’t > find where it is used? > > > It's used in allocateOneNode(). Incrementing the current vnode pointer > gives a fresh node (possibly backed by the shared pool). > > > And the comment on it does not say much about why we need it either. > > > It's used to avoid calling malloc(), which David (CC'd) found to be a > performance improvement. > >Right -- it is used to avoid depending on dynamic memory allocation. Other than performance, if heap memory is used, the program may deadlock if malloc library (such as tcmalloc) is instrumented. To turn off the behavior, use the following option -mllvm -vp-static-alloc=false with the instrumentation build. David> best, > vedant > > Can someone explain why we need this and where it is used? > > /* A shared static pool in addition to the vnodes statically > * allocated by the compiler. */ > COMPILER_RT_VISIBILITY ValueProfNode > lprofValueProfNodes[INSTR_PROF_VNODE_POOL_SIZE] > COMPILER_RT_SECTION(COMPILER_RT_SEG INSTR_PROF_VNODES_SECT_NAME_STR); > > Thanks > A > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://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/20171219/15badb6d/attachment.html>
Moshtaghi, Alireza via llvm-dev
2017-Dec-20 01:16 UTC
[llvm-dev] Question about : lprofValueProfNodes
Thank you
So it does not seem to be relevant for what I’m trying to do.
I’m doing something unconventional.
The objective is to implement PGO and code coverage on a system that does not
exit and does not have any file io, or any of stdc libraries that
libclang-profile is using. (more like a kernel)
So what I’m trying to do is instead of calling __llvm_profile_write_file () from
the application, read the sections __llvm_prf_data, __llvm_prf_names,
__llvm_prf_cnts and __llvm_prf_vnds after the critical tasks are done and
transfer them to outside of the system.
Then dump these sections in a char * array in a c file and attribute them to be
in the associated section. Then compile that file with –u__llvm_profile_runtime
to create an executable that calls __llvm_profile_write_file to dump my profraw
data.
Sofar, I’m able to do the mechanics but seems like something is going wrong
because because fprofile-instr-use does not find profile data for the source
files.
Any suggestion?
Thanks
A
From: <vsk at apple.com> on behalf of Vedant Kumar <vsk at
apple.com>
Date: Tuesday, December 19, 2017 at 11:32 AM
To: "Moshtaghi, Alireza" <Alireza.Moshtaghi at netapp.com>
Cc: llvm-dev <llvm-dev at lists.llvm.org>, Xinliang David Li <davidxl
at google.com>
Subject: Re: [llvm-dev] Question about : lprofValueProfNodes
Hi,
On Dec 19, 2017, at 10:26 AM, Moshtaghi, Alireza via llvm-dev <llvm-dev at
lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote:
Hi
This array is defined in compiler-rt: InstrProfilingValue.c but I can’t find
where it is used?
It's used in allocateOneNode(). Incrementing the current vnode pointer gives
a fresh node (possibly backed by the shared pool).
And the comment on it does not say much about why we need it either.
It's used to avoid calling malloc(), which David (CC'd) found to be a
performance improvement.
best,
vedant
Can someone explain why we need this and where it is used?
/* A shared static pool in addition to the vnodes statically
* allocated by the compiler. */
COMPILER_RT_VISIBILITY ValueProfNode
lprofValueProfNodes[INSTR_PROF_VNODE_POOL_SIZE]
COMPILER_RT_SECTION(COMPILER_RT_SEG INSTR_PROF_VNODES_SECT_NAME_STR);
Thanks
A
_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
http://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/20171220/896fc690/attachment.html>