Skip to content

Commit

Permalink
Do not use SelingerProfileSipsMetric if no profile available.
Browse files Browse the repository at this point in the history
There is a bug souffle-lang#2426, which causes an assertion in the
SelingerProfileSipsMetric::getReordering.
In our use case we cannot fail the compilation, if as long as
the datalog is valid. So, rather than fixing the problem I
decided to work-around it for the time being, until we have a
proper fix.

We can work around this problem in one of two ways:
1. don't assert and just don't reorder atoms (this should be fine)
2. don't create the metric in the first place, if there is no profile

I decided to use souffle-lang#2 as that seems to be the safer option. A warning
is printed if the scheduler cannot be used.
  • Loading branch information
strRM committed Nov 13, 2024
1 parent 03c741f commit aff8bd7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/ast2ram/utility/SipsMetric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,15 @@ std::vector<std::size_t> SelingerProfileSipsMetric::getReordering(
/** Create a SIPS metric based on a given heuristic. */
std::unique_ptr<SipsMetric> SipsMetric::create(const std::string& heuristic, const TranslationUnit& tu) {
if (tu.global().config().has("auto-schedule")) {
return mk<SelingerProfileSipsMetric>(tu);
} else if (heuristic == "strict")
if (tu.getAnalysis<ast::analysis::ProfileUseAnalysis>().hasAutoSchedulerStats()) {
return mk<SelingerProfileSipsMetric>(tu);
} else {
std::cerr << "WARNING: `--auto-schedule` cannot be used due to missing scheduler stats; falling back "
"to heuristic '"
<< heuristic << "'" << ::std::endl;
}
}
if (heuristic == "strict")
return mk<StrictSips>(tu);
else if (heuristic == "all-bound")
return mk<AllBoundSips>(tu);
Expand Down

0 comments on commit aff8bd7

Please sign in to comment.