Skip to content

Commit f417a88

Browse files
[SYCL] Extend static_assert's message for lambda captures' size (#6681)
Most often that is caused by capturing constexpr variables. Let the user know about that.
1 parent 1fe92c5 commit f417a88

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

sycl/include/sycl/handler.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -730,10 +730,14 @@ class __SYCL_EXPORT handler {
730730
// Some host compilers may have different captures from Clang. Currently
731731
// there is no stable way of handling this when extracting the captures, so
732732
// a static assert is made to fail for incompatible kernel lambdas.
733-
static_assert(!KernelHasName || sizeof(KernelFunc) == KI::getKernelSize(),
734-
"Unexpected kernel lambda size. This can be caused by an "
735-
"external host compiler producing a lambda with an "
736-
"unexpected layout. This is a limitation of the compiler.");
733+
static_assert(
734+
!KernelHasName || sizeof(KernelFunc) == KI::getKernelSize(),
735+
"Unexpected kernel lambda size. This can be caused by an "
736+
"external host compiler producing a lambda with an "
737+
"unexpected layout. This is a limitation of the compiler."
738+
"In many cases the difference is related to capturing constexpr "
739+
"variables. In such cases removing constexpr specifier aligns the "
740+
"captures between the host compiler and the device compiler.");
737741

738742
// Empty name indicates that the compilation happens without integration
739743
// header, so don't perform things that require it.

0 commit comments

Comments
 (0)