1// REQUIRES: clang-driver 2// REQUIRES: x86-registered-target 3// REQUIRES: amdgpu-registered-target 4 5// RUN: %clang -### -target x86_64-linux-gnu \ 6// RUN: -x hip \ 7// RUN: --offload-arch=gfx908:xnack+:sramecc+ \ 8// RUN: --offload-arch=gfx908:xnack+:sramecc- \ 9// RUN: --rocm-path=%S/Inputs/rocm \ 10// RUN: %s 2>&1 | FileCheck %s 11 12// RUN: %clang -### -target x86_64-linux-gnu \ 13// RUN: -x hip \ 14// RUN: --offload-arch=gfx908:xnack+:sramecc+ \ 15// RUN: --offload-arch=gfx908:xnack+:sramecc- \ 16// RUN: --rocm-path=%S/Inputs/rocm \ 17// RUN: -save-temps \ 18// RUN: %s 2>&1 | FileCheck --check-prefixes=CHECK,TMP %s 19 20// RUN: %clang -### -target x86_64-linux-gnu \ 21// RUN: -x hip \ 22// RUN: --offload-arch=gfx908:xnack+:sramecc+ \ 23// RUN: --offload-arch=gfx908:xnack+:sramecc- \ 24// RUN: --rocm-path=%S/Inputs/rocm \ 25// RUN: -fgpu-rdc \ 26// RUN: %s 2>&1 | FileCheck --check-prefixes=CHECK %s 27 28// CHECK: [[CLANG:"[^"]*clang[^"]*"]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa" 29// CHECK-SAME: "-target-cpu" "gfx908" 30// CHECK-SAME: "-target-feature" "+sramecc" 31// CHECK-SAME: "-target-feature" "+xnack" 32 33// TMP: [[CLANG:"[^"]*clang[^"]*"]] "-cc1as" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa" 34// TMP-SAME: "-target-cpu" "gfx908" 35// TMP-SAME: "-target-feature" "+sramecc" 36// TMP-SAME: "-target-feature" "+xnack" 37 38// CHECK: [[LLD:"[^"]*lld[^"]*"]] {{.*}} "-plugin-opt=mcpu=gfx908" 39// CHECK-SAME: "-plugin-opt=-mattr=+sramecc,+xnack" 40 41// CHECK: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa" 42// CHECK-SAME: "-target-cpu" "gfx908" 43// CHECK-SAME: "-target-feature" "-sramecc" 44// CHECK-SAME: "-target-feature" "+xnack" 45 46// CHECK: [[LLD]] {{.*}} "-plugin-opt=mcpu=gfx908" 47// CHECK-SAME: "-plugin-opt=-mattr=-sramecc,+xnack" 48 49// CHECK: {{"[^"]*clang-offload-bundler[^"]*"}} 50// CHECK-SAME: "-targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx908:sramecc+:xnack+,hip-amdgcn-amd-amdhsa--gfx908:sramecc-:xnack+" 51 52// Check canonicalization and repeating of target ID. 53 54// RUN: %clang -### -target x86_64-linux-gnu \ 55// RUN: -x hip \ 56// RUN: --offload-arch=fiji \ 57// RUN: --offload-arch=gfx803 \ 58// RUN: --offload-arch=fiji \ 59// RUN: --rocm-path=%S/Inputs/rocm \ 60// RUN: %s 2>&1 | FileCheck -check-prefix=FIJI %s 61// FIJI: "-targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx803" 62 63// RUN: %clang -### -target x86_64-linux-gnu \ 64// RUN: -x hip \ 65// RUN: --offload-arch=gfx900:xnack- \ 66// RUN: --offload-arch=gfx900:xnack+ \ 67// RUN: --offload-arch=gfx908:sramecc+ \ 68// RUN: --offload-arch=gfx908:sramecc- \ 69// RUN: --offload-arch=gfx906 \ 70// RUN: --rocm-path=%S/Inputs/rocm \ 71// RUN: %s 2>&1 | FileCheck -check-prefix=MULTI %s 72// MULTI: "-targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx900:xnack+,hip-amdgcn-amd-amdhsa--gfx900:xnack-,hip-amdgcn-amd-amdhsa--gfx906,hip-amdgcn-amd-amdhsa--gfx908:sramecc+,hip-amdgcn-amd-amdhsa--gfx908:sramecc-" 73