Rate This Document
Findability
Accuracy
Completeness
Readability

Single-File Scanning Mode (x86 Intel Intrinsics Analysis)

You can add the --enable-intel-intrinsics parameter next to the ./tiancheng command to enable x86 Intel intrinsics analysis, which analyzes x86 vectorized instructions in source files to rewrite x86 vectorized code.

The flame graph scanning mode and function scanning mode also support x86 Intel intrinsics analysis. In the following example, x86 Intel intrinsics analysis is enabled when scanning a single source file.

Prerequisites

Assume that the Tiancheng Code Optimizer is installed in /home/tiancheng-x.x.x-Linux-Kunpeng.

Example of Using x86 Intel Intrinsics Analysis

  1. Run the following command to enable x86 Intel intrinsics for source file scanning. In this example, the source code contained in /home/demo/input.cpp is scanned and the report files are stored in /home/demo. Replace the example parameter values with actual values.
    ./tiancheng --enable-intel-intrinsics -i /home/demo/input.cpp -o /home/demo -r /path/to/code_project
    • After the preceding command is executed, x86 Intel intrinsics analysis is enabled. The source files in the /home/demo directory are scanned, x86 vectorized instructions in the source files are analyzed, and vectorization check report and JSON report files are generated in the /home/demo directory. Specify the project root directory /path/to/code_project to ensure that header files can be correctly located.
    • A vectorization check report contains vectorization check information and the analysis process. The function vectorization check report is available only when x86 Intel intrinsics analysis is enabled. If this mode is disabled, only a loop vectorization check report is available.
    • A JSON report is a source code tuning suggestion report. Table 1 describes the fields in the report.

    Part of the command output:

    Successfully generated vectorization report: /home/demo/Vectorization_Source_20260527_094859_372_8895.html
    Successfully generated vectorization optimization result: /home/demo/Vectorization_Optimization_Result_20260527_094859_372_8895.json
  2. Open the generated vectorization check report and view the vectorization check information. The report includes the loop vectorization check result, function vectorization check result, and task information.
  3. Click Loop Vectorization Report. The loop check result is displayed, as shown in the following figure:

    Table 1 Parameters in the report

    Parameter

    Description

    Loop Vectorization Statistics

    Total Loops

    Total number of loops scanned in the source file.

    Vectorizable

    Number of vectorizable loops in the source file.

    Potentially vectorizable

    Number of loops that can be vectorized only after special processing (such as function inlining) is performed.

    Non-vectorizable

    Number of non-vectorizable loops in the source file.

    Loop Check Result

    Loop types that can be detected by the Tiancheng Code Optimizer, including vectorizable, potentially vectorizable, and non-vectorizable.

    Analyzed Loop Lines

    Lines of code in the loop in the source file.

    Loop Variable

    Variable used in the loop iteration.

    Source File Path

    Path to the source file where the loop is located.

    You can filter different loop types in Result Category. By default, all loop types are selected. You can click Reset to return to the default status. You can click any row to expand the specific loop analysis process.

  4. Click Analyzed loop lines to expand a loop analysis process, which can be vectorizable, potentially vectorizable, and non-vectorizable.
    • The following figure shows the process of analyzing a vectorizable loop.

    • The following figure shows the process of analyzing a potentially vectorizable loop.

    • The following figure shows the process of analyzing a non-vectorizable loop.

      Table 2 describes the parameters of the loop analysis process.

    Table 2 Parameters of the loop analysis process

    Type

    Parameter

    Description

    Vectorizable

    Complete Loop Snippet

    Code snippet of the loop in the source file.

    Vectorized Optimized Snippet

    Code snippet of the loop after being vectorized by the Tiancheng Code Optimizer.

    Potentially vectorizable

    Complete Loop Snippet

    Code snippet of the loop in the source file.

    Non-vectorizable

    Why Non-vectorizable

    Reasons why the Tiancheng Code Optimizer determines that the loop is non-vectorizable.

    Complete Loop Snippet

    Code snippet of the loop in the source file.

    Common parameters

    Loop Body Analysis (Line-by-Line)

    Loop analysis process performed by the Tiancheng Code Optimizer.

    Lines of Code

    Lines of code for the loop body.

    Coverage

    Indicates whether it is covered by a vectorization mode of the Tiancheng Code Optimizer.

    Line Vectorization Status

    Vectorization status of a single line of code in the loop body, which can be vectorizable, potentially vectorizable, or non-vectorizable.

    Check Information

    Result of code line analysis performed by the Tiancheng Code Optimizer.

    NOTE:

    If the code line vectorization status is vectorizable, no check information is displayed. If the status is potentially vectorizable or non-vectorizable, the cause or suggestion is displayed.

  5. Click Function Vectorization Report. The function check result is displayed, as shown in the following figure:

    Table 3 Parameters in the report

    Parameter

    Description

    Function Vectorization Statistics

    Total Functions

    Total number of functions scanned in the source file.

    Vectorizable

    Number of vectorizable functions in the source file.

    Potentially vectorizable

    Number of functions that contain rewriteable instructions but are not supported by the Tiancheng Code Optimizer for rewriting.

    Non-vectorizable

    Number of non-vectorizable functions in the source file.

    Function Check Result

    Function types that can be detected by the Tiancheng Code Optimizer, including vectorizable, potentially vectorizable, and non-vectorizable.

    Lines Analyzed

    Code lines of the function in the source file.

    Function Name

    Function name for which vectorization is checked by the Tiancheng Code Optimizer.

    Source File Path

    Path to the source file where the function is located.

    You can filter different function types in Result Category. By default, Vectorizable and Potentially vectorizable are selected. You can click Reset to return to the default status. You can click any row to expand the specific function analysis process.

  6. Click Lines Analyzed to expand a function analysis process, which can be vectorizable, potentially vectorizable, and non-vectorizable.
    • The following figure shows the process of analyzing a vectorizable function.

    • The following figure shows the process of analyzing a potentially vectorizable function.

    • The following figure shows the process of analyzing a non-vectorizable function.

      Table 4 describes the parameters of the function analysis process.

      Table 4 Parameters of the function analysis process

      Function Analysis Process

      Parameter

      Description

      Vectorizable

      Complete Function Snippet

      Code snippet of the function in the source file.

      Vectorized Optimized Snippet

      Code snippet of the function after being vectorized by the Tiancheng Code Optimizer.

      Check Information

      Analysis results of x86 instructions and variables in the lines of code by the Tiancheng Code Optimizer.

      Potentially vectorizable

      Complete Function Snippet

      Code snippet of the function in the source file.

      Check Information

      Analysis results of x86 instructions and variables in the lines of code by the Tiancheng Code Optimizer.

      Not vectorizable

      Why Non-vectorizable

      The rewrite module of the Tiancheng Code Optimizer is not yet adapted and does not currently support vectorization rewriting.

      Complete Function Snippet

      Code snippet of the function in the source file.

      Vectorized Optimized Snippet

      Code snippet of the function after being vectorized by the Tiancheng Code Optimizer.

      Check Information

      Result of code line analysis performed by the Tiancheng Code Optimizer.

      NOTE:

      If the code line vectorization status is vectorizable, no check information is displayed. If the status is potentially vectorizable or non-vectorizable, the cause or suggestion is displayed.

      Common parameters

      Function Analysis (Line by Line)

      Function analysis process performed by the Tiancheng Code Optimizer.

      Lines of Code

      Lines of code for the function body.

      Coverage

      Indicates whether it is covered by a vectorization mode of the Tiancheng Code Optimizer.

      Line Vectorization Status

      Vectorization status of a single line of code in a function, which can be Vectorizable, Potentially vectorizable, Non-vectorizable, Only x86-type variables included, or Irrelevant statement.

  7. Click Task Information to view the information about the current check report. See the following figure.

    Table 5 Task information

    Parameter

    Description

    Task Name

    Name of the check task automatically created by the Tiancheng Code Optimizer.

    Report Generated

    Time when the Tiancheng Code Optimizer generates the report.

    Source File Path

    Path to the source file containing the scanned source code.

    Flame Graph Path

    Path to the scanned flame graph SVG file.

    Specific Function Name

    Name of the scanned function.

    File Project

    Root directory of the project containing the source file to be analyzed.

    Clang File Path

    Directory of the Clang built-in header file (for example, stddef.h).

    GCC Toolchain

    GCC installation directory, which is used as the toolchain path for code analysis.

    Enable SVE

    Indicates whether to convert the instruction set to the SVE instruction set.