[LLVMbugs] [Bug 22719] New: Improvements in raw branch profile data representation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 26 15:47:00 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22719

            Bug ID: 22719
           Summary: Improvements in raw branch profile data representation
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Global Analyses
          Assignee: dnovillo at google.com
          Reporter: dnovillo at google.com
                CC: davidxl at google.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Raw branch profile data from instrumentation or sample based profiler is
represented using MD_prof meta data attached to branch/switch instructions.

The raw profile data serves two purposes:
1) to represent branch probabilities
2) to represent the raw branch execution count (named weight).

However the current profile annotation in clang has some limitations that lead
to information loss due to weight scaling:

(in tools/clang/lib/CodeGen/CodeGenPGO.cpp)

- scaleBranchWeight: when computing branch weight, the profile count is capped
to UINT32_MAX. For applications with long training runs (especially for cases
with hot loops executed by many threads), the capping can occur often.  Due to
the capping, currently the branch weight can not be used to preserve edge
execution count information. When the actual weight is larger but close to
UINT32_MAX, the scale factor will be two. As a result, the scaled weight will
only be half of the actual weight.

- When there is no scaling (scaling factor == 1), the computed weight will be
the actual weight + 1 (see calculateWeightScale).  This leads to distortion to
branch probability. Also for a loop that executes only once, the exit edge will
have a calculated weight of 2. This leads to wrong estimated trip count which
is only half of the actual value.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150226/1940d260/attachment.html>


More information about the llvm-bugs mailing list