This is an archive of the discontinued LLVM Phabricator instance.

[CSSPGO] Add attribute metadata for context profile
ClosedPublic

Authored by wenlei on Mar 17 2021, 3:35 PM.

Details

Summary

This changes adds attribute field for metadata of context profile. Currently we have an inline attribute that indicates whether the leaf frame corresponding to a context profile was inlined in previous build.

This will be used to help estimating inlining and be taken into account when trimming context. Changes for that in llvm-profgen will follow. It will also help tuning.

Note that we only populate inline attribute for pseudo-probe profile now.

Test Plan:

Diff Detail

Event Timeline

wenlei created this revision.Mar 17 2021, 3:35 PM
wenlei requested review of this revision.Mar 17 2021, 3:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2021, 3:35 PM
hoy added a comment.Mar 18 2021, 9:38 AM

Thanks for working on this. This gets us closer to a global inlining decision making for thinLTO.

llvm/lib/ProfileData/SampleProfReader.cpp
91–92

Please update comment here and also the format comment at the beginning of SampleProfReader.h .

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

Should caller profile be marked inlined? The callee was inlined into the caller, but the caller may not be inlined into caller's caller.

630

I'm wondering this should also be done for non-probe CS profile generation.

wenlei added inline comments.Mar 18 2021, 10:04 AM
llvm/lib/ProfileData/SampleProfReader.cpp
91–92

Updated.

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

Good catch, you're right.

630

Yeah, this is a TODO as mentioned in the change description. The change to support that for non-probe profile will actually be bigger since we put everything into flat context string out of unwinder, so wanted to do them separately. Now I left a TODO comment as well, but let me take another look..

wenlei updated this revision to Diff 331603.Mar 18 2021, 10:05 AM

Address Hongtao's comments.

wenlei added inline comments.Mar 18 2021, 10:20 AM
llvm/tools/llvm-profgen/ProfileGenerator.cpp
630

Turns out it can be done easily still, with the help of context key. Updated to support line CS profile too in this change.

wenlei updated this revision to Diff 331611.Mar 18 2021, 10:21 AM

Populate attribute for line-based profile too.

hoy accepted this revision.Mar 18 2021, 10:33 AM
hoy added inline comments.
llvm/tools/llvm-profgen/ProfileGenerator.cpp
630

Thanks for adding the support. Might also need to change existing regression tests if they are failed.

Nit: change the description to remove that TODO. Otherwise LGTM.

This revision is now accepted and ready to land.Mar 18 2021, 10:33 AM
wenlei added inline comments.Mar 18 2021, 10:00 PM
llvm/tools/llvm-profgen/ProfileGenerator.cpp
630

Tests are all passing, the commit message is updated, but not sure why it wasn't sync to Phabricator.

This revision was landed with ongoing or failed builds.Mar 18 2021, 10:01 PM
This revision was automatically updated to reflect the committed changes.