From 5187f9096cb738e3f6e5176b167239546b8abac3 Mon Sep 17 00:00:00 2001 From: Raimund Merkert Date: Wed, 13 Nov 2024 08:03:29 -0500 Subject: [PATCH] Do not use SelingerProfileSipsMetric if no profile available. There is a bug #2426, which causes an assertion in the SelingerProfileSipsMetric::getReordering. Rther 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 #2 as that seems to be the safer option. I added code for a warning, but disabled it because it is incompatible with the ctest suite. --- src/ast2ram/utility/SipsMetric.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ast2ram/utility/SipsMetric.cpp b/src/ast2ram/utility/SipsMetric.cpp index fb94638d0db..3cf82a8df25 100644 --- a/src/ast2ram/utility/SipsMetric.cpp +++ b/src/ast2ram/utility/SipsMetric.cpp @@ -310,8 +310,15 @@ std::vector SelingerProfileSipsMetric::getReordering( /** Create a SIPS metric based on a given heuristic. */ std::unique_ptr SipsMetric::create(const std::string& heuristic, const TranslationUnit& tu) { if (tu.global().config().has("auto-schedule")) { - return mk(tu); - } else if (heuristic == "strict") + if (tu.getAnalysis().hasAutoSchedulerStats()) { + return mk(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(tu); else if (heuristic == "all-bound") return mk(tu);