Programming Model for Multi-Port Access in HBM - 2021.2 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
Release Date
2021-12-15
Version
2021.2 English

HBM provides high bandwidth if arrays are split in different banks/pseudo-channels in the design. This is a common practice in partitioning an array into different memory regions in high-performance computing. The host allocates a single buffer, which will be spread across the pseudo-channels.

Vitis HLS would consider different pointers to be independent channels, and removes any dependency analysis. But the host allocates a single buffer for both pointers, and this lets the tool maintain the dependency analysis through pragma HLS ALIAS. The ALIAS pragma informs data dependence analysis about the pointer distance. Refer to the ALIAS pragma for more information.

The kernel arg0 is allocated in bank0 and kernel arg1 is allocated in bank1. The pointer distance should be specified in the distance option of the ALIAS pragma as shown below:
//Assume that the host code looks like this:
int *buf = clCreateBuffer(ctxt, CL_MEM_READ_ONLY, 2*bank_size, ...);
clSetKernelArg(kernel, 0, 0x20000000, buf);            // bank0
clSetKernelArg(kernel, 1, 0x20000000, buf+bank_size); // bank1

//The ALIAS pragma informs data dependence analysis about the pointer distance
void kernel(int *bank0, int *bank1, ...)
{
#pragma HLS alias ports=bank0,bank1 distance=bank_size

The ALIAS pragma can be specified using one of the following forms:

  • Constant distance:
    #pragma HLS alias ports=arr0,arr1,arr2,arr3 distance=1024
  • Variable distance:
    #pragma HLS alias ports=arr0,arr1,arr2,arr3 offset=0,512,1024,2048

Constraints:

  • The depths of all the ports in the interface pragma must be the same
  • All ports must be in assigned to different bundles, bound to different HBM controllers
  • The number of ports specified in the second form must be the same as the number of offsets specified, one offset per port. #pragma HLS interface offset=off is not supported

  • Each port can only be used in one ALIAS pragma