已合并
Support the fusionpass es project #907
chenyifeng创建于 1月22日
Support the fusionpass es project #907
已合并
共 17 个文件变更+742-84
| @@ -127,12 +127,6 @@ if(ENABLE_TEST) | |||
| 127 | set(OP_API_MODULE_NAME ${PKG_NAME}_op_api_ut) | 127 | set(OP_API_MODULE_NAME ${PKG_NAME}_op_api_ut) |
| 128 | endif() | 128 | endif() |
| 129 | 129 | ||
| 130 | - # op graph ut | ||
| 131 | - if(UT_TEST_ALL OR OP_GRAPH_UT) | ||
| 132 | - include(cmake/opbuild.cmake) | ||
| 133 | - set(OP_GRAPH_MODULE_NAME ${PKG_NAME}_op_graph_ut) | ||
| 134 | - endif() | ||
| 135 | - | ||
| 136 | # op kernel ut | 130 | # op kernel ut |
| 137 | if(UT_TEST_ALL OR OP_KERNEL_UT) | 131 | if(UT_TEST_ALL OR OP_KERNEL_UT) |
| 138 | set(UT_DONE OFF) | 132 | set(UT_DONE OFF) |
| @@ -149,6 +143,12 @@ endif() | |||
| 149 | add_category_subdirectory() | 143 | add_category_subdirectory() |
| 150 | 144 | ||
| 151 | if(ENABLE_TEST) | 145 | if(ENABLE_TEST) |
| 146 | + if(UT_TEST_ALL OR OP_GRAPH_UT) | ||
| 147 | + include(cmake/opbuild.cmake) | ||
| 148 | + include(cmake/gen_ops_info.cmake) | ||
| 149 | + include(cmake/symbol.cmake) | ||
| 150 | + set(OP_GRAPH_MODULE_NAME ${PKG_NAME}_op_graph_ut) | ||
| 151 | + endif() | ||
| 152 | add_subdirectory(tests/ut) | 152 | add_subdirectory(tests/ut) |
| 153 | endif() | 153 | endif() |
| 154 | 154 | ||
| @@ -9,7 +9,7 @@ | |||
| 9 | # ============================================================================ | 9 | # ============================================================================ |
| 10 | 10 | ||
| 11 | set -e | 11 | set -e |
| 12 | -RELEASE_TARGETS=("ophost" "opapi" "onnxplugin") | 12 | +RELEASE_TARGETS=("ophost" "opapi" "onnxplugin" "opgraph") |
| 13 | 13 | ||
| 14 | SUPPORT_COMPUTE_UNIT_SHORT=("ascend031" "ascend035" "ascend310b" "ascend310p" "ascend910_93" "ascend910_95" "ascend910b" "ascend910" "kirinx90") | 14 | SUPPORT_COMPUTE_UNIT_SHORT=("ascend031" "ascend035" "ascend310b" "ascend310p" "ascend910_93" "ascend910_95" "ascend910b" "ascend910" "kirinx90") |
| 15 | TRIGER_UTS=() | 15 | TRIGER_UTS=() |
| @@ -21,7 +21,7 @@ SUPPORTED_SHORT_OPTS="hj:vO:uf:-:" | |||
| 21 | SUPPORTED_LONG_OPTS=( | 21 | SUPPORTED_LONG_OPTS=( |
| 22 | "help" "ops=" "soc=" "vendor_name=" "build-type=" "cov" "noexec" "opkernel" "opkernel_aicpu" "opkernel_aicpu_test" "static" | 22 | "help" "ops=" "soc=" "vendor_name=" "build-type=" "cov" "noexec" "opkernel" "opkernel_aicpu" "opkernel_aicpu_test" "static" |
| 23 | "jit" "pkg" "asan" "make_clean_all" "make_clean" "no_force" | 23 | "jit" "pkg" "asan" "make_clean_all" "make_clean" "no_force" |
| 24 | - "ophost" "opapi" "run_example" "example_name=" "genop=" "genop_aicpu=" "experimental" "cann_3rd_lib_path=" "oom" "onnxplugin" | 24 | + "ophost" "opgraph" "opapi" "run_example" "example_name=" "genop=" "genop_aicpu=" "experimental" "cann_3rd_lib_path=" "oom" "onnxplugin" |
| 25 | ) | 25 | ) |
| 26 | 26 | ||
| 27 | in_array() { | 27 | in_array() { |
| @@ -194,6 +194,7 @@ usage() { | |||
| 194 | echo " --noexec Only compile ut, do not execute" | 194 | echo " --noexec Only compile ut, do not execute" |
| 195 | echo " --asan Enable ASAN (Address Sanitizer) on the host side" | 195 | echo " --asan Enable ASAN (Address Sanitizer) on the host side" |
| 196 | echo " --ophost -u Same as ophost test" | 196 | echo " --ophost -u Same as ophost test" |
| 197 | + echo " --opgraph -u Same as opgraph test" | ||
| 197 | echo " --opapi -u Same as opapi test" | 198 | echo " --opapi -u Same as opapi test" |
| 198 | echo " --opkernel -u Same as opkernel test" | 199 | echo " --opkernel -u Same as opkernel test" |
| 199 | echo $dotted_line | 200 | echo $dotted_line |
| @@ -236,6 +237,19 @@ usage() { | |||
| 236 | echo " bash build.sh --onnxplugin --debug" | 237 | echo " bash build.sh --onnxplugin --debug" |
| 237 | return | 238 | return |
| 238 | ;; | 239 | ;; |
| 240 | + opgraph) | ||
| 241 | + echo "Opgraph Build Options:" | ||
| 242 | + echo $dotted_line | ||
| 243 | + echo " --opgraph Build opgraph library" | ||
| 244 | + echo " -j[n] Compile thread nums, default is 8" | ||
| 245 | + echo " -O[n] Compile optimization options, support [O0 O1 O2 O3]" | ||
| 246 | + echo " --debug Build with debug mode" | ||
| 247 | + echo $dotted_line | ||
| 248 | + echo "Examples:" | ||
| 249 | + echo " bash build.sh --opgraph -j16 -O3" | ||
| 250 | + echo " bash build.sh --opgraph --debug" | ||
| 251 | + return | ||
| 252 | + ;; | ||
| 239 | opapi) | 253 | opapi) |
| 240 | echo "Opapi Build Options:" | 254 | echo "Opapi Build Options:" |
| 241 | echo $dotted_line | 255 | echo $dotted_line |
| @@ -296,7 +310,7 @@ usage() { | |||
| 296 | echo " -j[n] Compile thread nums, default is 8" | 310 | echo " -j[n] Compile thread nums, default is 8" |
| 297 | echo " -v Cmake compile verbose" | 311 | echo " -v Cmake compile verbose" |
| 298 | echo " -O[n] Compile optimization options, support [O0 O1 O2 O3]" | 312 | echo " -O[n] Compile optimization options, support [O0 O1 O2 O3]" |
| 299 | - echo " -u Compile all ut, default run ophost opapi test" | 313 | + echo " -u Compile all ut, default run ophost opgraph opapi test" |
| 300 | echo $dotted_line | 314 | echo $dotted_line |
| 301 | echo " example, Build ophost test with O0 level compilation optimization and do not execute." | 315 | echo " example, Build ophost test with O0 level compilation optimization and do not execute." |
| 302 | echo " ./build.sh -u --ophost --noexec -O0 -j8" | 316 | echo " ./build.sh -u --ophost --noexec -O0 -j8" |
| @@ -314,6 +328,7 @@ usage() { | |||
| 314 | echo " --vendor_name Specify the custom operator pkg vendor name, like: --vendor_name=customize, default to customize-nn" | 328 | echo " --vendor_name Specify the custom operator pkg vendor name, like: --vendor_name=customize, default to customize-nn" |
| 315 | echo " --onnxplugin build op_nn_onnx_plugin.so" | 329 | echo " --onnxplugin build op_nn_onnx_plugin.so" |
| 316 | echo " --opapi build opapi_nn.so" | 330 | echo " --opapi build opapi_nn.so" |
| 331 | + echo " --opgraph build opgraph_nn.so" | ||
| 317 | echo " --ophost build ophost_nn.so" | 332 | echo " --ophost build ophost_nn.so" |
| 318 | echo " --opkernel build binary kernel" | 333 | echo " --opkernel build binary kernel" |
| 319 | echo " --opkernel_aicpu build aicpu kernel" | 334 | echo " --opkernel_aicpu build aicpu kernel" |
| @@ -341,7 +356,7 @@ check_help_combinations() { | |||
| 341 | for arg in "${args[@]}"; do | 356 | for arg in "${args[@]}"; do |
| 342 | case "$arg" in | 357 | case "$arg" in |
| 343 | -u) has_u=true ;; | 358 | -u) has_u=true ;; |
| 344 | - --ophost | --opapi | --onnxplugin) | 359 | + --ophost | --opapi | --onnxplugin | --opgraph) |
| 345 | has_test_command=true | 360 | has_test_command=true |
| 346 | has_build_command=true | 361 | has_build_command=true |
| 347 | ;; | 362 | ;; |
| @@ -354,17 +369,17 @@ check_help_combinations() { | |||
| 354 | 369 | ||
| 355 | # 检查help中的无效命令组合 | 370 | # 检查help中的无效命令组合 |
| 356 | if [[ "$has_pkg" == "true" && ("$has_test_command" == "true" || "$has_u" == "true") ]]; then | 371 | if [[ "$has_pkg" == "true" && ("$has_test_command" == "true" || "$has_u" == "true") ]]; then |
| 357 | - print_error "--pkg cannot be used with test(-u, etc.), --ophost, --opapi" | 372 | + print_error "--pkg cannot be used with test(-u, etc.), --ophost, --opapi, --opgraph" |
| 358 | return 1 | 373 | return 1 |
| 359 | fi | 374 | fi |
| 360 | 375 | ||
| 361 | if [[ "$has_opkernel" == "true" && ("$has_test_command" == "true" || "$has_u" == "true") ]]; then | 376 | if [[ "$has_opkernel" == "true" && ("$has_test_command" == "true" || "$has_u" == "true") ]]; then |
| 362 | - print_error "--opkernel cannot be used with test(-u, etc.), --ophost, --opapi" | 377 | + print_error "--opkernel cannot be used with test(-u, etc.), --ophost, --opapi, --opgraph" |
| 363 | return 1 | 378 | return 1 |
| 364 | fi | 379 | fi |
| 365 | 380 | ||
| 366 | if [[ "$has_opkernel_aicpu" == "true" && ("$has_test_command" == "true" || "$has_u" == "true") ]]; then | 381 | if [[ "$has_opkernel_aicpu" == "true" && ("$has_test_command" == "true" || "$has_u" == "true") ]]; then |
| 367 | - echo "[ERROR] --opkernel_aicpu cannot be used with test(-u, --ophost_test, etc.), --ophost, --opapi, or --opgraph" | 382 | + echo "[ERROR] --opkernel_aicpu cannot be used with test(-u, --ophost, etc.), --ophost, --opapi, or --opgraph" |
| 368 | return 1 | 383 | return 1 |
| 369 | fi | 384 | fi |
| 370 | 385 | ||
| @@ -372,21 +387,21 @@ check_help_combinations() { | |||
| 372 | } | 387 | } |
| 373 | 388 | ||
| 374 | check_param() { | 389 | check_param() { |
| 375 | - # --ops不能与--ophost,--opapi同时存在,如果带U则可以 | 390 | + # --ops不能与--ophost,--opapi, --opgraph同时存在,如果带U则可以 |
| 376 | - if [[ -n "$COMPILED_OPS" && "$ENABLE_TEST" == "FALSE" ]] && [[ "$OP_HOST" == "TRUE" || "$OP_API" == "TRUE" ]]; then | 391 | + if [[ -n "$COMPILED_OPS" && "$ENABLE_TEST" == "FALSE" ]] && [[ "$OP_HOST" == "TRUE" || "$OP_GRAPH" == "TRUE" || "$OP_API" == "TRUE" ]]; then |
| 377 | print_error "--ops cannot be used with --ophost, --opapi" | 392 | print_error "--ops cannot be used with --ophost, --opapi" |
| 378 | exit 1 | 393 | exit 1 |
| 379 | fi | 394 | fi |
| 380 | 395 | ||
| 381 | - # --pkg不能与-u(UT模式,包含_test的参数)或者--ophost,--opapi同时存在 | 396 | + # --pkg不能与-u(UT模式,包含_test的参数)或者--ophost,--opapi, --opgraph同时存在 |
| 382 | if [[ "$ENABLE_PACKAGE" == "TRUE" ]]; then | 397 | if [[ "$ENABLE_PACKAGE" == "TRUE" ]]; then |
| 383 | if [[ "$ENABLE_TEST" == "TRUE" ]]; then | 398 | if [[ "$ENABLE_TEST" == "TRUE" ]]; then |
| 384 | - print_error "--pkg cannot be used with test(-u, --ophost_test, etc.)" | 399 | + print_error "--pkg cannot be used with test(-u, --ophost, etc.)" |
| 385 | exit 1 | 400 | exit 1 |
| 386 | fi | 401 | fi |
| 387 | 402 | ||
| 388 | - if [[ "$OP_HOST" == "TRUE" || "$OP_API" == "TRUE" ]]; then | 403 | + if [[ "$OP_HOST" == "TRUE" || "$OP_GRAPH" == "TRUE" || "$OP_API" == "TRUE" ]]; then |
| 389 | - print_error "--pkg cannot be used with --ophost, --opapi" | 404 | + print_error "--pkg cannot be used with --ophost, --opapi, --opgraph" |
| 390 | exit 1 | 405 | exit 1 |
| 391 | fi | 406 | fi |
| 392 | fi | 407 | fi |
| @@ -447,7 +462,7 @@ set_create_libs() { | |||
| 447 | return | 462 | return |
| 448 | fi | 463 | fi |
| 449 | if [[ "$ENABLE_PACKAGE" == "TRUE" && "$ENABLE_CUSTOM" != "TRUE" ]]; then | 464 | if [[ "$ENABLE_PACKAGE" == "TRUE" && "$ENABLE_CUSTOM" != "TRUE" ]]; then |
| 450 | - BUILD_LIBS=("ophost_${REPOSITORY_NAME}" "opapi_${REPOSITORY_NAME}" "op_${REPOSITORY_NAME}_onnx_plugin") | 465 | + BUILD_LIBS=("ophost_${REPOSITORY_NAME}" "opapi_${REPOSITORY_NAME}" "op_${REPOSITORY_NAME}_onnx_plugin" "opgraph_${REPOSITORY_NAME}") |
| 451 | ENABLE_CREATE_LIB=TRUE | 466 | ENABLE_CREATE_LIB=TRUE |
| 452 | else | 467 | else |
| 453 | if [[ "$OP_HOST" == "TRUE" ]]; then | 468 | if [[ "$OP_HOST" == "TRUE" ]]; then |
| @@ -462,6 +477,10 @@ set_create_libs() { | |||
| 462 | BUILD_LIBS+=("op_${REPOSITORY_NAME}_onnx_plugin") | 477 | BUILD_LIBS+=("op_${REPOSITORY_NAME}_onnx_plugin") |
| 463 | ENABLE_CREATE_LIB=TRUE | 478 | ENABLE_CREATE_LIB=TRUE |
| 464 | fi | 479 | fi |
| 480 | + if [[ "$OP_GRAPH" == "TRUE" ]]; then | ||
| 481 | + BUILD_LIBS+=("opgraph_${REPOSITORY_NAME}") | ||
| 482 | + ENABLE_CREATE_LIB=TRUE | ||
| 483 | + fi | ||
| 465 | fi | 484 | fi |
| 466 | } | 485 | } |
| 467 | 486 | ||
| @@ -475,6 +494,10 @@ set_ut_mode() { | |||
| 475 | OP_HOST_UT=TRUE | 494 | OP_HOST_UT=TRUE |
| 476 | UT_TEST_ALL=FALSE | 495 | UT_TEST_ALL=FALSE |
| 477 | fi | 496 | fi |
| 497 | + if [[ "$OP_GRAPH" == "TRUE" ]]; then | ||
| 498 | + OP_GRAPH_UT=TRUE | ||
| 499 | + UT_TEST_ALL=FALSE | ||
| 500 | + fi | ||
| 478 | if [[ "$OP_API" == "TRUE" ]]; then | 501 | if [[ "$OP_API" == "TRUE" ]]; then |
| 479 | OP_API_UT=TRUE | 502 | OP_API_UT=TRUE |
| 480 | UT_TEST_ALL=FALSE | 503 | UT_TEST_ALL=FALSE |
| @@ -493,7 +516,7 @@ set_ut_mode() { | |||
| 493 | fi | 516 | fi |
| 494 | 517 | ||
| 495 | # 检查测试项,至少有一个 | 518 | # 检查测试项,至少有一个 |
| 496 | - if [[ "$UT_TEST_ALL" == "FALSE" && "$OP_HOST_UT" == "FALSE" && "$OP_API_UT" == "FALSE" && "$OP_KERNEL_UT" == "FALSE" && "$OP_KERNEL_AICPU_UT" == "FALSE" ]]; then | 519 | + if [[ "$UT_TEST_ALL" == "FALSE" && "$OP_HOST_UT" == "FALSE" && "$OP_GRAPH_UT" == "FALSE" && "$OP_API_UT" == "FALSE" && "$OP_KERNEL_UT" == "FALSE" && "$OP_KERNEL_AICPU_UT" == "FALSE" ]]; then |
| 497 | print_error "At least one test target must be specified (ophost test, opapi test, opgraph test, opkernel test, opkernel_aicpu_test)" | 520 | print_error "At least one test target must be specified (ophost test, opapi test, opgraph test, opkernel test, opkernel_aicpu_test)" |
| 498 | usage | 521 | usage |
| 499 | exit 1 | 522 | exit 1 |
| @@ -502,6 +525,9 @@ set_ut_mode() { | |||
| 502 | if [[ "$UT_TEST_ALL" == "TRUE" ]] || [[ "$OP_HOST_UT" == "TRUE" ]]; then | 525 | if [[ "$UT_TEST_ALL" == "TRUE" ]] || [[ "$OP_HOST_UT" == "TRUE" ]]; then |
| 503 | UT_TARGES+=("${REPOSITORY_NAME}_op_host_ut") | 526 | UT_TARGES+=("${REPOSITORY_NAME}_op_host_ut") |
| 504 | fi | 527 | fi |
| 528 | + if [[ "$UT_TEST_ALL" == "TRUE" ]] || [[ "$OP_GRAPH_UT" == "TRUE" ]]; then | ||
| 529 | + UT_TARGES+=("${REPOSITORY_NAME}_op_graph_ut") | ||
| 530 | + fi | ||
| 505 | if [[ "$UT_TEST_ALL" == "TRUE" ]] || [[ "$OP_API_UT" == "TRUE" ]]; then | 531 | if [[ "$UT_TEST_ALL" == "TRUE" ]] || [[ "$OP_API_UT" == "TRUE" ]]; then |
| 506 | UT_TARGES+=("${REPOSITORY_NAME}_op_api_ut") | 532 | UT_TARGES+=("${REPOSITORY_NAME}_op_api_ut") |
| 507 | fi | 533 | fi |
| @@ -575,6 +601,7 @@ checkopts() { | |||
| 575 | OP_KERNEL_AICPU_UT=FALSE | 601 | OP_KERNEL_AICPU_UT=FALSE |
| 576 | OP_API=FALSE | 602 | OP_API=FALSE |
| 577 | OP_HOST=FALSE | 603 | OP_HOST=FALSE |
| 604 | + OP_GRAPH=FALSE | ||
| 578 | OP_KERNEL=FALSE | 605 | OP_KERNEL=FALSE |
| 579 | OP_KERNEL_AICPU=FALSE | 606 | OP_KERNEL_AICPU=FALSE |
| 580 | ENABLE_CREATE_LIB=FALSE | 607 | ENABLE_CREATE_LIB=FALSE |
| @@ -623,6 +650,7 @@ checkopts() { | |||
| 623 | -u) SHOW_HELP="test" ;; | 650 | -u) SHOW_HELP="test" ;; |
| 624 | --make_clean_all | --make_clean) SHOW_HELP="clean" ;; | 651 | --make_clean_all | --make_clean) SHOW_HELP="clean" ;; |
| 625 | --ophost) SHOW_HELP="ophost" ;; | 652 | --ophost) SHOW_HELP="ophost" ;; |
| 653 | + --opgraph) SHOW_HELP="opgraph" ;; | ||
| 626 | --opapi) SHOW_HELP="opapi" ;; | 654 | --opapi) SHOW_HELP="opapi" ;; |
| 627 | --onnxplugin) SHOW_HELP="onnxplugin" ;; | 655 | --onnxplugin) SHOW_HELP="onnxplugin" ;; |
| 628 | --run_example) SHOW_HELP="run_example" ;; | 656 | --run_example) SHOW_HELP="run_example" ;; |
| @@ -762,6 +790,8 @@ checkopts() { | |||
| 762 | 790 | ||
| 763 | if [[ "$OPTARG" == "ophost" ]]; then | 791 | if [[ "$OPTARG" == "ophost" ]]; then |
| 764 | OP_HOST=TRUE | 792 | OP_HOST=TRUE |
| 793 | + elif [[ "$OPTARG" == "opgraph" ]]; then | ||
| 794 | + OP_GRAPH=TRUE | ||
| 765 | elif [[ "$OPTARG" == "opapi" ]]; then | 795 | elif [[ "$OPTARG" == "opapi" ]]; then |
| 766 | OP_API=TRUE | 796 | OP_API=TRUE |
| 767 | elif [[ "$OPTARG" == "opkernel" ]]; then | 797 | elif [[ "$OPTARG" == "opkernel" ]]; then |
| @@ -784,8 +814,9 @@ checkopts() { | |||
| 784 | esac | 814 | esac |
| 785 | done | 815 | done |
| 786 | 816 | ||
| 787 | - if [[ "$OP_KERNEL_AICPU_UT" != "TRUE" && "$ENABLE_TEST" == "TRUE" && "$OP_HOST" == "FALSE" && "$OP_API" == "FALSE" && "$OP_KERNEL" == "FALSE" ]]; then | 817 | + if [[ "$OP_KERNEL_AICPU_UT" != "TRUE" && "$ENABLE_TEST" == "TRUE" && "$OP_HOST" == "FALSE" && "$OP_GRAPH" == "FALSE" && "$OP_API" == "FALSE" && "$OP_KERNEL" == "FALSE" ]]; then |
| 788 | OP_HOST=TRUE | 818 | OP_HOST=TRUE |
| 819 | + OP_GRAPH=TRUE | ||
| 789 | OP_API=TRUE | 820 | OP_API=TRUE |
| 790 | OP_KERNEL=TRUE | 821 | OP_KERNEL=TRUE |
| 791 | fi | 822 | fi |
| @@ -860,6 +891,7 @@ assemble_cmake_args() { | |||
| 860 | CMAKE_ARGS="$CMAKE_ARGS -DNO_FORCE=${NO_FORCE}" | 891 | CMAKE_ARGS="$CMAKE_ARGS -DNO_FORCE=${NO_FORCE}" |
| 861 | CMAKE_ARGS="$CMAKE_ARGS -DBUILD_MODE=${BUILD_MODE}" | 892 | CMAKE_ARGS="$CMAKE_ARGS -DBUILD_MODE=${BUILD_MODE}" |
| 862 | CMAKE_ARGS="$CMAKE_ARGS -DOP_HOST_UT=${OP_HOST_UT}" | 893 | CMAKE_ARGS="$CMAKE_ARGS -DOP_HOST_UT=${OP_HOST_UT}" |
| 894 | + CMAKE_ARGS="$CMAKE_ARGS -DOP_GRAPH_UT=${OP_GRAPH_UT}" | ||
| 863 | CMAKE_ARGS="$CMAKE_ARGS -DOP_API_UT=${OP_API_UT}" | 895 | CMAKE_ARGS="$CMAKE_ARGS -DOP_API_UT=${OP_API_UT}" |
| 864 | CMAKE_ARGS="$CMAKE_ARGS -DOP_KERNEL_UT=${OP_KERNEL_UT}" | 896 | CMAKE_ARGS="$CMAKE_ARGS -DOP_KERNEL_UT=${OP_KERNEL_UT}" |
| 865 | CMAKE_ARGS="$CMAKE_ARGS -DOP_KERNEL_AICPU_UT=${OP_KERNEL_AICPU_UT}" | 897 | CMAKE_ARGS="$CMAKE_ARGS -DOP_KERNEL_AICPU_UT=${OP_KERNEL_AICPU_UT}" |
| @@ -1025,14 +1057,19 @@ build_binary() { | |||
| 1025 | 1057 | ||
| 1026 | build_pkg() { | 1058 | build_pkg() { |
| 1027 | echo "--------------- build pkg start ---------------" | 1059 | echo "--------------- build pkg start ---------------" |
| 1060 | + local all_targets=$(cmake --build . --target help) | ||
| 1028 | if [[ "$ENABLE_BINARY" == "FALSE" ]]; then # for jit need dynamic py | 1061 | if [[ "$ENABLE_BINARY" == "FALSE" ]]; then # for jit need dynamic py |
| 1029 | - local all_targets=$(cmake --build . --target help) | ||
| 1030 | if grep -wq "ascendc_impl_gen" <<< "${all_targets}"; then | 1062 | if grep -wq "ascendc_impl_gen" <<< "${all_targets}"; then |
| 1031 | cmake --build . --target ascendc_impl_gen -- ${VERBOSE} -j $THREAD_NUM | 1063 | cmake --build . --target ascendc_impl_gen -- ${VERBOSE} -j $THREAD_NUM |
| 1032 | if [ $? -ne 0 ]; then exit 1; fi | 1064 | if [ $? -ne 0 ]; then exit 1; fi |
| 1033 | fi | 1065 | fi |
| 1034 | fi | 1066 | fi |
| 1035 | cd "${BUILD_PATH}" && cmake ${CMAKE_ARGS} .. | 1067 | cd "${BUILD_PATH}" && cmake ${CMAKE_ARGS} .. |
| 1068 | + | ||
| 1069 | + if echo "${all_targets}" | grep -wq "build_es_nn"; then | ||
不打包这个就不编译了吗? ![]() ![]() | |||
| 1070 | + cmake --build . --target build_es_nn -- ${VERBOSE} -j $THREAD_NUM | ||
| 1071 | + [ $? -ne 0 ] && echo "[ERROR] target:build_es_nn compile failed!" && exit 1 | ||
| 1072 | + fi | ||
| 1036 | cmake --build . --target package -- ${VERBOSE} -j $THREAD_NUM | 1073 | cmake --build . --target package -- ${VERBOSE} -j $THREAD_NUM |
| 1037 | 1074 | ||
| 1038 | print_success "Build package success!" | 1075 | print_success "Build package success!" |
| @@ -60,6 +60,17 @@ message(STATUS "compile option:${CMAKE_CXX_FLAGS}") | |||
| 60 | if(BUILD_WITH_INSTALLED_DEPENDENCY_CANN_PKG) | 60 | if(BUILD_WITH_INSTALLED_DEPENDENCY_CANN_PKG) |
| 61 | if(EXISTS "${ASCEND_CANN_PACKAGE_PATH}/${SYSTEM_PREFIX}/tikcpp/ascendc_kernel_cmake") | 61 | if(EXISTS "${ASCEND_CANN_PACKAGE_PATH}/${SYSTEM_PREFIX}/tikcpp/ascendc_kernel_cmake") |
| 62 | find_package(ASC REQUIRED HINTS ${ASCEND_CANN_PACKAGE_PATH}/${SYSTEM_PREFIX}/tikcpp/ascendc_kernel_cmake) | 62 | find_package(ASC REQUIRED HINTS ${ASCEND_CANN_PACKAGE_PATH}/${SYSTEM_PREFIX}/tikcpp/ascendc_kernel_cmake) |
| 63 | + list(APPEND CMAKE_MODULE_PATH ${ASCEND_CANN_PACKAGE_PATH}/include/ge/cmake) | ||
| 64 | + find_package(GenerateEsPackage MODULE QUIET) | ||
| 65 | + if(NOT GenerateEsPackage_FOUND) | ||
| 66 | + message("") | ||
| 67 | + message("================================================================") | ||
| 68 | + message(" GenerateEsPackage package not found!") | ||
| 69 | + message("================================================================") | ||
| 70 | + message("Refer to the \"Operator Invocation\" chapter (environment preparation section) in the README and update the toolkit package to the latest version.") | ||
| 71 | + message("") | ||
| 72 | + message(FATAL_ERROR "Build terminated: Missing required dependency package GenerateEsPackage.") | ||
| 73 | + endif() | ||
| 63 | else() | 74 | else() |
| 64 | find_package(ASC REQUIRED HINTS ${ASCEND_CANN_PACKAGE_PATH}/compiler/tikcpp/ascendc_kernel_cmake) | 75 | find_package(ASC REQUIRED HINTS ${ASCEND_CANN_PACKAGE_PATH}/compiler/tikcpp/ascendc_kernel_cmake) |
| 65 | endif() | 76 | endif() |
| @@ -191,7 +191,15 @@ function(add_graph_plugin_modules) | |||
| 191 | else() | 191 | else() |
| 192 | add_library(${GRAPH_PLUGIN_NAME}_obj OBJECT) | 192 | add_library(${GRAPH_PLUGIN_NAME}_obj OBJECT) |
| 193 | endif() | 193 | endif() |
| 194 | - target_include_directories(${GRAPH_PLUGIN_NAME}_obj PRIVATE ${OP_PROTO_INCLUDE}) | 194 | + target_include_directories(${GRAPH_PLUGIN_NAME}_obj PRIVATE |
| 195 | + ${OP_PROTO_INCLUDE} | ||
| 196 | + ${PROJECT_SOURCE_DIR}/common/inc | ||
| 197 | + ${ASCEND_DIR}/include | ||
| 198 | + ${ASCEND_DIR}/include/external | ||
| 199 | + ${ASCEND_DIR}/include/exe_graph | ||
| 200 | + ${ASCEND_DIR}/include/base/context_builder | ||
| 201 | + ${ASCEND_DIR}/include/ge | ||
| 202 | + ) | ||
| 195 | target_compile_definitions(${GRAPH_PLUGIN_NAME}_obj PRIVATE OPS_UTILS_LOG_SUB_MOD_NAME="GRAPH_PLUGIN" LOG_CPP) | 203 | target_compile_definitions(${GRAPH_PLUGIN_NAME}_obj PRIVATE OPS_UTILS_LOG_SUB_MOD_NAME="GRAPH_PLUGIN" LOG_CPP) |
| 196 | if(BUILD_WITH_INSTALLED_DEPENDENCY_CANN_PKG) | 204 | if(BUILD_WITH_INSTALLED_DEPENDENCY_CANN_PKG) |
| 197 | target_compile_options( | 205 | target_compile_options( |
| @@ -203,13 +211,27 @@ function(add_graph_plugin_modules) | |||
| 203 | -fvisibility=hidden | 211 | -fvisibility=hidden |
| 204 | ) | 212 | ) |
| 205 | endif() | 213 | endif() |
| 206 | - target_link_libraries( | 214 | + if(BUILD_WITH_INSTALLED_DEPENDENCY_CANN_PKG) |
| 215 | + target_link_libraries( | ||
| 216 | + ${GRAPH_PLUGIN_NAME}_obj | ||
| 217 | + PRIVATE $<BUILD_INTERFACE:$<IF:$<BOOL:${ENABLE_TEST}>,intf_llt_pub_asan_cxx17,intf_pub_cxx17>> | ||
| 218 | + $<BUILD_INTERFACE:dlog_headers> | ||
| 219 | + $<$<TARGET_EXISTS:ops_base_util_objs>:$<TARGET_OBJECTS:ops_base_util_objs>> | ||
| 220 | + $<$<TARGET_EXISTS:ops_base_infer_objs>:$<TARGET_OBJECTS:ops_base_infer_objs>> | ||
| 221 | + metadef | ||
| 222 | + graph | ||
| 223 | + register | ||
| 224 | + ge_compiler | ||
| 225 | + ) | ||
| 226 | + else() | ||
| 227 | + target_link_libraries( | ||
| 207 | ${GRAPH_PLUGIN_NAME}_obj | 228 | ${GRAPH_PLUGIN_NAME}_obj |
| 208 | PRIVATE $<BUILD_INTERFACE:$<IF:$<BOOL:${ENABLE_TEST}>,intf_llt_pub_asan_cxx17,intf_pub_cxx17>> | 229 | PRIVATE $<BUILD_INTERFACE:$<IF:$<BOOL:${ENABLE_TEST}>,intf_llt_pub_asan_cxx17,intf_pub_cxx17>> |
| 209 | $<BUILD_INTERFACE:dlog_headers> | 230 | $<BUILD_INTERFACE:dlog_headers> |
| 210 | $<$<TARGET_EXISTS:ops_base_util_objs>:$<TARGET_OBJECTS:ops_base_util_objs>> | 231 | $<$<TARGET_EXISTS:ops_base_util_objs>:$<TARGET_OBJECTS:ops_base_util_objs>> |
| 211 | $<$<TARGET_EXISTS:ops_base_infer_objs>:$<TARGET_OBJECTS:ops_base_infer_objs>> | 232 | $<$<TARGET_EXISTS:ops_base_infer_objs>:$<TARGET_OBJECTS:ops_base_infer_objs>> |
| 212 | ) | 233 | ) |
| 234 | + endif() | ||
| 213 | endif() | 235 | endif() |
| 214 | endfunction() | 236 | endfunction() |
| 215 | 237 | ||
| @@ -496,17 +518,12 @@ macro(add_graph_plugin_sources) | |||
| 496 | # 获取算子层级目录名称,判断是否编译该算子 | 518 | # 获取算子层级目录名称,判断是否编译该算子 |
| 497 | get_filename_component(PARENT_DIR ${SOURCE_DIR} DIRECTORY) | 519 | get_filename_component(PARENT_DIR ${SOURCE_DIR} DIRECTORY) |
| 498 | get_filename_component(OP_NAME ${PARENT_DIR} NAME) | 520 | get_filename_component(OP_NAME ${PARENT_DIR} NAME) |
| 499 | - if(DEFINED ASCEND_OP_NAME | 521 | + |
| 500 | - AND NOT "${ASCEND_OP_NAME}" STREQUAL "" | 522 | + if(BUILD_WITH_INSTALLED_DEPENDENCY_CANN_PKG) |
| 501 | - AND NOT "${ASCEND_OP_NAME}" STREQUAL "all" | 523 | + file(GLOB GRAPH_PLUGIN_SRCS ${SOURCE_DIR}/*_graph*.cpp ${SOURCE_DIR}/fusion_pass/*_pass.cpp) |
| 502 | - AND NOT "${ASCEND_OP_NAME}" STREQUAL "ALL" | 524 | + else() |
| 503 | - ) | 525 | + file(GLOB GRAPH_PLUGIN_SRCS ${SOURCE_DIR}/*_graph*.cpp) |
| 504 | - if(NOT ${OP_NAME} IN_LIST ASCEND_OP_NAME) | 526 | + endif() |
| 505 | - return() | ||
| 506 | - endif() | ||
| 507 | - endif() | ||
| 508 | - | ||
| 509 | - file(GLOB GRAPH_PLUGIN_SRCS ${SOURCE_DIR}/*_graph*.cpp) | ||
| 510 | if(GRAPH_PLUGIN_SRCS) | 527 | if(GRAPH_PLUGIN_SRCS) |
| 511 | add_graph_plugin_modules() | 528 | add_graph_plugin_modules() |
| 512 | target_sources(${GRAPH_PLUGIN_NAME}_obj PRIVATE ${GRAPH_PLUGIN_SRCS}) | 529 | target_sources(${GRAPH_PLUGIN_NAME}_obj PRIVATE ${GRAPH_PLUGIN_SRCS}) |
| @@ -42,46 +42,135 @@ function(gen_ophost_symbol) | |||
| 42 | ) | 42 | ) |
| 43 | endfunction() | 43 | endfunction() |
| 44 | 44 | ||
| 45 | -# graph_plugin shared | 45 | +# gen es_nn |
| 46 | -function(gen_opgraph_symbol) | 46 | +function(gen_es_nn_lib_ready) |
| 47 | + # 合并proto.h生成ops_proto_nn.h和ops_proto_nn.cpp | ||
| 48 | + merge_graph_headers(TARGET merge_ops_proto_${PKG_NAME} OUT_DIR ${ASCEND_GRAPH_CONF_DST}) | ||
| 47 | add_library( | 49 | add_library( |
| 48 | - ${OPGRAPH_NAME} SHARED | 50 | + proto_${PKG_NAME} SHARED |
| 49 | - $<$<TARGET_EXISTS:${GRAPH_PLUGIN_NAME}_obj>:$<TARGET_OBJECTS:${GRAPH_PLUGIN_NAME}_obj>> | 51 | + ${ASCEND_GRAPH_CONF_DST}/ops_proto_nn.cpp |
| 50 | - ) | ||
| 51 | - merge_graph_headers(TARGET merge_ops_proto ALL OUT_DIR ${ASCEND_GRAPH_CONF_DST}) | ||
| 52 | - add_dependencies(${OPGRAPH_NAME} merge_ops_proto) | ||
| 53 | - | ||
| 54 | - target_sources( | ||
| 55 | - ${OPGRAPH_NAME} PRIVATE ${ASCEND_GRAPH_CONF_DST}/ops_proto_nn.cpp | ||
| 56 | ) | 52 | ) |
| 53 | + add_dependencies(proto_${PKG_NAME} merge_ops_proto_${PKG_NAME}) | ||
| 57 | target_link_libraries( | 54 | target_link_libraries( |
| 58 | - ${OPGRAPH_NAME} | 55 | + proto_${PKG_NAME} |
| 59 | PRIVATE $<BUILD_INTERFACE:intf_pub_cxx17> | 56 | PRIVATE $<BUILD_INTERFACE:intf_pub_cxx17> |
| 60 | - c_sec | 57 | + c_sec |
| 61 | - -Wl,--no-as-needed | 58 | + -Wl,--no-as-needed |
| 62 | - register | 59 | + register |
| 63 | - $<$<TARGET_EXISTS:opsbase>:opsbase> | 60 | + $<$<TARGET_EXISTS:opsbase>:opsbase> |
| 64 | - -Wl,--as-needed | 61 | + -Wl,--as-needed |
| 65 | - -Wl,--whole-archive | ||
| 66 | - rt2_registry_static | ||
| 67 | - -Wl,--no-whole-archive | ||
| 68 | - -Wl,-Bsymbolic | ||
| 69 | ) | 62 | ) |
| 70 | - | 63 | + target_link_directories(proto_${PKG_NAME} PRIVATE ${ASCEND_DIR}/${SYSTEM_PREFIX}/lib64) |
| 71 | - target_link_directories(${OPGRAPH_NAME} PRIVATE ${ASCEND_DIR}/${SYSTEM_PREFIX}/lib64) | 64 | + |
| 72 | - set_target_properties(${OPGRAPH_NAME} PROPERTIES | 65 | + # 生成 es_nn |
| 73 | - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/opp/built-in/op_proto | 66 | + add_es_library_and_whl( |
| 67 | + ES_LINKABLE_AND_ALL_TARGET es_${PKG_NAME} | ||
| 68 | + OPP_PROTO_TARGET proto_${PKG_NAME} | ||
| 69 | + OUTPUT_PATH ${CMAKE_BINARY_DIR}/es_packages | ||
| 74 | ) | 70 | ) |
| 75 | install( | 71 | install( |
| 76 | - TARGETS ${OPGRAPH_NAME} | 72 | + DIRECTORY ${CMAKE_BINARY_DIR}/es_packages |
| 77 | - LIBRARY DESTINATION ${OPGRAPH_LIB_INSTALL_DIR} | 73 | + DESTINATION ${VERSION_INFO_INSTALL_DIR} |
| 78 | - ) | 74 | + OPTIONAL |
| 75 | + ) | ||
| 76 | +endfunction() | ||
| 79 | 77 | ||
| 78 | +# gen es_nn for custom | ||
| 79 | +function(gen_es_nn_lib_ready_cust) | ||
| 80 | + # 合并proto.h生成ops_proto_nn.h和ops_proto_nn.cpp | ||
| 81 | + merge_graph_headers(TARGET merge_ops_proto_${PKG_NAME}_cust OUT_DIR ${ASCEND_GRAPH_CONF_DST}) | ||
| 82 | + add_library( | ||
| 83 | + proto_${PKG_NAME}_cust SHARED | ||
| 84 | + ${ASCEND_GRAPH_CONF_DST}/ops_proto_nn.cpp | ||
| 85 | + ) | ||
| 86 | + add_dependencies(proto_${PKG_NAME}_cust merge_ops_proto_${PKG_NAME}_cust) | ||
| 87 | + target_link_libraries( | ||
| 88 | + proto_${PKG_NAME}_cust | ||
| 89 | + PRIVATE $<BUILD_INTERFACE:intf_pub_cxx17> | ||
| 90 | + c_sec | ||
| 91 | + -Wl,--no-as-needed | ||
| 92 | + register | ||
| 93 | + $<$<TARGET_EXISTS:opsbase>:opsbase> | ||
| 94 | + -Wl,--as-needed | ||
| 95 | + ) | ||
| 96 | + target_link_directories(proto_${PKG_NAME}_cust PRIVATE ${ASCEND_DIR}/${SYSTEM_PREFIX}/lib64) | ||
| 97 | + | ||
| 98 | + # 生成 es_nn | ||
| 99 | + add_es_library( | ||
| 100 | + ES_LINKABLE_AND_ALL_TARGET es_${PKG_NAME} | ||
| 101 | + OPP_PROTO_TARGET proto_${PKG_NAME}_cust | ||
| 102 | + OUTPUT_PATH ${CMAKE_BINARY_DIR}/es_packages | ||
| 103 | + ) | ||
| 104 | + install( | ||
| 105 | + DIRECTORY ${CMAKE_BINARY_DIR}/es_packages/include/es_${PKG_NAME}/ | ||
| 106 | + DESTINATION ${ES_INC_INSTALL_DIR} | ||
| 107 | + OPTIONAL | ||
| 108 | + ) | ||
| 109 | + install( | ||
| 110 | + FILES ${CMAKE_BINARY_DIR}/es_packages/lib64/libes_${PKG_NAME}.so | ||
| 111 | + DESTINATION ${ES_LIB_INSTALL_DIR} | ||
| 112 | + OPTIONAL | ||
| 113 | + ) | ||
| 114 | +endfunction() | ||
| 115 | + | ||
| 116 | +# graph_plugin shared | ||
| 117 | +function(gen_opgraph_symbol) | ||
| 118 | + gen_es_nn_lib_ready() | ||
| 119 | + | ||
| 120 | + if(TARGET ${GRAPH_PLUGIN_NAME}_obj) | ||
| 121 | + unset(GRAPH_SOURCE) | ||
| 122 | + get_target_property(GRAPH_SOURCE ${GRAPH_PLUGIN_NAME}_obj SOURCES) | ||
| 123 | + if(GRAPH_SOURCE) | ||
| 124 | + add_dependencies(${GRAPH_PLUGIN_NAME}_obj | ||
| 125 | + build_es_math | ||
| 126 | + build_es_nn | ||
| 127 | + ) | ||
| 128 | + target_link_libraries(${GRAPH_PLUGIN_NAME}_obj | ||
| 129 | + PRIVATE | ||
| 130 | + es_math | ||
| 131 | + es_nn | ||
| 132 | + ) | ||
| 133 | + add_library( | ||
| 134 | + ${OPGRAPH_NAME} SHARED | ||
| 135 | + $<$<TARGET_EXISTS:${GRAPH_PLUGIN_NAME}_obj>:$<TARGET_OBJECTS:${GRAPH_PLUGIN_NAME}_obj>> | ||
| 136 | + ) | ||
| 137 | + | ||
| 138 | + target_link_libraries( | ||
| 139 | + ${OPGRAPH_NAME} | ||
| 140 | + PRIVATE $<BUILD_INTERFACE:intf_pub_cxx17> | ||
| 141 | + c_sec | ||
| 142 | + -Wl,--no-as-needed | ||
| 143 | + register | ||
| 144 | + $<$<TARGET_EXISTS:opsbase>:opsbase> | ||
| 145 | + -Wl,--as-needed | ||
| 146 | + -Wl,--whole-archive | ||
| 147 | + rt2_registry_static | ||
| 148 | + -Wl,--no-whole-archive | ||
| 149 | + -Wl,-Bsymbolic | ||
| 150 | + ge_compiler | ||
| 151 | + es_math | ||
| 152 | + es_nn | ||
| 153 | + ) | ||
| 154 | + | ||
| 155 | + target_link_directories(${OPGRAPH_NAME} PRIVATE | ||
| 156 | + ${ASCEND_DIR}/${SYSTEM_PREFIX}/lib64 | ||
| 157 | + ${CMAKE_BINARY_DIR}/es_packages/lib64 | ||
| 158 | + ) | ||
| 159 | + set_target_properties(${OPGRAPH_NAME} PROPERTIES | ||
| 160 | + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/opp/built-in/op_proto | ||
| 161 | + ) | ||
| 162 | + install( | ||
| 163 | + TARGETS ${OPGRAPH_NAME} | ||
| 164 | + LIBRARY DESTINATION ${OPGRAPH_LIB_INSTALL_DIR} | ||
| 165 | + ) | ||
| 166 | + endif() | ||
| 167 | + endif() | ||
| 80 | install( | 168 | install( |
| 81 | FILES ${ASCEND_GRAPH_CONF_DST}/ops_proto_nn.h | 169 | FILES ${ASCEND_GRAPH_CONF_DST}/ops_proto_nn.h |
| 82 | DESTINATION ${OPGRAPH_INC_INSTALL_DIR} | 170 | DESTINATION ${OPGRAPH_INC_INSTALL_DIR} |
| 83 | OPTIONAL | 171 | OPTIONAL |
| 84 | ) | 172 | ) |
| 173 | + | ||
| 85 | endfunction() | 174 | endfunction() |
| 86 | 175 | ||
| 87 | function(gen_opapi_symbol) | 176 | function(gen_opapi_symbol) |
| @@ -160,22 +249,56 @@ function(gen_cust_proto_symbol) | |||
| 160 | return() | 249 | return() |
| 161 | endif() | 250 | endif() |
| 162 | npu_op_library(cust_proto GRAPH) | 251 | npu_op_library(cust_proto GRAPH) |
| 252 | + | ||
| 253 | + set(NEED_LINK_ES OFF) | ||
| 254 | + if(TARGET ${GRAPH_PLUGIN_NAME}_obj) | ||
| 255 | + unset(GRAPH_SOURCE) | ||
| 256 | + get_target_property(GRAPH_SOURCE ${GRAPH_PLUGIN_NAME}_obj SOURCES) | ||
| 257 | + if(GRAPH_SOURCE) | ||
| 258 | + # 添加obj依赖es | ||
| 259 | + gen_es_nn_lib_ready_cust() | ||
| 260 | + add_dependencies(${GRAPH_PLUGIN_NAME}_obj | ||
| 261 | + build_es_math | ||
| 262 | + build_es_nn | ||
| 263 | + ) | ||
| 264 | + target_link_libraries(${GRAPH_PLUGIN_NAME}_obj | ||
| 265 | + PRIVATE | ||
| 266 | + es_math | ||
| 267 | + es_nn | ||
| 268 | + ) | ||
| 269 | + set(NEED_LINK_ES ON) | ||
| 270 | + endif() | ||
| 271 | + endif() | ||
| 272 | + | ||
| 163 | target_sources( | 273 | target_sources( |
| 164 | cust_proto | 274 | cust_proto |
| 165 | PUBLIC $<$<TARGET_EXISTS:${OPHOST_NAME}_infer_obj>:$<TARGET_OBJECTS:${OPHOST_NAME}_infer_obj>> | 275 | PUBLIC $<$<TARGET_EXISTS:${OPHOST_NAME}_infer_obj>:$<TARGET_OBJECTS:${OPHOST_NAME}_infer_obj>> |
| 166 | $<$<TARGET_EXISTS:${GRAPH_PLUGIN_NAME}_obj>:$<TARGET_OBJECTS:${GRAPH_PLUGIN_NAME}_obj>> | 276 | $<$<TARGET_EXISTS:${GRAPH_PLUGIN_NAME}_obj>:$<TARGET_OBJECTS:${GRAPH_PLUGIN_NAME}_obj>> |
| 167 | ) | 277 | ) |
| 168 | - merge_graph_headers(TARGET merge_ops_proto ALL OUT_DIR ${ASCEND_GRAPH_CONF_DST}) | 278 | + |
| 169 | - add_dependencies(cust_proto merge_ops_proto) | ||
| 170 | - | ||
| 171 | - target_sources( | ||
| 172 | - cust_proto PRIVATE ${ASCEND_GRAPH_CONF_DST}/ops_proto_nn.cpp | ||
| 173 | - ) | ||
| 174 | target_link_libraries( | 279 | target_link_libraries( |
| 175 | cust_proto | 280 | cust_proto |
| 176 | PUBLIC $<BUILD_INTERFACE:intf_pub_cxx17> | 281 | PUBLIC $<BUILD_INTERFACE:intf_pub_cxx17> |
| 177 | PRIVATE $<$<TARGET_EXISTS:opsbase>:opsbase> | 282 | PRIVATE $<$<TARGET_EXISTS:opsbase>:opsbase> |
| 283 | + ge_compiler | ||
| 178 | ) | 284 | ) |
| 285 | + | ||
| 286 | + if(NEED_LINK_ES) | ||
| 287 | + add_dependencies(cust_proto build_es_math build_es_nn) | ||
| 288 | + | ||
| 289 | + target_link_directories(cust_proto | ||
| 290 | + PRIVATE | ||
| 291 | + ${CMAKE_BINARY_DIR}/es_packages/lib64 | ||
| 292 | + ${ES_LIB_INSTALL_DIR} | ||
| 293 | + ) | ||
| 294 | + target_link_libraries(cust_proto | ||
| 295 | + PRIVATE | ||
| 296 | + -Wl,--no-as-needed | ||
| 297 | + es_math | ||
| 298 | + es_nn | ||
| 299 | + -Wl,--as-needed | ||
| 300 | + ) | ||
| 301 | + endif() | ||
| 179 | file(GLOB_RECURSE proto_headers ${ASCEND_AUTOGEN_PATH}/*_proto.h) | 302 | file(GLOB_RECURSE proto_headers ${ASCEND_AUTOGEN_PATH}/*_proto.h) |
| 180 | install( | 303 | install( |
| 181 | FILES ${proto_headers} | 304 | FILES ${proto_headers} |
| @@ -170,6 +170,61 @@ function(add_opkernel_ut_modules OP_KERNEL_MODULE_NAME) | |||
| 170 | endforeach() | 170 | endforeach() |
| 171 | endfunction() | 171 | endfunction() |
| 172 | 172 | ||
| 173 | +function(add_op_graph_ut_modules OP_GRAPH_MODULE_NAME) | ||
| 174 | + # set variables | ||
| 175 | + set(UT_COMMON_INC ${PROJECT_SOURCE_DIR}/tests/ut/common) | ||
| 176 | + | ||
| 177 | + if(TARGET ${GRAPH_PLUGIN_NAME}_obj) | ||
| 178 | + add_dependencies(${GRAPH_PLUGIN_NAME}_obj build_es_math build_es_nn) | ||
| 179 | + target_link_libraries(${GRAPH_PLUGIN_NAME}_obj PRIVATE es_math es_nn) | ||
| 180 | + endif() | ||
| 181 | + | ||
| 182 | + # add op graph ut test cases obj | ||
| 183 | + add_library(${OP_GRAPH_MODULE_NAME}_cases_obj OBJECT) | ||
| 184 | + | ||
| 185 | + target_include_directories(${OP_GRAPH_MODULE_NAME}_cases_obj PRIVATE | ||
| 186 | + ${UT_COMMON_INC} | ||
| 187 | + ${JSON_INCLUDE} | ||
| 188 | + ${GTEST_INCLUDE} | ||
| 189 | + ${OPBASE_INC_DIRS} | ||
| 190 | + ${PROJECT_SOURCE_DIR}/common/inc | ||
| 191 | + ${ASCEND_DIR}/include | ||
| 192 | + ${ASCEND_DIR}/include/external | ||
| 193 | + ${ASCEND_DIR}/include/exe_graph | ||
| 194 | + ${ASCEND_DIR}/include/base/context_builder | ||
| 195 | + ${ASCEND_DIR}/include/ge/ | ||
| 196 | + ${CMAKE_BINARY_DIR}/es_packages/include/es_math/ | ||
| 197 | + ${CMAKE_BINARY_DIR}/es_packages/include/es_nn/ | ||
| 198 | + ) | ||
| 199 | + target_link_libraries(${OP_GRAPH_MODULE_NAME}_cases_obj PRIVATE | ||
| 200 | + $<BUILD_INTERFACE:intf_llt_pub_asan_cxx17> | ||
| 201 | + $<BUILD_INTERFACE:dlog_headers> | ||
| 202 | + -Wl,--no-as-needed | ||
| 203 | + metadef | ||
| 204 | + graph | ||
| 205 | + gtest | ||
| 206 | + register | ||
| 207 | + ge_compiler | ||
| 208 | + ascendalog | ||
| 209 | + unified_dlog | ||
| 210 | + ) | ||
| 211 | + | ||
| 212 | + target_compile_options(${OP_GRAPH_MODULE_NAME}_cases_obj PRIVATE | ||
| 213 | + -fno-access-control | ||
| 214 | + ) | ||
| 215 | + | ||
| 216 | + # add infershape ut static lib | ||
| 217 | + add_library(${OP_GRAPH_MODULE_NAME}_static_lib STATIC) | ||
| 218 | + target_link_libraries(${OP_GRAPH_MODULE_NAME}_static_lib PRIVATE | ||
| 219 | + ${OP_GRAPH_MODULE_NAME}_cases_obj | ||
| 220 | + ${GRAPH_PLUGIN_NAME}_obj | ||
| 221 | + es_math | ||
| 222 | + es_nn | ||
| 223 | + ) | ||
| 224 | + add_dependencies(${OP_GRAPH_MODULE_NAME}_static_lib build_es_math build_es_nn) | ||
| 225 | + target_link_libraries(${OP_GRAPH_MODULE_NAME}_static_lib PRIVATE es_math es_nn) | ||
| 226 | +endfunction() | ||
| 227 | + | ||
| 173 | if(UT_TEST_ALL OR OP_KERNEL_AICPU_UT) | 228 | if(UT_TEST_ALL OR OP_KERNEL_AICPU_UT) |
| 174 | set(AICPU_OP_KERNEL_MODULE_NAME ${PKG_NAME}_aicpu_op_kernel_ut CACHE STRING "aicpu_op_kernel ut module name" FORCE) | 229 | set(AICPU_OP_KERNEL_MODULE_NAME ${PKG_NAME}_aicpu_op_kernel_ut CACHE STRING "aicpu_op_kernel ut module name" FORCE) |
| 175 | message("******************* AICPU_OP_KERNEL_MODULE_NAME is ${AICPU_OP_KERNEL_MODULE_NAME}" ) | 230 | message("******************* AICPU_OP_KERNEL_MODULE_NAME is ${AICPU_OP_KERNEL_MODULE_NAME}" ) |
| @@ -288,6 +343,16 @@ function(add_modules_ut_sources) | |||
| 288 | target_sources(${MODULE_HOSTNAME}_cases_obj ${MODULE_MODE} ${OPHOST_OPAPI_SRCS}) | 343 | target_sources(${MODULE_HOSTNAME}_cases_obj ${MODULE_MODE} ${OPHOST_OPAPI_SRCS}) |
| 289 | message(STATUS "=== Debug<add_modules_ut_sources>: ${MODULE_HOSTNAME}_cases_obj ${OPHOST_OPAPI_SRCS}") | 344 | message(STATUS "=== Debug<add_modules_ut_sources>: ${MODULE_HOSTNAME}_cases_obj ${OPHOST_OPAPI_SRCS}") |
| 290 | endif() | 345 | endif() |
| 346 | + | ||
| 347 | + string(FIND "${MODULE_HOSTNAME}_cases_obj" "op_graph" OPGRAPH_FOUND_INDEX) | ||
| 348 | + if(${OPGRAPH_FOUND_INDEX} GREATER_EQUAL 0) | ||
| 349 | + file(GLOB OPHOST_OPGRAPH_SRCS ${MODULE_DIR}/test_*_pass.cpp) | ||
| 350 | + if (NOT TARGET ${MODULE_HOSTNAME}_cases_obj) | ||
| 351 | + add_op_graph_ut_modules(${OP_GRAPH_MODULE_NAME}) | ||
| 352 | + endif() | ||
| 353 | + target_sources(${MODULE_HOSTNAME}_cases_obj ${MODULE_MODE} ${OPHOST_OPGRAPH_SRCS}) | ||
| 354 | + message(STATUS "=== Debug<add_modules_ut_sources>: ${MODULE_HOSTNAME}_cases_obj ${OPHOST_OPGRAPH_SRCS}") | ||
| 355 | + endif() | ||
| 291 | endfunction() | 356 | endfunction() |
| 292 | 357 | ||
| 293 | if (UT_TEST_ALL OR OP_KERNEL_UT) | 358 | if (UT_TEST_ALL OR OP_KERNEL_UT) |
| @@ -47,6 +47,8 @@ add_library(${OPHOST_NAME}_aclnn_exclude_headers INTERFACE) | |||
| 47 | # interface, 用于收集ops proto头文件 | 47 | # interface, 用于收集ops proto头文件 |
| 48 | add_library(${GRAPH_PLUGIN_NAME}_proto_headers INTERFACE) | 48 | add_library(${GRAPH_PLUGIN_NAME}_proto_headers INTERFACE) |
| 49 | 49 | ||
| 50 | +set(OP_GRAPH_MODULE_NAME ${PKG_NAME}_op_graph_ut) | ||
| 51 | + | ||
| 50 | # global variables | 52 | # global variables |
| 51 | set(COMPILED_OPS CACHE STRING "Compiled Ops" FORCE) | 53 | set(COMPILED_OPS CACHE STRING "Compiled Ops" FORCE) |
| 52 | set(COMPILED_OP_DIRS CACHE STRING "Compiled Ops Dirs" FORCE) | 54 | set(COMPILED_OP_DIRS CACHE STRING "Compiled Ops Dirs" FORCE) |
| @@ -84,6 +86,8 @@ if(ENABLE_CUSTOM) | |||
| 84 | set(AICPU_KERNEL_IMPL packages/vendors/${VENDOR_PACKAGE_NAME}/op_impl/cpu/aicpu_kernel/impl) | 86 | set(AICPU_KERNEL_IMPL packages/vendors/${VENDOR_PACKAGE_NAME}/op_impl/cpu/aicpu_kernel/impl) |
| 85 | set(AICPU_JSON_CONFIG packages/vendors/${VENDOR_PACKAGE_NAME}/op_impl/cpu/config) | 87 | set(AICPU_JSON_CONFIG packages/vendors/${VENDOR_PACKAGE_NAME}/op_impl/cpu/config) |
| 86 | set(CUST_AICPU_OP_PROTO packages/vendors/${VENDOR_PACKAGE_NAME}/op_proto) | 88 | set(CUST_AICPU_OP_PROTO packages/vendors/${VENDOR_PACKAGE_NAME}/op_proto) |
| 89 | + set(ES_INC_INSTALL_DIR packages/vendors/${VENDOR_PACKAGE_NAME}/op_proto/es/include) | ||
| 90 | + set(ES_LIB_INSTALL_DIR packages/vendors/${VENDOR_PACKAGE_NAME}/op_proto/es/lib/linux/${CMAKE_SYSTEM_PROCESSOR}) | ||
| 87 | set(VERSION_INFO_INSTALL_DIR packages/vendors/${VENDOR_PACKAGE_NAME}/) | 91 | set(VERSION_INFO_INSTALL_DIR packages/vendors/${VENDOR_PACKAGE_NAME}/) |
| 88 | set(PACK_CUSTOM_NAME "cann-ops-nn-${VENDOR_NAME}-linux.${ARCH}") | 92 | set(PACK_CUSTOM_NAME "cann-ops-nn-${VENDOR_NAME}-linux.${ARCH}") |
| 89 | else() | 93 | else() |
| @@ -0,0 +1,39 @@ | |||
| 1 | +# Copyright (c) 2026 Huawei Technologies Co., Ltd. | ||
| 2 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| 3 | +# CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 4 | +# Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 5 | +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 6 | +# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 7 | +# See LICENSE in the root of the software repository for the full text of the License. | ||
| 8 | +#/ | ||
| 9 | + | ||
| 10 | +set(CMAKE_LIBRARY_OUTPUT_DIRECTOR ${PROJECT_SOURCE_DIR}/build) | ||
| 11 | + | ||
| 12 | +file(GLOB_RECURSE OP_PROTO_FILES "*.cpp") | ||
| 13 | + | ||
| 14 | +add_library(proto_math SHARED ${OP_PROTO_FILES}) | ||
| 15 | + | ||
| 16 | +target_compile_definitions(proto_math PRIVATE | ||
| 17 | + _GLIBCXX_USE_CXX11_ABI=0 | ||
| 18 | + LOG_CPP | ||
| 19 | +) | ||
| 20 | + | ||
| 21 | +target_link_libraries( | ||
| 22 | + proto_math | ||
| 23 | + PRIVATE $<BUILD_INTERFACE:intf_pub_cxx17> | ||
| 24 | + c_sec | ||
| 25 | + -Wl,--no-as-needed | ||
| 26 | + register | ||
| 27 | + $<$<TARGET_EXISTS:opsbase>:opsbase> | ||
| 28 | + -Wl,--as-needed | ||
| 29 | + -Wl,--whole-archive | ||
| 30 | + rt2_registry_static | ||
| 31 | + -Wl,--no-whole-archive | ||
| 32 | + ) | ||
| 33 | + # 生成 es_math | ||
| 34 | + add_es_library_and_whl( | ||
| 35 | + ES_LINKABLE_AND_ALL_TARGET es_math | ||
| 36 | + OPP_PROTO_TARGET proto_math | ||
| 37 | + OUTPUT_PATH ${CMAKE_BINARY_DIR}/es_packages_math | ||
| 38 | + ) | ||
| 39 | + | ||
| @@ -0,0 +1,96 @@ | |||
| 1 | +/** | ||
| 2 | + * Copyright (c) 2026 Huawei Technologies Co., Ltd. | ||
| 3 | + * This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 5 | + * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | + * See LICENSE in the root of the software repository for the full text of the License. | ||
| 9 | + */ | ||
| 10 | +/*! | ||
| 11 | + * \file math_proto_stub.cpp | ||
| 12 | + * \brief | ||
| 13 | + */ | ||
| 14 | + | ||
| 15 | + | ||
| 16 | + | ||
| 17 | +namespace ge{ | ||
| 18 | +/** | ||
| 19 | +*@brief Returns x1 + x2 element-wise. Support broadcasting operations. | ||
| 20 | +*@par Inputs: | ||
| 21 | +*Two inputs, including: | ||
| 22 | +* @li x1: A ND Tensor. Must be one of the following types: bool, int8, int16, int32, int64, uint8, float64, | ||
| 23 | +* float16, bfloat16, float32, complex128, complex64, complex32, string. | ||
| 24 | +* @li x2: A ND Tensor. Must be one of the following types: bool, int8, int16, int32, int64, uint8, float64, | ||
| 25 | +* float16, bfloat16, float32, complex128, complex64, complex32, string. \n | ||
| 26 | + | ||
| 27 | +*@par Outputs: | ||
| 28 | +*y: A ND Tensor. Must be one of the following types: bool, int8, int16, int32, int64, uint8, float64, | ||
| 29 | +* float16, bfloat16, float32, complex128, complex64, complex32, string. | ||
| 30 | +*@par Third-party framework compatibility | ||
| 31 | +*Compatible with the TensorFlow operator Add. | ||
| 32 | +*/ | ||
| 33 | +REG_OP(Add) | ||
| 34 | + .INPUT(x1, TensorType({DT_BOOL, DT_FLOAT, DT_INT32, DT_INT64, DT_FLOAT16, DT_BF16, DT_INT16, | ||
| 35 | + DT_INT8, DT_UINT8, DT_DOUBLE, DT_COMPLEX128, | ||
| 36 | + DT_COMPLEX64, DT_STRING, DT_COMPLEX32})) | ||
| 37 | + .INPUT(x2, TensorType({DT_BOOL, DT_FLOAT, DT_INT32, DT_INT64, DT_FLOAT16, DT_BF16, DT_INT16, | ||
| 38 | + DT_INT8, DT_UINT8, DT_DOUBLE, DT_COMPLEX128, | ||
| 39 | + DT_COMPLEX64, DT_STRING, DT_COMPLEX32})) | ||
| 40 | + .OUTPUT(y, TensorType({DT_BOOL, DT_FLOAT, DT_INT32, DT_INT64, DT_FLOAT16, DT_BF16, DT_INT16, | ||
| 41 | + DT_INT8, DT_UINT8, DT_DOUBLE, DT_COMPLEX128, | ||
| 42 | + DT_COMPLEX64, DT_STRING, DT_COMPLEX32})) | ||
| 43 | + .OP_END_FACTORY_REG(Add) | ||
| 44 | + | ||
| 45 | +/** | ||
| 46 | +*@brief Cast a tensor form src data type to dst data type. | ||
| 47 | + | ||
| 48 | +*@par Inputs: | ||
| 49 | +*One input: | ||
| 50 | +* x:A ND or 5HD tensor. Support 1D~8D. Must be one of the following types: bool, float16, float, int8, int32, uint32, uint8, bfloat16, uint1, | ||
| 51 | + int64, uint64, int16, uint16, double, complex32, complex64, complex128, qint8, quint8, qint16, quint16, qint32, | ||
| 52 | + hifloat8, float8_e5m2, float8_e4m3fn, float4_e1m2, float4_e2m1. | ||
| 53 | + | ||
| 54 | +*@par Attributes: | ||
| 55 | +*dst_type: A required attribute of type int32, specifying the dst data type. | ||
| 56 | + | ||
| 57 | +*@par Outputs: | ||
| 58 | +*y:A ND Tensor with same shape as x, and data type is specified by dst_type. | ||
| 59 | + | ||
| 60 | +*@attention Constraints: | ||
| 61 | +* @li In the scenario where the data type is converted from float16 to int16: \n | ||
| 62 | +* If the input data contains inf, inf is converted into the maximum value of int16. \n | ||
| 63 | +* If the input data contains -inf, -inf is converted into the minimum value of int16. \n | ||
| 64 | +* @li In the scenarios where the data type is converted from INT32 to INT8: \n | ||
| 65 | +* It can only guarantee that the input data has no precision errors within the range of (-2048, 1920). | ||
| 66 | +* @li Atlas Inference Series Product in the scenarios where the data type is converted from FLOAT32 to INT8: \n | ||
| 67 | +* It can only guarantee that the input data has no precision errors within the range of (-2048, 1920). | ||
| 68 | +* @li Atlas Inference Series Product in the scenarios where the data type is converted from FLOAT32 to INT64 and from FLOAT32 to UINT8: \n | ||
| 69 | +* It can only guarantee that the input data has no precision errors within the range of (-2147483648, 2147483583). | ||
| 70 | +* @li Atlas Inference Series Product in the scenarios where the data type is converted from INT64 to FLOAT32: \n | ||
| 71 | +* It can only guarantee that the input data has no precision errors within the range of (-2147483648, 2147483647). | ||
| 72 | +*/ | ||
| 73 | +REG_OP(Cast) | ||
| 74 | + .INPUT(x, TensorType({DT_BOOL, DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT32, DT_UINT8, | ||
| 75 | + DT_INT64, DT_UINT64, DT_INT16, DT_UINT16, DT_DOUBLE, DT_COMPLEX64, | ||
| 76 | + DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT16, DT_QUINT16, DT_QINT32, DT_BF16, DT_UINT1, | ||
| 77 | + DT_COMPLEX32, DT_HIFLOAT8, DT_FLOAT8_E5M2, DT_FLOAT8_E4M3FN, | ||
| 78 | + DT_FLOAT4_E1M2, DT_FLOAT4_E2M1})) | ||
| 79 | + .OUTPUT(y, TensorType({DT_BOOL, DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT32, DT_UINT8, | ||
| 80 | + DT_INT64, DT_UINT64, DT_INT16, DT_UINT16, DT_DOUBLE, DT_COMPLEX64, | ||
| 81 | + DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT16, DT_QUINT16, DT_QINT32, | ||
| 82 | + DT_BF16, DT_COMPLEX32, DT_HIFLOAT8, DT_FLOAT8_E5M2, DT_FLOAT8_E4M3FN, | ||
| 83 | + DT_FLOAT4_E1M2, DT_FLOAT4_E2M1})) | ||
| 84 | + .REQUIRED_ATTR(dst_type, Int) | ||
| 85 | + .OP_END_FACTORY_REG(Cast) | ||
| 86 | + | ||
| 87 | +REG_OP(Fill) | ||
| 88 | + .INPUT(dims, TensorType::IndexNumberType()) | ||
| 89 | + .INPUT(value, "T") | ||
| 90 | + .OUTPUT(y, "T") | ||
| 91 | + .DATATYPE(T, TensorType({DT_FLOAT, DT_DOUBLE, DT_INT32, DT_UINT8, DT_INT16, | ||
| 92 | + DT_INT8, DT_COMPLEX64, DT_INT64, DT_BOOL, DT_QINT8, | ||
| 93 | + DT_QUINT8, DT_QINT32, DT_QINT16, DT_QUINT16, DT_UINT16, | ||
| 94 | + DT_COMPLEX128, DT_FLOAT16, DT_BF16, DT_UINT32, DT_UINT64, DT_STRING})) | ||
| 95 | + .OP_END_FACTORY_REG(Fill) | ||
| 96 | +} // namespace ge | ||
| @@ -4,4 +4,7 @@ sympy | |||
| 4 | scipy | 4 | scipy |
| 5 | attrs | 5 | attrs |
| 6 | psutil | 6 | psutil |
| 7 | -protobuf | 7 | +protobuf |
| 8 | +pyyaml | ||
| 9 | +setuptools | ||
| 10 | +wheel | ||
| @@ -69,6 +69,8 @@ | |||
| 69 | <path value="opp/built-in/op_impl/ai_core/tbe/op_host/lib" install_mod="550"/> | 69 | <path value="opp/built-in/op_impl/ai_core/tbe/op_host/lib" install_mod="550"/> |
| 70 | <path value="opp/built-in/op_impl/ai_core/tbe/op_host/lib/linux" install_mod="550"/> | 70 | <path value="opp/built-in/op_impl/ai_core/tbe/op_host/lib/linux" install_mod="550"/> |
| 71 | <path value="opp/built-in/op_impl/ai_core/tbe/op_host/lib/linux/$(ARCH)" install_mod="550"/> | 71 | <path value="opp/built-in/op_impl/ai_core/tbe/op_host/lib/linux/$(ARCH)" install_mod="550"/> |
| 72 | + <path value="$(TARGET_ENV)/include/es" install_mod="550"/> | ||
| 73 | + <path value="$(TARGET_ENV)/include/es/es_nn" install_mod="550"/> | ||
| 72 | </dir_info> | 74 | </dir_info> |
| 73 | <dir_info value="OpsNNAiCpuKernel" install_mod="755" install_type="all"> | 75 | <dir_info value="OpsNNAiCpuKernel" install_mod="755" install_type="all"> |
| 74 | <path value="opp/built-in/op_impl/aicpu" install_mod="550"/> | 76 | <path value="opp/built-in/op_impl/aicpu" install_mod="550"/> |
| @@ -24,6 +24,17 @@ | |||
| 24 | <file value="script" entity="true"/> | 24 | <file value="script" entity="true"/> |
| 25 | <file value="version.info"/> | 25 | <file value="version.info"/> |
| 26 | </file_info> | 26 | </file_info> |
| 27 | + <file_info value="ops_es_packages_lib" copy_type="delivery" src_path="" | ||
| 28 | + dst_path="ops_nn/es_packages/lib64" | ||
| 29 | + install_path="$(TARGET_ENV)/lib64" install_mod="555"> | ||
| 30 | + <file value="libes_nn.so" | ||
| 31 | + file_type="shared"/> | ||
| 32 | + </file_info> | ||
| 33 | + <file_info copy_type="source" src_path="" | ||
| 34 | + dst_path="ops_nn/es_packages/include" | ||
| 35 | + install_path="$(TARGET_ENV)/include/es" install_type="all"> | ||
| 36 | + <file value="es_nn" install_mod="555" entity="true"/> | ||
| 37 | + </file_info> | ||
| 27 | <!--block_info--> | 38 | <!--block_info--> |
| 28 | <block_info dependtree="false" dst_path="ops_nn" block_conf_path="ascend"> | 39 | <block_info dependtree="false" dst_path="ops_nn" block_conf_path="ascend"> |
| 29 | <block name="EngineeringCommon"/> | 40 | <block name="EngineeringCommon"/> |
| @@ -38,5 +49,7 @@ | |||
| 38 | <path value="share/info" install_mod="750"/> | 49 | <path value="share/info" install_mod="750"/> |
| 39 | <path value="share/info/ops_nn" install_mod="550"/> | 50 | <path value="share/info/ops_nn" install_mod="550"/> |
| 40 | <path value="share/info/ops_nn/script" install_mod="550"/> | 51 | <path value="share/info/ops_nn/script" install_mod="550"/> |
| 52 | + <path value="python" install_mode="750"/> | ||
| 53 | + <path value="python/site-packages" install_mode="750"/> | ||
| 41 | </dir_info> | 54 | </dir_info> |
| 42 | </config> | 55 | </config> |
| @@ -20,6 +20,7 @@ if [ "$(id -u)" != "0" ]; then | |||
| 20 | fi | 20 | fi |
| 21 | 21 | ||
| 22 | # run package's files info | 22 | # run package's files info |
| 23 | +SOURCEDIR="$PWD/ops_nn" | ||
| 23 | _CURR_PATH=$(dirname $(readlink -f $0)) | 24 | _CURR_PATH=$(dirname $(readlink -f $0)) |
| 24 | _VERSION_INFO_FILE="${_CURR_PATH}""/../version.info" | 25 | _VERSION_INFO_FILE="${_CURR_PATH}""/../version.info" |
| 25 | _FILELIST_FILE="${_CURR_PATH}""/filelist.csv" | 26 | _FILELIST_FILE="${_CURR_PATH}""/filelist.csv" |
| @@ -259,6 +260,38 @@ getinstallpath() { | |||
| 259 | return | 260 | return |
| 260 | } | 261 | } |
| 261 | 262 | ||
| 263 | +install_whl_package() { | ||
| 264 | + local _package_path="$1" | ||
| 265 | + local _package_name="$2" | ||
| 266 | + local _pythonlocalpath="$3" | ||
| 267 | + logandprint "[INFO]: start install python module package ${_package_name}." | ||
| 268 | + if [ -f "$_package_path" ]; then | ||
| 269 | + pip3 install --disable-pip-version-check --upgrade --no-deps --force-reinstall "${_package_path}" -t "${_pythonlocalpath}" 1> /dev/null | ||
| 270 | + local ret=$? | ||
| 271 | + if [ $ret -ne 0 ]; then | ||
| 272 | + logandprint "[WARNING]: install ${_package_name} failed, error code: $ret." | ||
| 273 | + exit 1 | ||
| 274 | + else | ||
| 275 | + logandprint "[INFO]: ${_package_name} installed successfully!" | ||
| 276 | + fi | ||
| 277 | + chmod -R "${_BUILTIN_PERM}" "${_pythonlocalpath}"/es_nn 2> /dev/null | ||
| 278 | + chmod -R "${_BUILTIN_PERM}" "${_pythonlocalpath}"/es_nn-*.dist-info 2> /dev/null | ||
| 279 | + else | ||
| 280 | + logandprint "[ERROR]: ERR_NO:0x0080;ERR_DES:install ${_package_name} failed, can not find the matched package for this platform." | ||
| 281 | + exit 1 | ||
| 282 | + fi | ||
| 283 | +} | ||
| 284 | + | ||
| 285 | +install_es_whl() | ||
| 286 | +{ | ||
| 287 | + local es_whl_path="${SOURCEDIR}/es_packages/whl/es_nn-1.0.0-py3-none-any.whl" | ||
| 288 | + local python_es_whl_name="es_nn" | ||
| 289 | + local whl_install_dir_path="${TARGET_VERSION_DIR}/python/site-packages" | ||
| 290 | + chmod u+w "${whl_install_dir_path}" 2> /dev/null | ||
| 291 | + install_whl_package "${es_whl_path}" "${python_es_whl_name}" "${whl_install_dir_path}" | ||
| 292 | + chmod u-w "${whl_install_dir_path}" 2> /dev/null | ||
| 293 | +} | ||
| 294 | + | ||
| 262 | # init installation parameters | 295 | # init installation parameters |
| 263 | _TARGET_INSTALL_PATH="$1" | 296 | _TARGET_INSTALL_PATH="$1" |
| 264 | _TARGET_USERNAME="$2" | 297 | _TARGET_USERNAME="$2" |
| @@ -308,6 +341,15 @@ fi | |||
| 308 | getinstallpath | 341 | getinstallpath |
| 309 | relative_path_val=${relative_path} | 342 | relative_path_val=${relative_path} |
| 310 | 343 | ||
| 344 | +# Get target version | ||
| 345 | +TARGET_VERSION_DIR="" # _TARGET_INSTALL_PATH + PKG_VERSION_DIR | ||
| 346 | +get_version_dir "PKG_VERSION_DIR" "$_VERSION_INFO_FILE" | ||
| 347 | +if [ "${PKG_VERSION_DIR}" = "" ]; then | ||
| 348 | + TARGET_VERSION_DIR=${_TARGET_INSTALL_PATH} | ||
| 349 | +else | ||
| 350 | + TARGET_VERSION_DIR=${_TARGET_INSTALL_PATH}/${PKG_VERSION_DIR} | ||
| 351 | +fi | ||
| 352 | + | ||
| 311 | #Last Installed Version | 353 | #Last Installed Version |
| 312 | install_lower_dir=$(ls "${_TARGET_INSTALL_PATH}" 2> /dev/null) | 354 | install_lower_dir=$(ls "${_TARGET_INSTALL_PATH}" 2> /dev/null) |
| 313 | last_version_data=$(echo $install_lower_dir | awk -F ' ' '{print $1}') | 355 | last_version_data=$(echo $install_lower_dir | awk -F ' ' '{print $1}') |
| @@ -425,6 +467,8 @@ sh "${_COMMON_PARSER_FILE}" --package="${ops_nn_platform_dir}" --install --usern | |||
| 425 | --use-share-info --version=$pkg_version --version-dir=$pkg_version_dir $install_option ${in_install_for_all} ${in_feature_1} ${chip_type_1} "${install_type}" "${_TARGET_INSTALL_PATH}" "${_FILELIST_FILE}" | 467 | --use-share-info --version=$pkg_version --version-dir=$pkg_version_dir $install_option ${in_install_for_all} ${in_feature_1} ${chip_type_1} "${install_type}" "${_TARGET_INSTALL_PATH}" "${_FILELIST_FILE}" |
| 426 | logwitherrorlevel "$?" "error" "[ERROR]: ERR_NO:${INSTALL_FAILED};ERR_DES:Install ops_nn module files failed." | 468 | logwitherrorlevel "$?" "error" "[ERROR]: ERR_NO:${INSTALL_FAILED};ERR_DES:Install ops_nn module files failed." |
| 427 | 469 | ||
| 470 | +install_es_whl | ||
| 471 | + | ||
| 428 | #chmod to support copy | 472 | #chmod to support copy |
| 429 | if [ -d "${version_install_dir}/${ops_nn_platform_dir}/vendors" ] && [ "$(id -u)" != "0" ]; then | 473 | if [ -d "${version_install_dir}/${ops_nn_platform_dir}/vendors" ] && [ "$(id -u)" != "0" ]; then |
| 430 | chmod -R "${_CUSTOM_PERM}" ${version_install_dir}/${ops_nn_platform_dir}/vendors | 474 | chmod -R "${_CUSTOM_PERM}" ${version_install_dir}/${ops_nn_platform_dir}/vendors |
| @@ -109,6 +109,46 @@ unsetenv() { | |||
| 109 | fi | 109 | fi |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | +whl_uninstall_package() { | ||
| 113 | + local _module="$1" | ||
| 114 | + local _module_apth="$2" | ||
| 115 | + if [ ! -d "${_module_apth}/${_module}" ]; then | ||
| 116 | + pip3 show "${_module}" > /dev/null 2>&1 | ||
| 117 | + if [ $? -ne 0 ]; then | ||
| 118 | + logandprint "[WARNING]: ${_module} is not exist." | ||
| 119 | + else | ||
| 120 | + pip3 uninstall -y "${_module}" 1> /dev/null | ||
| 121 | + local ret=$? | ||
| 122 | + if [ $ret -ne 0 ]; then | ||
| 123 | + logandprint "[WARNING]: uninstall ${_module} failed, error code: $ret." | ||
| 124 | + exit 1 | ||
| 125 | + else | ||
| 126 | + logandprint "[INFO]: ${_module} uninstalled successfully!" | ||
| 127 | + fi | ||
| 128 | + fi | ||
| 129 | + else | ||
| 130 | + export PYTHONPATH="${_module_apth}" | ||
| 131 | + pip3 uninstall -y "${_module}" > /dev/null 2>&1 | ||
| 132 | + local ret=$? | ||
| 133 | + if [ $ret -ne 0 ]; then | ||
| 134 | + logandprint "[WARNING]: uninstall ${_module} failed, error code: $ret." | ||
| 135 | + exit 1 | ||
| 136 | + else | ||
| 137 | + logandprint "[INFO]: ${_module} uninstalled successfully!" | ||
| 138 | + fi | ||
| 139 | + fi | ||
| 140 | +} | ||
| 141 | + | ||
| 142 | +uninstall_es_whl() { | ||
| 143 | + local python_es_whl_name="es_nn" | ||
| 144 | + local whl_install_dir_path="${_TARGET_INSTALL_PATH}/python/site-packages" | ||
| 145 | + chmod u+w "${whl_install_dir_path}" 2> /dev/null | ||
| 146 | + chmod u+w -R "${whl_install_dir_path}"/es_nn 2> /dev/null | ||
| 147 | + chmod u+w -R "${whl_install_dir_path}"/es_nn-*.dist-info 2> /dev/null | ||
| 148 | + whl_uninstall_package "${python_es_whl_name}" "${whl_install_dir_path}" | ||
| 149 | + chmod u-w "${whl_install_dir_path}" 2> /dev/null | ||
| 150 | +} | ||
| 151 | + | ||
| 112 | installed_path="$1" | 152 | installed_path="$1" |
| 113 | uninstall_mode="$2" | 153 | uninstall_mode="$2" |
| 114 | is_quiet="$3" | 154 | is_quiet="$3" |
| @@ -243,6 +283,8 @@ get_version "pkg_version" "$_VERSION_INFO_FILE" | |||
| 243 | # delete ops_nn source files | 283 | # delete ops_nn source files |
| 244 | unsetenv | 284 | unsetenv |
| 245 | 285 | ||
| 286 | +uninstall_es_whl | ||
| 287 | + | ||
| 246 | is_multi_version_pkg "pkg_is_multi_version" "$_VERSION_INFO_FILE " | 288 | is_multi_version_pkg "pkg_is_multi_version" "$_VERSION_INFO_FILE " |
| 247 | 289 | ||
| 248 | if [ "${pkg_version_dir}" = "" ]; then | 290 | if [ "${pkg_version_dir}" = "" ]; then |
| @@ -20,21 +20,23 @@ def match_op_proto(file_path): | |||
| 20 | with open(file_path, 'r', encoding='utf-8') as file: | 20 | with open(file_path, 'r', encoding='utf-8') as file: |
| 21 | lines = file.readlines() | 21 | lines = file.readlines() |
| 22 | 22 | ||
| 23 | - start_line = None | 23 | + start_idx = None |
| 24 | - end_line = None | 24 | + end_idx = None |
| 25 | - | ||
| 26 | for i, line in enumerate(lines): | 25 | for i, line in enumerate(lines): |
| 27 | - if "{" in line: | 26 | + if "{" in line and start_idx is None: |
| 28 | - start_line = i+1 | 27 | + start_idx = i + 1 |
| 29 | break | 28 | break |
| 30 | - if start_line is not None: | ||
| 31 | - for i, line in enumerate(lines[start_line:], start=start_line): | ||
| 32 | - if "}" in line: | ||
| 33 | - end_line = i | ||
| 34 | - | ||
| 35 | - if start_line is not None and end_line is not None: | ||
| 36 | - return ''.join(lines[start_line:end_line]) | ||
| 37 | 29 | ||
| 30 | + if start_idx is not None: | ||
| 31 | + for i, line in enumerate(lines[start_idx:], start=start_idx): | ||
| 32 | + if re.search(r"OP_END_FACTORY_REG\(.*?\)", line): | ||
| 33 | + end_idx = i + 1 | ||
| 34 | + break | ||
| 35 | + | ||
| 36 | + if start_idx is not None and end_idx is not None: | ||
| 37 | + extracted = ''.join(lines[start_idx:end_idx]) | ||
| 38 | + return extracted.strip() + os.linesep | ||
| 39 | + | ||
| 38 | return "" | 40 | return "" |
| 39 | 41 | ||
| 40 | def merge_op_proto(protos_path, output_file): | 42 | def merge_op_proto(protos_path, output_file): |
| @@ -56,7 +58,7 @@ def merge_op_proto(protos_path, output_file): | |||
| 56 | 58 | ||
| 57 | namespace ge{{ | 59 | namespace ge{{ |
| 58 | 60 | ||
| 59 | -{os.linesep.join([f'{op_def}{os.linesep}' for op_def in op_defs])} | 61 | +{os.linesep.join(op_defs)} |
| 60 | }} // namespace ge | 62 | }} // namespace ge |
| 61 | 63 | ||
| 62 | #endif // OP_NN_PROTO_H_ | 64 | #endif // OP_NN_PROTO_H_ |
| @@ -78,6 +80,6 @@ def parse_args(argv): | |||
| 78 | if __name__ == "__main__": | 80 | if __name__ == "__main__": |
| 79 | args = parse_args(sys.argv) | 81 | args = parse_args(sys.argv) |
| 80 | 82 | ||
| 81 | - protos_path = args.protos[1:] | 83 | + protos_path = args.protos |
| 82 | output_file = args.output_file[0] | 84 | output_file = args.output_file[0] |
| 83 | merge_op_proto(protos_path, output_file) | 85 | merge_op_proto(protos_path, output_file) |
| @@ -0,0 +1,98 @@ | |||
| 1 | +# Copyright (c) 2026 Huawei Technologies Co., Ltd. | ||
| 2 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| 3 | +# CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 4 | +# Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 5 | +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 6 | +# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 7 | +# See LICENSE in the root of the software repository for the full text of the License. | ||
| 8 | +#/ | ||
| 9 | + | ||
| 10 | +cmake_minimum_required(VERSION 3.16) | ||
| 11 | + | ||
| 12 | +if(UT_TEST_ALL OR OP_GRAPH_UT) | ||
| 13 | + gen_es_nn_lib_ready() | ||
| 14 | + if(TARGET ${OP_GRAPH_MODULE_NAME}_cases_obj) | ||
| 15 | + add_dependencies(${OP_GRAPH_MODULE_NAME}_cases_obj json build_es_math build_es_nn) | ||
| 16 | + target_link_libraries(${OP_GRAPH_MODULE_NAME}_cases_obj PRIVATE es_math es_nn) | ||
| 17 | + endif() | ||
| 18 | + | ||
| 19 | + file(GLOB SUBDIRECTORIES LIST_DIRECTORIES true RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*) | ||
| 20 | + foreach(SUBDIR ${SUBDIRECTORIES}) | ||
| 21 | + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt) | ||
| 22 | + add_subdirectory(${SUBDIR}) | ||
| 23 | + endif() | ||
| 24 | + endforeach() | ||
| 25 | + | ||
| 26 | + ## add opgraph ut exe: nn_op_graph_ut | ||
| 27 | + set(OP_GRAPH_UT_EXE ${PKG_NAME}_op_graph_ut) | ||
| 28 | + | ||
| 29 | + add_executable(${OP_GRAPH_UT_EXE} | ||
| 30 | + test_op_graph_main.cpp | ||
| 31 | + ) | ||
| 32 | + | ||
| 33 | + # 当前桩函数实现不完整,优先从环境变量中链接so | ||
| 34 | + set_target_properties(${OP_GRAPH_UT_EXE} PROPERTIES | ||
| 35 | + SKIP_BUILD_RPATH TRUE | ||
| 36 | + ) | ||
| 37 | + | ||
| 38 | + target_compile_definitions(${OP_GRAPH_UT_EXE} PRIVATE LOG_CPP) | ||
| 39 | + target_compile_options(${OP_GRAPH_UT_EXE} PUBLIC -fPIE -fno-access-control) | ||
| 40 | + add_dependencies(${OP_GRAPH_UT_EXE} json build_es_math build_es_nn) | ||
| 41 | + target_link_directories(${OP_GRAPH_UT_EXE} PRIVATE ${ASCEND_DIR}/${SYSTEM_PREFIX}/lib64) | ||
| 42 | + target_link_libraries(${OP_GRAPH_UT_EXE} PRIVATE | ||
| 43 | + es_math | ||
| 44 | + es_nn | ||
| 45 | + $<BUILD_INTERFACE:intf_llt_pub_asan_cxx17> | ||
| 46 | + -Wl,--whole-archive | ||
| 47 | + $<$<TARGET_EXISTS:${OP_GRAPH_MODULE_NAME}_static_lib>:${OP_GRAPH_MODULE_NAME}_static_lib> | ||
| 48 | + -Wl,--no-whole-archive | ||
| 49 | + -Wl,--no-as-needed | ||
| 50 | + metadef | ||
| 51 | + -Wl,--as-needed | ||
| 52 | + error_manager | ||
| 53 | + unified_dlog | ||
| 54 | + exe_graph | ||
| 55 | + graph_base | ||
| 56 | + gtest | ||
| 57 | + graph | ||
| 58 | + platform | ||
| 59 | + register | ||
| 60 | + opp_registry | ||
| 61 | + rt2_registry | ||
| 62 | + c_sec | ||
| 63 | + mmpa | ||
| 64 | + dlog | ||
| 65 | + dl | ||
| 66 | + ascend_protobuf | ||
| 67 | + ) | ||
| 68 | + | ||
| 69 | + if(ENABLE_UT_EXEC) | ||
| 70 | + if(${ENABLE_ASAN} STREQUAL "TRUE") | ||
| 71 | + add_custom_command( | ||
| 72 | + TARGET ${OP_GRAPH_UT_EXE} POST_BUILD | ||
| 73 | + COMMAND export LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/es_packages_math/lib64:${CMAKE_BINARY_DIR}/es_packages/lib64:${LIB_OP_TILING_SO_PATH}:$ENV{LD_LIBRARY_PATH} && BUILD_PATH=${BUILD_PATH} | ||
| 74 | + LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.4:/usr/lib/x86_64-linux-gnu/libstdc++.so.6 ASAN_OPTIONS=detect_leaks=0 && ./${OP_GRAPH_UT_EXE} | ||
| 75 | + COMMENT "Run ops op_host utest with asan" | ||
| 76 | + ) | ||
| 77 | + else() | ||
| 78 | + add_custom_command( | ||
| 79 | + TARGET ${OP_GRAPH_UT_EXE} POST_BUILD | ||
| 80 | + COMMAND export LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/es_packages_math/lib64:${CMAKE_BINARY_DIR}/es_packages/lib64:${LIB_OP_TILING_SO_PATH}:$ENV{LD_LIBRARY_PATH}:${ASCEND_DIR}/${SYSTEM_PREFIX}/lib64 && ./${OP_GRAPH_UT_EXE} | ||
| 81 | + COMMENT "Run ops op_host utest" | ||
| 82 | + ) | ||
| 83 | + endif() | ||
| 84 | + endif() | ||
| 85 | + | ||
| 86 | + if(${ENABLE_VALGRIND} STREQUAL "TRUE") | ||
| 87 | + if(NOT LIB_OP_TILING_SO_PATH) | ||
| 88 | + message(FATAL_ERROR "Can not found optiling so!") | ||
| 89 | + return() | ||
| 90 | + endif() | ||
| 91 | + add_custom_command( | ||
| 92 | + TARGET ${OP_GRAPH_UT_EXE} POST_BUILD | ||
| 93 | + COMMAND export LD_LIBRARY_PATH=${LIB_OP_TILING_SO_PATH}:$ENV{LD_LIBRARY_PATH} && | ||
| 94 | + valgrind --undef-value-errors=no --leak-check=full ./${OP_GRAPH_UT_EXE} | ||
| 95 | + COMMENT "Run ops op_host utest by valgrind" | ||
| 96 | + ) | ||
| 97 | + endif() | ||
| 98 | +endif() | ||
| @@ -0,0 +1,62 @@ | |||
| 1 | +/** | ||
| 2 | + * Copyright (c) 2026 Huawei Technologies Co., Ltd. | ||
| 3 | + * This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 5 | + * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | + * See LICENSE in the root of the software repository for the full text of the License. | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + | ||
| 16 | + | ||
| 17 | +using namespace std; | ||
| 18 | + | ||
| 19 | +class OpGraphUtEnvironment : public testing::Environment { | ||
| 20 | +public: | ||
| 21 | + OpGraphUtEnvironment() | ||
| 22 | + {} | ||
| 23 | + virtual void SetUp() | ||
| 24 | + { | ||
| 25 | + cout << "Global Environment SetpUp." << endl; | ||
| 26 | + /* fe::OptionalInfos opti_compilation_infos_ge; | ||
| 27 | + opti_compilation_infos_ge.Init(); | ||
| 28 | + opti_compilation_infos_ge.SetSocVersion("soc_version"); | ||
| 29 | + fe::PlatformInfoManager::GeInstance().SetOptionalCompilationInfo(opti_compilation_infos_ge); | ||
| 30 | + | ||
| 31 | + char exePath[PATH_MAX] = {0}; | ||
| 32 | + (void)readlink("/proc/self/exe", exePath, sizeof(exePath) - 1); | ||
| 33 | + std::string exePathStr(exePath); | ||
| 34 | + auto pos = exePathStr.find_last_of('/'); | ||
| 35 | + if (pos != std::string::npos) { | ||
| 36 | + exePathStr.erase(pos + 1); | ||
| 37 | + } else { | ||
| 38 | + exePathStr.assign("./"); | ||
| 39 | + } | ||
| 40 | + string opHostSoPath = exePathStr + string("/libophost_nn_ut.so"); | ||
| 41 | + gert::OppSoDesc oppSoDesc(ge::AscendString(opHostSoPath.c_str()), "op_host_so"); | ||
| 42 | + shared_ptr<gert::OpImplSpaceRegistryV2> opImplSpaceRegistryV2 = make_shared<gert::OpImplSpaceRegistryV2>(); | ||
| 43 | + if (opImplSpaceRegistryV2->AddSoToRegistry(oppSoDesc) == ge::GRAPH_FAILED) { | ||
| 44 | + cout << "add so to registry failed." << endl; | ||
| 45 | + return; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + gert::DefaultOpImplSpaceRegistryV2::GetInstance().SetSpaceRegistry(opImplSpaceRegistryV2);*/ | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + virtual void TearDown() | ||
| 52 | + { | ||
| 53 | + cout << "Global Environment TearDown" << endl; | ||
| 54 | + } | ||
| 55 | +}; | ||
| 56 | + | ||
| 57 | +int main(int argc, char** argv) | ||
| 58 | +{ | ||
| 59 | + testing::InitGoogleTest(&argc, argv); | ||
| 60 | + testing::AddGlobalTestEnvironment(new OpGraphUtEnvironment()); | ||
| 61 | + _exit(RUN_ALL_TESTS()); | ||
| 62 | +} | ||


opbuild和gen_ops_info是不是多余的?