This is an archive of the discontinued LLVM Phabricator instance.

[libomptarget][cuda] Detect missing symbols in plugin at build time
ClosedPublic

Authored by JonChesterfield on Nov 25 2020, 4:39 PM.

Details

Summary

[libomptarget][cuda] Detect missing symbols in plugin at build time

Passes -z,defs to the linker. Error on unresolved symbol references.

Otherwise, those unresolved symbols present as target code running on the host
as the plugin fails to load. This is significantly harder to debug than a link
time error. Flag matches that passed by amdgcn and ve plugins.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptNov 25 2020, 4:39 PM
JonChesterfield requested review of this revision.Nov 25 2020, 4:39 PM

This is a nice change, but not all plugins can implement all interfaces listed in exports. For example, if the plugin doesn't support async operations, then those interfaces suffix with _async will not be implemented by the plugin, and libomptarget can acknowledge that because dlopen returns nullptr.

JonChesterfield added a comment.EditedNov 25 2020, 6:48 PM

True but orthogonal. This will raise a link error on libomptarget.rtl.cuda.so if it has symbols that are not resolved by the dynamic libraries it is linked against. E.g. amdgpu links with this and doesn't yet implement the device to device copy function.

Otherwise, the same missing symbol causes dlopen to fail when libomptarget tries to load the plugin.

edit: s/dlopen/dlsym/

This revision is now accepted and ready to land.Nov 26 2020, 10:51 AM