Relative Constraints - Relative Constraints - 2025.2 English - UG1079

AI Engine Kernel and Graph Programming Guide (UG1079)

Document ID
UG1079
Release Date
2025-11-26
Version
2025.2 English

Kernel, PLIO, GMIO and shared buffer objects can be placed relative to each other. These types of constraints are called relative constraints. The constraints allow for placement of a destination node relative to the source node, and is specified as a row or column offset in 2-D grid. Specify either the row offset or column offset. If you don not specify the row or column offset, it is "don't care."

The adf::relative_offset API allows you to specify the desired column and row offset. For example:
k = adf::kernel::create(matrix_mul);
k1 = adf::kernel::create(shuffle_4x16);
in0=adf::input_plio::create("Datain0", adf::plio_64_bits, "data/matA.txt");

adf::location<adf::kernel>(k1) = adf::location<adf::kernel>(k) + adf::relative_offset({.col_offset = 1, .row_offset= 1});
adf::location<adf::PLIO>(in0) = adf::location<adf::kernel>(k) + adf::relative_offset({.col_offset = 0}); 

adf::shared_buffer<int32> mtxA,mtxB;
adf::location<adf::buffer>(mtxA) = adf::location<adf::buffer>(mtxB) + adf::relative_offset({.col_offset = 1, .row_offset=1});
adf::location<adf::kernel>(adf::first) = adf::location<adf::buffer>(mtxA) + adf::relative_offset({.col_offset = 1});
Note: Shared buffers only support relative column offsets with other types.