Commit a44f116
authored
[SYCL RTC] Introduce
Compilation of `#include <sycl/sycl.hpp>` is slow and that's especially
problematic for SYCL RTC (run-time compilation). One way to overcome
this is fine-grained includes that are being pursued separately. Another
way is to employ clang's precompiled headers support which this PR is
doing. Those two approaches can be combined, and this PR adds
`test-e2e/PerformanceTests/KernelCompiler/auto-pch.cpp` that gives some
idea of the PCH impact. The test shows PCH benefits when compiling some
of the fine-grained includes on top of absolute minimum required to
compiled SYCL RTC's "Hello world". From one of the CI runs:
| Extra Headers | Without PCH | With auto-PCH
| -|-|-
| <none> | 176ms 137ms 136ms 136ms 136ms | 226ms 64ms 64ms 64ms 64ms
| sycl/half_type.hpp | 165ms 165ms 165ms 165ms 165ms | 267ms 71ms 72ms
72ms 72ms
| sycl/ext/oneapi/bfloat16.hpp | 174ms 173ms 173ms 173ms 173ms | 279ms
76ms 73ms 73ms 74ms
| sycl/marray.hpp | 142ms 143ms 142ms 142ms 143ms | 235ms 66ms 66ms 66ms
66ms
| sycl/vector.hpp | 296ms 290ms 290ms 290ms 290ms | 487ms 124ms 125ms
125ms 125ms
| sycl/multi_ptr.hpp | 278ms 278ms 276ms 275ms 274ms | 441ms 125ms 125ms
125ms 125ms
| sycl/builtins.hpp | 537ms 533ms 531ms 531ms 531ms | 883ms 218ms 218ms
219ms 218ms
It misses `sycl/sycl.hpp` line because that currently crashes FE when
reading the generated PCH, the crash is being investigated/fixed
separately.
Implementation-wise I'm reusing existing upstream
`clang::PrecompiledPreamble` with one minor modification. It seems that
`PrecompiledPreamble`'s main usage is for things like `clangd` so it
ignores errors in the code. I've modified it so that those errors would
break pch-generation the same way normal compilation would break. I'm
also not sure if we'd want that long-term, because it seems that making
such "auto-pch" persistent would deviate from the upstream version of
`PrecompiledPreamble` even more. I can imagine that in some near future
we'd need to "fork" it into a separate utility. Still, seems to be fine
for the first step.
Driver modifications are for the `--auto-pch` option support that should
only be present on the SYCL RTC path and not for the regular `clang`
invocations from the command line. I'm relatively confident those will
stay in future.--auto-pch support (#20226)1 parent 82f43fa commit a44f116
File tree
13 files changed
+649
-17
lines changed- clang
- include/clang
- Driver
- Frontend
- lib/Frontend
- test/Driver
- sycl-jit/jit-compiler/lib/rtc
- sycl
- doc/extensions/experimental
- test-e2e
- KernelCompiler
- PerformanceTests/KernelCompiler
13 files changed
+649
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
110 | 113 | | |
111 | 114 | | |
112 | 115 | | |
| |||
195 | 198 | | |
196 | 199 | | |
197 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
198 | 206 | | |
199 | 207 | | |
200 | 208 | | |
| |||
7543 | 7551 | | |
7544 | 7552 | | |
7545 | 7553 | | |
| 7554 | + | |
| 7555 | + | |
| 7556 | + | |
| 7557 | + | |
| 7558 | + | |
| 7559 | + | |
| 7560 | + | |
| 7561 | + | |
| 7562 | + | |
7546 | 7563 | | |
7547 | 7564 | | |
7548 | 7565 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
| 90 | + | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
| 250 | + | |
| 251 | + | |
251 | 252 | | |
252 | | - | |
| 253 | + | |
253 | 254 | | |
254 | 255 | | |
255 | 256 | | |
| |||
285 | 286 | | |
286 | 287 | | |
287 | 288 | | |
| 289 | + | |
288 | 290 | | |
289 | 291 | | |
290 | 292 | | |
291 | 293 | | |
292 | 294 | | |
293 | 295 | | |
294 | 296 | | |
295 | | - | |
| 297 | + | |
| 298 | + | |
296 | 299 | | |
297 | 300 | | |
298 | | - | |
| 301 | + | |
299 | 302 | | |
300 | 303 | | |
301 | 304 | | |
| |||
337 | 340 | | |
338 | 341 | | |
339 | 342 | | |
340 | | - | |
| 343 | + | |
341 | 344 | | |
342 | 345 | | |
343 | 346 | | |
| |||
415 | 418 | | |
416 | 419 | | |
417 | 420 | | |
418 | | - | |
| 421 | + | |
| 422 | + | |
419 | 423 | | |
420 | 424 | | |
421 | 425 | | |
| |||
512 | 516 | | |
513 | 517 | | |
514 | 518 | | |
515 | | - | |
| 519 | + | |
516 | 520 | | |
517 | 521 | | |
518 | 522 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
67 | 76 | | |
68 | 77 | | |
69 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
81 | 89 | | |
82 | 90 | | |
83 | 91 | | |
| |||
140 | 148 | | |
141 | 149 | | |
142 | 150 | | |
143 | | - | |
144 | | - | |
145 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
146 | 160 | | |
147 | 161 | | |
148 | 162 | | |
| |||
153 | 167 | | |
154 | 168 | | |
155 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
156 | 247 | | |
157 | 248 | | |
158 | 249 | | |
| |||
162 | 253 | | |
163 | 254 | | |
164 | 255 | | |
165 | | - | |
| 256 | + | |
| 257 | + | |
166 | 258 | | |
167 | 259 | | |
168 | 260 | | |
| |||
175 | 267 | | |
176 | 268 | | |
177 | 269 | | |
178 | | - | |
179 | | - | |
180 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
181 | 285 | | |
182 | 286 | | |
183 | 287 | | |
| |||
217 | 321 | | |
218 | 322 | | |
219 | 323 | | |
| 324 | + | |
| 325 | + | |
220 | 326 | | |
221 | 327 | | |
222 | 328 | | |
| |||
348 | 454 | | |
349 | 455 | | |
350 | 456 | | |
| 457 | + | |
| 458 | + | |
351 | 459 | | |
352 | 460 | | |
353 | | - | |
| 461 | + | |
354 | 462 | | |
355 | 463 | | |
356 | 464 | | |
| |||
Lines changed: 54 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1127 | 1127 | | |
1128 | 1128 | | |
1129 | 1129 | | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
1130 | 1184 | | |
1131 | 1185 | | |
1132 | 1186 | | |
| |||
0 commit comments