This is an archive of the discontinued LLVM Phabricator instance.

[HIP] Move HIP Linking Logic into HIP ToolChain
ClosedPublic

Authored by ashi1 on Jun 16 2020, 12:51 PM.

Details

Summary

This patch is a follow up on https://reviews.llvm.org/D78759.

Extract the HIP Linker script from generic GNU linker,
and move it into HIP ToolChain. Update OffloadActionBuilder
Link actions feature to apply device linking and host linking
actions separately.

Diff Detail

Event Timeline

ashi1 created this revision.Jun 16 2020, 12:51 PM
JonChesterfield accepted this revision.Jun 16 2020, 1:42 PM

This looks great to me. A bunch of HIP specific code moving out of generic code and into HIP specific files. The host / device split in the driver looks reasonable and similar to existing code. I especially like that all the changes to tests are under HIP.

One request - I'd like this to land before D78759 instead of after. Cleanup then extend as opposed to extend then cleanup. Primarily so that this patch doesn't get lost if D78759 stalls further or ends up getting reverted.

Thanks!

This revision is now accepted and ready to land.Jun 16 2020, 1:42 PM
ashi1 added a comment.Jun 16 2020, 2:18 PM

This looks great to me. A bunch of HIP specific code moving out of generic code and into HIP specific files. The host / device split in the driver looks reasonable and similar to existing code. I especially like that all the changes to tests are under HIP.

One request - I'd like this to land before D78759 instead of after. Cleanup then extend as opposed to extend then cleanup. Primarily so that this patch doesn't get lost if D78759 stalls further or ends up getting reverted.

Thanks!

Sounds good, I am working on that now and will update this patch to be standalone.

The only thing that concerns me is that you called clang-offload-unbundler twice to unbundle a fat binary, one for host, one for device. One call of clang-offload-unbundler is supposed to unbundle everything.

ashi1 updated this revision to Diff 271210.Jun 16 2020, 2:40 PM
ashi1 added projects: Restricted Project, Restricted Project.

I've updated this patch so it doesn't have dependence on the static-lib patch.

This patch can be submitted standalone.

ashi1 added a comment.Jun 17 2020, 8:20 AM

The only thing that concerns me is that you called clang-offload-unbundler twice to unbundle a fat binary, one for host, one for device. One call of clang-offload-unbundler is supposed to unbundle everything.

You are right, I am looking into this.

@yaxunl - I am looking into the bundler issue. Is it okay to commit these current patches first, while we look into that bug? This patch should only affect HIP.

yaxunl accepted this revision.Jun 22 2020, 11:24 AM

LGTM. Thanks.

This revision was automatically updated to reflect the committed changes.

Hi, your git commit contains extra Phabricator tags. You can drop Reviewers: Subscribers: Tags: and the text Summary: from the git commit with the following script:

arcfilter () {
        arc amend
        git log -1 --pretty=%B | awk '/Reviewers:|Subscribers:/{p=1} /Reviewed By:|Differential Revision:/{p=0} !p && !/^Summary:$/ {sub(/^Summary: /,"");print}' | git commit --amend --date=now -F -
}

Reviewed By: is considered important by some people. Please keep the tag. (I have updated my script to use --date=now (setting author date to committer date))

https://reviews.llvm.org/D80978 contains a git pre-push hook to automate this.