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

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

12.2. Kernel Attributes for Configuring Local and Private Memory Systems

The Intel® FPGA SDK for OpenCL™ includes kernel attributes that you can include in a kernel to customize the geometry of the local and private memory systems.
Attention: Only apply these local memory kernel attributes to local or private variables.
Table 14.  OpenCL Kernel Attributes for Configuring Local Memory
Attribute Description
register Specifies that the local variable must be implemented in a register.
memory Specifies that the local variable must be implemented in a memory system. Including the memory kernel attribute is equivalent to declaring the local variable with the __local qualifier.
numbanks(N)

N is an integer value.

Specifies that the memory system implementing the local variable must have N banks, where N is a power-of-2 integer value greater than zero.
bankwidth(N)

N is an integer value.

Specifies that the memory system implementing the local variable must have banks that are N bytes wide, where N is a power-of-2 integer value greater than zero.
singlepump Specifies that the memory system implementing the local variable must be single pumped.
doublepump Specifies that the memory system implementing the local variable must be double pumped.
numreadports(N)

N is an integer value.

Specifies that the memory system implementing the local variable must have N read ports, where N is an integer value greater than zero.
numwriteports(N)

N is an integer value.

Specifies that the memory system implementing the local variable must have N write ports, where N is an integer value greater than zero.
merge("label", "direction") Forces two or more variables to be implemented in the same memory system.

label is an arbitrary string. Assign the same label to all variables that you want to merge.

Specify direction as either width or depth to identify whether the memories should be merged width-wise or depth-wise, respectively.

bank_bits(b 0 , b 1 , ..., b n ) Forces the memory system to split into 2n banks, with {b 0 , b 1 , ..., b n } forming the bank-select bits.
Important: b 0 , b 1 , ..., b n must be consecutive, positive integers.

If you specify the numbanks(n) attribute without the bank_bits attribute, the bank-select bits default to the least significant bits (that is, 0, 1, ..., log2(numbanks)-1).

Table 15.  Code Examples for Memory Attributes
Example Use Case Syntax
Implements a variable in a register
int  __attribute__((register)) a[12];
Implements a memory system with eight banks, each with a width of 8 bytes
int __attribute__((memory,
                   numbanks(8),
                   bankwidth(8)) b[16];
Implements a double-pumped memory system with one 128-byte wide bank, one write port, and four read ports
int __attribute__((memory,
                   numbanks(1),
                   bankwidth(128),
                   doublepump,
                   numwriteports(1),
                   numreadports(4)) c[32];