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

[SME] Target parser support for SME #16794

Merged
merged 1 commit into from
Apr 2, 2024
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
3 changes: 2 additions & 1 deletion src/target/parsers/aprofile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ static TargetFeatures GetFeatures(TargetJSON target) {
{"has_sve", Bool(has_feature("sve"))},
{"has_dotprod", Bool(has_feature("dotprod"))},
{"has_matmul_i8", Bool(has_feature("i8mm"))},
{"has_fp16_simd", Bool(has_feature("fullfp16"))}};
{"has_fp16_simd", Bool(has_feature("fullfp16"))},
{"has_sme", Bool(has_feature("sme"))}};
#endif

LOG(WARNING) << "Cannot parse Arm(R)-based target features without LLVM support.";
Expand Down
17 changes: 17 additions & 0 deletions tests/cpp/target/parsers/aprofile_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ static float defaultI8MM = 8.6;
static float optionalI8MM[] = {8.2, 8.3, 8.4, 8.5};
static float defaultDotProd = 8.4;
static float optionalDotProd[] = {8.2, 8.3};
static float optionalSME[] = {9.2, 9.3};

static bool CheckArchitectureAvailability() {
#if TVM_LLVM_VERSION > 120
Expand Down Expand Up @@ -405,13 +406,29 @@ TEST(AProfileParserInvalid, LLVMUnsupportedArchitecture) {
}
}

using AProfileOptionalSME = AProfileParserTestWithParam;
TEST_P(AProfileOptionalSME, OptionalSMESupport) {
const std::string arch_attr = "+v9a";

TargetJSON target = ParseTargetWithAttrs("", "aarch64-arm-none-eabi", {arch_attr});
TargetFeatures features = Downcast<TargetFeatures>(target.at("features"));
ASSERT_TRUE(IsArch(target));
ASSERT_FALSE(Downcast<Bool>(features.at("has_sme")));

target = ParseTargetWithAttrs("", "aarch64-arm-none-eabi", {arch_attr, "+sme"});
features = Downcast<TargetFeatures>(target.at("features"));
ASSERT_TRUE(IsArch(target));
ASSERT_TRUE(Downcast<Bool>(features.at("has_sme")));
}

INSTANTIATE_TEST_SUITE_P(AProfileParser, AProfileOptionalI8MM, ::testing::ValuesIn(optionalI8MM));
INSTANTIATE_TEST_SUITE_P(AProfileParser, AProfileOptionalDotProd,
::testing::ValuesIn(optionalDotProd));
INSTANTIATE_TEST_SUITE_P(AProfileParser, AProfileOptionalSVE,
::testing::Values(8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9));
INSTANTIATE_TEST_SUITE_P(AProfileParser, AProfileOptionalFP16,
::testing::Values(8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9));
INSTANTIATE_TEST_SUITE_P(AProfileParser, AProfileOptionalSME, ::testing::ValuesIn(optionalSME));

} // namespace aprofile
} // namespace parsers
Expand Down
Loading