本机环境: wsl ubuntu2004(Linux x86-64)。 未安装Ascend设备,拟采用文档(https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/82RC1alpha002/opdevg/Ascendcopdevg/atlas_ascendc_10_0002.htmlï¼ 中提到的CPU模拟验证方案执行。
安装CANN软件包版本:Ascend-cann-toolkit_8.0.0_linux-x86_64.run
运行官方样例\samples\operator\ascendc\tutorials\AddCustomSample\KernelLaunch\AddKernelInvocationTilingNeo(https://gitee.com/ascend/samplesï¼ 环境测试通过。
配置算子工程文件中:
执行认证的算子工程文件中build.sh出错,报错如下。
本机环境: wsl ubuntu2004(Linux x86-64)。 未安装Ascend设备,拟采用文档(https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/82RC1alpha002/opdevg/Ascendcopdevg/atlas_ascendc_10_0002.htmlï¼ 中提到的CPU模拟验证方案执行。
安装CANN软件包版本:Ascend-cann-toolkit_8.0.0_linux-x86_64.run
运行官方样例\samples\operator\ascendc\tutorials\AddCustomSample\KernelLaunch\AddKernelInvocationTilingNeo(https://gitee.com/ascend/samplesï¼ 环境测试通过。
配置算子工程文件中:
{ "version": 1, "cmakeMinimumRequired": { "major": 3, "minor": 19, "patch": 0 }, "configurePresets": [ { "name": "default", "displayName": "Default Config", "description": "Default build using Unix Makefiles generator", "generator": "Unix Makefiles", "binaryDir": "${sourceDir}/build_out", "cacheVariables": { "CMAKE_BUILD_TYPE": { "type": "STRING", "value": "Release" }, "ENABLE_SOURCE_PACKAGE": { "type": "BOOL", "value": "True" }, "ENABLE_BINARY_PACKAGE": { "type": "BOOL", "value": "True" }, "ASCEND_COMPUTE_UNIT": { "type": "STRING", "value": "ascend310b;ascend910b" }, "ENABLE_TEST": { "type": "BOOL", "value": "True" }, "vendor_name": { "type": "STRING", "value": "customize" }, "ASCEND_CANN_PACKAGE_PATH": { "type": "PATH", "value": "/ascend/ascend-toolkit/latest"#确定为实际安装路径 }, "ASCEND_PYTHON_EXECUTABLE": { "type": "STRING", "value": "python3" }, "CMAKE_INSTALL_PREFIX": { "type": "PATH", "value": "${sourceDir}/build_out" }, "ENABLE_CROSS_COMPILE": { "type": "BOOL", "value": "False" }, "CMAKE_CROSS_PLATFORM_COMPILER": { "type": "PATH", "value": "/usr/bin/aarch64-linux-gnu-g++" } } } ] }执行认证的算子工程文件中build.sh出错,报错如下。
root@Y9000P-ZHR:/work/SinhCustom/SinhCustom# ./build.sh Preset CMake variables: ASCEND_CANN_PACKAGE_PATH:PATH="/usr/local/Ascend/ascend-toolkit/latest" ASCEND_COMPUTE_UNIT:STRING="ascend310b" ASCEND_PYTHON_EXECUTABLE:STRING="python3" CMAKE_BUILD_TYPE:STRING="Release" CMAKE_CROSS_PLATFORM_COMPILER:PATH="/usr/bin/aarch64-linux-gnu-g++" CMAKE_INSTALL_PREFIX:PATH="/work/SinhCustom/SinhCustom/build_out" ENABLE_BINARY_PACKAGE:BOOL="True" ENABLE_CROSS_COMPILE:BOOL="False" ENABLE_SOURCE_PACKAGE:BOOL="True" ENABLE_TEST:BOOL="True" vendor_name:STRING="customize" -- The C compiler identification is GNU 9.4.0 -- The CXX compiler identification is GNU 9.4.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Opbuild generating sources -- Opbuild generating sources - done -- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project: CMAKE_CROSS_PLATFORM_COMPILER -- Build files have been written to: /work/SinhCustom/SinhCustom/build_out [ 23%] Generating tbe/op_info_cfg/ai_core/npu_supported_ops.json [ 23%] Generating scripts/install.sh, scripts/upgrade.sh [ 23%] Generating tbe/op_info_cfg/ai_core/ascend310b/aic-ascend310b-ops-info.json [ 30%] Generating tbe/.impl_timestamp [ 46%] Built target gen_version_info [ 46%] Building CXX object op_host/CMakeFiles/cust_optiling.dir/sinh_custom.cpp.o [ 46%] Building CXX object op_host/CMakeFiles/cust_opapi.dir/__/autogen/aclnn_sinh_custom.cpp.o /work/SinhCustom/SinhCustom/build_out/autogen /work/SinhCustom/SinhCustom/build_out/op_kernel/tbe/op_info_cfg/ai_core [ 53%] Building CXX object op_host/CMakeFiles/cust_op_proto.dir/sinh_custom.cpp.o [ 61%] Building CXX object op_host/CMakeFiles/cust_op_proto.dir/__/autogen/op_proto.cc.o ==============check valid for ops info start============== ==============check valid for ops info end================ [ 69%] Building CXX object framework/tf_plugin/CMakeFiles/cust_tf_parsers.dir/tensorflow_sinh_custom_plugin.cc.o Compile op info cfg successfully. [ 69%] Built target ops_info_gen_ascend310b [ 69%] Built target ascendc_impl_gen [ 69%] Built target modify_vendor [INFO] Succed generated /work/SinhCustom/SinhCustom/build_out/op_kernel/tbe/op_info_cfg/ai_core/npu_supported_ops.json /work/SinhCustom/SinhCustom/op_host/sinh_custom.cpp: In function ‘ge::graphStatus optiling::TilingFunc(gert::TilingContext*)’: /work/SinhCustom/SinhCustom/op_host/sinh_custom.cpp:11:1: warning: no return statement in function returning non-void [-Wreturn-type] 11 | } | ^ [ 76%] Built target npu_supported_ops /work/SinhCustom/SinhCustom/op_host/sinh_custom.cpp: In function ‘ge::graphStatus optiling::TilingFunc(gert::TilingContext*)’: /work/SinhCustom/SinhCustom/op_host/sinh_custom.cpp:11:1: warning: no return statement in function returning non-void [-Wreturn-type] 11 | } | ^ [ 76%] Linking CXX shared library libcust_opapi.so [ 84%] Linking CXX shared library libcust_tf_parsers.so [100%] Linking CXX shared library libcust_opmaster_rt2.0.so [100%] Linking CXX shared library libcust_opsproto_rt2.0.so [100%] Built target cust_opapi [100%] Built target cust_tf_parsers [100%] Built target cust_optiling [100%] Built target cust_op_proto [100%] Built target optiling_compat Run CPack packaging tool... CPack: Create package using External CPack: Install projects CPack: - Run preinstall target for: opp CPack: - Install project: opp [] CPack: Create package About to compress 320 KB of data... Adding files to archive named "custom_opp_ubuntu_x86_64.run"... ./help.info ./install.sh ./packages/vendors/customize/framework/tensorflow/libcust_tf_parsers.so ./packages/vendors/customize/framework/tensorflow/npu_supported_ops.json ./packages/vendors/customize/op_api/include/aclnn_sinh_custom.h ./packages/vendors/customize/op_api/lib/libcust_opapi.so ./packages/vendors/customize/op_impl/ai_core/tbe/config/ascend310b/aic-ascend310b-ops-info.json ./packages/vendors/customize/op_impl/ai_core/tbe/customize_impl/dynamic/sinh_custom.cpp ./packages/vendors/customize/op_impl/ai_core/tbe/customize_impl/dynamic/sinh_custom.py ./packages/vendors/customize/op_impl/ai_core/tbe/op_tiling/lib/linux/x86_64/libcust_opmaster_rt2.0.so ./packages/vendors/customize/op_impl/ai_core/tbe/op_tiling/liboptiling.so ./packages/vendors/customize/op_proto/inc/op_proto.h ./packages/vendors/customize/op_proto/lib/linux/x86_64/libcust_opsproto_rt2.0.so ./packages/vendors/customize/version.info ./upgrade.sh CRC: 2202730909 SHA256: b6b7c8b12b796866fc976b5e00c1cf240d707ff3762f9098f3e7a244dade22f0 Skipping md5sum at user request Self-extractable archive "custom_opp_ubuntu_x86_64.run" successfully created. Copy /work/SinhCustom/SinhCustom/build_out/_CPack_Packages/Linux/External/custom_opp_ubuntu_x86_64.run/custom_opp_ubuntu_x86_64.run to /work/SinhCustom/SinhCustom/build_out/ CPack: - package: /work/SinhCustom/SinhCustom/build_out/custom_opp_ubuntu_x86_64.run.json generated. CPack: - package: /work/SinhCustom/SinhCustom/build_out/custom_opp_ubuntu_x86_64.run generated. Verifying archive integrity... 100% SHA256 checksums are OK. All good. Uncompressing version:1.0 100% [runtime] [2025-07-01 11:24:26] [INFO] copy uninstall sh success [ops_custom]upgrade framework tensorflow [runtime] [2025-07-01 11:24:26] [INFO] replace or merge old ops framework files .g..... [runtime] [2025-07-01 11:24:26] copy new ops framework files ...... [ops_custom]upgrade op proto inc lib [runtime] [2025-07-01 11:24:26] [INFO] replace or merge old ops op_proto files .g..... [runtime] [2025-07-01 11:24:26] copy new ops op_proto files ...... [ops_custom]upgrade version.info [runtime] [2025-07-01 11:24:26] copy new version.info files ...... [ops_custom]upgrade op impl ai_core [runtime] [2025-07-01 11:24:26] [INFO] replace or merge old ops op_impl files .g..... [runtime] [2025-07-01 11:24:26] copy new ops op_impl files ...... [ops_custom]upgrade op api include lib [runtime] [2025-07-01 11:24:26] [INFO] replace or merge old ops op_api files .g..... [runtime] [2025-07-01 11:24:26] copy new ops op_api files ...... [runtime] [2025-07-01 11:24:26] [INFO] no need to upgrade custom.proto files SUCCESS [100%] Built target ascendc_impl_gen [100%] Built target ascendc_bin_ascend310b_sinh_custom_copy [100%] Built target ascendc_bin_ascend310b [Ascend310B1] Generating SinhCustom_00b2b0b8ab8f50db439d6cb44263785b ... Traceback (most recent call last): File "/usr/local/Ascend/ascend-toolkit/8.0.0/python/site-packages/opc_tool/opc.py", line 24, in <module> from tbe.common.utils import log as logger File "/usr/local/Ascend/ascend-toolkit/8.0.0/python/site-packages/tbe/__init__.py", line 98, in <module> from . import dsl File "/usr/local/Ascend/ascend-toolkit/8.0.0/python/site-packages/tbe/dsl/__init__.py", line 20, in <module> from .api import ceil File "/usr/local/Ascend/ascend-toolkit/8.0.0/python/site-packages/tbe/dsl/api.py", line 27, in <module> from .compute import cast File "/usr/local/Ascend/ascend-toolkit/8.0.0/python/site-packages/tbe/dsl/compute/__init__.py", line 21, in <module> from . import array File "/usr/local/Ascend/ascend-toolkit/8.0.0/python/site-packages/tbe/dsl/compute/array.py", line 27, in <module> from tbe.common.context import op_context File "/usr/local/Ascend/ascend-toolkit/8.0.0/python/site-packages/tbe/common/__init__.py", line 19, in <module> from . import register File "/usr/local/Ascend/ascend-toolkit/8.0.0/python/site-packages/tbe/common/register/__init__.py", line 45, in <module> from . import fusion_pass File "/usr/local/Ascend/ascend-toolkit/8.0.0/python/site-packages/tbe/common/register/fusion_pass/__init__.py", line 21, in <module> from tbe.common.register.fusion_pass import conv2d_data_rm_fusion_pass File "/usr/local/Ascend/ascend-toolkit/8.0.0/python/site-packages/tbe/common/register/fusion_pass/conv2d_data_rm_fusion_pass.py", line 542, in <module> def conv2d_data_rm_build_pass(op_list): File "/usr/local/Ascend/ascend-toolkit/8.0.0/python/site-packages/tbe/common/register/fusion_pass_mgr.py", line 58, in decorator import tbe.common.utils.log as logger File "/usr/local/Ascend/ascend-toolkit/8.0.0/python/site-packages/tbe/common/utils/__init__.py", line 113, in <module> from .op_tiling import do_op_tiling File "/usr/local/Ascend/ascend-toolkit/8.0.0/python/site-packages/tbe/common/utils/op_tiling.py", line 89, in <module> tiling_so_arch_path = os.path.join("ai_core", "tbe", "op_tiling", "lib", sys_version, platform_arch, "liboptiling.so") NameError: name 'sys_version' is not defined /work/SinhCustom/SinhCustom/build_out/op_kernel/binary/ascend310b/bin/sinh_custom/SinhCustom_00b2b0b8ab8f50db439d6cb44263785b.json not generated! make[3]: *** [op_kernel/CMakeFiles/ascendc_bin_ascend310b_sinh_custom_0.dir/build.make:70: op_kernel/CMakeFiles/ascendc_bin_ascend310b_sinh_custom_0] Error 1 make[2]: *** [CMakeFiles/Makefile2:507: op_kernel/CMakeFiles/ascendc_bin_ascend310b_sinh_custom_0.dir/all] Error 2 make[1]: *** [CMakeFiles/Makefile2:409: op_kernel/CMakeFiles/binary.dir/rule] Error 2 make: *** [Makefile:306: binary] Error 2 root@Y9000P-ZHR:/work/SinhCustom/SinhCustom#