This is an archive of the discontinued LLVM Phabricator instance.

[SampleFDO] handle ProfileSampleAccurate when initializing function entry count
ClosedPublic

Authored by wmi on Dec 13 2018, 9:35 AM.

Details

Summary

ProfileSampleAccurate is used to indicate the profile has exact match to the code to be optimized.

Previously ProfileSampleAccurate is handled in ProfileSummaryInfo::isColdCallSite and ProfileSummaryInfo::isColdBlock. A better solution is to initialize function entry count to 0 when ProfileSampleAccurate is true, so we don't have to handle ProfileSampleAccurate in multiple places.

Thanks to Easwaran for the idea to the improvement.

Diff Detail

Repository
rL LLVM

Event Timeline

wmi created this revision.Dec 13 2018, 9:35 AM
tejohnson accepted this revision.Dec 13 2018, 9:44 AM

Nice! lgtm

test/Transforms/SampleProfile/section-accurate-samplepgo.ll
7

Nit: line length

This revision is now accepted and ready to land.Dec 13 2018, 9:44 AM

Could you add a test case or augment an existing test to check that the function entry count is 0 if -sample-profile and -profile-sample-accurate is specified?

lib/Transforms/IPO/SampleProfile.cpp
129

To be more precise, you are now marking all un-sampled functions as having entry count 0 (not just cold)

test/Transforms/SampleProfile/inline-cold-callsite-samplepgo.ll
8

Nit: You probably just need a single call void @extern() in the body to make this not inlineable when threshold is 0.

wmi marked 3 inline comments as done.Dec 13 2018, 11:14 AM

Could you add a test case or augment an existing test to check that the function entry count is 0 if -sample-profile and -profile-sample-accurate is specified?

I augmented test/Transforms/SampleProfile/section-accurate-samplepgo.ll to check that.

wmi updated this revision to Diff 178098.Dec 13 2018, 11:16 AM

Address Easwaran and Teresa's comments.

wmi updated this revision to Diff 178100.Dec 13 2018, 11:27 AM

Fix test/Transforms/SampleProfile/inline-cold-callsite-samplepgo.ll which was over simplified in the last revision.

eraman accepted this revision.Dec 13 2018, 1:12 PM

LGTM

This revision was automatically updated to reflect the committed changes.
test/Transforms/CodeGenPrepare/section-samplepgo.ll