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

View File

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