|
LLVM 24.0.0git
|
#include "AllocationOrder.h"#include "RegAllocGreedy.h"#include "llvm/Analysis/MLModelRunner.h"#include "llvm/Analysis/TensorSpec.h"#include "llvm/CodeGen/RegAllocEvictionAdvisor.h"#include "MLRegAllocEvictAdvisor.h"#include "llvm/Analysis/NoInferenceModelRunner.h"#include "llvm/Analysis/ReleaseModeModelRunner.h"#include "llvm/Analysis/Utils/MLGOUtils.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/IR/Module.h"#include "llvm/InitializePasses.h"#include "llvm/Pass.h"#include "llvm/Support/CommandLine.h"#include "llvm/Support/ErrorHandling.h"#include <bitset>#include <cmath>#include <memory>#include "llvm/Analysis/EmitCModelRunner.h"#include "llvm/CodeGen/RegAllocEvictModels.h"#include "llvm/CodeGen/RegAllocEvictModels.def"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 | MLGO_MODEL(CLASS_NAME, CLI_FLAG) |
| #define | MLGO_MODEL(CLASS_NAME, CLI_FLAG) |
| #define | MLGO_MODEL(CLASS_NAME, CLI_FLAG) |
| #define | RA_EVICT_FEATURES_LIST(M) |
| #define | DecisionName "index_to_evict" |
| #define | _FEATURE_IDX_SIMPLE(_, name, __, ___) |
| #define | _FEATURE_IDX(A, B, C, D) |
| #define | _DECL_FEATURES(type, name, shape, _) |
| #define | SET(ID, TYPE, VAL) |
Enumerations | |
| enum class | MLGORegAllocModelChoice { Default } |
Functions | |
| static std::unique_ptr< MLModelRunner > | createMLGORegAllocModelRunner (LLVMContext &Ctx, const std::vector< TensorSpec > &InputFeatures) |
| INITIALIZE_PASS (RegAllocScoring, "regallocscoringpass", "Register Allocation Scoring Pass", false, false) namespace | |
Variables | |
| static llvm::cl::opt< MLGORegAllocModelChoice > | SelectedMLGORegAllocModel ("regalloc-mlgo-model", llvm::cl::desc("Select the MLGO model to execute for register allocation:"), llvm::cl::init(MLGORegAllocModelChoice::Default), llvm::cl::values(clEnumValN(MLGORegAllocModelChoice::Default, "default", "Use standard heuristic") #define MLGO_MODEL(CLASS_NAME, CLI_FLAG) \ \)) |
| static 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 <regalloc-evict-interactive-channel-base>.in, while the " "outgoing name should be " "<regalloc-evict-interactive-channel-base>.out")) |
| static 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)) |
| static cl::opt< unsigned > | NumAllocatableRegs ("mlregalloc-num-allocatable-regs", cl::Hidden, cl::desc("The number of eviction candidates the model sees. The model has " "one more column, for the live range seeking allocation"), cl::init(32)) |
| cl::opt< unsigned > | llvm::EvictInterferenceCutoff |
Referenced by INITIALIZE_PASS().
Referenced by INITIALIZE_PASS().
| #define DEBUG_TYPE "ml-regalloc" |
Definition at line 47 of file MLRegAllocEvictAdvisor.cpp.
| #define DecisionName "index_to_evict" |
Referenced by INITIALIZE_PASS().
| #define MLGO_MODEL | ( | CLASS_NAME, | |
| CLI_FLAG ) |
Definition at line 62 of file MLRegAllocEvictAdvisor.cpp.
| #define MLGO_MODEL | ( | CLASS_NAME, | |
| CLI_FLAG ) |
Definition at line 62 of file MLRegAllocEvictAdvisor.cpp.
| #define MLGO_MODEL | ( | CLASS_NAME, | |
| CLI_FLAG ) |
Definition at line 62 of file MLRegAllocEvictAdvisor.cpp.
| #define RA_EVICT_FEATURES_LIST | ( | M | ) |
Referenced by INITIALIZE_PASS().
| #define SET | ( | ID, | |
| TYPE, | |||
| VAL ) |
|
strong |
| Enumerator | |
|---|---|
| Default | |
Definition at line 60 of file MLRegAllocEvictAdvisor.cpp.
|
static |
Definition at line 79 of file MLRegAllocEvictAdvisor.cpp.
References Default, llvm::InputFeatures, llvm_unreachable, and SelectedMLGORegAllocModel.
Referenced by 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 166 of file MLRegAllocEvictAdvisor.cpp.
References _DECL_FEATURES, _FEATURE_IDX, llvm::AnalysisUsage::addRequired(), llvm::append_range(), assert(), llvm::RegAllocEvictionAdvisor::canEvictHintInterference(), createMLGORegAllocModelRunner(), llvm::createReleaseModeModelRunner(), llvm::TensorSpec::createSpec(), DecisionName, llvm::DecisionSpec, llvm::Pass::doInitialization(), llvm::dyn_cast(), llvm::LLVMContext::emitError(), llvm::DenseMapBase< StorageT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::enumerate(), llvm::FeatureCount, llvm::DenseMapBase< StorageT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::RegAllocEvictionAdvisorProvider::getAdvisor(), llvm::RegAllocEvictionAdvisorAnalysisLegacy::getAnalysisUsage(), llvm::Function::getContext(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getFunctionNumber(), llvm::getLoggerContextName(), llvm::MachineFunction::getName(), llvm::MLModelRunner::getTensorUntyped(), I, llvm::Register::id(), llvm::InputFeatures, InteractiveChannelBaseName, llvm::RegAllocEvictionAdvisorAnalysisLegacy::logRewardIfNeeded(), llvm::RegAllocEvictionAdvisorProvider::logRewardIfNeeded(), Loops, NumAllocatableRegs, llvm::PerLiveRangeShape, RA, RA_EVICT_FEATURES_LIST, Reg, llvm::RegAllocEvictionAdvisorAnalysisLegacy::RegAllocEvictionAdvisorAnalysisLegacy(), llvm::RegAllocEvictionAdvisorProvider::RegAllocEvictionAdvisorProvider(), and llvm::RegAllocEvictionAdvisor::tryFindEvictionCandidate().
|
static |
|
static |
|
static |
Referenced by INITIALIZE_PASS().
|
static |