ノード制約 - 2023.2 日本語

AI エンジン カーネルおよびグラフ プログラミング ガイド (UG1079)

Document ID
UG1079
Release Date
2023-12-04
Version
2023.2 日本語

グラフ ノードの制約には、NodeConstraints セクションを使用します。制約はノードごとにグループ化されるため、各ノードに複数の制約を指定できます。

構文

{
  "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>) で指定する必要があります。

次の例では、グラフ名は 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 という名前を使用する必要があります。