[OpenMP] Slow compile of OpenMPDecompositionTest.cpp
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
OpenMPDecompositionTest.cpp is regularly one of the slowest files when building LLVM, often in the range of 30-90s. The visitor pattern results in types (>10 kB!) like the following, which cause many template instantiations and many IR functions need to be generated/optimized out again. The recursion depth is way over 100. Is there any way to write this test without such heavy reliance on templates?
```c++
std::__detail::__variant::_Variant_storage, omp::ExprTy>, tomp::clause::AcquireT, omp::ExprTy>, tomp::clause::CaptureT, omp::ExprTy>, tomp::clause::CompareT, omp::ExprTy>, tomp::clause::FullT, omp::ExprTy>, tomp::clause::InbranchT, omp::ExprTy>, tomp::clause::MergeableT, omp::ExprTy>, tomp::clause::NogroupT, omp::ExprTy>, tomp::clause::NoOpenmpConstructsT, omp::ExprTy>, tomp::clause::NoOpenmpRoutinesT, omp::ExprTy>, tomp::clause::NoOpenmpT, omp::ExprTy>, tomp::clause::NoParallelismT, omp::ExprTy>, tomp::clause::NotinbranchT, omp::ExprTy>, tomp::clause::NowaitT, omp::ExprTy>, tomp::clause::ReadT, omp::ExprTy>, tomp::clause::RelaxedT, omp::ExprTy>, tomp::clause::ReleaseT, omp::ExprTy>, tomp::clause::SeqCstT, omp::ExprTy>, tomp::clause::SimdT, omp::ExprTy>, tomp::clause::ThreadsT, omp::ExprTy>, tomp::clause::UnknownT, omp::ExprTy>, tomp::clause::UntiedT, omp::ExprTy>, tomp::clause::UseT, omp::ExprTy>, tomp::clause::WeakT, omp::ExprTy>, tomp::clause::WriteT, omp::ExprTy>, tomp::clause::OmpxAttributeT, omp::ExprTy>, tomp::clause::OmpxBareT, omp::ExprTy>, tomp::clause::OmpxDynCgroupMemT, omp::ExprTy>, tomp::clause::AdjustArgsT, omp::ExprTy>, tomp::clause::AppendArgsT, omp::ExprTy>, tomp::clause::ApplyT, omp::ExprTy>, tomp::clause::CollectorT, omp::ExprTy>, tomp::clause::CountsT, omp::ExprTy>, tomp::clause::GraphIdT, omp::ExprTy>, tomp::clause::GraphResetT, omp::ExprTy>, tomp::clause::InductionT, omp::ExprTy>, tomp::clause::InductorT, omp::ExprTy>, tomp::clause::InitCompleteT, omp::ExprTy>, tomp::clause::InteropT, omp::ExprTy>, tomp::clause::LocalT, omp::ExprTy>, tomp::clause::MatchT, omp::ExprTy>, tomp::clause::MemscopeT, omp::ExprTy>, tomp::clause::OtherwiseT, omp::ExprTy>, tomp::clause::ReplayableT, omp::ExprTy>, tomp::clause::SafesyncT, omp::ExprTy>, tomp::clause::TransparentT, omp::ExprTy>, tomp::clause::WhenT, omp::ExprTy>, tomp::clause::AffinityT, omp::ExprTy>, tomp::clause::AlignedT, omp::ExprTy>, tomp::clause::AllocateT, omp::ExprTy>, tomp::clause::DefaultmapT, omp::ExprTy>, tomp::clause::DeviceT, omp::ExprTy>, tomp::clause::DistScheduleT, omp::ExprTy>, tomp::clause::DoacrossT, omp::ExprTy>, tomp::clause::DynGroupprivateT, omp::ExprTy>, tomp::clause::FromT, omp::ExprTy>, tomp::clause::GrainsizeT, omp::ExprTy>, tomp::clause::IfT, omp::ExprTy>, tomp::clause::InitT, omp::ExprTy>, tomp::clause::InReductionT, omp::ExprTy>, tomp::clause::LastprivateT, omp::ExprTy>, tomp::clause::LinearT, omp::ExprTy>, tomp::clause::LooprangeT, omp::ExprTy>, tomp::clause::MapT, omp::ExprTy>, tomp::clause::NumTasksT, omp::ExprTy>, tomp::clause::OrderT, omp::ExprTy>, tomp::clause::ReductionT, omp::ExprTy>, tomp::clause::ScheduleT, omp::ExprTy>, tomp::clause::TaskReductionT, omp::ExprTy>, tomp::clause::ToT, omp::ExprTy>, tomp::clause::DependT, omp::ExprTy>, tomp::clause::AbsentT, omp::ExprTy>, tomp::clause::AlignT, omp::ExprTy>, tomp::clause::AllocatorT, omp::ExprTy>, tomp::clause::AtomicDefaultMemOrderT, omp::ExprTy>, tomp::clause::AtT, omp::ExprTy>, tomp::clause::BindT, omp::ExprTy>, tomp::clause::CollapseT, omp::ExprTy>, tomp::clause::CombinerT, omp::ExprTy>, tomp::clause::ContainsT, omp::ExprTy>, tomp::clause::CopyinT, omp::ExprTy>, tomp::clause::CopyprivateT, omp::ExprTy>, tomp::clause::DefaultT, omp::ExprTy>, tomp::clause::DestroyT, omp::ExprTy>, tomp::clause::DetachT, omp::ExprTy>, tomp::clause::DeviceSafesyncT, omp::ExprTy>, tomp::clause::DeviceTypeT, omp::ExprTy>, tomp::clause::DynamicAllocatorsT, omp::ExprTy>, tomp::clause::EnterT, omp::ExprTy>, tomp::clause::ExclusiveT, omp::ExprTy>, tomp::clause::FailT, omp::ExprTy>, tomp::clause::FilterT, omp::ExprTy>, tomp::clause::FinalT, omp::ExprTy>, tomp::clause::FirstprivateT, omp::ExprTy>, tomp::clause::HasDeviceAddrT, omp::ExprTy>, tomp::clause::HintT, omp::ExprTy>, tomp::clause::HoldsT, omp::ExprTy>, tomp::clause::InclusiveT, omp::ExprTy>, tomp::clause::IndirectT, omp::ExprTy>, tomp::clause::InitializerT, omp::ExprTy>, tomp::clause::IsDevicePtrT, omp::ExprTy>, tomp::clause::LinkT, omp::ExprTy>, tomp::clause::MessageT, omp::ExprTy>, tomp::clause::NocontextT, omp::ExprTy>, tomp::clause::NontemporalT, omp::ExprTy>, tomp::clause::NovariantsT, omp::ExprTy>, tomp::clause::NumTeamsT, omp::ExprTy>, tomp::clause::NumThreadsT, omp::ExprTy>, tomp::clause::OrderedT, omp::ExprTy>, tomp::clause::PartialT, omp::ExprTy>, tomp::clause::PriorityT, omp::ExprTy>, tomp::clause::PrivateT, omp::ExprTy>, tomp::clause::ProcBindT, omp::ExprTy>, tomp::clause::ReverseOffloadT, omp::ExprTy>, tomp::clause::SafelenT, omp::ExprTy>, tomp::clause::SelfMapsT, omp::ExprTy>, tomp::clause::SeverityT, omp::ExprTy>, tomp::clause::SharedT, omp::ExprTy>, tomp::clause::SimdlenT, omp::ExprTy>, tomp::clause::SizesT, omp::ExprTy>, tomp::clause::PermutationT, omp::ExprTy>, tomp::clause::ThreadLimitT, omp::ExprTy>, tomp::clause::ThreadsetT, omp::ExprTy>, tomp::clause::UnifiedAddressT, omp::ExprTy>, tomp::clause::UnifiedSharedMemoryT, omp::ExprTy>, tomp::clause::UniformT, omp::ExprTy>, tomp::clause::UpdateT, omp::ExprTy>, tomp::clause::UseDeviceAddrT, omp::ExprTy>, tomp::clause::UseDevicePtrT, omp::ExprTy>, tomp::clause::UsesAllocatorsT, omp::ExprTy>>::_Variant_storage<75UL, tomp::clause::AtT, omp::ExprTy>>
```
Time trace (green is InstantiateFunction), optimization starts after ~35s:
@kparzysz
Contributor guide
Research direction
Start with OpenMPDecompositionTest.cpp and the attached time trace, focusing on the visitor pattern, large variant types, and InstantiateFunction time. Compare compile-time behavior before and after any redesign, and verify that the test’s existing coverage and behavior remain intact while compilation is substantially faster.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- performance, testing-qa
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100