msProf (Operator Tuning)

The msProf tool is mainly used in the performance optimization phase of operator development. By using the msProf tool, developers can ensure that operators can run efficiently on different hardware platforms, thereby improving the overall software performance and user experience.

  1. Run the following command in the ${git_clone_path}/samples/operator/ascendc/0_introduction/1_add_frameworklaunch directory to generate a custom operator project and implement the operator on the host and kernel:
    bash install.sh -v Ascendxxxyy    # xxxyy indicates the processor type used by the user.
  2. Run the following command in the ${git_clone_path}/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/CustomOp directory to build and deploy the operator again:
    bash build.sh
    ./build_out/custom_opp_<target_os>_<target_architecture>.run   // Name of the .run package in the current directory
  3. Switch to the ${git_clone_path}/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AclNNInvocation directory and run the following command to generate an executable file:
    ./run.sh
  4. Specify the path of the dynamic library on which the operator depends and load the .so file of the dynamic library.
    export LD_LIBRARY_PATH=${INSTALL_DIR}/opp/vendors/customize/op_api/lib:$LD_LIBRARY_PATH
  5. Use msProf to perform tuning.
    • Use msprof op to perform board-based tuning.
      1. Switch to the ${git_clone_path}/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AclNNInvocation/output directory and run the following command to enable board-based tuning:
        msprof op --output=./output_data ./execute_add_op
      2. The following result directories are generated:
         1
         2
         3
         4
         5
         6
         7
         8
         9
        10
        11
        OPPROF_{timestamp}_XXX/
        ├── ArithmeticUtilization.csv
        ├── dump
        ├── L2Cache.csv
        ├── Memory.csv
        ├── MemoryL0.csv
        ├── MemoryUB.csv
        ├── OpBasicInfo.csv
        ├── PipeUtilization.csv
        ├── ResourceConflictRatio.csv
        └── visualize_data.bin
        
      3. Import the visualize_data.bin file to the MindStudio Insight tool to visualize the board tuning result. For details, see msprof op.
    • Use the msprof op simulator to perform simulation tuning.
      1. Configure the msprof op simulator as instructed in Configurations of msprof op simulator.
      2. Go to the ${git_clone_path}/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AclNNInvocation/output directory and run the following command to enable simulation tuning:
        msprof op simulator --soc-version=Ascendxxxyy --output=./output_data ./execute_add_op
      3. The following result directories are generated:
         1
         2
         3
         4
         5
         6
         7
         8
         9
        10
        11
        12
        13
        OPPROF_{timestamp}_XXX/
        ├── dump
        └── simulator
            ├── core0.veccore0
            ├── core0.veccore1
            ├── core1.veccore0
            ├── core1.veccore1
            ├── core2.veccore0
            ├── core2.veccore1
            ├── core3.veccore0
            ├── core3.veccore1
            ├── trace.json
            └── visualize_data.bin
        
      4. Import the trace.json and visualize_data.bin files to the MindStudio Insight tool to visualize the simulation result. For details, see msprof op simulator.