Manual Dump and Register Reading to Detect AI Engine Status in Hardware Emulation and Hardware - 2023.2 English

Vitis Tutorials: AI Engine (XD100)

Document ID
XD100
Release Date
2024-03-05
Version
2023.2 English
  • Using xbutil to report graph running status: The following command can be used to report graph running status:

    xbutil examine -r aie -d 0
    

    The output of above command is as follows:

      ```
      ----------------------
      [0000:00:00.0] : edge
      ----------------------
      Aie
        Aie_Metadata
        GRAPH[ 0] Name      : gr
                  Status    : unknown
          SNo.  Core [C:R]          Iteration_Memory [C:R]        Iteration_Memory_Addresses
          [ 0]   24:0                24:0                          8324
          [ 1]   25:0                24:0                          7012
    
      Core [ 0]
          Column                : 24
          Row                   : 0
          Core:
              Status                : disabled, east_lock_stall
              Program Counter       : 0x000001ca
              Link Register         : 0x000000b0
              Stack Pointer         : 0x0003a0c0
          DMA:
              MM2S:
                  Channel:
                      Id                    : 0
                      Channel Status        : idle
                      Queue Size            : 0
                      Queue Status          : okay
                      Current BD            : 0
    
                      Id                    : 1
                      Channel Status        : idle
                      Queue Size            : 0
                      Queue Status          : okay
                      Current BD            : 0
    
              S2MM:
                  Channel:
                      Id                    : 0
                      Channel Status        : stalled_on_requesting_lock
                      Queue Size            : 0
                      Queue Status          : okay
                      Current BD            : 0
    
                      Id                    : 1
                      Channel Status        : idle
                      Queue Size            : 0
                      Queue Status          : okay
                      Current BD            : 0
    
          Locks:
              0                     : acquired_for_read
              1                     : released_for_read
              2                     : acquired_for_write
              3                     : released_for_write
              4                     : released_for_write
              5                     : released_for_write
              6                     : released_for_write
              7                     : released_for_write
              8                     : released_for_write
              9                     : released_for_write
              10                    : released_for_write
              11                    : released_for_write
              12                    : released_for_write
              13                    : released_for_write
              14                    : released_for_write
              15                    : released_for_write
    
          Events:
              core                  : 1, 2, 5, 22, 26, 28, 29, 31, 32, 35, 38, 39, 44, 73, 74, 78, 82, 86, 90, 94, 98, 102, 106, 114
              memory                : 1, 20, 21, 25, 33, 43, 44, 45, 46, 47, 48, 76, 78, 106, 113
    
      Core [ 1]
          Column                : 25
          Row                   : 0
          Core:
              Status                : disabled, stream_stall_ms0
              Program Counter       : 0x00000310
              Link Register         : 0x00000220
              Stack Pointer         : 0x00029ba0
          DMA:
              MM2S:
                  Channel:
                      Id                    : 0
                      Channel Status        : idle
                      Queue Size            : 0
                      Queue Status          : okay
                      Current BD            : 0
    
                      Id                    : 1
                      Channel Status        : idle
                      Queue Size            : 0
                      Queue Status          : okay
                      Current BD            : 0
    
              S2MM:
                  Channel:
                      Id                    : 0
                      Channel Status        : idle
                      Queue Size            : 0
                      Queue Status          : okay
                      Current BD            : 0
    
                      Id                    : 1
                      Channel Status        : idle
                      Queue Size            : 0
                      Queue Status          : okay
                      Current BD            : 0
    
          Locks:
              0                     : released_for_write
              1                     : released_for_write
              2                     : released_for_write
              3                     : released_for_write
              4                     : released_for_write
              5                     : released_for_write
              6                     : released_for_write
              7                     : released_for_write
              8                     : released_for_write
              9                     : released_for_write
              10                    : released_for_write
              11                    : released_for_write
              12                    : released_for_write
              13                    : released_for_write
              14                    : released_for_write
              15                    : released_for_write
    
          Events:
              core                  : 1, 2, 5, 22, 23, 24, 28, 29, 31, 32, 35, 38, 39, 41, 44, 73, 74, 75, 76, 78, 79, 80, 82, 83, 84, 86, 87, 88, 90, 91, 92, 94, 95, 96, 98, 99, 100, 102, 103, 104, 106, 114
              memory                : 1		
      ```
    

    Tip: If a design hangs in Linux, press Ctrl+Z to suspend the design and run command.

    It is seen that core[0] (tile_24_1, aie_dest2) is in the status east_lock_stall, and core[1] (tile_25_1, aie_dest1) is in the status stream_stall_ms0. That is, aie_dest1 is trying to write to the consumer aie_dest2, while aie_dest2 is still trying to acquire lock to start.

    Tip: Cross-probe between Graph and Array view in Vitis Analyzer to understand kernels, buffers, and the locations of ports. `

  • Using devmem to probe AI Engine registers to see AI Engine status: By using the devmem command, you can read AI Engine registers to see the AI Engine internal status. The register reference can be found in the Versal ACAP AI Engine Register Reference (AM015).

    For example, the core status registers can be found here:

    core status

    Find the absolute addresses for the kernels in the design. The status of the kernels can be read by running the following command:

      versal-rootfs-common-20231:/run/media/mmcblk0p1# devmem 0x2000C872004
      0x00001000
      versal-rootfs-common-20231:/run/media/mmcblk0p1# devmem 0x2000C072004 
      0x00000200
      ```
    

    Value 0x00001000 indicates that it is Stream_Stall_MS0, and value 0x00000200 indicates that it is Lock_Stall_E. The analysis of the result is similar to using xbutil.