Developer Guide

Intel oneAPI FPGA Handbook

ID 785441
Date 2/07/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Optimize Floating-point Operation

Starting with the oneAPI 2021.2 release, fast math is enabled by default, allowing the Intel® oneAPI DPC++/C++ Compiler to make various out-of-box floating point math (float or double) optimizations. With these optimizations enabled, you might observe different bitwise results when compared to results from the oneAPI 2021.1 release or from GCC. The tradeoff is done to improve performance and area of your design. Automatic dot product inference and floating-point contraction for double precision math are two key noticeable FPGA optimizations that save a large amount of FPGA area and improve performance/latency. To return to the same precision as the oneAPI 2021.1 release or GCC, use the following compiler options:

  • For Linux: -no-fma -fp-model=precise
  • For Windows: /Qfma- /fp:precise

For more information about these options, refer to -fp-model, fp and fma, Qfma topics in the Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference.

For floating-point operations, you can manually direct the Intel® oneAPI DPC++/C++ Compiler to perform optimizations that create more efficient pipeline structures in hardware and reduce the overall hardware use. These optimizations can cause small differences in floating-point results. You can also apply the fp contract and fp reassociate floating-point pragmas to handle kernel's arithmetic and floating-point operations at finer granularity. For more information about the pragmas, refer to Floating-Point Pragmas.