LLVM: lib/CodeGen/MLRegAllocEvictAdvisor.cpp File Reference (original) (raw)
Go to the source code of this file.
| Namespaces | |
|---|---|
| namespace | 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_SIMPLE(_, name, __, ___) |
| #define | _FEATURE_IDX(A, B, C, D) |
| #define | _RESET(TYPE, NAME, SHAPE, __) |
| #define | _DECL_FEATURES(type, name, shape, _) |
| #define | SET(ID, TYPE, VAL) |
| Functions |
|---|
◆ _DECL_FEATURES
| #define _DECL_FEATURES | ( | type, |
|---|---|---|
| name, | ||
| shape, | ||
| _ ) |
Value:
static TensorSpec createSpec(const std::string &Name, const std::vector< int64_t > &Shape, int Port=0)
Referenced by INITIALIZE_PASS().
◆ _FEATURE_IDX
| #define _FEATURE_IDX | ( | A, |
|---|---|---|
| B, | ||
| C, | ||
| D ) |
Value:
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define _FEATURE_IDX_SIMPLE(_, name, __, ___)
@ C
The default llvm calling convention, compatible with C.
Referenced by INITIALIZE_PASS().
◆ _FEATURE_IDX_SIMPLE
| #define _FEATURE_IDX_SIMPLE | ( | _, |
|---|---|---|
| name, | ||
| __, | ||
| ___ ) |
◆ _RESET
| #define _RESET | ( | TYPE, |
|---|---|---|
| NAME, | ||
| SHAPE, | ||
| __ ) |
Value:
std::memset(Runner.getTensorUntyped(FeatureIDs::NAME), 0, \
getTotalSize(SHAPE));
Referenced by INITIALIZE_PASS().
◆ DEBUG_TYPE
#define DEBUG_TYPE "ml-regalloc"
◆ 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(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)
◆ 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.
Common provider for legacy and new pass managers.
Definition at line 129 of file MLRegAllocEvictAdvisor.cpp.
References _DECL_FEATURES, _FEATURE_IDX, _RESET, llvm::AnalysisUsage::addRequired(), llvm::append_range(), assert(), llvm::RegAllocEvictionAdvisor::canEvictHintInterference(), llvm::TensorSpec::createSpec(), DecisionName, llvm::DecisionSpec, llvm::Pass::doInitialization(), llvm::dyn_cast(), llvm::LLVMContext::emitError(), llvm::FeatureCount, llvm::RegAllocEvictionAdvisorProvider::getAdvisor(), llvm::RegAllocEvictionAdvisorAnalysisLegacy::getAnalysisUsage(), llvm::Function::getContext(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getName(), llvm::Register::id(), llvm::InputFeatures, InteractiveChannelBaseName, llvm::RegAllocEvictionAdvisorAnalysisLegacy::logRewardIfNeeded(), llvm::RegAllocEvictionAdvisorProvider::logRewardIfNeeded(), Loops, llvm::NumberOfInterferences, llvm::PerLiveRangeShape, RA, RA_EVICT_FEATURES_LIST, Reg, llvm::RegAllocEvictionAdvisorAnalysisLegacy::RegAllocEvictionAdvisorAnalysisLegacy(), llvm::RegAllocEvictionAdvisorProvider::RegAllocEvictionAdvisorProvider(), T, and llvm::RegAllocEvictionAdvisor::tryFindEvictionCandidate().
◆ InteractiveChannelBaseName
| cl::opt< std::string > InteractiveChannelBaseName("regalloc-evict-interactive-channel-base", cl::Hidden, cl::desc( "Base file path for the interactive mode. The incoming filename should " "have the name .in, while the " "outgoing name should be " ".out")) ( "regalloc-evict-interactive-channel-base" , cl::Hidden , cl::desc( "Base file path for the interactive mode. The incoming filename should " "have the name .in, while the " "outgoing name should be " ".out") ) | static |
|---|
◆ MaxEvictionCount
| cl::opt< unsigned > MaxEvictionCount("mlregalloc-max-eviction-count", cl::Hidden, cl::desc("The maximum number of times a live range can be " "evicted before preventing it from being evicted"), cl::init(100)) ( "mlregalloc-max-eviction-count" , cl::Hidden , cl::desc("The maximum number of times a live range can be " "evicted before preventing it from being evicted") , cl::init(100) ) | static |
|---|