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 check, 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

-

(Optional) Obtains help information.

-i/--input

-

(Mandatory) Path to the source code folder corresponding to the BC file.

-f/--bc-file

-

(Mandatory) BC folder path. BC files must exist in this path.

NOTE:

-c/--cmd

-

(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.

For example:

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

-o/--output

-

(Optional) 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.

-p/--compiler

gcc/clang

(Optional) Source code compiler, which defaults to clang.

-l/--log-level

0/1/2/3

(Optional) Log level, which defaults to 1.
  • 0: DEBUG
  • 1: INFO
  • 2: WARNING
  • 3: ERROR

-r/--report-type

all/json/html/csv

(Optional) Scan report format, which defaults to all.
  • 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

-

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

--sve-enable

true/false

(Optional) Indicates whether to enable Scalable Vector Extension (SVE). The default value is false. 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
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: info

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 to 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.