pragma HLS alias - 2022.2 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
Release Date
2022-12-07
Version
2022.2 English

Description

Specify that two or more M_AXI pointer arguments point to the same underlying buffer in memory (DDR or HBM) and indicate any aliasing between the pointers by setting the distance or offset between them.

Important: The ALIAS pragma applies to top-level function arguments mapped to M_AXI interfaces.

Vitis HLS considers different pointers to be independent channels and generally does not provide any dependency analysis. However, in cases where the host allocates a single buffer for multiple pointers, this relationship can be communicated through the ALIAS pragma or directive and dependency analysis can be maintained. The ALIAS pragma enables data dependence analysis in Vitis HLS by defining the distance between pointers in the buffer.

Requirements for ALIAS:

  • All ports assigned to an ALIAS pragma must be in assigned to M_AXI interfaces and assigned to different bundles, as shown in the example below
  • Each port can only be used in one ALIAS pragma or directive
  • The depth of all ports assigned to an ALIAS pragma must be the same
  • When offset is specified, the number of ports and number of offsets specified must be the same: one offset per port
  • The offset for the INTERFACE must be specified as slave or direct, offset=off is not supported

Syntax

pragma HLS alias ports=<list> [distance=<int> | offset=<list...>]

Where:

ports=<list>
specifies the ports to alias.
distance=<integer>
Specifies the difference between the pointer values passed to the ports in the list.
offset=<list>
Specifies the offset of the pointer passed to each port in the ports list with respect to the origin of the array.
Note: offset and distance are mutually exclusive.

Example

For the following function top:

void top(int *arr0, int *arr1, int *arr2, int *arr3, ...) {
  #pragma HLS interface mode=m_axi port=arr0 bundle=hbm0 depth=0x40000000
  #pragma HLS interface mode=m_axi port=arr1 bundle=hbm1 depth=0x40000000
  #pragma HLS interface mode=m_axi port=arr2 bundle=hbm2 depth=0x40000000
  #pragma HLS interface mode=m_axi port=arr3 bundle=hbm3 depth=0x40000000
The following pragma defines aliasing for the specified array pointers, and defines the distance between them:
#pragma HLS ALIAS ports=arr0,arr1,arr2,arr3 distance=10000000 
Alternatively, the following pragma specifies the offset between pointers, to accomplish the same effect:
#pragma HLS ALIAS ports=arr0,arr1,arr2,arr3 offset=00000000,10000000,20000000,30000000