[llvm-dev] [RFC] Propeller: A frame work for Post Link Optimizations
Eli Friedman via llvm-dev
llvm-dev at lists.llvm.org
Fri Sep 27 13:16:38 PDT 2019
> -----Original Message-----
> From: Sriraman Tallam <tmsriram at google.com>
> Sent: Friday, September 27, 2019 9:43 AM
> To: Eli Friedman <efriedma at quicinc.com>
> Cc: Xinliang David Li <xinliangli at gmail.com>; llvm-dev <llvm-dev at lists.llvm.org>
> Subject: [EXT] Re: [llvm-dev] [RFC] Propeller: A frame work for Post Link
> Optimizations
>
> >
> > > > Why are you proposing to add a bunch of options to clang to manipulate
> LLVM
> > > code generation, given none of those options are actually used for Propeller
> > > workflows?
> > >
> > > Where do you suggest labelling and section options should exist? We
> > > looked at basic block sections to be similar to function sections in
> > > terms of option handling?
> >
> > Generating bitcode with/without propeller doesn't actually affect the
> generated bitcode, right? So you could say that Propeller is enabled with "-Wl,--
> enable-propeller", and not change clang at all. I'm not a fan of adding options
> just because we can. If basic block sections are only used as a sort of secret
> handshake between the propeller compiler and the propeller linker, we can
> change that interface later, if we want; if we expose it as a clang option, we're
> committing to making basic block sections continue to work the same way until
> the end of time.
>
> The generated MIR code is slightly different as the later passes have
> more CFI instructions, basic block labels and extra direct jumps which
> would have been fall throughs otherwise. So, some llvm option is
> needed.
At link (LTO codegen) time, yes. But clang's bitcode generation doesn't change; only LTO code generation in lld changes.
> I envisioned that basic block sections could also be useful on its own
> outside of propeller. Hence, we made it like function-sections with
> a separate option -fbasicblock-sections. The propeller option is an
> umbrella option to make it easy to invoke Propeller.
I don't think this is really true. Basic block labels means "insert labels that are useful for propeller profiling", and basic block sections means "split the function into multiple chunks that are convenient for propeller optimization". So it's really only useful for propeller-like workflows. And I'd be concerned that future changes to propeller could affect the behavior of these options in the future, if the behavior isn't specified in some rigorous way.
In any case, if we're adding flags to clang other than "enable propeller", I think we should have a separate thread on cfe-dev to discuss them. We don't expose every possible LLVM optimization and code generation option through clang. Users have a strong expectation of stability for clang options, and that means we need to evaluate each new option carefully, to decide whether it's something we really want to support indefinitely.
-Eli
More information about the llvm-dev
mailing list