1 // REQUIRES: shell 2 // XFAIL: target={{.*}}-zos{{.*}} 3 4 // RUN: mkdir -p %t 5 // RUN: cp %S/Inputs/amdgpu-arch/amdgpu_arch_fail %t/ 6 // RUN: cp %S/Inputs/amdgpu-arch/amdgpu_arch_gfx906 %t/ 7 // RUN: echo '#!/bin/sh' > %t/amdgpu_arch_empty 8 // RUN: chmod +x %t/amdgpu_arch_fail 9 // RUN: chmod +x %t/amdgpu_arch_gfx906 10 // RUN: chmod +x %t/amdgpu_arch_empty 11 12 // case when amdgpu-arch returns nothing or fails 13 // RUN: not %clang -### --target=x86_64-unknown-linux-gnu -nogpulib --offload-arch=native --amdgpu-arch-tool=%t/amdgpu_arch_fail -x hip %s 2>&1 \ 14 // RUN: | FileCheck %s --check-prefix=NO-OUTPUT-ERROR 15 // RUN: not %clang -### --target=x86_64-unknown-linux-gnu -nogpulib --offload-new-driver --offload-arch=native --amdgpu-arch-tool=%t/amdgpu_arch_fail -x hip %s 2>&1 \ 16 // RUN: | FileCheck %s --check-prefix=NO-OUTPUT-ERROR 17 // NO-OUTPUT-ERROR: error: cannot determine amdgcn architecture{{.*}}; consider passing it via '--offload-arch' 18 19 // case when amdgpu-arch does not return anything with successful execution 20 // RUN: not %clang -### --target=x86_64-unknown-linux-gnu -nogpulib --offload-arch=native --amdgpu-arch-tool=%t/amdgpu_arch_empty -x hip %s 2>&1 \ 21 // RUN: | FileCheck %s --check-prefix=EMPTY-OUTPUT 22 // RUN: not %clang -### --target=x86_64-unknown-linux-gnu -nogpulib --offload-new-driver --offload-arch=native --amdgpu-arch-tool=%t/amdgpu_arch_empty -x hip %s 2>&1 \ 23 // RUN: | FileCheck %s --check-prefix=EMPTY-OUTPUT 24 // EMPTY-OUTPUT: error: cannot determine amdgcn architecture: No AMD GPU detected in the system; consider passing it via '--offload-arch' 25 26 // case when amdgpu-arch returns a gfx906 GPU. 27 // RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib --offload-arch=native --amdgpu-arch-tool=%t/amdgpu_arch_gfx906 -x hip %s 2>&1 \ 28 // RUN: | FileCheck %s --check-prefix=ARCH-GFX906 29 // RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib --offload-new-driver --offload-arch=native --amdgpu-arch-tool=%t/amdgpu_arch_gfx906 -x hip %s 2>&1 \ 30 // RUN: | FileCheck %s --check-prefix=ARCH-GFX906 31 // ARCH-GFX906: "-cc1" "-triple" "amdgcn-amd-amdhsa"{{.*}}"-target-cpu" "gfx906" 32 33 // case when CLANG_TOOLCHAIN_PROGRAM_TIMEOUT is malformed. 34 // RUN: env CLANG_TOOLCHAIN_PROGRAM_TIMEOUT=foo \ 35 // RUN: not %clang -### --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib \ 36 // RUN: --offload-arch=native --amdgpu-arch-tool=%t/amdgpu_arch_gfx906 \ 37 // RUN: -x hip %s 2>&1 | \ 38 // RUN: FileCheck %s --check-prefix=BAD-TIMEOUT 39 // BAD-TIMEOUT: clang: error: cannot determine amdgcn 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) 40