节点约束 - 2022.1 简体中文

Versal ACAP AI 引擎编程环境 用户指南 (UG1076)

Document ID
UG1076
Release Date
2022-05-25
Version
2022.1 简体中文

NodeConstraints 节用于约束 graph 节点。约束按节点进行分组,以便为每个节点指定一个或多个约束。

语法

{
  "NodeConstraints": {
    "<node name>": {
      <constraint>,
      <constraint>,
      ...
    }
  }
}
<node name> ::= string
<constraint> ::= tile
               | shim
               | reserved_memory
               | colocated_nodes
               | not_colocated_nodes
               | colocated_reserved_memories
               | not_colocated_reserved_memories

示例

{
  "NodeConstraints": {
    "mygraph.k1": {
      "tile": {
        "column": 2,
        "row": 1
      },
      "reserved_memory": {
        "column": 2,
        "row": 1,
        "bankId": 3,
        "offset": 4128
      }
    },
    "mygraph.k2": {
      "tile": {
        "column": 2,
        "row": 2
      }
    }
  }
}

节点名称

节点必须按其完全限定名称来指定,例如:<graph name>.<kernel name>

在以下示例中,graph 名称为 myGraph 且内核名称为 k1。完全指定的节点名称为 myGraph.k1

class graph : public adf::graph {
private:
  adf::kernel k1;
public:
  my_graph() { 
    k1 = kernel::create(kernel1);
    source(k1) = "src/kernels/kernel1.cc";
  }
};
graph myGraph;

只要在 JSON 约束文件内引用此内核,就必须将其命名为 myGraph.k1,如遍布本文档中的各示例所示。