This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Add Cuda path to linker wrapper tool
ClosedPublic

Authored by jhuber6 on Feb 3 2022, 1:46 PM.

Details

Summary

The linker wrapper tool uses the 'nvlink' and 'ptxas' binaries to link
and assemble device files. Previously we searched for this using the
binaries in the user's path. This didn't work in cases where the user
passed in a specific Cuda path to Clang. This patch changes the linker
wrapper to accept an argument for the Cuda path we can get from Clang.
This should fix #53573.

Diff Detail

Event Timeline

jhuber6 created this revision.Feb 3 2022, 1:46 PM
jhuber6 requested review of this revision.Feb 3 2022, 1:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 3 2022, 1:46 PM

Thanks for the fix

clang/lib/Driver/ToolChains/Clang.cpp
8151–8152

[style] Avoid "Almost Always Auto"

8161–8162

Since there is no break, would this potentially add multiple --cuda-path?

8184

[nit] unrelated rename

8259–8262

Is moving this relevant?

clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
102–103

[nit] unrelated whitespace change

jhuber6 added inline comments.Feb 3 2022, 2:08 PM
clang/lib/Driver/ToolChains/Clang.cpp
8161–8162

Right now the tool chains are initialized based on triples. I don't think it's technically possible for the user to perform an action like -fopenmp-targets=nvptx64-nvidia-cuda,nvptx-nvidia-cuda. The flag is listed ZeroOrMore, so I'm not sure if it's worth explicitly preventing, we'll just take the most recently passed in one.

8184

Avoids shadowing the new D I added.

8259–8262

No, but I wanted to move it so I figured I might as well while I'm here, similar with the other unrelated changes.

jhuber6 updated this revision to Diff 405783.Feb 3 2022, 2:10 PM

Address style.

jhuber6 updated this revision to Diff 405785.Feb 3 2022, 2:14 PM

Decided to add break.

tianshilei1992 added inline comments.Feb 3 2022, 2:25 PM
clang/lib/Driver/ToolChains/Clang.cpp
8163

Would be better to keep aligned with clang to use --cuda-path.

jhuber6 updated this revision to Diff 405799.Feb 3 2022, 2:37 PM

Use long version.

This revision is now accepted and ready to land.Feb 3 2022, 3:41 PM
This revision was landed with ongoing or failed builds.Feb 3 2022, 5:39 PM
This revision was automatically updated to reflect the committed changes.