This is an archive of the discontinued LLVM Phabricator instance.

[CSSPGO] Rename ProfileIsCSNested and ProfileIsCSFlat
ClosedPublic

Authored by hoy on Mar 28 2022, 11:11 AM.

Details

Summary

To be more clear and definitive, I'm renaming ProfileIsCSFlat back to ProfileIsCS which stands for full context-sensitive flat profiles. ProfileIsCSNested is now renamed to ProfileIsPreInlined and is extended to be applicable for CS flat profiles too. More specifically, ProfileIsPreInlined is for any kind of profiles (flat or nested) that contain 'ShouldBeInlined' contexts. The flag is encoded in the profile summary section for extbinary profiles and is computed on-the-fly for text profiles.

Diff Detail

Event Timeline

hoy created this revision.Mar 28 2022, 11:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 28 2022, 11:11 AM
hoy requested review of this revision.Mar 28 2022, 11:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 28 2022, 11:11 AM
hoy edited the summary of this revision. (Show Details)Mar 28 2022, 11:16 AM
hoy added reviewers: wenlei, wlei.
hoy updated this revision to Diff 425862.Apr 28 2022, 11:34 AM
hoy edited the summary of this revision. (Show Details)

Rebasing

hoy updated this revision to Diff 425876.Apr 28 2022, 12:02 PM

Updating D122602: [CSSPGO] Rename ProfileIsCSNested and ProfileIsCSFlat

wenlei added inline comments.Apr 28 2022, 4:26 PM
llvm/tools/llvm-profgen/CSPreInliner.cpp
200

I think we should set this in CSPreInliner::run()? In theory even if preinliner did nothing to the input profile, as long as we run it, the profile should be considered preinlined.

That also avoids setting it in the loop, for each function.

hoy added inline comments.Apr 28 2022, 4:55 PM
llvm/tools/llvm-profgen/CSPreInliner.cpp
200

Sounds good.

hoy updated this revision to Diff 425927.Apr 28 2022, 4:56 PM

Updating D122602: [CSSPGO] Rename ProfileIsCSNested and ProfileIsCSFlat

wenlei added inline comments.Apr 28 2022, 10:01 PM
llvm/tools/llvm-profgen/CSPreInliner.cpp
200

For the case I mentioned, how do we mark a profile as preinlined for text profile though, if no context actually has the preinline bit, but preinliner was run?

Admittedly this is a very corner case..

hoy added inline comments.Apr 28 2022, 10:55 PM
llvm/tools/llvm-profgen/CSPreInliner.cpp
200

We don't have a way to tell if a text profile is preinlined for that case. But on the other hand, such a text profile would not be considered as preinlined with the previous version. The "shouldInline" flag per context is the only way to tell if a text profile is preinlined or not.

The new iteration creates a discrepancy between text and extbin profile when there isn't any context with "shouldInline" flag. Such extbin profile will not lead to any inlining in the compiler, but the text counterpart would. I think the behavior of the extbin profile is what we want. Unfortunately that cannot be achieved with text profile.

wenlei accepted this revision.Apr 28 2022, 11:05 PM
wenlei added inline comments.
llvm/tools/llvm-profgen/CSPreInliner.cpp
200

Ok, perhaps we can live with that discrepancy, given it's a corner case and text profile isn't used much.

This revision is now accepted and ready to land.Apr 28 2022, 11:05 PM
This revision was landed with ongoing or failed builds.Apr 29 2022, 5:04 PM
This revision was automatically updated to reflect the committed changes.