Always use cuda.h to detect CUDA version. It's a more universal approach compared to version.txt which is no longer present in recent CUDA versions. Split the 'unknown CUDA version' warning in two: * when detected CUDA version is partially supported by clang. It's expected to work in general, at the feature parity with the latest supported CUDA version. and may be missing support for the new features/instructions/GPU variants. Clang will issue a warning. * when detected version is new. Recent CUDA versions have been working with clang reasonably well, and will likely to work similarly to the partially supported ones above. Or it may not work at all. Clang will issue a warning and proceed as if the latest known CUDA version was detected. Differential Revision: https://reviews.llvm.org/D108247
77 lines
4.1 KiB
Plaintext
77 lines
4.1 KiB
Plaintext
// REQUIRES: clang-driver
|
|
// REQUIRES: x86-registered-target
|
|
// REQUIRES: nvptx-registered-target
|
|
|
|
// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_20 --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \
|
|
// RUN: FileCheck %s --check-prefix=OK
|
|
// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_20 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda 2>&1 %s | \
|
|
// RUN: FileCheck %s --check-prefix=OK
|
|
// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda 2>&1 %s | \
|
|
// RUN: FileCheck %s --check-prefix=OK
|
|
// Test version guess when cuda.h has not been found
|
|
// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA-unknown/usr/local/cuda 2>&1 %s | \
|
|
// RUN: FileCheck %s --check-prefix=UNKNOWN_VERSION
|
|
// Unknown version info present in cuda.h
|
|
// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA-new/usr/local/cuda 2>&1 %s | \
|
|
// RUN: FileCheck %s --check-prefix=UNKNOWN_VERSION
|
|
// Make sure that we don't warn about CUDA version during C++ compilation.
|
|
// RUN: %clang --target=x86_64-linux -v -### -x c++ --cuda-gpu-arch=sm_60 \
|
|
// RUN: --cuda-path=%S/Inputs/CUDA-unknown/usr/local/cuda 2>&1 %s | \
|
|
// RUN: FileCheck %s --check-prefix=UNKNOWN_VERSION_CXX
|
|
|
|
// The installation at Inputs/CUDA is CUDA 7.0, which doesn't support sm_60.
|
|
// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \
|
|
// RUN: FileCheck %s --check-prefix=ERR_SM60
|
|
|
|
// This should only complain about sm_60, not sm_35.
|
|
// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-gpu-arch=sm_35 \
|
|
// RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \
|
|
// RUN: FileCheck %s --check-prefix=ERR_SM60 --check-prefix=OK_SM35
|
|
|
|
// We should get two errors here, one for sm_60 and one for sm_61.
|
|
// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-gpu-arch=sm_61 \
|
|
// RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \
|
|
// RUN: FileCheck %s --check-prefix=ERR_SM60 --check-prefix=ERR_SM61
|
|
|
|
// We should still get an error if we pass -nocudainc, because this compilation
|
|
// would invoke ptxas, and we do a version check on that, too.
|
|
// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 -nocudainc --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \
|
|
// RUN: FileCheck %s --check-prefix=ERR_SM60
|
|
|
|
// If with -nocudainc and -E, we don't touch the CUDA install, so we
|
|
// shouldn't get an error.
|
|
// RUN: %clang --target=x86_64-linux -v -### -E --cuda-device-only --cuda-gpu-arch=sm_60 -nocudainc \
|
|
// RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \
|
|
// RUN: FileCheck %s --check-prefix=OK
|
|
|
|
// --no-cuda-version-check should suppress all of these errors.
|
|
// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 \
|
|
// RUN: --no-cuda-version-check %s | \
|
|
// RUN: FileCheck %s --check-prefix=OK
|
|
|
|
// We need to make sure the version check is done only for the device toolchain,
|
|
// therefore we should not get an error in host-only mode. We use the -S here
|
|
// to avoid the error being produced in case by the assembler tool, which does
|
|
// the same check.
|
|
// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-host-only --cuda-path=%S/Inputs/CUDA/usr/local/cuda -S 2>&1 %s | \
|
|
// RUN: FileCheck %s --check-prefix=OK
|
|
// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-device-only --cuda-path=%S/Inputs/CUDA/usr/local/cuda -S 2>&1 %s | \
|
|
// RUN: FileCheck %s --check-prefix=ERR_SM60
|
|
|
|
// OK-NOT: error: GPU arch
|
|
|
|
// OK_SM35-NOT: error: GPU arch sm_35
|
|
|
|
// We should only get one error per architecture.
|
|
// ERR_SM20: error: GPU arch sm_20 {{.*}}
|
|
// ERR_SM20-NOT: error: GPU arch sm_20
|
|
|
|
// ERR_SM60: error: GPU arch sm_60 {{.*}}
|
|
// ERR_SM60-NOT: error: GPU arch sm_60
|
|
|
|
// ERR_SM61: error: GPU arch sm_61 {{.*}}
|
|
// ERR_SM61-NOT: error: GPU arch sm_61
|
|
|
|
// UNKNOWN_VERSION: CUDA version is newer than the latest{{.*}} supported version
|
|
// UNKNOWN_VERSION_CXX-NOT: unknown CUDA version
|