Page MenuHomePhabricator

[CUDA] Add support for 11.1
Needs ReviewPublic

Authored by kiwixz on Oct 1 2020, 9:12 AM.

Details

Reviewers
jlebar
tra
Summary

It looks like 11.1 doesn't have a version.txt file, so I changed the default guess in this case from CUDA 7.0 to 11.1.

Diff Detail

Unit TestsFailed

TimeTest
50 mslinux > Clang.Driver::cuda-detect-path.cu
Script: -- : 'RUN: at line 7'; env PATH=/mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/Inputs/CUDA/usr/local/cuda/bin /mnt/disks/ssd0/agent/llvm-project/build/bin/clang -v --target=i386-unknown-linux --sysroot=/mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/no-cuda-there 2>&1 | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/cuda-detect-path.cu
130 mslinux > Clang.Driver::cuda-detect.cu
Script: -- : 'RUN: at line 6'; /mnt/disks/ssd0/agent/llvm-project/build/bin/clang -v --target=i386-unknown-linux --sysroot=/mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/no-cuda-there --cuda-path-ignore-env 2>&1 | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/cuda-detect.cu -check-prefix NOCUDA
30 mslinux > Clang.Driver::cuda-macosx.cu
Script: -- : 'RUN: at line 5'; /mnt/disks/ssd0/agent/llvm-project/build/bin/clang -v --target=i386-apple-macosx --sysroot=/mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/Inputs/CUDA-macosx --cuda-path-ignore-env 2>&1 | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/cuda-macosx.cu
70 mslinux > Clang.Driver::cuda-version-check.cu
Script: -- : 'RUN: at line 5'; /mnt/disks/ssd0/agent/llvm-project/build/bin/clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_20 --cuda-path=/mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/Inputs/CUDA/usr/local/cuda 2>&1 /mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/cuda-version-check.cu | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/cuda-version-check.cu --check-prefix=OK
320 mslinux > Clang.Driver::cuda-windows.cu
Script: -- : 'RUN: at line 5'; /mnt/disks/ssd0/agent/llvm-project/build/bin/clang -v --target=i386-pc-windows-msvc --sysroot=/mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/Inputs/CUDA-windows 2>&1 /mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/cuda-windows.cu -### | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/cuda-windows.cu
View Full Test Results (7 Failed)

Event Timeline

kiwixz created this revision.Oct 1 2020, 9:12 AM
kiwixz requested review of this revision.Oct 1 2020, 9:12 AM
jlebar added a comment.Oct 1 2020, 9:18 AM

It looks like 11.1 doesn't have a version.txt file

Yikes, this is a problem if we can't tell the difference between CUDA versions!

kiwixz added a comment.Oct 1 2020, 9:21 AM

It looks like 11.1 doesn't have a version.txt file

Yikes, this is a problem if we can't tell the difference between CUDA versions!

It looks like a blunder from NVIDIA, CUDA 11.1 actually miss most of the documentation (pdf files etc).

tra added a comment.Oct 1 2020, 9:42 AM

Generally speaking the default should be conservative. It does us no good if we generate PTX 99.99, but discover that ptxas does not support it. Granted, these days 7.0 is also the wrong default as it's pretty ancient. IMO bumping it to 9.0 and GPU arch to sm_30 would be sensible.

Now, as for the missing version file, we should probably allow explicitly specifying the version. We already do it for HIP.

clang/lib/Driver/ToolChains/Cuda.cpp
662

I do not think LLVM has this feature implemented. I'm not sure how it reacts to clang specifying non-existing feature.

tra added a comment.Nov 2 2020, 2:33 PM

This patch is also missing corresponding LLVM changes that define features for sm_86 and ptx71.
See https://github.com/llvm/llvm-project/blob/master/llvm/lib/Target/NVPTX/NVPTX.td

clang/lib/Driver/ToolChains/Cuda.cpp
158–160

This should not be needed any more. Clang now extracts CUDA version from cuda.h.