Rate This Document
Findability
Accuracy
Completeness
Readability

Vectorization Check

The vectorization check function checks vectorizable code snippets and provides modification suggestions.

Command Function

Checks vectorizable code snippets.

To enable vectorization, you need to prepare the required compiler versions in the operating environment.

  • GCC version: GCC 7/GCC 8/GCC 9/GCC 10
  • Clang version: Clang 12/Clang 15/Clang 16

Syntax

1
devkit advisor vec-check [-h | --help] {-i INPUT_PATH | --input INPUT_PATH} {-f BC_PATH | --bc-file BC_PATH} {-c COMMAND | --cmd COMMAND} [-o OUTPUT_PATH | --output OUTPUT_PATH] [-p {clang,gcc} | --compiler {clang,gcc}] [-l {0,1,2,3} | --log-level {0,1,2,3}] [-r {all,json,html,csv} | --report-type {all,json,html,csv}] [--set-timeout TIMEOUT] [--sve-enable {true,false}]

Parameter Description

Table 1 Parameter description

Parameter

Option

Description

-h/--help

-

Obtains help information. This parameter is optional.

-i/--input

-

Path to the source code folder corresponding to the BC file. This parameter is mandatory.

-f/--bc-file

-

BC folder path. BC files must exist in this path. This parameter is mandatory.

NOTE:

-c/--cmd

-

Source code build command. This parameter is mandatory. Builds source code. If there are multiple build commands, separate them with semicolons (;) and enclose them with single quotation marks (') or double quotation marks ("). If a command contains spaces, enclose it with single or double quotation marks.

Example: "mkdir build;cd build;cmake ..;make"

NOTE:

The source code build command in the command line tool does not support variable setting and environment variable export.

Example: "CFLAGS='-O0 -g';make" or "export CFLAGS='-O0 -g';make"

-o/--output

-

Path for storing scan reports. By default, scan reports are stored in the current execution path. A report name is the format of Module-name_Timestamp. This parameter is optional.

-p/--compiler

gcc/clang

Source code compiler, which defaults to clang. This parameter is optional.

-l/--log-level

0/1/2/3

Log level, which defaults to 1. This parameter is optional.
  • 0: DEBUG
  • 1: INFO
  • 2: WARNING
  • 3: ERROR

-r/--report-type

all/json/html/csv

Scan report format, which defaults to all. This parameter is optional.
  • all: generates reports in JSON, HTML, and CSV formats.
  • json: generates a report only in JSON format.
  • html: generates a report only in HTML format.
  • csv: generates a report only in CSV format.

--set-timeout

-

Timeout interval of a task, in minutes. If the execution duration exceeds the timeout interval, the task exits. This parameter is optional. By default, there is no timeout interval. The task will be executed until it is complete.

--sve-enable

true/false

Indicates whether to enable Scalable Vector Extension (SVE). The default value is false. This parameter is optional. SVE is a variable-length instruction set introduced since ARMv8a. It aims to enhance the portability of binary code so that it can run on a wider range of SIMD units.

Example

In this example, the source file in the /home/testcase/cplusproject directory is scanned. Replace the example directory with the actual one.

1
devkit advisor vec-check -i /home/testcase/cplusproject -f /home/test/bc_files -c 'make' -p gcc -o /opt/DevKit -l 0
The following information is displayed and a report is generated:
Executing Vector Check task, please wait...
Current progress:  [0%]Start generate the compile log.
Generate the compile log succeed.
Current progress: ################################# [100%]
Scanned time: 2025/04/08 11:41:40

Configuration:
    Scan bc files path: /home/test/bc_files
    Scan source code path: /home/testcase/cplusproject
    Command: make
    Compiler: gcc
    EnableSVE: false
    Generate report path: /opt/DevKit
    Generate report type: all
    Task Timeout Interval: The timeout period is not set.
    Log level: debug

Summary:
    Scanned 2 bc files, there are 2 recommended modifications.

For the details information, please check:
    /opt/DevKit/vec-check_20250408114140_488a.json
    /opt/DevKit/vec-check_20250408114140_488a.html
    /opt/DevKit/vec-check_20250408114140_488a.csv

Output Report

Table 2 Output report parameters

Parameter

Description

Configuration

Displays the paths of the software source file and BC file.

Source File to Be Modified

Displays information such as the path to the source file that needs to be modified.