Skip to content
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

[SYCL] Optimize handling of compile-time properties #15492

Conversation

AlexeySachkov
Copy link
Contributor

We perform correctness check of compile-time properties in handler::processProperties helper function. That function was specialized by kernel name, meaning that if we have two kernels with absolutely the same properties applied to them there will be two instantiations of processProperties. That consumes compilation time for both front-end which has to emit extra isntantiations and for host compilation pass which gets more functions (with the same body!) to handle.

The only use of kernel name within processProperties is to check if that kernel is a ESIMD kernel. That can be done at caller side and propagated to processProperties as a simple boolean, thus reducing amount of instantiations of that function.

This patch does exactly that.

Please note that this is technically a functional change: even though we still process the properties in the same way, we will now emit diagnostics in a slightly different manner: if there are two kernels with the same set of illegal properties there will be only one diagnostic for the first kernel.
Once that first kernel is fixed, the diagnostic will be displayed for the second kernel, i.e. we won't display all violations in a single compilation run.

It seems like we only have one test which exposes that behavior and considering that with C++ it is almost always you should fix the first error first to see what happens to the rest, I don't think that such change in diagnostics is bad enough to outweight potential (even if they are the slightest) compilation time improvements.

We perform correctness check of compile-time properties in
`handler::processProperties` helper function. That function was
specialized by kernel name, meaning that if we have two kernels with
absolutely the same properties applied to them there will be two
instantiations of `processProperties`. That consumes compilation time
for both front-end which has to emit extra isntantiations and for host
compilation pass which gets more functions (with the same body!) to
handle.

The only use of kernel name within `processProperties` is to check if
that kernel is a ESIMD kernel. That can be done at caller side and
propagated to `processProperties` as a simple boolean, thus reducing
amount of instantiations of that function.

This patch does exactly that.

Please note that this is technically a *functional* change: even though
we still process the properties in the same way, we will now emit
diagnostics in a slightly different manner: if there are two kernels
with the same set of illegal properties there will be only one
diagnostic for the first kernel.
Once that first kernel is fixed, the diagnostic will be displayed for
the second kernel, i.e. we won't display _all_ violations in a single
compilation run.

It seems like we only have one test which exposes that behavior and
considering that with C++ it is almost always you should fix the first
error first to see what happens to the rest, I don't think that such
change in diagnostics is bad enough to outweight potential (even if they
are the slightest) compilation time improvements.
@AlexeySachkov AlexeySachkov merged commit bf6c089 into intel:sycl Sep 25, 2024
12 checks passed
@AlexeySachkov AlexeySachkov deleted the private/asachkov/instantiate-processproperties-less branch September 25, 2024 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants