Skip to content

Commit

Permalink
[CMSIS-NN] Add Cortex-M85 support (apache#13644)
Browse files Browse the repository at this point in the history
Added Cortex-M85 to the list of mprofiles maintained
for correct flag mappings: MVE and DSP.
  • Loading branch information
NicolaLancellotti authored and fzi-peccia committed Mar 27, 2023
1 parent 5ae63ac commit 9b0de0a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/target/parsers/mprofile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ const TargetFeatures kHasDSP = {{"has_dsp", Bool(true)}, {"has_mve", Bool(false)
const TargetFeatures kHasMVE = {{"has_dsp", Bool(true)}, {"has_mve", Bool(true)}};

static const char* baseCPUs[] = {"cortex-m0", "cortex-m3"};
static const char* dspCPUs[] = {"cortex-m55", "cortex-m4", "cortex-m7", "cortex-m33",
"cortex-m35p"};
static const char* mveCPUs[] = {"cortex-m55"};
static const char* dspCPUs[] = {"cortex-m55", "cortex-m4", "cortex-m7",
"cortex-m33", "cortex-m35p", "cortex-m85"};
static const char* mveCPUs[] = {"cortex-m55", "cortex-m85"};

template <typename Container>
static inline bool MatchesCpu(Optional<String> mcpu, const Container& cpus) {
Expand Down
16 changes: 14 additions & 2 deletions tests/cpp/relay/backend/contrib/cmsisnn/compiler_attrs_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,30 @@ TEST(CMSISNNTarget, CreateFromUndefined) {
ASSERT_EQ(target->GetFeature<Bool>("has_dsp").value_or(Bool(false)), Bool(false));
}

TEST(CMSISNNTarget, CreateFromContext) {
TEST(CMSISNNTarget, CreateFromContextCortexM55) {
Target target = GetTargetWithCompilerAttrs("cortex-m55", "");
ASSERT_EQ(target->GetFeature<Bool>("has_mve").value_or(Bool(false)), Bool(true));
ASSERT_EQ(target->GetFeature<Bool>("has_dsp").value_or(Bool(false)), Bool(true));
}

TEST(CMSISNNTarget, CreateFromContextWithAttrs) {
TEST(CMSISNNTarget, CreateFromContextWithAttrsCortexM55) {
Target target = GetTargetWithCompilerAttrs("cortex-m55", "+nomve");
ASSERT_EQ(target->GetFeature<Bool>("has_mve").value_or(Bool(false)), Bool(false));
ASSERT_EQ(target->GetFeature<Bool>("has_dsp").value_or(Bool(false)), Bool(true));
}

TEST(CMSISNNTarget, CreateFromContextCortexM85) {
Target target = GetTargetWithCompilerAttrs("cortex-m85", "");
ASSERT_EQ(target->GetFeature<Bool>("has_mve").value_or(Bool(false)), Bool(true));
ASSERT_EQ(target->GetFeature<Bool>("has_dsp").value_or(Bool(false)), Bool(true));
}

TEST(CMSISNNTarget, CreateFromContextWithAttrsCortexM85) {
Target target = GetTargetWithCompilerAttrs("cortex-m85", "+nomve");
ASSERT_EQ(target->GetFeature<Bool>("has_mve").value_or(Bool(false)), Bool(false));
ASSERT_EQ(target->GetFeature<Bool>("has_dsp").value_or(Bool(false)), Bool(true));
}

} // namespace cmsisnn
} // namespace contrib
} // namespace relay
Expand Down

0 comments on commit 9b0de0a

Please sign in to comment.