1// REQUIRES: clang-driver, x86-registered-target, amdgpu-registered-target 2 3// RUN: %clang -### -target x86_64-unknown-linux-gnu --offload-arch=gfx900 \ 4// RUN: -fsanitize=address \ 5// RUN: -nogpuinc --rocm-path=%S/Inputs/rocm \ 6// RUN: %s 2>&1 | FileCheck %s 7 8// RUN: %clang -### -target x86_64-unknown-linux-gnu --offload-arch=gfx900 \ 9// RUN: -fsanitize=address -fno-gpu-sanitize \ 10// RUN: -nogpuinc --rocm-path=%S/Inputs/rocm \ 11// RUN: %s 2>&1 | FileCheck %s 12 13// RUN: %clang -### -target x86_64-unknown-linux-gnu --offload-arch=gfx900 \ 14// RUN: -fsanitize=address -fgpu-sanitize \ 15// RUN: -nogpuinc --rocm-path=%S/Inputs/rocm \ 16// RUN: %s 2>&1 | FileCheck -check-prefixes=NORDC %s 17 18// RUN: %clang -### -target x86_64-unknown-linux-gnu --offload-arch=gfx900 \ 19// RUN: -fsanitize=address -fgpu-sanitize -fgpu-rdc \ 20// RUN: -nogpuinc --rocm-path=%S/Inputs/rocm \ 21// RUN: %s 2>&1 | FileCheck -check-prefixes=RDC %s 22 23// RUN: %clang -### -target x86_64-unknown-linux-gnu --offload-arch=gfx900 \ 24// RUN: -fsanitize=address -fgpu-sanitize \ 25// RUN: -nogpuinc --rocm-path=%S/Inputs/rocm-invalid \ 26// RUN: %s 2>&1 | FileCheck -check-prefixes=FAIL %s 27 28// RUN: %clang -### -target x86_64-unknown-linux-gnu --offload-arch=gfx900:xnack- \ 29// RUN: -fsanitize=address -fgpu-sanitize \ 30// RUN: -nogpuinc --rocm-path=%S/Inputs/rocm \ 31// RUN: %s 2>&1 | FileCheck -check-prefix=XNACK %s 32 33// CHECK-NOT: {{"[^"]*clang[^"]*".* "-fcuda-is-device".* "-fsanitize=address"}} 34// CHECK-NOT: {{"[^"]*lld(\.exe){0,1}".* ".*hip.bc"}} 35// CHECK: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* "-fsanitize=address"}} 36 37// NORDC: {{"[^"]*clang[^"]*".* "-emit-obj".* "-fcuda-is-device".* "-mlink-bitcode-file" ".*asanrtl.bc".* "-mlink-builtin-bitcode" ".*hip.bc".* "-fsanitize=address".*}} "-o" "[[OUT:[^"]*.o]]" 38// NORDC: {{"[^"]*lld(\.exe){0,1}".*}} "[[OUT]]" {{".*asanrtl.bc" ".*hip.bc"}} 39// NORDC: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* "-fsanitize=address"}} 40 41// RDC: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* "-fsanitize=address"}} 42// RDC: {{"[^"]*clang[^"]*".* "-emit-llvm-bc".* "-fcuda-is-device".* "-fsanitize=address".*}} "-o" "[[OUT:[^"]*.bc]]" 43// RDC: {{"[^"]*lld(\.exe){0,1}".*}} "[[OUT]]" {{".*asanrtl.bc" ".*hip.bc"}} 44 45// FAIL: AMDGPU address sanitizer runtime library (asanrtl) is not found. Please install ROCm device library which supports address sanitizer 46 47// XNACK: error: '-fgpu-sanitize' is not compatible with offload arch 'gfx900:xnack-'. Use an offload arch without 'xnack-' instead 48