Forum Discussion
OneAPI FPGA C Math Function Support
- 6 years ago
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
Hi,
You can refer to https://www.oneapi.com/ -> https://spec.oneapi.com/versions/latest/elements/oneMKL/source/domains/vm/sqrt.html?highlight=sqrt
If you had follow the syntax and still see the problem. Attached the files and steps for us for duplication.
Thanks,
Hi,
I see that according to the oneMKL source (GitHub) that FPGA accelerators are not supported.
Like I mentioned previously, the code runs fine when the compile target is the CPU only.
I cannot disclose the actual source; however, I have created a simple program that produces the same error. The file mathfunc.cpp contains a similar routine using the exp(), sqrt(), and pow() C math functions.
Compile for CPU (throws no error) using:
dpcpp -DCPU_HOST mathfunc.cpp -o program
Compile for FPGA Emulator using:
dpcpp -fintelfpga -DFPGA_EMULATOR mathfunc.cpp -o program
Which gives the error:
Failed to build device program Error: unimplemented function(s) used: __svml_expf16 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)
To execute CPU or FPGA Emulator program:
./program
Thank you!
Note: I had to zip the source file in order to upload.
- dcallanan6 years ago
New Contributor
I'm having the same problem with the test kernel sent by @lkljucaric . The issue persists when building RTL or hardware from mathfunc.cpp .
~RTL~ dpcpp -fintelfpga -fsycl-link mathfunc.cpp -o math.a -Xshardware ~hardware~ dpcpp -fintelfpga mathfunc.cpp -o math.out -XshardwareThe output points to an issue with "pow" and a missing log file in both cases.
cmath:418: Compiler Error: undefined reference to 'pow' Error: Optimizer FAILED. Refer to mathfunc-11bbfc/mathfunc_11bbfc.log for details. clang++: error: fpga compiler command failed with exit code 1 (use -v to see invocation)The log file referenced was not present in the working directory. Tests were performed on devcloud compute nodes.