Intel® FPGA SDK for OpenCL™ Pro Edition: Best Practices Guide

ID 683521
Date 6/21/2022
Public

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

Document Table of Contents

8.4.1. Optimizing the Geometric Configuration of Local Memory Banks Based on Array Index

By default, the Intel® FPGA SDK for OpenCL™ Offline Compiler might attempt to improve performance by automatically banking a local memory system. The Intel® FPGA SDK for OpenCL™ includes advanced features that allow you to customize the banking geometry of your local memory system. To configure the geometry of local memory banks, include the numbanks(N) and bankwidth(M) kernel attributes in your OpenCL kernel .

The following code examples illustrate how the bank geometry changes based on the values you assign to numbanks and bankwidth.

Table 20.  Effects of numbanks and bankwidth on the Bank Geometry of 2 x 4 Local Memory SystemThe first and last rows of this table illustrate how to bank memory on the upper and lower indexes of a 2D array, respectively.
Code Example Bank Geometry
local int
__attribute__((numbanks(2),
               bankwidth(16)))
               lmem[2][4]; 
local int 
__attribute__((numbanks(2), 
               bankwidth(8))) 
               lmem[2][4]; 
local int 
__attribute__((numbanks(2), 
               bankwidth(4))) 
               lmem[2][4]; 
local int 
__attribute__((numbanks(4), 
               bankwidth(8))) 
               lmem[2][4]; 
local int
__attribute__((numbanks(4),
               bankwidth(4)))
               lmem[2][4];