This is an archive of the discontinued LLVM Phabricator instance.

[HIP] Fix environment variable HIP_DEVICE_LIB_PATH
ClosedPublic

Authored by yaxunl on Jan 23 2020, 2:34 PM.

Details

Summary

Currently device lib path set by environment variable HIP_DEVICE_LIB_PATH
does not work due to extra "-L" added to each entry.

This patch fixes that by allowing argument name to be empty in addDirectoryList.

Diff Detail

Event Timeline

yaxunl created this revision.Jan 23 2020, 2:34 PM
tra added a comment.Jan 23 2020, 3:05 PM

If user sets HIP_DEVICE_LIB_PATH, this line in HIP.cpp
addDirectoryList(DriverArgs, LibraryPaths, "-L", "HIP_DEVICE_LIB_PATH");
adds -L<value of env var HIP_DEVICE_LIB_PATH> to LibraryPaths. -L is
needed since otherwise addDirectoryList will insert an extra empty string.
However, the -L must be stripped before checking for existence in addBCLib.

The fact that "-I" and "-L" are prepended to the paths is an implementation detail.
IMO it would be better to fix addDirectoryList() so it can deal with empty prefixes, and document it in the CommonArgs.h.

yaxunl updated this revision to Diff 240074.Jan 23 2020, 5:47 PM
yaxunl edited the summary of this revision. (Show Details)

Revised by Artem's comments.

tra accepted this revision.Jan 24 2020, 5:20 PM
This revision is now accepted and ready to land.Jan 24 2020, 5:20 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJan 28 2020, 8:30 AM
thakis added a subscriber: thakis.Jan 28 2020, 10:49 AM

This breaks check-clang on Windows: http://45.33.8.238/win/6843/step_7.txt

You probably want "env FOO=bar" instead of "FOO=bar" in the test file.

This breaks check-clang on Windows: http://45.33.8.238/win/6843/step_7.txt

You probably want "env FOO=bar" instead of "FOO=bar" in the test file.

Fixed. Thanks.