This is an archive of the discontinued LLVM Phabricator instance.

[FuncSpec] Extract the analysis part as an analysis pass
AbandonedPublic

Authored by ChuanqiXu on Jul 6 2021, 8:11 PM.

Details

Summary

I want the ThinLTO to support Function Specialization Pass.
Now the ThinLTO importer would only import functions by inline heuristics.
And if we want to make ThinLTO importer knows the information used by function specialization, we need to extract the analysis part as an analysis pass to make other pass get the information without transforming the IR.

There are much works to do since the function specialization pass itself is not strong enough first. The first step should be harmless.

This patch intended to be a NFC patch so here is nothing to factor the cost model. We could do that in following patches.

Test Plan: check-llvm

Diff Detail

Event Timeline

ChuanqiXu created this revision.Jul 6 2021, 8:11 PM
ChuanqiXu requested review of this revision.Jul 6 2021, 8:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 6 2021, 8:11 PM
ChuanqiXu updated this revision to Diff 356860.Jul 6 2021, 8:47 PM

Format codes.

I don't know much/anything about ThinLTO, which is why I don't really get what problem we need to solve:

And if we want to make ThinLTO importer knows the information used by function specialization, we need to extract the analysis part

But before we go down the path of making a lot of changes, I think it would be best if we are reasonably confident this is the right approach, which we can achieve by adding reviewers familiar with the ThinLTO challenges and by posting follow up patches using this work. Like I said, I don't know much about the ThinLTO pipeline, perhaps @fhahn can recommend someone.

SjoerdMeijer added a comment.EditedJul 7 2021, 12:59 AM

Ah, I remembered your post to the mailing list about this which provides more context:

https://lists.llvm.org/pipermail/llvm-dev/2021-May/150443.html

Looks like you're raising fundamental ThinLTO questions that need answering first. Perhaps ping that thread, perhaps update it with some more information, so that hopefully someone with ThinLTO knowledge can shed a light on this approach.

Ah, I remembered your post to the mailing list about this which provides more context:

https://lists.llvm.org/pipermail/llvm-dev/2021-May/150443.html

Looks like you're raising fundamental ThinLTO questions that need answering first. Perhaps ping that thread, perhaps update it with some more information, so that hopefully someone with ThinLTO knowledge can shed a light on this approach.

Yeah, I posted it before.

Then I made it in the downstream to see the impact I raised in the mailing list. And the impact looks good from my experiments. So I want to see if it is OK to contribute them to the upstream.

Since I want to make things happen in order, so I updated this patch first. Now it looks like I'd better to update the remained patch and discuss in the thread.

I would do that. Thanks for suggestion.

ChuanqiXu planned changes to this revision.Jul 13 2021, 2:41 AM
ChuanqiXu planned changes to this revision.Jul 27 2021, 8:28 PM

Waiting to get in consensus that we would import functions in ThinLTO for sepcialization.

ChuanqiXu abandoned this revision.Nov 15 2021, 7:37 PM