Merged
HiSpark_AiFly开发板功能适配 #569
jia_kongfengAdd on Jun 10
HiSpark_AiFly开发板功能适配 #569
Merged
Total: 16 files changed+445-253
| @@ -34,9 +34,13 @@ ohos_group("mindspore-lib") { | |||
| 34 | 34 | ||
| 35 | group("mindspore-test") { | 35 | group("mindspore-test") { |
| 36 | testonly = true | 36 | testonly = true |
| 37 | - deps = [ | 37 | + if (is_standard_system) { |
| 38 | - "test:mindspore_fuzz_test", | 38 | + deps = [ |
| 39 | - "test:mindspore_system_test", | 39 | + "test:mindspore_fuzz_test", |
| 40 | - "test:mindspore_unit_test", | 40 | + "test:mindspore_system_test", |
| 41 | - ] | 41 | + "test:mindspore_unit_test", |
| 42 | + ] | ||
| 43 | + } else { | ||
| 44 | + deps = [] | ||
| 45 | + } | ||
| 42 | } | 46 | } |
| @@ -18,7 +18,8 @@ | |||
| 18 | ], | 18 | ], |
| 19 | "features": [ "mindspore_feature_nnrt_metagraph" ], | 19 | "features": [ "mindspore_feature_nnrt_metagraph" ], |
| 20 | "adapted_system_type": [ | 20 | "adapted_system_type": [ |
| 21 | - "standard" | 21 | + "standard", |
| 22 | + "small" | ||
增加small系统上ms lite特性的简介、内核。bundle.json语法不支持增加注释描述 ![]() ![]() | |||
| 22 | ], | 23 | ], |
| 23 | "rom": "", | 24 | "rom": "", |
| 24 | "ram": "", | 25 | "ram": "", |
| @@ -37,7 +38,8 @@ | |||
| 37 | "bounds_checking_function", | 38 | "bounds_checking_function", |
| 38 | "flatbuffers", | 39 | "flatbuffers", |
| 39 | "runtime_core", | 40 | "runtime_core", |
| 40 | - "qos_manager" | 41 | + "qos_manager", |
| 42 | + "hilog_lite" | ||
| 41 | ] | 43 | ] |
| 42 | }, | 44 | }, |
| 43 | "build": { | 45 | "build": { |
| @@ -79,11 +79,16 @@ ohos_group("mindspore") { | |||
| 79 | deps = [ | 79 | deps = [ |
| 80 | ":mindspore_lib", | 80 | ":mindspore_lib", |
| 81 | ":mindspore_ndk", | 81 | ":mindspore_ndk", |
| 82 | - ":mindspore_train_lib", | ||
| 83 | "mindir:mindir_lib", | 82 | "mindir:mindir_lib", |
| 84 | - "src/litert/js_api:mindsporelite_napi", | ||
| 85 | "src/litert/taihe/ability_delegator:mindspore_taihe" | 83 | "src/litert/taihe/ability_delegator:mindspore_taihe" |
| 86 | ] | 84 | ] |
| 85 | + if (is_standard_system) { | ||
| 86 | + deps += [ ":mindspore_train_lib" ] | ||
| 87 | + deps += [ "src/litert/js_api:mindsporelite_napi" ] | ||
| 88 | + } | ||
| 89 | + if (is_small_system) { | ||
| 90 | + deps += [ "tools/benchmark:benchmark_bin" ] | ||
| 91 | + } | ||
| 87 | } | 92 | } |
| 88 | 93 | ||
| 89 | # Inference library | 94 | # Inference library |
| @@ -348,9 +353,11 @@ missing_sources = [ | |||
| 348 | 353 | ||
| 349 | all_sources += missing_sources | 354 | all_sources += missing_sources |
| 350 | SUPPORT_NNRT = false | 355 | SUPPORT_NNRT = false |
| 351 | -# currently, only arm/arm64 real machine support nnrt | 356 | + |
| 352 | -if ((target_cpu == "arm" || target_cpu == "arm64") && !is_emulator) { | 357 | +if (is_standard_system) { |
| 353 | - SUPPORT_NNRT = true | 358 | + if ((target_cpu == "arm" || target_cpu == "arm64") && !is_emulator) { |
| 359 | + SUPPORT_NNRT = true | ||
| 360 | + } | ||
| 354 | } | 361 | } |
| 355 | 362 | ||
| 356 | config("link_option_lto") { | 363 | config("link_option_lto") { |
| @@ -413,9 +420,15 @@ ohos_shared_library("mindspore_lib") { | |||
| 413 | "RUNTIME_PASS_CLIP", | 420 | "RUNTIME_PASS_CLIP", |
| 414 | "ENABLE_MULTI_LAYOUT", | 421 | "ENABLE_MULTI_LAYOUT", |
| 415 | "VERSION_STR=\"2.7.0\"", | 422 | "VERSION_STR=\"2.7.0\"", |
| 416 | - "ENABLE_HI_APP_EVENT", | ||
| 417 | ] | 423 | ] |
| 418 | 424 | ||
| 425 | + if (is_standard_system) { | ||
| 426 | + defines += [ | ||
| 427 | + "ENABLE_HI_APP_EVENT", | ||
| 428 | + "ENABLE_QOS", | ||
| 429 | + ] | ||
| 430 | + } | ||
| 431 | + | ||
| 419 | if (target_cpu == "arm") { | 432 | if (target_cpu == "arm") { |
| 420 | defines += [ | 433 | defines += [ |
| 421 | "ENABLE_ARM", | 434 | "ENABLE_ARM", |
| @@ -444,16 +457,23 @@ ohos_shared_library("mindspore_lib") { | |||
| 444 | ":link_option_lto", | 457 | ":link_option_lto", |
| 445 | ] | 458 | ] |
| 446 | 459 | ||
| 447 | - remove_configs = [ "//build/config/compiler:no_rtti" ] | 460 | + if (is_standard_system) { |
| 448 | - | 461 | + remove_configs = [ "//build/config/compiler:no_rtti" ] |
| 449 | - external_deps = [ | 462 | + external_deps = [ |
| 450 | - "hilog:libhilog", | 463 | + "hilog:libhilog", |
| 451 | - "bounds_checking_function:libsec_shared", | 464 | + "bounds_checking_function:libsec_shared", |
| 452 | - "flatbuffers:libflatbuffers_static", | 465 | + "flatbuffers:libflatbuffers_static", |
| 453 | - "qos_manager:qos", | 466 | + "qos_manager:qos", |
| 454 | - "ipc:ipc_single", | 467 | + "ipc:ipc_single", |
| 455 | - "qos_manager:concurrent_task_client" | 468 | + "qos_manager:concurrent_task_client" |
| 456 | - ] | 469 | + ] |
| 470 | + } else { | ||
| 471 | + external_deps = [ | ||
| 472 | + "hilog_lite:hilog_shared", | ||
| 473 | + "bounds_checking_function:libsec_shared", | ||
| 474 | + "flatbuffers:libflatbuffers_static", | ||
| 475 | + ] | ||
| 476 | + } | ||
| 457 | 477 | ||
| 458 | output_name = "libmindspore-lite" | 478 | output_name = "libmindspore-lite" |
| 459 | output_extension = "so" | 479 | output_extension = "so" |
| @@ -500,6 +520,9 @@ ohos_shared_library("mindspore_lib") { | |||
| 500 | "-Os", | 520 | "-Os", |
| 501 | "-flto=thin" | 521 | "-flto=thin" |
| 502 | ] | 522 | ] |
| 523 | + if (is_small_system) { | ||
| 524 | + cflags_cc += [ "-fPIC" ] | ||
| 525 | + } | ||
| 503 | part_name = "mindspore" | 526 | part_name = "mindspore" |
| 504 | subsystem_name = "thirdparty" | 527 | subsystem_name = "thirdparty" |
| 505 | } | 528 | } |
| @@ -507,10 +530,10 @@ ohos_shared_library("mindspore_lib") { | |||
| 507 | # NDK lib | 530 | # NDK lib |
| 508 | ohos_shared_library("mindspore_ndk") { | 531 | ohos_shared_library("mindspore_ndk") { |
| 509 | branch_protector_ret = "pac_ret" | 532 | branch_protector_ret = "pac_ret" |
| 510 | - deps = [ | 533 | + deps = [ ":mindspore_lib" ] |
| 511 | - ":mindspore_lib", | 534 | + if (is_standard_system) { |
| 512 | - ":mindspore_train_lib", | 535 | + deps += [ ":mindspore_train_lib" ] |
| 513 | - ] | 536 | + } |
| 514 | 537 | ||
| 515 | sources = c_api_sources | 538 | sources = c_api_sources |
| 516 | 539 | ||
| @@ -536,13 +559,23 @@ ohos_shared_library("mindspore_ndk") { | |||
| 536 | "RUNTIME_PASS_CLIP", | 559 | "RUNTIME_PASS_CLIP", |
| 537 | "ENABLE_MULTI_LAYOUT", | 560 | "ENABLE_MULTI_LAYOUT", |
| 538 | "VERSION_STR=\"2.7.0\"", | 561 | "VERSION_STR=\"2.7.0\"", |
| 539 | - "ENABLE_HI_APP_EVENT" | ||
| 540 | ] | 562 | ] |
| 541 | 563 | ||
| 542 | - external_deps = [ | 564 | + if (is_standard_system) { |
| 543 | - "flatbuffers:libflatbuffers_static", | 565 | + defines += [ "ENABLE_HI_APP_EVENT" ] |
| 544 | - "hilog:libhilog" | 566 | + } |
| 545 | - ] | 567 | + |
| 568 | + if (is_standard_system) { | ||
| 569 | + external_deps = [ | ||
| 570 | + "flatbuffers:libflatbuffers_static", | ||
| 571 | + "hilog:libhilog" | ||
| 572 | + ] | ||
| 573 | + } else { | ||
| 574 | + external_deps = [ | ||
| 575 | + "flatbuffers:libflatbuffers_static", | ||
| 576 | + "hilog_lite:hilog_shared" | ||
| 577 | + ] | ||
| 578 | + } | ||
| 546 | 579 | ||
| 547 | if (SUPPORT_NNRT) { | 580 | if (SUPPORT_NNRT) { |
| 548 | 581 | ||
| @@ -561,7 +594,9 @@ ohos_shared_library("mindspore_ndk") { | |||
| 561 | ":secure_option", | 594 | ":secure_option", |
| 562 | ] | 595 | ] |
| 563 | public_configs = [ ":mindspore_api" ] | 596 | public_configs = [ ":mindspore_api" ] |
| 564 | - remove_configs = [ "//build/config/compiler:no_rtti" ] | 597 | + if (is_standard_system) { |
| 598 | + remove_configs = [ "//build/config/compiler:no_rtti" ] | ||
| 599 | + } | ||
| 565 | 600 | ||
| 566 | output_name = "libmindspore_lite_ndk" | 601 | output_name = "libmindspore_lite_ndk" |
| 567 | output_extension = "so" | 602 | output_extension = "so" |
| @@ -576,6 +611,9 @@ ohos_shared_library("mindspore_ndk") { | |||
| 576 | "-Os", | 611 | "-Os", |
| 577 | "-flto=thin" | 612 | "-flto=thin" |
| 578 | ] | 613 | ] |
| 614 | + if (is_small_system) { | ||
| 615 | + cflags_cc += [ "-fPIC" ] | ||
| 616 | + } | ||
| 579 | part_name = "mindspore" | 617 | part_name = "mindspore" |
| 580 | subsystem_name = "thirdparty" | 618 | subsystem_name = "thirdparty" |
| 581 | } | 619 | } |
| @@ -683,84 +721,86 @@ fp32_train_kernel_sources = [ | |||
| 683 | not_needed(fp16_train_kernel_sources) | 721 | not_needed(fp16_train_kernel_sources) |
| 684 | all_train_sources += fp32_train_kernel_sources | 722 | all_train_sources += fp32_train_kernel_sources |
| 685 | 723 | ||
| 686 | -ohos_shared_library("mindspore_train_lib") { | 724 | +if (is_standard_system) { |
| 687 | - branch_protector_ret = "pac_ret" | 725 | + ohos_shared_library("mindspore_train_lib") { |
| 688 | - deps = [ | 726 | + branch_protector_ret = "pac_ret" |
| 689 | - ":mindspore_lib", | 727 | + deps = [ |
| 690 | - ] | 728 | + ":mindspore_lib", |
| 691 | - | ||
| 692 | - sources = all_train_sources | ||
| 693 | - | ||
| 694 | - include_dirs = [ | ||
| 695 | - "./", | ||
| 696 | - "../", | ||
| 697 | - "../../", | ||
| 698 | - "../core", | ||
| 699 | - "src", | ||
| 700 | - "src/c_api/", | ||
| 701 | - "src/train/", | ||
| 702 | - "src/litert/kernel/cpu/", | ||
| 703 | - "../mindspore/mindspore/core/mindrt/", | ||
| 704 | - "../mindspore/mindspore/core/mindrt/include/", | ||
| 705 | - "../../third_party/", | ||
| 706 | - "./schema/", | ||
| 707 | - "../mindspore/mindspore/core/include/" | ||
| 708 | - ] | ||
| 709 | - | ||
| 710 | - defines = [ | ||
| 711 | - "ENABLE_MINDRT", | ||
| 712 | - "MS_COMPILE_OHOS", | ||
| 713 | - "PRIMITIVE_WRITEABLE", | ||
| 714 | - "VERSION_STR=\"2.7.0\"", | ||
| 715 | - ] | ||
| 716 | - | ||
| 717 | - if (target_cpu == "arm") { | ||
| 718 | - defines += [ | ||
| 719 | - "ENABLE_ARM", | ||
| 720 | - "ENABLE_ARM32", | ||
| 721 | - "ENABLE_NEON", | ||
| 722 | ] | 729 | ] |
| 723 | - } else if (target_cpu == "arm64") { | 730 | + |
| 724 | - defines += [ | 731 | + sources = all_train_sources |
| 725 | - "ENABLE_ARM", | 732 | + |
| 726 | - "ENABLE_ARM64", | 733 | + include_dirs = [ |
| 727 | - "ENABLE_NEON", | 734 | + "./", |
| 728 | - "ENABLE_FP16", | 735 | + "../", |
| 729 | - "USE_OPENCL_WRAPPER", | 736 | + "../../", |
| 730 | - "MS_OPENCL_PROFILE=false", | 737 | + "../core", |
| 731 | - "CL_TARGET_OPENCL_VERSION=200", | 738 | + "src", |
| 732 | - "CL_HPP_TARGET_OPENCL_VERSION=120", | 739 | + "src/c_api/", |
| 733 | - "CL_HPP_MINIMUM_OPENCL_VERSION=120", | 740 | + "src/train/", |
| 741 | + "src/litert/kernel/cpu/", | ||
| 742 | + "../mindspore/mindspore/core/mindrt/", | ||
| 743 | + "../mindspore/mindspore/core/mindrt/include/", | ||
| 744 | + "../../third_party/", | ||
| 745 | + "./schema/", | ||
| 746 | + "../mindspore/mindspore/core/include/" | ||
| 734 | ] | 747 | ] |
| 748 | + | ||
| 749 | + defines = [ | ||
| 750 | + "ENABLE_MINDRT", | ||
| 751 | + "MS_COMPILE_OHOS", | ||
| 752 | + "PRIMITIVE_WRITEABLE", | ||
| 753 | + "VERSION_STR=\"2.7.0\"", | ||
| 754 | + ] | ||
| 755 | + | ||
| 756 | + if (target_cpu == "arm") { | ||
| 757 | + defines += [ | ||
| 758 | + "ENABLE_ARM", | ||
| 759 | + "ENABLE_ARM32", | ||
| 760 | + "ENABLE_NEON", | ||
| 761 | + ] | ||
| 762 | + } else if (target_cpu == "arm64") { | ||
| 763 | + defines += [ | ||
| 764 | + "ENABLE_ARM", | ||
| 765 | + "ENABLE_ARM64", | ||
| 766 | + "ENABLE_NEON", | ||
| 767 | + "ENABLE_FP16", | ||
| 768 | + "USE_OPENCL_WRAPPER", | ||
| 769 | + "MS_OPENCL_PROFILE=false", | ||
| 770 | + "CL_TARGET_OPENCL_VERSION=200", | ||
| 771 | + "CL_HPP_TARGET_OPENCL_VERSION=120", | ||
| 772 | + "CL_HPP_MINIMUM_OPENCL_VERSION=120", | ||
| 773 | + ] | ||
| 774 | + } | ||
| 775 | + configs = [ | ||
| 776 | + ":mindspore_api", | ||
| 777 | + ":disable_android", | ||
| 778 | + ":train_kernel_option", | ||
| 779 | + ":secure_option", | ||
| 780 | + ":link_option_lto", | ||
| 781 | + ] | ||
| 782 | + | ||
| 783 | + remove_configs = [ "//build/config/compiler:no_rtti" ] | ||
| 784 | + external_deps = [ "hilog:libhilog", | ||
| 785 | + "flatbuffers:libflatbuffers_static", | ||
| 786 | + "bounds_checking_function:libsec_shared", ] | ||
| 787 | + innerapi_tags = [ "platformsdk" ] | ||
| 788 | + output_name = "libmindspore-lite-train" | ||
| 789 | + output_extension = "so" | ||
| 790 | + defines += [ "SUPPORT_TRAIN" ] | ||
| 791 | + cflags_cc = [ | ||
| 792 | + "-Wno-ignored-qualifiers", | ||
| 793 | + "-Wunused-private-field", | ||
| 794 | + "-Wno-unused-private-field", | ||
| 795 | + "-Wno-inconsistent-missing-override", | ||
| 796 | + "-Wno-macro-redefined", | ||
| 797 | + "-Wno-constant-conversion", | ||
| 798 | + "-Os", | ||
| 799 | + "-flto=thin" | ||
| 800 | + ] | ||
| 801 | + part_name = "mindspore" | ||
| 802 | + subsystem_name = "thirdparty" | ||
| 735 | } | 803 | } |
| 736 | - configs = [ | ||
| 737 | - ":mindspore_api", | ||
| 738 | - ":disable_android", | ||
| 739 | - ":train_kernel_option", | ||
| 740 | - ":secure_option", | ||
| 741 | - ":link_option_lto", | ||
| 742 | - ] | ||
| 743 | - | ||
| 744 | - remove_configs = [ "//build/config/compiler:no_rtti" ] | ||
| 745 | - external_deps = [ "hilog:libhilog", | ||
| 746 | - "flatbuffers:libflatbuffers_static", | ||
| 747 | - "bounds_checking_function:libsec_shared", ] | ||
| 748 | - innerapi_tags = [ "platformsdk" ] | ||
| 749 | - output_name = "libmindspore-lite-train" | ||
| 750 | - output_extension = "so" | ||
| 751 | - defines += [ "SUPPORT_TRAIN" ] | ||
| 752 | - cflags_cc = [ | ||
| 753 | - "-Wno-ignored-qualifiers", | ||
| 754 | - "-Wunused-private-field", | ||
| 755 | - "-Wno-unused-private-field", | ||
| 756 | - "-Wno-inconsistent-missing-override", | ||
| 757 | - "-Wno-macro-redefined", | ||
| 758 | - "-Wno-constant-conversion", | ||
| 759 | - "-Os", | ||
| 760 | - "-flto=thin" | ||
| 761 | - ] | ||
| 762 | - part_name = "mindspore" | ||
| 763 | - subsystem_name = "thirdparty" | ||
| 764 | } | 804 | } |
| 765 | 805 | ||
| 766 | # Build configurations | 806 | # Build configurations |
| @@ -58,19 +58,27 @@ ohos_shared_library("mindir_lib") { | |||
| 58 | "src/mindir_1.cc", | 58 | "src/mindir_1.cc", |
| 59 | "src/mindir_2.cc", | 59 | "src/mindir_2.cc", |
| 60 | "src/mindir_memory_manager.cc", | 60 | "src/mindir_memory_manager.cc", |
| 61 | - "src/mindir_nnrt_lite_graph.cc", | ||
| 62 | "src/mindir_tensor.cc", | 61 | "src/mindir_tensor.cc", |
| 63 | "src/utils.cc", | 62 | "src/utils.cc", |
| 64 | ] | 63 | ] |
| 65 | - external_deps = [ | 64 | + if (is_standard_system) { |
| 66 | - "c_utils:utils", | 65 | + sources += [ "src/mindir_nnrt_lite_graph.cc" ] |
| 67 | - "hdf_core:libhdi", | 66 | + external_deps = [ |
| 68 | - "hilog:libhilog", | 67 | + "c_utils:utils", |
| 69 | - "bounds_checking_function:libsec_shared", | 68 | + "hdf_core:libhdi", |
| 70 | - "drivers_interface_nnrt:nnrt_idl_headers", | 69 | + "hilog:libhilog", |
| 71 | - "flatbuffers:libflatbuffers_static", | 70 | + "bounds_checking_function:libsec_shared", |
| 72 | - "hilog:libhilog", | 71 | + "drivers_interface_nnrt:nnrt_idl_headers", |
| 73 | - ] | 72 | + "flatbuffers:libflatbuffers_static", |
| 73 | + "hilog:libhilog", | ||
| 74 | + ] | ||
| 75 | + } else { | ||
| 76 | + external_deps = [ | ||
| 77 | + "bounds_checking_function:libsec_shared", | ||
| 78 | + "flatbuffers:libflatbuffers_static", | ||
| 79 | + "hilog_lite:hilog_shared", | ||
| 80 | + ] | ||
| 81 | + } | ||
| 74 | configs = [ | 82 | configs = [ |
| 75 | ":mindir_secure_disable_android", | 83 | ":mindir_secure_disable_android", |
| 76 | "../:link_option_lto", | 84 | "../:link_option_lto", |
| @@ -26,6 +26,9 @@ | |||
| 26 | #define LOG_TAG "MS_LITE" | 26 | #define LOG_TAG "MS_LITE" |
| 27 | #define FORMAT "[%{public}s:%{public}d] %{public}s# %{public}s" | 27 | #define FORMAT "[%{public}s:%{public}d] %{public}s# %{public}s" |
| 28 | #include "hilog/log.h" | 28 | #include "hilog/log.h" |
| 29 | +#ifndef LOG_APP | ||
| 30 | +#define LOG_APP LOG_CORE | ||
| 31 | +#endif | ||
| 29 | #endif | 32 | #endif |
| 30 | 33 | ||
| 31 | // namespace to support utils module definition namespace mindspore constexpr const char *ANDROID_LOG_TAG = "MS_LITE"; | 34 | // namespace to support utils module definition namespace mindspore constexpr const char *ANDROID_LOG_TAG = "MS_LITE"; |
| @@ -17,13 +17,18 @@ lite_src_common_mid_sources = [ | |||
| 17 | "random_data_generator.cc", | 17 | "random_data_generator.cc", |
| 18 | "string_util.cc", | 18 | "string_util.cc", |
| 19 | "dynamic_library_loader.cc", | 19 | "dynamic_library_loader.cc", |
| 20 | - "hi_app_event/hi_app_event.cc", | ||
| 21 | - "hi_app_event/hi_app_event_thread.cc", | ||
| 22 | ] | 20 | ] |
| 23 | 21 | ||
| 24 | ohos_source_set("lite_common_mid_obj") { | 22 | ohos_source_set("lite_common_mid_obj") { |
| 25 | sources = lite_src_common_mid_sources | 23 | sources = lite_src_common_mid_sources |
| 26 | 24 | ||
| 25 | + if (is_standard_system) { | ||
| 26 | + sources += [ | ||
| 27 | + "hi_app_event/hi_app_event.cc", | ||
| 28 | + "hi_app_event/hi_app_event_thread.cc", | ||
| 29 | + ] | ||
| 30 | + } | ||
| 31 | + | ||
| 27 | include_dirs = [ | 32 | include_dirs = [ |
| 28 | "../", | 33 | "../", |
| 29 | "../../", | 34 | "../../", |
| @@ -36,13 +41,6 @@ ohos_source_set("lite_common_mid_obj") { | |||
| 36 | "../../../mindspore/mindspore/core/mindrt/include/", | 41 | "../../../mindspore/mindspore/core/mindrt/include/", |
| 37 | ] | 42 | ] |
| 38 | 43 | ||
| 39 | - external_deps = [ | ||
| 40 | - "flatbuffers:libflatbuffers_static", | ||
| 41 | - "bounds_checking_function:libsec_shared", | ||
| 42 | - "hiappevent:hiappevent_innerapi", | ||
| 43 | - "hilog:libhilog", | ||
| 44 | - ] | ||
| 45 | - | ||
| 46 | configs = [ | 44 | configs = [ |
| 47 | "../../:disable_android", | 45 | "../../:disable_android", |
| 48 | "../../:secure_option", | 46 | "../../:secure_option", |
| @@ -53,8 +51,23 @@ ohos_source_set("lite_common_mid_obj") { | |||
| 53 | "MS_COMPILE_OHOS", | 51 | "MS_COMPILE_OHOS", |
| 54 | "PRIMITIVE_WRITEABLE", | 52 | "PRIMITIVE_WRITEABLE", |
| 55 | "VERSION_STR=\"2.1.0\"", | 53 | "VERSION_STR=\"2.1.0\"", |
| 56 | - "ENABLE_HI_APP_EVENT", | ||
| 57 | ] | 54 | ] |
| 55 | + | ||
| 56 | + if (is_standard_system) { | ||
| 57 | + defines += [ "ENABLE_HI_APP_EVENT" ] | ||
| 58 | + external_deps = [ | ||
| 59 | + "flatbuffers:libflatbuffers_static", | ||
| 60 | + "bounds_checking_function:libsec_shared", | ||
| 61 | + "hiappevent:hiappevent_innerapi", | ||
| 62 | + "hilog:libhilog", | ||
| 63 | + ] | ||
| 64 | + } else { | ||
| 65 | + external_deps = [ | ||
| 66 | + "flatbuffers:libflatbuffers_static", | ||
| 67 | + "bounds_checking_function:libsec_shared", | ||
| 68 | + "hilog_lite:hilog_shared", | ||
| 69 | + ] | ||
| 70 | + } | ||
| 58 | if (target_cpu == "arm") { | 71 | if (target_cpu == "arm") { |
| 59 | defines += [ | 72 | defines += [ |
| 60 | "ENABLE_ARM", | 73 | "ENABLE_ARM", |
| @@ -84,6 +97,10 @@ ohos_source_set("lite_common_mid_obj") { | |||
| 84 | "-Wno-constant-conversion", | 97 | "-Wno-constant-conversion", |
| 85 | ] | 98 | ] |
| 86 | 99 | ||
| 100 | + if (is_small_system) { | ||
| 101 | + cflags_cc += [ "-fPIC" ] | ||
| 102 | + } | ||
| 103 | + | ||
| 87 | part_name = "mindspore" | 104 | part_name = "mindspore" |
| 88 | subsystem_name = "thirdparty" | 105 | subsystem_name = "thirdparty" |
| 89 | } | 106 | } |
| @@ -26,6 +26,9 @@ | |||
| 26 | #define LOG_TAG "MS_LITE" | 26 | #define LOG_TAG "MS_LITE" |
| 27 | #define FORMAT "[%{public}s:%{public}d] %{public}s# %{public}s" | 27 | #define FORMAT "[%{public}s:%{public}d] %{public}s# %{public}s" |
| 28 | #include "hilog/log.h" | 28 | #include "hilog/log.h" |
| 29 | +#ifndef LOG_APP | ||
| 30 | +#define LOG_APP LOG_CORE | ||
| 31 | +#endif | ||
| 29 | #endif | 32 | #endif |
| 30 | 33 | ||
| 31 | // namespace to support utils module definition namespace mindspore constexpr const char *ANDROID_LOG_TAG = "MS_LITE"; | 34 | // namespace to support utils module definition namespace mindspore constexpr const char *ANDROID_LOG_TAG = "MS_LITE"; |
| @@ -17,7 +17,7 @@ | |||
| 17 | #include <algorithm> | 17 | #include <algorithm> |
| 18 | #include <memory> | 18 | #include <memory> |
| 19 | #include <unistd.h> | 19 | #include <unistd.h> |
| 20 | -#ifdef MS_COMPILE_OHOS | 20 | +#if defined(MS_COMPILE_OHOS) && defined(ENABLE_QOS) |
| 21 | #include "concurrent_task_client.h" | 21 | #include "concurrent_task_client.h" |
| 22 | #endif | 22 | #endif |
| 23 | #include "include/errorcode.h" | 23 | #include "include/errorcode.h" |
| @@ -76,7 +76,7 @@ int InnerContext::CreateThreadPool(bool is_control_flow) { | |||
| 76 | if (thread_pool_ == nullptr) { | 76 | if (thread_pool_ == nullptr) { |
| 77 | #ifdef ENABLE_MINDRT | 77 | #ifdef ENABLE_MINDRT |
| 78 | #ifndef MS_COMPILE_IOS | 78 | #ifndef MS_COMPILE_IOS |
| 79 | -#ifdef MS_COMPILE_OHOS | 79 | +#if defined(MS_COMPILE_OHOS) && defined(ENABLE_QOS) |
| 80 | std::call_once(ms_qos_authflag, []() { | 80 | std::call_once(ms_qos_authflag, []() { |
| 81 | pid_t pid = getpid(); | 81 | pid_t pid = getpid(); |
| 82 | std::unordered_map<std::string, std::string> payload; | 82 | std::unordered_map<std::string, std::string> payload; |
| @@ -295,10 +295,17 @@ ohos_source_set("cpu_kernel_obj") { | |||
| 295 | 295 | ||
| 296 | deps = [ "nnacl_c/:nnacl_obj" ] | 296 | deps = [ "nnacl_c/:nnacl_obj" ] |
| 297 | 297 | ||
| 298 | - external_deps = [ | 298 | + if (is_standard_system) { |
| 299 | - "flatbuffers:libflatbuffers_static", | 299 | + external_deps = [ |
| 300 | - "hilog:libhilog", | 300 | + "flatbuffers:libflatbuffers_static", |
| 301 | - ] | 301 | + "hilog:libhilog" |
| 302 | + ] | ||
| 303 | + } else { | ||
| 304 | + external_deps = [ | ||
| 305 | + "flatbuffers:libflatbuffers_static", | ||
| 306 | + "hilog_lite:hilog_shared" | ||
| 307 | + ] | ||
| 308 | + } | ||
| 302 | 309 | ||
| 303 | include_dirs = [ | 310 | include_dirs = [ |
| 304 | "./", | 311 | "./", |
| @@ -349,6 +356,11 @@ ohos_source_set("cpu_kernel_obj") { | |||
| 349 | "-Wno-macro-redefined", | 356 | "-Wno-macro-redefined", |
| 350 | "-Wno-constant-conversion", | 357 | "-Wno-constant-conversion", |
| 351 | ] | 358 | ] |
| 359 | + | ||
| 360 | + if (is_small_system) { | ||
| 361 | + cflags_cc += [ "-fPIC" ] | ||
| 362 | + } | ||
| 363 | + | ||
| 352 | part_name = "mindspore" | 364 | part_name = "mindspore" |
| 353 | subsystem_name = "thirdparty" | 365 | subsystem_name = "thirdparty" |
| 354 | } | 366 | } |
| @@ -29,6 +29,23 @@ config("nnacl_public_config") { | |||
| 29 | "-Wno-ignored-qualifiers", | 29 | "-Wno-ignored-qualifiers", |
| 30 | "-Wno-unknown-pragmas" | 30 | "-Wno-unknown-pragmas" |
| 31 | ] | 31 | ] |
| 32 | + if (is_small_system) { | ||
| 33 | + cflags_c += [ | ||
| 34 | + "-fasm", | ||
| 35 | + "-fPIC", | ||
| 36 | + ] | ||
| 37 | + if (target_cpu == "arm64") { | ||
| 38 | + # board_arch 来自 device config.gni,未设置时默认 armv8.2-a | ||
| 39 | + if (board_arch == "") { | ||
| 40 | + _arch = "armv8.2-a" | ||
| 41 | + } else { | ||
| 42 | + _arch = board_arch | ||
| 43 | + } | ||
| 44 | + asmflags = [ | ||
| 45 | + "-march=${_arch}+fp16+dotprod", | ||
| 46 | + ] | ||
| 47 | + } | ||
| 48 | + } | ||
| 32 | if (target_cpu == "arm" || target_cpu == "arm64") { | 49 | if (target_cpu == "arm" || target_cpu == "arm64") { |
| 33 | defines += [ | 50 | defines += [ |
| 34 | "ENABLE_ARM", | 51 | "ENABLE_ARM", |
| @@ -955,9 +972,15 @@ ohos_source_set("nnacl_common") { | |||
| 955 | sources = nnacl_sources | 972 | sources = nnacl_sources |
| 956 | part_name = "mindspore" | 973 | part_name = "mindspore" |
| 957 | subsystem_name = "thirdparty" | 974 | subsystem_name = "thirdparty" |
| 958 | - external_deps = [ | 975 | + if (is_standard_system) { |
| 959 | - "hilog:libhilog" | 976 | + external_deps = [ |
| 960 | - ] | 977 | + "hilog:libhilog" |
| 978 | + ] | ||
| 979 | + } else { | ||
| 980 | + external_deps = [ | ||
| 981 | + "hilog_lite:hilog_shared" | ||
| 982 | + ] | ||
| 983 | + } | ||
| 961 | } | 984 | } |
| 962 | 985 | ||
| 963 | ohos_source_set("nnacl_common_train") { | 986 | ohos_source_set("nnacl_common_train") { |
| @@ -966,9 +989,15 @@ ohos_source_set("nnacl_common_train") { | |||
| 966 | sources = nnacl_train_sources | 989 | sources = nnacl_train_sources |
| 967 | part_name = "mindspore" | 990 | part_name = "mindspore" |
| 968 | subsystem_name = "thirdparty" | 991 | subsystem_name = "thirdparty" |
| 969 | - external_deps = [ | 992 | + if (is_standard_system) { |
| 970 | - "hilog:libhilog" | 993 | + external_deps = [ |
| 971 | - ] | 994 | + "hilog:libhilog" |
| 995 | + ] | ||
| 996 | + } else { | ||
| 997 | + external_deps = [ | ||
| 998 | + "hilog_lite:hilog_shared" | ||
| 999 | + ] | ||
| 1000 | + } | ||
| 972 | } | 1001 | } |
| 973 | 1002 | ||
| 974 | ohos_source_set("nnacl_no_fast_math") { | 1003 | ohos_source_set("nnacl_no_fast_math") { |
| @@ -34,55 +34,59 @@ ohos_taihe("run_taihe_ms") { | |||
| 34 | ] | 34 | ] |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | -taihe_shared_library("mindspore_ani_taihe_native") { | 37 | +if (is_standard_system) { |
| 38 | - taihe_generated_file_path = "$taihe_generated_file_path" | 38 | + taihe_shared_library("mindspore_ani_taihe_native") { |
| 39 | - part_name = "$part_name" | 39 | + taihe_generated_file_path = "$taihe_generated_file_path" |
| 40 | - subsystem_name = "$subsystem_name" | 40 | + part_name = "$part_name" |
| 41 | - sources = get_target_outputs(":run_taihe_ms") | 41 | + subsystem_name = "$subsystem_name" |
| 42 | - include_dirs = [ | 42 | + sources = get_target_outputs(":run_taihe_ms") |
| 43 | - "${MINDSPORE_ROOT_ANI}/source/", | 43 | + include_dirs = [ |
| 44 | - "${MINDSPORE_ROOT_ANI}/source/include/api", | 44 | + "${MINDSPORE_ROOT_ANI}/source/", |
| 45 | - "${MINDSPORE_ROOT_ANI}/source/mindspore/mindspore/core", | 45 | + "${MINDSPORE_ROOT_ANI}/source/include/api", |
| 46 | - "${MINDSPORE_ROOT_ANI}/source/mindspore/mindspore/core/include", | 46 | + "${MINDSPORE_ROOT_ANI}/source/mindspore/mindspore/core", |
| 47 | - "${MINDSPORE_ROOT_ANI}/source/mindspore-lite", | 47 | + "${MINDSPORE_ROOT_ANI}/source/mindspore/mindspore/core/include", |
| 48 | - "${MINDSPORE_ROOT_ANI}/source/mindspore-lite/src/litert/taihe/ability_delegator/include" | 48 | + "${MINDSPORE_ROOT_ANI}/source/mindspore-lite", |
| 49 | - ] | 49 | + "${MINDSPORE_ROOT_ANI}/source/mindspore-lite/src/litert/taihe/ability_delegator/include" |
| 50 | - sources += [ | 50 | + ] |
| 51 | - "src/ani_constructor.cpp", | 51 | + sources += [ |
| 52 | - "src/ohos.ai.mindSporeLite.impl.cpp", | 52 | + "src/ani_constructor.cpp", |
| 53 | - "src/ms_utils_ani.cpp", | 53 | + "src/ohos.ai.mindSporeLite.impl.cpp", |
| 54 | - ] | 54 | + "src/ms_utils_ani.cpp", |
| 55 | - deps = [ | 55 | + ] |
| 56 | - ":run_taihe_ms", | 56 | + deps = [ |
| 57 | - "${MINDSPORE_ROOT_ANI}/source/mindspore-lite:mindspore_ndk", | 57 | + ":run_taihe_ms", |
| 58 | - "${MINDSPORE_ROOT_ANI}/source/mindspore-lite:mindspore_lib" | 58 | + "${MINDSPORE_ROOT_ANI}/source/mindspore-lite:mindspore_ndk", |
| 59 | - ] | 59 | + "${MINDSPORE_ROOT_ANI}/source/mindspore-lite:mindspore_lib" |
| 60 | - cflags_cc = [ | 60 | + ] |
| 61 | - "-Os", | 61 | + cflags_cc = [ |
| 62 | - "-flto=thin" | 62 | + "-Os", |
| 63 | - ] | 63 | + "-flto=thin" |
| 64 | -} | 64 | + ] |
| 65 | + } | ||
| 65 | 66 | ||
| 66 | -generate_static_abc("mindspore_ani_abc") { | 67 | + generate_static_abc("mindspore_ani_abc") { |
| 67 | - base_url = "$taihe_generated_file_path" | 68 | + base_url = "$taihe_generated_file_path" |
| 68 | - files = [ "$taihe_generated_file_path/@ohos.ai.mindSporeLite.ets" ] | 69 | + files = [ "$taihe_generated_file_path/@ohos.ai.mindSporeLite.ets" ] |
| 69 | - is_boot_abc = "True" | 70 | + is_boot_abc = "True" |
| 70 | - device_dst_file = "/system/framework/mindspore_ani_abc.abc" | 71 | + device_dst_file = "/system/framework/mindspore_ani_abc.abc" |
| 71 | - dependencies = [ ":run_taihe_ms" ] | 72 | + dependencies = [ ":run_taihe_ms" ] |
| 72 | 73 | ||
| 73 | -} | 74 | + } |
| 74 | 75 | ||
| 75 | -ohos_prebuilt_etc("mindspore_ani_etc") { | 76 | + ohos_prebuilt_etc("mindspore_ani_etc") { |
| 76 | - source = "$target_out_dir/mindspore_ani_abc.abc" | 77 | + source = "$target_out_dir/mindspore_ani_abc.abc" |
| 77 | - module_install_dir = "framework" | 78 | + module_install_dir = "framework" |
| 78 | - part_name = "$part_name" | 79 | + part_name = "$part_name" |
| 79 | - subsystem_name = "$subsystem_name" | 80 | + subsystem_name = "$subsystem_name" |
| 80 | - deps = [ ":mindspore_ani_abc" ] | 81 | + deps = [ ":mindspore_ani_abc" ] |
| 82 | + } | ||
| 81 | } | 83 | } |
| 82 | 84 | ||
| 83 | group("mindspore_taihe") { | 85 | group("mindspore_taihe") { |
| 84 | - deps = [ | 86 | + if (is_standard_system) { |
| 85 | - ":mindspore_ani_etc", | 87 | + deps = [ |
| 86 | - ":mindspore_ani_taihe_native", | 88 | + ":mindspore_ani_etc", |
| 87 | - ] | 89 | + ":mindspore_ani_taihe_native", |
| 90 | + ] | ||
| 91 | + } | ||
| 88 | } | 92 | } |
| @@ -15,53 +15,110 @@ | |||
| 15 | 15 | ||
| 16 | import("//build/ohos.gni") | 16 | import("//build/ohos.gni") |
| 17 | 17 | ||
| 18 | -ohos_executable("benchmark_bin") { | 18 | +if (is_small_system) { |
| 19 | - sources = [ | 19 | + executable("benchmark_bin") { |
| 20 | - "../../../ccsrc/plugin/device/cpu/kernel/nnacl/nnacl_common.c", | 20 | + sources = [ |
| 21 | - "../../src/common/file_utils.cc", | 21 | + "../../src/litert/kernel/cpu/nnacl_c/nnacl_common.c", |
| 22 | - "../../src/common/utils.cc", | 22 | + "../../src/common/file_utils.cc", |
| 23 | - "../../src/common/config_file.cc", | 23 | + "../../src/common/utils.cc", |
| 24 | - "../common/flag_parser.cc", | 24 | + "../../src/common/config_file.cc", |
| 25 | - "../common/opengl_util.cc", | 25 | + "../common/flag_parser.cc", |
| 26 | - "../common/string_util.cc", | 26 | + "../common/opengl_util.cc", |
| 27 | - "benchmark_base.cc", | 27 | + "../common/string_util.cc", |
| 28 | - "benchmark_c_api.cc", | 28 | + "benchmark_base.cc", |
| 29 | - "benchmark_unified_api.cc", | 29 | + "benchmark_c_api.cc", |
| 30 | - "main.cc", | 30 | + "benchmark_unified_api.cc", |
| 31 | - "run_benchmark.cc", | 31 | + "main.cc", |
| 32 | - ] | 32 | + "run_benchmark.cc", |
| 33 | - | ||
| 34 | - include_dirs = [ | ||
| 35 | - "../../", # src | ||
| 36 | - "../../../core/", # core | ||
| 37 | - "../../../../", # | ||
| 38 | - "../../../../third_party/", # third_party | ||
| 39 | - "../../../ccsrc/plugin/device/cpu/kernel/", # nnacl | ||
| 40 | - ] | ||
| 41 | - | ||
| 42 | - defines = [ | ||
| 43 | - "MS_COMPILE_OHOS", | ||
| 44 | - ] | ||
| 45 | - | ||
| 46 | - if (target_cpu == "arm") { | ||
| 47 | - defines += [ | ||
| 48 | - "ENABLE_ARM", | ||
| 49 | - "ENABLE_ARM32", | ||
| 50 | ] | 33 | ] |
| 51 | - } else if (target_cpu == "arm64") { | 34 | + |
| 52 | - defines += [ | 35 | + include_dirs = [ |
| 53 | - "ENABLE_ARM", | 36 | + "//third_party/flatbuffers/include", |
| 54 | - "ENABLE_ARM64", | 37 | + "//third_party/json/single_include", |
| 38 | + "../../", | ||
| 39 | + "../../../core/", | ||
| 40 | + "../../../../", | ||
| 41 | + "../../../../third_party/", | ||
| 42 | + "../../src/litert/kernel/cpu/nnacl_c/", | ||
| 55 | ] | 43 | ] |
| 44 | + | ||
| 45 | + defines = [ "MS_COMPILE_OHOS" ] | ||
| 46 | + | ||
| 47 | + if (target_cpu == "arm") { | ||
| 48 | + defines += [ | ||
| 49 | + "ENABLE_ARM", | ||
| 50 | + "ENABLE_ARM32", | ||
| 51 | + ] | ||
| 52 | + } else if (target_cpu == "arm64") { | ||
| 53 | + defines += [ | ||
| 54 | + "ENABLE_ARM", | ||
| 55 | + "ENABLE_ARM64", | ||
| 56 | + ] | ||
| 57 | + } | ||
| 58 | + cflags_cc = [ "-Wno-unused-const-variable" ] | ||
| 59 | + deps = [ | ||
| 60 | + "../../:mindspore_lib", | ||
| 61 | + "../../:mindspore_ndk", | ||
| 62 | + ] | ||
| 63 | + external_deps = [ | ||
| 64 | + "bounds_checking_function:libsec_shared", | ||
| 65 | + ] | ||
| 66 | + include_dirs += [ | ||
| 67 | + "//third_party/bounds_checking_function/include", | ||
| 68 | + ] | ||
| 69 | + | ||
| 70 | + output_name = "benchmark" | ||
| 71 | + output_dir = "$root_out_dir/usr" | ||
整个mindspore-lite lib库会打包到系统镜像,benchmark在rom和ndk里面有归档吗? ![]() ![]() | |||
| 72 | + } | ||
| 73 | +} else { | ||
| 74 | + ohos_executable("benchmark_bin") { | ||
| 75 | + sources = [ | ||
| 76 | + "../../../ccsrc/plugin/device/cpu/kernel/nnacl/nnacl_common.c", | ||
| 77 | + "../../src/common/file_utils.cc", | ||
| 78 | + "../../src/common/utils.cc", | ||
| 79 | + "../../src/common/config_file.cc", | ||
| 80 | + "../common/flag_parser.cc", | ||
| 81 | + "../common/opengl_util.cc", | ||
| 82 | + "../common/string_util.cc", | ||
| 83 | + "benchmark_base.cc", | ||
| 84 | + "benchmark_c_api.cc", | ||
| 85 | + "benchmark_unified_api.cc", | ||
| 86 | + "main.cc", | ||
| 87 | + "run_benchmark.cc", | ||
| 88 | + ] | ||
| 89 | + | ||
| 90 | + include_dirs = [ | ||
| 91 | + "../../", # src | ||
| 92 | + "../../../core/", # core | ||
| 93 | + "../../../../", # | ||
| 94 | + "../../../../third_party/", # third_party | ||
| 95 | + "../../../ccsrc/plugin/device/cpu/kernel/", # nnacl | ||
| 96 | + ] | ||
| 97 | + | ||
| 98 | + defines = [ | ||
| 99 | + "MS_COMPILE_OHOS", | ||
| 100 | + ] | ||
| 101 | + | ||
| 102 | + if (target_cpu == "arm") { | ||
| 103 | + defines += [ | ||
| 104 | + "ENABLE_ARM", | ||
| 105 | + "ENABLE_ARM32", | ||
| 106 | + ] | ||
| 107 | + } else if (target_cpu == "arm64") { | ||
| 108 | + defines += [ | ||
| 109 | + "ENABLE_ARM", | ||
| 110 | + "ENABLE_ARM64", | ||
| 111 | + ] | ||
| 112 | + } | ||
| 113 | + remove_configs = [ "//build/config/compiler:no_rtti" ] | ||
| 114 | + cflags_cc = [ "-Wno-unused-const-variable" ] | ||
| 115 | + deps = [ | ||
| 116 | + "../../:mindspore_lib", | ||
| 117 | + "../../:mindspore_ndk", | ||
| 118 | + ] | ||
| 119 | + external_deps = [ "flatbuffers:libflatbuffers_static" ] | ||
| 120 | + output_name = "benchmark_bin" | ||
| 121 | + install_enable = true | ||
| 122 | + part_name = "mindspore" | ||
| 56 | } | 123 | } |
| 57 | - remove_configs = [ "//build/config/compiler:no_rtti" ] | ||
| 58 | - cflags_cc = [ "-Wno-unused-const-variable" ] | ||
| 59 | - deps = [ | ||
| 60 | - "../../:mindspore_lib", | ||
| 61 | - "../../:mindspore_ndk", | ||
| 62 | - ] | ||
| 63 | - external_deps = [ "flatbuffers:libflatbuffers_static" ] | ||
| 64 | - output_name = "benchmark_bin" | ||
| 65 | - install_enable = true | ||
| 66 | - part_name = "mindspore" | ||
| 67 | } | 124 | } |
| @@ -48,8 +48,16 @@ ohos_source_set("mindrt_obj") { | |||
| 48 | "BUILD_LITE", | 48 | "BUILD_LITE", |
| 49 | ] | 49 | ] |
| 50 | 50 | ||
| 51 | - external_deps = [ "hilog:libhilog", "qos_manager:qos" ] | 51 | + if (is_standard_system) { |
| 52 | - remove_configs = [ "//build/config/compiler:no_rtti" ] | 52 | + external_deps = [ "hilog:libhilog", "qos_manager:qos" ] |
| 53 | + remove_configs = [ "//build/config/compiler:no_rtti" ] | ||
| 54 | + } else { | ||
| 55 | + external_deps = [ "hilog_lite:hilog_shared" ] | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + if (is_small_system) { | ||
| 59 | + cflags_cc = [ "-fPIC" ] | ||
| 60 | + } | ||
| 53 | 61 | ||
| 54 | part_name = "mindspore" | 62 | part_name = "mindspore" |
| 55 | subsystem_name = "thirdparty" | 63 | subsystem_name = "thirdparty" |
| @@ -18,6 +18,9 @@ | |||
| 18 | #define MINDSPORE_CORE_MINDRT_RUNTIME_THREADPOOL_LOG_H_ | 18 | #define MINDSPORE_CORE_MINDRT_RUNTIME_THREADPOOL_LOG_H_ |
| 19 | #ifdef MS_COMPILE_OHOS | 19 | #ifdef MS_COMPILE_OHOS |
| 20 | #include "hilog/log.h" | 20 | #include "hilog/log.h" |
| 21 | +#ifndef LOG_APP | ||
| 22 | +#define LOG_APP LOG_CORE | ||
| 23 | +#endif | ||
| 21 | #endif | 24 | #endif |
| 22 | namespace mindspore { | 25 | namespace mindspore { |
| 23 | #ifdef THREAD_POOL_DEBUG | 26 | #ifdef THREAD_POOL_DEBUG |
| @@ -20,7 +20,7 @@ | |||
| 20 | #endif | 20 | #endif |
| 21 | #include "thread/actor_threadpool.h" | 21 | #include "thread/actor_threadpool.h" |
| 22 | #include "thread/core_affinity.h" | 22 | #include "thread/core_affinity.h" |
| 23 | -#ifdef MS_COMPILE_OHOS | 23 | +#if defined(MS_COMPILE_OHOS) && defined(ENABLE_QOS) |
| 24 | #include "qos.h" | 24 | #include "qos.h" |
| 25 | using namespace OHOS::QOS; | 25 | using namespace OHOS::QOS; |
| 26 | #endif | 26 | #endif |
| @@ -36,7 +36,7 @@ void ActorWorker::RunWithSpin() { | |||
| 36 | } | 36 | } |
| 37 | #if !defined(__APPLE__) && !defined(_MSC_VER) | 37 | #if !defined(__APPLE__) && !defined(_MSC_VER) |
| 38 | static std::atomic_int index{0}; | 38 | static std::atomic_int index{0}; |
| 39 | -#ifdef MS_COMPILE_OHOS | 39 | +#if defined(MS_COMPILE_OHOS) && defined(ENABLE_QOS) |
| 40 | SetThreadQos(QosLevel::QOS_USER_INTERACTIVE); | 40 | SetThreadQos(QosLevel::QOS_USER_INTERACTIVE); |
| 41 | #endif | 41 | #endif |
| 42 | (void)pthread_setname_np(pthread_self(), ("OS_Actor_" + std::to_string(index++)).c_str()); | 42 | (void)pthread_setname_np(pthread_self(), ("OS_Actor_" + std::to_string(index++)).c_str()); |
| @@ -13,26 +13,28 @@ | |||
| 13 | 13 | ||
| 14 | import("//build/ohos.gni") | 14 | import("//build/ohos.gni") |
| 15 | 15 | ||
| 16 | -group("mindspore_unit_test") { | 16 | +if (is_standard_system) { |
| 17 | - testonly = true | 17 | + group("mindspore_unit_test") { |
| 18 | - deps = [ "unittest:unit_test" ] | 18 | + testonly = true |
| 19 | -} | 19 | + deps = [ "unittest:unit_test" ] |
| 20 | + } | ||
| 20 | 21 | ||
| 21 | -group("mindspore_system_test") { | 22 | + group("mindspore_system_test") { |
| 22 | - testonly = true | 23 | + testonly = true |
| 23 | - deps = [ "systemtest:system_test" ] | 24 | + deps = [ "systemtest:system_test" ] |
| 24 | -} | 25 | + } |
| 25 | 26 | ||
| 26 | -group("mindspore_fuzz_test") { | 27 | + group("mindspore_fuzz_test") { |
| 27 | - testonly = true | 28 | + testonly = true |
| 28 | - deps = [ "fuzztest:fuzz_test" ] | 29 | + deps = [ "fuzztest:fuzz_test" ] |
| 29 | -} | 30 | + } |
| 30 | 31 | ||
| 31 | -group("mindspore_test_target") { | 32 | + group("mindspore_test_target") { |
| 32 | - testonly = true | 33 | + testonly = true |
| 33 | - deps = [] | 34 | + deps = [] |
| 34 | 35 | ||
| 35 | - deps += [ ":mindspore_unit_test" ] | 36 | + deps += [ ":mindspore_unit_test" ] |
| 36 | - deps += [ ":mindspore_system_test" ] | 37 | + deps += [ ":mindspore_system_test" ] |
| 37 | - deps += [ ":mindspore_fuzz_test" ] | 38 | + deps += [ ":mindspore_fuzz_test" ] |
| 39 | + } | ||
| 38 | } | 40 | } |


这里新增对small系统的支持,mindspore lite设计上仅支持standard,small和standard的差异是什么?