|
5 | 5 | //
|
6 | 6 |
|
7 | 7 | // RUN: clang-offload-wrapper --help | FileCheck %s --check-prefix CHECK-HELP
|
8 |
| -// CHECK-HELP: A tool to create a wrapper bitcode for offload target binaries. |
| 8 | +// CHECK-HELP: OVERVIEW: A tool to create a wrapper bitcode for offload target binaries. |
9 | 9 | // CHECK-HELP: Takes offload target binaries and optional manifest files as input
|
10 | 10 | // CHECK-HELP: and produces bitcode file containing target binaries packaged as data
|
11 | 11 | // CHECK-HELP: and initialization code which registers target binaries in the offload
|
|
16 | 16 | // CHECK-HELP: command line. Options annotating a device binary have effect on all
|
17 | 17 | // CHECK-HELP: subsequent input, until redefined.
|
18 | 18 | // CHECK-HELP: For example:
|
19 |
| -// CHECK-HELP: clang-offload-wrapper |
20 |
| -// CHECK-HELP: -host x86_64-pc-linux-gnu |
21 |
| -// CHECK-HELP: -kind=sycl |
22 |
| -// CHECK-HELP: -target=spir64 |
23 |
| -// CHECK-HELP: -format=spirv |
24 |
| -// CHECK-HELP: -compile-opts=-g |
25 |
| -// CHECK-HELP: -link-opts=-cl-denorms-are-zero |
26 |
| -// CHECK-HELP: a.spv |
27 |
| -// CHECK-HELP: a_mf.txt |
28 |
| -// CHECK-HELP: -target=xxx |
29 |
| -// CHECK-HELP: -format=native |
30 |
| -// CHECK-HELP: -compile-opts="" |
31 |
| -// CHECK-HELP: -link-opts="" |
32 |
| -// CHECK-HELP: b.bin |
33 |
| -// CHECK-HELP: b_mf.txt |
34 |
| -// CHECK-HELP: -kind=openmp |
35 |
| -// CHECK-HELP: c.bin |
| 19 | +// CHECK-HELP: clang-offload-wrapper \ |
| 20 | +// CHECK-HELP: -host x86_64-pc-linux-gnu \ |
| 21 | +// CHECK-HELP: -kind=sycl \ |
| 22 | +// CHECK-HELP: -target=spir64 \ |
| 23 | +// CHECK-HELP: -format=spirv \ |
| 24 | +// CHECK-HELP: -compile-opts=-g \ |
| 25 | +// CHECK-HELP: -link-opts=-cl-denorms-are-zero \ |
| 26 | +// CHECK-HELP: -entries=sym.txt \ |
| 27 | +// CHECK-HELP: -properties=props.txt \ |
| 28 | +// CHECK-HELP: a.spv \ |
| 29 | +// CHECK-HELP: a_mf.txt \ |
| 30 | +// CHECK-HELP: -target=xxx \ |
| 31 | +// CHECK-HELP: -format=native \ |
| 32 | +// CHECK-HELP: -compile-opts="" \ |
| 33 | +// CHECK-HELP: -link-opts="" \ |
| 34 | +// CHECK-HELP: -entries="" \ |
| 35 | +// CHECK-HELP: -properties="" \ |
| 36 | +// CHECK-HELP: b.bin \ |
| 37 | +// CHECK-HELP: b_mf.txt \ |
| 38 | +// CHECK-HELP: -kind=openmp \ |
| 39 | +// CHECK-HELP: c.bin\n |
36 | 40 | // CHECK-HELP: This command generates an x86 wrapper object (.bc) enclosing the
|
37 | 41 | // CHECK-HELP: following tuples describing a single device binary each:
|
38 |
| -// CHECK-HELP: offload kind | target | data format | data | manifest | build options: |
39 |
| -// CHECK-HELP: ---------------------------------------------------------------------- |
40 |
| -// CHECK-HELP: sycl | spir64 | spirv | a.spv| a_mf.txt | -g |
41 |
| -// CHECK-HELP: sycl | xxx | native | b.bin| b_mf.txt | - |
42 |
| -// CHECK-HELP: openmp | xxx | native | c.bin| n/a | - |
43 |
| -// CHECK-HELP: USAGE: clang-offload-wrapper [options] <input files> |
| 42 | +// CHECK-HELP: |offload|target|data |data |manifest|compile|entries|properties|...| |
| 43 | +// CHECK-HELP: | kind | |format| | |options| | |...| |
| 44 | +// CHECK-HELP: |-------|------|------|-----|--------|-------|-------|----------|---| |
| 45 | +// CHECK-HELP: |sycl |spir64|spirv |a.spv|a_mf.txt| -g |sym.txt|props.txt |...| |
| 46 | +// CHECK-HELP: |sycl |xxx |native|b.bin|b_mf.txt| | | |...| |
| 47 | +// CHECK-HELP: |openmp |xxx |native|c.bin| | | | |...| |
| 48 | +// CHECK-HELP: |...| link | |
| 49 | +// CHECK-HELP: |...| options | |
| 50 | +// CHECK-HELP: |---|--------------------| |
| 51 | +// CHECK-HELP: |...|-cl-denorms-are-zero| |
| 52 | +// CHECK-HELP: |...| | |
| 53 | +// CHECK-HELP: |...| | |
| 54 | +// CHECK-HELP: USAGE: clang-offload-wrapper [options] <input files> |
44 | 55 | // CHECK-HELP: OPTIONS:
|
| 56 | +// CHECK-HELP: Generic Options: |
| 57 | +// CHECK-HELP: --help - Display available options (--help-hidden for more) |
| 58 | +// CHECK-HELP: --help-list - Display list of available options (--help-list-hidden for more) |
| 59 | +// CHECK-HELP: --version - Display the version of this program |
45 | 60 | // CHECK-HELP: clang-offload-wrapper options:
|
46 |
| -// CHECK-HELP: --compile-opts=<string> - compile options passed to the offload runtime |
47 |
| -// CHECK-HELP: --desc-name=<name> - Specifies offload descriptor symbol name: '.<offload kind>.<name>', and makes it globally visible |
48 |
| -// CHECK-HELP: --emit-reg-funcs - Emit [un-]registration functions |
49 |
| -// CHECK-HELP: --entries=<filename> - File listing all offload function entries, SYCL offload only |
50 |
| -// CHECK-HELP: --format=<value> - device binary image formats: |
51 |
| -// CHECK-HELP: =none - not set |
52 |
| -// CHECK-HELP: =native - unknown or native |
53 |
| -// CHECK-HELP: =spirv - SPIRV binary |
54 |
| -// CHECK-HELP: =llvmbc - LLVMIR bitcode |
55 |
| -// CHECK-HELP: --host=<triple> - Target triple for the output module |
56 |
| -// CHECK-HELP: --kind=<value> - offload kind: |
57 |
| -// CHECK-HELP: =unknown - unknown |
58 |
| -// CHECK-HELP: =host - host |
59 |
| -// CHECK-HELP: =openmp - OpenMP |
60 |
| -// CHECK-HELP: =hip - HIP |
61 |
| -// CHECK-HELP: =sycl - SYCL |
62 |
| -// CHECK-HELP: --link-opts=<string> - link options passed to the offload runtime |
63 |
| -// CHECK-HELP: -o=<filename> - Output filename |
64 |
| -// CHECK-HELP: --target=<string> - offload target triple |
65 |
| -// CHECK-HELP: -v - verbose output |
| 61 | +// CHECK-HELP: --batch - All input files are provided as cells in a file table file, |
| 62 | +// CHECK-HELP: other command-line input files are not allowed. |
| 63 | +// CHECK-HELP: Example input file table in batch mode: |
| 64 | +// CHECK-HELP: [Code|Symbols|Properties|Manifest] |
| 65 | +// CHECK-HELP: a_0.bc|a_0.sym|a_0.props|a_0.mnf |
| 66 | +// CHECK-HELP: a_1.bin||| |
| 67 | +// CHECK-HELP: --compile-opts=<string> - compile options passed to the offload runtime |
| 68 | +// CHECK-HELP: --desc-name=<name> - Specifies offload descriptor symbol name: '.<offload kind>.<name>', |
| 69 | +// CHECK-HELP: and makes it globally visible |
| 70 | +// CHECK-HELP: --emit-reg-funcs - Emit [un-]registration functions |
| 71 | +// CHECK-HELP: --entries=<filename> - File listing all offload function entries, SYCL offload only |
| 72 | +// CHECK-HELP: --format=<value> - device binary image formats: |
| 73 | +// CHECK-HELP: =none - not set |
| 74 | +// CHECK-HELP: =native - unknown or native |
| 75 | +// CHECK-HELP: =spirv - SPIRV binary |
| 76 | +// CHECK-HELP: =llvmbc - LLVMIR bitcode |
| 77 | +// CHECK-HELP: --host=<triple> - Target triple for the output module. If omitted, the host |
| 78 | +// CHECK-HELP: triple is used. |
| 79 | +// CHECK-HELP: --kind=<value> - offload kind: |
| 80 | +// CHECK-HELP: =unknown - unknown |
| 81 | +// CHECK-HELP: =host - host |
| 82 | +// CHECK-HELP: =openmp - OpenMP |
| 83 | +// CHECK-HELP: =hip - HIP |
| 84 | +// CHECK-HELP: =sycl - SYCL |
| 85 | +// CHECK-HELP: --link-opts=<string> - link options passed to the offload runtime |
| 86 | +// CHECK-HELP: -o=<filename> - Output filename |
| 87 | +// CHECK-HELP: --properties=<filename> - File listing device binary image properties, SYCL offload only |
| 88 | +// CHECK-HELP: --target=<string> - offload target triple |
| 89 | +// CHECK-HELP: -v - verbose output |
66 | 90 |
|
67 | 91 | // -------
|
68 | 92 | // Generate files to wrap.
|
|
87 | 111 |
|
88 | 112 | // CHECK-IR: target triple = "x86_64-pc-linux-gnu"
|
89 | 113 |
|
| 114 | +// --- OpenMP device binary image descriptor structure |
90 | 115 | // CHECK-IR-DAG: [[ENTTY:%.+]] = type { i8*, i8*, i{{32|64}}, i32, i32 }
|
91 | 116 | // CHECK-IR-DAG: [[IMAGETY:%.+]] = type { i8*, i8*, [[ENTTY]]*, [[ENTTY]]* }
|
92 | 117 | // CHECK-IR-DAG: [[DESCTY:%.+]] = type { i32, [[IMAGETY]]*, [[ENTTY]]*, [[ENTTY]]* }
|
93 | 118 |
|
94 |
| -// CHECK-IR-DAG: [[SYCL_IMAGETY:%.+]] = type { i16, i8, i8, i8*, i8*, i8*, i8*, i8*, i8*, i8*, [[ENTTY]]*, [[ENTTY]]* } |
| 119 | +// --- SYCL device binary image descriptor structure |
| 120 | +// CHECK-IR-DAG: [[SYCL_IMAGETY:%.+]] = type { i16, i8, i8, i8*, i8*, i8*, i8*, i8*, i8*, i8*, [[ENTTY]]*, [[ENTTY]]*, [[PROPSETTY:%.+]]*, [[PROPSETTY]]* } |
| 121 | +// CHECK-IR-DAG: [[PROPSETTY]] = type { i8*, [[PROPTY:%.+]]*, [[PROPTY]]* } |
| 122 | +// CHECK-IR-DAG: [[PROPTY]] = type { i8*, i8*, i32, i64 } |
95 | 123 | // CHECK-IR-DAG: [[SYCL_DESCTY:%.+]] = type { i16, i16, [[SYCL_IMAGETY]]*, [[ENTTY]]*, [[ENTTY]]* }
|
96 | 124 |
|
97 | 125 | // CHECK-IR: [[ENTBEGIN:@.+]] = external hidden constant [[ENTTY]]
|
|
113 | 141 | // CHECK-IR: [[SYCL_TGT1:@.+]] = internal unnamed_addr constant [4 x i8] c"tg2\00"
|
114 | 142 | // CHECK-IR: [[SYCL_COMPILE_OPTS1:@.+]] = internal unnamed_addr constant [1 x i8] zeroinitializer
|
115 | 143 | // CHECK-IR: [[SYCL_LINK_OPTS1:@.+]] = internal unnamed_addr constant [1 x i8] zeroinitializer
|
116 |
| -// CHECK-IR: [[SYCL_BIN1:@.+]] = internal unnamed_addr constant [[SYCL_BIN1TY:\[[0-9]+ x i8\]]] c"Content of device file2{{.+}}" |
| 144 | +// CHECK-IR: [[SYCL_BIN1:@.+]] = internal unnamed_addr constant [[SYCL_BIN1TY:\[[0-9]+ x i8\]]] c"Content of device file2{{.+}}" |
117 | 145 |
|
118 |
| -// CHECK-IR: [[SYCL_IMAGES:@.+]] = internal unnamed_addr constant [2 x [[SYCL_IMAGETY]]] [{{.+}} { i16 1, 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 }, [[SYCL_IMAGETY]] { i16 1, 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 }] |
| 146 | +// 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 }] |
119 | 147 |
|
120 | 148 | // 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 }
|
121 | 149 |
|
|
154 | 182 | //
|
155 | 183 | // 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
|
156 | 184 | // CHECK-IR1: source_filename = "offload.wrapper.object"
|
157 |
| -// CHECK-IR1: [[IMAGETY:%.+]] = type { i16, i8, i8, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %__tgt_offload_entry*, %__tgt_offload_entry* } |
| 185 | +// 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* } |
158 | 186 | // CHECK-IR1: [[ENTTY:%.+]] = type { i8*, i8*, i64, i32, i32 }
|
159 | 187 | // CHECK-IR1: [[DESCTY:%.+]] = type { i16, i16, [[IMAGETY]]*, [[ENTTY]]*, [[ENTTY]]* }
|
160 | 188 | // CHECK-IR1-NOT: @llvm.global_ctors
|
161 | 189 | // CHECK-IR1-NOT: @llvm.global_dtors
|
162 |
| -// CHECK-IR1: @.sycl_offloading.lalala = constant [[DESCTY]] { i16 1, i16 1, [[IMAGETY]]* getelementptr inbounds ([1 x [[IMAGETY]]], [1 x [[IMAGETY]]]* @.sycl_offloading.device_images, i64 0, i64 0), [[ENTTY]]* null, [[ENTTY]]* null } |
| 190 | +// 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 } |
163 | 191 |
|
164 | 192 | // -------
|
165 | 193 | // Check option's effects: -entries
|
|
171 | 199 | // CHECK-IR3: @__sycl_offload_entry_name = internal unnamed_addr constant [7 x i8] c"entryA\00"
|
172 | 200 | // CHECK-IR3: @__sycl_offload_entry_name.1 = internal unnamed_addr constant [7 x i8] c"entryB\00"
|
173 | 201 | // 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 }]
|
174 |
| -// 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) }] |
| 202 | +// 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 }] |
175 | 203 |
|
176 | 204 | // -------
|
177 | 205 | // Check that device image can be extracted from the wrapper object by the clang-offload-bundler tool.
|
|
0 commit comments