OneAPI FPGA C Math Function Support
I have developing designs using the FPGA SDK for OpenCL using both the DevCloud and an on-premise solution. My designs have been fully compiled and executed without issue on either platform.
I have been exploring the use of dpcpp/OneAPI for FPGAs for the same designs I have developed with OpenCL. When compiling my dpcpp code for the CPU, the program compiles, executes, and the results are validated. When I target the FPGA emulator (-fintelfpga -DFPGA_EMULATOR), I receive the following compilation error:
Failed to build device program Error: unimplemented function(s) used: __svml_expf16 is undefined __svml_sqrtf16_mask is undefined __svml_sqrtf16 is undefined CompilerException Failed to parse IR Error: Compiler Error: OpenCL kernel compile/link FAILED clang++: error: fpga compiler command failed with exit code 1 (use -v to see invocation)
My kernel uses the C math functions exp(), sqrt(), and pow(). When removing the exp() and sqrt() functions, the program compiles fine and the FPGA emulation completes successfully. Is there something I am missing to include for the FPGA like oneMKL or is there a missing FPGA implementation for the exp() and sqrt() functions?
Any help would be appreciated. All of the OneAPI development is performed on the DevCloud. DPCPP version:
Intel(R) oneAPI DPC++ Compiler 2021.1-beta07 (2020.5.0.0604) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /glob/development-tools/versions/oneapi/beta07/inteloneapi/compiler/latest/linux/bin
Thank you!
The reason of the error is you will need cl::sycl::exp()
oneAPI FPGA example designs that use math functions, for example the CCR example can be found here: https://gitlab.devtools.intel.com/ecosystem-dev-programs/oneapi-toolkits/oneapi-toolkit/-/blob/2021.1-beta08-ci/FPGAExampleDesigns/crr/src/main.cpp#L458
We will improve this documentation in https://software.intel.com/content/www/us/en/develop/documentation/oneapi-fpga-optimization-guide/top.html as user do searching in there.
Thanks