SYCL 未找到命名的内核 -46 (CL_INVALID_KERNEL_NAME)

SYCL No kernel named was found -46 (CL_INVALID_KERNEL_NAME)

以下 c++ SYCL 代码仅适用于主机设备,使用 GPU 设备(NVIDIA 或 INTEL)我有以下错误:

未找到名为 _ZTSZZN10MainWindow15testPerformanceEiENKUlRN2cl4sycl7handlerEE_clES3_E10FillBuffer 的内核 -46 (CL_INVALID_KERNEL_NAME)

提前致谢。

std::vector<sycl::platform> all_platforms = sycl::platform::get_platforms();
    cl::sycl::device selectedDevice;

    if (all_platforms.size()==0)
    {
        std::cout<<" No platforms found. Check OpenCL installation!\n";
        return;
    }

    for(size_t i = 0; i < all_platforms.size(); i++)
    {
        sycl::platform  current_platform = all_platforms[i];

        std::vector<sycl::device> all_devices = current_platform.get_devices();

        // Loop over all devices available from this platform.
        for( const cl::sycl::device& device : all_devices )
        {
            QString type;

            if(device.is_gpu())
            {
                selectedDevice = device;
                break;
            }
        }
    }

    sycl::queue myQueue(selectedDevice);

    try
    {
        myQueue.submit([&](sycl::handler &h) {
            sycl::stream os(1024, 768, h);
            h.parallel_for<class FillBuffer>(32, [=](sycl::id<1> i) {
                os<<i<<"\n";
              });
          }).wait();
    }
    catch (cl::sycl::exception ex)
    {
        std::cout << "cl::sycl::exception+: " << ex.what() << " category: " << ex.category().name()  << std::endl;
        return;
    }

从第一次检查来看,这似乎是一个与名称空间相关的问题。

而不是

h.parallel_for<class FillBuffer>(32, [=](sycl::id<1> i) {
                os<<i<<"\n";
              });

声明class FillBuffer;在文件的顶部,然后使用

h.parallel_for<FillBuffer>(32, [=](sycl::id<1> i) {
                os<<i<<"\n";
              });

问题与 qmake 自动生成的 Makafile 参数顺序有关

错误的方式(自动生成):

$(LINKER) $(LFLAGS) /MANIFEST:embed /OUT:$(DESTDIR_TARGET) @<<
debug\main.obj debug\mainwindow.obj debug\moc_mainwindow.obj
$(LIBS)
<<

正确的方法:

    $(LINKER) debug\main.obj debug\mainwindow.obj debug\moc_mainwindow.obj $(LFLAGS) /MANIFEST:embed /OUT:$(DESTDIR_TARGET) @<<
$(LIBS)
<<