public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Fangrui Song <maskray@google.com>
To: Bill Wendling <morbo@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	"Jose E. Marchesi" <jemarch@gnu.org>,
	Ruud van der Pas <ruud.vanderpas@oracle.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Sami Tolvanen <samitolvanen@google.com>,
	Vladimir Mezentsev <vladimir.mezentsev@oracle.com>,
	clang-built-linux <llvm@lists.linux.dev>,
	LKML <linux-kernel@vger.kernel.org>, Yonghong Song <yhs@fb.com>,
	Wenlei He <wenlei@fb.com>, Hongtao Yu <hoy@fb.com>,
	Ingo Molnar <mingo@kernel.org>,
	linux-toolchains <linux-toolchains@vger.kernel.org>,
	elena.zannoni@oracle.com
Subject: Re: plumbers session on profiling?
Date: Fri, 1 Jul 2022 12:34:09 -0700	[thread overview]
Message-ID: <20220701193409.p4ejod7olx7ngl5m@google.com> (raw)
In-Reply-To: <CAGG=3QUA8BnhN9QaJao6nH6EyNks0yWO+cWWyvE0pJbOUm+cMw@mail.gmail.com>

On 2022-07-01, Bill Wendling wrote:
>On Fri, Jul 1, 2022 at 4:49 AM Peter Zijlstra <peterz@infradead.org> wrote:
>> On Fri, Jul 01, 2022 at 03:17:54AM -0700, Bill Wendling wrote:
>> > On Fri, Jul 1, 2022 at 2:02 AM Peter Zijlstra <peterz@infradead.org> wrote:
>> > >
>> > > On Tue, Jun 28, 2022 at 07:08:48PM +0200, Jose E. Marchesi wrote:
>> > > >
>> > > > [Added linux-toolchains@vger in CC]
>> > > >
>> > > > It would be interesting to have some discussion in the Toolchains track
>> > > > on building the kernel with PGO/FDO.  I have seen a raise on interest on
>> > > > the topic in several companies, but it would make very little sense if
>> > > > no kernel hacker is interested in participating... anybody?
>> > >
>> > > I know there's been a lot of work in this area, but none of it seems to
>> > > have trickled down to be easy enough for me to use it.
>> >
>> > We use an instrumented kernel to collect the data we need. It gives us
>> > the best payoff, because the profiling data is more fine-grained and
>> > accurate. (PGO does much more than make inlining decisions.)
>> >
>> > If I recall correctly, you previously suggested using sampling data.
>> > (Correct?) Is there a document or article that outlines that process?
>>
>> IIRC Google has LBR sample driven PGO somewhere as well. ISTR that being
>> the whole motivation for that gruesome Zen3 BRS hack.
>>
>> Google got me this: https://research.google.com/pubs/archive/45290.pdf
>>

I very support that the mainline kernel adds instrumentation based PGO
but I vaguely recall that it was NAKed by Linus (because he thought
sample based is better).

>Right. However, there's a chicken-and-egg issue with AutoFDO for the
>production kernel. We can't release a kernel that hasn't been compiled
>with PGO/FDO. We could only release it in a test environment, in which
>case we could use AutoFDO. However, the document says that AutoFDO
>only reaches ~90% of FDO. They list some reasons for this, but
>nonetheless I suspect that the delta would be too severe for us to
>release the kernel.
>
>As for LBR, that will work with Intel/AMD, but I thought that LBR
>doesn't exist for Arm processors (my knowledge could be out of date on
>this).

Some folks try using Embedded Trace Macrocells.
I am not at all familiar with it but it seems that retrieving profiles
is not easy. The needed efforts seem even higher than using
instrumentation based PGO.

Instrumentation based PGO has the nice property that it works with all
architectures (the compiler supports) and does not rely on hardware
support. In addition, it collects indirect call targets and string
operation sizes which are very difficult/impossible for sample based
PGO.

>What would make PGO (sample-based or instrumented) easy enough for you
>to use? What're the key elements missing?
>
>-bw
>

  reply	other threads:[~2022-07-01 19:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-15 17:54 plumbers session on profiling? Nick Desaulniers
2022-04-15 20:41 ` Nick Desaulniers
2022-05-24 10:24   ` Jose E. Marchesi
2022-05-24 11:46     ` Ruud van der Pas
2022-06-21 22:02       ` Nick Desaulniers
2022-06-23 21:21         ` Ruud van der Pas
2022-06-28 17:08           ` Jose E. Marchesi
2022-06-29 19:48             ` Bill Wendling
2022-07-01  9:01             ` Peter Zijlstra
2022-07-01 10:17               ` Bill Wendling
2022-07-01 11:49                 ` Peter Zijlstra
2022-07-01 13:50                   ` Paul E. McKenney
     [not found]                     ` <MW3PR15MB3868B1DC443B538A2A27F1D3CFBD9@MW3PR15MB3868.namprd15.prod.outlook.com>
2022-07-01 16:28                       ` Paul E. McKenney
2022-07-01 18:57                   ` Bill Wendling
2022-07-01 19:34                     ` Fangrui Song [this message]
2022-07-04 14:03                       ` Peter Zijlstra
2022-07-04 14:01                     ` Peter Zijlstra
2022-07-05 12:57                       ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220701193409.p4ejod7olx7ngl5m@google.com \
    --to=maskray@google.com \
    --cc=elena.zannoni@oracle.com \
    --cc=hoy@fb.com \
    --cc=jemarch@gnu.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-toolchains@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mingo@kernel.org \
    --cc=morbo@google.com \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    --cc=ruud.vanderpas@oracle.com \
    --cc=samitolvanen@google.com \
    --cc=vladimir.mezentsev@oracle.com \
    --cc=wenlei@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox