This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Make clang argument handling for the new driver more generic
ClosedPublic

Authored by jhuber6 on Apr 7 2022, 7:57 AM.

Details

Summary

In preparation for accepting other offloading kinds with the new driver,
this patch makes the way we handle offloading actions more generic. A
new field to get the associated device action's toolchain is used rather
than manually iterating a list. This makes building the arguments easier
and makes sure that we doin't rely on any implicit ordering.

Diff Detail

Event Timeline

jhuber6 created this revision.Apr 7 2022, 7:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2022, 7:57 AM
jhuber6 requested review of this revision.Apr 7 2022, 7:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2022, 7:57 AM
jhuber6 updated this revision to Diff 423461.Apr 18 2022, 1:24 PM

Rebase after making the new driver default.

jhuber6 updated this revision to Diff 423466.Apr 18 2022, 1:50 PM

Fix for real after rebasing failure...

jhuber6 updated this revision to Diff 423468.Apr 18 2022, 2:12 PM

Sorry for the spam

jhuber6 updated this revision to Diff 423470.Apr 18 2022, 2:16 PM

Fix after fix.

jhuber6 updated this revision to Diff 423478.Apr 18 2022, 3:28 PM

Hopefully this is the last time I need to update this

yaxunl added inline comments.Apr 19 2022, 10:02 AM
clang/lib/Driver/ToolChains/Clang.cpp
6949–6953

Linux path may contain ',' which cannot be passed by this option.

We've seen similar issues with -inputs= option of clang-offload-bundler. To solve that issue, we had to add support of multiple -input= options.

jhuber6 added inline comments.Apr 19 2022, 10:06 AM
clang/lib/Driver/ToolChains/Clang.cpp
6949–6953

Ugh, you could probably split this starting from the end since we assume it will always end with at least three commas, but that's not a satisfying solution. I've been pondering creating a new tool to do this, but haven't quite decided how that should look. I'd imagine it would basically behave like how we invoke fatbinary.

This issue isn't related to this patch, so I'll probably just parse it in reverse upstream, thanks for bringing this up.

yaxunl added inline comments.Apr 19 2022, 10:20 AM
clang/lib/Driver/ToolChains/Clang.cpp
6949–6953

I agree the issue is orthogonal to this patch.

Parsing backward is an option. Another option is to put file name at the end of the option. Maybe the latter is less confusing.

yaxunl accepted this revision.Apr 27 2022, 3:10 PM

LGTM. Thanks.

This revision is now accepted and ready to land.Apr 27 2022, 3:10 PM
This revision was landed with ongoing or failed builds.Apr 29 2022, 6:14 AM
This revision was automatically updated to reflect the committed changes.