[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / Driver / hip-toolchain-rdc-separate.hip
blobe52184fdeacf36a1dc07e9d77dc4a8e7890681b6
1 // REQUIRES: x86-registered-target
2 // REQUIRES: amdgpu-registered-target
4 // RUN: rm -rf %t && mkdir %t
5 // RUN: %clang -c -### --target=x86_64-linux-gnu \
6 // RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
7 // RUN:   --hip-device-lib=lib1.bc --hip-device-lib=lib2.bc \
8 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
9 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib2 \
10 // RUN:   -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
11 // RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
12 // RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
13 // RUN: 2>&1 | FileCheck %s
15 // CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
16 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
17 // CHECK-SAME: "-emit-llvm-bc"
18 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
19 // CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility=hidden"
20 // CHECK-SAME: "-fapply-global-visibility-to-externs"
21 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
22 // CHECK-SAME: "-target-cpu" "gfx803"
23 // CHECK-SAME: "-fgpu-rdc"
24 // CHECK-SAME: {{.*}} "-o" "[[A_BC1:.*bc]]" "-x" "hip"
25 // CHECK-SAME: {{.*}} [[A_SRC:".*a.cu"]]
27 // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
28 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
29 // CHECK-SAME: "-emit-llvm-bc"
30 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
31 // CHECK-SAME: "-fcuda-is-device"
32 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
33 // CHECK-SAME: "-target-cpu" "gfx900"
34 // CHECK-SAME: "-fgpu-rdc"
35 // CHECK-SAME: {{.*}} "-o" "[[A_BC2:.*bc]]" "-x" "hip"
36 // CHECK-SAME: {{.*}} [[A_SRC]]
38 // CHECK: [[CLANG]] "-cc1" "-triple" "x86_64-unknown-linux-gnu"
39 // CHECK-SAME: "-aux-triple" "amdgcn-amd-amdhsa"
40 // CHECK-SAME: "-emit-obj"
41 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
42 // CHECK-SAME: "-fgpu-rdc"
43 // CHECK-SAME: {{.*}} "-o" "[[A_OBJ_HOST:.*o]]" "-x" "hip"
44 // CHECK-SAME: {{.*}} [[A_SRC]]
46 // CHECK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
47 // CHECK-SAME: "-targets=hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900,host-x86_64-unknown-linux-gnu"
48 // CHECK-SAME: "-output=[[A_O:.*a.o]]" "-input=[[A_BC1]]" "-input=[[A_BC2]]" "-input=[[A_OBJ_HOST]]"
50 // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
51 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
52 // CHECK-SAME: "-emit-llvm-bc"
53 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
54 // CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility=hidden"
55 // CHECK-SAME: "-fapply-global-visibility-to-externs"
56 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
57 // CHECK-SAME: "-target-cpu" "gfx803"
58 // CHECK-SAME: "-fgpu-rdc"
59 // CHECK-SAME: {{.*}} "-o" "[[B_BC1:.*bc]]" "-x" "hip"
60 // CHECK-SAME: {{.*}} [[B_SRC:".*b.hip"]]
62 // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
63 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
64 // CHECK-SAME: "-emit-llvm-bc"
65 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
66 // CHECK-SAME: "-fcuda-is-device"
67 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
68 // CHECK-SAME: "-target-cpu" "gfx900"
69 // CHECK-SAME: "-fgpu-rdc"
70 // CHECK-SAME: {{.*}} "-o" "[[B_BC2:.*bc]]" "-x" "hip"
71 // CHECK-SAME: {{.*}} [[B_SRC]]
73 // CHECK: [[CLANG]] "-cc1" "-triple" "x86_64-unknown-linux-gnu"
74 // CHECK-SAME: "-aux-triple" "amdgcn-amd-amdhsa"
75 // CHECK-SAME: "-emit-obj"
76 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
77 // CHECK-SAME: "-fgpu-rdc"
78 // CHECK-SAME: {{.*}} "-o" "[[B_OBJ_HOST:.*o]]" "-x" "hip"
79 // CHECK-SAME: {{.*}} [[B_SRC]]
81 // CHECK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
82 // CHECK-SAME: "-targets=hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900,host-x86_64-unknown-linux-gnu"
83 // CHECK-SAME: "-output=[[B_O:.*b.o]]" "-input=[[B_BC1]]" "-input=[[B_BC2]]" "-input=[[B_OBJ_HOST]]"
85 // RUN: touch %t/a.o %t/b.o
86 // RUN: %clang --hip-link -### --target=x86_64-linux-gnu \
87 // RUN:   --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
88 // RUN:   -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
89 // RUN:   %t/a.o %t/b.o \
90 // RUN: 2>&1 | FileCheck -check-prefixes=LINK,LINK-HOST-UNBUNDLE,LLD-TMP,LINK-BUNDLE,LINK-EMBED %s
92 // RUN: %clang --hip-link -### --target=x86_64-linux-gnu \
93 // RUN:   --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
94 // RUN:   -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
95 // RUN:   %t/a.o %t/b.o --cuda-device-only \
96 // RUN: 2>&1 | FileCheck -check-prefixes=LINK,LLD-TMP,LINK-BUNDLE,LINK-NOEMBED %s
98 // RUN: %clang --hip-link -### --target=x86_64-linux-gnu \
99 // RUN:   --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
100 // RUN:   -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
101 // RUN:   %t/a.o %t/b.o --cuda-device-only --no-gpu-bundle-output \
102 // RUN: 2>&1 | FileCheck -check-prefixes=LINK,LLD-FIN,LINK-NOBUNDLE,LINK-NOEMBED %s
104 // LINK-HOST-UNBUNDLE: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
105 // LINK-HOST-UNBUNDLE-SAME: "-targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900"
106 // LINK-HOST-UNBUNDLE-SAME: "-input=[[A_O:.*a.o]]" "-output=[[A_OBJ_HOST:.*o]]" "-output={{.*o}}" "-output={{.*o}}"
107 // LINK-HOST-UNBUNDLE: "-unbundle" "-allow-missing-bundles"
109 // LINK-HOST-UNBUNDLE: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
110 // LINK-HOST-UNBUNDLE-SAME: "-targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900"
111 // LINK-HOST-UNBUNDLE-SAME: "-input=[[B_O:.*b.o]]" "-output=[[B_OBJ_HOST:.*o]]" "-output={{.*o}}" "-output={{.*o}}"
112 // LINK-HOST-UNBUNDLE: "-unbundle" "-allow-missing-bundles"
114 // LINK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
115 // LINK-SAME: "-targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900"
116 // LINK-SAME: "-input=[[A_O:.*a.o]]" "-output={{.*o}}" "-output=[[A_BC1:.*o]]" "-output=[[A_BC2:.*o]]"
117 // LINK-SAME: "-unbundle" "-allow-missing-bundles"
119 // LINK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
120 // LINK-SAME: "-targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900"
121 // LINK-SAME: "-input=[[B_O:.*b.o]]" "-output={{.*o}}" "-output=[[B_BC1:.*o]]" "-output=[[B_BC2:.*o]]"
122 // LINK-SAME: "-unbundle" "-allow-missing-bundles"
124 // LINK-NOT: "*.llvm-link"
125 // LINK-NOT: ".*opt"
126 // LINK-NOT: ".*llc"
127 // LINK: {{".*lld.*"}} {{.*}} "-plugin-opt=-amdgpu-internalize-symbols"
128 // LINK-SAME: "-plugin-opt=mcpu=gfx803"
129 // LINK-SAME: "--whole-archive"
130 // LLD-TMP-SAME: "-o" "[[IMG_DEV1:.*.out]]"
131 // LLD-FIN-SAME: "-o" "[[IMG_DEV1:a.out-.*gfx803]]"
132 // LINK-SAME "[[A_BC1]]" "[[B_BC1]]"
133 // LINK-SAME: "--no-whole-archive"
135 // LINK-NOT: "*.llvm-link"
136 // LINK-NOT: ".*opt"
137 // LINK-NOT: ".*llc"
138 // LINK: {{".*lld.*"}} {{.*}} "-plugin-opt=-amdgpu-internalize-symbols"
139 // LINK-SAME: "-plugin-opt=mcpu=gfx900"
140 // LINK-SAME: "--whole-archive"
141 // LLD-TMP-SAME: "-o" "[[IMG_DEV2:.*.out]]"
142 // LLD-FIN-SAME: "-o" "[[IMG_DEV1:a.out-.*gfx900]]"
143 // LINK-SAME "[[A_BC2]]" "[[B_BC2]]"
144 // LINK-SAME: "--no-whole-archive"
146 // LINK-BUNDLE: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
147 // LINK-BUNDLE-SAME: "-targets={{.*}},hipv4-amdgcn-amd-amdhsa--gfx803,hipv4-amdgcn-amd-amdhsa--gfx900"
148 // LINK-BUNDLE-SAME: "-input={{.*}}" "-input=[[IMG_DEV1]]" "-input=[[IMG_DEV2]]" "-output=[[BUNDLE:.*]]"
149 // LINK-NOBUNDLE-NOT: {{".*clang-offload-bundler"}} "-type=o"
151 // LINK-EMBED: {{".*llvm-mc.*"}} "-o" "[[OBJBUNDLE:.*o]]" "{{.*}}.mcin" "--filetype=obj"
152 // LINK-NOEMBED-NOT: {{".*llvm-mc.*"}} "-o"
154 // LINK-EMBED: [[LD:".*ld.*"]] {{.*}} "-o" "a.out" {{.*}} "[[A_OBJ_HOST]]"
155 // LINK-EMBED-SAME: "[[B_OBJ_HOST]]" "[[OBJBUNDLE]]"
156 // LINK-NOEMBED-NOT: {{".*ld.*"}} {{.*}} "-o" "a.out"