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