|
LLVM 24.0.0git
|
#include "llvm/Analysis/MLInlineAdvisor.h"
Public Member Functions | |
| MLInlineAdvisor (Module &M, ModuleAnalysisManager &MAM, std::function< std::unique_ptr< MLModelRunner >(const std::vector< TensorSpec > &)> GetModelRunner, std::function< bool(CallBase &)> GetDefaultAdvice) | |
| ~MLInlineAdvisor () override=default | |
| void | onPassEntry (LazyCallGraph::SCC *SCC) override |
| This must be called when the Inliner pass is entered, to allow the InlineAdvisor update internal state, as result of function passes run between Inliner pass runs (for the same module). | |
| void | onPassExit (LazyCallGraph::SCC *SCC) override |
| This must be called when the Inliner pass is exited, as function passes may be run subsequently. | |
| int64_t | getIRSize (Function &F) const |
| void | onSuccessfulInlining (const MLInlineAdvice &Advice, bool CalleeWasDeleted) |
| bool | isForcedToStop () const |
| int64_t | getLocalCalls (Function &F) |
| const MLModelRunner & | getModelRunner () const |
| FunctionPropertiesInfo & | getCachedFPI (Function &) const |
| const std::vector< TensorSpec > & | getFeatureMap () const |
| Public Member Functions inherited from llvm::InlineAdvisor | |
| InlineAdvisor (InlineAdvisor &&)=delete | |
| virtual | ~InlineAdvisor () |
| std::unique_ptr< InlineAdvice > | getAdvice (CallBase &CB, bool MandatoryOnly=false) |
| Get an InlineAdvice containing a recommendation on whether to inline or not. | |
| const char * | getAnnotatedInlinePassName () const |
| NOTE pass name is annotated only when inline advisor constructor provides InlineContext. | |
Static Public Member Functions | |
| static const std::vector< TensorSpec > & | getInitialFeatureMap () |
Protected Member Functions | |
| std::unique_ptr< InlineAdvice > | getAdviceImpl (CallBase &CB) override |
| std::unique_ptr< InlineAdvice > | getMandatoryAdvice (CallBase &CB, bool Advice) override |
| virtual std::unique_ptr< MLInlineAdvice > | getMandatoryAdviceImpl (CallBase &CB) |
| virtual std::unique_ptr< MLInlineAdvice > | getAdviceFromModel (CallBase &CB, OptimizationRemarkEmitter &ORE) |
| unsigned | getInitialFunctionLevel (const Function &F) const |
| Protected Member Functions inherited from llvm::InlineAdvisor | |
| InlineAdvisor (Module &M, FunctionAnalysisManager &FAM, std::optional< InlineContext > IC=std::nullopt) | |
| OptimizationRemarkEmitter & | getCallerORE (CallBase &CB) |
Protected Attributes | |
| const AnalysisOptions & | Opts |
| std::unique_ptr< MLModelRunner > | ModelRunner |
| std::function< bool(CallBase &)> | GetDefaultAdvice |
| std::vector< TensorSpec > | FeatureMap |
| Protected Attributes inherited from llvm::InlineAdvisor | |
| Module & | M |
| FunctionAnalysisManager & | FAM |
| const std::optional< InlineContext > | IC |
| const std::string | AnnotatedInlinePassName |
| std::unique_ptr< ImportedFunctionsInliningStatistics > | ImportedFunctionsStats |
Additional Inherited Members | |
| Protected Types inherited from llvm::InlineAdvisor | |
| enum class | MandatoryInliningKind { NotMandatory , Always , Never } |
| Static Protected Member Functions inherited from llvm::InlineAdvisor | |
| static MandatoryInliningKind | getMandatoryKind (CallBase &CB, FunctionAnalysisManager &FAM, OptimizationRemarkEmitter &ORE) |
Definition at line 29 of file MLInlineAdvisor.h.
| MLInlineAdvisor::MLInlineAdvisor | ( | Module & | M, |
| ModuleAnalysisManager & | MAM, | ||
| std::function< std::unique_ptr< MLModelRunner >(const std::vector< TensorSpec > &)> | GetModelRunner, | ||
| std::function< bool(CallBase &)> | GetDefaultAdvice ) |
Definition at line 137 of file MLInlineAdvisor.cpp.
References llvm::TensorSpec::createSpec(), llvm::DefaultDecisionSpec, F, FeatureMap, llvm::getAnalysisOptions(), GetDefaultAdvice, getFeatureMap(), getInitialFeatureMap(), getInlinableCS(), getLocalCalls(), I, llvm::InlineAdvisor::InlineAdvisor(), instructions, llvm::InlineAdvisor::M, MAM, ModelRunner, Opts, and llvm::scc_begin().
|
overridedefault |
References onPassEntry(), and onPassExit().
|
protectedvirtual |
Definition at line 510 of file MLInlineAdvisor.cpp.
References ModelRunner.
Referenced by getAdviceImpl().
|
overrideprotectedvirtual |
Implements llvm::InlineAdvisor.
Definition at line 375 of file MLInlineAdvisor.cpp.
References llvm::InlineAdvisor::Always, llvm::CallBase::arg_begin(), llvm::CallBase::arg_end(), llvm::callee_embedding, llvm::caller_embedding, DEBUG_TYPE, F, llvm::InlineAdvisor::FAM, getAdviceFromModel(), getCachedFPI(), llvm::CallBase::getCalledFunction(), llvm::CallBase::getCaller(), GetDefaultAdvice, getFeatureMap(), getInitialFunctionLevel(), llvm::getInliningCostEstimate(), llvm::getInliningCostFeatures(), getMandatoryAdvice(), llvm::InlineAdvisor::getMandatoryKind(), I, llvm::IfCallerIsNotCold, llvm::inlineCostFeatureToMlFeature(), llvm::isa(), ModelRunner, llvm::InlineAdvisor::Never, llvm::NumberOfFeatures, Opts, and llvm::transform().
| FunctionPropertiesInfo & MLInlineAdvisor::getCachedFPI | ( | Function & | F | ) | const |
Definition at line 367 of file MLInlineAdvisor.cpp.
References F, and llvm::InlineAdvisor::FAM.
Referenced by getAdviceImpl(), getIRSize(), getLocalCalls(), and onSuccessfulInlining().
|
inline |
Definition at line 52 of file MLInlineAdvisor.h.
References FeatureMap.
Referenced by getAdviceImpl(), and MLInlineAdvisor().
|
static |
Definition at line 104 of file MLInlineAdvisor.cpp.
References FeatureMap, INLINE_COST_FEATURE_ITERATOR, INLINE_FEATURE_ITERATOR, and POPULATE_NAMES.
Referenced by MLInlineAdvisor().
|
inline |
Definition at line 42 of file MLInlineAdvisor.h.
References F, and getCachedFPI().
Referenced by onSuccessfulInlining().
| int64_t MLInlineAdvisor::getLocalCalls | ( | Function & | F | ) |
Definition at line 296 of file MLInlineAdvisor.cpp.
References llvm::FunctionPropertiesInfo::DirectCallsToDefinedFunctions, F, and getCachedFPI().
Referenced by MLInlineAdvisor(), onPassEntry(), and onPassExit().
|
overrideprotectedvirtual |
Reimplemented from llvm::InlineAdvisor.
Definition at line 524 of file MLInlineAdvisor.cpp.
References llvm::InlineAdvisor::getCallerORE(), and getMandatoryAdviceImpl().
Referenced by getAdviceImpl().
|
protectedvirtual |
Definition at line 540 of file MLInlineAdvisor.cpp.
References llvm::InlineAdvisor::getCallerORE().
Referenced by getMandatoryAdvice().
|
inline |
Definition at line 50 of file MLInlineAdvisor.h.
References ModelRunner.
|
inline |
Definition at line 48 of file MLInlineAdvisor.h.
|
overridevirtual |
This must be called when the Inliner pass is entered, to allow the InlineAdvisor update internal state, as result of function passes run between Inliner pass runs (for the same module).
Reimplemented from llvm::InlineAdvisor.
Definition at line 218 of file MLInlineAdvisor.cpp.
References assert(), getLocalCalls(), I, and N.
Referenced by ~MLInlineAdvisor().
|
overridevirtual |
This must be called when the Inliner pass is exited, as function passes may be run subsequently.
This allows an implementation of InlineAdvisor to prepare for a partial update, based on the optional SCC.
Reimplemented from llvm::InlineAdvisor.
Definition at line 268 of file MLInlineAdvisor.cpp.
References assert(), getLocalCalls(), I, N, and Opts.
Referenced by ~MLInlineAdvisor().
| void MLInlineAdvisor::onSuccessfulInlining | ( | const MLInlineAdvice & | Advice, |
| bool | CalleeWasDeleted ) |
Definition at line 305 of file MLInlineAdvisor.cpp.
References llvm::PreservedAnalyses::abandon(), llvm::PreservedAnalyses::all(), assert(), llvm::MLInlineAdvice::CalleeIRSize, llvm::MLInlineAdvice::CallerAndCalleeEdges, llvm::MLInlineAdvice::CallerIRSize, llvm::FunctionPropertiesInfo::DirectCallsToDefinedFunctions, llvm::InlineAdvisor::FAM, getCachedFPI(), llvm::MLInlineAdvice::getCallee(), llvm::MLInlineAdvice::getCaller(), getIRSize(), Opts, and llvm::MLInlineAdvice::updateCachedCallerFPI().
|
protected |
Definition at line 74 of file MLInlineAdvisor.h.
Referenced by getFeatureMap(), getInitialFeatureMap(), and MLInlineAdvisor().
Definition at line 73 of file MLInlineAdvisor.h.
Referenced by getAdviceImpl(), and MLInlineAdvisor().
|
protected |
Definition at line 72 of file MLInlineAdvisor.h.
Referenced by getAdviceFromModel(), getAdviceImpl(), getModelRunner(), and MLInlineAdvisor().
|
protected |
Definition at line 71 of file MLInlineAdvisor.h.
Referenced by getAdviceImpl(), MLInlineAdvisor(), onPassExit(), and onSuccessfulInlining().