[PATCH] D90125: [CSSPGO] Infrastructure for context-sensitive Sample PGO and Inlining

Wenlei He via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 20 00:34:09 PST 2020


Agreed. Though the tricky part is the staleness, e.g. refresh every day vs every week may have different results.

I think eventually it might make sense to have a switch to control how we want to treat non-existing samples (0 or unknown), and that needs to be paired with a witch in llvm-profgen to control whether we fill in 0 for unsampled lines. These two switches need to be coordinated, or even better, the setting can be stored in profile file, then compiler can adapt to how profile is generated.

Users can choose which mode to use depending on refresh frequency and sensitiveness to profile size.

Thanks,
Wenlei

From: Wei Mi <wmi at google.com>
Date: Thursday, November 19, 2020 at 3:36 PM
To: Wenlei He <reviews+D90125+public+34d9fdca657d53b2 at reviews.llvm.org>
Cc: Wenlei He <wenlei at fb.com>, Hongtao Yu <hoy at fb.com>, David Li <davidxl at google.com>, higuoxing at gmail.com <higuoxing at gmail.com>, dougpuob at gmail.com <dougpuob at gmail.com>, 88888yl at gmail.com <88888yl at gmail.com>, Lei Wang <wlei at fb.com>, Michał Górny <mgorny at gentoo.org>, lxfind at gmail.com <lxfind at gmail.com>, Modi Mo <modimo at fb.com>, llvm-commits <llvm-commits at lists.llvm.org>, matthew.voss at sony.com <matthew.voss at sony.com>
Subject: Re: [PATCH] D90125: [CSSPGO] Infrastructure for context-sensitive Sample PGO and Inlining
On Thu, Nov 19, 2020 at 2:59 PM Wenlei He via Phabricator
<reviews at reviews.llvm.org> wrote:
>
> wenlei added inline comments.
>
>
> ================
> Comment at: llvm/include/llvm/ProfileData/SampleProf.h:504-506
> +      // For CSFDO, in order to conserve profile size, we no longer write out
> +      // locations profile for those not hit during training, so we need to
> +      // treat them as zero instead of error here.
> ----------------
> wenlei wrote:
> > wmi wrote:
> > > davidxl wrote:
> > > > CSFDO ==> CSSPGO
> > > It means CSSPGO will treat all the new lines as cold, even if some of them may be inferred from other parts of the profile. How much extra size is needed if zero is emitted?
> > Knowing that CS profile will be much bigger, we started with trimming zero counts trying to save size as much as we can. But I don't actually have the data at hand. Let me see if I can get some data on this.
> >
> > New lines will be less of a problem for pseudo-probe if they don't change CFG.
> >
> I took a look at current profile generation tool. It requires some extra work to fill in zeros for not sample lines for CSSPGO. I collected AutoFDO for mysql w/ and w/o zeros filled, here's the size difference. CSSPGO is likely to see similar or bigger relative size difference (profile for context can be more sparse).
>
> w/ zero filled for unsampled lines: 3.9M
> w/o zero filled for unsampled lines: 1.4M
>

Thanks for the data. That matches my expectation. It will be
interesting to know the performance impact for both CSSPGO and current
SPGO. For example, we can have some stale profile with and without
zero filled for unsampled lines. Coupled with needed compiler change,
we can compare whether the zeros are necessary for performance,
especially under the source drift circumstance. If not, it can bring
some substantial profile size saving and build time reduction for
current SPGO.

>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D90125/new/<https://reviews.llvm.org/D90125/new/>
>
> https://reviews.llvm.org/D90125<https://reviews.llvm.org/D90125>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201120/798d3c25/attachment.html>


More information about the llvm-commits mailing list