-
Notifications
You must be signed in to change notification settings - Fork 796
[SYCL RTC] Introduce --auto-pch support
#20226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
ae02915
48ee6c1
736efc4
ed658f1
3c7efe1
d2d39ca
869be70
3d45e6a
7317f86
ba43750
ebb81cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1127,6 +1127,57 @@ build_options{{ | |
| Relax the requirement that parameter types for free-function kernels must be | ||
| forward-declarable. | ||
|
|
||
| ===== `--auto-pch` | ||
|
|
||
| Enable auto-detection of the preamble and use it as a pre-compiled header to | ||
| speed up subsequent compilations of TUs matching the preamble/compilation | ||
| options. Example of the code that can benefit from this: | ||
gmlueck marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| [source,c++] | ||
| ---- | ||
| #include <sycl/sycl.hpp> | ||
|
|
||
| // Auto-detected preamble ends before next line: | ||
| namespace syclext = sycl::ext::oneapi; | ||
| namespace syclexp = sycl::ext::oneapi::experimental; | ||
|
|
||
| extern "C" | ||
| SYCL_EXT_ONEAPI_FUNCTION_PROPERTY((syclexp::nd_range_kernel<1>)) | ||
| void iota(float start, float *ptr) { | ||
| size_t id = syclext::this_work_item::get_nd_item<1>().get_global_linear_id(); | ||
| ptr[id] = start + static_cast<float>(id); | ||
| } | ||
| ---- | ||
|
|
||
| Limitations: | ||
|
|
||
| * Preamble detection is done at the Lexer level and can't handle code like | ||
|
|
||
| [source,c++] | ||
| ---- | ||
| #if 1 | ||
| #include <sycl/sycl.hpp> | ||
| #else | ||
| // Auto-detected preamble ends in the middle of `#else` and would fail to compile. | ||
| void foo() {} | ||
| #endif | ||
| ---- | ||
gmlueck marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| * Any changes in either preamble or compilation options (including | ||
| `-DSOMETHING`!) result in a creation of a new pre-compiled header/preamble. | ||
|
|
||
| * No support (including not reporting any errors) for `+__DATE__+`/`+__TIME__+` | ||
| macros inside auto-detected preamble (transitively in regards to the | ||
| includes). | ||
gmlueck marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| * Files used inside preamble must not change between different compilations (at | ||
| least for the same auto-detected preamble). | ||
|
|
||
| * Auto-generated pre-compiled headers/preambles are stored in memory only. That means: | ||
| - No persistency between invocations | ||
| - Currently there is no eviction mechanism, so application is expected to use | ||
| the option only when number of preambles is limited. | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't an immediate concern, but future support for C++20 modules might require changes to include module imports in the preamble. Module imports don't look like preprocessor control lines, but they are. The language has rules that prevent use of macros that expand to import declarations so that recognition of them isn't dependent on preprocessing. |
||
| === Known issues and limitations when the language is `sycl` | ||
|
|
||
| ==== Changing the compiler action or output | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.