VART を使用したプログラミング - 2.5 日本語

Vitis AI ユーザー ガイド (UG1414)

Document ID
UG1414
Release Date
2022-06-15
Version
2.5 日本語

Vitis AI は、次のインターフェイスを備える C++ DpuRunner クラスを提供します。

  1. std::pair<uint32_t, int> execute_async(  
    					const std::vector<TensorBuffer*>& input,  
    					const std::vector<TensorBuffer*>& output);

    実行用の入力テンソルと結果を保存するための出力テンソルを作成します。ホスト ポインターは、TensorBuffer オブジェクトを使用して渡されます。この関数は、ジョブ ID と関数呼び出しのステータスを返します。

  2. int wait(int jobid, int timeout);

    execute_async によって返されたジョブ ID は wait() に渡され、ジョブが完了して結果が準備できるまでブロックします。

  3. TensorFormat get_tensor_format()

    必要なテンソル形式について DpuRunner に問い合わせます。

    DpuRunner::TensorFormat::NCHW または DpuRunner::TensorFormat::NHWC を返します。

  4. std::vector<Tensor*> get_input_tensors()
    std::vector<Tensor*> get_output_tensors()

    読み込まれた Vitis AI モデルに必要な入力および出力テンソルの形状と名前について DpuRunner に問い合わせます。

  5. DpuRunner オブジェクトを作成するため、次の関数を呼び出します。
    create_runner(const xir::Subgraph* subgraph, const std::string& mode = "")

    次の結果が返されます。

    std::unique_ptr<Runner>

    create_runner への入力は、Vitis AI コンパイラで生成された XIR サブグラフです。

ヒント: VART でマルチスレッド処理を有効にするには、スレッドごとにランナーを作成します。
注記: モデルに複数のサブグラフがある場合は、次を参照してください。

https://github.com/Xilinx/Vitis-AI-Tutorials/tree/1.4/Feature_Tutorials/pytorch-subgraphs.