|
33 | 33 | // CK-HELP: {{.*}}one. The resulting file can also be unbundled into different files by
|
34 | 34 | // CK-HELP: {{.*}}this tool if -unbundle is provided.
|
35 | 35 | // CK-HELP: {{.*}}USAGE: clang-offload-bundler [options]
|
| 36 | +// CK-HELP: {{.*}}-allow-missing-bundles {{.*}}- Create empty files if bundles are missing when unbundling |
36 | 37 | // CK-HELP: {{.*}}-inputs=<string> - [<input file>,...]
|
37 | 38 | // CK-HELP: {{.*}}-outputs=<string> - [<output file>,...]
|
38 | 39 | // CK-HELP: {{.*}}-targets=<string> - [<offload kind>-<target triple>,...]
|
|
88 | 89 | // RUN: not clang-offload-bundler -type=i -targets=openmp-powerpc64le-linux,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR9A
|
89 | 90 | // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR9B
|
90 | 91 | // CK-ERR9A: error: expecting exactly one host target but got 0
|
91 |
| -// CK-ERR9B: error: expecting exactly one host target but got 2 |
| 92 | +// CK-ERR9B: error: Duplicate targets are not allowed |
92 | 93 |
|
93 | 94 | //
|
94 | 95 | // Check text bundle. This is a readable format, so we check for the format we expect to find.
|
|
181 | 182 | // RUN: diff %t.tgt2 %t.res.tgt2
|
182 | 183 |
|
183 | 184 | // Check if we can unbundle a file with no magic strings.
|
184 |
| -// RUN: clang-offload-bundler -type=s -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.res.s,%t.res.tgt1,%t.res.tgt2 -inputs=%t.s -unbundle |
| 185 | +// RUN: clang-offload-bundler -type=s -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.res.s,%t.res.tgt1,%t.res.tgt2 -inputs=%t.s -unbundle -allow-missing-bundles |
185 | 186 | // RUN: diff %t.s %t.res.s
|
186 | 187 | // RUN: diff %t.empty %t.res.tgt1
|
187 | 188 | // RUN: diff %t.empty %t.res.tgt2
|
188 |
| -// RUN: clang-offload-bundler -type=s -targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -outputs=%t.res.tgt1,%t.res.s,%t.res.tgt2 -inputs=%t.s -unbundle |
| 189 | +// RUN: clang-offload-bundler -type=s -targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -outputs=%t.res.tgt1,%t.res.s,%t.res.tgt2 -inputs=%t.s -unbundle -allow-missing-bundles |
189 | 190 | // RUN: diff %t.s %t.res.s
|
190 | 191 | // RUN: diff %t.empty %t.res.tgt1
|
191 | 192 | // RUN: diff %t.empty %t.res.tgt2
|
192 | 193 |
|
193 | 194 | // Check that bindler prints an error if given host bundle does not exist in the fat binary.
|
194 |
| -// RUN: not clang-offload-bundler -type=s -targets=host-x86_64-xxx-linux-gnu,openmp-powerpc64le-ibm-linux-gnu -outputs=%t.res.s,%t.res.tgt1 -inputs=%t.bundle3.s -unbundle 2>&1 | FileCheck %s --check-prefix CK-NO-HOST-BUNDLE |
| 195 | +// RUN: not clang-offload-bundler -type=s -targets=host-x86_64-xxx-linux-gnu,openmp-powerpc64le-ibm-linux-gnu -outputs=%t.res.s,%t.res.tgt1 -inputs=%t.bundle3.s -unbundle -allow-missing-bundles 2>&1 | FileCheck %s --check-prefix CK-NO-HOST-BUNDLE |
195 | 196 | // CK-NO-HOST-BUNDLE: error: Can't find bundle for the host target
|
196 | 197 |
|
197 | 198 | //
|
|
229 | 230 | // RUN: diff %t.tgt1 %t.res.tgt1
|
230 | 231 |
|
231 | 232 | // Check if we can unbundle a file with no magic strings.
|
232 |
| -// RUN: clang-offload-bundler -type=bc -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.res.bc,%t.res.tgt1,%t.res.tgt2 -inputs=%t.bc -unbundle |
| 233 | +// RUN: clang-offload-bundler -type=bc -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.res.bc,%t.res.tgt1,%t.res.tgt2 -inputs=%t.bc -unbundle -allow-missing-bundles |
233 | 234 | // RUN: diff %t.bc %t.res.bc
|
234 | 235 | // RUN: diff %t.empty %t.res.tgt1
|
235 | 236 | // RUN: diff %t.empty %t.res.tgt2
|
236 |
| -// RUN: clang-offload-bundler -type=bc -targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -outputs=%t.res.tgt1,%t.res.bc,%t.res.tgt2 -inputs=%t.bc -unbundle |
| 237 | +// RUN: clang-offload-bundler -type=bc -targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -outputs=%t.res.tgt1,%t.res.bc,%t.res.tgt2 -inputs=%t.bc -unbundle -allow-missing-bundles |
237 | 238 | // RUN: diff %t.bc %t.res.bc
|
238 | 239 | // RUN: diff %t.empty %t.res.tgt1
|
239 | 240 | // RUN: diff %t.empty %t.res.tgt2
|
|
269 | 270 | // RUN: diff %t.tgt1 %t.res.tgt1
|
270 | 271 |
|
271 | 272 | // Check if we can unbundle a file with no magic strings.
|
272 |
| -// RUN: clang-offload-bundler -type=o -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.res.o,%t.res.tgt1,%t.res.tgt2 -inputs=%t.o -unbundle |
| 273 | +// RUN: clang-offload-bundler -type=o -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.res.o,%t.res.tgt1,%t.res.tgt2 -inputs=%t.o -unbundle -allow-missing-bundles |
273 | 274 | // RUN: diff %t.o %t.res.o
|
274 | 275 | // RUN: diff %t.empty %t.res.tgt1
|
275 | 276 | // RUN: diff %t.empty %t.res.tgt2
|
276 |
| -// RUN: clang-offload-bundler -type=o -targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -outputs=%t.res.tgt1,%t.res.o,%t.res.tgt2 -inputs=%t.o -unbundle |
| 277 | +// RUN: clang-offload-bundler -type=o -targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -outputs=%t.res.tgt1,%t.res.o,%t.res.tgt2 -inputs=%t.o -unbundle -allow-missing-bundles |
277 | 278 | // RUN: diff %t.o %t.res.o
|
278 | 279 | // RUN: diff %t.empty %t.res.tgt1
|
279 | 280 | // RUN: diff %t.empty %t.res.tgt2
|
|
288 | 289 | // RUN: diff %t.tgt1 %t.res.tgt1
|
289 | 290 | // RUN: diff %t.tgt2 %t.res.tgt2
|
290 | 291 |
|
| 292 | +// |
| 293 | +// Check error due to missing bundles |
| 294 | +// |
| 295 | +// RUN: clang-offload-bundler -type=bc -targets=host-%itanium_abi_triple,hip-amdgcn-amd-amdhsa-gfx900 -inputs=%t.bc,%t.tgt1 -outputs=%t.hip.bundle.bc |
| 296 | +// RUN: not clang-offload-bundler -type=bc -inputs=%t.hip.bundle.bc -outputs=%t.tmp.bc -unbundle \ |
| 297 | +// RUN: -targets=hip-amdgcn-amd-amdhsa-gfx906 \ |
| 298 | +// RUN: 2>&1 | FileCheck -check-prefix=MISS1 %s |
| 299 | +// RUN: not clang-offload-bundler -type=bc -inputs=%t.hip.bundle.bc -outputs=%t.tmp.bc,%t.tmp2.bc -unbundle \ |
| 300 | +// RUN: -targets=hip-amdgcn-amd-amdhsa-gfx906,hip-amdgcn-amd-amdhsa-gfx900 \ |
| 301 | +// RUN: 2>&1 | FileCheck -check-prefix=MISS1 %s |
| 302 | +// MISS1: error: Can't find bundles for hip-amdgcn-amd-amdhsa-gfx906 |
| 303 | +// RUN: not clang-offload-bundler -type=bc -inputs=%t.hip.bundle.bc -outputs=%t.tmp.bc,%t.tmp2.bc -unbundle \ |
| 304 | +// RUN: -targets=hip-amdgcn-amd-amdhsa-gfx906,hip-amdgcn-amd-amdhsa-gfx803 \ |
| 305 | +// RUN: 2>&1 | FileCheck -check-prefix=MISS2 %s |
| 306 | +// MISS2: error: Can't find bundles for hip-amdgcn-amd-amdhsa-gfx803 and hip-amdgcn-amd-amdhsa-gfx906 |
| 307 | +// RUN: not clang-offload-bundler -type=bc -inputs=%t.hip.bundle.bc -outputs=%t.tmp.bc,%t.tmp2.bc,%t.tmp3.bc -unbundle \ |
| 308 | +// RUN: -targets=hip-amdgcn-amd-amdhsa-gfx906,hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx1010 \ |
| 309 | +// RUN: 2>&1 | FileCheck -check-prefix=MISS3 %s |
| 310 | +// MISS3: error: Can't find bundles for hip-amdgcn-amd-amdhsa-gfx1010, hip-amdgcn-amd-amdhsa-gfx803, and hip-amdgcn-amd-amdhsa-gfx906 |
| 311 | + |
| 312 | +// |
| 313 | +// Check error due to duplicate targets |
| 314 | +// |
| 315 | +// RUN: not clang-offload-bundler -type=bc -targets=host-%itanium_abi_triple,hip-amdgcn-amd-amdhsa-gfx900,hip-amdgcn-amd-amdhsa-gfx900 \ |
| 316 | +// RUN: -inputs=%t.bc,%t.tgt1,%t.tgt1 -outputs=%t.hip.bundle.bc 2>&1 | FileCheck -check-prefix=DUP %s |
| 317 | +// RUN: not clang-offload-bundler -type=bc -inputs=%t.hip.bundle.bc -outputs=%t.tmp.bc,%t.tmp2.bc -unbundle \ |
| 318 | +// RUN: -targets=hip-amdgcn-amd-amdhsa-gfx906,hip-amdgcn-amd-amdhsa-gfx906 \ |
| 319 | +// RUN: 2>&1 | FileCheck -check-prefix=DUP %s |
| 320 | +// DUP: error: Duplicate targets are not allowed |
| 321 | + |
291 | 322 | // Some code so that we can create a binary out of this file.
|
292 | 323 | int A = 0;
|
293 | 324 | void test_func(void) {
|
|
0 commit comments