This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Extract CUDA version from cuda.h if version.txt is not found
ClosedPublic

Authored by tra on Oct 20 2020, 3:53 PM.

Details

Summary

This is a follow-up to D89752,

If CUDA version can not be determined based on version.txt file, attempt to find CUDA_VERSION macro in cuda.h.

Diff Detail

Event Timeline

tra created this revision.Oct 20 2020, 3:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 20 2020, 3:53 PM
tra requested review of this revision.Oct 20 2020, 3:53 PM
tra updated this revision to Diff 299501.Oct 20 2020, 4:11 PM
tra edited the summary of this revision. (Show Details)

Added more tests.

emankov requested changes to this revision.Oct 22 2020, 2:12 AM
emankov added inline comments.
clang/lib/Driver/ToolChains/Cuda.cpp
76–77

Please, add CudaVersion::CUDA_111 declaration in Cuda.h and a corresponding if here.
Btw, switch is possible here.

This revision now requires changes to proceed.Oct 22 2020, 2:12 AM
jlebar accepted this revision.Oct 22 2020, 10:04 AM

LGTM modulo emankov's comment.

tra added inline comments.Oct 22 2020, 10:14 AM
clang/lib/Driver/ToolChains/Cuda.cpp
76–77

It does not serve any purpose here. 102/110 were added when clang was only accepting specific versions. Now that it will accept any newer version, Arguably it's 102/101 that should be gone until we implement the new functionality. All of that would out of scope for this patch.

As for the switch, it would only work to match exact versions encoded in the CUDA headers, including updates, patches, special private builds etc. I do not have access to all of those versions, so I can not enumerate all of them. Range checking is more robust.

emankov accepted this revision.Oct 22 2020, 11:31 AM
emankov added inline comments.
clang/lib/Driver/ToolChains/Cuda.cpp
76–77

Ok, I can "live" with the latest 110 for a while till the appearing of the new functionality in clang. Thanks!

This revision is now accepted and ready to land.Oct 22 2020, 11:31 AM

I confirm that D89752 eliminates 47332 on Windows. Tested against the following CUDA versions: 7.0, 7,5, 9,2, 10.0, 10,1, 10.2, 11.0 Update 1, 11.1.

tra added a comment.Oct 23 2020, 9:30 AM

I confirm that D89752 eliminates 47332 on Windows. Tested against the following CUDA versions: 7.0, 7,5, 9,2, 10.0, 10,1, 10.2, 11.0 Update 1, 11.1.

Thank you! I appreciate your help testing this patch. I'll land the patches shortly.

D89832 eliminates 47332 on Windows as well. Tested against the same CUDA versions as for D89752.