Overview
msSanitizer is an exception detection tool based on Ascend AI Processor. It provides three functions: memory check, contention check, and uninitialization check. After testing the operator functions in a real-world hardware environment by using the msOpST tool, you can determine whether to use the msSanitizer tool for exception detection based on the actual test situation.
- Memory check: During operator development, the tool can locate memory problems such as illegal read/write, multi-core corruption, non-aligned access, memory leak, and illegal release. In addition, the tool can detect the memory of the CANN software stack, helping users locate the module with memory exception in the software stack.
- Contention check: The tool helps users locate data contention problems that may be caused by contention risks, including intra-core contention and inter-core contention. Intra-core contention includes inter-pipeline contention and intra-pipeline contention.
- Uninitialization check: The tool helps users locate dirty data read problems that may be caused by uninitialized memory.
msSanitizer cannot detect exceptions for multi-thread operators, level-2 pointer operators, and vector computation instructions that use masks.
Features
msSanitizer provides different error detection functions. The following functions are supported:
Use Cases |
Example |
Sample |
|---|---|---|
Operator memory check |
|
|
Operator contention check |
||
Operator uninitialization check |
msSanitizer supports uninitialization detection of Ascend C operators (including Vector, Cube, and Mix fusion operators) called by AscendCL. For details, see Uninitialization Check. |
|
Memory check of the CANN software stack |
For details, see Checking the Memory of the CANN Software Stack. |
Commands
You can run the following command to call msSanitizer:
mssanitizer <options> -- <user_program> <user_options>
- options is the command line option of the detection tool. For details about the available options and their default values, see Table 2 and Table 3. user_program indicates the user operator program, and user_options indicates the command line option of the user program.
- If the executable file or user-defined program to be loaded contains command line options, use -- to separate the detection tool from the user command before the executable file or applications.
mssanitizer -- application parameter1 parameter2 ...
- Ensure the security of executable files and user-defined applications.
- You need to ensure the execution security of executable files or applications.
- You are advised to restrict the operation permission on executable files or applications to avoid privilege escalation risks.
- You are not advised to perform high-risk operations (such as deleting files, deleting directories, changing passwords, and running privilege escalation commands) to avoid security risks.
Parameter |
Description |
Value |
Required |
|---|---|---|---|
-v, --version |
Queries the msSanitizer version. |
- |
No |
-t, --tool |
Specifies the sub-tool for exception detection. |
|
No |
--log-file |
Specifies that the detection report is exported to a file. |
{file_name}, for example, test_log NOTE:
|
No |
--log-level |
Specifies the output level of the detection report. |
|
No |
--max-debuglog-size |
Specifies the maximum size of a single file in the debugging logs output by the detection tool. |
The value is an integer ranging from 1 to 10240, in MB. Defaults to 1024. NOTE:
--max-debuglog-size=100 indicates that the maximum size of a debug log file is 100 MB. |
No |
-h, --help |
Outputs the help information. |
- |
No |
Parameter |
Description |
Value |
Required |
|---|---|---|---|
--check-unused-memory |
Whether to detect unused allocated memory |
|
No |
--leak-check |
Whether to enable memory leak detection |
|
No |
--check-device-heap |
Whether to enable device memory detection |
|
No |
--check-cann-heap |
Whether to enable memory detection of the CANN software stack |
|
No |
- After --check-device-heap or --check-cann-heap is enabled, the kernel is not checked.
- The device memory detection and CANN software stack memory detection cannot be enabled at the same time. If they are enabled at the same time, the message "--check-cann-heap and --check-device-heap CANNOT both enabled" is displayed.
- The to-be-detected program that is recompiled using the API header file provided by the msSanitizer tool can be used only for leakage detection of AscendCL interfaces and cannot be used for detection of device interfaces.
Call Scenarios
The following operator call scenarios are supported
- Kernel launch
For details about how to verify the running of the kernel function, see Kernel Launch. For details, see Checking the Ascend C Operator of the Kernel Launch Symbol.
- AscendCL single-operator execution: single-operator API execution scenario
For details about single-operator API execution, see Single-Operator API Calling. For the procedure, see Detecting AscendCL-Called Single Operators.
- Third-party framework operator calling: PyTorch framework scenario
For details about how to use to call a single-operator through the PyTorch framework, see "Self-Developed Styleparameter Plugin > OpPlugin Development for Single-Operator Adaptation" in Ascend Extension for PyTorch Suites and Third-Party Libraries . For details, see Checking the Operators Called by a PyTorch API.
Result Files
Result File |
Description |
|---|---|
mssanitizer_{TIMESTAMP}_{PID}.log |
msSanitizer logs generated in the current directory during msSanitizer running. TIMESTAMP indicates the current timestamp, and PID indicates the PID of the current detection tool. |
kernel.{PID}.o |
Operator cache file generated in the current path during the running of msSanitizer. PID is the PID of the detection tool in use. The operator cache file is used to parse the abnormal call stack.
|