Rate This Document
Findability
Accuracy
Completeness
Readability

Static Memory Consistency Check

The tool checks for any memory consistency problem when the source code is ported to the Kunpeng platform and provides suggestions on inserting memory barriers.

  • Before using this function, ensure that the drive where the tool is installed has sufficient space. During the weak memory sequence checks, large intermediate files are generated. According to empirical data, about 100 GB of available drive space is required for every 100,000 lines of code.
  • The check of a large amount of source code consumes many resources. It is recommended the code to be checked do not exceed 100,000 lines.
  • The static memory consistency check function is available on the Kunpeng platform.

Prerequisites

You have logged in to the Kunpeng DevKit.
  • /opt is the default installation directory of the tool. The following uses this directory as an example. Replace it with the actual directory.
  • In the IDE, the tool plugin can scan local projects. If the source code is included in a compressed package, decompress the package and select the decompressed folder.

Procedure

  1. On the left pane of the page, choose Affinity Analyzer > Static Memory Consistency Check, and click to create a task. See Figure 1.
    Figure 1 Static memory consistency check
  2. Select a check mode.
    • Static check
    • Auto repair by compiler. For details, see Using the Auto Repair by Compiler.

      The static check features low false positive ratio and a repair rate up to 60%. The auto repair by compiler does not miss any report and features a repair rate of 100%, but the false positive ratio is higher. Higher false positive ratio indicates greater impact on performance. The repair rate varies depending on the software, and the impact on performance also varies.

  3. Set Source file path using either of the following methods:
    • Enter the absolute path of the source file.
    • Click Select Folder on the right and select the folder for storing the source file.
  4. Set BC File Path using either of the following methods:
    • Enter the absolute path of the BC file.
    • Click Select Folder on the right and select the folder for storing the BC file.
    • For details about the BC file and how to obtain it, see Generating a BC File.
    • Only one folder can be uploaded at a time. The size of the folder must be less than or equal to half of the remaining drive space.
  5. Choose whether to generate a compiler configuration file. The default value is Disabled.
  6. Click Check to start the static memory consistency check. After the check is complete, the check report page is displayed. See Figure 2.
    Figure 2 Static memory consistency check report
    • You can click to sort the source files to be modified by path or number of recommended items.
    • In the upper right corner of the page, you can click Download Report. Then click Download Report (.csv) or Download Report (.html) to download the analysis report. Alternatively, you can click next to the task name and click Download Report (.csv) or Download Report (.html) to download the analysis report.
    • If Generate compiler tool configuration files is selected, you can click Download Report in the upper right corner of the page and select Download compiler configuration files. Alternatively,you can click next to the task name and select Download compiler configuration files.
    • If the system displays a message indicating that the compiler file is not the latest, click Go to download the file from the latest report. If the system displays a message indicating that the latest report does not contain the compiler configuration file, perform operations as prompted.
    Table 1 Parameters in the report

    Parameter

    Description

    Source File Statistics

    Files to Modify

    Total number of files to be modified in the source file path.

    Code Lines to Modify

    Number of code lines to be modified.

    Total Number of Suggestions

    Total number of items recommended for modification. Modify these items to enhance application performance on the Kunpeng platform.

    Source Files to Modify

    Source files to be modified and suggestions for each file. You can click View Suggested Source Code in the Operation column to quickly go to the source file suggestion page.

  7. Click View Suggested Source Code. The Source Code Modification Suggestion tab page is displayed. See Figure 3.
    Figure 3 Source code modification suggestion
    • The tool supports concurrent running of multiple static memory consistency check tasks.
    • To cancel a task, click Close during the task running process.
    • To modify the configuration of a successful or failed task, click on the right of the task name to restart the task.
    • If you use shortcut keys to modify the source code, pay attention to shortcut key conflicts caused by the input method or IDE environment.
    • If the check fails or the check result indicates that no modification is required, an empty report is generated.
    • If the system displays a message indicating that the task times out, rectify the fault by following instructions in Task Timeout.