Buffer Port Attributes and API - Buffer Port Attributes and API - 2026.1 English - UG1603

AI Engine-ML Kernel and Graph Programming Guide (UG1603)

Document ID
UG1603
Release Date
2026-07-08
Version
2026.1 English

You can configure the following attributes on buffer ports:

  • Buffer port size
  • Margin
  • Locking protocol (synchronous or asynchronous)
  • Addressing mode (linear or circular)
  • Single buffer versus ping-pong-buffer

Of these attributes, margin, locking protocol and addressing mode are specified in the kernel function signature. Single buffer versus. The graph specifies the ping-pong buffer.

You can specify the size of a buffer port either in the kernel signature or in the graph constructor. If the kernel function signature does not specify the size or if it is specified to be adf::inherited_extent, then you must specify the size in the graph using the dimensions() API. The dimensions() API is used in the constructor of the graph and configures the buffer port size in terms of the number of samples.

adf::inherited_extent, represents the size of the buffer which is inferred from the context. For example, it is inferred from the specification in the graph.

The buffer port margin represents the number of samples copied from the end of one block to the beginning of the next one. If a margin parameter is specified, the total memory allocated is the sum of sample size and margin size, multiplied by template data type in number of bytes( (sample size + margin size) * sizeof (data type)). In the case of a circular output buffer, the margin can be specified as adf::inherited_margin. In this situation, the margin size is specified by the sink connected to this output port.

An example function prototype specifying margin size is as follows:

simple(input_buffer<int32, adf::extents<adf::inherited_extent>, 
        adf::margin<MARGIN_SIZE>> & in0,
        output_buffer<int32> & out0);
Note:
  • Buffer port types define their dimensions and margin in number of samples of data. To determine the actual data size stored in physical memory, multiply the total number of samples with supported data type in bytes.
  • If there is no margin, the buffer size must be a multiple of 16 bytes. Otherwise, both buffer and margin size must be a multiple of 32 bytes.
  • Constructs related to I/O buffers are defined in the adf namespace. Therefore, these constructs need to be qualified with adf::, unless you include using namespace adf;.