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

ID 683176
Date 9/24/2018
Public
Document Table of Contents

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

By default, the might attempt to improve performance by automatically banking a local memory system. The 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 11.  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];