|
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 | |
| 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 28 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 185 of file MLInlineAdvisor.cpp.
References llvm::TensorSpec::createSpec(), llvm::DefaultDecisionSpec, F, FeatureMap, GetDefaultAdvice, getFeatureMap(), getInitialFeatureMap(), getInlinableCS(), getLocalCalls(), I, llvm::InlineAdvisor::InlineAdvisor(), instructions, InteractiveIncludeDefault, llvm::InlineAdvisor::M, MAM, ModelRunner, llvm::scc_begin(), and StopImmediatelyForTest.
|
overridedefault |
References onPassEntry(), and onPassExit().
|
protectedvirtual |
Definition at line 556 of file MLInlineAdvisor.cpp.
References ModelRunner.
Referenced by getAdviceImpl().
|
overrideprotectedvirtual |
Implements llvm::InlineAdvisor.
Definition at line 422 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, IfCallerIsNotCold, llvm::inlineCostFeatureToMlFeature(), InteractiveChannelBaseName, InteractiveIncludeDefault, llvm::isa(), ModelRunner, llvm::InlineAdvisor::Never, llvm::NumberOfFeatures, SkipPolicy, and llvm::transform().
| FunctionPropertiesInfo & MLInlineAdvisor::getCachedFPI | ( | Function & | F | ) | const |
Definition at line 414 of file MLInlineAdvisor.cpp.
References F, and llvm::InlineAdvisor::FAM.
Referenced by getAdviceImpl(), getIRSize(), getLocalCalls(), and onSuccessfulInlining().
|
inline |
Definition at line 51 of file MLInlineAdvisor.h.
References FeatureMap.
Referenced by getAdviceImpl(), and MLInlineAdvisor().
|
static |
Definition at line 152 of file MLInlineAdvisor.cpp.
References FeatureMap, INLINE_COST_FEATURE_ITERATOR, INLINE_FEATURE_ITERATOR, and POPULATE_NAMES.
Referenced by MLInlineAdvisor().
|
inline |
Definition at line 41 of file MLInlineAdvisor.h.
References F, and getCachedFPI().
Referenced by onSuccessfulInlining().
| int64_t MLInlineAdvisor::getLocalCalls | ( | Function & | F | ) |
Definition at line 343 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 570 of file MLInlineAdvisor.cpp.
References llvm::InlineAdvisor::getCallerORE(), and getMandatoryAdviceImpl().
Referenced by getAdviceImpl().
|
protectedvirtual |
Definition at line 586 of file MLInlineAdvisor.cpp.
References llvm::InlineAdvisor::getCallerORE().
Referenced by getMandatoryAdvice().
|
inline |
Definition at line 49 of file MLInlineAdvisor.h.
References ModelRunner.
|
inline |
Definition at line 47 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 265 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 315 of file MLInlineAdvisor.cpp.
References assert(), getLocalCalls(), I, KeepFPICache, and N.
Referenced by ~MLInlineAdvisor().
| void MLInlineAdvisor::onSuccessfulInlining | ( | const MLInlineAdvice & | Advice, |
| bool | CalleeWasDeleted ) |
Definition at line 352 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(), SizeIncreaseThreshold, and llvm::MLInlineAdvice::updateCachedCallerFPI().
|
protected |
Definition at line 72 of file MLInlineAdvisor.h.
Referenced by getFeatureMap(), getInitialFeatureMap(), and MLInlineAdvisor().
Definition at line 71 of file MLInlineAdvisor.h.
Referenced by getAdviceImpl(), and MLInlineAdvisor().
|
protected |
Definition at line 70 of file MLInlineAdvisor.h.
Referenced by getAdviceFromModel(), getAdviceImpl(), getModelRunner(), and MLInlineAdvisor().