Skip to content

[DO NOT MERGE] Check int header absence #19029

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

Draft
wants to merge 1 commit into
base: sycl
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 12 additions & 41 deletions sycl/include/sycl/handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -843,52 +843,23 @@ class __SYCL_EXPORT handler {
Dims>());
#endif

constexpr bool KernelHasName =
detail::getKernelName<KernelName>() != nullptr &&
detail::getKernelName<KernelName>()[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<KernelName>(),
"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<KernelName>();
setKernelInfo((void *)MHostKernel->getPtr(),
detail::getKernelNumParams<KernelName>(),
&(detail::getKernelParamDesc<KernelName>),
detail::isKernelESIMD<KernelName>(), HasSpecialCapt);

constexpr std::string_view KernelNameStr =
detail::getKernelName<KernelName>();
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<KernelName>();
setKernelInfo((void *)MHostKernel->getPtr(),
detail::getKernelNumParams<KernelName>(),
&(detail::getKernelParamDesc<KernelName>),
detail::isKernelESIMD<KernelName>(), HasSpecialCapt);

constexpr std::string_view KernelNameStr =
detail::getKernelName<KernelName>();
MKernelName = KernelNameStr;
setKernelNameBasedCachePtr(detail::getKernelNameBasedCache<KernelName>());

// If the kernel lambda is callable with a kernel_handler argument, manifest
Expand Down
19 changes: 0 additions & 19 deletions sycl/test/basic_tests/kernel_size_mismatch.cpp

This file was deleted.

Loading