Programming with VART - 1.4.1 English

Vitis AI User Guide (UG1414)

Document ID
UG1414
Release Date
2021-12-13
Version
1.4.1 English

Vitis AI provides a C++ DpuRunner class with the following interfaces:

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

    Submit input tensors for execution and output tensors to store results. The host pointer is passed using the TensorBuffer object. This function returns a job ID and the status of the function call.

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

    The job ID returned by execute_async is passed to wait() to block until the job is complete and the results are ready.

  3. TensorFormat get_tensor_format()

    Query the DpuRunner for the Tensor format it expects.

    Returns DpuRunner::TensorFormat::NCHW or DpuRunner::TensorFormat::NHWC

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

    Query the DpuRunner for the shape and name of the input and output tensors it expects for its loaded Vitis AI model.

  5. To create a DpuRunner object, call the following: function
    create_runner(const xir::Subgraph* subgraph, const std::string& mode = "")

    It returns the following:

    std::unique_ptr<Runner>

    The input to create_runner is a XIR subgraph generated by the Vitis AI compiler.

Tip: To enable multi-threading with VART, create a runner for each thread.