diff --git a/gallery/how_to/work_with_microtvm/install_cmsis.rst b/gallery/how_to/work_with_microtvm/install_cmsis.rst index 2f1d2fb1189a5..13286b1b54f60 100644 --- a/gallery/how_to/work_with_microtvm/install_cmsis.rst +++ b/gallery/how_to/work_with_microtvm/install_cmsis.rst @@ -33,3 +33,7 @@ Install CMSIS-NN wget ${CMSIS_URL} -O "${DOWNLOAD_PATH}" tar -xf "${DOWNLOAD_PATH}" -C ${CMSIS_PATH} --strip-components=1 rm ${DOWNLOAD_PATH} + + CMSIS_NN_TAG="v4.0.0" + CMSIS_NN_URL="https://github.com/ARM-software/CMSIS-NN.git" + git clone ${CMSIS_NN_URL} --branch ${CMSIS_NN_TAG} --single-branch ${CMSIS_PATH}/CMSIS-NN diff --git a/gallery/how_to/work_with_microtvm/micro_aot.py b/gallery/how_to/work_with_microtvm/micro_aot.py index 81109b2965ef7..c1b29ba5c5820 100644 --- a/gallery/how_to/work_with_microtvm/micro_aot.py +++ b/gallery/how_to/work_with_microtvm/micro_aot.py @@ -41,7 +41,7 @@ # By default, this tutorial runs on x86 CPU using TVM's C runtime. If you would like # to run on real Zephyr hardware, you must export the `TVM_MICRO_USE_HW` environment # variable. Otherwise (if you are using the C runtime), you can skip installing -# Zephyr and CMSIS-NN. It takes ~20 minutes to install both of them. +# Zephyr. It takes ~20 minutes to install Zephyr. use_physical_hw = bool(os.getenv("TVM_MICRO_USE_HW")) ###################################################################### @@ -49,11 +49,6 @@ # .. include:: ../../../../gallery/how_to/work_with_microtvm/install_zephyr.rst # -###################################################################### -# -# .. include:: ../../../../gallery/how_to/work_with_microtvm/install_cmsis.rst -# - ###################################################################### # Import Python dependencies # ------------------------------- @@ -159,7 +154,6 @@ "board": BOARD, "serial_number": SERIAL, "config_main_stack_size": 4096, - "cmsis_path": os.getenv("CMSIS_PATH", default="/content/cmsis"), "zephyr_base": os.getenv("ZEPHYR_BASE", default="/content/zephyrproject/zephyr"), } diff --git a/gallery/how_to/work_with_microtvm/micro_autotune.py b/gallery/how_to/work_with_microtvm/micro_autotune.py index 9edb9ae75e7fb..9be257a57ac57 100644 --- a/gallery/how_to/work_with_microtvm/micro_autotune.py +++ b/gallery/how_to/work_with_microtvm/micro_autotune.py @@ -33,7 +33,7 @@ # -# You can skip the following two sections (installing Zephyr and CMSIS-NN) if the following flag is False. +# You can skip the following section (installing Zephyr) if the following flag is False. # Installing Zephyr takes ~20 min. import os @@ -44,10 +44,6 @@ # .. include:: ../../../../gallery/how_to/work_with_microtvm/install_zephyr.rst # -###################################################################### -# -# .. include:: ../../../../gallery/how_to/work_with_microtvm/install_cmsis.rst -# ###################################################################### # Import Python dependencies diff --git a/gallery/how_to/work_with_microtvm/micro_tflite.py b/gallery/how_to/work_with_microtvm/micro_tflite.py index 86e5d6b4b1aec..0770d472c9b81 100644 --- a/gallery/how_to/work_with_microtvm/micro_tflite.py +++ b/gallery/how_to/work_with_microtvm/micro_tflite.py @@ -36,7 +36,7 @@ # By default, this tutorial runs on x86 CPU using TVM's C runtime. If you would like # to run on real Zephyr hardware, you must export the `TVM_MICRO_USE_HW` environment # variable. Otherwise (if you are using the C runtime), you can skip installing -# Zephyr and CMSIS-NN. It takes ~20 minutes to install both of them. +# Zephyr. It takes ~20 minutes to install Zephyr. use_physical_hw = bool(os.getenv("TVM_MICRO_USE_HW")) ###################################################################### @@ -44,11 +44,6 @@ # .. include:: ../../../../gallery/how_to/work_with_microtvm/install_zephyr.rst # -###################################################################### -# -# .. include:: ../../../../gallery/how_to/work_with_microtvm/install_cmsis.rst -# - ###################################################################### # Import Python dependencies # ------------------------------- @@ -219,7 +214,6 @@ "board": BOARD, "serial_number": SERIAL, "config_main_stack_size": 4096, - "cmsis_path": os.getenv("CMSIS_PATH", default="/content/cmsis"), "zephyr_base": os.getenv("ZEPHYR_BASE", default="/content/zephyrproject/zephyr"), } diff --git a/src/target/parsers/aprofile.cc b/src/target/parsers/aprofile.cc index 2fd5fe71e617f..6b0712461026c 100644 --- a/src/target/parsers/aprofile.cc +++ b/src/target/parsers/aprofile.cc @@ -134,15 +134,17 @@ static TargetFeatures GetFeatures(TargetJSON target) { } static Array MergeKeys(Optional> existing_keys) { - const String kExtraKey = "arm_cpu"; + const Array kExtraKeys = {"arm_cpu", "cpu"}; if (!existing_keys) { - return {kExtraKey}; + return kExtraKeys; } Array keys = existing_keys.value(); - if (std::find(keys.begin(), keys.end(), kExtraKey) == keys.end()) { - keys.push_back(kExtraKey); + for (String key : kExtraKeys) { + if (std::find(keys.begin(), keys.end(), key) == keys.end()) { + keys.push_back(key); + } } return keys; } diff --git a/tests/cpp/target/parsers/aprofile_test.cc b/tests/cpp/target/parsers/aprofile_test.cc index 0382e7a84bd7e..ffbc5fd431a71 100644 --- a/tests/cpp/target/parsers/aprofile_test.cc +++ b/tests/cpp/target/parsers/aprofile_test.cc @@ -48,8 +48,9 @@ static TargetFeatures ParseTargetWithAttrs(String mcpu, String mtriple, Array keys = Downcast>(target.at("keys")); - ASSERT_EQ(keys.size(), 1); + ASSERT_EQ(keys.size(), 2); ASSERT_EQ(keys[0], "arm_cpu"); + ASSERT_EQ(keys[1], "cpu"); } TEST(AProfileParser, ParseTargetWithExistingKeys) {