Hierarchical Constraints - 2024.1 English

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

Document ID
UG1603
Release Date
2024-06-06
Version
2024.1 English

When creating complex graphs with multiple subgraph classes, or multiple instances of the same subgraph class, the location constraints described previously can also be applied to each kernel instance or kernel port instance individually at the point of subgraph instantiation instead of the definition. In this case, you need to specify the graph qualified name of that kernel instance or kernel port instance in the constraint as shown in the following example. Also, make sure that the kernels or their ports being constrained as described previously are defined to be public members of the subgraph.

class ToplevelGraph : public graph {
 public:
  indep_nodes_graph1<1,2,3,2> mygraph;
  port<input> datain[2] ;
  port<output> dataout[2] ;

  ToplevelGraph() {
    for (int i = 0; i < 2; i++) {
      connect(datain[i], mygraph.datain[i]);
      connect(mygraph.dataout[i], dataout[i]);

      // hierarchical constraints
      location<stack>(mygraph.kr[i]) = bank(3, 2+i, 2);
      location<buffer>(mygraph.kr[i].out[0]) = location<kernel>(mygraph.kr[i]);
    }
  };
};
Note: You can recirculate the previous design placement in your next compilation. This significantly reduces the mapper run time. When the compiler runs, it generates a placement constraints file in the Work directory. This constraint file can be specified on the command line for the next iteration.
v++ -c --mode aie --constraints Work/temp/graph_aie_mapped.aiecst src/graph.cpp

To reuse FIFO location constraints, use aie_routed.aiecst file.

v++ -c --mode aie --constraints Work/temp/graph_aie_routed.aiecst src/graph.cpp