aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorLei Wang <wlei@fb.com>2024-05-13 16:01:29 -0700
committerGitHub <noreply@github.com>2024-05-13 16:01:29 -0700
commit5b6f15110422f4955212bd26a96057972e3304ad (patch)
tree766c45696aa5e8cabb5244f00f2a1c8bd9e06403 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parentb342d18a8f0240342ea5c461145e78c6e3af92cc (diff)
downloadllvm-5b6f15110422f4955212bd26a96057972e3304ad.zip
llvm-5b6f15110422f4955212bd26a96057972e3304ad.tar.gz
llvm-5b6f15110422f4955212bd26a96057972e3304ad.tar.bz2
[SampleFDO] Improve stale profile matching by diff algorithm (#87375)
This change improves the matching algorithm by using the diff algorithm, the current matching algorithm only processes the callsites grouped by the same name functions, it doesn't consider the order relationships between different name functions, this sometimes fails to handle this ambiguous anchor case. For example. (`Foo:1` means a calliste[callee_name: callsite_location]) ``` IR : foo:1 bar:2 foo:4 bar:5 Profile : bar:3 foo:5 bar:6 ``` The `foo:1` is matched to the 2nd `foo:5` and using the diff algorithm(finding longest common subsequence ) can help on this issue. One well-known diff algorithm is the Myers diff algorithm(paper "An O(ND) Difference Algorithm and Its Variations∗" Eugene W. Myers), its variations have been implemented and used in many famous tools, like the GNU diff or git diff. It provides an efficient way to find the longest common subsequence or the shortest edit script through graph searching. There are several variations/refinements for the algorithm, but as in our case, the num of function callsites is usually very small, so we implemented the basic greedy version in this change which should be good enough. We observed better matchings and positive perf improvement on our internal services.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions