|
| 1 | +# SYCL binary property sets |
| 2 | + |
| 3 | +To communicate information about SYCL binaries to the SYCL runtime, the |
| 4 | +implementation produces sets of properties. The intention of this design |
| 5 | +document is to describe the structure of the property sets and define the |
| 6 | +representation and meaning of pre-defined property set names. |
| 7 | + |
| 8 | + |
| 9 | +## Property sets structure |
| 10 | + |
| 11 | +A property set consists of a reserved name, enclosed in square brackets, |
| 12 | +followed by a series of string key and value pairs. The set name and each entry |
| 13 | +in the set are separated by a newline. |
| 14 | + |
| 15 | +The string key and value pairs have the following format: |
| 16 | +``` |
| 17 | +<string key>=<value type>|<value> |
| 18 | +``` |
| 19 | + |
| 20 | +The value type is a string and the value of it has the following meaning for the |
| 21 | +corresponding value: |
| 22 | + |
| 23 | +| Value type | Description | |
| 24 | +| ---------- | ----------------------------------------- | |
| 25 | +| "1" | The value is a 32 bit integer. | |
| 26 | +| "2" | The value is a base64 encoded byte array. | |
| 27 | + |
| 28 | +__Note:__ Whitespaces are __not__ ignored and are treated like any other |
| 29 | +characters. As such, `some_key=1|1` is not the same as `some_key = 1 | 1` and |
| 30 | +`[some property set]` is not the same as `[ some property set ]`. |
| 31 | + |
| 32 | + |
| 33 | +## Property sets |
| 34 | + |
| 35 | +This section describes the known property sets. |
| 36 | + |
| 37 | + |
| 38 | +### [SYCL/specialization constants] |
| 39 | + |
| 40 | +__Key:__ Specialization constant name. |
| 41 | + |
| 42 | +__Value type:__ Byte array. ("2") |
| 43 | + |
| 44 | +__Value:__ Information about the specialization constant with the following |
| 45 | +fields: |
| 46 | + |
| 47 | +```c++ |
| 48 | +// Encodes ID of a scalar specialization constants which is a leaf of some |
| 49 | +// composite specialization constant. |
| 50 | +unsigned ID; |
| 51 | +// Encodes offset from the beginning of composite, where scalar resides, i.e. |
| 52 | +// location of the scalar value within a byte-array containing the whole |
| 53 | +// composite specialization constant. If descriptor is used to represent a |
| 54 | +// whole scalar specialization constant instead of an element of a composite, |
| 55 | +// this field should be contain zero. |
| 56 | +unsigned Offset; |
| 57 | +// Encodes size of scalar specialization constant. |
| 58 | +unsigned Size; |
| 59 | +``` |
| 60 | + |
| 61 | +See also [SYCL2020-SpecializationConstants.md](./SYCL2020-SpecializationConstants.md). |
| 62 | + |
| 63 | + |
| 64 | +### [SYCL/specialization constants default values] |
| 65 | + |
| 66 | +__Key:__ Specialization constant name. |
| 67 | + |
| 68 | +__Value type:__ Byte array. ("2") |
| 69 | + |
| 70 | +__Value:__ Byte representation of the default value for the specialization |
| 71 | +constant. |
| 72 | + |
| 73 | +See also [SYCL2020-SpecializationConstants.md](./SYCL2020-SpecializationConstants.md). |
| 74 | + |
| 75 | + |
| 76 | +### [SYCL/devicelib req mask] |
| 77 | + |
| 78 | +__Key:__ At most one entry with "DeviceLibReqMask". |
| 79 | + |
| 80 | +__Value type:__ 32 bit integer. ("1") |
| 81 | + |
| 82 | +__Value:__ A bitmask of which device libraries the binary uses. |
| 83 | + |
| 84 | +__Notes:__ |
| 85 | + |
| 86 | +1. If this property set is missing, no device libraries are used by the binary. |
| 87 | + |
| 88 | + |
| 89 | +### [SYCL/kernel param opt] |
| 90 | + |
| 91 | +__Key:__ Kernel name. |
| 92 | + |
| 93 | +__Value type:__ Byte array. ("2") |
| 94 | + |
| 95 | +__Value:__ A bitmask identifying the arguments of the kernel that have been |
| 96 | +removed by the dead-argument-elimination optimization pass. |
| 97 | + |
| 98 | +__Notes:__ |
| 99 | + |
| 100 | +1. If no entry is present for a given kernel in the binary, no arguments have |
| 101 | +been eliminated. |
| 102 | +2. If this property set is missing, no kernels in the binary have any eliminated |
| 103 | +arguments. |
| 104 | + |
| 105 | + |
| 106 | +### [SYCL/program metadata] |
| 107 | + |
| 108 | +Program metadata properties: |
| 109 | + |
| 110 | +| Key | Value type | Value | |
| 111 | +| ---------------------------------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------- | |
| 112 | +| `kernel` + "@reqd_work_group_size" | Byte array. ("2") | Specifies the required work-group size for the kernel identified by the name `kernel`. | |
| 113 | +| `kernel` + "@work_group_num_dim" | Byte array. ("2") | Specifies the work-group dimensionality of the kernel identified by the name `kernel`. | |
| 114 | +| `kernel` + "@max_work_group_size" | Byte array. ("2") | Specifies the max work-group size for the kernel identified by the name `kernel`. | |
| 115 | +| `kernel` + "@max_linear_work_group_size" | Byte array. ("2") | Specifies the max linear work-group size for the kernel identified by the name `kernel`. | |
| 116 | +| `variable` + "@global_id_mapping" | Byte array. ("2") | Specifies the mapping between the global variable with unique identifier `variable` and its name in the binary. | |
| 117 | + |
| 118 | + |
| 119 | +### [SYCL/misc properties] |
| 120 | + |
| 121 | +Miscellaneous properties: |
| 122 | + |
| 123 | +| Key | Value type | Value | |
| 124 | +| ------------------------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------- | |
| 125 | +| "isEsimdImage" | 32 bit integer. ("1") | 1 if the image is ESIMD and 0 or missing otherwise. | |
| 126 | +| "sycl-register-alloc-mode" | 32 bit integer. ("1") | The register allocation mode: 2 for large and 0 or missing for automatic. | |
| 127 | +| "sycl-grf-size" | 32 bit integer. ("1") | The GRF size. Automatic if 0 or missing. | |
| 128 | +| "optLevel" | 32 bit integer. ("1") | Optimization level, corresponding to the `-O` option used during compilation. | |
| 129 | +| "sanUsed" | Byte array. ("2") | Specifying if address sanitization ("asan") or memory sanitization ("msan") is used. Missing if neither is used. | |
| 130 | +| "specConstsReplacedWithDefault" | 32 bit integer. ("1") | 1 if the specialization constants have been replaced by their default values and 0 or missing otherwise. | |
| 131 | + |
| 132 | + |
| 133 | +### [SYCL/assert used] |
| 134 | + |
| 135 | +__Key:__ Kernel name. |
| 136 | + |
| 137 | +__Value type:__ 32 bit integer. ("1") |
| 138 | + |
| 139 | +__Value:__ 1 if the kernel uses assertions and 0 or missing otherwise. |
| 140 | + |
| 141 | + |
| 142 | +### [SYCL/exported symbols] |
| 143 | + |
| 144 | +__Key:__ Symbol name. |
| 145 | + |
| 146 | +__Value type:__ 32 bit integer. ("1") |
| 147 | + |
| 148 | +__Value:__ 1 if the symbol is exported by the binary and 0 or missing otherwise. |
| 149 | + |
| 150 | +See also [SharedLibraries.md](SharedLibraries.md). |
| 151 | + |
| 152 | + |
| 153 | +### [SYCL/imported symbols] |
| 154 | + |
| 155 | +__Key:__ Symbol name. |
| 156 | + |
| 157 | +__Value type:__ 32 bit integer. ("1") |
| 158 | + |
| 159 | +__Value:__ 1 if the symbol is imported by the binary and 0 or missing otherwise. |
| 160 | + |
| 161 | +See also [SharedLibraries.md](SharedLibraries.md). |
| 162 | + |
| 163 | + |
| 164 | +### [SYCL/device globals] |
| 165 | + |
| 166 | +__Key:__ Device global variable name. |
| 167 | + |
| 168 | +__Value type:__ Byte array. ("2") |
| 169 | + |
| 170 | +__Value:__ Information about the device global variable with the following |
| 171 | +fields: |
| 172 | + |
| 173 | +```c++ |
| 174 | + // Encodes size of the underlying type T of the device global variable. |
| 175 | + uint32_t Size; |
| 176 | + |
| 177 | + // Either 1 (true) or 0 (false), telling whether the device global variable |
| 178 | + // was declared with the device_image_scope property. |
| 179 | + // We use uint32_t for a boolean value to eliminate padding after the field |
| 180 | + // and suppress false positive reports from MemorySanitizer. |
| 181 | + uint32_t DeviceImageScope; |
| 182 | +``` |
| 183 | + |
| 184 | +__Notes:__ |
| 185 | + |
| 186 | +1. If this property set is missing, the binary does not contain any device |
| 187 | +global variables. |
| 188 | + |
| 189 | +See also [DeviceGlobal.md](./DeviceGlobal.md). |
| 190 | + |
| 191 | + |
| 192 | +### [SYCL/device requirements] |
| 193 | + |
| 194 | +Set of device requirements for the entire module: |
| 195 | + |
| 196 | +| Key | Value type | Value | |
| 197 | +| ------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 198 | +| "aspects" | Byte array. ("2") | A collection of 32 bit integers representing the SYCL aspects used. These correspond 1:1 with the enum values of `sycl::aspect`. | |
| 199 | +| "fixed_target" | Byte array. ("2") | The string literals specified in `-fsycl-fixed-targets`. | |
| 200 | +| "reqd_work_group_size_uint64_t" | Byte array. ("2") | At most three 64 bit unsigned integers representing the required work-group size. If this entry is missing, there is no work-group size requirement. | |
| 201 | +| "joint_matrix" | Byte array. ("2") | A string containing a semi-colon-separated list of comma-separated descriptors for used matrices. The descriptors in the order they appear are: <ul><li>sycl-joint-matrix-type</li><li>sycl-joint-matrix-use</li><li>sycl-joint-matrix-rows</li><li>sycl-joint-matrix-cols</li></ul> | |
| 202 | +| "joint_matrix_mad" | Byte array. ("2") | A string containing a semi-colon-separated list of comma-separated descriptors for used matrix MAD operations. The descriptors in the order they appear are: <ul><li>sycl-joint-matrix-mad-type-A</li><li>sycl-joint-matrix-mad-type-B</li><li>sycl-joint-matrix-mad-type-C</li><li>sycl-joint-matrix-mad-type-D</li><li>sycl-joint-matrix-mad-size-M</li><li>sycl-joint-matrix-mad-size-K</li><li>sycl-joint-matrix-mad-size-N</li></ul> | |
| 203 | +| "reqd_sub_group_size" | Byte array. ("2") | At most three 32 bit unsigned integers representing the required sub-group size. If this entry is missing, there is no sub-group size requirement. | |
| 204 | +| "work_group_num_dim" | Byte array. ("2") | At most three 32 bit unsigned integers representing the work-group dimensionality. If this entry is missing, there is no specified work-group dimensionality. | |
| 205 | + |
| 206 | + |
| 207 | +See also [OptionalDeviceFeatures.md](OptionalDeviceFeatures.md). |
| 208 | + |
| 209 | + |
| 210 | +### [SYCL/host pipes] |
| 211 | + |
| 212 | +__Key:__ Host pipe variable name. |
| 213 | + |
| 214 | +__Value type:__ Byte array. ("2") |
| 215 | + |
| 216 | +__Value:__ Information about the host pipe variable with the following |
| 217 | +fields: |
| 218 | + |
| 219 | +```c++ |
| 220 | + // Encodes size of the underlying type T of the host pipe variable. |
| 221 | + uint32_t Size; |
| 222 | +``` |
| 223 | + |
| 224 | +__Notes:__ |
| 225 | + |
| 226 | +1. If this property set is missing, the binary does not contain any host pipe |
| 227 | +variables. |
| 228 | + |
| 229 | + |
| 230 | +### [SYCL/virtual functions] |
| 231 | + |
| 232 | +Set of information about virtual function usage in the module. |
| 233 | + |
| 234 | +| Key | Value type | Value | |
| 235 | +| ---------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |
| 236 | +| "virtual-functions-set" | Byte array. ("2") | A string identifying the set of virtual functions contained in the module. If this is missing, the module does not contain any virtual function sets. | |
| 237 | +| "uses-virtual-functions-set" | Byte array. ("2") | A string containing a comma-separated list of sets of virtual functions used by the module. If this is missing, the module does not use any virtual function sets. | |
| 238 | + |
| 239 | + |
| 240 | +### [SYCL/implicit local arg] |
| 241 | + |
| 242 | +__Key:__ Kernel name. |
| 243 | + |
| 244 | +__Value type:__ 32 bit integer. ("1") |
| 245 | + |
| 246 | +__Value:__ Index of the implicit local memory argument. |
| 247 | + |
| 248 | +__Notes:__ |
| 249 | + |
| 250 | +1. If no entry is present for a given kernel in the binary, the kernel does not |
| 251 | +have an implicit local memory argument. |
| 252 | +2. If this property set is missing, no kernels in the binary have an implicit |
| 253 | +local memory argument. |
| 254 | + |
| 255 | + |
| 256 | +### [SYCL/registered kernels] |
| 257 | + |
| 258 | +__Key:__ "Registered" kernel name. |
| 259 | + |
| 260 | +__Value type:__ Byte array. ("2") |
| 261 | + |
| 262 | +__Value:__ The name of the kernel corresponding to the registered kernel name. |
| 263 | + |
| 264 | +__Notes:__ |
| 265 | + |
| 266 | +1. If this property set is missing, the binary does not have any registered |
| 267 | +kernel names. |
| 268 | + |
| 269 | + |
| 270 | +### [SYCLBIN/global metadata] |
| 271 | + |
| 272 | +Set of global information about a SYCLBIN file. |
| 273 | + |
| 274 | +| Key | Value type | Value | |
| 275 | +| ------- | --------------------- | ----- | |
| 276 | +| "state" | 32 bit integer. ("1") | Integer representation of one of the possible states of the file, corresponding to the `sycl::bundle_state` enum. It must be one of the following:<ol start="0"><li>`sycl::bundle_state::input`</li><li>`sycl::bundle_state::object`</li><li>`sycl::bundle_state::executable`</li></ol> | |
| 277 | + |
| 278 | + |
| 279 | +### [SYCLBIN/ir module metadata] |
| 280 | + |
| 281 | +Set of information about an IR module in a SYCLBIN file. |
| 282 | + |
| 283 | +| Key | Value type | Value | |
| 284 | +| -------- | --------------------- | ----- | |
| 285 | +| "type" | 32 bit integer. ("1") | Integer representation of one of the pre-defined IR types. It must be one of the following:<ol start="0"><li>SPIR-V</li><li>PTX</li><li>AMDGCN</li></ol> | |
| 286 | +| "target" | Byte array. ("2") | A string representing the architecture of the binary, corresponding to the value of `-fsycl-targets` option used when compiling this binary. This may be missing if no part of `-fsycl-targets` was used during the compilation of this binary or if `-fsycl-targets` was not used at all. | |
| 287 | + |
| 288 | + |
| 289 | +### [SYCLBIN/native device code image metadata] |
| 290 | + |
| 291 | +Set of information about an native device code image in a SYCLBIN file. |
| 292 | + |
| 293 | +| Key | Value type | Value | |
| 294 | +| ------ | ----------------- | ----- | |
| 295 | +| "arch" | Byte array. ("2") | A string representing the architecture of the binary, corresponding to the value of `-fsycl-targets` option used when compiling this binary. | |
| 296 | + |
0 commit comments