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

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

Parameter Description

Table 1 Parameter description

Parameter

Option

Description

-h/--help

-

Obtains help information.

-i/--input

input_path

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

-f/--bc-file

path

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

NOTE:
  • For details about how to generate a BC file in CLI mode, see Generating a BC File.
  • To use the third-party tool gllvm or the project building tool to generate a BC file, refer to method 2 or 3 respectively in Generating a BC File.

-c/--cmd

command

Source code build command. This parameter is mandatory.

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"

-p/--compiler

gcc/clang

Source code compiler, which defaults to clang.

-o/--output

output_path

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.

--set-timeout

time

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

-l/--log-level

0/1/2/3

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

-r/--report-type

all/json/html/csv

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.

--sve-enable

true/false

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.

devkit advisor vec-check -i /home/testcase/cplusproject -f /home/advisor/bc_file -c 'make' -p gcc -l 0
The following information is displayed and a report is generated:
Scanned time: 2024/02/29 06:11:25
Configuration:
    Scan bc files path: /home/advisor/bc_file
    Scan source code path: /home/testcase/cplusproject
    Command: make
    Compiler: gcc
    EnableSVE: false
    Generate report path: /home/DevKit_Softwar
    Generate report type: all
    Task Timeout Interval: The timeout period is not set.
    Log level: debug

Summary:
    Scanned 1 bc files, there are 0 recommended modifications.

For the detailed information, please check:
   /home/DevKit_Software/vec-check_20240229061125_0cdc.json
   /home/DevKit_Software/vec-check_20240229061125_0cdc.html
   /home/DevKit_Software/vec-check_20240229061125_0cdc.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 of the source file that needs to be modified.