AI Engine Deadlock Example and Analysis in AI Engine Simulator - 2023.2 English

Vitis Tutorials: AI Engine (XD100)

Document ID
XD100
Release Date
2024-03-05
Version
2023.2 English

The example is similar to the one used in AI Engine Execution and Measurement, except that it does not have a FIFO for the stream connection:

Deadlock Example Graph

When the design stalls, graph::wait() and graph::end() hang. It needs to interrupt graph execution by:

  • Using graph::wait(CYCLE_NUMBER): Specifying the number of cycles to wait for the API to return (if the graph does not return after CYCLE_NUMBER cycles, this API still returns immediately).

  • Using graph::end(CYCLE_NUMBER): Specifying the number of cycles to wait for the graph to be ended (if the graph does not return after CYCLE_NUMBER cycles, this API still ends the graph immediately).

  • Using the --simulation-cycle-timeout CYCLE_NUMBER option for aiesimulator.

The CYCLE_NUMBER should be large enough for AI Engine simulator to record all the stall events, or for hardware to run into hang status.

  1. In this example, examine aie/graph.cpp. We wait for 10000 cycles:

    gr.init();
    gr.run(4);
    gr.wait(10000);
    
  2. Run AI Engine simulator using the following command:

    make aiesim
    
  3. Open Trace view in Vitis Analyzer by using the following command:

    vitis_analyzer aiesimulator_output/default.aierun_summary
    

    Trace View

    The hang occurs after the following activities:

    1: Kernel aie_dest1 acquires the lock of read buffer (buf0) and write buffer (buf1).

    2: Kernel aie_dest1 starts.

    3: Kernel hangs in stream stall.

    4: S2mm is waiting for kernel aie_dest1 to release buffer buf0.