Rate This Document
Findability
Accuracy
Completeness
Readability

A-FOT Configuration File Parameter Optimization

Procedure

The following procedure explains how to optimize parameters in the configuration file.

  1. Before using the A-FOT tool, move ${HOME}/.local/gcc-10.3.1-2023.12-aarch64-linux/bin to the beginning of the PATH environment variable. Example:
    export PATH=${HOME}/.local/gcc-10.3.1-2023.12-aarch64-linux/bin:$PATH
  2. Locate the a-fot.ini file in the A-FOT root directory and set the configuration items.
    vi ${HOME}/.local/a-fot/a-fot.ini
    File content:
    # Use absolute paths for files and directories.
    # Optimization mode, which is AutoFDO, AutoPrefetch, AutoBOLT, or Auto_kernel_PGO.
    opt_mode=AutoPrefetch
    #Script working directory, used to compile the application and store profiles and logs.
    work_path=/opt
    # Application running script path: run_script=/root/run.sh.
    # GCC path, which is the parent directory of bin and lib.
    gcc_path=/usr 
    # AutoFDO, AutoPrefetch, AutoBOLT
    # Configure the three optimization modes for the application.
    # Application process name.
    application_name=test
    # Executable file after binary installation.
    bin_file=/tmp/test
    # Application build script path: build_script=/root/build.sh.
    # Maximum binary startup time, in seconds.
    max_waiting_time=600
    # Perf sampling duration, in seconds.
    perf_time=100
    # Checks whether the optimization is successful (1: enabled; 0: disabled).
    check_success=0
    # Build mode, which is Bear or Wrapper.
    build_mode=Wrapper 
    # auto_kernel_PGO # Set the kernel optimization mode.
    # Kernel PGO mode. (arc: enables only the arc profile; all: enables full PGO.)
    pgo_mode=all
    # Execution stage. (1: stage of compiling and instrumenting the kernel; 2: stage of compiling and optimizing)
    pgo_phase=1
    # Kernel source code directory. If this directory is not specified, the kernel source code is automatically downloaded.
    kernel_src=/opt/kernel
    # Local name of the kernel build. The tool will add the -pgoing or -pgoed suffix depending on the stage.
    kernel_name=kernel
    # Kernel compilation options. Ensure that the options are correct and valid. Otherwise, the kernel compilation will fail. #CONFIG_...=y
    # Timestamped directory created before restart, used to store logs from the same workflow together.
    last_time=
    # Kernel source Makefile address, used when the kernel is not automatically compiled.
    makefile=
    # Kernel configuration file address, used when the kernel is not automatically compiled.
    kernel_config=
    # Directory of the original profile generated by the kernel, used when the kernel is not automatically compiled.
    data_dir=

    In the configuration file, the script working directory is in the /opt directory. Change it to the home directory or ./ based on your requirements.

  3. Run the following command to start optimization:
    a-fot --config_file a-fot.ini