LLVM  15.0.0git
Classes | Namespaces | Macros | Typedefs | Functions | Variables
MLRegallocEvictAdvisor.cpp File Reference
#include "AllocationOrder.h"
#include "RegAllocEvictionAdvisor.h"
#include "RegAllocGreedy.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/MLModelRunner.h"
#include "llvm/Analysis/TensorSpec.h"
#include "llvm/Analysis/ReleaseModeModelRunner.h"
#include "llvm/CodeGen/CalcSpillWeights.h"
#include "llvm/CodeGen/LiveRegMatrix.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/RegisterClassInfo.h"
#include "llvm/CodeGen/VirtRegMap.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/PassRegistry.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include <array>
#include <memory>
Include dependency graph for MLRegallocEvictAdvisor.cpp:

Go to the source code of this file.

Classes

class  llvm::RegAllocScoring
 

Namespaces

 llvm
 This is an optimization pass for GlobalISel generic memory operations.
 

Macros

#define DEBUG_TYPE   "ml-regalloc"
 
#define RA_EVICT_FEATURES_LIST(M)
 
#define DecisionName   "index_to_evict"
 
#define _FEATURE_IDX(_, name, __, ___)   name,
 
#define _RESET(TYPE, NAME, SHAPE, __)
 
#define _DECL_FEATURES(type, name, shape, _)   TensorSpec::createSpec<type>(#name, shape),
 
#define SET(ID, TYPE, VAL)
 

Typedefs

using CompiledModelType = NoopSavedModelImpl
 

Functions

FunctionPassllvm::createRegAllocScoringPass ()
 When learning an eviction policy, extract score(reward) information, otherwise this does nothing. More...
 
 INITIALIZE_PASS (RegAllocScoring, "regallocscoringpass", "Register Allocation Scoring Pass", false, false) namespace
 

Variables

cl::opt< unsigned > EvictInterferenceCutoff
 

Macro Definition Documentation

◆ _DECL_FEATURES

#define _DECL_FEATURES (   type,
  name,
  shape,
  _ 
)    TensorSpec::createSpec<type>(#name, shape),

◆ _FEATURE_IDX

#define _FEATURE_IDX (   _,
  name,
  __,
  ___ 
)    name,

◆ _RESET

#define _RESET (   TYPE,
  NAME,
  SHAPE,
  __ 
)
Value:
std::memset(Runner.getTensorUntyped(FeatureIDs::NAME), 0, \
getTotalSize<TYPE>(SHAPE));

◆ DEBUG_TYPE

#define DEBUG_TYPE   "ml-regalloc"

Definition at line 44 of file MLRegallocEvictAdvisor.cpp.

◆ DecisionName

#define DecisionName   "index_to_evict"

◆ RA_EVICT_FEATURES_LIST

#define RA_EVICT_FEATURES_LIST (   M)

◆ SET

#define SET (   ID,
  TYPE,
  VAL 
)
Value:
do { \
Runner->getTensor<TYPE>(FeatureIDs::ID)[Pos] = static_cast<TYPE>(VAL); \
if (!DoNotNormalize.test(FeatureIDs::ID)) \
Largest[FeatureIDs::ID] = \
std::max(Largest[FeatureIDs::ID], static_cast<float>(VAL)); \
} while (false)

Typedef Documentation

◆ CompiledModelType

Definition at line 51 of file MLRegallocEvictAdvisor.cpp.

Function Documentation

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( RegAllocScoring  ,
"regallocscoringpass"  ,
"Register Allocation Scoring Pass ,
false  ,
false   
)

The ML evictor (commonalities between release and development mode)

This just calls Evaluate on the Runner, but in the development mode case, if we're just capturing the log of the default advisor, it needs to call the latter instead, so we need to pass all the necessary parameters for it. In the development case, it will also log.

Load the features of the given VirtReg (allocated or not) at column Pos, but if that can't be evicted, return false instead.

Definition at line 107 of file MLRegallocEvictAdvisor.cpp.

References _DECL_FEATURES, _FEATURE_IDX, _RESET, llvm::AnalysisUsage::addRequired(), llvm::append_range(), assert(), llvm::DecisionName, llvm::drop_begin(), llvm::LLVMContext::emitError(), llvm::X86AS::FS, llvm::RegAllocEvictionAdvisorAnalysis::getAnalysisUsage(), llvm::Function::getContext(), llvm::MachineFunction::getFunction(), llvm::Value::getName(), llvm::MachineFunction::getName(), I, Loops, M, llvm::None, RA, RA_EVICT_FEATURES_LIST, llvm::MipsISD::Ret, and llvm::RISCVFenceField::W.

Variable Documentation

◆ EvictInterferenceCutoff

cl::opt<unsigned> EvictInterferenceCutoff
llvm::max
Align max(MaybeAlign Lhs, Align Rhs)
Definition: Alignment.h:340
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:37