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

ID 683846
Date 12/13/2021
Public

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

Document Table of Contents

6.5. Modifying Host Program for Structure Parameter Conversion

If you convert any structure parameters to pointers-to-constant structures in your OpenCL™ kernel, you must modify your host application accordingly.

Perform the following changes to your host application:

  1. Allocate a cl_mem buffer to store the structure contents.
    Attention: You need a separate cl_mem buffer for every kernel that uses a different structure value.
  2. Set the structure kernel argument with a pointer to the structure buffer, not with a pointer to the structure contents.
  3. Populate the structure buffer contents before queuing the kernel. Perform one of the following steps to ensure that the structure buffer is populated before the kernel launches:
    • Queue the structure buffer on the same command queue as the kernel queue.
    • Synchronize separate kernel queues and structure buffer queues with an event.

  4. When your application no longer needs to call a kernel that uses the structure buffer, release the cl_mem buffer.