Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions llvm/include/llvm/Analysis/InlineModelFeatureMaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ inlineCostFeatureToMlFeature(InlineCostFeatureIndex Feature) {
}

LLVM_ABI extern const char *const DecisionName;
LLVM_ABI extern const TensorSpec InlineDecisionSpec;
LLVM_ABI const TensorSpec &getInlineDecisionSpec();
LLVM_ABI extern const char *const DefaultDecisionName;
LLVM_ABI extern const TensorSpec DefaultDecisionSpec;
LLVM_ABI extern const TensorSpec &getDefaultDecisionSpec();
LLVM_ABI extern const char *const RewardName;

using InlineFeatures = std::vector<int64_t>;
Expand Down
18 changes: 12 additions & 6 deletions llvm/lib/Analysis/MLInlineAdvisor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ llvm::getReleaseModeAdvisor(Module &M, ModuleAnalysisManager &MAM,
EmbeddedModelRunnerOptions().setModelSelector(ModelSelector));
else {
AOTRunner = std::make_unique<InteractiveModelRunner>(
M.getContext(), InputFeatures, InlineDecisionSpec,
M.getContext(), InputFeatures, getInlineDecisionSpec(),
InteractiveChannelBaseName + ".out",
InteractiveChannelBaseName + ".in");
}
Expand Down Expand Up @@ -127,11 +127,17 @@ static std::vector<TensorSpec> FeatureMap{
}

const char *const llvm::DecisionName = "inlining_decision";
const TensorSpec llvm::InlineDecisionSpec =
TensorSpec::createSpec<int64_t>(DecisionName, {1});
const TensorSpec &llvm::getInlineDecisionSpec() {
static const TensorSpec T =
TensorSpec::createSpec<int64_t>(DecisionName, {1});
return T;
}
const char *const llvm::DefaultDecisionName = "inlining_default";
const TensorSpec llvm::DefaultDecisionSpec =
TensorSpec::createSpec<int64_t>(DefaultDecisionName, {1});
const TensorSpec &llvm::getDefaultDecisionSpec() {
static const TensorSpec T =
TensorSpec::createSpec<int64_t>(DefaultDecisionName, {1});
return T;
}
const char *const llvm::RewardName = "delta_size";

CallBase *getInlinableCS(Instruction &I) {
Expand Down Expand Up @@ -209,7 +215,7 @@ MLInlineAdvisor::MLInlineAdvisor(
TensorSpec::createSpec<float>("caller_embedding", {IR2VecDim}));
}
if (InteractiveIncludeDefault)
FeatureMap.push_back(DefaultDecisionSpec);
FeatureMap.push_back(getDefaultDecisionSpec());

ModelRunner = GetModelRunner(getFeatureMap());
if (!ModelRunner) {
Expand Down
Loading