Re: [PATCH] kbuild: AutoFDO: Disable Profi (-fno-sample-profile-use-profi)
From: Snehasish Kumar
Date: Fri Nov 06 2026 - 12:53:14 EST
On Fri, Nov 6, 2026 at 9:43 AM Rong Xu <xur@xxxxxxxxxx> wrote:
>
> Just one thing: I think we should also have this flag for Rust so Rust
> and c are consistent.
>
> Rong
>
> On Fri, Nov 6, 2026 at 9:38 AM Rong Xu <xur@xxxxxxxxxx> wrote:
> >
> > This looks good to me. Thanks!
> >
> > Reviewed-by: Rong Xu <xur@xxxxxxxxxx>
> >
> > -Rong
> >
> > On Thu, Nov 5, 2026 at 3:12 PM Douglas Anderson <dianders@xxxxxxxxxxxx> wrote:
> > >
> > > Starting in Clang 21 (LLVM commit 2fc4a4a9d3a8 ("[Driver][SamplePGO]
> > > Enable -fsample-profile-use-profi (#146795)") [1]), the Clang driver
> > > automatically passes -mllvm -sample-profile-use-profi whenever
> > > -fprofile-sample-use is specified, enabling LLVM's flow-based profile
> > > inference algorithm (Profi) by default.
> > >
> > > However, as Rong Xu noted [2], the kernel's AutoFDO implementation uses
> > > flow-sensitive discriminators (FS-AFDO), and Profi has known issues with
> > > FS-AFDO that degrade runtime performance compared to LLVM's original
> > > profile propagation algorithm. In addition, Profi's min-cost max-flow
> > > solver (applyFlowInference) can hit pathological compile times (30+
> > > minutes or hangs) on certain kernel control-flow graphs when profiles
> > > drift slightly or when combined with GCOV [3].
LGTM. I've seen degradations without FSAFDO too, reproducible on SPEC
workloads 531.deepsjeng and 502.gcc while controlling for profile
drift with newer versions of clang.
Reviewed-by: Snehasish Kumar <snehasishk@xxxxxxxxxx>