Linear and Circular Addressing of Buffer Ports - 2023.1 English

AI Engine Kernel and Graph Programming Guide (UG1079)

Document ID
UG1079
Release Date
2023-06-23
Version
2023.1 English

Buffer ports can be addressed in a linear or circular manner. In linear addressing mode, data is addressed linearly and has no wrap around. In circular addressing mode, data is addressed circularly and has wrap around. Kernels with margin in the same tile are recommended to use circular buffer ports. Port connections with non-zero margin require copying the margin data at the consumer port after the consumer kernel returns. However, if the producer and consumer are on the same core and you use circular buffer ports, then margin copy can be avoided, which improves performance. By using a circular buffer port, you are committing to access the data in the buffer port using a circular iterator. For regular buffer ports the data can be accessed using a raw pointer obtained from the data() API, or using a linear or circular iterator. It is preferable to use linear iterators over the circular iterators because it has lower overhead.

Note:
  • Circular addressing mode is supported only in one dimension buffer ports.
  • Access to the data in a circular buffer port must use a circular iterator.
  • Circular buffer port can only be declared in the function prototype.