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

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

6.2.1. Partitioning Buffers Across Multiple Interfaces of the Same Memory Type

Before you partition the memory across multiple interfaces of the same memory type, you must first disable burst-interleaving during OpenCL™ kernel compilation. Then, in the host application, you must specify the memory bank to which you allocate the OpenCL buffer.
By default, the Intel® FPGA SDK for OpenCL™ Offline Compiler configures each global memory type in a burst-interleaved fashion. Usually, the burst-interleaving configuration leads to the best load balancing between the memory banks. However, there might be situations where it is more efficient to partition the memory into non-interleaved regions.

The figure below illustrates the differences between burst-interleaved and non-interleaved memory partitions.

To manually partition some or all of the available global memory types, perform the following tasks:

  1. Compile your OpenCL kernel using the -no-interleaving=<global_memory_type> flag to configure the memory bank(s) of the specified memory type as separate addresses. For more information on the usage of the -no-interleaving=<global_memory_type> flag, refer to the Disabling Burst-Interleaving of Global Memory (-no-interleaving=<global_memory_type>) section.
  2. Create an OpenCL buffer in your host application, and allocate the buffer to one of the banks using the CL_CHANNEL flags.
    • Specify CL_CHANNEL_1_INTELFPGA to allocate the buffer to the lowest available memory region.
    • Specify CL_CHANNEL_2_INTELFPGA to allocation memory to the second bank (if available).
    Attention: Allocate each buffer to a single memory bank only. If the second bank is not available at runtime, the memory is allocated to the first bank. If no global memory is available, the clCreateBuffer call fails with the error message CL_MEM_OBJECT_ALLOCATION_FAILURE.