Skip to content

Commit

Permalink
[microNPU] Fix cascade scheduling stability (#13428)
Browse files Browse the repository at this point in the history
For Plans/Proposals added sorting by the number of cycles in case the memory used matches.
  • Loading branch information
Aleksei-grovety authored Dec 5, 2022
1 parent e7160d5 commit 012551f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/contrib/ethosu/cascader/pareto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ std::vector<Plan> ParetoCullPlans(std::vector<Plan> plans, size_t max_plans,
}

std::sort(plans.begin(), plans.end(), [](const Plan& a, const Plan& b) -> bool {
if (a->GetMemoryUsage() == b->GetMemoryUsage()) {
return a->GetCycles() < b->GetCycles();
}
return a->GetMemoryUsage() < b->GetMemoryUsage();
});
std::vector<std::array<float, 2>> costs;
Expand Down Expand Up @@ -122,6 +125,9 @@ std::vector<Proposal> ParetoCullProposals(std::vector<Proposal> proposals, size_
}

std::sort(proposals.begin(), proposals.end(), [](const Proposal& a, const Proposal& b) -> bool {
if (a->GetMemoryUsage() == b->GetMemoryUsage()) {
return a->GetCycles() < b->GetCycles();
}
return a->GetMemoryUsage() < b->GetMemoryUsage();
});
std::vector<std::array<float, 2>> costs;
Expand Down

0 comments on commit 012551f

Please sign in to comment.