Importing Debugging Information
Before debugging an operator, enable the -g -O0 option and recompile the operator so that the operator binary contains the debugging information. For details, see section compile an operator based on the sample project.
The behavior of the operator program in the -O0 compile option scenario is different from that in the -O2 compile scenario. Therefore, you are advised to use the Contention Check function of the msSanitizer tool instead of the -O0 compile option to locate the contention issue in an operator.
Generally, the operator debugging information is automatically imported to the msDebug tool. However, if the operator binary file exists independently and is deployed as a .o file (for example, in the Ascend CL single-operator execution scenario), you need to import the operator debugging information as follows:
Only the debugging information of a single operator can be imported.
- Method 1: Before debugging, configure the following environment variable, specify the operator loading path, and import the debugging information.
export LAUNCH_KERNEL_PATH={path_to_kernel} /my_kernel.o //{path_to_kernel} is the directory where the .o file on the kernel side is located. - Method 2: Before executing the run command, run the image add command to specify the operator loading path and import the debugging information.
(msdebug) image add {path_to_kernel} /my_kernel.o //{path_to_kernel} is the directory where the .o file on the kernel side is located.
- image add is tailor-made only for PyTorch.
- If you want to import the debugging information after the program runs, run the image load command to load the operator debugging information.
(msdebug) image load -f {path_to_kernel}/my_kernel.o -s 0
Parent topic: msDebug (Operator Debugging)