已关闭
[Documentation|文档反馈]: [AI 识别] examples里面三个样例的关系是什么,如何测试 #1122
StoneChan_创建于  3月30日关闭于  4月15日
StoneChan_
StoneChan_成员
3月30日 创建

Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.

一、文档链接 (必填)

https://gitcode.com/cann/ops-math/blob/master/docs/zh/develop/aicore_develop_guide.md
https://gitcode.com/cann/ops-math/blob/master/docs/zh/develop/aicpu_develop_guide.md
https://gitcode.com/cann/ops-math/blob/master/examples/fast_kernel_launch_example/README.md

二、问题文档片段 (必填)

问题1:为什么3个样例的介绍文档不在一个位置,这三者的关系是什么
问题2:aicpu的指导中没有提及如何测试,以及是否能够测试,实际测试无法通过,且docs/zh/invocation/quick_op_invocation.md这里也只介绍了add_example的测试方式
文档片段:

算子验证

验证算子前需确保已配置了环境变量,命令如下:

export LD_LIBRARY_PATH=${ASCEND_HOME_PATH}/opp/vendors/${vendor_name}_math/op_api/lib:${LD_LIBRARY_PATH}
export ASCEND_CUSTOM_OPP_PATH=${ASCEND_HOME_PATH}/opp/vendors/${vendor_name}_math
  • UT验证

    算子开发过程中,可通过UT验证(如Kernel)方式进行快速验证,如需查看详细实现,请参考Kernel UT

  • aclnn调用验证

    开发好的算子完成编译部署后,可通过aclnn方式验证功能,方法请参考算子调用方式

问题:
没有介绍examples怎么执行,bash build.sh --run_example add_example_aicpu eager cust --vendor_name=custom可以执行通过
而UT的执行无法通过
执行:
bash build.sh -u --opkernel --ops=add_example_aicpu
结果:

[2026-03-30 15:21:46] Start to build ut
[2026-03-30 15:21:46] Built target math_op_kernel_ut

执行:
./build/tests/ut/op_kernel_aicpu/math_aicpu_op_kernel_ut
结果:

[==========] Running 0 tests from 0 test suites.
[==========] 0 tests from 0 test suites ran. (0 ms total)
[  PASSED  ] 0 tests.

add_example kernel ut执行失败
执行:
bash build.sh -u --opkernel --ops=add_example
结果:

[2026-03-30 16:08:49] Run fast op utest
[2026-03-30 16:08:49] [==========] Running 1 test from 1 test suite.
[2026-03-30 16:08:49] [----------] Global test environment set-up.
[2026-03-30 16:08:49] Global Environment SetpUp.
[2026-03-30 16:08:49] [INFO] GE(680685,math_op_kernel_ut_Ascend910B1):2026-03-30-16:08:49.733.731 [op_impl_space_registry_v2_impl.cc:75]680685 AddSoToRegistry:Start to AddSoToRegistry so_path:/mnt/workspace/gitCode/StoneChan_/ops-math/build/tests/ut/op_kernel/libmath_op_kernel_ut_tiling.so, package name math_op_kernel_ut_so
[2026-03-30 16:08:49] [WARNING] GE(680685,math_op_kernel_ut_Ascend910B1):2026-03-30-16:08:49.733.791 [file_utils.cc:46]680685 RealPath:[Util][realpath] Can not get real_path for [/mnt/workspace/gitCode/StoneChan_/ops-math/build/tests/ut/op_kernel/libmath_op_kernel_ut_tiling.so], reason:No such file or directory
[2026-03-30 16:08:49] [INFO] GE(680685,math_op_kernel_ut_Ascend910B1):2026-03-30-16:08:49.733.877 [error_manager.cc:346]680685 Init:Begin to init, path is /home/developer/tmp/Ascend/cann-9.0.0/aarch64-linux/lib64/
[2026-03-30 16:08:49] [INFO] GE(680685,math_op_kernel_ut_Ascend910B1):2026-03-30-16:08:49.761.669 [error_manager.cc:399]680685 ReportInterErrMessage:report error_message, error_code:E19999, work_stream_id:68069180685, error_mode:0
[2026-03-30 16:08:49] [ERROR] GE(680685,math_op_kernel_ut_Ascend910B1):2026-03-30-16:08:49.761.700 [file_utils.cc:155]680685 GetBinDataFromFile: ErrorNo: 4294967295(failed)Path: /mnt/workspace/gitCode/StoneChan_/ops-math/build/tests/ut/op_kernel/libmath_op_kernel_ut_tiling.so is invalid, file or directory does not exist
[2026-03-30 16:08:49] [INFO] GE(680685,math_op_kernel_ut_Ascend910B1):2026-03-30-16:08:49.761.719 [error_manager.cc:399]680685 ReportInterErrMessage:report error_message, error_code:E19999, work_stream_id:68069180685, error_mode:0
[2026-03-30 16:08:49] [ERROR] GE(680685,math_op_kernel_ut_Ascend910B1):2026-03-30-16:08:49.761.744 [op_impl_space_registry_v2_impl.cc:78]680685 AddSoToRegistry: ErrorNo: 4294967295(failed)Assert ((so_data) != nullptr) failed
[2026-03-30 16:08:49] [----------] 1 test from AddExampleTest
[2026-03-30 16:08:49] AddExampleTest SetUp
[2026-03-30 16:08:49] 
[2026-03-30 16:08:49] is_finite_test SetUp
[2026-03-30 16:08:49] [ RUN      ] AddExampleTest.test_case_0
[2026-03-30 16:08:50] The input numBlocks 64 exceed max core num of ascend910B1!
[2026-03-30 16:08:50] make[3]: *** [tests/ut/op_kernel/CMakeFiles/math_op_kernel_ut_Ascend910B1.dir/build.make:108: tests/ut/op_kernel/math_op_kernel_ut_Ascend910B1] Aborted
[2026-03-30 16:08:50] make[3]: *** Deleting file 'tests/ut/op_kernel/math_op_kernel_ut_Ascend910B1'
[2026-03-30 16:08:50] make[2]: *** [CMakeFiles/Makefile2:11888: tests/ut/op_kernel/CMakeFiles/math_op_kernel_ut_Ascend910B1.dir/all] Error 2
[2026-03-30 16:08:50] make[1]: *** [CMakeFiles/Makefile2:11921: tests/ut/op_kernel/CMakeFiles/math_op_kernel_ut.dir/rule] Error 2
[2026-03-30 16:08:50] make: *** [Makefile:391: math_op_kernel_ut] Error 2

💡 存在的问题(选填)

likedislike
StoneChan_StoneChan_成员
3月30日 修改了issue 的描述
StoneChan_StoneChan_成员
3月30日 修改了issue 的描述
StoneChan_StoneChan_成员
3月30日 修改了issue 的描述
StoneChan_StoneChan_成员
3月30日 修改了issue 的描述
StoneChan_StoneChan_成员
3月30日 修改了issue 的描述
sunday成员
3月30日 评论:

/assign @songkai111

likedislike
CANN-robotCANN-robot成员
3月30日 将 songkai111 设为负责人
liu-weiliu-wei成员
4月3日 将 Ding_Jing 设为负责人
StoneChan_StoneChan_成员
4月13日 修改标题为 “[Documentation|文档反馈]: [易用性分析] examples里面三个样例的关系是什么,如何测试”,原标题为“[Documentation|文档反馈]: examples里面三个样例的关系是什么,如何测试”
StoneChan_StoneChan_成员
4月13日 修改标题为 “[Documentation|文档反馈]: [AI 识别] examples里面三个样例的关系是什么,如何测试”,原标题为“[Documentation|文档反馈]: [易用性分析] examples里面三个样例的关系是什么,如何测试”
Ding_JingDing_Jing成员
4月15日 关联了pull request:add_example_aicpu修改
CANN-robotCANN-robot成员
4月15日 关闭了 issue
CANN-robotCANN-robot成员
4月15日 添加了label:resolved