2022-04-16 01:52:05

by Nick Desaulniers

[permalink] [raw]
Subject: plumbers session on profiling?

Hi Sami, Bill, Jose, and Vladamir,
Jose and I are currently in the planning process to put together a
Kernel+Toolchain microconference track at Linux Plumbers Conference
this year (Sept 12-14) in Dublin, Ireland.

Would you all be interested in leading a session discussing various
profiling related topics such as:
* gprofng
* PGO
* AutoFDO

Would others find such a discussion useful?
--
Thanks,
~Nick Desaulniers


2022-04-16 02:41:05

by Nick Desaulniers

[permalink] [raw]
Subject: Re: plumbers session on profiling?

(Re-sending with Vladamir's email addr fixed; sorry for the noise)

On Fri, Apr 15, 2022 at 10:54 AM Nick Desaulniers
<[email protected]> wrote:
>
> Hi Sami, Bill, Jose, and Vladamir,
> Jose and I are currently in the planning process to put together a
> Kernel+Toolchain microconference track at Linux Plumbers Conference
> this year (Sept 12-14) in Dublin, Ireland.
>
> Would you all be interested in leading a session discussing various
> profiling related topics such as:
> * gprofng
> * PGO
> * AutoFDO
>
> Would others find such a discussion useful?
> --
> Thanks,
> ~Nick Desaulniers



--
Thanks,
~Nick Desaulniers

2022-05-25 09:08:37

by Jose E. Marchesi

[permalink] [raw]
Subject: Re: plumbers session on profiling?


I am adding Ruud van der Pas in CC. He works in gprofng and would be
willing to participate in a discussion on kernel profiling.

> (Re-sending with Vladamir's email addr fixed; sorry for the noise)
>
> On Fri, Apr 15, 2022 at 10:54 AM Nick Desaulniers
> <[email protected]> wrote:
>>
>> Hi Sami, Bill, Jose, and Vladamir,
>> Jose and I are currently in the planning process to put together a
>> Kernel+Toolchain microconference track at Linux Plumbers Conference
>> this year (Sept 12-14) in Dublin, Ireland.
>>
>> Would you all be interested in leading a session discussing various
>> profiling related topics such as:
>> * gprofng
>> * PGO
>> * AutoFDO
>>
>> Would others find such a discussion useful?
>> --
>> Thanks,
>> ~Nick Desaulniers

2022-05-25 10:16:10

by Ruud van der Pas

[permalink] [raw]
Subject: Re: plumbers session on profiling?

Hi Jose,

Thanks. I indeed plan to attend LPC 2022 and am very interested
to participate in such a discussion.

Kind regards, Ruud

> On 24 May 2022, at 12:24, Jose E. Marchesi <[email protected]> wrote:
>
>
> I am adding Ruud van der Pas in CC. He works in gprofng and would be
> willing to participate in a discussion on kernel profiling.
>
>> (Re-sending with Vladamir's email addr fixed; sorry for the noise)
>>
>> On Fri, Apr 15, 2022 at 10:54 AM Nick Desaulniers
>> <[email protected]> wrote:
>>>
>>> Hi Sami, Bill, Jose, and Vladamir,
>>> Jose and I are currently in the planning process to put together a
>>> Kernel+Toolchain microconference track at Linux Plumbers Conference
>>> this year (Sept 12-14) in Dublin, Ireland.
>>>
>>> Would you all be interested in leading a session discussing various
>>> profiling related topics such as:
>>> * gprofng
>>> * PGO
>>> * AutoFDO
>>>
>>> Would others find such a discussion useful?
>>> --
>>> Thanks,
>>> ~Nick Desaulniers


2022-06-21 22:17:49

by Nick Desaulniers

[permalink] [raw]
Subject: Re: plumbers session on profiling?

On Tue, May 24, 2022 at 4:46 AM Ruud van der Pas
<[email protected]> wrote:
>
> Hi Jose,
>
> Thanks. I indeed plan to attend LPC 2022 and am very interested
> to participate in such a discussion.

Hi Ruud,
If you're still considering attending Linux Plumbers conf, please
submit a proposal:
https://lpc.events/event/16/abstracts/
Please make sure to select "Toolchains Track" as the "Track" after
clicking on "Submit new abstract."

>
> Kind regards, Ruud
>
> > On 24 May 2022, at 12:24, Jose E. Marchesi <[email protected]> wrote:
> >
> >
> > I am adding Ruud van der Pas in CC. He works in gprofng and would be
> > willing to participate in a discussion on kernel profiling.
> >
> >> (Re-sending with Vladamir's email addr fixed; sorry for the noise)
> >>
> >> On Fri, Apr 15, 2022 at 10:54 AM Nick Desaulniers
> >> <[email protected]> wrote:
> >>>
> >>> Hi Sami, Bill, Jose, and Vladamir,
> >>> Jose and I are currently in the planning process to put together a
> >>> Kernel+Toolchain microconference track at Linux Plumbers Conference
> >>> this year (Sept 12-14) in Dublin, Ireland.
> >>>
> >>> Would you all be interested in leading a session discussing various
> >>> profiling related topics such as:
> >>> * gprofng
> >>> * PGO
> >>> * AutoFDO
> >>>
> >>> Would others find such a discussion useful?
> >>> --
> >>> Thanks,
> >>> ~Nick Desaulniers
>


--
Thanks,
~Nick Desaulniers

2022-06-23 21:30:04

by Ruud van der Pas

[permalink] [raw]
Subject: Re: plumbers session on profiling?

Hi Nick,

Apologies for the delay. It's been a busy week with gprofng related work.

> If you're still considering attending Linux Plumbers conf, please
> submit a proposal:
> https://lpc.events/event/16/abstracts/
> Please make sure to select "Toolchains Track" as the "Track" after
> clicking on "Submit new abstract."

Thanks for asking!

Our presence largely depends on a discussion on kernel profiling and
to see what we might be able to do with gprofng regarding this.

From our side, the main person will be Vladimir. He knows the code
inside and out, but I will also try to attend such a session.

Is there any news regarding such a session on kernel profiling?

Kind regards, Ruud

>
>>
>> Kind regards, Ruud
>>
>>> On 24 May 2022, at 12:24, Jose E. Marchesi <[email protected]> wrote:
>>>
>>>
>>> I am adding Ruud van der Pas in CC. He works in gprofng and would be
>>> willing to participate in a discussion on kernel profiling.
>>>
>>>> (Re-sending with Vladamir's email addr fixed; sorry for the noise)
>>>>
>>>> On Fri, Apr 15, 2022 at 10:54 AM Nick Desaulniers
>>>> <[email protected]> wrote:
>>>>>
>>>>> Hi Sami, Bill, Jose, and Vladamir,
>>>>> Jose and I are currently in the planning process to put together a
>>>>> Kernel+Toolchain microconference track at Linux Plumbers Conference
>>>>> this year (Sept 12-14) in Dublin, Ireland.
>>>>>
>>>>> Would you all be interested in leading a session discussing various
>>>>> profiling related topics such as:
>>>>> * gprofng
>>>>> * PGO
>>>>> * AutoFDO
>>>>>
>>>>> Would others find such a discussion useful?
>>>>> --
>>>>> Thanks,
>>>>> ~Nick Desaulniers
>>
>
>
> --
> Thanks,
> ~Nick Desaulniers

2022-06-29 09:21:37

by Jose E. Marchesi

[permalink] [raw]
Subject: Re: plumbers session on profiling?


[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?

> Hi Nick,
>
> Apologies for the delay. It's been a busy week with gprofng related work.
>
>> If you're still considering attending Linux Plumbers conf, please
>> submit a proposal:
>> https://lpc.events/event/16/abstracts/
>> Please make sure to select "Toolchains Track" as the "Track" after
>> clicking on "Submit new abstract."
>
> Thanks for asking!
>
> Our presence largely depends on a discussion on kernel profiling and
> to see what we might be able to do with gprofng regarding this.
>
>>From our side, the main person will be Vladimir. He knows the code
> inside and out, but I will also try to attend such a session.
>
> Is there any news regarding such a session on kernel profiling?
>
> Kind regards, Ruud
>
>>
>>>
>>> Kind regards, Ruud
>>>
>>>> On 24 May 2022, at 12:24, Jose E. Marchesi <[email protected]> wrote:
>>>>
>>>>
>>>> I am adding Ruud van der Pas in CC. He works in gprofng and would be
>>>> willing to participate in a discussion on kernel profiling.
>>>>
>>>>> (Re-sending with Vladamir's email addr fixed; sorry for the noise)
>>>>>
>>>>> On Fri, Apr 15, 2022 at 10:54 AM Nick Desaulniers
>>>>> <[email protected]> wrote:
>>>>>>
>>>>>> Hi Sami, Bill, Jose, and Vladamir,
>>>>>> Jose and I are currently in the planning process to put together a
>>>>>> Kernel+Toolchain microconference track at Linux Plumbers Conference
>>>>>> this year (Sept 12-14) in Dublin, Ireland.
>>>>>>
>>>>>> Would you all be interested in leading a session discussing various
>>>>>> profiling related topics such as:
>>>>>> * gprofng
>>>>>> * PGO
>>>>>> * AutoFDO
>>>>>>
>>>>>> Would others find such a discussion useful?
>>>>>> --
>>>>>> Thanks,
>>>>>> ~Nick Desaulniers
>>>
>>
>>
>> --
>> Thanks,
>> ~Nick Desaulniers

2022-06-29 20:31:12

by Bill Wendling

[permalink] [raw]
Subject: Re: plumbers session on profiling?

I have experience in this area with our internal production kernel.

-bw

On Wed, Jun 29, 2022 at 2:00 AM Jose E. Marchesi <[email protected]> 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?
>
> > Hi Nick,
> >
> > Apologies for the delay. It's been a busy week with gprofng related work.
> >
> >> If you're still considering attending Linux Plumbers conf, please
> >> submit a proposal:
> >> https://lpc.events/event/16/abstracts/
> >> Please make sure to select "Toolchains Track" as the "Track" after
> >> clicking on "Submit new abstract."
> >
> > Thanks for asking!
> >
> > Our presence largely depends on a discussion on kernel profiling and
> > to see what we might be able to do with gprofng regarding this.
> >
> >>From our side, the main person will be Vladimir. He knows the code
> > inside and out, but I will also try to attend such a session.
> >
> > Is there any news regarding such a session on kernel profiling?
> >
> > Kind regards, Ruud
> >
> >>
> >>>
> >>> Kind regards, Ruud
> >>>
> >>>> On 24 May 2022, at 12:24, Jose E. Marchesi <[email protected]> wrote:
> >>>>
> >>>>
> >>>> I am adding Ruud van der Pas in CC. He works in gprofng and would be
> >>>> willing to participate in a discussion on kernel profiling.
> >>>>
> >>>>> (Re-sending with Vladamir's email addr fixed; sorry for the noise)
> >>>>>
> >>>>> On Fri, Apr 15, 2022 at 10:54 AM Nick Desaulniers
> >>>>> <[email protected]> wrote:
> >>>>>>
> >>>>>> Hi Sami, Bill, Jose, and Vladamir,
> >>>>>> Jose and I are currently in the planning process to put together a
> >>>>>> Kernel+Toolchain microconference track at Linux Plumbers Conference
> >>>>>> this year (Sept 12-14) in Dublin, Ireland.
> >>>>>>
> >>>>>> Would you all be interested in leading a session discussing various
> >>>>>> profiling related topics such as:
> >>>>>> * gprofng
> >>>>>> * PGO
> >>>>>> * AutoFDO
> >>>>>>
> >>>>>> Would others find such a discussion useful?
> >>>>>> --
> >>>>>> Thanks,
> >>>>>> ~Nick Desaulniers
> >>>
> >>
> >>
> >> --
> >> Thanks,
> >> ~Nick Desaulniers

2022-07-01 09:21:10

by Peter Zijlstra

[permalink] [raw]
Subject: Re: plumbers session on profiling?

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.

2022-07-01 10:32:38

by Bill Wendling

[permalink] [raw]
Subject: Re: plumbers session on profiling?

On Fri, Jul 1, 2022 at 2:02 AM Peter Zijlstra <[email protected]> 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?

-bw

2022-07-01 12:18:51

by Peter Zijlstra

[permalink] [raw]
Subject: Re: plumbers session on profiling?

On Fri, Jul 01, 2022 at 03:17:54AM -0700, Bill Wendling wrote:
> On Fri, Jul 1, 2022 at 2:02 AM Peter Zijlstra <[email protected]> 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


2022-07-01 14:14:50

by Paul E. McKenney

[permalink] [raw]
Subject: Re: plumbers session on profiling?

On Fri, Jul 01, 2022 at 01:49:06PM +0200, Peter Zijlstra 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 <[email protected]> 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

Whatever else, please refrain from using PGO and friends to drive
data-value speculation!

Thanx, Paul

2022-07-01 16:43:16

by Paul E. McKenney

[permalink] [raw]
Subject: Re: plumbers session on profiling?

On Fri, Jul 01, 2022 at 03:32:12PM +0000, Hongtao Yu wrote:
>
>
> ________________________________
> From: Paul E. McKenney <[email protected]>
> Sent: Friday, July 1, 2022 6:50 AM
> To: Peter Zijlstra <[email protected]>
> Cc: Bill Wendling <[email protected]>; Jose E. Marchesi <[email protected]>; Ruud van der Pas <[email protected]>; Nick Desaulniers <[email protected]>; Sami Tolvanen <[email protected]>; Vladimir Mezentsev <[email protected]>; clang-built-linux <[email protected]>; LKML <[email protected]>; Yonghong Song <[email protected]>; Wenlei He <[email protected]>; Hongtao Yu <[email protected]>; Ingo Molnar <[email protected]>; linux-toolchains <[email protected]>; [email protected] <[email protected]>
> Subject: Re: plumbers session on profiling?
>
> On Fri, Jul 01, 2022 at 01:49:06PM +0200, Peter Zijlstra 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 <[email protected]> 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
>
> > Whatever else, please refrain from using PGO and friends to drive
> data-value speculation!
>
> Is there a particular reason for this?

Yes, there is.

Doing so breaks many concurrent algorithms.

Sure, the hardware can get away with this sort of thing. But that is
only because it has access to cache and store-buffer state that allows it
to roll back and replay when needed. The compiler does not have access
to this state [1], so it needs to avoid playing this game.

Thanx, Paul

2022-07-01 19:23:49

by Bill Wendling

[permalink] [raw]
Subject: Re: plumbers session on profiling?

On Fri, Jul 1, 2022 at 4:49 AM Peter Zijlstra <[email protected]> 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 <[email protected]> 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
>
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).

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

-bw

2022-07-01 19:39:48

by Fangrui Song

[permalink] [raw]
Subject: Re: plumbers session on profiling?

On 2022-07-01, Bill Wendling wrote:
>On Fri, Jul 1, 2022 at 4:49 AM Peter Zijlstra <[email protected]> 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 <[email protected]> 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
>

2022-07-04 14:06:07

by Peter Zijlstra

[permalink] [raw]
Subject: Re: plumbers session on profiling?

On Fri, Jul 01, 2022 at 12:34:09PM -0700, Fangrui Song wrote:

> 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.

LBR samples should provide the indirect call targets just fine.

2022-07-04 14:44:44

by Peter Zijlstra

[permalink] [raw]
Subject: Re: plumbers session on profiling?

On Fri, Jul 01, 2022 at 11:57:25AM -0700, Bill Wendling wrote:
> On Fri, Jul 1, 2022 at 4:49 AM Peter Zijlstra <[email protected]> wrote:

> > 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
> >
> 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.

The pertinent question seems to be what's missing? Where does that 10%
go.

> 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).

Not totally up to date on the ARM thing either; but I believe you're
right in that they don't yet have such a feature.

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

The key piece missing is how to feed a perf.data file back into the
compile cycle, something like:

$ make O=build/ PERF=perf.data -j$lots

would be useful I suppose.

2022-07-05 14:27:49

by Peter Zijlstra

[permalink] [raw]
Subject: Re: plumbers session on profiling?

On Mon, Jul 04, 2022 at 04:01:15PM +0200, Peter Zijlstra wrote:
> On Fri, Jul 01, 2022 at 11:57:25AM -0700, Bill Wendling wrote:

> > 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).
>
> Not totally up to date on the ARM thing either; but I believe you're
> right in that they don't yet have such a feature.

Just found this in my inbox; I should've seen it before, but it must've
slipped my mind:

https://lkml.kernel.org/r/[email protected]

And of course, PowerPC also supports this.