set_directive_alias - 2023.2 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
Release Date
2023-12-18
Version
2023.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

set_directive_alias [OPTIONS] <location> <ports>
  • <location> is the location string in the format function[/label] that the ALIAS pragma applies to.
  • <ports> specifies the ports to alias.

Options

-distance <integer>
Specifies the difference between the pointer values passed to the ports in the list.
-offset <string>
Specifies the offset of the pointer passed to each port in the ports list with respect to the origin of the array.

Example

For the following function top:

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