Currently when -fgpu-rdc is specified, HIP toolchain always does host linking even
if --cuda-device-only is specified.
This patch fixes that. Only device linking is performed when --cuda-device-only
is specified.
| Paths 
 |  Differential  D116840  
[HIP] Fix device only linking for -fgpu-rdc ClosedPublic Authored by yaxunl on Jan 7 2022, 2:28 PM. 
Details 
 Summary Currently when -fgpu-rdc is specified, HIP toolchain always does host linking even This patch fixes that. Only device linking is performed when --cuda-device-only 
Diff Detail 
 Event Timeline
 
 This revision is now accepted and ready to land.Jan 10 2022, 10:31 AM This revision was landed with ongoing or failed builds.Jan 10 2022, 2:38 PM Closed by commit rG98ab43a1d209: [HIP] Fix device only linking for -fgpu-rdc (authored by yaxunl).  ·  Explain Why This revision was automatically updated to reflect the committed changes. 
Revision Contents 
 
Diff 398747 clang/lib/Driver/Driver.cpp
 clang/test/Driver/hip-phases.hip
 clang/test/Driver/hip-toolchain-rdc-separate.hip
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Doing clear() in a function intended to append looks suspicious.
We may potentially discard whatever was in AL on entry to the function, plus whatever has been added per DeviceLinkerInputs.
I wonder if a better API would be to return a new action list, instead of modifying one.
At the very least I'd like to see a comment explaining what's going on here and, maybe, some assertions (e.g. if we expect AL to be empty on entry).