This is an archive of the discontinued LLVM Phabricator instance.

HIP: Merge builtin library handling
ClosedPublic

Authored by arsenm on Mar 27 2020, 3:55 PM.

Details

Summary

Merge with the new --rocm-path handling used for OpenCL. This looks
for a usable set of device libraries upfront, rather than giving a
generic "no such file or directory error". If any of the required
bitcode libraries are missing, this will now produce a "cannot find
ROCm installation." error. This differs from the existing hip specific
flags by pointing to a rocm root install instead of a single directory
with bitcode files.

This tries to maintain compatibility with the existing the
--hip-device-lib and --hip-device-lib-path flags, as well as the
HIP_DEVICE_LIB_PATH environment variable, or at least the range of
uses with testcases. The existing range of uses and behavior doesn't
entirely make sense to me, so some of the untested edge cases change
behavior. Currently the two path forms seem to have the double purpose
of a search path for an arbitrary --hip-device-lib, and for finding
he stock set of libraries. Since the stock set of libraries This also
changes the behavior when multiple paths are specified, and only takes
the last one (and the environment variable only handles a single
path).

If --hip-device-lib is used, it now only treats --hip-device-lib-path
as the search path for it, and does not attempt to find the rocm
installation. If not, --hip-device-lib-path and the environment
variable are used as the directory to search instead of the rocm root
based path.

This should also automatically fix handling of the options to use
wave64.

Diff Detail

Event Timeline

arsenm created this revision.Mar 27 2020, 3:55 PM
arsenm updated this revision to Diff 257694.Apr 15 2020, 6:15 AM

Update for new library structure

yaxunl added inline comments.Apr 18 2020, 9:31 AM
clang/lib/Driver/ToolChains/HIP.cpp
364

By default this was on. We should keep the old behavior.

arsenm updated this revision to Diff 258562.Apr 18 2020, 3:20 PM

Switch default back for correct sqrt. Also add more checks for all of the linked libs, and fix duplicating wave64 logic

yaxunl accepted this revision.Apr 18 2020, 6:48 PM

LGTM. Thanks.

This revision is now accepted and ready to land.Apr 18 2020, 6:48 PM