Revert 548eca7 to bring back optimisation level of interpreter to O0

Revert https://github.com/root-project/root/commit/548eca7 bringing back
optimisation level to O0 given the very long time needed to JIT simple
pieces of code.
This takes tens of seconds versus a few seconds:

using namespace ROOT::Experimental;
int test() {
   // build a TDF with 1 event and 1 column "x" that is always equal 42
   TDataFrame dd(1);
   auto d = dd.Define("x", []() { return 42; });

   // book nHistos histograms
   // all with the same cut and filled with the same variable in this simple example
   std::vector<TDF::TResultProxy<TH1D>> histos;
   const auto nHistos = 1000u;
   histos.reserve(nHistos);
   for (auto i = 0u; i < nHistos; ++i)
      histos.emplace_back(d.Histo1D("x"));

   // run event loop, print something to be sure everything is ok
   std::cout << histos.front()->GetMean() << std::endl;
   return 0;
}
This commit is contained in:
Danilo Piparo 2017-10-19 17:48:29 +02:00 committed by sftnight
parent f8d746464b
commit fde4b32b7c
2 changed files with 23 additions and 15 deletions

View File

@ -104,13 +104,18 @@ void BackendPasses::CreatePasses(llvm::Module& M, int OptLevel)
Inlining = CodeGenOptions::NormalInlining;
#endif
// Handle disabling of LLVM optimization, where we want to preserve the
// internal module before any optimization.
if (m_CGOpts.DisableLLVMPasses) {
OptLevel = 0;
// Always keep at least ForceInline - NoInlining is deadly for libc++.
// Inlining = CGOpts.NoInlining;
}
// Revert https://github.com/root-project/root/commit/548eca7 bringing back
// optimisation level to O0 given the very long time needed to JIT simple
// pieces of code.
// // Handle disabling of LLVM optimization, where we want to preserve the
// // internal module before any optimization.
// if (m_CGOpts.DisableLLVMPasses) {
// OptLevel = 0;
// // Always keep at least ForceInline - NoInlining is deadly for libc++.
// // Inlining = CGOpts.NoInlining;
// }
OptLevel = 0;
llvm::PassManagerBuilder PMBuilder;
PMBuilder.OptLevel = OptLevel;

View File

@ -1132,14 +1132,17 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts,
CGOpts.EmitCodeView = 1;
CGOpts.CXXCtorDtorAliases = 1;
#endif
// Reduce amount of emitted symbols by optimizing more.
CGOpts.OptimizationLevel = 2;
// Taken from a -O2 run of clang:
CGOpts.DiscardValueNames = 1;
CGOpts.OmitLeafFramePointer = 1;
CGOpts.UnrollLoops = 1;
CGOpts.VectorizeLoop = 1;
CGOpts.VectorizeSLP = 1;
// Revert https://github.com/root-project/root/commit/548eca7 bringing back
// optimisation level to O0 given the very long time needed to JIT simple
// pieces of code.
// // Reduce amount of emitted symbols by optimizing more.
// CGOpts.OptimizationLevel = 2;
// // Taken from a -O2 run of clang:
// CGOpts.DiscardValueNames = 1;
// CGOpts.OmitLeafFramePointer = 1;
// CGOpts.UnrollLoops = 1;
// CGOpts.VectorizeLoop = 1;
// CGOpts.VectorizeSLP = 1;
// CGOpts.setDebugInfo(clang::CodeGenOptions::FullDebugInfo);
// CGOpts.EmitDeclMetadata = 1; // For unloading, for later