[polly] [Polly] Keep proximity dependence exact if simplifying it unbounds its distance (PR #225840)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 26 10:33:12 PDT 2026
================
@@ -656,6 +656,41 @@ static void printSchedule(llvm::raw_ostream &OS, const isl::schedule &Schedule,
}
#endif
+/// Return whether the dependence distances of @p Map, which relates instances
+/// of the same statement, are bounded.
+static bool hasBoundedDistances(const isl::map &Map) {
+ isl::set Deltas = Map.deltas();
+ return !Deltas.is_null() && isl_set_is_bounded(Deltas.get()) == isl_bool_true;
+}
+
+/// Undo the simplification of the proximity dependences of a statement on
+/// itself where it made their distances unbounded.
+///
+/// The scheduler looks for schedule rows that bound the distance of every
+/// proximity dependence. If the simplification drops the constraints of the
+/// domain that bound the distance of a dependence, such as a value that is
+/// read by all later iterations of a loop, then every row that advances along
+/// that loop has an unbounded distance, and the scheduler falls back to
+/// carrying dependences one row at a time instead of forming a permutable
+/// band.
+///
+/// @param Simplified The simplified proximity dependences.
+/// @param Exact The proximity dependences before simplification.
+static isl::union_map keepBoundedDistances(isl::union_map Simplified,
+ const isl::union_map &Exact) {
+ isl::union_map Result = isl::union_map::empty(Simplified.ctx());
+ for (isl::map Map : Simplified.get_map_list()) {
+ isl::space Space = Map.get_space();
+ if (Space.domain().is_equal(Space.range()) && !hasBoundedDistances(Map)) {
+ isl::map ExactMap = Exact.extract_map(Space);
+ if (hasBoundedDistances(ExactMap))
+ Map = ExactMap;
----------------
baitim wrote:
Addressed
https://github.com/llvm/llvm-project/pull/225840
More information about the llvm-commits
mailing list