This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Run an extra 'OpenMPOpt' pass in LTO-mode
ClosedPublic

Authored by jhuber6 on Jan 26 2023, 9:31 AM.

Details

Summary

The OpenMPOpt pass is pivotal to the performance of many OpenMP
offloading programs. When we perform non-LTO builds with OpenMP we used
to link the OpenMP deviceRTL individually for each TU. This lead to us
getting an additional attributor run on the combined runtime and user
code. When we used LTO we lost a run and suffered a large performance
degradation. This patch simply adds in the extra OpenMPOpt pass that
we miss into the LTO pipeline. This patch fixes the performance
regression shown in applications that used OpenMP offloading in LTO
mode.

Previously, this wasn't legal to do as we could emit new runtime calls
into the module. That was fixed by D142646.

Depends on D142646

Fixes https://github.com/llvm/llvm-project/issues/60300

Diff Detail

Event Timeline

jhuber6 created this revision.Jan 26 2023, 9:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 26 2023, 9:31 AM
jhuber6 requested review of this revision.Jan 26 2023, 9:31 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
jdoerfert accepted this revision.Jan 26 2023, 11:11 AM

LG, one nit.

llvm/lib/Passes/PassBuilderPipelines.cpp
1723

Move it before DCE, maybe even before the GlobalOpt pass.

This revision is now accepted and ready to land.Jan 26 2023, 11:11 AM
This revision was landed with ongoing or failed builds.Jan 26 2023, 11:24 AM
This revision was automatically updated to reflect the committed changes.