Commit Graph

7 Commits

Author SHA1 Message Date
Aaron En Ye Shi c64bb3f736 [HIP] Use default triple in llvm-mc for system ld
The Ubuntu system ld does not recognize the amdgcn-amd-amdhsa target.
Instead the host object with embedded device fat binary should not be
assembled by that triple. It should use default triple, so that the
object is compatible with system ld.

Reviewed By: yaxunl

Differential Revision: https://reviews.llvm.org/D83145
2020-07-07 16:44:51 +00:00
Yaxun (Sam) Liu 8013ce4490 [HIP] Add missing options for lto
Add -mcpu, -mattr, -mllvm, and -save-temps options for lto when necessary.

Differential Revision: https://reviews.llvm.org/D82506
2020-06-26 00:26:05 -04:00
Hiroshi Yamauchi 9da93f5904 [HIP] Improve check patterns to avoid test failures in case string "opt", etc. happens to be in the command path.
Similarly to D82046.

Differential Revision: https://reviews.llvm.org/D82586
2020-06-25 12:18:43 -07:00
Aaron En Ye Shi 4bafb0adcf Add Statically Linked Libraries
Add GNU Static Lib Tool, which supports the --emit-static-lib
flag. For HIP, a static library archive will be created and
consist of HIP Fat Binary host object with the device images embedded.
Using llvm-ar to create the static archive. Also, delete existing
output file to ensure a new archive is created each time.

Reviewers: yaxunl, tra, rjmccall, echristo

Subscribers: echristo, JonChesterfield, scchan, msearles

Differential Revision: https://reviews.llvm.org/D78759
2020-06-22 19:48:49 +00:00
Aaron En Ye Shi 77df5a8283 [HIP] Move HIP Linking Logic into HIP ToolChain
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. Using MC Directives, embed the device images
and define symbols.

Reviewers: JonChesterfield, yaxunl

Subscribers: tra, echristo, jdoerfert, msearles, scchan

Differential Revision: https://reviews.llvm.org/D81963
2020-06-22 19:48:48 +00:00
Yaxun (Sam) Liu c830d517b4 [HIP] Enable -amdgpu-internalize-symbols
Enable -amdgpu-internalize-symbols to eliminate unused functions and global variables
for whole program to speed up compilation and improve performance.

For -fno-gpu-rdc, -amdgpu-internalize-symbols is passed to clang -cc1.

For -fgpu-rdc, -amdgpu-internalize-symbols is passed to lld.

Differential Revision: https://reviews.llvm.org/D81959
2020-06-18 16:34:37 -04:00
Yaxun (Sam) Liu 6752786d65 [HIP] Do not use llvm-link/opt/llc for -fgpu-rdc
This patch is a follow up on https://reviews.llvm.org/D81627.

In addition to default -fno-gpu-rdc case, this patches let
HIP toolchain not use llvm-link/opt/llc to link device code
for -fgpu-rdc case. Instead, uses standard lto.

This will eliminate some redundant optimizations and speed
up the compilation/linking.

Differential Revision: https://reviews.llvm.org/D81861
2020-06-15 21:09:18 -04:00