diff --git a/sycl/include/sycl/handler.hpp b/sycl/include/sycl/handler.hpp index 3cf26b5432298..63f3e0474542d 100644 --- a/sycl/include/sycl/handler.hpp +++ b/sycl/include/sycl/handler.hpp @@ -843,52 +843,23 @@ class __SYCL_EXPORT handler { Dims>()); #endif - constexpr bool KernelHasName = - detail::getKernelName() != nullptr && - detail::getKernelName()[0] != '\0'; - // Some host compilers may have different captures from Clang. Currently // there is no stable way of handling this when extracting the captures, so // a static assert is made to fail for incompatible kernel lambdas. // TODO remove the ifdef once the kernel size builtin is supported. -#ifdef __INTEL_SYCL_USE_INTEGRATION_HEADERS - static_assert( - !KernelHasName || - sizeof(KernelType) == detail::getKernelSize(), - "Unexpected kernel lambda size. This can be caused by an " - "external host compiler producing a lambda with an " - "unexpected layout. This is a limitation of the compiler." - "In many cases the difference is related to capturing constexpr " - "variables. In such cases removing constexpr specifier aligns the " - "captures between the host compiler and the device compiler." - "\n" - "In case of MSVC, passing " - "-fsycl-host-compiler-options='/std:c++latest' " - "might also help."); -#endif - // Empty name indicates that the compilation happens without integration - // header, so don't perform things that require it. - if constexpr (KernelHasName) { - // TODO support ESIMD in no-integration-header case too. - - // Force hasSpecialCaptures to be evaluated at compile-time. - constexpr bool HasSpecialCapt = detail::hasSpecialCaptures(); - setKernelInfo((void *)MHostKernel->getPtr(), - detail::getKernelNumParams(), - &(detail::getKernelParamDesc), - detail::isKernelESIMD(), HasSpecialCapt); - - constexpr std::string_view KernelNameStr = - detail::getKernelName(); - MKernelName = KernelNameStr; - } else { - // In case w/o the integration header it is necessary to process - // accessors from the list(which are associated with this handler) as - // arguments. We must copy the associated accessors as they are checked - // later during finalize. - setArgsToAssociatedAccessors(); - } + // TODO support ESIMD in no-integration-header case too. + + // Force hasSpecialCaptures to be evaluated at compile-time. + constexpr bool HasSpecialCapt = detail::hasSpecialCaptures(); + setKernelInfo((void *)MHostKernel->getPtr(), + detail::getKernelNumParams(), + &(detail::getKernelParamDesc), + detail::isKernelESIMD(), HasSpecialCapt); + + constexpr std::string_view KernelNameStr = + detail::getKernelName(); + MKernelName = KernelNameStr; setKernelNameBasedCachePtr(detail::getKernelNameBasedCache()); // If the kernel lambda is callable with a kernel_handler argument, manifest diff --git a/sycl/test/basic_tests/kernel_size_mismatch.cpp b/sycl/test/basic_tests/kernel_size_mismatch.cpp deleted file mode 100644 index 03ba5a7983bf4..0000000000000 --- a/sycl/test/basic_tests/kernel_size_mismatch.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning %s - -// Tests for static assertion failure when kernel lambda mismatches between host -// and device. - -#include - -int main() { - sycl::queue Q; - int A = 1; - Q.single_task([=]() { -#ifdef __SYCL_DEVICE_ONLY__ - (void)A; - // expected-no-diagnostics -#else - // expected-error-re@sycl/handler.hpp:* {{static assertion failed due to requirement '{{.*}}': Unexpected kernel lambda size. This can be caused by an external host compiler producing a lambda with an unexpected layout. This is a limitation of the compiler.}} -#endif - }).wait(); -}