配置环境变量LAUNCH_KERNEL_PATH导入算子调试信息时,若一个算子有多个.o文件,无法确定应导入哪个文件
现象描述
当调试像 fused_infer_attention_score这类较大的算子时,由于编译后生成的.o文件数量较多(如下所示),用户可能难以判断应导入哪一个文件中的调试信息。
(py39) $ find ./ -name *.o ./op_impl/ai_core/tbe/kernel/ascend910b/fused_infer_attention_score/FusedInferAttentionScore_c9779e9cf662582fdc59feae83d98a97.o ./op_impl/ai_core/tbe/kernel/ascend910b/fused_infer_attention_score/FusedInferAttentionScore_c9779e9cf662582fdc59feae83d98a97_relocatable.o ./op_impl/ai_core/tbe/kernel/ascend910b/fused_infer_attention_score/FusedInferAttentionScore_436344defac760e81ad543718775dedf_relocatable.o ./op_impl/ai_core/tbe/kernel/ascend910b/fused_infer_attention_score/FusedInferAttentionScore_ecc807936618ac360a79b21656f3ff04_relocatable.o ./op_impl/ai_core/tbe/kernel/ascend910b/fused_infer_attention_score/FusedInferAttentionScore_29c62fc24e72bbc0878b0bd85b4a328d.o ./op_impl/ai_core/tbe/kernel/ascend910b/fused_infer_attention_score/FusedInferAttentionScore_3b093497fc536d61a77a7a3293a524da_relocatable.o ./op_impl/ai_core/tbe/kernel/ascend910b/fused_infer_attention_score/FusedInferAttentionScore_b7875fc3902e4412f7a0663e4d08c4c5_relocatable.o ./op_impl/ai_core/tbe/kernel/ascend910b/fused_infer_attention_score/FusedInferAttentionScore_8cd36e66e4ceb2d60ef96db29a147347.o ./op_impl/ai_core/tbe/kernel/ascend910b/fused_infer_attention_score/FusedInferAttentionScore_ed7b89d48fbae9f46c581ea00e7f9149_relocatable.o ./op_impl/ai_core/tbe/kernel/ascend910b/fused_infer_attention_score/FusedInferAttentionScore_885c5eb692c9d72249a97ae03b5ea7c7.o ./op_impl/ai_core/tbe/kernel/ascend910b/fused_infer_attention_score/FusedInferAttentionScore_e5777797aa0db1ccf2f4b8b25a0e9c0d.o ...
原因分析
因算子较大,编译生成的.o文件数量较多,用户难以判断应导入哪个.o文件中的调试信息。
解决措施
遇到这种情况,可使用msdebug直接拉起算子程序,无需设置断点,直接输入 r 命令后运行算子程序。关注屏幕输出如下所示,其中[Launch of Kernel FusedInferAttentionScore_8cd36e66e4ceb2d60ef96db29a147347_110000 on Device 0]展示了算子名:FusedInferAttentionScore_8cd36e66e4ceb2d60ef96db29a147347_110000,因此该算子程序中加载的算子.o文件对应: FusedInferAttentionScore_8cd36e66e4ceb2d60ef96db29a147347.o
(py39) $ msdebug -- bash build.sh --run_example fused_infer_attention_score eager cust msdebug(MindStudio Debugger) is part of MindStudio Operator-dev Tools. The tool provides developers with a mechanism for debugging Ascend kernels running on actual hardware. This enables developers to debug Ascend kernels without being affected by potential changes brought by simulation and emulation environments. (msdebug) target create "bash" Current executable set to '/usr/bin/bash' (aarch64). (msdebug) settings set -- target.run-args "build.sh" "--run_example" "fused_infer_attention_score" "eager" "cust" (msdebug) r Process 2395539 launched: '/usr/bin/bash' (aarch64) Process 2395539 stopped and restarted: thread 1 received signal: SIGCHLD ... [2026-02-24 20:13:25] Start to run example,name:fused_infer_attention_score mode:eager [2026-02-24 20:13:25] Start compile and run example file: ../attention/fused_infer_attention_score/examples/test_aclnn_fused_infer_attention_score.cpp [2026-02-24 20:13:25] pkg_mode:cust vendor_name:custom [2026-02-24 20:13:28] [Launch of Kernel FusedInferAttentionScore_8cd36e66e4ceb2d60ef96db29a147347_110000 on Device 0] [2026-02-24 20:13:30] result[0] is: 1.000000 [2026-02-24 20:13:30] result[1] is: 1.000000 ... [2026-02-24 20:13:30] result[31] is: 1.000000 [2026-02-24 20:13:30] run test_aclnn_fused_infer_attention_score, execute samples success [2026-02-24 20:13:30] Example completed successfully Process 2395539 stopped and restarted: thread 1 received signal: SIGCHLD Process 2395539 exited with status = 0 (0x00000000) (msdebug)
父主题: FAQ