This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Assume the latest known CUDA version if we've found an unknown one.
ClosedPublic

Authored by tra on Jan 22 2020, 2:19 PM.

Details

Summary

This makes clang somewhat forward-compatible with new CUDA releases without
having to patch it for every minor release without adding any new functionality.

If an unknown version is found, clang issues a warning (can be disabled with -Wno-cuda-unknown-version)
and assumes that it has detected the latest known version. CUDA releases are usually supersets
of older ones feature-wise, so it should be sufficient to keep released clang versions
working with minor CUDA updates without having to upgrade clang, too.

Diff Detail

Event Timeline

tra created this revision.Jan 22 2020, 2:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 22 2020, 2:19 PM
yaxunl accepted this revision.Jan 27 2020, 8:32 AM

LGTM. Thanks.

This revision is now accepted and ready to land.Jan 27 2020, 8:32 AM
tra updated this revision to Diff 240731.Jan 27 2020, 4:44 PM
tra edited the summary of this revision. (Show Details)

Use std::string instead of Twine which can't be stored.

yaxunl accepted this revision.Jan 28 2020, 9:40 AM

LGTM

This revision was automatically updated to reflect the committed changes.
tra edited the summary of this revision. (Show Details)Jan 28 2020, 10:22 AM
tra added a subscriber: hans.

@hans : that's another candidate for 10.x cherry-pick, if you're OK with it.

hans added a comment.Jan 29 2020, 12:22 PM
In D73231#1845096, @tra wrote:

@hans : that's another candidate for 10.x cherry-pick, if you're OK with it.

Sounds good to me. Cherry-picked in 5777899f146aaa53f598e6978702a7a2725200d7

yaxunl added inline comments.Mar 11 2020, 10:03 AM
clang/lib/Driver/ToolChains/Cuda.cpp
51

We got some issue with this warning.

Basically CudaInstallationDetector is a member of GNU and other host toolchain and this check is done in the ctor.

If a user has latest CUDA SDK installed, clang will always emit a warning. If the user has -Werror set, which is quite common, compilation will always fail.

Is it possible only do this check for CUDA compilation?

Thanks.

tra marked an inline comment as done.Mar 11 2020, 10:38 AM
tra added inline comments.
clang/lib/Driver/ToolChains/Cuda.cpp
51

Agreed. Clang should not warn about this unless it's a CUDA compilation. I'll get it fixed.