[PATCH] D114171: [SLP]Improve reductions analysis and emission, part 1.
Alexey Bataev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 20 04:33:26 PDT 2022
ABataev added a comment.
In D114171#3526821 <https://reviews.llvm.org/D114171#3526821>, @alexfh wrote:
> I've noticed that this patch (7ea03f0b4e4ec5d91d48ba2976f5adc299089ffd <https://reviews.llvm.org/rG7ea03f0b4e4ec5d91d48ba2976f5adc299089ffd>) significantly increases compile time for a certain type of code (functions with a large number of branches on top level). In extreme cases (generated code with really large functions) this leads to tens of minutes of time spent in SLP vectorizer:
>
> ===-------------------------------------------------------------------------===
> ... Pass execution timing report ...
> ===-------------------------------------------------------------------------===
> Total Execution Time: 1895.1082 seconds (1895.2216 wall clock)
>
> ---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
> 1752.0457 ( 93.4%) 0.2965 ( 1.5%) 1752.3421 ( 92.5%) 1752.4505 ( 92.5%) SLPVectorizerPass
> 37.7381 ( 2.0%) 5.4889 ( 28.6%) 43.2270 ( 2.3%) 43.2324 ( 2.3%) ModuleInlinerWrapperPass
> 37.0725 ( 2.0%) 5.2396 ( 27.3%) 42.3121 ( 2.2%) 42.3175 ( 2.2%) DevirtSCCRepeatedPass
> 16.8654 ( 0.9%) 0.2731 ( 1.4%) 17.1384 ( 0.9%) 17.1387 ( 0.9%) GVNPass
>
> Analyzing data from `perf record -g`, I can also see related code, specifically `llvm::slpvectorizer::BoUpSLP::buildTree_rec`:
>
> - 99.23% 0.00% clang clang [.] main ▒
> - main ▒
> - 99.23% ExecuteCC1Tool ▒
> - 99.23% cc1_main ◆
> - 99.23% clang::ExecuteCompilerInvocation ▒
> - 99.23% clang::CompilerInstance::ExecuteAction ▒
> - 99.21% clang::FrontendAction::Execute ▒
> - 99.21% clang::ParseAST ▒
> - 98.53% clang::BackendConsumer::HandleTranslationUnit ▒
> - 98.48% clang::EmitBackendOutput ▒
> - 96.34% (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline ▒
> - 96.34% llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run ▒
> - 94.47% llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run ▒
> - 94.47% llvm::ModuleToFunctionPassAdaptor::run ▒
> - 94.45% llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run ▒
> - 94.45% llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run ▒
> - 94.21% llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run ▒
> - llvm::SLPVectorizerPass::run ▒
> - 94.20% llvm::SLPVectorizerPass::runImpl ▒
> - 93.68% llvm::SLPVectorizerPass::vectorizeSimpleInstructions ▒
> - 92.96% llvm::SLPVectorizerPass::vectorizeRootInstruction ▒
> - 88.63% llvm::slpvectorizer::BoUpSLP::buildTree ▒
> 87.88% llvm::slpvectorizer::BoUpSLP::buildTree_rec ▒
> 0.73% llvm::slpvectorizer::BoUpSLP::buildTree_rec ▒
> 3.30% llvm::hashing::detail::hash_state::mix ▒
> 0.61% llvm::SmallPtrSetImplBase::find_imp ▒
> + 1.76% llvm::detail::PassModel<llvm::Module, llvm::ModuleInlinerWrapperPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run ▒
> + 2.14% llvm::legacy::PassManagerImpl::run ▒
> + 0.65% clang::Parser::ParseTopLevelDecl
>
> I'm trying to come up with an isolated test case now.
Hi, the reproducer will definitely help to figure out the problem, thanks. I tried to avoid some extra checks and added limits, probably missed some.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114171/new/
https://reviews.llvm.org/D114171
More information about the llvm-commits
mailing list