Debian Codegraph @

clang/test/Driver/hip-macros.hip

raw
1 // REQUIRES: amdgpu-registered-target
2 // RUN: %clang -E -dM --offload-arch=gfx906 --cuda-device-only -nogpuinc -nogpulib \
3 // RUN: %s 2>&1 | FileCheck --check-prefix=CUMODE-ON %s
4 // RUN: %clang -E -dM --offload-arch=gfx906 --cuda-device-only -nogpuinc -nogpulib -mcumode \
5 // RUN: %s 2>&1 | FileCheck --check-prefix=CUMODE-ON %s
6 // RUN: %clang -E -dM --offload-arch=gfx906 --cuda-device-only -nogpuinc -nogpulib -mno-cumode \
7 // RUN: %s 2>&1 | FileCheck -DOFFLOAD_ARCH=gfx906 --check-prefixes=CUMODE-ON,WARN-CUMODE %s
8 // RUN: %clang -E -dM --offload-arch=gfx1030 --cuda-device-only -nogpuinc -nogpulib \
9 // RUN: %s 2>&1 | FileCheck --check-prefix=CUMODE-OFF %s
10 // RUN: %clang -E -dM --offload-arch=gfx1030 --cuda-device-only -nogpuinc -nogpulib -mcumode \
11 // RUN: %s 2>&1 | FileCheck --check-prefix=CUMODE-ON %s
12 // RUN: %clang -E -dM --offload-arch=gfx1030 --cuda-device-only -nogpuinc -nogpulib -mno-cumode \
13 // RUN: %s 2>&1 | FileCheck --check-prefix=CUMODE-OFF %s
14 // RUN: %clang -E -dM --offload-arch=gfx1250 --cuda-device-only -nogpuinc -nogpulib \
15 // RUN: %s 2>&1 | FileCheck --check-prefix=CUMODE-ON %s
16 // RUN: %clang -E -dM --offload-arch=gfx1250 --cuda-device-only -nogpuinc -nogpulib -mcumode \
17 // RUN: %s 2>&1 | FileCheck --check-prefix=CUMODE-ON %s
18 // RUN: %clang -E -dM --offload-arch=gfx1250 --cuda-device-only -nogpuinc -nogpulib -mno-cumode \
19 // RUN: %s 2>&1 | FileCheck -DOFFLOAD_ARCH=gfx1250 --check-prefixes=CUMODE-ON,WARN-CUMODE %s
20
21 // Check no duplicate warnings.
22 // RUN: %clang -E -dM --offload-arch=gfx906 --cuda-device-only -nogpuinc -nogpulib -mcumode \
23 // RUN: -mno-cumode -mno-cumode \
24 // RUN: %s 2>&1 | FileCheck -DOFFLOAD_ARCH=gfx906 --check-prefixes=CUMODE-ON,WARN-CUMODE %s
25
26 // WARN-CUMODE-DAG: warning: ignoring '-mno-cumode' option as it is not currently supported for processor '[[OFFLOAD_ARCH]]' [-Woption-ignored]
27 // WARN-CUMODE-NOT: warning: ignoring '-mno-cumode' option as it is not currently supported for processor '[[OFFLOAD_ARCH]]' [-Woption-ignored]
28 // CUMODE-ON-DAG: #define __AMDGCN_CUMODE__ 1
29 // CUMODE-OFF-DAG: #define __AMDGCN_CUMODE__ 0
30
31 // RUN: %clang -E -dM --offload-arch=gfx90a --cuda-device-only -nogpuinc -nogpulib \
32 // RUN: %s 2>&1 | FileCheck --check-prefixes=IMAGE,NOWARN %s
33 // RUN: %clang -E -dM --offload-arch=gfx1100 --cuda-device-only -nogpuinc -nogpulib \
34 // RUN: %s 2>&1 | FileCheck --check-prefixes=IMAGE,NOWARN %s
35 // RUN: %clang -E -dM --offload-arch=gfx942 --cuda-device-only -nogpuinc -nogpulib \
36 // RUN: %s 2>&1 | FileCheck --check-prefixes=NOIMAGE,NOWARN %s
37 // RUN: %clang -E -dM --offload-arch=gfx942 --cuda-device-only -nogpuinc -nogpulib \
38 // RUN: %s 2>&1 | FileCheck --check-prefixes=NOIMAGE,NOWARN %s
39 // RUN: %clang -E -dM --offload-arch=gfx1100 --cuda-device-only -nogpuinc -nogpulib \
40 // RUN: -Xclang -target-feature -Xclang "-image-insts" %s 2>&1 | FileCheck --check-prefixes=IMAGE,WARN %s
41 // RUN: %clang -E -dM --offload-arch=gfx942 --cuda-device-only -nogpuinc -nogpulib \
42 // RUN: -Xclang -target-feature -Xclang "+image-insts" %s 2>&1 | FileCheck --check-prefixes=NOIMAGE,WARN %s
43 // NOWARN-NOT: warning
44 // WARN: warning: feature flag '{{[+|-]}}image-insts' is ignored since the feature is read only [-Winvalid-command-line-argument]
45 // IMAGE-NOT: #define __HIP_NO_IMAGE_SUPPORT__
46 // IMAGE-NOT: #define __HIP_NO_IMAGE_SUPPORT
47 // NOIMAGE-DAG: #define __HIP_NO_IMAGE_SUPPORT__ 1
48 // NOIMAGE-DAG: #define __HIP_NO_IMAGE_SUPPORT 1
49
50 // RUN: %clang -E -dM --offload-arch=gfx1100 -nogpuinc -nogpulib \
51 // RUN: -fgpu-default-stream=per-thread %s 2>&1 | FileCheck --check-prefixes=PTS %s
52 // RUN: %clang -E -dM --offload-arch=gfx942 --cuda-device-only -nogpuinc -nogpulib \
53 // RUN: -fgpu-default-stream=legacy %s 2>&1 | FileCheck --check-prefixes=NOPTS %s
54 // RUN: %clang -E -dM --offload-arch=gfx942 --cuda-device-only -nogpuinc -nogpulib \
55 // RUN: %s 2>&1 | FileCheck --check-prefixes=NOPTS %s
56 // PTS-DAG: #define __HIP_API_PER_THREAD_DEFAULT_STREAM__ 1
57 // PTS-DAG: #define __HIP_API_PER_THREAD_DEFAULT_STREAM__ 1
58 // PTS-DAG: #define HIP_API_PER_THREAD_DEFAULT_STREAM 1
59 // PTS-DAG: #define HIP_API_PER_THREAD_DEFAULT_STREAM 1
60 // NOPTS-NOT: #define __HIP_API_PER_THREAD_DEFAULT_STREAM__
61 // NOPTS-NOT: #define HIP_API_PER_THREAD_DEFAULT_STREAM
62
63 // RUN: %clang -E -dM --offload-arch=gfx906 -nogpuinc -nogpulib \
64 // RUN: %s 2>&1 | FileCheck --check-prefix=NOAPPROX %s
65 // RUN: %clang -E -dM --offload-arch=gfx906 -nogpuinc -nogpulib -fgpu-approx-transcendentals \
66 // RUN: %s 2>&1 | FileCheck --check-prefix=APPROX %s
67 // NOAPPROX-NOT: #define __CLANG_GPU_APPROX_TRANSCENDENTALS__
68 // APPROX: #define __CLANG_GPU_APPROX_TRANSCENDENTALS__ 1
69 // APPROX: #define __CLANG_GPU_APPROX_TRANSCENDENTALS__ 1