Skip to main content

Performance_benchmark

Obtaining Performance Data

Before optimizing the performance, you need to obtain accurate performance data, understand the current performance status, and analyze the next optimization direction based on the performance status. MindStudio provides realistic methods for testing the performance of Triton operators.

Device-end

The msProf tool is used to collect and analyze key performance indicators of operators running on the Ascend AI Processor. You can use the output performance data to quickly locate the software and hardware performance bottlenecks of operators and improve the efficiency of operator performance analysis.
The following is a case of using msprof for data collection. Below is the field-by-field breakdown of the operator performance record, aligned with the official specification.

1. Basic Identification Fields

2. Timing & Scheduling Fields

3. Core Configuration & Precision Fields

4. Input & Output Information

5. AI Core Performance Metrics (aic_* series)

6. AI Vector Core Performance Metrics (aiv_* series)

7. Utilization Metrics

Optimization

Specification

1. Ascend core compute units

  • AI Core: the core that actually performs matrix/vector computation
  • Vector Unit: responsible for SIMD computation (similar to CUDA Core)
  • Scalar Unit: responsible for control/loop
  • L0/L1/L2 cache: The smaller the size, the faster the speed. L0 is only 64KB, L1 is 256KB, and L2 is shared.

2. Ascend memory hierarchy (from fastest to slowest)

  • Register → Fastest
  • L0/L1 cache → Very fast
  • On-chip cache (L2) → Fast
  • DDR (host memory) → Slowest

3. Characteristics of Ascend instructions

Good at accessing large contiguous memory blocks Dislikes discrete access, stride access, and random access Must be 128-bit/256-bit aligned Must be vectorized.

Tips

  1. Ascend 910 series usually has only 40 or 48 vector cores. If the number of grids exceeds 40 or 48 vector cores, the grids will be delivered in a queue, resulting in a long waiting time. Therefore, the number of cores for high-performance implementation does not exceed the number of vector cores.
  2. Try to use up all the UB as much as possible. Move a large block size at a time to ensure that the bound is in the MTE. No Redundant Copy.
  3. If the offset is a negative number, the current triton-ascend considers it as a discrete memory access scenario. As a result, the performance severely deteriorates, and the data is read from the entire DMA block instead of being read in scalar mode.
  4. The UB of the Ascend hardware requires that the size of the tail axis of the tensor can be exactly divided by 32bytes. If the length of the tail axis is insufficient, the length of the tail axis is automatically supplemented. For example, the performance deteriorates exponentially due to automatic supplementation for the Tensor whose shape is (2048, 3). In this situation, you can perform the transposition operation to change the alignment axis to a lower dimension. In addition, the transposition operation is affected by the automatic supplement rule. Therefore, special skills are also required to avoid supplementation.
  5. Use Double Buffer, parallelizes computation and data transfer. While computing one block of data, another block of data is being transferred to L1.
  6. If hostbound behavior is severe, core binding can be used to address it.