This is an archive of the discontinued LLVM Phabricator instance.

[SampleFDO] Add a cutoff flag to control how many symbols will be included into profile symbol list.
ClosedPublic

Authored by wmi on Feb 27 2021, 9:56 PM.

Details

Summary

When test is unrepresentative to production behavior, sample profile collected from production can cause unexpected performance behavior in test. To triage such issue, it is useful to have a cutoff flag to control how many symbols will be included into profile symbol list for binary search.

Diff Detail

Event Timeline

wmi created this revision.Feb 27 2021, 9:56 PM
wmi requested review of this revision.Feb 27 2021, 9:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 27 2021, 9:56 PM
tejohnson added inline comments.Feb 27 2021, 10:39 PM
llvm/lib/ProfileData/SampleProf.cpp
34

Nit: suggest making "cutoff" one word not hyphenated in option.

llvm/test/Transforms/SampleProfile/profile-sample-accurate.ll
66

Shouldn't it be the other way around - i.e. with the larger cutoff it will be included and with the smaller one it isn't?

Also - confused at how the cutoff correlates to the placement in profile-symbol-list.text. In that file, _Z3toov is symbol number 5. So wouldn't a cutoff of 4 vs 5 affect whether it is included?

davidxl added inline comments.Feb 27 2021, 10:50 PM
llvm/test/Transforms/SampleProfile/profile-sample-accurate.ll
66

I think it is sorted list.

When cutoff is 3, precise symbol list includes too, so too has profile of 0.

wmi added inline comments.Feb 27 2021, 11:01 PM
llvm/lib/ProfileData/SampleProf.cpp
34

Fixed.

llvm/test/Transforms/SampleProfile/profile-sample-accurate.ll
66

Nice catch. It should be the other way around. I fix it.

Yes, the order is confusing. David's explanation is right. It is sorted when the text profile symbol list is written into binary section. I change the order in the text to remove the confusion.

wmi updated this revision to Diff 326951.Feb 27 2021, 11:02 PM

Address Teresa's comment.

This revision is now accepted and ready to land.Feb 27 2021, 11:03 PM
This revision was landed with ongoing or failed builds.Feb 27 2021, 11:16 PM
This revision was automatically updated to reflect the committed changes.