This is an archive of the discontinued LLVM Phabricator instance.

[HIP] Enable -amdgpu-internalize-symbols
ClosedPublic

Authored by yaxunl on Jun 16 2020, 12:33 PM.

Details

Summary

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.

Diff Detail

Event Timeline

yaxunl created this revision.Jun 16 2020, 12:33 PM

Isn't the internalization implied by LTO? I thought part of the appeal of LTO is killing this off

Isn't the internalization implied by LTO? I thought part of the appeal of LTO is killing this off

How does LTO know that the kernels need to be kept?

rampitec accepted this revision.Jun 16 2020, 2:35 PM

LGTM, thanks!

This revision is now accepted and ready to land.Jun 16 2020, 2:35 PM
arsenm added inline comments.Jun 16 2020, 7:34 PM
clang/lib/Driver/ToolChains/HIP.cpp
64–65

We should probably add an lld driver flag for this rather than relying on the backend option? Is there some regular way to specify internalization that could add the target pass instead?

yaxunl marked an inline comment as done.Jun 18 2020, 8:48 AM
yaxunl added inline comments.
clang/lib/Driver/ToolChains/HIP.cpp
64–65

the current approach should work. I will do restructuring later.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 18 2020, 1:42 PM