91 lines · c
1// Needs chmod2// UNSUPPORTED: system-windows3// XFAIL: target={{.*}}-zos{{.*}}4 5// RUN: mkdir -p %t6// RUN: cp %S/Inputs/amdgpu-arch/amdgpu_arch_fail %t/7// RUN: cp %S/Inputs/amdgpu-arch/amdgpu_arch_gfx906 %t/8// RUN: cp %S/Inputs/nvptx-arch/nvptx_arch_fail %t/9// RUN: cp %S/Inputs/nvptx-arch/nvptx_arch_sm_70 %t/10// RUN: cp %S/Inputs/offload-arch/offload_arch_sm_70_gfx906 %t/11// RUN: echo '#!/bin/sh' > %t/amdgpu_arch_empty12// RUN: chmod +x %t/amdgpu_arch_fail13// RUN: chmod +x %t/amdgpu_arch_gfx90614// RUN: chmod +x %t/amdgpu_arch_empty15// RUN: echo '#!/bin/sh' > %t/nvptx_arch_empty16// RUN: chmod +x %t/nvptx_arch_fail17// RUN: chmod +x %t/nvptx_arch_sm_7018// RUN: chmod +x %t/nvptx_arch_empty19// RUN: chmod +x %t/offload_arch_sm_70_gfx90620 21// case when nvptx-arch and amdgpu-arch return nothing or fails22// RUN: not %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -fopenmp=libomp --offload-arch=native \23// RUN: --nvptx-arch-tool=%t/nvptx_arch_fail --amdgpu-arch-tool=%t/amdgpu_arch_fail %s 2>&1 \24// RUN: | FileCheck %s --check-prefix=NO-OUTPUT-ERROR25// RUN: not %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -fopenmp=libomp --offload-arch=native \26// RUN: --nvptx-arch-tool=%t/nvptx_arch_empty --amdgpu-arch-tool=%t/amdgpu_arch_empty %s 2>&1 \27// RUN: | FileCheck %s --check-prefix=NO-OUTPUT-ERROR28// NO-OUTPUT-ERROR: error: cannot determine openmp architecture29 30// case when amdgpu-arch succeeds.31// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -fopenmp=libomp --offload-arch=native \32// RUN: --nvptx-arch-tool=%t/nvptx_arch_fail --amdgpu-arch-tool=%t/amdgpu_arch_gfx906 %s 2>&1 \33// RUN: | FileCheck %s --check-prefix=ARCH-GFX90634// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -fopenmp=libomp -fopenmp-targets=amdgcn-amd-amdhsa \35// RUN: --nvptx-arch-tool=%t/nvptx_arch_fail --amdgpu-arch-tool=%t/amdgpu_arch_gfx906 %s 2>&1 \36// RUN: | FileCheck %s --check-prefix=ARCH-GFX90637// ARCH-GFX906: "-cc1" "-triple" "amdgcn-amd-amdhsa"{{.*}}"-target-cpu" "gfx906"38 39// case when nvptx-arch succeeds.40// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -fopenmp=libomp --offload-arch=native \41// RUN: --amdgpu-arch-tool=%t/amdgpu_arch_fail --nvptx-arch-tool=%t/nvptx_arch_sm_70 %s 2>&1 \42// RUN: | FileCheck %s --check-prefix=ARCH-SM_7043// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \44// RUN: --amdgpu-arch-tool=%t/amdgpu_arch_fail --nvptx-arch-tool=%t/nvptx_arch_sm_70 %s 2>&1 \45// RUN: | FileCheck %s --check-prefix=ARCH-SM_7046// ARCH-SM_70: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-target-cpu" "sm_70"47 48// case when both nvptx-arch and amdgpu-arch succeed.49// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -fopenmp=libomp --offload-arch=native \50// RUN: --offload-arch-tool=%t/offload_arch_sm_70_gfx906 %s 2>&1 \51// RUN: | FileCheck %s --check-prefix=ARCH-SM_70-GFX90652// ARCH-SM_70-GFX906: "-cc1" "-triple" "amdgcn-amd-amdhsa"{{.*}}"-target-cpu" "gfx906"53// ARCH-SM_70-GFX906: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-target-cpu" "sm_70"54 55// case when both nvptx-arch and amdgpu-arch succeed with other archs.56// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -fopenmp=libomp --offload-arch=native,sm_75,gfx1030 \57// RUN: --offload-arch-tool=%t/offload_arch_sm_70_gfx906 %s 2>&1 \58// RUN: | FileCheck %s --check-prefix=ARCH-MULTIPLE59// ARCH-MULTIPLE: "-cc1" "-triple" "amdgcn-amd-amdhsa"{{.*}}"-target-cpu" "gfx1030"60// ARCH-MULTIPLE: "-cc1" "-triple" "amdgcn-amd-amdhsa"{{.*}}"-target-cpu" "gfx906"61// ARCH-MULTIPLE: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-target-cpu" "sm_70"62// ARCH-MULTIPLE: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-target-cpu" "sm_75"63 64// case when 'nvptx-arch' returns nothing using `-fopenmp-targets=`.65// RUN: not %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -fopenmp=libomp \66// RUN: -fopenmp-targets=nvptx64-nvidia-cuda --nvptx-arch-tool=%t/nvptx_arch_empty %s 2>&1 \67// RUN: | FileCheck %s --check-prefix=NVPTX68// NVPTX: error: cannot determine nvptx64 architecture: No NVIDIA GPU detected in the system; consider passing it via '--offload-arch'69 70// case when 'amdgpu-arch' returns nothing using `-fopenmp-targets=`.71// RUN: not %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -fopenmp=libomp \72// RUN: -fopenmp-targets=amdgcn-amd-amdhsa --amdgpu-arch-tool=%t/amdgpu_arch_empty %s 2>&1 \73// RUN: | FileCheck %s --check-prefix=AMDGPU74// AMDGPU: error: cannot determine amdgcn architecture: No AMD GPU detected in the system; consider passing it via '--offload-arch'75 76// case when CLANG_TOOLCHAIN_PROGRAM_TIMEOUT is malformed for nvptx-arch.77// RUN: env CLANG_TOOLCHAIN_PROGRAM_TIMEOUT=foo \78// RUN: not %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \79// RUN: -fopenmp-targets=nvptx64-nvidia-cuda -nogpulib \80// RUN: --nvptx-arch-tool=%t/nvptx_arch_sm_70 %s 2>&1 | \81// RUN: FileCheck %s --check-prefix=BAD-TIMEOUT-NVPTX82// BAD-TIMEOUT-NVPTX: clang: error: cannot determine nvptx64 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)83 84// case when CLANG_TOOLCHAIN_PROGRAM_TIMEOUT is malformed for amdgpu-arch.85// RUN: env CLANG_TOOLCHAIN_PROGRAM_TIMEOUT= \86// RUN: not %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \87// RUN: -fopenmp-targets=amdgcn-amd-amdhsa -nogpulib \88// RUN: --amdgpu-arch-tool=%t/amdgpu_arch_gfx906 %s 2>&1 | \89// RUN: FileCheck %s --check-prefix=BAD-TIMEOUT-AMDGPU90// BAD-TIMEOUT-AMDGPU: clang: error: cannot determine amdgcn architecture: CLANG_TOOLCHAIN_PROGRAM_TIMEOUT expected an integer, got ''; consider passing it via '--offload-arch'; environment variable CLANG_TOOLCHAIN_PROGRAM_TIMEOUT specifies the tool timeout (integer secs, <=0 is infinite)91