SYCL_INTEL_unnamed_kernel_lambda

SYCL 1.2.1 requires that a kernel name be specified as a template parameter of the invocation function when a kernel has been defined as a lambda. This kernel name enables correlation of the lambda name between multiple compilations.

The SYCL_INTEL_unnamed_kernel_lambda extension makes naming of lambdas optional. Launch of a kernel is simplified from, for example:

cgh.parallel_for<class my_kernel_name>(range<1>{ 1024 }, [=](id<1> idx) {
  writeResult[idx] = idx[0];
});

To:

cgh.parallel_for(range<1>{ 1024 }, [=](id<1> idx) {
  writeResult[idx] = idx[0];
});

In this example, <class my_kernel_name> is optional.

Note

The program class methods compile_with_kernel_type and build_with_kernel_type are not supported with unnamed lambdas, and currently there are no replacements for them.

Enabling the Extension

This extension is enabled through the compiler flag -fsycl-unnamed-lambda, which is on by default. You can disable the extension by specifying the -fno-sycl-unnamed-lambda compiler flag.

When enabled, the extension defines the macro $$__SYCL_INTEL_UNNAMED_LAMBDA__$$.