This is an archive of the discontinued LLVM Phabricator instance.

[HIP] Ignore host linker flags for device-only
ClosedPublic

Authored by scchan on Jul 10 2023, 1:06 PM.

Details

Summary

When compiling in device only mode (e.g. --offload-device-only), the
host linker phase would not happen and therefore, the driver should
ignore all the host linker flags.

Diff Detail

Event Timeline

scchan created this revision.Jul 10 2023, 1:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 10 2023, 1:06 PM
scchan requested review of this revision.Jul 10 2023, 1:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 10 2023, 1:06 PM
yaxunl added inline comments.Jul 10 2023, 1:25 PM
clang/lib/Driver/Driver.cpp
4153

The --hip-link -fgpu-rdc --offload-device-only case needs to add the linker inputs e.g. archive of bundled bitcodes. Need a test to make sure that still works.

Also you need to use Driver::offloadDeviceOnly() to check whether it is device compilation only

scchan updated this revision to Diff 539173.Jul 11 2023, 10:03 AM

addressed comments from yaxunl, rebased

scchan marked an inline comment as done.Jul 11 2023, 10:04 AM
yaxunl added inline comments.Jul 13 2023, 1:05 PM
clang/test/Driver/hip-phases.hip
276

need to check RELOC-NOT: host

304

need to check RELOC2-NOT: host

425

need to check RL2-DEV-NOT: host

scchan updated this revision to Diff 540481.Jul 14 2023, 10:22 AM

added extra checks for not host, rebased

scchan marked 3 inline comments as done.Jul 14 2023, 10:24 AM
yaxunl accepted this revision.Jul 14 2023, 10:37 AM

LGTM. Thanks.

This revision is now accepted and ready to land.Jul 14 2023, 10:37 AM
scchan updated this revision to Diff 541060.Jul 17 2023, 8:37 AM

minor formatting fixes, rebased

This revision was automatically updated to reflect the committed changes.