Affinity Analyzer CLI
The Affinity Analyzer is one of the tools provided by the Kunpeng DevKit. It can check software code on the Kunpeng 920 platform to improve code quality and memory access performance. It can work in VS Code, WebUI, or CLI mode. The Affinity Analyzer CLI performs the following functions:
- 64-bit running mode check: Uses a terminal tool to check the running mode.
- Byte alignment check: Checks the byte alignment of structure variables in the source code.
- BC file generation: Scans the source file to generate a BC file.
- Memory consistency check: Checks for memory consistency issues in source code.
- Vectorization check: Checks vectorizable code snippets.
- Matricization check: Checks matricizable code snippets.
- Build affinity check: Checks build affinity.
- Cache line alignment check: Checks the 128-byte alignment of structure variables in the C/C++ source code.
- Calculation precision analysis: Locates the precision differences of the Fortran, C, and C++ languages caused by x86 and Kunpeng instructions.
You can integrate the Affinity Analyzer CLI into the CI/CD pipeline to obtain suggestions for tuning Kunpeng affinity code.
For details about the Affinity Analyzer CLI, see Affinity Analyzer (CLI) in the Kunpeng DevKit Affinity Analyzer User Guide.
64-Bit Running Mode Check
The 64-bit running mode check function identifies the 32-bit applications to be ported to the 64-bit platform and provides modification suggestions. It supports GCC 4.8.5 to GCC 10.3.0.
Syntax:
devkit advisor run-mode [-h | --help] {-i INPUT_PATH | --input INPUT_PATH} {-c COMMAND | --command COMMAND} [-o OUTPUT_PATH | --output OUTPUT_PATH] [-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]
Byte Alignment Check
The byte alignment check function checks the byte alignment of structure variables in the source code to improve memory access performance.
Syntax:
devkit advisor addr-align [-h | --help] {-i INPUT_PATH | --input INPUT_PATH} {-c COMMAND | --cmd COMMAND} [-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]
BC File Generation
BC files are used for memory consistency check and vectorization check.
Command function:
devkit advisor bc-gen [-h | --help] {-c COMMAND | --command COMMAND} [-o OUTPUT_PATH | --output OUTPUT_PATH] [-l {0,1,2,3} | --log-level {0,1,2,3}] [--set-timeout TIMEOUT] [-t THREADS | --thread THREADS]
Memory Consistency Check
The memory consistency check function checks for any memory consistency problem when the source code is ported to the Kunpeng platform and provides suggestions on inserting memory barriers.
Command function:
devkit advisor mm-check [-h | --help] {-i INPUT_PATH | --input INPUT_PATH}{-f BC_PATH | --bc-file BC_PATH} [--autofix {true,false}] [--autofix-dir AUTOFIX_OUTPUT_PATH] [-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]
Vectorization Check
The vectorization check function checks vectorizable code snippets and provides modification suggestions to maximize the processor performance.
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}]
Matricization Check
The matricization check function checks matricizable code snippets and provides modification suggestions to maximize the processor performance.
Command function:
devkit advisor matrix-check [-h | --help] {-i INPUT_PATH | --input INPUT_PATH} [-s SCAN_DIR | --scan-dir SCAN_DIR] [-b {make, cmake} | --build-tool {make,cmake}] [-c COMMAND | --cmd COMMAND] [-j COMPILE_JSON_PATH | --compile-command-json COMPILE_JSON_PATH] [-o OUTPUT_PATH | --output OUTPUT_PATH] [-r {all,html,csv} | --report-type {all,html,csv}] {-p {sme,domain} | --optimization {sme,domain}} [-m {compute,memory_access,communication} | --module {compute,memory_access,communication}][-l {0,1,2,3} | --log-level {0,1,2,3}][--set-timeout TIMEOUT]
Build Affinity
The build affinity function analyzes the content in Makefile and CMakeLists.txt that can be replaced with content in the Kunpeng library, and provides replacement suggestions and function repair.
Command function:
devkit advisor affi-check [-h | --help] {-i INPUT_PATH | --input INPUT_PATH} {-c COMMAND | --cmd COMMAND} [-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]
Cache Line Alignment Check
The cache line alignment check function checks the 128-byte alignment of structure variables in the C/C++ source code to improve memory access performance.
Command function:
devkit advisor cacheline [-h | --help] {-i INPUT_PATH | --input INPUT_PATH} [-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]
Calculation Precision Analysis
The calculation precision analysis function locates the precision differences of the Fortran, C, and C++ languages caused by x86 and Kunpeng instructions.
Compilation and instrumentation:
1 | devkit advisor precision [-h | --help] {-instrument | --instrument} {-c COMMAND COMMANDS | --commands COMMANDS} {-p PROJECT | --project PROJECT} {-e ENTRY | --entry ENTRY} [-v VARIABLE | --variable VARIABLE] [-d DEPTH | --depth DEPTH] [-L | --loops] [-D DATABASE| --database DATABASE] [-b BLACK_LIST | --black-list BLACK_LIST] [-l {0,1,2,3} | --log-level {0,1,2,3}] [--set-timeout TIMEOUT] |
Log difference analysis:
1 | devkit advisor precision [-h | --help] {-analysis | --analysis} {-i INPUT_LOG | --input INPUT_LOG} [-o OUTPUT_PATH | --output OUTPUT_PATH] [-l {0,1,2,3} | --log-level {0,1,2,3}] [--set-timeout TIMEOUT] |