You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SYCL] Optimize handling of compile-time properties
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.
Copy file name to clipboardExpand all lines: sycl/test/virtual-functions/properties-negative.cpp
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,9 @@ int main() {
19
19
20
20
// expected-error-re@sycl/handler.hpp:* {{static assertion failed due to requirement {{.*}} indirectly_callable property cannot be applied to SYCL kernels}}
21
21
q.single_task(props_empty, [=]() {});
22
-
// expected-error-re@sycl/handler.hpp:* {{static assertion failed due to requirement {{.*}} indirectly_callable property cannot be applied to SYCL kernels}}
22
+
// When both "props_empty" and "props_void" are in use, we won't see the
23
+
// static assert firing for the second one, because there will be only one
24
+
// instantiation of handler::processProperties.
23
25
q.single_task(props_void, [=]() {});
24
26
// expected-error-re@sycl/handler.hpp:* {{static assertion failed due to requirement {{.*}} indirectly_callable property cannot be applied to SYCL kernels}}
0 commit comments