From d07d9a44cffd76e6276dea1edccb0d8381deee18 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 26 Mar 2012 12:55:35 +0200 Subject: [PATCH] isl_union_set_compute_schedule: only carry validity dependences If we are forced to try and carry come dependences because of some conflict, then we only need to carry those dependences that may lead to a conflict. That is, we only need to carry validity dependences. Signed-off-by: Sven Verdoolaege --- isl_schedule.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/isl_schedule.c b/isl_schedule.c index 3e56153..0807fce 100644 --- a/isl_schedule.c +++ b/isl_schedule.c @@ -1042,8 +1042,8 @@ static int node_update_cmap(struct isl_sched_node *node) /* Count the number of equality and inequality constraints * that will be added for the given map. - * If carry is set, then we are counting the number of constraints - * that will be added in setup_carry_lp and we count + * If carry is set, then we are counting the number of (validity) + * constraints that will be added in setup_carry_lp and we count * each edge exactly once. Otherwise, we count as follows * validity -> 1 (>= 0) * validity+proximity -> 2 (>= 0 and upper bound) @@ -1056,6 +1056,11 @@ static int count_map_constraints(struct isl_sched_graph *graph, isl_basic_set *coef; int f = carry ? 1 : edge->proximity ? 2 : 1; + if (carry && !edge->validity) { + isl_map_free(map); + return 0; + } + if (edge->src == edge->dst) coef = intra_coefficients(graph, map); else @@ -2110,7 +2115,7 @@ static int add_inter_constraints(struct isl_sched_graph *graph, return 0; } -/* Add constraints to graph->lp that force all dependences +/* Add constraints to graph->lp that force all validity dependences * to be respected and attempt to carry them. */ static int add_all_constraints(struct isl_sched_graph *graph) @@ -2121,6 +2126,10 @@ static int add_all_constraints(struct isl_sched_graph *graph) pos = 0; for (i = 0; i < graph->n_edge; ++i) { struct isl_sched_edge *edge= &graph->edge[i]; + + if (!edge->validity) + continue; + for (j = 0; j < edge->map->n; ++j) { isl_basic_map *bmap; isl_map *map; @@ -2198,7 +2207,7 @@ static int count_all_constraints(struct isl_sched_graph *graph, * - positive and negative parts of c_i_n (if parametric) * - positive and negative parts of c_i_x * - * The constraints are those from the edges plus three equalities + * The constraints are those from the (validity) edges plus three equalities * to express the sums and n_edge inequalities to express e_i <= 1. */ static int setup_carry_lp(isl_ctx *ctx, struct isl_sched_graph *graph) -- 2.7.4