This is an archive of the discontinued LLVM Phabricator instance.

[libomptarget] Build amdgpu plugin without hsa
ClosedPublic

Authored by JonChesterfield on Jul 22 2021, 2:47 PM.

Details

Summary

Default to building the amdgpu plugin to use dlopen when hsa is
not found instead of disabling it.

Diff Detail

Event Timeline

JonChesterfield requested review of this revision.Jul 22 2021, 2:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 22 2021, 2:47 PM
JonChesterfield added a comment.EditedJul 22 2021, 3:00 PM

Previous patches have simplified the dependencies of this plugin to increase portability. The plugin uses headers from LLVM and the libelf library, as well as pthreads and dlopen. Libelf was, until recently, used by other plugins in libomptarget so is likely to be available on the build machines.

This may fail to build on CI, or in the field, as it will try to build the plugin on any machine that is compiling libomptarget. If libelf is missing the plugin should be skipped by existing logic in the cmake script.

This may fail to build on CI, or in the field, as it will try to build the plugin on any machine that is compiling libomptarget.

That worries me. Why would it fail and how would we check and avoid it?

I know of no failure modes. Missing libelf should be handled gracefully by skipping the plugin.

I believe it has only been built on x64 and ppc so far. Libomptarget probably builds on aarch64, maybe others.

We could avoid it failing under CI by running the build on all the machines of CI before commit, but I don't think we have the infra in place to do that.

In case the above is unclear, I'm reasonably sure this will go through CI fine.

In case it breaks on a platform I haven't thought about, I want whoever runs into that to feel empowered to summarily revert this toggle with a comment about how it broke them.

jdoerfert accepted this revision.Jul 25 2021, 10:30 AM

I know of no failure modes

LG then.

This revision is now accepted and ready to land.Jul 25 2021, 10:30 AM
This revision was automatically updated to reflect the committed changes.
JonChesterfield reopened this revision.Jul 25 2021, 3:21 PM

Reopening. The patch to enable dlopen'ed HSA didn't take into account that the plugin would be initialised by libomptarget if it existed at all, even if HSA was not present, and the error path handling for a missing HSA library was not good. Patched in D106774. Will reland this once that goes through CI, having now checked that behaviour is reasonable on a machine with no HSA library available at runtime (uses the host fallback, without segfaulting).

This revision is now accepted and ready to land.Jul 25 2021, 3:21 PM
This revision was automatically updated to reflect the committed changes.