This is an archive of the discontinued LLVM Phabricator instance.

[ModuleInliner] Add MLPriority
ClosedPublic

Authored by kazu on Dec 1 2022, 1:20 PM.

Details

Summary

This patch adds MLPriority as the first step toward the ML-based
function inlining with the module inliner.

For now, MLPriority is completely identical to CostPriority.

Once this patch lands, I'm planning to:

  • integrate NoInferenceModelRunner,
  • memoize the priority computation so that the priority remains the same for given values of metrics even with the noise injected during training, and
  • port/take more features into account.

Diff Detail

Event Timeline

kazu created this revision.Dec 1 2022, 1:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 1 2022, 1:20 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
kazu requested review of this revision.Dec 1 2022, 1:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 1 2022, 1:20 PM
kazu added a reviewer: mtrofin.Dec 1 2022, 1:20 PM

can you also add a test? thanks!

llvm/lib/Analysis/InlineOrder.cpp
197

can you initialize it here - lowers the risk of undefined values later (like if somehow the ctor forgets to initialize it)

kazu added a comment.Dec 1 2022, 4:04 PM

can you also add a test? thanks!

Will do.

llvm/lib/Analysis/InlineOrder.cpp
197

Would int Cost = INT_MAX; be OK here? The actual initialization is a bit complicated.

mtrofin added inline comments.Dec 1 2022, 4:27 PM
llvm/lib/Analysis/InlineOrder.cpp
197

sgtm

kazu updated this revision to Diff 479740.Dec 2 2022, 1:44 PM

Add a test. Also, initialize Cost.

kazu added a comment.Dec 2 2022, 1:45 PM

PTAL. Thanks!

mtrofin accepted this revision.Dec 2 2022, 2:16 PM
This revision is now accepted and ready to land.Dec 2 2022, 2:16 PM
This revision was landed with ongoing or failed builds.Dec 2 2022, 2:25 PM
This revision was automatically updated to reflect the committed changes.