Page MenuHomePhabricator

[OPENMP]Fix PR41826: symbols visibility in device code.
ClosedPublic

Authored by ABataev on Nov 21 2019, 10:08 AM.

Details

Summary

Currently, we ignore all locality attributes/info when building for
the device and thus all symblos are externally visible and can be
preemted at the runtime. It may lead to incorrect results. We need to
follow the same logic, compiler uses for static/pie builds. But in some
cases changing of dso locality may lead to problems with codegen, so
instead mark external symbols as hidden instead in the device code.

Diff Detail

Event Timeline

ABataev created this revision.Nov 21 2019, 10:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 21 2019, 10:08 AM
Herald added a subscriber: guansong. · View Herald Transcript
This revision is now accepted and ready to land.Nov 25 2019, 9:47 AM
This revision was automatically updated to reflect the committed changes.

@ABataev @jhuber6 and I would like to change this to annotate variables with whatever visibility the user asked for.

Can you recall if the concern about premption here was for the deviceRTL, in which case it can be comprehensively dealt with by internalizing the deviceRTL symbols, or for user defined things in which case we want whatever the linker flag -Bsymbolic maps onto as an IR construct. (<- said construct is dso_local)

@ABataev @jhuber6 and I would like to change this to annotate variables with whatever visibility the user asked for.

Can you recall if the concern about premption here was for the deviceRTL, in which case it can be comprehensively dealt with by internalizing the deviceRTL symbols, or for user defined things in which case we want whatever the linker flag -Bsymbolic maps onto as an IR construct.

Hi, check the original PR, it has all required details. Maybe add a check that if the device is same as the host, then add hidden visibility (to avoid problems with the standard libs etc.), otherwise keep it as is?