You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by an...@apache.org on 2023/01/13 00:13:06 UTC
[tvm] branch main updated: [Target] Make `key=arm_cpu` --> `key=arm_cpu,cpu` on AArch64 (#13775)
This is an automated email from the ASF dual-hosted git repository.
andrewzhaoluo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 5878f6090b [Target] Make `key=arm_cpu` --> `key=arm_cpu,cpu` on AArch64 (#13775)
5878f6090b is described below
commit 5878f6090b11dd20c124b322fd76c47a00bbb985
Author: AndrewZhaoLuo <an...@gmail.com>
AuthorDate: Thu Jan 12 16:12:56 2023 -0800
[Target] Make `key=arm_cpu` --> `key=arm_cpu,cpu` on AArch64 (#13775)
* arm cpu is cpu
* init commit
* fix test
---
src/target/parsers/aprofile.cc | 10 ++++++----
tests/cpp/target/parsers/aprofile_test.cc | 3 ++-
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/target/parsers/aprofile.cc b/src/target/parsers/aprofile.cc
index 2fd5fe71e6..6b07124610 100644
--- a/src/target/parsers/aprofile.cc
+++ b/src/target/parsers/aprofile.cc
@@ -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;
}
diff --git a/tests/cpp/target/parsers/aprofile_test.cc b/tests/cpp/target/parsers/aprofile_test.cc
index 0382e7a84b..ffbc5fd431 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<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) {