[SYCL] Optimize handling of compile-time properties #15492
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 ofprocessProperties
. 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 toprocessProperties
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.