This is an archive of the discontinued LLVM Phabricator instance.

[llvm-profgen] Fix total samples related issues
ClosedPublic

Authored by wlei on Dec 2 2021, 4:59 PM.

Details

Summary

Since total sample and body sample are used to compute hotness threshold in compiler, we found in some services changing the total samples computation will cause noticeable regression. Hence, here we will revert the changes and just keep all total samples number identical to the old tool.

Three changes in this diff:

  1. Revert previous diff(https://reviews.llvm.org/D112672: [llvm-profgen] Update total samples by accumulating all its body samples) and put it under a switch.
  1. Keep the negative line number. Although compiler doesn't consume the count but it will be used to compute hot threshold.
  1. Change to accumulate total samples per byte instead of per instruction.

Diff Detail

Event Timeline

wlei created this revision.Dec 2 2021, 4:59 PM
wlei requested review of this revision.Dec 2 2021, 4:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 2 2021, 4:59 PM
wlei edited the summary of this revision. (Show Details)Dec 2 2021, 5:15 PM
wlei added reviewers: hoy, wenlei.
hoy added inline comments.Dec 3 2021, 5:00 PM
llvm/tools/llvm-profgen/ProfileGenerator.cpp
494

This doesn't really makes sense. Wondering how much it matters, compared to other places that affect total samples.

wlei added inline comments.Dec 6 2021, 9:08 AM
llvm/tools/llvm-profgen/ProfileGenerator.cpp
494

This place caused 0.1% regression(I confirmed it's not noise) on unicorn, no regression on ads. With others together, they caused ~0.5% regression on unicorn.

hoy accepted this revision.Dec 6 2021, 10:20 AM

lgtm, thanks.

llvm/tools/llvm-profgen/ProfileGenerator.cpp
494

Thanks for the update. Looks like we need to keep this. Please add a comment for this.

This revision is now accepted and ready to land.Dec 6 2021, 10:20 AM
wlei updated this revision to Diff 392141.Dec 6 2021, 11:44 AM
wlei edited the summary of this revision. (Show Details)

add comments about changing counts perf byte

wenlei accepted this revision.Dec 7 2021, 11:15 PM

lgtm, thanks.

This revision was landed with ongoing or failed builds.Dec 8 2021, 12:34 PM
This revision was automatically updated to reflect the committed changes.
thakis added a comment.Dec 8 2021, 4:18 PM

Thanks for the fix :)