53 lines · c
1// UNSUPPORTED: system-windows2// XFAIL: target={{.*}}-zos{{.*}}3 4// RUN: mkdir -p %t5// RUN: cp %S/Inputs/nvptx-arch/nvptx_arch_fail %t/6// RUN: cp %S/Inputs/nvptx-arch/nvptx_arch_sm_70 %t/7// RUN: cp %S/Inputs/nvptx-arch/nvptx_arch_sm_89_sm_80 %t/8// RUN: echo '#!/bin/sh' > %t/nvptx_arch_empty9// RUN: chmod +x %t/nvptx_arch_fail10// RUN: chmod +x %t/nvptx_arch_sm_7011// RUN: chmod +x %t/nvptx_arch_sm_89_sm_8012// RUN: chmod +x %t/nvptx_arch_empty13 14// case when nvptx-arch returns nothing or fails15// RUN: not %clang -### --target=x86_64-unknown-linux-gnu -nogpulib --offload-arch=native --nvptx-arch-tool=%t/nvptx_arch_fail -x cuda %s 2>&1 \16// RUN: | FileCheck %s --check-prefix=NO-OUTPUT-ERROR17// RUN: not %clang -### --target=x86_64-unknown-linux-gnu -nogpulib --offload-new-driver --offload-arch=native --nvptx-arch-tool=%t/nvptx_arch_fail -x cuda %s 2>&1 \18// RUN: | FileCheck %s --check-prefix=NO-OUTPUT-ERROR19// NO-OUTPUT-ERROR: error: cannot determine cuda architecture{{.*}}; consider passing it via '--offload-arch'20 21// case when nvptx-arch does not return anything with successful execution22// RUN: not %clang -### --target=x86_64-unknown-linux-gnu -nogpulib --offload-arch=native --nvptx-arch-tool=%t/nvptx_arch_empty -x cuda %s 2>&1 \23// RUN: | FileCheck %s --check-prefix=EMPTY-OUTPUT24// RUN: not %clang -### --target=x86_64-unknown-linux-gnu -nogpulib --offload-new-driver --offload-arch=native --nvptx-arch-tool=%t/nvptx_arch_empty -x cuda %s 2>&1 \25// RUN: | FileCheck %s --check-prefix=EMPTY-OUTPUT26// EMPTY-OUTPUT: error: cannot determine cuda architecture: No GPU detected in the system; consider passing it via '--offload-arch'27 28// case when nvptx-arch does not return anything with successful execution29// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib --offload-arch=native --nvptx-arch-tool=%t/nvptx_arch_sm_70 -x cuda --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda %s 2>&1 \30// RUN: | FileCheck %s --check-prefix=ARCH-sm_7031// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib --offload-arch=native --offload-new-driver --nvptx-arch-tool=%t/nvptx_arch_sm_70 -x cuda --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda %s 2>&1 \32// RUN: | FileCheck %s --check-prefix=ARCH-sm_7033// ARCH-sm_70: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-target-cpu" "sm_70"34 35// case when nvptx-arch is used via '-march=native'36// RUN: %clang -### --target=nvptx64-nvidia-cuda -nogpulib -march=native --nvptx-arch-tool=%t/nvptx_arch_sm_70 \37// RUN: --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda %s 2>&1 | FileCheck %s --check-prefix=MARCH-sm_7038// MARCH-sm_70: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-target-cpu" "sm_70"39 40// case when nvptx-arch is used via '-march=native'41// RUN: %clang -### --target=nvptx64-nvidia-cuda -nogpulib -march=native --nvptx-arch-tool=%t/nvptx_arch_sm_89_sm_80 \42// RUN: --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda %s 2>&1 | FileCheck %s --check-prefix=MARCH-sm_8943// MARCH-sm_89: warning: multiple nvptx64 architectures are detected: sm_89, sm_80; only the first one is used for '-march' [-Wmulti-gpu]44// MARCH-sm_89: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-target-cpu" "sm_89"45 46// case when CLANG_TOOLCHAIN_PROGRAM_TIMEOUT is malformed.47// RUN: env CLANG_TOOLCHAIN_PROGRAM_TIMEOUT=foo \48// RUN: not %clang -### --target=x86_64-unknown-linux-gnu -nogpulib \49// RUN: --offload-arch=native --nvptx-arch-tool=%t/nvptx_arch_sm_70 \50// RUN: --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda -x cuda %s 2>&1 | \51// RUN: FileCheck %s --check-prefix=BAD-TIMEOUT52// BAD-TIMEOUT: clang: error: cannot determine cuda architecture: CLANG_TOOLCHAIN_PROGRAM_TIMEOUT expected an integer, got 'foo'; consider passing it via '--offload-arch'; environment variable CLANG_TOOLCHAIN_PROGRAM_TIMEOUT specifies the tool timeout (integer secs, <=0 is infinite)53