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

ID 683342
Date 4/22/2019
Public
Document Table of Contents

12.1.2. 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 XML specification 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 will issue 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.