Is there a convenient / portable way to use std::complex with sycl 1.2.1, including at least the four basic arithmetic operations?
I have noticed that addition and subtraction of std::complex works fine in both ComputeCpp and Intel DPCPP SYCL implementations. Multiplication and division fail at runtime when running on an Intel GPU or CPU (using latest intel-compute-runtime from git). ComputeCpp warns that
__muldc3 is undefined during compilation and terminates with ‘cl::sycl::compile_program_error’. dpcpp has no compiler warning, also fails at runtime with compile_program_errors with
error: undefined reference to __muldc3()’`. Interestingly hipsycl on AMD gfx803 works fine for this case. With DPCPP, if I link the libsycl-cmath-fp64.o and libsycl-complex-fp64.o, then it works on GPU. What is the recommendation for doing this in computecpp?
Here is my test code:
I noticed that the ComputeCpp mandelbrot example uses separate im/re variables and it’s own complex multiply algorithm in the kernel. Fine for simple kernels, but for porting libraries already using thrust::complex / std::complex to SYCL, it would be useful to have a portable way to do this.