Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fork Sync: Update from parent repository #2

Merged
merged 2 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions gallery/how_to/work_with_microtvm/install_cmsis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 1 addition & 7 deletions gallery/how_to/work_with_microtvm/micro_aot.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,14 @@
# 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"))

######################################################################
#
# .. include:: ../../../../gallery/how_to/work_with_microtvm/install_zephyr.rst
#

######################################################################
#
# .. include:: ../../../../gallery/how_to/work_with_microtvm/install_cmsis.rst
#

######################################################################
# Import Python dependencies
# -------------------------------
Expand Down Expand Up @@ -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"),
}

Expand Down
6 changes: 1 addition & 5 deletions gallery/how_to/work_with_microtvm/micro_autotune.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
8 changes: 1 addition & 7 deletions gallery/how_to/work_with_microtvm/micro_tflite.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,14 @@
# 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"))

######################################################################
#
# .. include:: ../../../../gallery/how_to/work_with_microtvm/install_zephyr.rst
#

######################################################################
#
# .. include:: ../../../../gallery/how_to/work_with_microtvm/install_cmsis.rst
#

######################################################################
# Import Python dependencies
# -------------------------------
Expand Down Expand Up @@ -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"),
}

Expand Down
10 changes: 6 additions & 4 deletions src/target/parsers/aprofile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,17 @@ static TargetFeatures GetFeatures(TargetJSON target) {
}

static Array<String> MergeKeys(Optional<Array<String>> existing_keys) {
const String kExtraKey = "arm_cpu";
const Array<String> kExtraKeys = {"arm_cpu", "cpu"};

if (!existing_keys) {
return {kExtraKey};
return kExtraKeys;
}

Array<String> 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;
}
Expand Down
3 changes: 2 additions & 1 deletion tests/cpp/target/parsers/aprofile_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ static TargetFeatures ParseTargetWithAttrs(String mcpu, String mtriple, Array<St
TEST(AProfileParser, ParseTargetKeys) {
TargetJSON target = ParseTarget({});
Array<String> keys = Downcast<Array<String>>(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) {
Expand Down