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

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

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.