[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Driver / hip-device-compile.hip
blob1dfadfe8f65135eacfb6a73d3ab8c8d2af064994
1 // If -emit-llvm and/or -S is used in device only compilation,
2 // the output should not be bundled, except --gpu-bundle-output
3 // is specified.
5 // Output unbundled bitcode.
6 // RUN: %clang -c -emit-llvm --cuda-device-only -### --target=x86_64-linux-gnu \
7 // RUN:   --rocm-path=%S/Inputs/rocm -o a.bc -x hip --cuda-gpu-arch=gfx900 --no-gpu-bundle-output \
8 // RUN:   --no-offload-new-driver --hip-device-lib=lib1.bc \
9 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
10 // RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
11 // RUN: 2>&1 | FileCheck -check-prefixes=CHECK,BC,NBUN %s
13 // Output bundled bitcode.
14 // RUN: %clang -c -emit-llvm --cuda-device-only -### --target=x86_64-linux-gnu \
15 // RUN:   --rocm-path=%S/Inputs/rocm -o a.bc -x hip --cuda-gpu-arch=gfx900 --no-gpu-bundle-output \
16 // RUN:   --no-offload-new-driver --hip-device-lib=lib1.bc \
17 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
18 // RUN:   %S/Inputs/hip_multiple_inputs/a.cu --gpu-bundle-output \
19 // RUN: 2>&1 | FileCheck -check-prefixes=CHECK,BCBUN %s
21 // Output unbundled LLVM IR.
22 // RUN: %clang -c -S -emit-llvm --cuda-device-only -### --target=x86_64-linux-gnu \
23 // RUN:   --rocm-path=%S/Inputs/rocm -o a.ll -x hip --cuda-gpu-arch=gfx900 --no-gpu-bundle-output \
24 // RUN:   --no-offload-new-driver --hip-device-lib=lib1.bc \
25 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
26 // RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
27 // RUN: 2>&1 | FileCheck -check-prefixes=CHECK,LL,NBUN %s
29 // Output bundled LLVM IR.
30 // RUN: %clang -c -S -emit-llvm --cuda-device-only -### --target=x86_64-linux-gnu \
31 // RUN:   --rocm-path=%S/Inputs/rocm -o a.ll -x hip --cuda-gpu-arch=gfx900 --no-gpu-bundle-output \
32 // RUN:   --no-offload-new-driver --hip-device-lib=lib1.bc \
33 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
34 // RUN:   %S/Inputs/hip_multiple_inputs/a.cu --gpu-bundle-output \
35 // RUN: 2>&1 | FileCheck -check-prefixes=CHECK,LLBUN %s
37 // Output unbundled assembly.
38 // RUN: %clang -c -S --cuda-device-only -### --target=x86_64-linux-gnu \
39 // RUN:   --rocm-path=%S/Inputs/rocm -o a.s -x hip --cuda-gpu-arch=gfx900 --no-gpu-bundle-output \
40 // RUN:   --no-offload-new-driver --hip-device-lib=lib1.bc \
41 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
42 // RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
43 // RUN: 2>&1 | FileCheck -check-prefixes=CHECK,ASM,NBUN %s
45 // Output relocatable.
46 // RUN: %clang -c --cuda-device-only -### --target=x86_64-linux-gnu \
47 // RUN:   --rocm-path=%S/Inputs/rocm -o a.o -x hip --cuda-gpu-arch=gfx900 -fhip-emit-relocatable \
48 // RUN:   --no-offload-new-driver --hip-device-lib=lib1.bc \
49 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
50 // RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
51 // RUN: 2>&1 | FileCheck -check-prefixes=CHECK,NBUN,RELOC %s
53 // Output bundled assembly.
54 // RUN: %clang -c -S --cuda-device-only -### --target=x86_64-linux-gnu \
55 // RUN:   --rocm-path=%S/Inputs/rocm -o a.s -x hip --cuda-gpu-arch=gfx900 --no-gpu-bundle-output \
56 // RUN:   --no-offload-new-driver --hip-device-lib=lib1.bc \
57 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
58 // RUN:   %S/Inputs/hip_multiple_inputs/a.cu --gpu-bundle-output \
59 // RUN: 2>&1 | FileCheck -check-prefixes=CHECK,ASMBUN %s
61 // CHECK: {{".*clang.*"}} "-cc1" "-triple" "amdgcn-amd-amdhsa"
62 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
63 // BC-SAME: "-emit-llvm-bc"
64 // LL-SAME: "-emit-llvm"
65 // ASM-NOT: "-emit-llvm"
66 // CHECK-SAME: "-main-file-name" "a.cu"
67 // CHECK-SAME: "-fcuda-is-device"
68 // CHECK-SAME: {{".*lib1.bc"}}
69 // CHECK-SAME: "-target-cpu" "gfx900"
70 // BC-SAME: "-o" "a.bc"
71 // BCBUN-SAME: "-o" "{{.*}}.bc"
72 // LL-SAME: "-o" "a.ll"
73 // LLBUN-SAME: "-o" "{{.*}}.ll"
74 // ASM-SAME: "-o" "a.s"
75 // ASMBUN-SAME: "-o" "{{.*}}.s"
76 // RELOC-SAME: "-o" "a.o"
77 // CHECK-SAME: {{".*a.cu"}}
79 // CHECK-NOT: {{"*.llvm-link"}}
80 // CHECK-NOT: {{".*opt"}}
81 // CHECK-NOT: {{".*llc"}}
82 // CHECK-NOT: {{".*lld.*"}}
83 // NBUN-NOT: {{".*clang-offload-bundler"}}
84 // BCBUN: {{".*clang-offload-bundler"}}{{.*}}"-output=a.bc"
85 // LLBUN: {{".*clang-offload-bundler"}}{{.*}}"-output=a.ll"
86 // ASMBUN: {{".*clang-offload-bundler"}}{{.*}}"-output=a.s"
87 // CHECK-NOT: {{".*ld.*"}}{{.*}}"-o"
89 // If neither -emit-llvm nor -S is used in device only compilation,
90 // the output should be bundled except --no-gpu-bundle-output is
91 // specified.
93 // Output bundled code objects.
94 // RUN: %clang -c --cuda-device-only -### --target=x86_64-linux-gnu \
95 // RUN:   --rocm-path=%S/Inputs/rocm -o a.o -x hip --cuda-gpu-arch=gfx900 \
96 // RUN:   --no-offload-new-driver --hip-device-lib=lib1.bc \
97 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
98 // RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
99 // RUN: 2>&1 | FileCheck -check-prefixes=OBJ,OBJ-BUN %s
101 // Output unbundled code objects.
102 // RUN: %clang -c --cuda-device-only -### --target=x86_64-linux-gnu \
103 // RUN:   --rocm-path=%S/Inputs/rocm -o a.o -x hip --cuda-gpu-arch=gfx900 \
104 // RUN:   --no-offload-new-driver --hip-device-lib=lib1.bc \
105 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
106 // RUN:   %S/Inputs/hip_multiple_inputs/a.cu --no-gpu-bundle-output \
107 // RUN: 2>&1 | FileCheck -check-prefixes=OBJ,OBJ-UBUN %s
109 // Output bundled code objects.
110 // RUN: %clang --cuda-device-only -### --target=x86_64-linux-gnu \
111 // RUN:   --rocm-path=%S/Inputs/rocm -o a.o -x hip --cuda-gpu-arch=gfx900 \
112 // RUN:   --no-offload-new-driver --hip-device-lib=lib1.bc \
113 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
114 // RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
115 // RUN: 2>&1 | FileCheck -check-prefixes=OBJ,OBJ-BUN %s
117 // Output unbundled code objects.
118 // RUN: %clang --cuda-device-only -### --target=x86_64-linux-gnu \
119 // RUN:   --rocm-path=%S/Inputs/rocm -o a.o -x hip --cuda-gpu-arch=gfx900 \
120 // RUN:   --no-offload-new-driver --hip-device-lib=lib1.bc \
121 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
122 // RUN:   %S/Inputs/hip_multiple_inputs/a.cu --no-gpu-bundle-output \
123 // RUN: 2>&1 | FileCheck -check-prefixes=OBJ,OBJ-UBUN %s
125 // OBJ: {{"*.clang.*"}} {{.*}} "-emit-obj"
126 // OBJ-NOT: {{"*.llvm-link"}}
127 // OBJ-NOT: {{".*opt"}}
128 // OBJ-NOT: {{".*llc"}}
129 // OBJ-BUN: {{".*lld.*"}}{{.*}}"-o" "{{.*}}.o"
130 // OBJ-UBUN: {{".*lld.*"}}{{.*}}"-o" "a.o"
131 // OBJ-BUN: {{".*clang-offload-bundler"}}{{.*}}"-output=a.o"
132 // OBJ-UBUN-NOT: {{".*clang-offload-bundler"}}