mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 19:08:21 +08:00
Revert "[BOLT] Add the FeatureMiner pass to extract Calder's features."
This reverts commit 2476f46af02ccce04e9ed456462dd098460e4e1f. Reviewed By: maks (cherry picked from FBD28111787)
This commit is contained in:
committed by
Maksim Panchenko
parent
170f73ac9e
commit
6c8fc28892
File diff suppressed because it is too large
Load Diff
@@ -884,9 +884,6 @@ public:
|
||||
/// CFG after an optimization pass.
|
||||
void dumpGraphForPass(std::string Annotation = "") const;
|
||||
|
||||
/// Dump internal CFG representaton in a file with .txt extension
|
||||
void dumpGraphToTextFile() const;
|
||||
|
||||
/// Return BinaryContext for the function.
|
||||
const BinaryContext &getBinaryContext() const {
|
||||
return BC;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
add_llvm_library(LLVMBOLTPasses
|
||||
Aligner.cpp
|
||||
AllocCombiner.cpp
|
||||
BranchPredictionInfo.cpp
|
||||
BinaryPasses.cpp
|
||||
BinaryFunctionCallGraph.cpp
|
||||
CallGraph.cpp
|
||||
@@ -11,7 +10,6 @@ add_llvm_library(LLVMBOLTPasses
|
||||
ExtTSPReorderAlgorithm.cpp
|
||||
FrameAnalysis.cpp
|
||||
FrameOptimizer.cpp
|
||||
FeatureMiner.cpp
|
||||
HFSort.cpp
|
||||
HFSortPlus.cpp
|
||||
IdenticalCodeFolding.cpp
|
||||
@@ -41,7 +39,6 @@ add_llvm_library(LLVMBOLTPasses
|
||||
VeneerElimination.cpp
|
||||
RetpolineInsertion.cpp
|
||||
|
||||
|
||||
DEPENDS
|
||||
intrinsics_gen
|
||||
)
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "ExecutableFileMemoryManager.h"
|
||||
#include "MCPlusBuilder.h"
|
||||
#include "ParallelUtilities.h"
|
||||
#include "Passes/FeatureMiner.h"
|
||||
#include "Passes/ReorderFunctions.h"
|
||||
#include "Relocation.h"
|
||||
#include "RuntimeLibs/HugifyRuntimeLibrary.h"
|
||||
@@ -91,7 +90,6 @@ extern cl::OptionCategory BoltCategory;
|
||||
extern cl::OptionCategory BoltDiffCategory;
|
||||
extern cl::OptionCategory BoltOptCategory;
|
||||
extern cl::OptionCategory BoltOutputCategory;
|
||||
extern cl::OptionCategory InferenceCategory;
|
||||
extern cl::OptionCategory AggregatorCategory;
|
||||
|
||||
extern cl::opt<MacroFusionType> AlignMacroOpFusion;
|
||||
@@ -150,17 +148,6 @@ DumpDotAll("dump-dot-all",
|
||||
cl::Hidden,
|
||||
cl::cat(BoltCategory));
|
||||
|
||||
cl::opt<bool> DumpAll("dump-all",
|
||||
cl::desc("dump function CFGs to text file format after each stage"),
|
||||
cl::ZeroOrMore, cl::cat(BoltCategory));
|
||||
|
||||
cl::opt<bool>
|
||||
GenFeatures("gen-features",
|
||||
cl::desc("capture features useful for training an ML model on branch"
|
||||
" behavior and save them in CSV format."),
|
||||
cl::ZeroOrMore,
|
||||
cl::cat(InferenceCategory));
|
||||
|
||||
static cl::opt<bool>
|
||||
DumpEHFrame("dump-eh-frame",
|
||||
cl::desc("dump parsed .eh_frame (debugging)"),
|
||||
@@ -567,7 +554,7 @@ void RewriteInstance::discoverStorage() {
|
||||
SectionContents.data() - InputFile->getData().data();
|
||||
}
|
||||
|
||||
if (!opts::GenFeatures && !opts::HeatmapMode &&
|
||||
if (!opts::HeatmapMode &&
|
||||
!(opts::AggregateOnly && BAT->enabledFor(InputFile)) &&
|
||||
(SectionName.startswith(getOrgSecPrefix()) ||
|
||||
SectionName == getBOLTTextSectionName())) {
|
||||
@@ -808,13 +795,6 @@ void RewriteInstance::run() {
|
||||
|
||||
processProfileData();
|
||||
|
||||
if (opts::GenFeatures) {
|
||||
std::unique_ptr<FeatureMiner> FM =
|
||||
llvm::make_unique<FeatureMiner>(opts::GenFeatures);
|
||||
FM->runOnFunctions(*BC);
|
||||
return;
|
||||
}
|
||||
|
||||
postProcessFunctions();
|
||||
|
||||
if (opts::DiffOnly)
|
||||
@@ -2645,9 +2625,6 @@ void RewriteInstance::postProcessFunctions() {
|
||||
if (opts::DumpDotAll)
|
||||
Function.dumpGraphForPass("build-cfg");
|
||||
|
||||
if (opts::DumpAll)
|
||||
Function.dumpGraphToTextFile();
|
||||
|
||||
if (opts::PrintLoopInfo) {
|
||||
Function.calculateLoopInfo();
|
||||
Function.printLoopInfo(outs());
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
#include "llvm/Support/Path.h"
|
||||
#include "llvm/Support/PrettyStackTrace.h"
|
||||
#include "llvm/Support/Signals.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include "llvm/Support/TargetSelect.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include "llvm/Support/ThreadPool.h"
|
||||
|
||||
#undef DEBUG_TYPE
|
||||
#undef DEBUG_TYPE
|
||||
#define DEBUG_TYPE "bolt"
|
||||
|
||||
using namespace llvm;
|
||||
@@ -45,13 +45,11 @@ cl::OptionCategory BoltOptCategory("BOLT optimization options");
|
||||
cl::OptionCategory BoltRelocCategory("BOLT options in relocation mode");
|
||||
cl::OptionCategory BoltOutputCategory("Output options");
|
||||
cl::OptionCategory AggregatorCategory("Data aggregation options");
|
||||
cl::OptionCategory InferenceCategory("BOLT static profile options");
|
||||
|
||||
static cl::OptionCategory *BoltCategories[] = {&BoltCategory,
|
||||
&BoltOptCategory,
|
||||
&BoltRelocCategory,
|
||||
&BoltOutputCategory,
|
||||
&InferenceCategory};
|
||||
&BoltOutputCategory};
|
||||
|
||||
static cl::OptionCategory *BoltDiffCategories[] = {&BoltDiffCategory};
|
||||
|
||||
@@ -63,40 +61,59 @@ cl::SubCommand HeatmapCommand("heatmap", "generate heatmap");
|
||||
extern cl::opt<std::string> OutputFilename;
|
||||
extern cl::opt<bool> AggregateOnly;
|
||||
extern cl::opt<bool> DiffOnly;
|
||||
extern cl::opt<bool> GenFeatures;
|
||||
|
||||
static cl::opt<std::string> InputDataFilename("data", cl::desc("<data file>"),
|
||||
cl::Optional,
|
||||
cl::cat(BoltCategory));
|
||||
static cl::opt<std::string>
|
||||
InputDataFilename("data",
|
||||
cl::desc("<data file>"),
|
||||
cl::Optional,
|
||||
cl::cat(BoltCategory));
|
||||
|
||||
static cl::alias BoltProfile("b", cl::desc("alias for -data"),
|
||||
cl::aliasopt(InputDataFilename),
|
||||
cl::cat(BoltCategory));
|
||||
static cl::alias
|
||||
BoltProfile("b",
|
||||
cl::desc("alias for -data"),
|
||||
cl::aliasopt(InputDataFilename),
|
||||
cl::cat(BoltCategory));
|
||||
|
||||
static cl::opt<std::string> InputDataFilename2("data2", cl::desc("<data file>"),
|
||||
cl::Optional,
|
||||
cl::cat(BoltCategory));
|
||||
static cl::opt<std::string>
|
||||
InputDataFilename2("data2",
|
||||
cl::desc("<data file>"),
|
||||
cl::Optional,
|
||||
cl::cat(BoltCategory));
|
||||
|
||||
static cl::opt<std::string> InputFilename(cl::Positional,
|
||||
cl::desc("<executable>"),
|
||||
cl::Required, cl::cat(BoltCategory),
|
||||
cl::sub(*cl::AllSubCommands));
|
||||
static cl::opt<std::string>
|
||||
InputFilename(
|
||||
cl::Positional,
|
||||
cl::desc("<executable>"),
|
||||
cl::Required,
|
||||
cl::cat(BoltCategory),
|
||||
cl::sub(*cl::AllSubCommands));
|
||||
|
||||
static cl::opt<std::string> InputFilename2(cl::Positional,
|
||||
cl::desc("<executable>"),
|
||||
cl::Optional,
|
||||
cl::cat(BoltDiffCategory));
|
||||
static cl::opt<std::string>
|
||||
InputFilename2(
|
||||
cl::Positional,
|
||||
cl::desc("<executable>"),
|
||||
cl::Optional,
|
||||
cl::cat(BoltDiffCategory));
|
||||
|
||||
static cl::opt<std::string> PerfData("perfdata", cl::desc("<data file>"),
|
||||
cl::Optional, cl::cat(AggregatorCategory),
|
||||
cl::sub(*cl::AllSubCommands));
|
||||
static cl::opt<std::string>
|
||||
PerfData("perfdata",
|
||||
cl::desc("<data file>"),
|
||||
cl::Optional,
|
||||
cl::cat(AggregatorCategory),
|
||||
cl::sub(*cl::AllSubCommands));
|
||||
|
||||
static cl::alias PerfDataA("p", cl::desc("alias for -perfdata"),
|
||||
cl::aliasopt(PerfData), cl::cat(AggregatorCategory));
|
||||
static cl::alias
|
||||
PerfDataA("p",
|
||||
cl::desc("alias for -perfdata"),
|
||||
cl::aliasopt(PerfData),
|
||||
cl::cat(AggregatorCategory));
|
||||
|
||||
cl::opt<bool> PrintSections("print-sections",
|
||||
cl::desc("print all registered sections"),
|
||||
cl::ZeroOrMore, cl::Hidden, cl::cat(BoltCategory));
|
||||
cl::opt<bool>
|
||||
PrintSections("print-sections",
|
||||
cl::desc("print all registered sections"),
|
||||
cl::ZeroOrMore,
|
||||
cl::Hidden,
|
||||
cl::cat(BoltCategory));
|
||||
|
||||
} // namespace opts
|
||||
|
||||
@@ -119,9 +136,9 @@ namespace llvm {
|
||||
namespace bolt {
|
||||
const char *BoltRevision =
|
||||
#include "BoltRevision.inc"
|
||||
;
|
||||
} // namespace bolt
|
||||
} // namespace llvm
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
static void printBoltRevision(llvm::raw_ostream &OS) {
|
||||
OS << "BOLT revision " << BoltRevision << "\n";
|
||||
@@ -160,7 +177,7 @@ void heatmapMode(int argc, char **argv) {
|
||||
std::unique_ptr<char *[]> FakeArgv;
|
||||
if (argc == 1 || strcmp(argv[1], "heatmap")) {
|
||||
++argc;
|
||||
FakeArgv.reset(new char *[argc + 1]);
|
||||
FakeArgv.reset(new char *[argc+1]);
|
||||
FakeArgv[0] = argv[0];
|
||||
FakeArgv[1] = const_cast<char *>("heatmap");
|
||||
for (int I = 2; I < argc; ++I)
|
||||
@@ -217,11 +234,7 @@ void boltMode(int argc, char **argv) {
|
||||
cl::ParseCommandLineOptions(argc, argv,
|
||||
"BOLT - Binary Optimization and Layout Tool\n");
|
||||
|
||||
if (opts::InputFilename.empty()) {
|
||||
errs() << ToolName << ": expected binary.\n";
|
||||
exit(1);
|
||||
}
|
||||
if (!opts::GenFeatures && opts::OutputFilename.empty()) {
|
||||
if (opts::OutputFilename.empty()) {
|
||||
errs() << ToolName << ": expected -o=<output file> option.\n";
|
||||
exit(1);
|
||||
}
|
||||
@@ -242,7 +255,7 @@ int main(int argc, char **argv) {
|
||||
sys::PrintStackTraceOnErrorSignal(argv[0]);
|
||||
PrettyStackTraceProgram X(argc, argv);
|
||||
|
||||
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
|
||||
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
|
||||
|
||||
std::string ToolPath = GetExecutablePath(argv[0]);
|
||||
|
||||
@@ -273,6 +286,7 @@ int main(int argc, char **argv) {
|
||||
else
|
||||
boltMode(argc, argv);
|
||||
|
||||
|
||||
if (!sys::fs::exists(opts::InputFilename))
|
||||
report_error(opts::InputFilename, errc::no_such_file_or_directory);
|
||||
|
||||
@@ -289,10 +303,8 @@ int main(int argc, char **argv) {
|
||||
if (!opts::PerfData.empty()) {
|
||||
if (!opts::AggregateOnly) {
|
||||
errs() << ToolName
|
||||
<< ": WARNING: reading perf data directly is unsupported, "
|
||||
"please use "
|
||||
"-aggregate-only or perf2bolt.\n!!! Proceed on your own "
|
||||
"risk. !!!\n";
|
||||
<< ": WARNING: reading perf data directly is unsupported, please use "
|
||||
"-aggregate-only or perf2bolt.\n!!! Proceed on your own risk. !!!\n";
|
||||
}
|
||||
if (auto E = RI.setProfile(opts::PerfData))
|
||||
report_error(opts::PerfData, std::move(E));
|
||||
|
||||
Reference in New Issue
Block a user