[polly] r326073 - isl: "isl_schedule_get_map: handle trees with divergent filter node parameters"

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 26 01:26:41 PST 2018


Author: grosser
Date: Mon Feb 26 01:26:41 2018
New Revision: 326073

URL: http://llvm.org/viewvc/llvm-project?rev=326073&view=rev
Log:
isl: "isl_schedule_get_map: handle trees with divergent filter node parameters"

Also un-revert (isl_pw_*_alloc: add missing check for compatible spaces, Wed Sep
6 12:18:04 2017 +0200).

This patch is a proposed fix to avoid asserts due to stricter space checking
within isl, which resulted in failures when converting a schedule tree to
a schedule map.

Modified:
    polly/trunk/lib/External/isl/isl_pw_templ.c
    polly/trunk/lib/External/isl/isl_schedule_tree.c
    polly/trunk/lib/External/isl/isl_test.c

Modified: polly/trunk/lib/External/isl/isl_pw_templ.c
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/isl_pw_templ.c?rev=326073&r1=326072&r2=326073&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/isl_pw_templ.c (original)
+++ polly/trunk/lib/External/isl/isl_pw_templ.c Mon Feb 26 01:26:41 2018
@@ -144,7 +144,7 @@ __isl_give PW *FN(PW,alloc)(__isl_take i
 {
 	PW *pw;
 
-	if (!set || !el)
+	if (FN(PW,check_compatible_domain)(el, set) < 0)
 		goto error;
 
 #ifdef HAS_TYPE

Modified: polly/trunk/lib/External/isl/isl_schedule_tree.c
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/isl_schedule_tree.c?rev=326073&r1=326072&r2=326073&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/isl_schedule_tree.c (original)
+++ polly/trunk/lib/External/isl/isl_schedule_tree.c Mon Feb 26 01:26:41 2018
@@ -1733,7 +1733,7 @@ static __isl_give isl_union_map *subtree
 	separate = n > 1 && (tree->type == isl_schedule_node_sequence ||
 			    isl_options_get_schedule_separate_components(ctx));
 
-	space = extract_space_from_filter_child(tree);
+	space = isl_space_params_alloc(ctx, 0);
 
 	umap = isl_union_map_empty(isl_space_copy(space));
 	space = isl_space_set_from_params(space);
@@ -1745,6 +1745,7 @@ static __isl_give isl_union_map *subtree
 
 	dim = isl_multi_val_dim(mv, isl_dim_set);
 	for (i = 0; i < n; ++i) {
+		isl_multi_val *mv_copy;
 		isl_union_pw_multi_aff *upma;
 		isl_union_map *umap_i;
 		isl_union_set *dom;
@@ -1760,8 +1761,10 @@ static __isl_give isl_union_map *subtree
 			mv = isl_multi_val_set_val(mv, 0, isl_val_copy(v));
 			v = isl_val_add_ui(v, 1);
 		}
-		upma = isl_union_pw_multi_aff_multi_val_on_domain(dom,
-							isl_multi_val_copy(mv));
+		mv_copy = isl_multi_val_copy(mv);
+		space = isl_union_set_get_space(dom);
+		mv_copy = isl_multi_val_align_params(mv_copy, space);
+		upma = isl_union_pw_multi_aff_multi_val_on_domain(dom, mv_copy);
 		umap_i = isl_union_map_from_union_pw_multi_aff(upma);
 		umap_i = isl_union_map_flat_range_product(
 					    isl_union_map_copy(outer), umap_i);

Modified: polly/trunk/lib/External/isl/isl_test.c
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/isl_test.c?rev=326073&r1=326072&r2=326073&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/isl_test.c (original)
+++ polly/trunk/lib/External/isl/isl_test.c Mon Feb 26 01:26:41 2018
@@ -6832,6 +6832,35 @@ static int test_compute_divs(isl_ctx *ct
 	return 0;
 }
 
+/* Check that isl_schedule_get_map is not confused by a schedule tree
+ * with divergent filter node parameters, as can result from a call
+ * to isl_schedule_intersect_domain.
+ */
+static int test_schedule_tree(isl_ctx *ctx)
+{
+	const char *str;
+	isl_union_set *uset;
+	isl_schedule *sched1, *sched2;
+	isl_union_map *umap;
+
+	uset = isl_union_set_read_from_str(ctx, "{ A[i] }");
+	sched1 = isl_schedule_from_domain(uset);
+	uset = isl_union_set_read_from_str(ctx, "{ B[] }");
+	sched2 = isl_schedule_from_domain(uset);
+
+	sched1 = isl_schedule_sequence(sched1, sched2);
+	str = "[n] -> { A[i] : 0 <= i < n; B[] }";
+	uset = isl_union_set_read_from_str(ctx, str);
+	sched1 = isl_schedule_intersect_domain(sched1, uset);
+	umap = isl_schedule_get_map(sched1);
+	isl_schedule_free(sched1);
+	isl_union_map_free(umap);
+	if (!umap)
+		return -1;
+
+	return 0;
+}
+
 /* Check that the reaching domain elements and the prefix schedule
  * at a leaf node are the same before and after grouping.
  */
@@ -7352,6 +7381,7 @@ struct {
 	{ "injective", &test_injective },
 	{ "schedule (whole component)", &test_schedule_whole },
 	{ "schedule (incremental)", &test_schedule_incremental },
+	{ "schedule tree", &test_schedule_tree },
 	{ "schedule tree grouping", &test_schedule_tree_group },
 	{ "tile", &test_tile },
 	{ "union_pw", &test_union_pw },




More information about the llvm-commits mailing list