> > From: "Adam Nemet" < anemet@apple.com >
>
> > To: "Hal Finkel" < hfinkel@anl.gov >
>
> > Cc: "llvm-dev ( llvm-dev@lists.llvm.org )" <
> > llvm-dev@lists.llvm.org
> > >, "John McCall" < rjmccall@apple.com >
>
> > Sent: Wednesday, May 11, 2016 12:45:32 PM
>
> > Subject: Re: Filter optimization remarks by the hotness of the
> > code
> > region
>
> >
>
> >
>
> > > > From: "Adam Nemet" < anemet@apple.com >
> > >
> >
>
> > > > To: "Hal Finkel" < hfinkel@anl.gov >
> > >
> >
>
> > > > Cc: "llvm-dev ( llvm-dev@lists.llvm.org )" <
> > > > llvm-dev@lists.llvm.org
> > > > >
> > >
> >
>
> > > > Sent: Wednesday, May 11, 2016 1:15:42 AM
> > >
> >
>
> > > > Subject: Re: Filter optimization remarks by the hotness of
> > > > the
> > > > code
> > > > region
> > >
> >
>
> > > > Hi Hal,
> > >
> >
>
> > > >
> > >
> >
>
> > > > > Hi Adam,
> > > >
> > >
> >
>
> > > > > I think would be a really useful feature to have. I don't
> > > > > think
> > > >
> > >
> >
>
> > > > > that the backend should be responsible for filtering, but
> > > > > should
> > > >
> > >
> >
>
> > > > > pass the relative hotness information to the frontend.
> > > > > Given
> > > > > that
> > > >
> > >
> >
>
> > > > > these diagnostics are not just going to be used for -Rpass
> > > > > and
> > > >
> > >
> >
>
> > > > > friends, but also for generating reports by other tools
> > > > > (see
> > > > > the
> > > >
> > >
> >
>
> > > > > discussion around D19678, for example), I think it is
> > > > > important
> > > > > to
> > > >
> > >
> >
>
> > > > > allow the frontend to filter.
> > > >
> > >
> >
>
> > > > I am not sure I follow, can you please elaborate. Are you
> > > > saying
> > >
> >
>
> > > > that for example in the listing use case we don’t want the
> > > > filtered
> > >
> >
>
> > > > diagnostics? In other words it should be up to the remark
> > > > handler
> > >
> >
>
> > > > to decide whether it wants filtered or unfiltered remarks?
> > >
> >
>
> > > We might or might not want them. The user might want to select
> > > different ratios and filters.
> >
>
> > > > > The frontend, or other tool, might also want to collect
> > > > > information
> > > >
> > >
> >
>
> > > > > from different compilation jobs to provide the user with an
> > > >
> > >
> >
>
> > > > > overall ranking.
> > > >
> > >
> >
>
> > > > Strictly speaking about PGO, the different compilation jobs
> > > > get
> > > > the
> > >
> >
>
> > > > same PGO with the aggregated profile, thus the hotness
> > > > calculated
> > >
> >
>
> > > > should be global. I am not sure why an extra aggregation step
> > > > is
> > >
> >
>
> > > > necessary.
> > >
> >
>
> > > I agree. However, I think that the frontend might employ a
> > > combination of factors in deciding what information to present.
> > > We
> > > might, for example, have pick different hotness thresholds for
> > > different kinds of remarks.
> >
>
> > > Especially since we're likely going with a design for the
> > > optimization reports where the frontend just creates some YAML
> > > files
> > > with the diagnostic information, and then a separate tool
> > > processes
> > > the files to produce reports, I think that we should give those
> > > tools the maximum about of practical flexibility. Such a tool
> > > might
> > > provide the user with non-trivial filtering options.
> >
>
> > I think this all makes sense. So I guess the steps are:
>
> > 1. YAML support for the existing remarks
>
> > 2. Add optional relative hotness to the opt-remark API
>
> > 3. Exposed relative hotness in the YAML output
>
> > Are you working on 1 or should I get started?
>
> This is on my TODO list, but I've not started yet. Next few days
> seem
> unlikely too.
> One thing we should now thing about is where this YAML encoding
> happens. It could be in the backend, or it could be in the remark
> handler in the frontend. If they'll be no real programmatic
> interaction in the frontend with the remark content (other than
> serializing it into YAML), it might make sense to make the
> YAML-serialization capability a property of the remark itself
> handled by its implementation in the backend.
I was under the impression that your notion of source locations is
opaquely encoded and so something in the frontend would need to
interpret them. If that's not the case, then it doesn't matter much,
I think, as long as the format supports certain kinds of query. For
example, a tool should be able to start with a source location and
find the interesting remarks about it + surrounding code. As long as
the format allows that query to occur without needing pass-specific
knowledge of a remark's schema, it's probably not all that important
who outputs the data.
Right now, this works by forcing the frontend to at least produce line/column debug information, and the locations are derived from that.