向量化检查功能用于对可向量化片段进行检查,并提供向量化修改建议。
对可向量化片段进行检查。
使用向量化需要在运行环境上准备对应编译器版本。
1 | 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}] |
参数 |
参数选项 |
参数说明 |
---|---|---|
-h/--help |
- |
获取帮助信息。 |
-i/--input |
input_path |
必选参数,BC文件对应的源码文件夹路径。 |
-f/--bc-file |
path |
必选参数,BC文件夹路径,该路径下必须存在BC文件。 |
-c/--cmd |
command |
必选参数,源码的构建命令。 说明:
命令行工具源码构建命令不支持设置变量和export环境变量。 例如:"CFLAGS='-O0 -g';make"或"export CFLAGS='-O0 -g';make"。 |
-p/--compiler |
gcc/clang |
指定用于编译源码的编译器,默认为clang。 |
-o/--output |
output_path |
扫描报告的存放路径,默认存放在当前执行路径下,报告名称为模块名称_时间戳。 |
--set-timeout |
time |
任务超时时间,单位为分钟,若执行时间超过超时时间则退出执行。默认无超时时间,任务将持续执行直到结束。 |
-l/--log-level |
0/1/2/3 |
设置日志级别,默认为1。
|
-r/--report-type |
all/json/html/csv |
扫描报告的格式,默认为all。
|
--sve-enable |
true,false |
是否启用SVE,默认不开启。SVE是在ARMv8a之后引入的可变长度向量化指令,目的是增强二进制代码的可移植性,使其可以运行在更广泛的SIMD单元上。 |
此处以扫描“/home/testcase/cplusproject”路径下源码文件为例,请根据实际情况进行修改。
1 | devkit advisor vec-check -i /home/testcase/cplusproject -f /home/advisor/bc_file -c 'make' -p gcc -o /opt/DevKit -l 0 |
debug: Enter the second level command: advisor 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/07 06:51:24 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: /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_20250407065124_cbe5.json /opt/DevKit/vec-check_20250407065124_cbe5.html /opt/DevKit/vec-check_20250407065124_cbe5.csv
参数 |
说明 |
---|---|
配置信息 |
显示软件源码文件及BC文件存放路径。 |
需要修改的源码文件 |
显示存在向量化问题,并需要进行修改的源码文件路径等相关信息。 |