|
10 | 10 | // In all these tests also ensure functionality with bundled object files still
|
11 | 11 | // works correctly.
|
12 | 12 |
|
13 |
| -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
14 |
| -// Make bundled object with targets: |
15 |
| -// sycl-spir64-unknown-unknown |
16 |
| -// host-x86_64-unknown-linux-gnu |
17 |
| -// RUN: %clangxx -fsycl -c %s -o %t_bundled.o |
18 |
| - |
19 |
| -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
20 |
| -// Make three distinct BC files |
21 |
| -// RUN: %clangxx -fsycl -fsycl-device-only -DTYPE1 %s -o %t1.bc |
22 |
| -// RUN: %clangxx -fsycl -fsycl-device-only -DTYPE2 %s -o %t2.bc |
23 |
| -// RUN: %clangxx -fsycl -fsycl-device-only -DTYPE3 %s -o %t3.bc |
24 |
| - |
25 |
| -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
26 |
| -// Bundle BC files to different targets: |
27 |
| -// host-spir64-unknown-unknown |
28 |
| -// host-spir64_gen |
29 |
| -// host-spir64_x86_64 |
30 |
| -// RUN: clang-offload-bundler -type=bc -targets=host-spir64-unknown-unknown -input=%t1.bc -output=%t1_bundled.bc |
31 |
| -// RUN: clang-offload-bundler -type=bc -targets=host-spir64_gen -input=%t2.bc -output=%t2_bundled.bc |
32 |
| -// RUN: clang-offload-bundler -type=bc -targets=host-spir64_x86_64 -input=%t3.bc -output=%t3_bundled.bc |
33 |
| - |
34 |
| -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
35 |
| -// Make archive with bundled BC and o files |
36 |
| -// RUN: rm -f %t_bundled.a |
37 |
| -// RUN: llvm-ar cr %t_bundled.a %t1_bundled.bc %t2_bundled.bc %t3_bundled.bc %t_bundled.o |
38 |
| - |
39 |
| -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 13 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 14 | +// Make bundled object with targets: |
| 15 | +// sycl-spir64-unknown-unknown |
| 16 | +// host-x86_64-unknown-linux-gnu |
| 17 | +// RUN: %clangxx -fsycl --no-offload-new-driver -c %s -o %t_bundled.o |
| 18 | + |
| 19 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 20 | +// Make three distinct BC files |
| 21 | +// RUN: %clangxx -fsycl --no-offload-new-driver -fsycl-device-only -DTYPE1 %s -o %t1.bc |
| 22 | +// RUN: %clangxx -fsycl --no-offload-new-driver -fsycl-device-only -DTYPE2 %s -o %t2.bc |
| 23 | +// RUN: %clangxx -fsycl --no-offload-new-driver -fsycl-device-only -DTYPE3 %s -o %t3.bc |
| 24 | + |
| 25 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 26 | +// Bundle BC files to different targets: |
| 27 | +// host-spir64-unknown-unknown |
| 28 | +// host-spir64_gen |
| 29 | +// host-spir64_x86_64 |
| 30 | +// RUN: clang-offload-bundler -type=bc -targets=host-spir64-unknown-unknown -input=%t1.bc -output=%t1_bundled.bc |
| 31 | +// RUN: clang-offload-bundler -type=bc -targets=host-spir64_gen -input=%t2.bc -output=%t2_bundled.bc |
| 32 | +// RUN: clang-offload-bundler -type=bc -targets=host-spir64_x86_64 -input=%t3.bc -output=%t3_bundled.bc |
| 33 | + |
| 34 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 35 | +// Make archive with bundled BC and o files |
| 36 | +// RUN: rm -f %t_bundled.a |
| 37 | +// RUN: llvm-ar cr %t_bundled.a %t1_bundled.bc %t2_bundled.bc %t3_bundled.bc %t_bundled.o |
| 38 | + |
| 39 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
40 | 40 | // TEST1
|
41 |
| -// Check that -list with various archive types can find all targets |
42 |
| -// RUN: clang-offload-bundler -list -type=ao -input=%t_bundled.a > %t_list_ao.txt |
43 |
| -// RUN: clang-offload-bundler -list -type=aoo -input=%t_bundled.a > %t_list_aoo.txt |
44 |
| -// RUN: FileCheck --check-prefixes=CHECK-LIST < %t_list_ao.txt %s |
45 |
| -// RUN: FileCheck --check-prefixes=CHECK-LIST < %t_list_aoo.txt %s |
46 |
| - |
47 |
| -// CHECK-LIST-DAG: sycl-spir64-unknown-unknown |
48 |
| -// CHECK-LIST-DAG: host-x86_64-unknown-linux-gnu |
49 |
| -// CHECK-LIST-DAG: host-spir64-unknown-unknown |
50 |
| -// CHECK-LIST-DAG: host-spir64_gen |
51 |
| -// CHECK-LIST-DAG: host-spir64_x86_64 |
52 |
| - |
53 |
| -// RUN: wc -l %t_list_ao.txt | FileCheck --check-prefixes=CHECK-LIST-LENGTH %s |
54 |
| -// RUN: wc -l %t_list_aoo.txt | FileCheck --check-prefixes=CHECK-LIST-LENGTH %s |
55 |
| - |
56 |
| -// CHECK-LIST-LENGTH: 5 |
57 |
| - |
58 |
| -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 41 | +// Check that -list with various archive types can find all targets |
| 42 | +// RUN: clang-offload-bundler -list -type=ao -input=%t_bundled.a > %t_list_ao.txt |
| 43 | +// RUN: clang-offload-bundler -list -type=aoo -input=%t_bundled.a > %t_list_aoo.txt |
| 44 | +// RUN: FileCheck --check-prefixes=CHECK-LIST < %t_list_ao.txt %s |
| 45 | +// RUN: FileCheck --check-prefixes=CHECK-LIST < %t_list_aoo.txt %s |
| 46 | + |
| 47 | +// CHECK-LIST-DAG: sycl-spir64-unknown-unknown |
| 48 | +// CHECK-LIST-DAG: host-x86_64-unknown-linux-gnu |
| 49 | +// CHECK-LIST-DAG: host-spir64-unknown-unknown |
| 50 | +// CHECK-LIST-DAG: host-spir64_gen |
| 51 | +// CHECK-LIST-DAG: host-spir64_x86_64 |
| 52 | + |
| 53 | +// RUN: wc -l %t_list_ao.txt | FileCheck --check-prefixes=CHECK-LIST-LENGTH %s |
| 54 | +// RUN: wc -l %t_list_aoo.txt | FileCheck --check-prefixes=CHECK-LIST-LENGTH %s |
| 55 | + |
| 56 | +// CHECK-LIST-LENGTH: 5 |
| 57 | + |
| 58 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
59 | 59 | // TEST2
|
60 |
| -// Test -check-section |
61 |
| -// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown |
62 |
| -// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-x86_64-unknown-linux-gnu |
63 |
| -// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64-unknown-unknown |
64 |
| -// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_gen |
65 |
| -// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_x86_64 |
66 |
| -// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown-a |
67 |
| -// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-x86_64-unknown-linux-gnu-b |
68 |
| -// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64-unknown-unknown-c |
69 |
| -// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_gen-d |
70 |
| -// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_x86_64-e |
71 |
| -// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown |
72 |
| -// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-x86_64-unknown-linux-gnu |
73 |
| -// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64-unknown-unknown |
74 |
| -// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_gen |
75 |
| -// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_x86_64 |
76 |
| -// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown-a |
77 |
| -// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-x86_64-unknown-linux-gnu-b |
78 |
| -// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64-unknown-unknown-c |
79 |
| -// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_gen-d |
80 |
| -// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_x86_64-e |
81 |
| - |
82 |
| -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
83 |
| -// Unbundle object file to use as a reference result |
84 |
| -// RUN: clang-offload-bundler -unbundle -type=o -input=%t_bundled.o -targets=sycl-spir64-unknown-unknown -output=%t_unbundled_A.o |
85 |
| -// RUN: clang-offload-bundler -unbundle -type=o -input=%t_bundled.o -targets=host-x86_64-unknown-linux-gnu -output=%t_unbundled_B.o |
86 |
| - |
87 |
| -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 60 | +// Test -check-section |
| 61 | +// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown |
| 62 | +// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-x86_64-unknown-linux-gnu |
| 63 | +// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64-unknown-unknown |
| 64 | +// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_gen |
| 65 | +// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_x86_64 |
| 66 | +// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown-a |
| 67 | +// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-x86_64-unknown-linux-gnu-b |
| 68 | +// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64-unknown-unknown-c |
| 69 | +// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_gen-d |
| 70 | +// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_x86_64-e |
| 71 | +// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown |
| 72 | +// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-x86_64-unknown-linux-gnu |
| 73 | +// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64-unknown-unknown |
| 74 | +// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_gen |
| 75 | +// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_x86_64 |
| 76 | +// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown-a |
| 77 | +// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-x86_64-unknown-linux-gnu-b |
| 78 | +// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64-unknown-unknown-c |
| 79 | +// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_gen-d |
| 80 | +// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_x86_64-e |
| 81 | + |
| 82 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 83 | +// Unbundle object file to use as a reference result |
| 84 | +// RUN: clang-offload-bundler -unbundle -type=o -input=%t_bundled.o -targets=sycl-spir64-unknown-unknown -output=%t_unbundled_A.o |
| 85 | +// RUN: clang-offload-bundler -unbundle -type=o -input=%t_bundled.o -targets=host-x86_64-unknown-linux-gnu -output=%t_unbundled_B.o |
| 86 | + |
| 87 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
88 | 88 | // TEST3
|
89 |
| -// Test archive unbundling |
90 |
| -// RUN: clang-offload-bundler -unbundle -type=aoo -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown -output=%t_list1.txt |
91 |
| -// RUN: clang-offload-bundler -unbundle -type=aoo -input=%t_bundled.a -targets=host-x86_64-unknown-linux-gnu -output=%t_list2.txt |
92 |
| -// RUN: clang-offload-bundler -unbundle -type=aoo -input=%t_bundled.a -targets=host-spir64-unknown-unknown -output=%t_list3.txt |
93 |
| -// RUN: clang-offload-bundler -unbundle -type=aoo -input=%t_bundled.a -targets=host-spir64_gen -output=%t_list4.txt |
94 |
| -// RUN: clang-offload-bundler -unbundle -type=aoo -input=%t_bundled.a -targets=host-spir64_x86_64 -output=%t_list5.txt |
95 |
| - |
96 |
| -// RUN: cmp %t_unbundled_A.o `cat %t_list1.txt` |
97 |
| -// RUN: cmp %t_unbundled_B.o `cat %t_list2.txt` |
98 |
| -// RUN: cmp %t1.bc `cat %t_list3.txt` |
99 |
| -// RUN: cmp %t2.bc `cat %t_list4.txt` |
100 |
| -// RUN: cmp %t3.bc `cat %t_list5.txt` |
101 |
| - |
102 |
| -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 89 | +// Test archive unbundling |
| 90 | +// RUN: clang-offload-bundler -unbundle -type=aoo -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown -output=%t_list1.txt |
| 91 | +// RUN: clang-offload-bundler -unbundle -type=aoo -input=%t_bundled.a -targets=host-x86_64-unknown-linux-gnu -output=%t_list2.txt |
| 92 | +// RUN: clang-offload-bundler -unbundle -type=aoo -input=%t_bundled.a -targets=host-spir64-unknown-unknown -output=%t_list3.txt |
| 93 | +// RUN: clang-offload-bundler -unbundle -type=aoo -input=%t_bundled.a -targets=host-spir64_gen -output=%t_list4.txt |
| 94 | +// RUN: clang-offload-bundler -unbundle -type=aoo -input=%t_bundled.a -targets=host-spir64_x86_64 -output=%t_list5.txt |
| 95 | + |
| 96 | +// RUN: cmp %t_unbundled_A.o `cat %t_list1.txt` |
| 97 | +// RUN: cmp %t_unbundled_B.o `cat %t_list2.txt` |
| 98 | +// RUN: cmp %t1.bc `cat %t_list3.txt` |
| 99 | +// RUN: cmp %t2.bc `cat %t_list4.txt` |
| 100 | +// RUN: cmp %t3.bc `cat %t_list5.txt` |
| 101 | + |
| 102 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
103 | 103 | // TEST4
|
104 |
| -// Test archive unbundling for multiple targets |
| 104 | +// Test archive unbundling for multiple targets |
105 | 105 | // RUN: clang-offload-bundler -unbundle -type=aoo -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown,host-spir64_gen -output=%t_listA.txt -output=%t_listB.txt
|
106 | 106 |
|
107 |
| -// RUN: cmp %t_unbundled_A.o `cat %t_listA.txt` |
108 |
| -// RUN: cmp %t2.bc `cat %t_listB.txt` |
| 107 | +// RUN: cmp %t_unbundled_A.o `cat %t_listA.txt` |
| 108 | +// RUN: cmp %t2.bc `cat %t_listB.txt` |
109 | 109 |
|
110 |
| -#include <sycl/sycl.hpp> |
| 110 | +#include <sycl/sycl.hpp> |
111 | 111 |
|
112 | 112 | SYCL_EXTERNAL int foo(int x) {
|
113 | 113 |
|
|
0 commit comments