Intel® FPGA SDK for OpenCL™ Pro Edition: Programming Guide

ID 683846
Date 10/04/2021
Public

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

Document Table of Contents

11.1.3. Packaging an OpenCL Helper Function File for an OpenCL Library

Before creating an OpenCL™ library file, package each OpenCL source file with helper functions into a .aoco file. Unlike RTL modules, you do not need to create an object manifest file.

In general, you do not need to create a library to share helper functions written in OpenCL. You can distribute a helper function in source form (for example, <shared_file>.cl) and then insert the line #include "<shared_file>.cl" in the OpenCL kernel source code.

Consider creating a library under the following circumstances:

  • The helper functions are in multiple files and you want to simplify distribution.
  • You do not want to expose the helper functions' source code.

    The helper functions are stored as LLVM IR, an assembly-like language, without comments inside the associated library.

Hardware generation is not necessary for the creation of a .aoco file. Compile the OpenCL source file using the -c offline compiler command option.

Note: A library can only include OpenCL helper functions. The Intel® FPGA SDK for OpenCL™ Offline Compiler issues an error message if the library contains OpenCL kernels.
To package an OpenCL source file into a .aoco file, invoke the following command: aoc -c -shared <OpenCL_source_file_name>.cl -o <OpenCL_object_file_name>.aoco
where the -shared offline compiler command option instructs the compiler to create a .aoco file that is suitable for inclusion into an OpenCL library.