This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Make Ctor / Dtor functions have external visibility
ClosedPublic

Authored by jhuber6 on Mar 25 2022, 1:39 PM.

Details

Summary

The default construction of constructor functions by LLVM tends to make
them have internal linkage. When we call a ctor / dtor function in the
target region we are actually creating a kernel that is called at
registration. Because the ctor is a kernel we need to make sure it's
externally visible so we can actually call it. This prevented AMDGPU
from correctly using constructors while NVPTX could use them simply
because it ignored internal visibility.

Diff Detail

Event Timeline

jhuber6 created this revision.Mar 25 2022, 1:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 25 2022, 1:39 PM
jhuber6 requested review of this revision.Mar 25 2022, 1:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 25 2022, 1:39 PM
jhuber6 updated this revision to Diff 418321.Mar 25 2022, 2:08 PM

Changing approach, we should optionally use internal linkage for the ctor
creation function since it's not correct to add the internal linkage attributes
and then make it external. Also remove it from the used global since it's not
needed anymore.

JonChesterfield accepted this revision.Mar 25 2022, 2:12 PM

Nice, thanks. Wonder if we want protected visibility as well.

This revision is now accepted and ready to land.Mar 25 2022, 2:12 PM

Nice, thanks. Wonder if we want protected visibility as well.

I'm not actually sure what having protected visibility would do considering it's not applied with -fvisibility=protected like we pass currently.

jhuber6 edited the summary of this revision. (Show Details)Mar 25 2022, 3:44 PM
This revision was landed with ongoing or failed builds.Mar 25 2022, 7:44 PM
This revision was automatically updated to reflect the committed changes.