Rate This Document
Findability
Accuracy
Completeness
Readability

Checking Matricization

The matricization check function checks matricizable code fragments and provides modification suggestions.

Command Function

Checks matricizable code snippets.

Syntax

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-timeoutTIMEOUT]

Parameter Description

Table 1 Parameter description

Parameter

Option

Description

-h/--help

-

Obtains help information.

-i/--input

INPUT_PATH

Path to the source code folder to be scanned. This parameter is mandatory.

-s/--scan-dir

SCAN_DIR

Relative path to the file or folder to be scanned in the source folder. Use spaces to separate them if there are multiple paths.

-b/--build-tool

make/cmake

Build tool, which defaults to make.

-c/--cmd

COMMAND

Source code build command. If the command contains spaces, use single quotation marks (').

Enter -c or -j.

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"

-j/--compile-command-json

COMPILE_JSON_PATH

Path to the compile_commands.json file. For details about how to generate a JSON file, see Generating a JSON File.

Enter -c or -j.

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

-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/html/csv

Scan report format, which defaults to all.

  • all: generates reports in HTML and CSV formats.
  • html: generates a report only in HTML format.
  • csv: generates a report only in CSV format.

-p/--optimization

sme/domain

Matricization optimization method. This parameter is mandatory.

  • sme: SME-based matricization, covering Stencil, GEMV, and FFT.
  • domain: domain-specific optimization, which must be used together with the -m option.

-m/--module

compute/memory_access/communication

Domain-specific optimization method. This parameter is optional.

  • compute: computing optimization, including equivalent transformation, elimination of redundant common operators, unit step calculation optimization, precision-consistent conversion of division to multiplication, search algorithm optimization, reduction calculation parallelization, directive statement optimization, sin/cos operator fusion, exp calculation simplification, and loop fusion.
  • memory_access: memory access optimization, that is, large data dimension reduction.
  • communication: communication optimization, that is, communication hiding.

If you select domain for matricization optimization, select at least one domain-specific method.

--set-timeout

-

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.

For details about SME-based matricization and domain-specific optimization technologies, see Matricization Check.

Example

In this example, the source code in the /home/test_code/data directory is scanned, the build tool is make, the build command is make, and the matricization optimization methods are sme and domain. Replace the example parameter values with the actual ones.

devkit advisor matrix-check -i /home/test_code/data -c make -b make -o /home/out/ -p domain,sme -m compute,memory_access,communication

The following information is displayed and a report is generated:

Scanned time: 2024/06/12 02:18:35
Configuration: 
    Scan source code path: /home/test_code/data
    Generate report path: /home/out
    Generate report type: all
    Task Timeout Interval: The timeout period is not set.
    Log level: info

Summary:
    Scanned 11 files, there are 50 sugguestions.

For the details information, please check:
/home/out/matrix-check_20240612021835_2d68.html
/home/out/matrix-check_20240612021835_2d68.csv
After the project analysis is complete, additional optimization files are generated in /home/out/matrix-check_20240612021835_2d68
Download the optimization files and adapt the project build files.
Adapt the project build files to the FFT-SME library, which is located in /home/out/fftm.zip

Output Report

Table 2 Output report parameters

Parameter

Description

Configuration

Displays the software source file path.

Source File to Be Modified

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