Developer Guide

Intel® oneAPI DPC++/C++ Compiler Handbook for FPGAs

ID 785441
Date 6/24/2024
Public

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

Document Table of Contents

Partitioning Buffers Across Different Memory Types (Heterogeneous Memory)

The board support package for your FPGA board can assemble a global memory space consisting of different memory technologies (for example, DRAM or SRAM). The board support package designates one such memory (which might consist of multiple interfaces) as the default memory. All buffers reside in this heterogeneous memory.

To use the heterogeneous memory, perform the following steps to modify the code in your source file:

  1. Determine the names of global memory types available on your FPGA board using one of the following methods:
    • Refer to the board vendor's documentation for information.
    • Identify the index of the global memory type in the board_spec.xml file of your Custom Platform. The index starts at 0, which indicates the global memory that is marked as "default". If no interface is marked as "default", then 0 indicates the first global memory listed in the board_spec.xml file.

      The index then follows the order in which the global memory appears in the board_spec.xml file. For example, if there is no memory marked as "default", then the first global memory type in the board_spec.xml file has an index 0, the second has an index 1, and so on. Another example: if the second global memory is marked as "default" then 0 index refers to the second memory, index 1 refers to the first memory and so on.

      For more information, refer to global_mem in oneAPI Accelerator Support Package (ASP) Reference Manual: Open FPGA Stack.

  2. To instruct the host to allocate buffer to a specific global memory type, insert the buffer_location<index> property in the accessor property list.

    For example:

    ext::oneapi::accessor_property_list PL{ext::intel::buffer_location<2>};
    accessor acc(buffer, cgh, read_only, PL);
NOTICE:

Using the buffer_location<index> property on BSPs with heterogeneous memory support in combination with read-only cache is an untested functionality and Intel does not guarantee its support.

If you do not specify the buffer_location property, the host allocates the buffer to the default memory type automatically. To determine the default memory type, consult the documentation provided by your board vendor. Alternatively, in the board_spec.xml file of your Custom Platform, search for the memory type that is defined first or has the attribute default=1 assigned to it. For more information, refer to oneAPI Accelerator Support Package(ASP) Reference Manual: Open FPGA Stack.

NOTE:

Streams support is limited if the target FPGA is used in an FPGA board with heterogeneous memory. With SYCL streams, all work items write to the same stream buffer in parallel, so atomics are leveraged to ensure race conditions. Atomics support for boards that have heterogeneous memory is limited. For more information about atomics and streams, refer to the SYCL* 2020 specification available at https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html. For debugging kernels, use sycl::ext::oneapi::experimental::printf instead of SYCL streams, which can lead to performance issues or hangs.