Intel® oneAPI Data Parallel C++
Support for Intel® oneAPI DPC++ Compiler, Intel® oneAPI DPC++ Library, Intel ICX Compiler , Intel® DPC++ Compatibility Tool, and GDB*

Using fsycl-link

James_S_9
Beginner
1,106 Views

Using Intel 2021.2 from oneapi-hpckit docker image.

I'm attempting to follow the documentation here: https://software.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-and-reference/top/compilation/use-a-third-party-compiler-as-a-host-compiler-for-dpc-code.html

but am running into a few issues:

1. The generated header seems to be specialising a type that doesn't exist:

In file included from <command-line>:0:0:
./a_host.h:27:20: error: 'KernelInfoData' is not a class template
 template <> struct KernelInfoData<'_', 'Z', 'T', 'S', 'Z', 'Z', '4', 'm', 'a', 'i', 'n', 'E', 'N', 'K', 'U', 'l', 'R', 'N', '2', 'c', 'l', '4', 's', 'y', 'c', 'l', '7', 'h', 'a', 'n', 'd', 'l', 'e', 'r', 'E', 'E', '1', '1', '_', '2', '0', 'c', 'l', 'E', 'S', '2', '_', 'E', 'U', 'l', 'N', 'S', '0', '_', '4', 'i', 't', 'e', 'm', 'I', 'L', 'i', '1', 'E', 'L', 'b', '1', 'E', 'E', 'E', 'E', '1', '3', '_', '2', '7'> {
                    ^~~~~~~~~~~~~~
In file included from <command-line>:0:0:
./a_host.h:27:415: error: explicit specialization of non-template 'cl::sycl::detail::KernelInfoData'
 ', 'l', 'E', 'S', '2', '_', 'E', 'U', 'l', 'N', 'S', '0', '_', '4', 'i', 't', 'e', 'm', 'I', 'L', 'i', '1', 'E', 'L', 'b', '1', 'E', 'E', 'E', 'E', '1', '3', '_', '2', '7'> {
                                                                                                                                                                              ^

2. CL_TARGET_OPENCL_VERSION is not defined:

In file included from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/cl.h:20:0,
                 from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/cl_ext_intel.h:44,
                 from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/detail/common.hpp:11,
                 from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/access/access.hpp:10,
                 from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/ONEAPI/atomic_enums.hpp:12,
                 from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/ONEAPI/atomic_accessor.hpp:11,
                 from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/ONEAPI/atomic.hpp:11,
                 from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl.hpp:11,
                 from sample.cc:1:
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/cl_version.h:22:104: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 300 (OpenCL 3.0)
 #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 300 (OpenCL 3.0)")
                                                                                                        ^

 

3. The linked device.o file only contains sycl symbols and none of the compiled kernels:

$ nm -A device.o
device.o:0000000000000000 r .sycl_offloading.0.data
device.o:0000000000000000 r .sycl_offloading.0.data.size
device.o:0000000000000060 d .sycl_offloading.descriptor
device.o:0000000000000000 d .sycl_offloading.device_images
device.o:0000000000000007 r .sycl_offloading.opts.compile.0
device.o:0000000000000008 r .sycl_offloading.opts.link.0
device.o:0000000000000000 r .sycl_offloading.target.0
device.o:                 U __sycl_register_lib
device.o:                 U __sycl_unregister_lib
device.o:0000000000000000 t sycl.descriptor_reg
device.o:0000000000000010 t sycl.descriptor_unreg

 

Is there any updated documentation on how the -fsycl-link flag should be used as it currently seems broken?

0 Kudos
3 Replies
James_S_9
Beginner
1,089 Views

The first error seems to be due to __SYCL_UNNAMED_LAMBDA__ not being defined when compiling with g++ as KernelInfoData only exists when that is turned on.

0 Kudos
VidyalathaB_Intel
Moderator
1,061 Views

Hi James,

Thanks for reaching out to us.

Could you please share a small reproducer and steps to reproduce the issues (compilation and linking commands used).

Regards,

Vidya


0 Kudos
James_S_9
Beginner
1,057 Views

The commands are as in the documentation as stated in my original post: https://software.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-gui...

I was just using a single file though:

#include <CL/sycl.hpp>
#include <iostream>

constexpr int num = 16;
using namespace sycl;

int main() {
    auto r = range{num};
    buffer<int> a{r};

    queue{}.submit([&](handler& h) {
        accessor out{a, h};
        h.parallel_for(r, [=](item<1> idx) { out[idx] = idx; });
    });

    host_accessor result{a};
    for(int i = 0; i < num; ++i)
        std::cout << result[i] << "\n";
}

 

The integration header generated by this file gives the errors described in my original post.

0 Kudos
Reply