Intel® FPGA SDK for OpenCL™ Pro Edition: Best Practices Guide

ID 683521
Date 3/28/2022
Public

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

Document Table of Contents

9.5. Data Type Selection Considerations

Select the appropriate data type to optimize the FPGA area usage by your OpenCL™ application.
  1. Select the most appropriate data type for your application.

    For example, do not define your variable as float if the data type short is sufficient.

  2. Ensure that both sides of an arithmetic expression belong to the same data type.

    Consider an example where one side of an arithmetic expression is a floating-point value and the other side is an integer. The mismatched data types cause the Intel® FPGA SDK for OpenCL™ Offline Compiler to create implicit conversion operators, which can become expensive if they are present in large numbers.

  3. Take advantage of padding if it exists in your data structures.

    For example, if you only need float3 data type, which has the same size as float4, you may change the data type to float4 to make use of the extra dimension to carry an unrelated value.