|
1 | 1 | // REQUIRES: x86-registered-target
|
2 | 2 |
|
| 3 | +// FIXME: enable opaque pointers support |
| 4 | +// UNSUPPORTED: enable-opaque-pointers |
| 5 | + |
3 | 6 | //
|
4 | 7 | // Check help message.
|
5 | 8 | //
|
6 |
| -// RUN: clang-offload-wrapper --help | FileCheck %s --check-prefix CHECK-HELP |
7 |
| -// CHECK-HELP: {{.*}}OVERVIEW: A tool to create a wrapper bitcode for offload target binaries. Takes offload |
8 |
| -// CHECK-HELP: {{.*}}target binaries as input and produces bitcode file containing target binaries packaged |
9 |
| -// CHECK-HELP: {{.*}}as data and initialization code which registers target binaries in offload runtime. |
10 |
| -// CHECK-HELP: {{.*}}USAGE: clang-offload-wrapper [options] <input files> |
11 |
| -// CHECK-HELP: {{.*}} -o <filename> - Output filename |
12 |
| -// CHECK-HELP: {{.*}} --target=<triple> - Target triple for the output module |
13 | 9 |
|
| 10 | +// RUN: clang-offload-wrapper --help | FileCheck %s --check-prefix CHECK-HELP |
| 11 | +// CHECK-HELP: OVERVIEW: A tool to create a wrapper bitcode for offload target binaries. |
| 12 | +// CHECK-HELP: Takes offload target binaries and optional manifest files as input |
| 13 | +// CHECK-HELP: and produces bitcode file containing target binaries packaged as data |
| 14 | +// CHECK-HELP: and initialization code which registers target binaries in the offload |
| 15 | +// CHECK-HELP: runtime. Manifest files format and contents are not restricted and are |
| 16 | +// CHECK-HELP: a subject of agreement between the device compiler and the native |
| 17 | +// CHECK-HELP: runtime for that device. When present, manifest file name should |
| 18 | +// CHECK-HELP: immediately follow the corresponding device image filename on the |
| 19 | +// CHECK-HELP: command line. Options annotating a device binary have effect on all |
| 20 | +// CHECK-HELP: subsequent input, until redefined. |
| 21 | +// CHECK-HELP: For example: |
| 22 | +// CHECK-HELP: clang-offload-wrapper \ |
| 23 | +// CHECK-HELP: -host x86_64-pc-linux-gnu \ |
| 24 | +// CHECK-HELP: -kind=sycl \ |
| 25 | +// CHECK-HELP: -target=spir64 \ |
| 26 | +// CHECK-HELP: -format=spirv \ |
| 27 | +// CHECK-HELP: -compile-opts=-g \ |
| 28 | +// CHECK-HELP: -link-opts=-cl-denorms-are-zero \ |
| 29 | +// CHECK-HELP: -entries=sym.txt \ |
| 30 | +// CHECK-HELP: -properties=props.txt \ |
| 31 | +// CHECK-HELP: a.spv \ |
| 32 | +// CHECK-HELP: a_mf.txt \ |
| 33 | +// CHECK-HELP: -target=xxx \ |
| 34 | +// CHECK-HELP: -format=native \ |
| 35 | +// CHECK-HELP: -compile-opts="" \ |
| 36 | +// CHECK-HELP: -link-opts="" \ |
| 37 | +// CHECK-HELP: -entries="" \ |
| 38 | +// CHECK-HELP: -properties="" \ |
| 39 | +// CHECK-HELP: b.bin \ |
| 40 | +// CHECK-HELP: b_mf.txt \ |
| 41 | +// CHECK-HELP: -kind=openmp \ |
| 42 | +// CHECK-HELP: c.bin\n |
| 43 | +// CHECK-HELP: This command generates an x86 wrapper object (.bc) enclosing the |
| 44 | +// CHECK-HELP: following tuples describing a single device binary each: |
| 45 | +// CHECK-HELP: |offload|target|data |data |manifest|compile|entries|properties|...| |
| 46 | +// CHECK-HELP: | kind | |format| | |options| | |...| |
| 47 | +// CHECK-HELP: |-------|------|------|-----|--------|-------|-------|----------|---| |
| 48 | +// CHECK-HELP: |sycl |spir64|spirv |a.spv|a_mf.txt| -g |sym.txt|props.txt |...| |
| 49 | +// CHECK-HELP: |sycl |xxx |native|b.bin|b_mf.txt| | | |...| |
| 50 | +// CHECK-HELP: |openmp |xxx |native|c.bin| | | | |...| |
| 51 | +// CHECK-HELP: |...| link | |
| 52 | +// CHECK-HELP: |...| options | |
| 53 | +// CHECK-HELP: |---|--------------------| |
| 54 | +// CHECK-HELP: |...|-cl-denorms-are-zero| |
| 55 | +// CHECK-HELP: |...| | |
| 56 | +// CHECK-HELP: |...| | |
| 57 | +// CHECK-HELP: USAGE: clang-offload-wrapper [options] <input files> |
| 58 | +// CHECK-HELP: OPTIONS: |
| 59 | +// CHECK-HELP: Generic Options: |
| 60 | +// CHECK-HELP: --help - Display available options (--help-hidden for more) |
| 61 | +// CHECK-HELP: --help-list - Display list of available options (--help-list-hidden for more) |
| 62 | +// CHECK-HELP: --version - Display the version of this program |
| 63 | +// CHECK-HELP: clang-offload-wrapper options: |
| 64 | +// CHECK-HELP: --batch - All input files are provided as cells in a file table file, |
| 65 | +// CHECK-HELP: other command-line input files are not allowed. |
| 66 | +// CHECK-HELP: Example input file table in batch mode: |
| 67 | +// CHECK-HELP: [Code|Symbols|Properties|Manifest] |
| 68 | +// CHECK-HELP: a_0.bc|a_0.sym|a_0.props|a_0.mnf |
| 69 | +// CHECK-HELP: a_1.bin||| |
| 70 | +// CHECK-HELP: --compile-opts=<string> - compile options passed to the offload runtime |
| 71 | +// CHECK-HELP: --desc-name=<name> - Specifies offload descriptor symbol name: '.<offload kind>.<name>', |
| 72 | +// CHECK-HELP: and makes it globally visible |
| 73 | +// CHECK-HELP: --emit-reg-funcs - Emit [un-]registration functions |
| 74 | +// CHECK-HELP: --entries=<filename> - File listing all offload function entries, SYCL offload only |
| 75 | +// CHECK-HELP: --format=<value> - device binary image formats: |
| 76 | +// CHECK-HELP: =none - not set |
| 77 | +// CHECK-HELP: =native - unknown or native |
| 78 | +// CHECK-HELP: =spirv - SPIRV binary |
| 79 | +// CHECK-HELP: =llvmbc - LLVMIR bitcode |
| 80 | +// CHECK-HELP: --host=<triple> - Target triple for the output module. If omitted, the host |
| 81 | +// CHECK-HELP: triple is used. |
| 82 | +// CHECK-HELP: --kind=<value> - offload kind: |
| 83 | +// CHECK-HELP: =unknown - unknown |
| 84 | +// CHECK-HELP: =host - host |
| 85 | +// CHECK-HELP: =openmp - OpenMP |
| 86 | +// CHECK-HELP: =hip - HIP |
| 87 | +// CHECK-HELP: =sycl - SYCL |
| 88 | +// CHECK-HELP: --link-opts=<string> - link options passed to the offload runtime |
| 89 | +// CHECK-HELP: -o <filename> - Output filename |
| 90 | +// CHECK-HELP: --properties=<filename> - File listing device binary image properties, SYCL offload only |
| 91 | +// CHECK-HELP: --target=<string> - offload target triple |
| 92 | +// CHECK-HELP: -v - verbose output |
| 93 | + |
| 94 | +// ------- |
| 95 | +// Generate files to wrap. |
14 | 96 | //
|
15 |
| -// Generate a file to wrap. |
16 |
| -// |
17 |
| -// RUN: echo 'Content of device file' > %t.tgt |
18 |
| - |
| 97 | +// RUN: echo 'Content of device file1' > %t1.tgt |
| 98 | +// RUN: echo 'Content of device file2' > %t2.tgt |
| 99 | +// RUN: echo 'Content of device file3' > %t3.tgt |
| 100 | +// RUN: echo 'Content of manifest file1' > %t1_mf.txt |
19 | 101 | //
|
| 102 | +// ------- |
20 | 103 | // Check bitcode produced by the wrapper tool.
|
21 | 104 | //
|
22 |
| -// RUN: clang-offload-wrapper -add-omp-offload-notes -target=x86_64-pc-linux-gnu -o %t.wrapper.bc %t.tgt 2>&1 | FileCheck %s --check-prefix ELF-WARNING |
| 105 | +// RUN: clang-offload-wrapper -add-omp-offload-notes \ |
| 106 | +// RUN: -host=x86_64-pc-linux-gnu \ |
| 107 | +// RUN: -kind=openmp -target=tg2 -format=native %t3.tgt %t1_mf.txt \ |
| 108 | +// RUN: -kind=sycl -target=tg1 -compile-opts=-g -link-opts=-cl-denorms-are-zero \ |
| 109 | +// RUN: -format spirv %t1.tgt \ |
| 110 | +// RUN: -target=tg2 -compile-opts= -link-opts= \ |
| 111 | +// RUN: -format native %t2.tgt \ |
| 112 | +// RUN: -o %t.wrapper.bc 2>&1 | FileCheck %s --check-prefix ELF-WARNING |
23 | 113 | // RUN: llvm-dis %t.wrapper.bc -o - | FileCheck %s --check-prefix CHECK-IR
|
24 | 114 |
|
25 | 115 | // ELF-WARNING: is not an ELF image, so notes cannot be added to it.
|
26 | 116 | // CHECK-IR: target triple = "x86_64-pc-linux-gnu"
|
27 | 117 |
|
28 |
| -// CHECK-IR-DAG: [[ENTTY:%.+]] = type { ptr, ptr, i{{32|64}}, i32, i32 } |
29 |
| -// CHECK-IR-DAG: [[IMAGETY:%.+]] = type { ptr, ptr, ptr, ptr } |
30 |
| -// CHECK-IR-DAG: [[DESCTY:%.+]] = type { i32, ptr, ptr, ptr } |
| 118 | +// --- OpenMP device binary image descriptor structure |
| 119 | +// CHECK-IR-DAG: [[ENTTY:%.+]] = type { i8*, i8*, i{{32|64}}, i32, i32 } |
| 120 | +// CHECK-IR-DAG: [[IMAGETY:%.+]] = type { i8*, i8*, [[ENTTY]]*, [[ENTTY]]* } |
| 121 | +// CHECK-IR-DAG: [[DESCTY:%.+]] = type { i32, [[IMAGETY]]*, [[ENTTY]]*, [[ENTTY]]* } |
| 122 | + |
| 123 | +// --- SYCL device binary image descriptor structure |
| 124 | +// CHECK-IR-DAG: [[SYCL_IMAGETY:%.+]] = type { i16, i8, i8, i8*, i8*, i8*, i8*, i8*, i8*, i8*, [[ENTTY]]*, [[ENTTY]]*, [[PROPSETTY:%.+]]*, [[PROPSETTY]]* } |
| 125 | +// CHECK-IR-DAG: [[PROPSETTY]] = type { i8*, [[PROPTY:%.+]]*, [[PROPTY]]* } |
| 126 | +// CHECK-IR-DAG: [[PROPTY]] = type { i8*, i8*, i32, i64 } |
| 127 | +// CHECK-IR-DAG: [[SYCL_DESCTY:%.+]] = type { i16, i16, [[SYCL_IMAGETY]]*, [[ENTTY]]*, [[ENTTY]]* } |
31 | 128 |
|
32 | 129 | // CHECK-IR: [[ENTBEGIN:@.+]] = external hidden constant [[ENTTY]]
|
33 | 130 | // CHECK-IR: [[ENTEND:@.+]] = external hidden constant [[ENTTY]]
|
34 | 131 |
|
35 | 132 | // CHECK-IR: [[DUMMY:@.+]] = hidden constant [0 x [[ENTTY]]] zeroinitializer, section "omp_offloading_entries"
|
36 | 133 |
|
37 |
| -// CHECK-IR: [[BIN:@.+]] = internal unnamed_addr constant [[BINTY:\[[0-9]+ x i8\]]] c"Content of device file{{.+}}" |
| 134 | +// CHECK-IR: [[OMP_BIN:@.+]] = internal unnamed_addr constant [[OMP_BINTY:\[[0-9]+ x i8\]]] c"Content of device file3{{.+}}" |
| 135 | +// CHECK-IR: [[OMP_INFO:@.+]] = internal local_unnamed_addr constant [2 x i64] [i64 ptrtoint ([{{[0-9]+}} x i8]* [[OMP_BIN]] to i64), i64 24], section ".tgtimg", align 16 |
38 | 136 |
|
39 |
| -// CHECK-IR: [[IMAGES:@.+]] = internal unnamed_addr constant [1 x [[IMAGETY]]] [{{.+}} { ptr [[BIN]], ptr getelementptr inbounds ([[BINTY]], ptr [[BIN]], i64 1, i64 0), ptr [[ENTBEGIN]], ptr [[ENTEND]] }] |
| 137 | +// CHECK-IR: [[OMP_IMAGES:@.+]] = internal unnamed_addr constant [1 x [[IMAGETY]]] [{{.+}} { i8* getelementptr inbounds ([[OMP_BINTY]], [[OMP_BINTY]]* [[OMP_BIN]], i64 0, i64 0), i8* getelementptr inbounds ([[OMP_BINTY]], [[OMP_BINTY]]* [[OMP_BIN]], i64 1, i64 0), [[ENTTY]]* [[ENTBEGIN]], [[ENTTY]]* [[ENTEND]] }] |
40 | 138 |
|
41 |
| -// CHECK-IR: [[DESC:@.+]] = internal constant [[DESCTY]] { i32 1, ptr [[IMAGES]], ptr [[ENTBEGIN]], ptr [[ENTEND]] } |
| 139 | +// CHECK-IR: [[OMP_DESC:@.+]] = internal constant [[DESCTY]] { i32 1, [[IMAGETY]]* getelementptr inbounds ([1 x [[IMAGETY]]], [1 x [[IMAGETY]]]* [[OMP_IMAGES]], i64 0, i64 0), [[ENTTY]]* [[ENTBEGIN]], [[ENTTY]]* [[ENTEND]] } |
42 | 140 |
|
43 |
| -// CHECK-IR: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 1, ptr [[REGFN:@.+]], ptr null }] |
44 |
| -// CHECK-IR: @llvm.global_dtors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 1, ptr [[UNREGFN:@.+]], ptr null }] |
| 141 | +// CHECK-IR: [[SYCL_TGT0:@.+]] = internal unnamed_addr constant [4 x i8] c"tg1\00" |
| 142 | +// CHECK-IR: [[SYCL_COMPILE_OPTS0:@.+]] = internal unnamed_addr constant [3 x i8] c"-g\00" |
| 143 | +// CHECK-IR: [[SYCL_LINK_OPTS0:@.+]] = internal unnamed_addr constant [21 x i8] c"-cl-denorms-are-zero\00" |
| 144 | +// CHECK-IR: [[SYCL_BIN0:@.+]] = internal unnamed_addr constant [[SYCL_BIN0TY:\[[0-9]+ x i8\]]] c"Content of device file1{{.+}}" |
| 145 | +// CHECK-IR: [[SYCL_INFO:@.+]] = internal local_unnamed_addr constant [2 x i64] [i64 ptrtoint ([{{[0-9]+}} x i8]* [[SYCL_BIN0]] to i64), i64 24], section ".tgtimg", align 16 |
45 | 146 |
|
46 |
| -// CHECK-IR: define internal void [[REGFN]]() |
47 |
| -// CHECK-IR: call void @__tgt_register_lib(ptr [[DESC]]) |
| 147 | +// CHECK-IR: [[SYCL_TGT1:@.+]] = internal unnamed_addr constant [4 x i8] c"tg2\00" |
| 148 | +// CHECK-IR: [[SYCL_COMPILE_OPTS1:@.+]] = internal unnamed_addr constant [1 x i8] zeroinitializer |
| 149 | +// CHECK-IR: [[SYCL_LINK_OPTS1:@.+]] = internal unnamed_addr constant [1 x i8] zeroinitializer |
| 150 | +// CHECK-IR: [[SYCL_BIN1:@.+]] = internal unnamed_addr constant [[SYCL_BIN1TY:\[[0-9]+ x i8\]]] c"Content of device file2{{.+}}" |
| 151 | +// CHECK-IR: [[SYCL_INFO1:@.+]] = internal local_unnamed_addr constant [2 x i64] [i64 ptrtoint ([{{[0-9]+}} x i8]* [[SYCL_BIN1]] to i64), i64 24], section ".tgtimg", align 16 |
| 152 | + |
| 153 | +// CHECK-IR: [[SYCL_IMAGES:@.+]] = internal unnamed_addr constant [2 x [[SYCL_IMAGETY]]] [{{.*}} { i16 2, i8 4, i8 2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[SYCL_TGT0]], i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[SYCL_COMPILE_OPTS0]], i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* [[SYCL_LINK_OPTS0]], i64 0, i64 0), i8* null, i8* null, i8* getelementptr inbounds ([[SYCL_BIN0TY]], [[SYCL_BIN0TY]]* [[SYCL_BIN0]], i64 0, i64 0), i8* getelementptr inbounds ([[SYCL_BIN0TY]], [[SYCL_BIN0TY]]* [[SYCL_BIN0]], i64 1, i64 0), [[ENTTY]]* null, [[ENTTY]]* null, [[PROPSETTY]]* null, [[PROPSETTY]]* null }, [[SYCL_IMAGETY]] { i16 2, i8 4, i8 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[SYCL_TGT1]], i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* [[SYCL_COMPILE_OPTS1]], i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* [[SYCL_LINK_OPTS1]], i64 0, i64 0), i8* null, i8* null, i8* getelementptr inbounds ([[SYCL_BIN1TY]], [[SYCL_BIN1TY]]* [[SYCL_BIN1]], i64 0, i64 0), i8* getelementptr inbounds ([[SYCL_BIN1TY]], [[SYCL_BIN1TY]]* [[SYCL_BIN1]], i64 1, i64 0), [[ENTTY]]* null, [[ENTTY]]* null, [[PROPSETTY]]* null, [[PROPSETTY]]* null }] |
| 154 | + |
| 155 | +// CHECK-IR: [[SYCL_DESC:@.+]] = internal constant [[SYCL_DESCTY]] { i16 1, i16 2, [[SYCL_IMAGETY]]* getelementptr inbounds ([2 x [[SYCL_IMAGETY]]], [2 x [[SYCL_IMAGETY]]]* [[SYCL_IMAGES]], i64 0, i64 0), [[ENTTY]]* null, [[ENTTY]]* null } |
| 156 | + |
| 157 | +// CHECK-IR: @llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 1, void ()* [[OMP_REGFN:@.+]], i8* null }, { i32, void ()*, i8* } { i32 1, void ()* [[SYCL_REGFN:@.+]], i8* null }] |
| 158 | + |
| 159 | +// CHECK-IR: @llvm.global_dtors = appending global [2 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 1, void ()* [[OMP_UNREGFN:@.+]], i8* null }, { i32, void ()*, i8* } { i32 1, void ()* [[SYCL_UNREGFN:@.+]], i8* null }] |
| 160 | + |
| 161 | +// CHECK-IR: define internal void [[OMP_REGFN]]() |
| 162 | +// CHECK-IR: call void @__tgt_register_lib([[DESCTY]]* [[OMP_DESC]]) |
48 | 163 | // CHECK-IR: ret void
|
49 | 164 |
|
50 |
| -// CHECK-IR: declare void @__tgt_register_lib(ptr) |
| 165 | +// CHECK-IR: declare void @__tgt_register_lib([[DESCTY]]*) |
51 | 166 |
|
52 |
| -// CHECK-IR: define internal void [[UNREGFN]]() |
53 |
| -// CHECK-IR: call void @__tgt_unregister_lib(ptr [[DESC]]) |
| 167 | +// CHECK-IR: define internal void [[OMP_UNREGFN]]() |
| 168 | +// CHECK-IR: call void @__tgt_unregister_lib([[DESCTY]]* [[OMP_DESC]]) |
54 | 169 | // CHECK-IR: ret void
|
55 | 170 |
|
56 |
| -// CHECK-IR: declare void @__tgt_unregister_lib(ptr) |
| 171 | +// CHECK-IR: declare void @__tgt_unregister_lib([[DESCTY]]*) |
| 172 | + |
| 173 | +// CHECK-IR: define internal void [[SYCL_REGFN]]() |
| 174 | +// CHECK-IR: call void @__sycl_register_lib([[SYCL_DESCTY]]* [[SYCL_DESC]]) |
| 175 | +// CHECK-IR: ret void |
| 176 | + |
| 177 | +// CHECK-IR: declare void @__sycl_register_lib([[SYCL_DESCTY]]*) |
| 178 | + |
| 179 | +// CHECK-IR: define internal void [[SYCL_UNREGFN]]() |
| 180 | +// CHECK-IR: call void @__sycl_unregister_lib([[SYCL_DESCTY]]* [[SYCL_DESC]]) |
| 181 | +// CHECK-IR: ret void |
| 182 | + |
| 183 | +// CHECK-IR: declare void @__sycl_unregister_lib([[SYCL_DESCTY]]*) |
| 184 | + |
| 185 | +// ------- |
| 186 | +// Check options' effects: -emit-reg-funcs, -desc-name |
| 187 | +// |
| 188 | +// RUN: echo 'Content of device file' > %t.tgt |
| 189 | +// |
| 190 | +// RUN: clang-offload-wrapper -kind sycl -host=x86_64-pc-linux-gnu -emit-reg-funcs=0 -desc-name=lalala -o - %t.tgt | llvm-dis | FileCheck %s --check-prefix CHECK-IR1 |
| 191 | +// CHECK-IR1: source_filename = "offload.wrapper.object" |
| 192 | +// CHECK-IR1: [[IMAGETY:%.+]] = type { i16, i8, i8, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %__tgt_offload_entry*, %__tgt_offload_entry*, %_pi_device_binary_property_set_struct*, %_pi_device_binary_property_set_struct* } |
| 193 | +// CHECK-IR1: [[ENTTY:%.+]] = type { i8*, i8*, i64, i32, i32 } |
| 194 | +// CHECK-IR1: [[DESCTY:%.+]] = type { i16, i16, [[IMAGETY]]*, [[ENTTY]]*, [[ENTTY]]* } |
| 195 | +// CHECK-IR1-NOT: @llvm.global_ctors |
| 196 | +// CHECK-IR1-NOT: @llvm.global_dtors |
| 197 | +// CHECK-IR1-NOT: section ".tgtimg" |
| 198 | +// CHECK-IR1: @.sycl_offloading.lalala = constant [[DESCTY]] { i16 {{[0-9]+}}, i16 1, [[IMAGETY]]* getelementptr inbounds ([1 x [[IMAGETY]]], [1 x [[IMAGETY]]]* @.sycl_offloading.device_images, i64 0, i64 0), [[ENTTY]]* null, [[ENTTY]]* null } |
| 199 | + |
| 200 | +// ------- |
| 201 | +// Check option's effects: -entries |
| 202 | +// |
| 203 | +// RUN: echo 'Content of device file' > %t.tgt |
| 204 | +// RUN: echo -e 'entryA\nentryB' > %t.txt |
| 205 | +// RUN: clang-offload-wrapper -host=x86_64-pc-linux-gnu -kind=sycl -entries=%t.txt %t.tgt -o - | llvm-dis | FileCheck %s --check-prefix CHECK-IR3 |
| 206 | +// CHECK-IR3: source_filename = "offload.wrapper.object" |
| 207 | +// CHECK-IR3: @__sycl_offload_entry_name = internal unnamed_addr constant [7 x i8] c"entryA\00" |
| 208 | +// CHECK-IR3: @__sycl_offload_entry_name.1 = internal unnamed_addr constant [7 x i8] c"entryB\00" |
| 209 | +// CHECK-IR3: @__sycl_offload_entries_arr = internal constant [2 x %__tgt_offload_entry] [%__tgt_offload_entry { i8* null, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__sycl_offload_entry_name, i64 0, i64 0), i64 0, i32 0, i32 0 }, %__tgt_offload_entry { i8* null, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__sycl_offload_entry_name.1, i64 0, i64 0), i64 0, i32 0, i32 0 }] |
| 210 | +// CHECK-IR3: @.sycl_offloading.device_images = internal unnamed_addr constant [1 x %__tgt_device_image] [%__tgt_device_image { {{.*}}, %__tgt_offload_entry* getelementptr inbounds ([2 x %__tgt_offload_entry], [2 x %__tgt_offload_entry]* @__sycl_offload_entries_arr, i64 0, i64 0), %__tgt_offload_entry* getelementptr inbounds ([2 x %__tgt_offload_entry], [2 x %__tgt_offload_entry]* @__sycl_offload_entries_arr, i64 1, i64 0), %_pi_device_binary_property_set_struct* null, %_pi_device_binary_property_set_struct* null }] |
| 211 | + |
| 212 | +// ------- |
| 213 | +// Check that device image can be extracted from the wrapper object by the clang-offload-bundler tool. |
| 214 | +// |
| 215 | +// RUN: clang-offload-wrapper -o %t.wrapper.bc -host=x86_64-pc-linux-gnu -kind=sycl -target=spir64-unknown-linux %t1.tgt |
| 216 | +// RUN: %clang -target x86_64-pc-linux-gnu -c %t.wrapper.bc -o %t.wrapper.o |
| 217 | +// RUN: clang-offload-bundler --type=o -input=%t.wrapper.o --targets=sycl-spir64-unknown-linux -output=%t1.out --unbundle |
| 218 | +// RUN: diff %t1.out %t1.tgt |
57 | 219 |
|
58 | 220 | // Check that clang-offload-wrapper adds LLVMOMPOFFLOAD notes
|
59 | 221 | // into the ELF offload images:
|
60 | 222 | // RUN: yaml2obj %S/Inputs/empty-elf-template.yaml -o %t.64le -DBITS=64 -DENCODING=LSB
|
61 |
| -// RUN: clang-offload-wrapper -add-omp-offload-notes -target=x86_64-pc-linux-gnu -o %t.wrapper.elf64le.bc %t.64le |
| 223 | +// RUN: clang-offload-wrapper -add-omp-offload-notes -kind=openmp -target=x86_64-pc-linux-gnu -o %t.wrapper.elf64le.bc %t.64le |
62 | 224 | // RUN: llvm-dis %t.wrapper.elf64le.bc -o - | FileCheck %s --check-prefix OMPNOTES
|
63 | 225 | // RUN: yaml2obj %S/Inputs/empty-elf-template.yaml -o %t.64be -DBITS=64 -DENCODING=MSB
|
64 |
| -// RUN: clang-offload-wrapper -add-omp-offload-notes -target=x86_64-pc-linux-gnu -o %t.wrapper.elf64be.bc %t.64be |
| 226 | +// RUN: clang-offload-wrapper -add-omp-offload-notes -kind=openmp -target=x86_64-pc-linux-gnu -o %t.wrapper.elf64be.bc %t.64be |
65 | 227 | // RUN: llvm-dis %t.wrapper.elf64be.bc -o - | FileCheck %s --check-prefix OMPNOTES
|
66 | 228 | // RUN: yaml2obj %S/Inputs/empty-elf-template.yaml -o %t.32le -DBITS=32 -DENCODING=LSB
|
67 |
| -// RUN: clang-offload-wrapper -add-omp-offload-notes -target=x86_64-pc-linux-gnu -o %t.wrapper.elf32le.bc %t.32le |
| 229 | +// RUN: clang-offload-wrapper -add-omp-offload-notes -kind=openmp -target=x86_64-pc-linux-gnu -o %t.wrapper.elf32le.bc %t.32le |
68 | 230 | // RUN: llvm-dis %t.wrapper.elf32le.bc -o - | FileCheck %s --check-prefix OMPNOTES
|
69 | 231 | // RUN: yaml2obj %S/Inputs/empty-elf-template.yaml -o %t.32be -DBITS=32 -DENCODING=MSB
|
70 |
| -// RUN: clang-offload-wrapper -add-omp-offload-notes -target=x86_64-pc-linux-gnu -o %t.wrapper.elf32be.bc %t.32be |
| 232 | +// RUN: clang-offload-wrapper -add-omp-offload-notes -kind=openmp -target=x86_64-pc-linux-gnu -o %t.wrapper.elf32be.bc %t.32be |
71 | 233 | // RUN: llvm-dis %t.wrapper.elf32be.bc -o - | FileCheck %s --check-prefix OMPNOTES
|
72 | 234 |
|
73 | 235 | // There is no clean way for extracting the offload image
|
|
0 commit comments