[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Driver / hip-toolchain-rdc-separate.hip
blob0ce5ea5174e1b1f642e0cb0634f560d57278b3ef
1 // RUN: rm -rf %t && mkdir %t
2 // RUN: %clang -c -### --target=x86_64-linux-gnu \
3 // RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
4 // RUN:   --hip-device-lib=lib1.bc --hip-device-lib=lib2.bc \
5 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
6 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib2 \
7 // RUN:   --no-offload-new-driver -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
8 // RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
9 // RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
10 // RUN: 2>&1 | FileCheck %s
12 // CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
13 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
14 // CHECK-SAME: "-emit-llvm-bc"
15 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
16 // CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility=hidden"
17 // CHECK-SAME: "-fapply-global-visibility-to-externs"
18 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
19 // CHECK-SAME: "-target-cpu" "gfx803"
20 // CHECK-SAME: "-fgpu-rdc"
21 // CHECK-SAME: {{.*}} "-o" "[[A_BC1:.*bc]]" "-x" "hip"
22 // CHECK-SAME: {{.*}} [[A_SRC:".*a.cu"]]
24 // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
25 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
26 // CHECK-SAME: "-emit-llvm-bc"
27 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
28 // CHECK-SAME: "-fcuda-is-device"
29 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
30 // CHECK-SAME: "-target-cpu" "gfx900"
31 // CHECK-SAME: "-fgpu-rdc"
32 // CHECK-SAME: {{.*}} "-o" "[[A_BC2:.*bc]]" "-x" "hip"
33 // CHECK-SAME: {{.*}} [[A_SRC]]
35 // CHECK: [[CLANG]] "-cc1" "-triple" "x86_64-unknown-linux-gnu"
36 // CHECK-SAME: "-aux-triple" "amdgcn-amd-amdhsa"
37 // CHECK-SAME: "-emit-obj"
38 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
39 // CHECK-SAME: "-fgpu-rdc"
40 // CHECK-SAME: {{.*}} "-o" "[[A_OBJ_HOST:.*o]]" "-x" "hip"
41 // CHECK-SAME: {{.*}} [[A_SRC]]
43 // CHECK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
44 // CHECK-SAME: "-targets=hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900,host-x86_64-unknown-linux-gnu"
45 // CHECK-SAME: "-output=[[A_O:.*a.o]]" "-input=[[A_BC1]]" "-input=[[A_BC2]]" "-input=[[A_OBJ_HOST]]"
47 // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
48 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
49 // CHECK-SAME: "-emit-llvm-bc"
50 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
51 // CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility=hidden"
52 // CHECK-SAME: "-fapply-global-visibility-to-externs"
53 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
54 // CHECK-SAME: "-target-cpu" "gfx803"
55 // CHECK-SAME: "-fgpu-rdc"
56 // CHECK-SAME: {{.*}} "-o" "[[B_BC1:.*bc]]" "-x" "hip"
57 // CHECK-SAME: {{.*}} [[B_SRC:".*b.hip"]]
59 // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
60 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
61 // CHECK-SAME: "-emit-llvm-bc"
62 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
63 // CHECK-SAME: "-fcuda-is-device"
64 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
65 // CHECK-SAME: "-target-cpu" "gfx900"
66 // CHECK-SAME: "-fgpu-rdc"
67 // CHECK-SAME: {{.*}} "-o" "[[B_BC2:.*bc]]" "-x" "hip"
68 // CHECK-SAME: {{.*}} [[B_SRC]]
70 // CHECK: [[CLANG]] "-cc1" "-triple" "x86_64-unknown-linux-gnu"
71 // CHECK-SAME: "-aux-triple" "amdgcn-amd-amdhsa"
72 // CHECK-SAME: "-emit-obj"
73 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
74 // CHECK-SAME: "-fgpu-rdc"
75 // CHECK-SAME: {{.*}} "-o" "[[B_OBJ_HOST:.*o]]" "-x" "hip"
76 // CHECK-SAME: {{.*}} [[B_SRC]]
78 // CHECK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
79 // CHECK-SAME: "-targets=hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900,host-x86_64-unknown-linux-gnu"
80 // CHECK-SAME: "-output=[[B_O:.*b.o]]" "-input=[[B_BC1]]" "-input=[[B_BC2]]" "-input=[[B_OBJ_HOST]]"
82 // RUN: touch %t/a.o %t/b.o
83 // RUN: %clang --hip-link -### --target=x86_64-linux-gnu \
84 // RUN:   --no-offload-new-driver --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
85 // RUN:   -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
86 // RUN:   %t/a.o %t/b.o \
87 // RUN: 2>&1 | FileCheck -check-prefixes=LINK,LINK-HOST-UNBUNDLE,LLD-TMP,LINK-BUNDLE,LINK-EMBED %s
89 // RUN: %clang --hip-link -### --target=x86_64-linux-gnu \
90 // RUN:   --no-offload-new-driver --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
91 // RUN:   -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
92 // RUN:   %t/a.o %t/b.o --cuda-device-only \
93 // RUN: 2>&1 | FileCheck -check-prefixes=LINK,LLD-TMP,LINK-BUNDLE,LINK-NOEMBED %s
95 // RUN: %clang --hip-link -### --target=x86_64-linux-gnu \
96 // RUN:   --no-offload-new-driver --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
97 // RUN:   -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
98 // RUN:   %t/a.o %t/b.o --cuda-device-only --no-gpu-bundle-output \
99 // RUN: 2>&1 | FileCheck -check-prefixes=LINK,LLD-FIN,LINK-NOBUNDLE,LINK-NOEMBED %s
101 // LINK-HOST-UNBUNDLE: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
102 // LINK-HOST-UNBUNDLE-SAME: "-targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900"
103 // LINK-HOST-UNBUNDLE-SAME: "-input=[[A_O:.*a.o]]" "-output=[[A_OBJ_HOST:.*o]]" "-output={{.*o}}" "-output={{.*o}}"
104 // LINK-HOST-UNBUNDLE: "-unbundle" "-allow-missing-bundles"
106 // LINK-HOST-UNBUNDLE: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
107 // LINK-HOST-UNBUNDLE-SAME: "-targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900"
108 // LINK-HOST-UNBUNDLE-SAME: "-input=[[B_O:.*b.o]]" "-output=[[B_OBJ_HOST:.*o]]" "-output={{.*o}}" "-output={{.*o}}"
109 // LINK-HOST-UNBUNDLE: "-unbundle" "-allow-missing-bundles"
111 // LINK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
112 // LINK-SAME: "-targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900"
113 // LINK-SAME: "-input=[[A_O:.*a.o]]" "-output={{.*o}}" "-output=[[A_BC1:.*o]]" "-output=[[A_BC2:.*o]]"
114 // LINK-SAME: "-unbundle" "-allow-missing-bundles"
116 // LINK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
117 // LINK-SAME: "-targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900"
118 // LINK-SAME: "-input=[[B_O:.*b.o]]" "-output={{.*o}}" "-output=[[B_BC1:.*o]]" "-output=[[B_BC2:.*o]]"
119 // LINK-SAME: "-unbundle" "-allow-missing-bundles"
121 // LINK-NOT: "*.llvm-link"
122 // LINK-NOT: ".*opt"
123 // LINK-NOT: ".*llc"
124 // LINK: {{".*lld.*"}} {{.*}} "-plugin-opt=-amdgpu-internalize-symbols"
125 // LINK-SAME: "-plugin-opt=mcpu=gfx803"
126 // LINK-SAME: "--whole-archive"
127 // LLD-TMP-SAME: "-o" "[[IMG_DEV1:.*.out]]"
128 // LLD-FIN-SAME: "-o" "[[IMG_DEV1:a.out-.*gfx803]]"
129 // LINK-SAME "[[A_BC1]]" "[[B_BC1]]"
130 // LINK-SAME: "--no-whole-archive"
132 // LINK-NOT: "*.llvm-link"
133 // LINK-NOT: ".*opt"
134 // LINK-NOT: ".*llc"
135 // LINK: {{".*lld.*"}} {{.*}} "-plugin-opt=-amdgpu-internalize-symbols"
136 // LINK-SAME: "-plugin-opt=mcpu=gfx900"
137 // LINK-SAME: "--whole-archive"
138 // LLD-TMP-SAME: "-o" "[[IMG_DEV2:.*.out]]"
139 // LLD-FIN-SAME: "-o" "[[IMG_DEV1:a.out-.*gfx900]]"
140 // LINK-SAME "[[A_BC2]]" "[[B_BC2]]"
141 // LINK-SAME: "--no-whole-archive"
143 // LINK-BUNDLE: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
144 // LINK-BUNDLE-SAME: "-targets={{.*}},hipv4-amdgcn-amd-amdhsa--gfx803,hipv4-amdgcn-amd-amdhsa--gfx900"
145 // LINK-BUNDLE-SAME: "-input={{.*}}" "-input=[[IMG_DEV1]]" "-input=[[IMG_DEV2]]" "-output=[[BUNDLE:.*]]"
146 // LINK-NOBUNDLE-NOT: {{".*clang-offload-bundler"}} "-type=o"
148 // LINK-EMBED: {{".*clang.*"}} "-o" "[[OBJBUNDLE:.*o]]" "{{.*}}.mcin"
149 // LINK-NOEMBED-NOT: {{".*clang.*"}} "-o"
151 // LINK-EMBED: [[LD:".*ld.*"]] {{.*}} "-o" "a.out" {{.*}} "[[A_OBJ_HOST]]"
152 // LINK-EMBED-SAME: "[[B_OBJ_HOST]]" "[[OBJBUNDLE]]"
153 // LINK-NOEMBED-NOT: {{".*ld.*"}} {{.*}} "-o" "a.out"