Hi,
This patch fixes AutoFDO breakage on trunk.  The main reason for breakage is 
AutoFDO
relies on standalone edge count computing and propagating profile 
count/probability info
on CFG, but in new infra, edge count is actually computed from probability, 
which leads
to chicken-egg problem and corrupted profile count.  This patch fixes the issue 
by using
explicit edge count.

There is another issue not touched yet that, in quite common case, profiled 
samples are
not enough and profile info computed for lots of blocks is ZERO.  In the 
future, we may
add some heuristics checking quality of sampled counts and reverting to guessed 
profile
count if necessary.  I think change made in this patch is also needed for that.

Package mysql server is used in test of this patch set.  It can't be compiled 
with autofdo
on trunk, even with compilation issues worked-around, there isn't performance 
improvement.
I local experiments, with this patch set it's improved by 12.3%, 4.3% 
irrespectively for
read-only/write-heavy benchmarks.  Unfortunately,  this patch set was written 
against
GCC 8 branch a while ago, improvement gets worse on trunk and I haven't 
investigated
the reason yet.  I guess there are still other issues which need to be fixed in 
the future.

Bootstrap and test on x86_64 in patch set.  Is it OK?

Thanks,
bin
2018-10-31  Bin Cheng  <bin.ch...@linux.alibaba.com>

        * auto-profile.c (AFDO_EINFO): New macro.
        (struct edge_info): New structure.
        (is_edge_annotated, set_edge_annotated): Delete.
        (afdo_propagate_edge, afdo_propagate_circuit, afdo_propagate): Remove
        parameter.  Adjust edge count computation and annotation using struct
        edge_info.
        (afdo_calculate_branch_prob): Ditto.
        (afdo_annotate_cfg): Simplify code setting basic block profile count.

Attachment: 0004-Fix-AutoFDO-breakage-after-profile-count-rewriting.patch
Description: Binary data

Reply via email to