[PATCH] D79042: [llvm] Add interface to drive inlining decision using ML model

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 09:35:54 PDT 2020


davidxl added inline comments.


================
Comment at: llvm/lib/Passes/PassBuilder.cpp:220
+static cl::opt<MLMode> EnableMLInliner(
+    "enable-ml-inliner", cl::init(MLMode::Invalid), cl::Hidden,
+    cl::desc("Enable ML policy for inliner. Currently trained for -Oz only"),
----------------
mtrofin wrote:
> davidxl wrote:
> > Invalid mode --> Null mode?
> How about 'NoML' or 'None'?
NoML or None or just No sound fine.


================
Comment at: llvm/lib/Transforms/IPO/Inliner.cpp:1082
 
-      Optional<InlineCost> OIC = shouldInline(*CS, GetInlineCost, ORE);
-      // Check whether we want to inline this callsite.
-      if (!OIC.hasValue()) {
-        setInlineRemark(*CS, "deferred");
+      auto TrivialDecision = llvm::getAttributeBasedInliningDecision(
+          *CS, CS->getCalledFunction(), FAM.getResult<TargetIRAnalysis>(Callee),
----------------
This should be better computed under 

if (Advisor) {

     TrivialDecision = ...
     if (noinline)
        continue;
      Mandatory = ...
   }


================
Comment at: llvm/test/Transforms/Inline/inlining-advisor-default.ll:9
+
+; CHECK: Could not setup Inlining Advisor for the requested mode and/or options
----------------
I wonder if it is useful to have a mock mode for testing purpose where the ML code is barebone but not fully statically compiled out.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79042/new/

https://reviews.llvm.org/D79042





More information about the llvm-commits mailing list