* [PATCH 01/15] add more coalescing to simplify constraints
@ 2016-01-15 17:14 Sebastian Pop
2016-01-15 17:15 ` [PATCH 02/15] remove unused variable Sebastian Pop
` (12 more replies)
0 siblings, 13 replies; 15+ messages in thread
From: Sebastian Pop @ 2016-01-15 17:14 UTC (permalink / raw)
To: gcc-patches; +Cc: hiraditya, sebpop, richard.guenther, Sebastian Pop
From: Sebastian Pop <s.pop@samsung.com>
2015-12-30 Aditya Kumar <aditya.k7@samsung.com>
Sebastian Pop <s.pop@samsung.com>
* graphite-dependences.c (constrain_domain): Add call to isl_*_coalesce.
(add_pdr_constraints): Same.
(scop_get_reads): Same.
(scop_get_must_writes): Same.
(scop_get_may_writes): Same.
(scop_get_original_schedule): Same.
(extend_schedule): Same.
(apply_schedule_on_deps): Same.
(carries_deps): Same.
(compute_deps): Same.
(scop_get_dependences): Same.
* graphite-isl-ast-to-gimple.c
(translate_isl_ast_to_gimple::generate_isl_schedule): Same.
* graphite-optimize-isl.c (get_schedule_for_band): Same.
(get_schedule_for_band_list): Same.
(get_schedule_map): Same.
(apply_schedule_map_to_scop): Same.
* graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons): Same.
(build_loop_iteration_domains): Same.
(add_condition_to_pbb): Same.
(add_param_constraints): Same.
(pdr_add_memory_accesses): Same.
(pdr_add_data_dimensions): Same.
---
gcc/graphite-dependences.c | 63 ++++++++++++++++++----------------------
gcc/graphite-isl-ast-to-gimple.c | 2 ++
gcc/graphite-optimize-isl.c | 12 ++++----
gcc/graphite-sese-to-poly.c | 28 ++++++++++++------
4 files changed, 56 insertions(+), 49 deletions(-)
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index 46869d7..ae08059 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -49,7 +49,7 @@ constrain_domain (isl_map *map, isl_set *s)
s = isl_set_set_tuple_id (s, id);
isl_space_free (d);
- return isl_map_intersect_domain (map, s);
+ return isl_map_coalesce (isl_map_intersect_domain (map, s));
}
/* Constrain pdr->accesses with pdr->subscript_sizes and pbb->domain. */
@@ -59,8 +59,8 @@ add_pdr_constraints (poly_dr_p pdr, poly_bb_p pbb)
{
isl_map *x = isl_map_intersect_range (isl_map_copy (pdr->accesses),
isl_set_copy (pdr->subscript_sizes));
- x = constrain_domain (x, isl_set_copy (pbb->domain));
- return x;
+ x = isl_map_coalesce (x);
+ return constrain_domain (x, isl_set_copy (pbb->domain));
}
/* Returns all the memory reads in SCOP. */
@@ -93,7 +93,7 @@ scop_get_reads (scop_p scop, vec<poly_bb_p> pbbs)
}
}
- return res;
+ return isl_union_map_coalesce (res);
}
/* Returns all the memory must writes in SCOP. */
@@ -126,7 +126,7 @@ scop_get_must_writes (scop_p scop, vec<poly_bb_p> pbbs)
}
}
- return res;
+ return isl_union_map_coalesce (res);
}
/* Returns all the memory may writes in SCOP. */
@@ -159,7 +159,7 @@ scop_get_may_writes (scop_p scop, vec<poly_bb_p> pbbs)
}
}
- return res;
+ return isl_union_map_coalesce (res);
}
/* Returns all the original schedules in SCOP. */
@@ -179,7 +179,7 @@ scop_get_original_schedule (scop_p scop, vec<poly_bb_p> pbbs)
isl_set_copy (pbb->domain)));
}
- return res;
+ return isl_union_map_coalesce (res);
}
/* Helper function used on each MAP of a isl_union_map. Computes the
@@ -242,7 +242,7 @@ extend_schedule (__isl_take isl_union_map *x)
str.umap = isl_union_map_empty (isl_union_map_get_space (x));
isl_union_map_foreach_map (x, extend_schedule_1, (void *) &str);
isl_union_map_free (x);
- return str.umap;
+ return isl_union_map_coalesce (str.umap);
}
/* Applies SCHEDULE to the in and out dimensions of the dependences
@@ -252,22 +252,17 @@ static isl_map *
apply_schedule_on_deps (__isl_keep isl_union_map *schedule,
__isl_keep isl_union_map *deps)
{
- isl_map *x;
- isl_union_map *ux, *trans;
-
- trans = isl_union_map_copy (schedule);
- trans = extend_schedule (trans);
- ux = isl_union_map_copy (deps);
+ isl_union_map *trans = extend_schedule (isl_union_map_copy (schedule));
+ isl_union_map *ux = isl_union_map_copy (deps);
ux = isl_union_map_apply_domain (ux, isl_union_map_copy (trans));
ux = isl_union_map_apply_range (ux, trans);
- if (isl_union_map_is_empty (ux))
- {
- isl_union_map_free (ux);
- return NULL;
- }
- x = isl_map_from_union_map (ux);
+ ux = isl_union_map_coalesce (ux);
+
+ if (!isl_union_map_is_empty (ux))
+ return isl_map_from_union_map (ux);
- return x;
+ isl_union_map_free (ux);
+ return NULL;
}
/* Return true when DEPS is non empty and the intersection of LEX with
@@ -280,25 +275,19 @@ carries_deps (__isl_keep isl_union_map *schedule,
__isl_keep isl_union_map *deps,
int depth)
{
- bool res;
- int i;
- isl_space *space;
- isl_map *lex, *x;
- isl_constraint *ineq;
-
if (isl_union_map_is_empty (deps))
return false;
- x = apply_schedule_on_deps (schedule, deps);
+ isl_map *x = apply_schedule_on_deps (schedule, deps);
if (x == NULL)
return false;
- space = isl_map_get_space (x);
- space = isl_space_range (space);
- lex = isl_map_lex_le (space);
- space = isl_map_get_space (x);
- ineq = isl_inequality_alloc (isl_local_space_from_space (space));
- for (i = 0; i < depth - 1; i++)
+ isl_space *space = isl_map_get_space (x);
+ isl_map *lex = isl_map_lex_le (isl_space_range (space));
+ isl_constraint *ineq = isl_inequality_alloc
+ (isl_local_space_from_space (isl_map_get_space (x)));
+
+ for (int i = 0; i < depth - 1; i++)
lex = isl_map_equate (lex, isl_dim_in, i, isl_dim_out, i);
/* in + 1 <= out */
@@ -306,8 +295,9 @@ carries_deps (__isl_keep isl_union_map *schedule,
ineq = isl_constraint_set_coefficient_si (ineq, isl_dim_in, depth - 1, -1);
ineq = isl_constraint_set_constant_si (ineq, -1);
lex = isl_map_add_constraint (lex, ineq);
+ lex = isl_map_coalesce (lex);
x = isl_map_intersect (x, lex);
- res = !isl_map_is_empty (x);
+ bool res = !isl_map_is_empty (x);
isl_map_free (x);
return res;
@@ -336,6 +326,8 @@ compute_deps (scop_p scop, vec<poly_bb_p> pbbs,
isl_union_map *may_writes = scop_get_may_writes (scop, pbbs);
isl_union_map *all_writes = isl_union_map_union
(isl_union_map_copy (must_writes), isl_union_map_copy (may_writes));
+ all_writes = isl_union_map_coalesce (all_writes);
+
isl_space *space = isl_union_map_get_space (all_writes);
isl_union_map *empty = isl_union_map_empty (space);
isl_union_map *original = scop_get_original_schedule (scop, pbbs);
@@ -416,6 +408,7 @@ scop_get_dependences (scop_p scop)
dependences = isl_union_map_union (dependences, may_raw);
dependences = isl_union_map_union (dependences, may_war);
dependences = isl_union_map_union (dependences, may_waw);
+ dependences = isl_union_map_coalesce (dependences);
if (dump_file)
{
diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c
index 795232a..aaca9e9 100644
--- a/gcc/graphite-isl-ast-to-gimple.c
+++ b/gcc/graphite-isl-ast-to-gimple.c
@@ -3160,9 +3160,11 @@ translate_isl_ast_to_gimple::generate_isl_schedule (scop_p scop)
bb_schedule = isl_map_intersect_domain (bb_schedule,
isl_set_copy (pbb->domain));
bb_schedule = extend_schedule (bb_schedule, nb_schedule_dims);
+ bb_schedule = isl_map_coalesce (bb_schedule);
schedule_isl
= isl_union_map_union (schedule_isl,
isl_union_map_from_map (bb_schedule));
+ schedule_isl = isl_union_map_coalesce (schedule_isl);
}
return schedule_isl;
}
diff --git a/gcc/graphite-optimize-isl.c b/gcc/graphite-optimize-isl.c
index 9626e96..15dd5b0 100644
--- a/gcc/graphite-optimize-isl.c
+++ b/gcc/graphite-optimize-isl.c
@@ -241,6 +241,7 @@ get_schedule_for_band (isl_band *band, int *dimensions)
PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE));
tile_umap = isl_union_map_from_map (isl_map_from_basic_map (tile_map));
tile_umap = isl_union_map_align_params (tile_umap, space);
+ tile_umap = isl_union_map_coalesce (tile_umap);
*dimensions = 2 * *dimensions;
return isl_union_map_apply_range (partial_schedule, tile_umap);
@@ -292,14 +293,14 @@ get_schedule_for_band_list (isl_band_list *band_list)
isl_space_free (space);
}
- return schedule;
+ return isl_union_map_coalesce (schedule);
}
static isl_union_map *
get_schedule_map (isl_schedule *schedule)
{
- isl_band_list *bandList = isl_schedule_get_band_forest (schedule);
- isl_union_map *schedule_map = get_schedule_for_band_list (bandList);
+ isl_band_list *band_list = isl_schedule_get_band_forest (schedule);
+ isl_union_map *schedule_map = get_schedule_for_band_list (band_list);
isl_band_list_free (bandList);
return schedule_map;
}
@@ -327,15 +328,16 @@ apply_schedule_map_to_scop (scop_p scop, isl_union_map *schedule_map)
isl_union_map *stmt_band
= isl_union_map_intersect_domain (isl_union_map_copy (schedule_map),
isl_union_set_from_set (domain));
+ stmt_band = isl_union_map_coalesce (stmt_band);
isl_union_map_foreach_map (stmt_band, get_single_map, &stmt_schedule);
isl_map_free (pbb->transformed);
- pbb->transformed = stmt_schedule;
+ pbb->transformed = isl_map_coalesce (stmt_schedule);
isl_union_map_free (stmt_band);
}
}
static isl_union_set *
-scop_get_domains (scop_p scop ATTRIBUTE_UNUSED)
+scop_get_domains (scop_p scop)
{
int i;
poly_bb_p pbb;
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index a7fd5d9..78dc2fb 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -143,6 +143,10 @@ build_pbb_scattering_polyhedrons (isl_aff *static_sched,
}
}
+ /* Simplify the original schedule. */
+ pbb->schedule = isl_map_coalesce (pbb->schedule);
+
+ /* At the beginning, set the transformed schedule to the original. */
pbb->transformed = isl_map_copy (pbb->schedule);
}
@@ -482,7 +486,7 @@ build_loop_iteration_domains (scop_p scop, struct loop *loop,
isl_constraint *c = isl_inequality_alloc
(isl_local_space_from_space (isl_space_copy (space)));
c = isl_constraint_set_coefficient_si (c, isl_dim_set, pos, 1);
- inner = isl_set_add_constraint (inner, c);
+ inner = isl_set_coalesce (isl_set_add_constraint (inner, c));
/* loop_i <= cst_nb_iters */
if (TREE_CODE (nb_iters) == INTEGER_CST)
@@ -513,7 +517,8 @@ build_loop_iteration_domains (scop_p scop, struct loop *loop,
isl_set_dim (valid, isl_dim_set));
if (valid)
- scop->param_context = isl_set_intersect (scop->param_context, valid);
+ scop->param_context = isl_set_coalesce
+ (isl_set_intersect (scop->param_context, valid));
isl_local_space *ls = isl_local_space_from_space (isl_space_copy (space));
isl_aff *al = isl_aff_set_coefficient_si (isl_aff_zero_on_domain (ls),
@@ -541,7 +546,8 @@ build_loop_iteration_domains (scop_p scop, struct loop *loop,
isl_set *x = isl_pw_aff_ge_set (approx, aff);
x = isl_set_project_out (x, isl_dim_set, 0,
isl_set_dim (x, isl_dim_set));
- scop->param_context = isl_set_intersect (scop->param_context, x);
+ scop->param_context = isl_set_coalesce
+ (isl_set_intersect (scop->param_context, x));
isl_constraint *c = isl_inequality_alloc
(isl_local_space_from_space (isl_space_copy (space)));
@@ -557,6 +563,7 @@ build_loop_iteration_domains (scop_p scop, struct loop *loop,
else
gcc_unreachable ();
+ inner = isl_set_coalesce (inner);
if (loop->inner
&& !build_loop_iteration_domains (scop, loop->inner, nb + 1,
isl_set_copy (inner), doms))
@@ -648,7 +655,7 @@ add_condition_to_pbb (poly_bb_p pbb, gcond *stmt, enum tree_code code)
cond = isl_set_coalesce (cond);
cond = isl_set_set_tuple_id (cond, isl_set_get_tuple_id (pbb->domain));
- pbb->domain = isl_set_intersect (pbb->domain, cond);
+ pbb->domain = isl_set_coalesce (isl_set_intersect (pbb->domain, cond));
return true;
}
@@ -749,7 +756,8 @@ add_param_constraints (scop_p scop, graphite_dim_t p)
c = isl_constraint_set_constant_val (c, v);
c = isl_constraint_set_coefficient_si (c, isl_dim_param, p, 1);
- scop->param_context = isl_set_add_constraint (scop->param_context, c);
+ scop->param_context = isl_set_coalesce
+ (isl_set_add_constraint (scop->param_context, c));
}
if (ub)
@@ -768,7 +776,8 @@ add_param_constraints (scop_p scop, graphite_dim_t p)
c = isl_constraint_set_constant_val (c, v);
c = isl_constraint_set_coefficient_si (c, isl_dim_param, p, -1);
- scop->param_context = isl_set_add_constraint (scop->param_context, c);
+ scop->param_context = isl_set_coalesce
+ (isl_set_add_constraint (scop->param_context, c));
}
}
@@ -911,7 +920,7 @@ pdr_add_memory_accesses (isl_map *acc, dr_info &dri)
acc = set_index (acc, i + 1, aff);
}
- return acc;
+ return isl_map_coalesce (acc);
}
/* Return true when the LOW and HIGH bounds of an array reference REF are valid
@@ -972,7 +981,8 @@ pdr_add_data_dimensions (isl_set *subscript_sizes, scop_p scop,
isl_set *valid = isl_pw_aff_nonneg_set (isl_pw_aff_copy (ub));
valid = isl_set_project_out (valid, isl_dim_set, 0,
isl_set_dim (valid, isl_dim_set));
- scop->param_context = isl_set_intersect (scop->param_context, valid);
+ scop->param_context = isl_set_coalesce
+ (isl_set_intersect (scop->param_context, valid));
isl_aff *aff
= isl_aff_zero_on_domain (isl_local_space_from_space (space));
@@ -992,7 +1002,7 @@ pdr_add_data_dimensions (isl_set *subscript_sizes, scop_p scop,
subscript_sizes = isl_set_intersect (subscript_sizes, ubs);
}
- return subscript_sizes;
+ return isl_set_coalesce (subscript_sizes);
}
/* Build data accesses for DRI. */
--
2.5.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 04/15] add missing ast node for isl 0.15
2016-01-15 17:14 [PATCH 01/15] add more coalescing to simplify constraints Sebastian Pop
` (9 preceding siblings ...)
2016-01-15 17:15 ` [PATCH 13/15] reinstantiate loop blocking Sebastian Pop
@ 2016-01-15 17:15 ` Sebastian Pop
2016-01-15 17:16 ` [PATCH 12/15] new scop schedule Sebastian Pop
2016-01-21 14:22 ` [PATCH 01/15] add more coalescing to simplify constraints Matthew Wahab
12 siblings, 0 replies; 15+ messages in thread
From: Sebastian Pop @ 2016-01-15 17:15 UTC (permalink / raw)
To: gcc-patches; +Cc: hiraditya, sebpop, richard.guenther, Sebastian Pop
From: Sebastian Pop <s.pop@samsung.com>
* graphite-isl-ast-to-gimple.c (translate_isl_ast): Also handle
isl_ast_node_mark.
---
gcc/graphite-isl-ast-to-gimple.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c
index d143ef7..dad802f 100644
--- a/gcc/graphite-isl-ast-to-gimple.c
+++ b/gcc/graphite-isl-ast-to-gimple.c
@@ -1242,6 +1242,13 @@ translate_isl_ast_to_gimple::translate_isl_ast (loop_p context_loop,
case isl_ast_node_block:
return translate_isl_ast_node_block (context_loop, node,
next_e, ip);
+ case isl_ast_node_mark:
+ {
+ isl_ast_node *n = isl_ast_node_mark_get_node (node);
+ edge e = translate_isl_ast (context_loop, n, next_e, ip);
+ isl_ast_node_free (n);
+ return e;
+ }
default:
gcc_unreachable ();
--
2.5.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 08/15] record loops in execution order
2016-01-15 17:14 [PATCH 01/15] add more coalescing to simplify constraints Sebastian Pop
` (7 preceding siblings ...)
2016-01-15 17:15 ` [PATCH 09/15] fix memory leak in scop-detection Sebastian Pop
@ 2016-01-15 17:15 ` Sebastian Pop
2016-01-15 17:15 ` [PATCH 13/15] reinstantiate loop blocking Sebastian Pop
` (3 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Sebastian Pop @ 2016-01-15 17:15 UTC (permalink / raw)
To: gcc-patches; +Cc: hiraditya, sebpop, richard.guenther, Sebastian Pop
From: Sebastian Pop <s.pop@samsung.com>
* graphite-scop-detection.c (record_loop_in_sese): New.
(gather_bbs::before_dom_children): Call record_loop_in_sese.
(build_scops): Remove call to build_sese_loop_nests.
* sese.c (sese_record_loop): Remove.
(build_sese_loop_nests): Remove.
(new_sese_info): Remove region->loops.
(free_sese_info): Same.
* sese.h (sese_contains_loop): Same.
(build_sese_loop_nests): Remove.
(sese_contains_loop): Remove.
---
gcc/graphite-scop-detection.c | 29 ++++++++++++++++++++---
gcc/sese.c | 54 -------------------------------------------
gcc/sese.h | 10 --------
3 files changed, 26 insertions(+), 67 deletions(-)
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index e004185..be33be3 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1874,15 +1874,40 @@ gather_bbs::gather_bbs (cdi_direction direction, scop_p scop)
{
}
+/* Record in execution order the loops fully contained in the region. */
+
+static void
+record_loop_in_sese (basic_block bb, sese_info_p region)
+{
+ loop_p father = bb->loop_father;
+ if (loop_in_sese_p (father, region->region))
+ {
+ bool found = false;
+ loop_p loop0;
+ int j;
+ FOR_EACH_VEC_ELT (region->loop_nest, j, loop0)
+ if (father == loop0)
+ {
+ found = true;
+ break;
+ }
+ if (!found)
+ region->loop_nest.safe_push (father);
+ }
+}
+
/* Call-back for dom_walk executed before visiting the dominated
blocks. */
edge
gather_bbs::before_dom_children (basic_block bb)
{
- if (!bb_in_sese_p (bb, scop->scop_info->region))
+ sese_info_p region = scop->scop_info;
+ if (!bb_in_sese_p (bb, region->region))
return NULL;
+ record_loop_in_sese (bb, region);
+
gcond *stmt = single_pred_cond_non_loop_exit (bb);
if (stmt)
@@ -1991,8 +2016,6 @@ build_scops (vec<scop_p> *scops)
continue;
}
- build_sese_loop_nests (scop->scop_info);
-
find_scop_parameters (scop);
graphite_dim_t max_dim = PARAM_VALUE (PARAM_GRAPHITE_MAX_NB_SCOP_PARAMS);
diff --git a/gcc/sese.c b/gcc/sese.c
index b0f54de..2ecff7d 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -43,56 +43,6 @@ along with GCC; see the file COPYING3. If not see
#include "sese.h"
#include "tree-ssa-propagate.h"
-/* Record LOOP as occurring in REGION. */
-
-static void
-sese_record_loop (sese_info_p region, loop_p loop)
-{
- if (sese_contains_loop (region, loop))
- return;
-
- bitmap_set_bit (region->loops, loop->num);
- region->loop_nest.safe_push (loop);
-}
-
-/* Build the loop nests contained in REGION. Returns true when the
- operation was successful. */
-
-void
-build_sese_loop_nests (sese_info_p region)
-{
- unsigned i;
- basic_block bb;
- struct loop *loop0, *loop1;
-
- FOR_EACH_BB_FN (bb, cfun)
- if (bb_in_sese_p (bb, region->region))
- {
- struct loop *loop = bb->loop_father;
-
- /* Only add loops if they are completely contained in the SCoP. */
- if (loop->header == bb
- && bb_in_sese_p (loop->latch, region->region))
- sese_record_loop (region, loop);
- }
-
- /* Make sure that the loops in the SESE_LOOP_NEST are ordered. It
- can be the case that an inner loop is inserted before an outer
- loop. To avoid this, semi-sort once. */
- FOR_EACH_VEC_ELT (region->loop_nest, i, loop0)
- {
- if (region->loop_nest.length () == i + 1)
- break;
-
- loop1 = region->loop_nest[i + 1];
- if (loop0->num > loop1->num)
- {
- region->loop_nest[i] = loop1;
- region->loop_nest[i + 1] = loop0;
- }
- }
-}
-
/* For a USE in BB, if BB is outside REGION, mark the USE in the
LIVEOUTS set. */
@@ -228,7 +178,6 @@ new_sese_info (edge entry, edge exit)
region->region.entry = entry;
region->region.exit = exit;
- region->loops = BITMAP_ALLOC (NULL);
region->loop_nest.create (3);
region->params.create (3);
region->rename_map = new rename_map_t;
@@ -244,9 +193,6 @@ new_sese_info (edge entry, edge exit)
void
free_sese_info (sese_info_p region)
{
- if (region->loops)
- region->loops = BITMAP_ALLOC (NULL);
-
region->params.release ();
region->loop_nest.release ();
diff --git a/gcc/sese.h b/gcc/sese.h
index 99df354..f481524 100644
--- a/gcc/sese.h
+++ b/gcc/sese.h
@@ -86,7 +86,6 @@ typedef struct sese_info_t
rename_map_t *rename_map;
/* Loops completely contained in this SESE. */
- bitmap loops;
vec<loop_p> loop_nest;
/* Basic blocks contained in this SESE. */
@@ -107,20 +106,11 @@ typedef struct sese_info_t
extern sese_info_p new_sese_info (edge, edge);
extern void free_sese_info (sese_info_p);
extern void sese_insert_phis_for_liveouts (sese_info_p, basic_block, edge, edge);
-extern void build_sese_loop_nests (sese_info_p);
extern struct loop *outermost_loop_in_sese (sese_l &, basic_block);
extern tree scalar_evolution_in_region (const sese_l &, loop_p, tree);
extern bool scev_analyzable_p (tree, sese_l &);
extern bool invariant_in_sese_p_rec (tree, const sese_l &, bool *);
-/* Check that SESE contains LOOP. */
-
-static inline bool
-sese_contains_loop (sese_info_p sese, struct loop *loop)
-{
- return bitmap_bit_p (sese->loops, loop->num);
-}
-
/* The number of parameters in REGION. */
static inline unsigned
--
2.5.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 03/15] fix PR68343: disable graphite tests for isl 0.14 or earlier
2016-01-15 17:14 [PATCH 01/15] add more coalescing to simplify constraints Sebastian Pop
` (5 preceding siblings ...)
2016-01-15 17:15 ` [PATCH 06/15] fix codegen error exposed by compute isl flow patch Sebastian Pop
@ 2016-01-15 17:15 ` Sebastian Pop
2016-01-15 17:15 ` [PATCH 09/15] fix memory leak in scop-detection Sebastian Pop
` (5 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Sebastian Pop @ 2016-01-15 17:15 UTC (permalink / raw)
To: gcc-patches; +Cc: hiraditya, sebpop, richard.guenther
From: Aditya Kumar <hiraditya@msn.com>
The patch disables all optimizations when configuring gcc with isl 0.14 or earlier.
The next patch makes use of the schedule-trees that is only availaible in isl 0.15.
ChangeLog:
* Makefile.in: Regenerate.
* Makefile.tpl: Export ISLVER.
* configure: Regenerate.
* config/isl.m4: Detect isl-0.15.
gcc/
* Makefile.in: Set ISLVER in site.exp.
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Define HAVE_isl for isl-0.15.
* graphite-isl-ast-to-gimple.c: Remove #ifdefs related to isl-0.15.
* graphite-optimize-isl.c: Same.
* graphite.c: Same.
* graphite.h: Same.
* toplev.c: Same.
gcc/testsuite/
* g++.dg/graphite/graphite.exp: Only run the tests with isl-0.15.
* gcc.dg/graphite/graphite.exp: Same.
* gfortran.dg/graphite/graphite.exp: Same.
libgomp/
* config/isl.m4: New file.
* configure: Regenerate.
* configure.ac: Detect isl-0.15.
* testsuite/Makefile.am: Set ISLVER in libgomp-test-support.exp.
* testsuite/Makefile.in: Regenerate.
* testsuite/libgomp.graphite/graphite.exp: Only run the tests with
isl-0.15.
---
Makefile.in | 2 +
Makefile.tpl | 2 +
config/isl.m4 | 12 ++
configure | 29 ++++
gcc/Makefile.in | 1 +
gcc/config.in | 6 -
gcc/configure | 43 +----
gcc/configure.ac | 26 +--
gcc/graphite-isl-ast-to-gimple.c | 18 --
gcc/graphite-optimize-isl.c | 208 ------------------------
gcc/graphite.c | 12 +-
gcc/graphite.h | 9 -
gcc/testsuite/g++.dg/graphite/graphite.exp | 5 +
gcc/testsuite/gcc.dg/graphite/graphite.exp | 5 +
gcc/testsuite/gfortran.dg/graphite/graphite.exp | 5 +
gcc/toplev.c | 6 +-
libgomp/config/isl.m4 | 158 ++++++++++++++++++
libgomp/configure | 201 ++++++++++++++++++++++-
libgomp/configure.ac | 24 +++
libgomp/testsuite/Makefile.am | 2 +
libgomp/testsuite/Makefile.in | 3 +
libgomp/testsuite/libgomp.graphite/graphite.exp | 5 +
22 files changed, 468 insertions(+), 314 deletions(-)
create mode 100644 libgomp/config/isl.m4
diff --git a/Makefile.in b/Makefile.in
index e9b5950..d2c5b9f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -222,6 +222,7 @@ HOST_EXPORTS = \
GMPINC="$(HOST_GMPINC)"; export GMPINC; \
ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \
ISLINC="$(HOST_ISLINC)"; export ISLINC; \
+ ISLVER="$(HOST_ISLVER)"; export ISLVER; \
LIBELFLIBS="$(HOST_LIBELFLIBS)"; export LIBELFLIBS; \
LIBELFINC="$(HOST_LIBELFINC)"; export LIBELFINC; \
XGCC_FLAGS_FOR_TARGET="$(XGCC_FLAGS_FOR_TARGET)"; export XGCC_FLAGS_FOR_TARGET; \
@@ -315,6 +316,7 @@ HOST_GMPINC = @gmpinc@
# Where to find isl
HOST_ISLLIBS = @isllibs@
HOST_ISLINC = @islinc@
+HOST_ISLVER = @islver@
# Where to find libelf
HOST_LIBELFLIBS = @libelflibs@
diff --git a/Makefile.tpl b/Makefile.tpl
index f7bb77e..88c2810 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -225,6 +225,7 @@ HOST_EXPORTS = \
GMPINC="$(HOST_GMPINC)"; export GMPINC; \
ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \
ISLINC="$(HOST_ISLINC)"; export ISLINC; \
+ ISLVER="$(HOST_ISLVER)"; export ISLVER; \
LIBELFLIBS="$(HOST_LIBELFLIBS)"; export LIBELFLIBS; \
LIBELFINC="$(HOST_LIBELFINC)"; export LIBELFINC; \
XGCC_FLAGS_FOR_TARGET="$(XGCC_FLAGS_FOR_TARGET)"; export XGCC_FLAGS_FOR_TARGET; \
@@ -318,6 +319,7 @@ HOST_GMPINC = @gmpinc@
# Where to find isl
HOST_ISLLIBS = @isllibs@
HOST_ISLINC = @islinc@
+HOST_ISLVER = @islver@
# Where to find libelf
HOST_LIBELFLIBS = @libelflibs@
diff --git a/config/isl.m4 b/config/isl.m4
index 86ccb94..2cfeb46 100644
--- a/config/isl.m4
+++ b/config/isl.m4
@@ -117,6 +117,18 @@ AC_DEFUN([ISL_CHECK_VERSION],
AC_MSG_RESULT([recommended isl version is 0.15, minimum required isl version 0.14 is deprecated])
fi
+ AC_MSG_CHECKING([Checking for isl-0.15])
+ AC_TRY_LINK([#include <isl/schedule.h>],
+ [isl_options_set_schedule_serialize_sccs (NULL, 0);],
+ [ac_has_isl_options_set_schedule_serialize_sccs=yes],
+ [ac_has_isl_options_set_schedule_serialize_sccs=no])
+ AC_MSG_RESULT($ac_has_isl_options_set_schedule_serialize_sccs)
+
+ if test x"$ac_has_isl_options_set_schedule_serialize_sccs" = x"yes"; then
+ islver="0.15"
+ AC_SUBST([islver])
+ fi
+
CFLAGS=$_isl_saved_CFLAGS
LDFLAGS=$_isl_saved_LDFLAGS
LIBS=$_isl_saved_LIBS
diff --git a/configure b/configure
index f5786ed..d4e3675 100755
--- a/configure
+++ b/configure
@@ -650,6 +650,7 @@ extra_linker_plugin_flags
extra_linker_plugin_configure_flags
islinc
isllibs
+islver
poststage1_ldflags
poststage1_libs
stage1_ldflags
@@ -6048,6 +6049,34 @@ $as_echo "$gcc_cv_isl" >&6; }
$as_echo "recommended isl version is 0.15, minimum required isl version 0.14 is deprecated" >&6; }
fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Checking for isl-0.15" >&5
+$as_echo_n "checking Checking for isl-0.15... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <isl/schedule.h>
+int
+main ()
+{
+isl_options_set_schedule_serialize_sccs (NULL, 0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_has_isl_options_set_schedule_serialize_sccs=yes
+else
+ ac_has_isl_options_set_schedule_serialize_sccs=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_has_isl_options_set_schedule_serialize_sccs" >&5
+$as_echo "$ac_has_isl_options_set_schedule_serialize_sccs" >&6; }
+
+ if test x"$ac_has_isl_options_set_schedule_serialize_sccs" = x"yes"; then
+ islver="0.15"
+
+ fi
+
CFLAGS=$_isl_saved_CFLAGS
LDFLAGS=$_isl_saved_LDFLAGS
LIBS=$_isl_saved_LIBS
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 726fcbb..a83e776 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3691,6 +3691,7 @@ site.exp: ./config.status Makefile
echo "set PLUGINCFLAGS \"$(PLUGINCFLAGS)\"" >> ./site.tmp; \
echo "set GMPINC \"$(GMPINC)\"" >> ./site.tmp; \
fi
+ @echo "set ISLVER \"$(ISLVER)\"" >> ./site.tmp
# If newlib has been configured, we need to pass -B to gcc so it can find
# newlib's crt0.o if it exists. This will cause a "path prefix not used"
# message if it doesn't, but the testsuite is supposed to ignore the message -
diff --git a/gcc/config.in b/gcc/config.in
index c00cd0f..91475ee 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1378,12 +1378,6 @@
#endif
-/* Define if isl_options_set_schedule_serialize_sccs exists. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
-#endif
-
-
/* Define to 1 if you have the `kill' function. */
#ifndef USED_FOR_TARGET
#undef HAVE_KILL
diff --git a/gcc/configure b/gcc/configure
index e6eb999..df92baf 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -28926,49 +28926,12 @@ fi
-if test "x${ISLLIBS}" != "x" ; then
-
-$as_echo "#define HAVE_isl 1" >>confdefs.h
-fi
-
-# Check whether isl_options_set_schedule_serialize_sccs is available;
-# it's new in isl 0.15.
+# Check whether isl 0.15 is available.
if test "x${ISLLIBS}" != "x" ; then
- saved_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $ISLINC"
- saved_LIBS="$LIBS"
- LIBS="$LIBS $ISLLIBS $GMPLIBS"
+ if test x"$ISLVER" = x"0.15"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Checking for isl_options_set_schedule_serialize_sccs" >&5
-$as_echo_n "checking Checking for isl_options_set_schedule_serialize_sccs... " >&6; }
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <isl/schedule.h>
-int
-main ()
-{
-isl_options_set_schedule_serialize_sccs (NULL, 0);
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
- ac_has_isl_options_set_schedule_serialize_sccs=yes
-else
- ac_has_isl_options_set_schedule_serialize_sccs=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_has_isl_options_set_schedule_serialize_sccs" >&5
-$as_echo "$ac_has_isl_options_set_schedule_serialize_sccs" >&6; }
-
- LIBS="$saved_LIBS"
- CXXFLAGS="$saved_CXXFLAGS"
-
- if test x"$ac_has_isl_options_set_schedule_serialize_sccs" = x"yes"; then
-
-$as_echo "#define HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS 1" >>confdefs.h
+$as_echo "#define HAVE_isl 1" >>confdefs.h
fi
fi
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 3aa2737..4edd7ef 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -5910,31 +5910,11 @@ AC_ARG_VAR(GMPINC,[How to find GMP include files])
AC_ARG_VAR(ISLLIBS,[How to link isl])
AC_ARG_VAR(ISLINC,[How to find isl include files])
-if test "x${ISLLIBS}" != "x" ; then
- AC_DEFINE(HAVE_isl, 1, [Define if isl is in use.])
-fi
-# Check whether isl_options_set_schedule_serialize_sccs is available;
-# it's new in isl 0.15.
+# Check whether isl 0.15 is available.
if test "x${ISLLIBS}" != "x" ; then
- saved_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $ISLINC"
- saved_LIBS="$LIBS"
- LIBS="$LIBS $ISLLIBS $GMPLIBS"
-
- AC_MSG_CHECKING([Checking for isl_options_set_schedule_serialize_sccs])
- AC_TRY_LINK([#include <isl/schedule.h>],
- [isl_options_set_schedule_serialize_sccs (NULL, 0);],
- [ac_has_isl_options_set_schedule_serialize_sccs=yes],
- [ac_has_isl_options_set_schedule_serialize_sccs=no])
- AC_MSG_RESULT($ac_has_isl_options_set_schedule_serialize_sccs)
-
- LIBS="$saved_LIBS"
- CXXFLAGS="$saved_CXXFLAGS"
-
- if test x"$ac_has_isl_options_set_schedule_serialize_sccs" = x"yes"; then
- AC_DEFINE(HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS, 1,
- [Define if isl_options_set_schedule_serialize_sccs exists.])
+ if test x"$ISLVER" = x"0.15"; then
+ AC_DEFINE(HAVE_isl, 1, [Define if isl is in use.])
fi
fi
diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c
index aaca9e9..d143ef7 100644
--- a/gcc/graphite-isl-ast-to-gimple.c
+++ b/gcc/graphite-isl-ast-to-gimple.c
@@ -115,8 +115,6 @@ void ivs_params_clear (ivs_params &ip)
}
}
-#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
-
/* Set the "separate" option for the schedule node. */
static __isl_give isl_schedule_node *
@@ -136,7 +134,6 @@ set_separate_option (__isl_take isl_schedule_node *node, void *user)
return node;
}
-#endif
class translate_isl_ast_to_gimple
{
@@ -303,13 +300,11 @@ class translate_isl_ast_to_gimple
__isl_give isl_union_map *generate_isl_schedule (scop_p scop);
-#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
/* Set the "separate" option for all schedules. This helps reducing control
overhead. */
__isl_give isl_schedule *
set_options_for_schedule_tree (__isl_take isl_schedule *schedule);
-#endif
/* Set the separate option for all dimensions.
This helps to reduce control overhead. */
@@ -601,10 +596,7 @@ binary_op_to_tree (tree type, __isl_take isl_ast_expr *expr, ivs_params &ip)
}
return fold_build2 (TRUNC_DIV_EXPR, type, tree_lhs_expr, tree_rhs_expr);
-#if HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
- /* isl 0.15 or later. */
case isl_ast_op_zdiv_r:
-#endif
case isl_ast_op_pdiv_r:
/* As isl operates on arbitrary precision numbers, we may end up with
division by 2^64 that is folded to 0. */
@@ -775,10 +767,7 @@ gcc_expression_from_isl_expr_op (tree type, __isl_take isl_ast_expr *expr,
case isl_ast_op_pdiv_q:
case isl_ast_op_pdiv_r:
case isl_ast_op_fdiv_q:
-#if HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
- /* isl 0.15 or later. */
case isl_ast_op_zdiv_r:
-#endif
case isl_ast_op_and:
case isl_ast_op_or:
case isl_ast_op_eq:
@@ -3186,7 +3175,6 @@ ast_build_before_for (__isl_keep isl_ast_build *build, void *user)
return id;
}
-#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
/* Set the separate option for all schedules. This helps reducing control
overhead. */
@@ -3197,7 +3185,6 @@ translate_isl_ast_to_gimple::set_options_for_schedule_tree
return isl_schedule_map_schedule_node_bottom_up
(schedule, set_separate_option, NULL);
}
-#endif
/* Set the separate option for all dimensions.
This helps to reduce control overhead. */
@@ -3242,7 +3229,6 @@ translate_isl_ast_to_gimple::scop_to_isl_ast (scop_p scop, ivs_params &ip)
dependence);
}
-#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
if (scop->schedule)
{
scop->schedule = set_options_for_schedule_tree (scop->schedule);
@@ -3251,10 +3237,6 @@ translate_isl_ast_to_gimple::scop_to_isl_ast (scop_p scop, ivs_params &ip)
}
else
ast_isl = isl_ast_build_ast_from_schedule (context_isl, schedule_isl);
-#else
- ast_isl = isl_ast_build_ast_from_schedule (context_isl, schedule_isl);
- isl_schedule_free (scop->schedule);
-#endif
isl_ast_build_free (context_isl);
return ast_isl;
diff --git a/gcc/graphite-optimize-isl.c b/gcc/graphite-optimize-isl.c
index 15dd5b0..1565219 100644
--- a/gcc/graphite-optimize-isl.c
+++ b/gcc/graphite-optimize-isl.c
@@ -39,9 +39,6 @@ along with GCC; see the file COPYING3. If not see
#include "dumpfile.h"
#include "graphite.h"
-#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
-/* isl 0.15 or later. */
-
/* get_schedule_for_node_st - Improve schedule for the schedule node.
Only Simple loop tiling is considered. */
@@ -110,201 +107,6 @@ get_schedule_map_st (__isl_keep isl_schedule *schedule)
isl_union_map *schedule_map = isl_schedule_get_map (schedule);
return schedule_map;
}
-#else
-
-/* get_tile_map - Create a map that describes a n-dimensonal tiling.
-
- get_tile_map creates a map from a n-dimensional scattering space into an
- 2*n-dimensional scattering space. The map describes a rectangular tiling.
-
- Example:
- SCHEDULE_DIMENSIONS = 2, PARAMETER_DIMENSIONS = 1, TILE_SIZE = 32
-
- tile_map := [p0] -> {[s0, s1] -> [t0, t1, s0, s1]:
- t0 % 32 = 0 and t0 <= s0 < t0 + 32 and
- t1 % 32 = 0 and t1 <= s1 < t1 + 32}
-
- Before tiling:
-
- for (i = 0; i < N; i++)
- for (j = 0; j < M; j++)
- S(i,j)
-
- After tiling:
-
- for (t_i = 0; t_i < N; i+=32)
- for (t_j = 0; t_j < M; j+=32)
- for (i = t_i; i < min(t_i + 32, N); i++) | Unknown that N % 32 = 0
- for (j = t_j; j < t_j + 32; j++) | Known that M % 32 = 0
- S(i,j)
- */
-
-static isl_basic_map *
-get_tile_map (isl_ctx *ctx, int schedule_dimensions, int tile_size)
-{
- /* We construct
-
- tile_map := [p0] -> {[s0, s1] -> [t0, t1, p0, p1, a0, a1]:
- s0 = a0 * 32 and s0 = p0 and t0 <= p0 < t0 + 32 and
- s1 = a1 * 32 and s1 = p1 and t1 <= p1 < t1 + 32}
-
- and project out the auxilary dimensions a0 and a1. */
- isl_space *space
- = isl_space_alloc (ctx, 0, schedule_dimensions, schedule_dimensions * 3);
- isl_basic_map *tile_map = isl_basic_map_universe (isl_space_copy (space));
-
- isl_local_space *local_space = isl_local_space_from_space (space);
-
- for (int x = 0; x < schedule_dimensions; x++)
- {
- int sX = x;
- int tX = x;
- int pX = schedule_dimensions + x;
- int aX = 2 * schedule_dimensions + x;
-
- isl_constraint *c;
-
- /* sX = aX * tile_size; */
- c = isl_equality_alloc (isl_local_space_copy (local_space));
- isl_constraint_set_coefficient_si (c, isl_dim_out, sX, 1);
- isl_constraint_set_coefficient_si (c, isl_dim_out, aX, -tile_size);
- tile_map = isl_basic_map_add_constraint (tile_map, c);
-
- /* pX = sX; */
- c = isl_equality_alloc (isl_local_space_copy (local_space));
- isl_constraint_set_coefficient_si (c, isl_dim_out, pX, 1);
- isl_constraint_set_coefficient_si (c, isl_dim_in, sX, -1);
- tile_map = isl_basic_map_add_constraint (tile_map, c);
-
- /* tX <= pX */
- c = isl_inequality_alloc (isl_local_space_copy (local_space));
- isl_constraint_set_coefficient_si (c, isl_dim_out, pX, 1);
- isl_constraint_set_coefficient_si (c, isl_dim_out, tX, -1);
- tile_map = isl_basic_map_add_constraint (tile_map, c);
-
- /* pX <= tX + (tile_size - 1) */
- c = isl_inequality_alloc (isl_local_space_copy (local_space));
- isl_constraint_set_coefficient_si (c, isl_dim_out, tX, 1);
- isl_constraint_set_coefficient_si (c, isl_dim_out, pX, -1);
- isl_constraint_set_constant_si (c, tile_size - 1);
- tile_map = isl_basic_map_add_constraint (tile_map, c);
- }
-
- /* Project out auxiliary dimensions.
-
- The auxiliary dimensions are transformed into existentially quantified
- ones.
- This reduces the number of visible scattering dimensions and allows isl
- to produces better code. */
- tile_map =
- isl_basic_map_project_out (tile_map, isl_dim_out,
- 2 * schedule_dimensions, schedule_dimensions);
- isl_local_space_free (local_space);
- return tile_map;
-}
-
-/* get_schedule_for_band - Get the schedule for this BAND.
-
- Polly applies transformations like tiling on top of the isl calculated
- value.
- This can influence the number of scheduling dimension. The number of
- schedule dimensions is returned in DIMENSIONS. */
-
-static isl_union_map *
-get_schedule_for_band (isl_band *band, int *dimensions)
-{
- isl_union_map *partial_schedule;
- isl_ctx *ctx;
- isl_space *space;
- isl_basic_map *tile_map;
- isl_union_map *tile_umap;
-
- partial_schedule = isl_band_get_partial_schedule (band);
- *dimensions = isl_band_n_member (band);
-
- /* It does not make any sense to tile a band with just one dimension. */
- if (*dimensions == 1)
- {
- if (dump_file && dump_flags)
- fprintf (dump_file, "not tiled\n");
- return partial_schedule;
- }
-
- if (dump_file && dump_flags)
- fprintf (dump_file, "tiled by %d\n",
- PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE));
-
- ctx = isl_union_map_get_ctx (partial_schedule);
- space = isl_union_map_get_space (partial_schedule);
-
- tile_map = get_tile_map (ctx, *dimensions,
- PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE));
- tile_umap = isl_union_map_from_map (isl_map_from_basic_map (tile_map));
- tile_umap = isl_union_map_align_params (tile_umap, space);
- tile_umap = isl_union_map_coalesce (tile_umap);
- *dimensions = 2 * *dimensions;
-
- return isl_union_map_apply_range (partial_schedule, tile_umap);
-}
-
-
-/* get_schedule_for_band_list - Get the scheduling map for a list of bands.
-
- We walk recursively the forest of bands to combine the schedules of the
- individual bands to the overall schedule. In case tiling is requested,
- the individual bands are tiled. */
-
-static isl_union_map *
-get_schedule_for_band_list (isl_band_list *band_list)
-{
- int num_bands, i;
- isl_union_map *schedule;
- isl_ctx *ctx;
-
- ctx = isl_band_list_get_ctx (band_list);
- num_bands = isl_band_list_n_band (band_list);
- schedule = isl_union_map_empty (isl_space_params_alloc (ctx, 0));
-
- for (i = 0; i < num_bands; i++)
- {
- isl_band *band;
- isl_union_map *partial_schedule;
- int schedule_dimensions;
- isl_space *space;
-
- band = isl_band_list_get_band (band_list, i);
- partial_schedule = get_schedule_for_band (band, &schedule_dimensions);
- space = isl_union_map_get_space (partial_schedule);
-
- if (isl_band_has_children (band))
- {
- isl_band_list *children = isl_band_get_children (band);
- isl_union_map *suffixSchedule
- = get_schedule_for_band_list (children);
- partial_schedule
- = isl_union_map_flat_range_product (partial_schedule,
- suffixSchedule);
- isl_band_list_free (children);
- }
-
- schedule = isl_union_map_union (schedule, partial_schedule);
-
- isl_band_free (band);
- isl_space_free (space);
- }
-
- return isl_union_map_coalesce (schedule);
-}
-
-static isl_union_map *
-get_schedule_map (isl_schedule *schedule)
-{
- isl_band_list *band_list = isl_schedule_get_band_forest (schedule);
- isl_union_map *schedule_map = get_schedule_for_band_list (band_list);
- isl_band_list_free (bandList);
- return schedule_map;
-}
-#endif
static isl_stat
get_single_map (__isl_take isl_map *map, void *user)
@@ -375,8 +177,6 @@ optimize_isl (scop_p scop)
isl_options_set_schedule_max_constant_term (scop->isl_context, CONSTANT_BOUND);
isl_options_set_schedule_maximize_band_depth (scop->isl_context, 1);
-#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
- /* isl 0.15 or later. */
isl_options_set_schedule_serialize_sccs (scop->isl_context, 0);
isl_options_set_schedule_maximize_band_depth (scop->isl_context, 1);
isl_options_set_schedule_max_constant_term (scop->isl_context, 20);
@@ -385,9 +185,6 @@ optimize_isl (scop_p scop)
isl_options_set_coalesce_bounded_wrapping (scop->isl_context, 1);
isl_options_set_ast_build_exploit_nested_bounds (scop->isl_context, 1);
isl_options_set_ast_build_atomic_upper_bound (scop->isl_context, 1);
-#else
- isl_options_set_schedule_fuse (scop->isl_context, ISL_SCHEDULE_FUSE_MIN);
-#endif
isl_schedule *schedule
= isl_union_set_compute_schedule (domain, validity, proximity);
@@ -409,12 +206,7 @@ optimize_isl (scop_p scop)
schedule freeing will occur in code generation. */
scop->schedule = schedule;
-#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
- /* isl 0.15 or later. */
isl_union_map *schedule_map = get_schedule_map_st (schedule);
-#else
- isl_union_map *schedule_map = get_schedule_map (schedule);
-#endif
apply_schedule_map_to_scop (scop, schedule_map);
isl_union_map_free (schedule_map);
diff --git a/gcc/graphite.c b/gcc/graphite.c
index 8d0d24c..877a0fb 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -341,10 +341,11 @@ graphite_transform_loops (void)
static void
graphite_transform_loops (void)
{
- sorry ("Graphite loop optimizations cannot be used (isl is not available).");
+ /* Do not error when graphite is not supported. */
+ return;
}
-#endif
+#endif /* #ifdef HAVE_isl */
static unsigned int
@@ -361,6 +362,11 @@ graphite_transforms (struct function *fun)
static bool
gate_graphite_transforms (void)
{
+#ifndef HAVE_isl
+ /* Graphite is not supported for isl version 0.14 or earlier. */
+ return false;
+#endif
+
/* Enable -fgraphite pass if any one of the graphite optimization flags
is turned on. */
if (flag_graphite_identity
@@ -441,5 +447,3 @@ make_pass_graphite_transforms (gcc::context *ctxt)
{
return new pass_graphite_transforms (ctxt);
}
-
-
diff --git a/gcc/graphite.h b/gcc/graphite.h
index f9af292..5a6677a 100644
--- a/gcc/graphite.h
+++ b/gcc/graphite.h
@@ -36,17 +36,8 @@ along with GCC; see the file COPYING3. If not see
#include <isl/ilp.h>
#include <isl/schedule.h>
#include <isl/ast_build.h>
-
-#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
-/* isl 0.15 or later. */
#include <isl/schedule_node.h>
-#else
-/* isl 0.14 or 0.13. */
-# define isl_stat int
-# define isl_stat_ok 0
-#endif
-
typedef struct poly_dr *poly_dr_p;
typedef struct poly_bb *poly_bb_p;
diff --git a/gcc/testsuite/g++.dg/graphite/graphite.exp b/gcc/testsuite/g++.dg/graphite/graphite.exp
index 2d85cf7..639e6e9 100644
--- a/gcc/testsuite/g++.dg/graphite/graphite.exp
+++ b/gcc/testsuite/g++.dg/graphite/graphite.exp
@@ -19,6 +19,11 @@
# Load support procs.
load_lib g++-dg.exp
+global ISLVER
+if { $ISLVER != "0.15" } {
+ return
+}
+
if ![check_effective_target_fgraphite] {
return
}
diff --git a/gcc/testsuite/gcc.dg/graphite/graphite.exp b/gcc/testsuite/gcc.dg/graphite/graphite.exp
index 8e1a229..9ad15fc 100644
--- a/gcc/testsuite/gcc.dg/graphite/graphite.exp
+++ b/gcc/testsuite/gcc.dg/graphite/graphite.exp
@@ -19,6 +19,11 @@
# Load support procs.
load_lib gcc-dg.exp
+global ISLVER
+if { $ISLVER != "0.15" } {
+ return
+}
+
if ![check_effective_target_fgraphite] {
return
}
diff --git a/gcc/testsuite/gfortran.dg/graphite/graphite.exp b/gcc/testsuite/gfortran.dg/graphite/graphite.exp
index 93863c3..25cba6b 100644
--- a/gcc/testsuite/gfortran.dg/graphite/graphite.exp
+++ b/gcc/testsuite/gfortran.dg/graphite/graphite.exp
@@ -19,6 +19,11 @@
# Load support procs.
load_lib gfortran-dg.exp
+global ISLVER
+if { $ISLVER != "0.15" } {
+ return
+}
+
if ![check_effective_target_fgraphite] {
return
}
diff --git a/gcc/toplev.c b/gcc/toplev.c
index e61e06c..db188c4 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -675,12 +675,10 @@ print_version (FILE *file, const char *indent, bool show_global_state)
fprintf (file,
file == stderr ? _(fmt2) : fmt2,
GCC_GMP_STRINGIFY_VERSION, MPFR_VERSION_STRING, MPC_VERSION_STRING,
-#ifndef HAVE_isl
- "none"
-#elif HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
+#ifdef HAVE_isl
"0.15"
#else
- "0.14 or 0.13"
+ "none"
#endif
);
if (strcmp (GCC_GMP_STRINGIFY_VERSION, gmp_version))
diff --git a/libgomp/config/isl.m4 b/libgomp/config/isl.m4
new file mode 100644
index 0000000..3d9e948
--- /dev/null
+++ b/libgomp/config/isl.m4
@@ -0,0 +1,158 @@
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3, or (at your option) any later
+# version.
+#
+# GCC is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+#
+# Contributed by Richard Guenther <rguenther@suse.de>
+# Based on cloog.m4
+
+# ISL_INIT_FLAGS ()
+# -------------------------
+# Provide configure switches for isl support.
+# Initialize isllibs/islinc according to the user input.
+AC_DEFUN([ISL_INIT_FLAGS],
+[
+ AC_ARG_WITH([isl-include],
+ [AS_HELP_STRING(
+ [--with-isl-include=PATH],
+ [Specify directory for installed isl include files])])
+ AC_ARG_WITH([isl-lib],
+ [AS_HELP_STRING(
+ [--with-isl-lib=PATH],
+ [Specify the directory for the installed isl library])])
+
+ AC_ARG_ENABLE(isl-version-check,
+ [AS_HELP_STRING(
+ [--disable-isl-version-check],
+ [disable check for isl version])],
+ ENABLE_ISL_CHECK=$enableval,
+ ENABLE_ISL_CHECK=yes)
+
+ # Initialize isllibs and islinc.
+ case $with_isl in
+ no)
+ isllibs=
+ islinc=
+ ;;
+ "" | yes)
+ ;;
+ *)
+ isllibs="-L$with_isl/lib"
+ islinc="-I$with_isl/include"
+ ;;
+ esac
+ if test "x${with_isl_include}" != x ; then
+ islinc="-I$with_isl_include"
+ fi
+ if test "x${with_isl_lib}" != x; then
+ isllibs="-L$with_isl_lib"
+ fi
+ dnl If no --with-isl flag was specified and there is in-tree isl
+ dnl source, set up flags to use that and skip any version tests
+ dnl as we cannot run them before building isl.
+ if test "x${islinc}" = x && test "x${isllibs}" = x \
+ && test -d ${srcdir}/isl; then
+ isllibs='-L$$r/$(HOST_SUBDIR)/isl/'"$lt_cv_objdir"' '
+ islinc='-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include'
+ ENABLE_ISL_CHECK=no
+ AC_MSG_WARN([using in-tree isl, disabling version check])
+ fi
+
+ isllibs="${isllibs} -lisl"
+]
+)
+
+# ISL_REQUESTED (ACTION-IF-REQUESTED, ACTION-IF-NOT)
+# ----------------------------------------------------
+# Provide actions for failed isl detection.
+AC_DEFUN([ISL_REQUESTED],
+[
+ AC_REQUIRE([ISL_INIT_FLAGS])
+
+ if test "x${with_isl}" = xno; then
+ $2
+ elif test "x${with_isl}" != x \
+ || test "x${with_isl_include}" != x \
+ || test "x${with_isl_lib}" != x ; then
+ $1
+ else
+ $2
+ fi
+]
+)
+
+# ISL_CHECK_VERSION ISL_CHECK_VERSION ()
+# ----------------------------------------------------------------
+# Test whether isl contains functionality added to the minimum expected version.
+AC_DEFUN([ISL_CHECK_VERSION],
+[
+ if test "${ENABLE_ISL_CHECK}" = yes ; then
+ _isl_saved_CFLAGS=$CFLAGS
+ _isl_saved_LDFLAGS=$LDFLAGS
+ _isl_saved_LIBS=$LIBS
+
+ CFLAGS="${_isl_saved_CFLAGS} ${islinc} ${gmpinc}"
+ LDFLAGS="${_isl_saved_LDFLAGS} ${isllibs} ${gmplibs}"
+ LIBS="${_isl_saved_LIBS} -lisl -lgmp"
+
+ AC_MSG_CHECKING([for isl 0.15 (or deprecated 0.14)])
+ AC_TRY_LINK([#include <isl/ctx.h>],
+ [isl_ctx_get_max_operations (isl_ctx_alloc ());],
+ [gcc_cv_isl=yes],
+ [gcc_cv_isl=no])
+ AC_MSG_RESULT([$gcc_cv_isl])
+
+ if test "${gcc_cv_isl}" = no ; then
+ AC_MSG_RESULT([recommended isl version is 0.15, minimum required isl version 0.14 is deprecated])
+ fi
+
+ AC_MSG_CHECKING([Checking for isl-0.15])
+ AC_TRY_LINK([#include <isl/schedule.h>],
+ [isl_options_set_schedule_serialize_sccs (NULL, 0);],
+ [ac_has_isl_options_set_schedule_serialize_sccs=yes],
+ [ac_has_isl_options_set_schedule_serialize_sccs=no])
+ AC_MSG_RESULT($ac_has_isl_options_set_schedule_serialize_sccs)
+
+ if test x"$ac_has_isl_options_set_schedule_serialize_sccs" = x"yes"; then
+ islver="0.15"
+ AC_SUBST([islver])
+ fi
+
+ CFLAGS=$_isl_saved_CFLAGS
+ LDFLAGS=$_isl_saved_LDFLAGS
+ LIBS=$_isl_saved_LIBS
+ fi
+]
+)
+
+# ISL_IF_FAILED (ACTION-IF-FAILED)
+# ----------------------------------
+# Executes ACTION-IF-FAILED, if GRAPHITE was requested and
+# the checks failed.
+AC_DEFUN([ISL_IF_FAILED],
+[
+ ISL_REQUESTED([graphite_requested=yes], [graphite_requested=no])
+
+ if test "${gcc_cv_isl}" = no ; then
+ isllibs=
+ islinc=
+ fi
+
+ if test "${graphite_requested}" = yes \
+ && test "x${isllibs}" = x \
+ && test "x${islinc}" = x ; then
+ $1
+ fi
+]
+)
diff --git a/libgomp/configure b/libgomp/configure
index aaa17c9..8ef73c2 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -638,6 +638,7 @@ PLUGIN_NVPTX
CUDA_DRIVER_LIB
CUDA_DRIVER_INCLUDE
offload_targets
+islver
libtool_VERSION
ac_ct_FC
FCFLAGS
@@ -779,6 +780,10 @@ enable_fast_install
with_gnu_ld
enable_libtool_lock
enable_maintainer_mode
+with_isl
+with_isl_include
+with_isl_lib
+enable_isl_version_check
with_cuda_driver
with_cuda_driver_include
with_cuda_driver_lib
@@ -1432,6 +1437,8 @@ Optional Features:
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
+ --disable-isl-version-check
+ disable check for isl version
--enable-linux-futex use the Linux futex system call [default=default]
--enable-tls Use thread-local storage [default=yes]
--enable-symvers=STYLE enables symbol versioning of the shared library
@@ -1443,6 +1450,12 @@ Optional Packages:
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-isl=PATH Specify prefix directory for the installed isl
+ package. Equivalent to
+ --with-isl-include=PATH/include plus
+ --with-isl-lib=PATH/lib
+ --with-isl-include=PATH Specify directory for installed isl include files
+ --with-isl-lib=PATH Specify the directory for the installed isl library
--with-cuda-driver=PATH specify prefix directory for installed CUDA driver
package. Equivalent to
--with-cuda-driver-include=PATH/include plus
@@ -11121,7 +11134,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11124 "configure"
+#line 11137 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11227,7 +11240,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11230 "configure"
+#line 11243 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15088,6 +15101,190 @@ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
esac
+
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3, or (at your option) any later
+# version.
+#
+# GCC is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+#
+# Contributed by Richard Guenther <rguenther@suse.de>
+# Based on cloog.m4
+
+# ISL_INIT_FLAGS ()
+# -------------------------
+# Provide configure switches for isl support.
+# Initialize isllibs/islinc according to the user input.
+
+
+# ISL_REQUESTED (ACTION-IF-REQUESTED, ACTION-IF-NOT)
+# ----------------------------------------------------
+# Provide actions for failed isl detection.
+
+
+# ISL_CHECK_VERSION ISL_CHECK_VERSION ()
+# ----------------------------------------------------------------
+# Test whether isl contains functionality added to the minimum expected version.
+
+
+# ISL_IF_FAILED (ACTION-IF-FAILED)
+# ----------------------------------
+# Executes ACTION-IF-FAILED, if GRAPHITE was requested and
+# the checks failed.
+
+
+
+# GCC GRAPHITE dependency isl.
+# Basic setup is inlined here, actual checks are in config/isl.m4
+
+
+# Check whether --with-isl was given.
+if test "${with_isl+set}" = set; then :
+ withval=$with_isl;
+fi
+
+
+# Treat --without-isl as a request to disable
+# GRAPHITE support and skip all following checks.
+if test "x$with_isl" != "xno"; then
+ # Check for isl
+
+
+# Check whether --with-isl-include was given.
+if test "${with_isl_include+set}" = set; then :
+ withval=$with_isl_include;
+fi
+
+
+# Check whether --with-isl-lib was given.
+if test "${with_isl_lib+set}" = set; then :
+ withval=$with_isl_lib;
+fi
+
+
+ # Check whether --enable-isl-version-check was given.
+if test "${enable_isl_version_check+set}" = set; then :
+ enableval=$enable_isl_version_check; ENABLE_ISL_CHECK=$enableval
+else
+ ENABLE_ISL_CHECK=yes
+fi
+
+
+ # Initialize isllibs and islinc.
+ case $with_isl in
+ no)
+ isllibs=
+ islinc=
+ ;;
+ "" | yes)
+ ;;
+ *)
+ isllibs="-L$with_isl/lib"
+ islinc="-I$with_isl/include"
+ ;;
+ esac
+ if test "x${with_isl_include}" != x ; then
+ islinc="-I$with_isl_include"
+ fi
+ if test "x${with_isl_lib}" != x; then
+ isllibs="-L$with_isl_lib"
+ fi
+ if test "x${islinc}" = x && test "x${isllibs}" = x \
+ && test -d ${srcdir}/isl; then
+ isllibs='-L$$r/$(HOST_SUBDIR)/isl/'"$lt_cv_objdir"' '
+ islinc='-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include'
+ ENABLE_ISL_CHECK=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using in-tree isl, disabling version check" >&5
+$as_echo "$as_me: WARNING: using in-tree isl, disabling version check" >&2;}
+ fi
+
+ isllibs="${isllibs} -lisl"
+
+
+
+ if test "${ENABLE_ISL_CHECK}" = yes ; then
+ _isl_saved_CFLAGS=$CFLAGS
+ _isl_saved_LDFLAGS=$LDFLAGS
+ _isl_saved_LIBS=$LIBS
+
+ CFLAGS="${_isl_saved_CFLAGS} ${islinc} ${gmpinc}"
+ LDFLAGS="${_isl_saved_LDFLAGS} ${isllibs} ${gmplibs}"
+ LIBS="${_isl_saved_LIBS} -lisl -lgmp"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for isl 0.15 (or deprecated 0.14)" >&5
+$as_echo_n "checking for isl 0.15 (or deprecated 0.14)... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <isl/ctx.h>
+int
+main ()
+{
+isl_ctx_get_max_operations (isl_ctx_alloc ());
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ gcc_cv_isl=yes
+else
+ gcc_cv_isl=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_isl" >&5
+$as_echo "$gcc_cv_isl" >&6; }
+
+ if test "${gcc_cv_isl}" = no ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: recommended isl version is 0.15, minimum required isl version 0.14 is deprecated" >&5
+$as_echo "recommended isl version is 0.15, minimum required isl version 0.14 is deprecated" >&6; }
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Checking for isl-0.15" >&5
+$as_echo_n "checking Checking for isl-0.15... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <isl/schedule.h>
+int
+main ()
+{
+isl_options_set_schedule_serialize_sccs (NULL, 0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_has_isl_options_set_schedule_serialize_sccs=yes
+else
+ ac_has_isl_options_set_schedule_serialize_sccs=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_has_isl_options_set_schedule_serialize_sccs" >&5
+$as_echo "$ac_has_isl_options_set_schedule_serialize_sccs" >&6; }
+
+ if test x"$ac_has_isl_options_set_schedule_serialize_sccs" = x"yes"; then
+ islver="0.15"
+
+ fi
+
+ CFLAGS=$_isl_saved_CFLAGS
+ LDFLAGS=$_isl_saved_LDFLAGS
+ LIBS=$_isl_saved_LIBS
+ fi
+
+
+fi
+
# Plugins for offload execution, configure.ac fragment. -*- mode: autoconf -*-
#
# Copyright (C) 2014-2015 Free Software Foundation, Inc.
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 2e41ca8..281934a 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -202,6 +202,30 @@ case "$host" in
[AC_MSG_ERROR([Pthreads are required to build libgomp])])])
esac
+
+m4_include([config/isl.m4])
+
+# GCC GRAPHITE dependency isl.
+# Basic setup is inlined here, actual checks are in config/isl.m4
+
+AC_ARG_WITH(isl,
+ [AS_HELP_STRING(
+ [--with-isl=PATH],
+ [Specify prefix directory for the installed isl package.
+ Equivalent to --with-isl-include=PATH/include
+ plus --with-isl-lib=PATH/lib])])
+
+# Treat --without-isl as a request to disable
+# GRAPHITE support and skip all following checks.
+if test "x$with_isl" != "xno"; then
+ # Check for isl
+ dnl Provide configure switches and initialize islinc & isllibs
+ dnl with user input.
+ ISL_INIT_FLAGS
+ dnl The versions of isl that work for Graphite
+ ISL_CHECK_VERSION()
+fi
+
m4_include([plugin/configfrag.ac])
# Check for functions needed.
diff --git a/libgomp/testsuite/Makefile.am b/libgomp/testsuite/Makefile.am
index 66a9d94..837366e 100644
--- a/libgomp/testsuite/Makefile.am
+++ b/libgomp/testsuite/Makefile.am
@@ -22,6 +22,8 @@ libgomp-test-support.exp: libgomp-test-support.pt.exp Makefile
'set offload_additional_options "$(offload_additional_options)"'
echo >> $@.tmp \
'set offload_additional_lib_paths "$(offload_additional_lib_paths)"'
+ echo >> $@.tmp \
+ 'set ISLVER "$(ISLVER)"'
mv $@.tmp $@
all-local: libgomp-test-support.exp
diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in
index c25d21f..f01436e 100644
--- a/libgomp/testsuite/Makefile.in
+++ b/libgomp/testsuite/Makefile.in
@@ -116,6 +116,7 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ISLVER = @islver@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
@@ -464,6 +465,8 @@ libgomp-test-support.exp: libgomp-test-support.pt.exp Makefile
'set offload_additional_options "$(offload_additional_options)"'
echo >> $@.tmp \
'set offload_additional_lib_paths "$(offload_additional_lib_paths)"'
+ echo >> $@.tmp \
+ 'set ISLVER "$(ISLVER)"'
mv $@.tmp $@
all-local: libgomp-test-support.exp
diff --git a/libgomp/testsuite/libgomp.graphite/graphite.exp b/libgomp/testsuite/libgomp.graphite/graphite.exp
index d737c85..ce29169 100644
--- a/libgomp/testsuite/libgomp.graphite/graphite.exp
+++ b/libgomp/testsuite/libgomp.graphite/graphite.exp
@@ -14,6 +14,11 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
+global ISLVER
+if { $ISLVER != "0.15" } {
+ return
+}
+
if [info exists lang_library_path] then {
unset lang_library_path
unset lang_link_flags
--
2.5.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 11/15] check for unstructured control flow
2016-01-15 17:14 [PATCH 01/15] add more coalescing to simplify constraints Sebastian Pop
2016-01-15 17:15 ` [PATCH 02/15] remove unused variable Sebastian Pop
2016-01-15 17:15 ` [PATCH 05/15] remove tiling Sebastian Pop
@ 2016-01-15 17:15 ` Sebastian Pop
2016-01-15 17:15 ` [PATCH 07/15] check that all loops are valid in the combined region Sebastian Pop
` (9 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Sebastian Pop @ 2016-01-15 17:15 UTC (permalink / raw)
To: gcc-patches; +Cc: hiraditya, sebpop, richard.guenther, Sebastian Pop
From: Sebastian Pop <s.pop@samsung.com>
* graphite-scop-detection.c (scop_detection::harmful_loop_in_region):
Discard unstructured if-then-else regions.
---
gcc/graphite-scop-detection.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index a0c630b..f035e0d 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1078,6 +1078,18 @@ scop_detection::harmful_loop_in_region (sese_l scop) const
return true;
}
+ /* Check for unstructured control flow: CFG not generated by structured
+ if-then-else. */
+ if (bb->succs->length () > 1)
+ {
+ edge e;
+ edge_iterator ei;
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ if (!dominated_by_p (CDI_POST_DOMINATORS, bb, e->dest)
+ && !dominated_by_p (CDI_DOMINATORS, e->dest, bb))
+ return true;
+ }
+
/* Collect all loops in the current region. */
loop_p loop = bb->loop_father;
if (loop_in_sese_p (loop, scop))
--
2.5.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 05/15] remove tiling
2016-01-15 17:14 [PATCH 01/15] add more coalescing to simplify constraints Sebastian Pop
2016-01-15 17:15 ` [PATCH 02/15] remove unused variable Sebastian Pop
@ 2016-01-15 17:15 ` Sebastian Pop
2016-01-15 17:15 ` [PATCH 11/15] check for unstructured control flow Sebastian Pop
` (10 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Sebastian Pop @ 2016-01-15 17:15 UTC (permalink / raw)
To: gcc-patches; +Cc: hiraditya, sebpop, richard.guenther, Sebastian Pop
From: Sebastian Pop <s.pop@samsung.com>
We remove all code related to tiling, then we will call isl functionality for that.
* graphite-isl-ast-to-gimple.c (set_options_for_schedule_tree): Remove.
(translate_isl_ast_to_gimple::scop_to_isl_ast): Call set_separate_option.
(graphite_regenerate_ast_isl): Add dump.
* graphite-optimize-isl.c (get_schedule_for_node_st): Remove.
(get_schedule_map_st): Remove.
(get_single_map): Remove.
(apply_schedule_map_to_scop): Remove.
(optimize_isl): Do not use isl_union_maps to build the schedule.
* graphite-poly.c (apply_poly_transforms): Simplify.
(print_isl_set): Use more readable format: ISL_YAML_STYLE_BLOCK.
(print_isl_map): Same.
(print_isl_union_map): Same.
(print_isl_schedule): New.
(debug_isl_schedule): New.
* graphite.h: Declare print_isl_schedule and debug_isl_schedule.
gcc/testsuite
* gcc.dg/graphite/block-0.c: Adjust patern.
* gcc.dg/graphite/block-1.c: Same.
* gcc.dg/graphite/block-5.c: Same.
* gcc.dg/graphite/block-6.c: Same.
* gcc.dg/graphite/block-pr47654.c: Same.
* gcc.dg/graphite/interchange-0.c: Same.
* gcc.dg/graphite/interchange-1.c: Same.
* gcc.dg/graphite/interchange-10.c: Same.
* gcc.dg/graphite/interchange-11.c: Same.
* gcc.dg/graphite/interchange-12.c: Same.
* gcc.dg/graphite/interchange-13.c: Same.
* gcc.dg/graphite/interchange-14.c: Same.
* gcc.dg/graphite/interchange-15.c: Same.
* gcc.dg/graphite/interchange-16.c: Same.
* gcc.dg/graphite/interchange-2.c: Same.
* gcc.dg/graphite/interchange-3.c: Same.
* gcc.dg/graphite/interchange-4.c: Same.
* gcc.dg/graphite/interchange-5.c: Same.
* gcc.dg/graphite/interchange-6.c: Same.
* gcc.dg/graphite/interchange-7.c: Same.
* gcc.dg/graphite/interchange-8.c: Same.
* gcc.dg/graphite/interchange-9.c: Same.
* gcc.dg/graphite/interchange-mvt.c: Same.
* gcc.dg/graphite/uns-block-1.c: Same.
* gcc.dg/graphite/uns-interchange-12.c: Same.
* gcc.dg/graphite/uns-interchange-14.c: Same.
* gcc.dg/graphite/uns-interchange-15.c: Same.
* gcc.dg/graphite/uns-interchange-9.c: Same.
* gcc.dg/graphite/uns-interchange-mvt.c: Same.
* gfortran.dg/graphite/interchange-3.f90: Same.
* gfortran.dg/graphite/pr14741.f90: Same.
---
gcc/graphite-isl-ast-to-gimple.c | 47 +++-----
gcc/graphite-optimize-isl.c | 130 +++------------------
gcc/graphite-poly.c | 36 ++++--
gcc/graphite.h | 2 +
gcc/testsuite/gcc.dg/graphite/block-0.c | 2 +-
gcc/testsuite/gcc.dg/graphite/block-1.c | 2 +-
gcc/testsuite/gcc.dg/graphite/block-5.c | 3 +-
gcc/testsuite/gcc.dg/graphite/block-6.c | 3 +-
gcc/testsuite/gcc.dg/graphite/block-pr47654.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-0.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-1.c | 7 +-
gcc/testsuite/gcc.dg/graphite/interchange-10.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-11.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-12.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-13.c | 1 +
gcc/testsuite/gcc.dg/graphite/interchange-14.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-15.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-16.c | 1 +
gcc/testsuite/gcc.dg/graphite/interchange-2.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-3.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-4.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-5.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-6.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-7.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-8.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-9.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-mvt.c | 2 +-
gcc/testsuite/gcc.dg/graphite/uns-block-1.c | 2 +-
gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c | 2 +-
gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c | 2 +-
gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c | 2 +-
gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c | 2 +-
.../gcc.dg/graphite/uns-interchange-mvt.c | 2 +-
.../gfortran.dg/graphite/interchange-3.f90 | 2 +-
gcc/testsuite/gfortran.dg/graphite/pr14741.f90 | 2 +-
35 files changed, 97 insertions(+), 185 deletions(-)
diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c
index dad802f..b0da425 100644
--- a/gcc/graphite-isl-ast-to-gimple.c
+++ b/gcc/graphite-isl-ast-to-gimple.c
@@ -300,12 +300,6 @@ class translate_isl_ast_to_gimple
__isl_give isl_union_map *generate_isl_schedule (scop_p scop);
- /* Set the "separate" option for all schedules. This helps reducing control
- overhead. */
-
- __isl_give isl_schedule *
- set_options_for_schedule_tree (__isl_take isl_schedule *schedule);
-
/* Set the separate option for all dimensions.
This helps to reduce control overhead. */
@@ -3182,17 +3176,6 @@ ast_build_before_for (__isl_keep isl_ast_build *build, void *user)
return id;
}
-/* Set the separate option for all schedules. This helps reducing control
- overhead. */
-
-__isl_give isl_schedule *
-translate_isl_ast_to_gimple::set_options_for_schedule_tree
-(__isl_take isl_schedule *schedule)
-{
- return isl_schedule_map_schedule_node_bottom_up
- (schedule, set_separate_option, NULL);
-}
-
/* Set the separate option for all dimensions.
This helps to reduce control overhead. */
@@ -3217,7 +3200,6 @@ translate_isl_ast_to_gimple::set_options (__isl_take isl_ast_build *control,
__isl_give isl_ast_node *
translate_isl_ast_to_gimple::scop_to_isl_ast (scop_p scop, ivs_params &ip)
{
- isl_ast_node *ast_isl = NULL;
/* Generate loop upper bounds that consist of the current loop iterator, an
operator (< or <=) and an expression not involving the iterator. If this
option is not set, then the current loop iterator may appear several times
@@ -3225,6 +3207,20 @@ translate_isl_ast_to_gimple::scop_to_isl_ast (scop_p scop, ivs_params &ip)
isl_options_set_ast_build_atomic_upper_bound (scop->isl_context, true);
add_parameters_to_ivs_params (scop, ip);
+
+ if (scop->schedule)
+ {
+ /* Set the separate option to reduce control flow overhead. */
+ isl_schedule *schedule = isl_schedule_map_schedule_node_bottom_up
+ (scop->schedule, set_separate_option, NULL);
+ isl_ast_build *context_isl = generate_isl_context (scop);
+ isl_ast_node *ast_isl = isl_ast_build_node_from_schedule
+ (context_isl, schedule);
+ isl_ast_build_free (context_isl);
+ return ast_isl;
+ }
+
+ /* graphite-identity, or parallelize. */
isl_union_map *schedule_isl = generate_isl_schedule (scop);
isl_ast_build *context_isl = generate_isl_context (scop);
context_isl = set_options (context_isl, schedule_isl);
@@ -3235,16 +3231,8 @@ translate_isl_ast_to_gimple::scop_to_isl_ast (scop_p scop, ivs_params &ip)
isl_ast_build_set_before_each_for (context_isl, ast_build_before_for,
dependence);
}
-
- if (scop->schedule)
- {
- scop->schedule = set_options_for_schedule_tree (scop->schedule);
- ast_isl = isl_ast_build_node_from_schedule (context_isl, scop->schedule);
- isl_union_map_free(schedule_isl);
- }
- else
- ast_isl = isl_ast_build_ast_from_schedule (context_isl, schedule_isl);
-
+ isl_ast_node *ast_isl = isl_ast_build_ast_from_schedule
+ (context_isl, schedule_isl);
isl_ast_build_free (context_isl);
return ast_isl;
}
@@ -3314,6 +3302,9 @@ graphite_regenerate_ast_isl (scop_p scop)
scev_reset ();
recompute_all_dominators ();
graphite_verify ();
+
+ if (dump_file)
+ fprintf (dump_file, "[codegen] isl AST to Gimple succeeded.\n");
}
else
{
diff --git a/gcc/graphite-optimize-isl.c b/gcc/graphite-optimize-isl.c
index 1565219..306f91c 100644
--- a/gcc/graphite-optimize-isl.c
+++ b/gcc/graphite-optimize-isl.c
@@ -39,105 +39,6 @@ along with GCC; see the file COPYING3. If not see
#include "dumpfile.h"
#include "graphite.h"
-/* get_schedule_for_node_st - Improve schedule for the schedule node.
- Only Simple loop tiling is considered. */
-
-static __isl_give isl_schedule_node *
-get_schedule_for_node_st (__isl_take isl_schedule_node *node, void *user)
-{
- if (user)
- return node;
-
- if (isl_schedule_node_get_type (node) != isl_schedule_node_band
- || isl_schedule_node_n_children (node) != 1)
- return node;
-
- isl_space *space = isl_schedule_node_band_get_space (node);
- unsigned dims = isl_space_dim (space, isl_dim_set);
- isl_schedule_node *child = isl_schedule_node_get_child (node, 0);
- isl_schedule_node_type type = isl_schedule_node_get_type (child);
- isl_space_free (space);
- isl_schedule_node_free (child);
-
- if (type != isl_schedule_node_leaf)
- return node;
-
- if (dims <= 1 || !isl_schedule_node_band_get_permutable (node))
- {
- if (dump_file && dump_flags)
- fprintf (dump_file, "not tiled\n");
- return node;
- }
-
- /* Tile loops. */
- space = isl_schedule_node_band_get_space (node);
- isl_multi_val *sizes = isl_multi_val_zero (space);
- long tile_size = PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE);
- isl_ctx *ctx = isl_schedule_node_get_ctx (node);
-
- for (unsigned i = 0; i < dims; i++)
- {
- sizes = isl_multi_val_set_val (sizes, i,
- isl_val_int_from_si (ctx, tile_size));
- if (dump_file && dump_flags)
- fprintf (dump_file, "tiled by %ld\n", tile_size);
- }
-
- node = isl_schedule_node_band_tile (node, sizes);
- node = isl_schedule_node_child (node, 0);
-
- return node;
-}
-
-/* get_schedule_map_st - Improve the schedule by performing other loop
- optimizations. _st ending is for schedule tree version of this
- function (see get_schedule_map below for the band forest version).
-
- Do a depth-first post-order traversal of the nodes in a schedule
- tree and apply get_schedule_for_node_st on them to improve the schedule.
- */
-
-static __isl_give isl_union_map *
-get_schedule_map_st (__isl_keep isl_schedule *schedule)
-{
-
- schedule = isl_schedule_map_schedule_node_bottom_up (schedule,
- get_schedule_for_node_st,
- NULL);
- isl_union_map *schedule_map = isl_schedule_get_map (schedule);
- return schedule_map;
-}
-
-static isl_stat
-get_single_map (__isl_take isl_map *map, void *user)
-{
- isl_map **single_map = (isl_map **)user;
- *single_map = map;
- return isl_stat_ok;
-}
-
-static void
-apply_schedule_map_to_scop (scop_p scop, isl_union_map *schedule_map)
-{
- int i;
- poly_bb_p pbb;
-
- FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
- {
- isl_set *domain = isl_set_copy (pbb->domain);
- isl_map *stmt_schedule;
-
- isl_union_map *stmt_band
- = isl_union_map_intersect_domain (isl_union_map_copy (schedule_map),
- isl_union_set_from_set (domain));
- stmt_band = isl_union_map_coalesce (stmt_band);
- isl_union_map_foreach_map (stmt_band, get_single_map, &stmt_schedule);
- isl_map_free (pbb->transformed);
- pbb->transformed = isl_map_coalesce (stmt_schedule);
- isl_union_map_free (stmt_band);
- }
-}
-
static isl_union_set *
scop_get_domains (scop_p scop)
{
@@ -152,8 +53,6 @@ scop_get_domains (scop_p scop)
return res;
}
-static const int CONSTANT_BOUND = 20;
-
/* Compute the schedule for SCOP based on its parameters, domain and set of
constraints. Then apply the schedule to SCOP. */
@@ -175,19 +74,27 @@ optimize_isl (scop_p scop)
isl_union_map *validity = isl_union_map_copy (scop->dependence);
isl_union_map *proximity = isl_union_map_copy (validity);
- isl_options_set_schedule_max_constant_term (scop->isl_context, CONSTANT_BOUND);
- isl_options_set_schedule_maximize_band_depth (scop->isl_context, 1);
+ isl_schedule_constraints *schedule_constraints;
+ schedule_constraints = isl_schedule_constraints_on_domain (domain);
+ schedule_constraints
+ = isl_schedule_constraints_set_proximity (schedule_constraints,
+ proximity);
+ schedule_constraints
+ = isl_schedule_constraints_set_validity (schedule_constraints,
+ isl_union_map_copy (validity));
+ schedule_constraints
+ = isl_schedule_constraints_set_coincidence (schedule_constraints,
+ validity);
+
isl_options_set_schedule_serialize_sccs (scop->isl_context, 0);
isl_options_set_schedule_maximize_band_depth (scop->isl_context, 1);
isl_options_set_schedule_max_constant_term (scop->isl_context, 20);
isl_options_set_schedule_max_coefficient (scop->isl_context, 20);
isl_options_set_tile_scale_tile_loops (scop->isl_context, 0);
- isl_options_set_coalesce_bounded_wrapping (scop->isl_context, 1);
- isl_options_set_ast_build_exploit_nested_bounds (scop->isl_context, 1);
isl_options_set_ast_build_atomic_upper_bound (scop->isl_context, 1);
isl_schedule *schedule
- = isl_union_set_compute_schedule (domain, validity, proximity);
+ = isl_schedule_constraints_compute_schedule (schedule_constraints);
isl_options_set_on_error (scop->isl_context, ISL_ON_ERROR_ABORT);
isl_ctx_reset_operations (scop->isl_context);
@@ -202,15 +109,14 @@ optimize_isl (scop_p scop)
return false;
}
- /* Attach the schedule to scop so that it can be used in code generation.
- schedule freeing will occur in code generation. */
scop->schedule = schedule;
- isl_union_map *schedule_map = get_schedule_map_st (schedule);
- apply_schedule_map_to_scop (scop, schedule_map);
+ if (dump_file)
+ {
+ fprintf (dump_file, "isl end schedule:\n");
+ print_isl_schedule (dump_file, scop->schedule);
+ }
- isl_union_map_free (schedule_map);
return true;
}
-
#endif /* HAVE_isl */
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index 428c427..de7515a 100644
--- a/gcc/graphite-poly.c
+++ b/gcc/graphite-poly.c
@@ -91,21 +91,16 @@ debug_iteration_domains (scop_p scop)
bool
apply_poly_transforms (scop_p scop)
{
- bool transform_done = false;
+ if (flag_loop_nest_optimize && optimize_isl (scop))
+ return true;
+
+ if (!flag_graphite_identity && !flag_loop_parallelize_all)
+ return false;
/* Generate code even if we did not apply any real transformation.
This also allows to check the performance for the identity
transformation: GIMPLE -> GRAPHITE -> GIMPLE. */
- if (flag_graphite_identity)
- transform_done = true;
-
- if (flag_loop_parallelize_all)
- transform_done = true;
-
- if (flag_loop_nest_optimize)
- transform_done |= optimize_isl (scop);
-
- return transform_done;
+ return true;
}
/* Create a new polyhedral data reference and add it to PBB. It is
@@ -538,6 +533,7 @@ void
print_isl_set (FILE *f, isl_set *set)
{
isl_printer *p = isl_printer_to_file (the_isl_ctx, f);
+ p = isl_printer_set_yaml_style (p, ISL_YAML_STYLE_BLOCK);
p = isl_printer_print_set (p, set);
p = isl_printer_print_str (p, "\n");
isl_printer_free (p);
@@ -553,6 +549,7 @@ void
print_isl_map (FILE *f, isl_map *map)
{
isl_printer *p = isl_printer_to_file (the_isl_ctx, f);
+ p = isl_printer_set_yaml_style (p, ISL_YAML_STYLE_BLOCK);
p = isl_printer_print_map (p, map);
p = isl_printer_print_str (p, "\n");
isl_printer_free (p);
@@ -568,6 +565,7 @@ void
print_isl_union_map (FILE *f, isl_union_map *map)
{
isl_printer *p = isl_printer_to_file (the_isl_ctx, f);
+ p = isl_printer_set_yaml_style (p, ISL_YAML_STYLE_BLOCK);
p = isl_printer_print_union_map (p, map);
p = isl_printer_print_str (p, "\n");
isl_printer_free (p);
@@ -610,6 +608,22 @@ debug_isl_constraint (isl_constraint *c)
print_isl_constraint (stderr, c);
}
+void
+print_isl_schedule (FILE *f, isl_schedule *s)
+{
+ isl_printer *p = isl_printer_to_file (the_isl_ctx, f);
+ p = isl_printer_set_yaml_style (p, ISL_YAML_STYLE_BLOCK);
+ p = isl_printer_print_schedule (p, s);
+ p = isl_printer_print_str (p, "\n");
+ isl_printer_free (p);
+}
+
+DEBUG_FUNCTION void
+debug_isl_schedule (isl_schedule *s)
+{
+ print_isl_schedule (stderr, s);
+}
+
/* Returns the number of iterations RES of the loop around PBB at
time(scattering) dimension TIME_DEPTH. */
diff --git a/gcc/graphite.h b/gcc/graphite.h
index 5a6677a..7f8a273 100644
--- a/gcc/graphite.h
+++ b/gcc/graphite.h
@@ -304,6 +304,8 @@ extern void print_isl_map (FILE *, isl_map *);
extern void print_isl_union_map (FILE *, isl_union_map *);
extern void print_isl_aff (FILE *, isl_aff *);
extern void print_isl_constraint (FILE *, isl_constraint *);
+extern void print_isl_schedule (FILE *, isl_schedule *);
+extern void debug_isl_schedule (isl_schedule *);
extern void debug_isl_set (isl_set *);
extern void debug_isl_map (isl_map *);
extern void debug_isl_union_map (isl_union_map *);
diff --git a/gcc/testsuite/gcc.dg/graphite/block-0.c b/gcc/testsuite/gcc.dg/graphite/block-0.c
index 2a9f748..0a278f8 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-0.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-0.c
@@ -42,4 +42,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "not tiled" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/block-1.c b/gcc/testsuite/gcc.dg/graphite/block-1.c
index b8ac3ac..2758404 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-1.c
@@ -45,4 +45,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/block-5.c b/gcc/testsuite/gcc.dg/graphite/block-5.c
index 97bf410..28a0192 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-5.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-5.c
@@ -34,6 +34,7 @@ main (void)
{
int i, j, res;
+ /* Not beneficial to be blocked. */
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
{
@@ -53,4 +54,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/block-6.c b/gcc/testsuite/gcc.dg/graphite/block-6.c
index a6a5ba7..8902a17 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-6.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-6.c
@@ -32,6 +32,7 @@ main (void)
{
int i, j, res;
+
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
a[i][j] = i + j;
@@ -48,4 +49,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/block-pr47654.c b/gcc/testsuite/gcc.dg/graphite/block-pr47654.c
index 6d53ef4..2027a3f 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-pr47654.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-pr47654.c
@@ -21,4 +21,4 @@ main ()
return 0;
}
-/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-0.c b/gcc/testsuite/gcc.dg/graphite/interchange-0.c
index d56be46..f655e84 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-0.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-0.c
@@ -46,4 +46,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-1.c b/gcc/testsuite/gcc.dg/graphite/interchange-1.c
index b65d486..b6260dc 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-1.c
@@ -49,9 +49,4 @@ main (void)
return 0;
}
-/*FIXME: Between isl 0.12 and isl 0.15 the schedule optimizer needs to print
-something canonical so that it can be checked in the test. The final code
-generated by both are same in this case but the messaged printed are
-not consistent. */
-
-/* { dg-final { scan-tree-dump "tiled" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-10.c b/gcc/testsuite/gcc.dg/graphite/interchange-10.c
index a955644..825aafd 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-10.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-10.c
@@ -46,4 +46,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-11.c b/gcc/testsuite/gcc.dg/graphite/interchange-11.c
index 6102822..3173774 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-11.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-11.c
@@ -46,4 +46,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-12.c b/gcc/testsuite/gcc.dg/graphite/interchange-12.c
index 482bea4..7cdbabe 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-12.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-12.c
@@ -53,4 +53,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-13.c b/gcc/testsuite/gcc.dg/graphite/interchange-13.c
index 4e4a83e..d7f00a1 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-13.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-13.c
@@ -49,3 +49,4 @@ main (void)
return 0;
}
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-14.c b/gcc/testsuite/gcc.dg/graphite/interchange-14.c
index ca4dedc..617659c 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-14.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-14.c
@@ -54,4 +54,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-15.c b/gcc/testsuite/gcc.dg/graphite/interchange-15.c
index 7410f29..3696f41 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-15.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-15.c
@@ -48,4 +48,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-16.c b/gcc/testsuite/gcc.dg/graphite/interchange-16.c
index b4d79ae..307c757 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-16.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-16.c
@@ -19,3 +19,4 @@ void spread_i1 (int *rptr, int *sptr, int ncopies, int *extent, int rdelta, int
int main() { return 0; }
+/* { dg-final { scan-tree-dump-times "number of SCoPs: 0" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-2.c b/gcc/testsuite/gcc.dg/graphite/interchange-2.c
index 936ee00..0178861 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-2.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-2.c
@@ -52,4 +52,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "number of SCoPs: 0" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-3.c b/gcc/testsuite/gcc.dg/graphite/interchange-3.c
index 4aec824..e1b1117 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-3.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-3.c
@@ -47,4 +47,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-4.c b/gcc/testsuite/gcc.dg/graphite/interchange-4.c
index 463ecb5..28df935 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-4.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-4.c
@@ -46,4 +46,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-5.c b/gcc/testsuite/gcc.dg/graphite/interchange-5.c
index e5aaa64..4410a17 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-5.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-5.c
@@ -46,4 +46,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-6.c b/gcc/testsuite/gcc.dg/graphite/interchange-6.c
index 7257c29..c4500cb 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-6.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-6.c
@@ -47,4 +47,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-7.c b/gcc/testsuite/gcc.dg/graphite/interchange-7.c
index 81a6d83..2cb46a8 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-7.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-7.c
@@ -46,4 +46,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-8.c b/gcc/testsuite/gcc.dg/graphite/interchange-8.c
index d705910..9df7258 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-8.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-8.c
@@ -82,4 +82,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-9.c b/gcc/testsuite/gcc.dg/graphite/interchange-9.c
index 88a3578..728e67f 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-9.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-9.c
@@ -44,4 +44,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c b/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c
index c6543ec..b43131c 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c
@@ -58,4 +58,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-block-1.c b/gcc/testsuite/gcc.dg/graphite/uns-block-1.c
index 3bc7c12..5b61eea 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-block-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-block-1.c
@@ -45,4 +45,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c
index 4e3c705..a53c98e 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c
@@ -54,4 +54,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c
index a9d4950..1e180c6 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c
@@ -55,4 +55,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c
index fe2669f..adac7d4 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c
@@ -49,4 +49,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c
index cc108c2..e4d42f2 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c
@@ -45,4 +45,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c
index 211c9ab..04f5b7d 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c
@@ -59,4 +59,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90 b/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90
index 8070bbb..6c16a19 100644
--- a/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90
@@ -24,4 +24,4 @@ Program FOO
end Program FOO
-! { dg-final { scan-tree-dump "tiled" "graphite" } }
+! { dg-final { scan-tree-dump-times "unsuccessful in translating pending phis" "1" "graphite" } }
diff --git a/gcc/testsuite/gfortran.dg/graphite/pr14741.f90 b/gcc/testsuite/gfortran.dg/graphite/pr14741.f90
index e40262f..50c2e79 100644
--- a/gcc/testsuite/gfortran.dg/graphite/pr14741.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/pr14741.f90
@@ -24,4 +24,4 @@ SUBROUTINE mult(A,B,C,N)
ENDDO
END SUBROUTINE mult
-! { dg-final { scan-tree-dump "tiled by" "graphite" } }
+! { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } }
--
2.5.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 07/15] check that all loops are valid in the combined region
2016-01-15 17:14 [PATCH 01/15] add more coalescing to simplify constraints Sebastian Pop
` (2 preceding siblings ...)
2016-01-15 17:15 ` [PATCH 11/15] check for unstructured control flow Sebastian Pop
@ 2016-01-15 17:15 ` Sebastian Pop
2016-01-15 17:15 ` [PATCH 10/15] rewrite computation of iteration domains Sebastian Pop
` (8 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Sebastian Pop @ 2016-01-15 17:15 UTC (permalink / raw)
To: gcc-patches; +Cc: hiraditya, sebpop, richard.guenther, Sebastian Pop
From: Sebastian Pop <s.pop@samsung.com>
the bug was exposed by rewriting an if condition into an assert in the computation
of the loop iteration domains.
* graphite-scop-detection.c (loop_is_valid_scop): Renamed loop_is_valid_in_scop.
(scop_detection::harmful_stmt_in_region): Renamed harmful_loop_in_region.
Call loop_is_valid_in_scop.
---
gcc/graphite-scop-detection.c | 56 ++++++++++++++++++++++++++++++++-----------
1 file changed, 42 insertions(+), 14 deletions(-)
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index ad11227..e004185 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -554,7 +554,7 @@ public:
region of code that can be represented in the polyhedral model. SCOP
defines the region we analyse. */
- bool loop_is_valid_scop (loop_p loop, sese_l scop) const;
+ bool loop_is_valid_in_scop (loop_p loop, sese_l scop) const;
/* Return true when BEGIN is the preheader edge of a loop with a single exit
END. */
@@ -597,7 +597,7 @@ public:
Limit the number of bbs between adjacent loops to
PARAM_SCOP_MAX_NUM_BBS_BETWEEN_LOOPS. */
- bool harmful_stmt_in_region (sese_l scop) const;
+ bool harmful_loop_in_region (sese_l scop) const;
/* Return true only when STMT is simple enough for being handled by Graphite.
This depends on SCOP, as the parameters are initialized relatively to
@@ -777,8 +777,9 @@ scop_detection::merge_sese (sese_l first, sese_l second) const
if (!second)
return first;
- DEBUG_PRINT (dp << "[try-merging-sese] s1: "; print_sese (dump_file, first);
- dp << "[try-merging-sese] s2: ";
+ DEBUG_PRINT (dp << "[scop-detection] try merging sese s1: ";
+ print_sese (dump_file, first);
+ dp << "[scop-detection] try merging sese s2: ";
print_sese (dump_file, second));
/* Assumption: Both the sese's should be at the same loop depth or one scop
@@ -807,7 +808,7 @@ scop_detection::merge_sese (sese_l first, sese_l second) const
sese_l combined (entry, exit);
- DEBUG_PRINT (dp << "checking combined sese: ";
+ DEBUG_PRINT (dp << "[scop-detection] checking combined sese: ";
print_sese (dump_file, combined));
/* FIXME: We could iterate to find the dom which dominates pdom, and pdom
@@ -849,7 +850,7 @@ scop_detection::merge_sese (sese_l first, sese_l second) const
}
/* Analyze all the BBs in new sese. */
- if (harmful_stmt_in_region (combined))
+ if (harmful_loop_in_region (combined))
return invalid_sese;
DEBUG_PRINT (dp << "[merged-sese] s1: "; print_sese (dump_file, combined));
@@ -877,7 +878,7 @@ scop_detection::build_scop_depth (sese_l s, loop_p loop)
return s;
}
- if (!loop_is_valid_scop (loop, s2))
+ if (!loop_is_valid_in_scop (loop, s2))
return build_scop_depth (invalid_sese, loop->next);
return build_scop_breadth (s2, loop);
@@ -954,7 +955,7 @@ scop_detection::can_represent_loop (loop_p loop, sese_l scop)
defines the region we analyse. */
bool
-scop_detection::loop_is_valid_scop (loop_p loop, sese_l scop) const
+scop_detection::loop_is_valid_in_scop (loop_p loop, sese_l scop) const
{
if (!scop)
return false;
@@ -1008,7 +1009,7 @@ scop_detection::add_scop (sese_l s)
/* Do not add scops with only one loop. */
if (region_has_one_loop (s))
{
- DEBUG_PRINT (dp << "[scop-detection-fail] Discarding one loop SCoP.\n";
+ DEBUG_PRINT (dp << "[scop-detection-fail] Discarding one loop SCoP: ";
print_sese (dump_file, s));
return;
}
@@ -1016,7 +1017,7 @@ scop_detection::add_scop (sese_l s)
if (get_exit_bb (s) == EXIT_BLOCK_PTR_FOR_FN (cfun))
{
DEBUG_PRINT (dp << "[scop-detection-fail] "
- << "Discarding SCoP exiting to return.";
+ << "Discarding SCoP exiting to return: ";
print_sese (dump_file, s));
return;
}
@@ -1029,7 +1030,7 @@ scop_detection::add_scop (sese_l s)
remove_intersecting_scops (s);
scops.safe_push (s);
- DEBUG_PRINT (dp << "Adding SCoP "; print_sese (dump_file, s));
+ DEBUG_PRINT (dp << "[scop-detection] Adding SCoP: "; print_sese (dump_file, s));
}
/* Return true when a statement in SCOP cannot be represented by Graphite.
@@ -1038,7 +1039,7 @@ scop_detection::add_scop (sese_l s)
PARAM_SCOP_MAX_NUM_BBS_BETWEEN_LOOPS. */
bool
-scop_detection::harmful_stmt_in_region (sese_l scop) const
+scop_detection::harmful_loop_in_region (sese_l scop) const
{
basic_block exit_bb = get_exit_bb (scop);
basic_block entry_bb = get_entry_bb (scop);
@@ -1056,6 +1057,7 @@ scop_detection::harmful_stmt_in_region (sese_l scop) const
= get_dominated_to_depth (CDI_DOMINATORS, entry_bb, depth);
int i;
basic_block bb;
+ bitmap loops = BITMAP_ALLOC (NULL);
FOR_EACH_VEC_ELT (dom, i, bb)
{
DEBUG_PRINT (dp << "Visiting bb_" << bb->index << "\n");
@@ -1072,16 +1074,42 @@ scop_detection::harmful_stmt_in_region (sese_l scop) const
if (bb->flags & BB_IRREDUCIBLE_LOOP)
{
dom.release ();
+ BITMAP_FREE (loops);
return true;
}
- if (harmful_stmt_in_bb (scop, bb))
+ /* Collect all loops in the current region. */
+ loop_p loop = bb->loop_father;
+ if (loop_in_sese_p (loop, scop))
+ bitmap_set_bit (loops, loop->num);
+ else
{
- dom.release ();
+ /* We only check for harmful statements in basic blocks not part of
+ any loop fully contained in the scop: other bbs are checked below
+ in loop_is_valid_in_scop. */
+ if (harmful_stmt_in_bb (scop, bb))
+ return true;
+ }
+
+ }
+
+ /* Go through all loops and check that they are still valid in the combined
+ scop. */
+ unsigned j;
+ bitmap_iterator bi;
+ EXECUTE_IF_SET_IN_BITMAP (loops, 0, j, bi)
+ {
+ loop_p loop = (*current_loops->larray)[j];
+ gcc_assert (loop->num == (int) j);
+
+ if (!loop_is_valid_in_scop (loop, scop))
+ {
+ BITMAP_FREE (loops);
return true;
}
}
+ BITMAP_FREE (loops);
dom.release ();
return false;
}
--
2.5.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 13/15] reinstantiate loop blocking
2016-01-15 17:14 [PATCH 01/15] add more coalescing to simplify constraints Sebastian Pop
` (8 preceding siblings ...)
2016-01-15 17:15 ` [PATCH 08/15] record loops in execution order Sebastian Pop
@ 2016-01-15 17:15 ` Sebastian Pop
2016-01-15 17:15 ` [PATCH 04/15] add missing ast node for isl 0.15 Sebastian Pop
` (2 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Sebastian Pop @ 2016-01-15 17:15 UTC (permalink / raw)
To: gcc-patches; +Cc: hiraditya, sebpop, richard.guenther
* graphite-optimize-isl.c (get_schedule_for_node_st): Add back.
(optimize_isl): Call isl_schedule_map_schedule_node_bottom_up.
* params.def (PARAM_LOOP_BLOCK_TILE_SIZE): Adjust to 32.
gcc/testsuite
* gcc.dg/graphite/block-1.c:
* gcc.dg/graphite/block-5.c:
* gcc.dg/graphite/block-6.c:
* gcc.dg/graphite/block-pr47654.c:
* gcc.dg/graphite/interchange-0.c:
* gcc.dg/graphite/interchange-12.c:
* gcc.dg/graphite/interchange-14.c:
* gcc.dg/graphite/interchange-15.c:
* gcc.dg/graphite/interchange-5.c:
* gcc.dg/graphite/interchange-6.c:
* gcc.dg/graphite/interchange-8.c:
* gcc.dg/graphite/interchange-mvt.c:
* gcc.dg/graphite/uns-block-1.c:
* gcc.dg/graphite/uns-interchange-12.c:
* gcc.dg/graphite/uns-interchange-14.c:
* gcc.dg/graphite/uns-interchange-15.c:
* gcc.dg/graphite/uns-interchange-mvt.c:
* gfortran.dg/graphite/pr14741.f90:
---
gcc/graphite-optimize-isl.c | 54 ++++++++++++++++++++++
gcc/params.def | 2 +-
gcc/testsuite/gcc.dg/graphite/block-1.c | 2 +-
gcc/testsuite/gcc.dg/graphite/block-5.c | 2 +-
gcc/testsuite/gcc.dg/graphite/block-6.c | 3 +-
gcc/testsuite/gcc.dg/graphite/block-pr47654.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-0.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-12.c | 3 +-
gcc/testsuite/gcc.dg/graphite/interchange-14.c | 3 +-
gcc/testsuite/gcc.dg/graphite/interchange-15.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-5.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-6.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-8.c | 3 +-
gcc/testsuite/gcc.dg/graphite/interchange-mvt.c | 2 +-
gcc/testsuite/gcc.dg/graphite/uns-block-1.c | 2 +-
gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c | 3 +-
gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c | 3 +-
gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c | 2 +-
.../gcc.dg/graphite/uns-interchange-mvt.c | 2 +-
gcc/testsuite/gfortran.dg/graphite/pr14741.f90 | 2 +-
20 files changed, 74 insertions(+), 24 deletions(-)
diff --git a/gcc/graphite-optimize-isl.c b/gcc/graphite-optimize-isl.c
index f385c77..28dc6d4 100644
--- a/gcc/graphite-optimize-isl.c
+++ b/gcc/graphite-optimize-isl.c
@@ -39,6 +39,56 @@ along with GCC; see the file COPYING3. If not see
#include "dumpfile.h"
#include "graphite.h"
+/* get_schedule_for_node_st - Improve schedule for the schedule node.
+ Only Simple loop tiling is considered. */
+
+static __isl_give isl_schedule_node *
+get_schedule_for_node_st (__isl_take isl_schedule_node *node, void *user)
+{
+ if (user)
+ return node;
+
+ if (isl_schedule_node_get_type (node) != isl_schedule_node_band
+ || isl_schedule_node_n_children (node) != 1)
+ return node;
+
+ isl_space *space = isl_schedule_node_band_get_space (node);
+ unsigned dims = isl_space_dim (space, isl_dim_set);
+ isl_schedule_node *child = isl_schedule_node_get_child (node, 0);
+ isl_schedule_node_type type = isl_schedule_node_get_type (child);
+ isl_space_free (space);
+ isl_schedule_node_free (child);
+
+ if (type != isl_schedule_node_leaf)
+ return node;
+
+ if (dims <= 1 || !isl_schedule_node_band_get_permutable (node))
+ {
+ if (dump_file && dump_flags)
+ fprintf (dump_file, "not tiled\n");
+ return node;
+ }
+
+ /* Tile loops. */
+ space = isl_schedule_node_band_get_space (node);
+ isl_multi_val *sizes = isl_multi_val_zero (space);
+ long tile_size = PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE);
+ isl_ctx *ctx = isl_schedule_node_get_ctx (node);
+
+ for (unsigned i = 0; i < dims; i++)
+ {
+ sizes = isl_multi_val_set_val (sizes, i,
+ isl_val_int_from_si (ctx, tile_size));
+ if (dump_file && dump_flags)
+ fprintf (dump_file, "tiled by %ld\n", tile_size);
+ }
+
+ node = isl_schedule_node_band_tile (node, sizes);
+ node = isl_schedule_node_child (node, 0);
+
+ return node;
+}
+
static isl_union_set *
scop_get_domains (scop_p scop)
{
@@ -83,6 +133,7 @@ optimize_isl (scop_p scop)
sc = isl_schedule_constraints_set_validity (sc, isl_union_map_copy (validity));
sc = isl_schedule_constraints_set_coincidence (sc, validity);
+ isl_options_set_tile_scale_tile_loops (scop->isl_context, 32);
isl_options_set_schedule_serialize_sccs (scop->isl_context, 0);
isl_options_set_schedule_maximize_band_depth (scop->isl_context, 1);
isl_options_set_schedule_max_constant_term (scop->isl_context, 20);
@@ -95,6 +146,9 @@ optimize_isl (scop_p scop)
isl_options_set_ast_build_atomic_upper_bound (scop->isl_context, 1);
scop->transformed_schedule = isl_schedule_constraints_compute_schedule (sc);
+ scop->transformed_schedule =
+ isl_schedule_map_schedule_node_bottom_up (scop->transformed_schedule,
+ get_schedule_for_node_st, NULL);
isl_options_set_on_error (scop->isl_context, ISL_ON_ERROR_ABORT);
isl_ctx_reset_operations (scop->isl_context);
diff --git a/gcc/params.def b/gcc/params.def
index 9b82164..98081b9 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -833,7 +833,7 @@ DEFPARAM (PARAM_SWITCH_CONVERSION_BRANCH_RATIO,
DEFPARAM (PARAM_LOOP_BLOCK_TILE_SIZE,
"loop-block-tile-size",
"size of tiles for loop blocking.",
- 51, 0, 0)
+ 32, 0, 0)
/* Maximal number of parameters that we allow in a SCoP. */
diff --git a/gcc/testsuite/gcc.dg/graphite/block-1.c b/gcc/testsuite/gcc.dg/graphite/block-1.c
index 03a5f83..2758404 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-1.c
@@ -45,4 +45,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/block-5.c b/gcc/testsuite/gcc.dg/graphite/block-5.c
index 95f08c7..24b92c1 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-5.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-5.c
@@ -55,4 +55,4 @@ main (void)
}
/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "codegen error: reverting back to the original code" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/block-6.c b/gcc/testsuite/gcc.dg/graphite/block-6.c
index 0418a34..e7f1e34 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-6.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-6.c
@@ -49,4 +49,5 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "codegen error: reverting back to the original code" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/block-pr47654.c b/gcc/testsuite/gcc.dg/graphite/block-pr47654.c
index c4ffca3..2027a3f 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-pr47654.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-pr47654.c
@@ -21,4 +21,4 @@ main ()
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-0.c b/gcc/testsuite/gcc.dg/graphite/interchange-0.c
index 3f398ca..f655e84 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-0.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-0.c
@@ -46,4 +46,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-12.c b/gcc/testsuite/gcc.dg/graphite/interchange-12.c
index 0012d56..7cdbabe 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-12.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-12.c
@@ -53,5 +53,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-14.c b/gcc/testsuite/gcc.dg/graphite/interchange-14.c
index 917e679..617659c 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-14.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-14.c
@@ -54,5 +54,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-15.c b/gcc/testsuite/gcc.dg/graphite/interchange-15.c
index 8e147ad..4bd354a 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-15.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-15.c
@@ -48,4 +48,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-5.c b/gcc/testsuite/gcc.dg/graphite/interchange-5.c
index e578e17..4410a17 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-5.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-5.c
@@ -46,4 +46,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-6.c b/gcc/testsuite/gcc.dg/graphite/interchange-6.c
index 9760ed3..c4500cb 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-6.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-6.c
@@ -47,4 +47,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-8.c b/gcc/testsuite/gcc.dg/graphite/interchange-8.c
index c623a32..977bc60 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-8.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-8.c
@@ -82,5 +82,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "codegen error: reverting back to the original code" "1" "graphite" } } */
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c b/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c
index ec6a983..b97602b 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c
@@ -58,4 +58,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-block-1.c b/gcc/testsuite/gcc.dg/graphite/uns-block-1.c
index 19f358d..5b61eea 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-block-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-block-1.c
@@ -45,4 +45,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c
index 2b957f5..a53c98e 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c
@@ -54,5 +54,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c
index 960e7ae..1e180c6 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c
@@ -55,5 +55,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c
index 5c5597f..dcf4738 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c
@@ -49,4 +49,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c
index 153fc8e..8f9111a 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c
@@ -59,4 +59,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gfortran.dg/graphite/pr14741.f90 b/gcc/testsuite/gfortran.dg/graphite/pr14741.f90
index 057e57e..50c2e79 100644
--- a/gcc/testsuite/gfortran.dg/graphite/pr14741.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/pr14741.f90
@@ -24,4 +24,4 @@ SUBROUTINE mult(A,B,C,N)
ENDDO
END SUBROUTINE mult
-! { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } }
+! { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } }
--
2.5.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 06/15] fix codegen error exposed by compute isl flow patch
2016-01-15 17:14 [PATCH 01/15] add more coalescing to simplify constraints Sebastian Pop
` (4 preceding siblings ...)
2016-01-15 17:15 ` [PATCH 10/15] rewrite computation of iteration domains Sebastian Pop
@ 2016-01-15 17:15 ` Sebastian Pop
2016-01-15 17:15 ` [PATCH 03/15] fix PR68343: disable graphite tests for isl 0.14 or earlier Sebastian Pop
` (6 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Sebastian Pop @ 2016-01-15 17:15 UTC (permalink / raw)
To: gcc-patches; +Cc: hiraditya, sebpop, richard.guenther, Sebastian Pop
From: Sebastian Pop <s.pop@samsung.com>
we used to fail using an iv from a different loop.
* graphite-isl-ast-to-gimple.c (enum phi_node_kind): New.
(class translate_isl_ast_to_gimple): Use phi_node_kind instead of bool.
(is_valid_rename): Same.
(translate_isl_ast_to_gimple::get_rename): Same.
(translate_isl_ast_to_gimple::rename_all_uses): Same.
(translate_isl_ast_to_gimple::rename_uses): Same.
(get_new_name): Check for close_phi nodes.
(copy_loop_phi_args): Use phi_node_kind.
(translate_isl_ast_to_gimple::copy_loop_close_phi_args): Same.
(translate_isl_ast_to_gimple::copy_cond_phi_args): Same.
gcc/testsuite
* gfortran.dg/graphite/interchange-3.f90: Adjust pattern.
---
gcc/graphite-isl-ast-to-gimple.c | 48 ++++++++++++++--------
.../gfortran.dg/graphite/interchange-3.f90 | 2 +-
2 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c
index b0da425..a196419 100644
--- a/gcc/graphite-isl-ast-to-gimple.c
+++ b/gcc/graphite-isl-ast-to-gimple.c
@@ -135,6 +135,14 @@ set_separate_option (__isl_take isl_schedule_node *node, void *user)
return node;
}
+enum phi_node_kind
+{
+ unknown_phi,
+ loop_phi,
+ close_phi,
+ cond_phi
+};
+
class translate_isl_ast_to_gimple
{
public:
@@ -317,14 +325,14 @@ class translate_isl_ast_to_gimple
SSA form. */
bool is_valid_rename (tree rename, basic_block def_bb, basic_block use_bb,
- bool loop_phi, tree old_name, basic_block old_bb) const;
+ phi_node_kind, tree old_name, basic_block old_bb) const;
/* Returns the expression associated to OLD_NAME (which is used in OLD_BB), in
NEW_BB from RENAME_MAP. LOOP_PHI is true when we want to rename OLD_NAME
within a loop PHI instruction. */
tree get_rename (basic_block new_bb, tree old_name,
- basic_block old_bb, bool loop_phi) const;
+ basic_block old_bb, phi_node_kind) const;
/* For ops which are scev_analyzeable, we can regenerate a new name from
its scalar evolution around LOOP. */
@@ -344,7 +352,7 @@ class translate_isl_ast_to_gimple
true when we want to rename an OP within a loop PHI instruction. */
tree get_new_name (basic_block new_bb, tree op,
- basic_block old_bb, bool loop_phi) const;
+ basic_block old_bb, phi_node_kind) const;
/* Collect all the operands of NEW_EXPR by recursively visiting each
operand. */
@@ -1349,7 +1357,7 @@ phi_uses_name (basic_block bb, tree name)
bool
translate_isl_ast_to_gimple::
is_valid_rename (tree rename, basic_block def_bb, basic_block use_bb,
- bool loop_phi, tree old_name, basic_block old_bb) const
+ phi_node_kind phi_kind, tree old_name, basic_block old_bb) const
{
/* The def of the rename must either dominate the uses or come from a
back-edge. Also the def must respect the loop closed ssa form. */
@@ -1367,7 +1375,7 @@ is_valid_rename (tree rename, basic_block def_bb, basic_block use_bb,
if (dominated_by_p (CDI_DOMINATORS, use_bb, def_bb))
return true;
- if (bb_contains_loop_phi_nodes (use_bb) && loop_phi)
+ if (bb_contains_loop_phi_nodes (use_bb) && phi_kind == loop_phi)
{
/* The loop-header dominates the loop-body. */
if (!dominated_by_p (CDI_DOMINATORS, def_bb, use_bb))
@@ -1386,14 +1394,13 @@ is_valid_rename (tree rename, basic_block def_bb, basic_block use_bb,
}
/* Returns the expression associated to OLD_NAME (which is used in OLD_BB), in
- NEW_BB from RENAME_MAP. LOOP_PHI is true when we want to rename OLD_NAME
- within a loop PHI instruction. */
+ NEW_BB from RENAME_MAP. PHI_KIND determines the kind of phi node. */
tree
translate_isl_ast_to_gimple::get_rename (basic_block new_bb,
tree old_name,
basic_block old_bb,
- bool loop_phi) const
+ phi_node_kind phi_kind) const
{
gcc_assert (TREE_CODE (old_name) == SSA_NAME);
vec <tree> *renames = region->rename_map->get (old_name);
@@ -1407,7 +1414,9 @@ translate_isl_ast_to_gimple::get_rename (basic_block new_bb,
if (TREE_CODE (rename) == SSA_NAME)
{
basic_block bb = gimple_bb (SSA_NAME_DEF_STMT (rename));
- if (is_valid_rename (rename, bb, new_bb, loop_phi, old_name, old_bb))
+ if (is_valid_rename (rename, bb, new_bb, phi_kind, old_name, old_bb)
+ && (phi_kind == close_phi
+ || flow_bb_inside_loop_p (bb->loop_father, new_bb)))
return rename;
return NULL_TREE;
}
@@ -1435,6 +1444,9 @@ translate_isl_ast_to_gimple::get_rename (basic_block new_bb,
if (!dominated_by_p (CDI_DOMINATORS, new_bb, t2_bb))
continue;
+ if (!flow_bb_inside_loop_p (t2_bb->loop_father, new_bb))
+ continue;
+
/* Compute the nearest dominator. */
if (!t1 || dominated_by_p (CDI_DOMINATORS, t2_bb, t1_bb))
{
@@ -1756,7 +1768,7 @@ translate_isl_ast_to_gimple::rename_all_uses (tree new_expr, basic_block new_bb,
tree t;
int i;
FOR_EACH_VEC_ELT (ssa_names, i, t)
- if (tree r = get_rename (new_bb, t, old_bb, false))
+ if (tree r = get_rename (new_bb, t, old_bb, unknown_phi))
new_expr = substitute_ssa_name (new_expr, t, r);
return new_expr;
@@ -1887,7 +1899,7 @@ translate_isl_ast_to_gimple::rename_uses (gimple *copy,
changed = true;
tree new_expr = get_rename (gsi_tgt->bb, old_name,
- old_bb, false);
+ old_bb, unknown_phi);
if (new_expr)
{
@@ -1986,19 +1998,19 @@ translate_isl_ast_to_gimple::get_def_bb_for_const (basic_block bb,
return b1;
}
-/* Get the new name of OP (from OLD_BB) to be used in NEW_BB. LOOP_PHI is true
- when we want to rename an OP within a loop PHI instruction. */
+/* Get the new name of OP (from OLD_BB) to be used in NEW_BB. PHI_KIND
+ determines the kind of phi node. */
tree
translate_isl_ast_to_gimple::
get_new_name (basic_block new_bb, tree op,
- basic_block old_bb, bool loop_phi) const
+ basic_block old_bb, phi_node_kind phi_kind) const
{
/* For constants the names are the same. */
if (is_constant (op))
return op;
- return get_rename (new_bb, op, old_bb, loop_phi);
+ return get_rename (new_bb, op, old_bb, phi_kind);
}
/* Return a debug location for OP. */
@@ -2053,7 +2065,7 @@ copy_loop_phi_args (gphi *old_phi, init_back_edge_pair_t &ibp_old_bb,
tree old_name = gimple_phi_arg_def (old_phi, i);
tree new_name = get_new_name (new_bb, old_name,
- gimple_bb (old_phi), true);
+ gimple_bb (old_phi), loop_phi);
if (new_name)
{
add_phi_arg (new_phi, new_name, e, get_loc (old_name));
@@ -2315,7 +2327,7 @@ translate_isl_ast_to_gimple::copy_loop_close_phi_args (basic_block old_bb,
set_rename (res, new_res);
tree old_name = gimple_phi_arg_def (old_close_phi, 0);
- tree new_name = get_new_name (new_bb, old_name, old_bb, false);
+ tree new_name = get_new_name (new_bb, old_name, old_bb, close_phi);
/* Predecessor basic blocks of a loop close phi should have been code
generated before. FIXME: This is fixable by merging PHIs from inner
@@ -2589,7 +2601,7 @@ translate_isl_ast_to_gimple::copy_cond_phi_args (gphi *phi, gphi *new_phi,
for (unsigned i = 0; i < gimple_phi_num_args (phi); i++)
{
tree old_name = gimple_phi_arg_def (phi, i);
- tree new_name = get_new_name (new_bb, old_name, old_bb, false);
+ tree new_name = get_new_name (new_bb, old_name, old_bb, cond_phi);
old_phi_args[i] = old_name;
if (new_name)
{
diff --git a/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90 b/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90
index 6c16a19..a66ddfd 100644
--- a/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90
@@ -24,4 +24,4 @@ Program FOO
end Program FOO
-! { dg-final { scan-tree-dump-times "unsuccessful in translating pending phis" "1" "graphite" } }
+! { dg-final { scan-tree-dump-times "unsuccessful, reverting back to the original code." "1" "graphite" } }
--
2.5.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 09/15] fix memory leak in scop-detection
2016-01-15 17:14 [PATCH 01/15] add more coalescing to simplify constraints Sebastian Pop
` (6 preceding siblings ...)
2016-01-15 17:15 ` [PATCH 03/15] fix PR68343: disable graphite tests for isl 0.14 or earlier Sebastian Pop
@ 2016-01-15 17:15 ` Sebastian Pop
2016-01-15 17:15 ` [PATCH 08/15] record loops in execution order Sebastian Pop
` (4 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Sebastian Pop @ 2016-01-15 17:15 UTC (permalink / raw)
To: gcc-patches; +Cc: hiraditya, sebpop, richard.guenther, Sebastian Pop
From: Sebastian Pop <s.pop@samsung.com>
* graphite-scop-detection.c
(scop_detection::harmful_loop_in_region): Free dom and loops.
(scop_detection::loop_body_is_valid_scop): Free bbs.
---
gcc/graphite-scop-detection.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index be33be3..a0c630b 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1088,7 +1088,11 @@ scop_detection::harmful_loop_in_region (sese_l scop) const
any loop fully contained in the scop: other bbs are checked below
in loop_is_valid_in_scop. */
if (harmful_stmt_in_bb (scop, bb))
- return true;
+ {
+ dom.release ();
+ BITMAP_FREE (loops);
+ return true;
+ }
}
}
@@ -1104,13 +1108,14 @@ scop_detection::harmful_loop_in_region (sese_l scop) const
if (!loop_is_valid_in_scop (loop, scop))
{
+ dom.release ();
BITMAP_FREE (loops);
return true;
}
}
- BITMAP_FREE (loops);
dom.release ();
+ BITMAP_FREE (loops);
return false;
}
@@ -1503,7 +1508,10 @@ scop_detection::loop_body_is_valid_scop (loop_p loop, sese_l scop) const
basic_block bb = bbs[i];
if (harmful_stmt_in_bb (scop, bb))
- return false;
+ {
+ free (bbs);
+ return false;
+ }
}
free (bbs);
--
2.5.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 02/15] remove unused variable
2016-01-15 17:14 [PATCH 01/15] add more coalescing to simplify constraints Sebastian Pop
@ 2016-01-15 17:15 ` Sebastian Pop
2016-01-15 17:15 ` [PATCH 05/15] remove tiling Sebastian Pop
` (11 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Sebastian Pop @ 2016-01-15 17:15 UTC (permalink / raw)
To: gcc-patches; +Cc: hiraditya, sebpop, richard.guenther, Sebastian Pop
From: Sebastian Pop <s.pop@samsung.com>
2015-12-30 Sebastian Pop <sebpop@gmail.com>
* graphite-poly.c (new_poly_bb): Remove use of PBB_IS_REDUCTION.
* graphite.h (struct poly_bb): Remove field is_reduction.
(PBB_IS_REDUCTION): Remove.
---
gcc/graphite-poly.c | 1 -
gcc/graphite.h | 4 ----
2 files changed, 5 deletions(-)
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index d188341..428c427 100644
--- a/gcc/graphite-poly.c
+++ b/gcc/graphite-poly.c
@@ -164,7 +164,6 @@ new_poly_bb (scop_p scop, gimple_poly_bb_p black_box)
PBB_SCOP (pbb) = scop;
pbb_set_black_box (pbb, black_box);
PBB_DRS (pbb).create (3);
- PBB_IS_REDUCTION (pbb) = false;
GBB_PBB ((gimple_poly_bb_p) black_box) = pbb;
return pbb;
diff --git a/gcc/graphite.h b/gcc/graphite.h
index 83f8191..f9af292 100644
--- a/gcc/graphite.h
+++ b/gcc/graphite.h
@@ -281,9 +281,6 @@ struct poly_bb
/* A copy of the transformed scattering. */
isl_map *saved;
- /* True when this PBB contains only a reduction statement. */
- bool is_reduction;
-
/* The last basic block generated for this pbb. */
basic_block new_bb;
};
@@ -291,7 +288,6 @@ struct poly_bb
#define PBB_BLACK_BOX(PBB) ((gimple_poly_bb_p) PBB->black_box)
#define PBB_SCOP(PBB) (PBB->scop)
#define PBB_DRS(PBB) (PBB->drs)
-#define PBB_IS_REDUCTION(PBB) (PBB->is_reduction)
extern poly_bb_p new_poly_bb (scop_p, gimple_poly_bb_p);
extern void free_poly_bb (poly_bb_p);
--
2.5.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 10/15] rewrite computation of iteration domains
2016-01-15 17:14 [PATCH 01/15] add more coalescing to simplify constraints Sebastian Pop
` (3 preceding siblings ...)
2016-01-15 17:15 ` [PATCH 07/15] check that all loops are valid in the combined region Sebastian Pop
@ 2016-01-15 17:15 ` Sebastian Pop
2016-01-15 17:15 ` [PATCH 06/15] fix codegen error exposed by compute isl flow patch Sebastian Pop
` (7 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Sebastian Pop @ 2016-01-15 17:15 UTC (permalink / raw)
To: gcc-patches; +Cc: hiraditya, sebpop, richard.guenther, Sebastian Pop
From: Sebastian Pop <s.pop@samsung.com>
* graphite-sese-to-poly.c (set_scop_parameter_dim): Remove.
(cleanup_loop_iter_dom): Remove.
(build_loop_iteration_domains): Remove.
(build_scop_context): Remove.
(build_scop_iteration_domain): Remove.
(add_loop_constraints): New.
(build_iteration_domains): New.
(build_poly_scop): Call build_iteration_domains.
---
gcc/graphite-sese-to-poly.c | 407 +++++++++++++++++++++-----------------------
1 file changed, 192 insertions(+), 215 deletions(-)
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 78dc2fb..abf18a7 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -431,159 +431,6 @@ extract_affine (scop_p s, tree e, __isl_take isl_space *space)
return res;
}
-/* Assign dimension for each parameter in SCOP. */
-
-static void
-set_scop_parameter_dim (scop_p scop)
-{
- sese_info_p region = scop->scop_info;
- unsigned nbp = sese_nb_params (region);
- isl_space *space = isl_space_set_alloc (scop->isl_context, nbp, 0);
-
- unsigned i;
- tree e;
- FOR_EACH_VEC_ELT (region->params, i, e)
- space = isl_space_set_dim_id (space, isl_dim_param, i,
- isl_id_for_ssa_name (scop, e));
-
- scop->param_context = isl_set_universe (space);
-}
-
-static inline bool
-cleanup_loop_iter_dom (isl_set *inner, isl_set *outer, isl_space *space, mpz_t g)
-{
- isl_set_free (inner);
- isl_set_free (outer);
- isl_space_free (space);
- mpz_clear (g);
- return false;
-}
-
-/* Builds the constraint polyhedra for LOOP in SCOP. OUTER_PH gives
- the constraints for the surrounding loops. */
-
-static bool
-build_loop_iteration_domains (scop_p scop, struct loop *loop,
- int nb,
- isl_set *outer, isl_set **doms)
-{
-
- tree nb_iters = number_of_latch_executions (loop);
- const sese_l& region = scop->scop_info->region;
- gcc_assert (loop_in_sese_p (loop, region));
-
- isl_set *inner = isl_set_copy (outer);
- int pos = isl_set_dim (outer, isl_dim_set);
- isl_val *v;
- mpz_t g;
-
- mpz_init (g);
-
- inner = isl_set_add_dims (inner, isl_dim_set, 1);
- isl_space *space = isl_set_get_space (inner);
-
- /* 0 <= loop_i */
- isl_constraint *c = isl_inequality_alloc
- (isl_local_space_from_space (isl_space_copy (space)));
- c = isl_constraint_set_coefficient_si (c, isl_dim_set, pos, 1);
- inner = isl_set_coalesce (isl_set_add_constraint (inner, c));
-
- /* loop_i <= cst_nb_iters */
- if (TREE_CODE (nb_iters) == INTEGER_CST)
- {
- c = isl_inequality_alloc
- (isl_local_space_from_space (isl_space_copy (space)));
- c = isl_constraint_set_coefficient_si (c, isl_dim_set, pos, -1);
- tree_int_to_gmp (nb_iters, g);
- v = isl_val_int_from_gmp (scop->isl_context, g);
- c = isl_constraint_set_constant_val (c, v);
- inner = isl_set_add_constraint (inner, c);
- }
-
- /* loop_i <= expr_nb_iters */
- else if (!chrec_contains_undetermined (nb_iters))
- {
- isl_pw_aff *aff;
-
- nb_iters = scalar_evolution_in_region (region, loop, nb_iters);
-
- /* Bail out as we do not know the scev. */
- if (chrec_contains_undetermined (nb_iters))
- return cleanup_loop_iter_dom (inner, outer, space, g);
-
- aff = extract_affine (scop, nb_iters, isl_set_get_space (inner));
- isl_set *valid = isl_pw_aff_nonneg_set (isl_pw_aff_copy (aff));
- valid = isl_set_project_out (valid, isl_dim_set, 0,
- isl_set_dim (valid, isl_dim_set));
-
- if (valid)
- scop->param_context = isl_set_coalesce
- (isl_set_intersect (scop->param_context, valid));
-
- isl_local_space *ls = isl_local_space_from_space (isl_space_copy (space));
- isl_aff *al = isl_aff_set_coefficient_si (isl_aff_zero_on_domain (ls),
- isl_dim_in, pos, 1);
- isl_set *le = isl_pw_aff_le_set (isl_pw_aff_from_aff (al),
- isl_pw_aff_copy (aff));
- inner = isl_set_intersect (inner, le);
-
- widest_int nit;
- if (max_stmt_executions (loop, &nit))
- {
- /* Insert in the context the constraints from the
- estimation of the number of iterations NIT and the
- symbolic number of iterations (involving parameter
- names) NB_ITERS. First, build the affine expression
- "NIT - NB_ITERS" and then say that it is positive,
- i.e., NIT approximates NB_ITERS: "NIT >= NB_ITERS". */
- mpz_t g;
- mpz_init (g);
- wi::to_mpz (nit, g, SIGNED);
- mpz_sub_ui (g, g, 1);
-
- isl_pw_aff *approx
- = extract_affine_gmp (g, isl_set_get_space (inner));
- isl_set *x = isl_pw_aff_ge_set (approx, aff);
- x = isl_set_project_out (x, isl_dim_set, 0,
- isl_set_dim (x, isl_dim_set));
- scop->param_context = isl_set_coalesce
- (isl_set_intersect (scop->param_context, x));
-
- isl_constraint *c = isl_inequality_alloc
- (isl_local_space_from_space (isl_space_copy (space)));
- c = isl_constraint_set_coefficient_si (c, isl_dim_set, pos, -1);
- v = isl_val_int_from_gmp (scop->isl_context, g);
- mpz_clear (g);
- c = isl_constraint_set_constant_val (c, v);
- inner = isl_set_add_constraint (inner, c);
- }
- else
- isl_pw_aff_free (aff);
- }
- else
- gcc_unreachable ();
-
- inner = isl_set_coalesce (inner);
- if (loop->inner
- && !build_loop_iteration_domains (scop, loop->inner, nb + 1,
- isl_set_copy (inner), doms))
- return cleanup_loop_iter_dom (inner, outer, space, g);
-
- if (nb != 0
- && loop->next
- && loop_in_sese_p (loop->next, region)
- && !build_loop_iteration_domains (scop, loop->next, nb,
- isl_set_copy (outer), doms))
- return cleanup_loop_iter_dom (inner, outer, space, g);
-
- doms[loop->num] = inner;
-
- isl_set_free (outer);
- isl_space_free (space);
- mpz_clear (g);
- return true;
-}
-
/* Returns a linear expression for tree T evaluated in PBB. */
static isl_pw_aff *
@@ -781,64 +628,6 @@ add_param_constraints (scop_p scop, graphite_dim_t p)
}
}
-/* Build the context of the SCOP. The context usually contains extra
- constraints that are added to the iteration domains that constrain
- some parameters. */
-
-static void
-build_scop_context (scop_p scop)
-{
- graphite_dim_t p, n = scop_nb_params (scop);
-
- for (p = 0; p < n; p++)
- add_param_constraints (scop, p);
-}
-
-/* Build the iteration domains: the loops belonging to the current
- SCOP, and that vary for the execution of the current basic block.
- Returns false if there is no loop in SCOP. */
-
-static bool
-build_scop_iteration_domain (scop_p scop)
-{
- sese_info_p region = scop->scop_info;
- int nb_loops = number_of_loops (cfun);
- isl_set **doms = XCNEWVEC (isl_set *, nb_loops);
- bool res = true;
- int i;
- struct loop *loop;
- FOR_EACH_VEC_ELT (region->loop_nest, i, loop)
- if (!loop_in_sese_p (loop_outer (loop), region->region)
- && !build_loop_iteration_domains (scop, loop, 0,
- isl_set_copy (scop->param_context), doms))
- {
- res = false;
- goto cleanup;
- }
-
- poly_bb_p pbb;
- FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
- {
- loop = pbb_loop (pbb);
-
- if (doms[loop->num])
- pbb->domain = isl_set_copy (doms[loop->num]);
- else
- pbb->domain = isl_set_copy (scop->param_context);
-
- pbb->domain = isl_set_set_tuple_id (pbb->domain,
- isl_id_for_pbb (scop, pbb));
- }
-
- cleanup:
- for (int i = 0; i < nb_loops; i++)
- if (doms[i])
- isl_set_free (doms[i]);
-
- free (doms);
- return res;
-}
-
/* Add a constrain to the ACCESSES polyhedron for the alias set of
data reference DR. ACCESSP_NB_DIMS is the dimension of the
ACCESSES polyhedron, DOM_NB_DIMS is the dimension of the iteration
@@ -1109,17 +898,205 @@ build_scop_drs (scop_p scop)
build_poly_sr (pbb);
}
+/* Add constraints to DOMAIN for each loop from LOOP up to CONTEXT. */
+
+static isl_set *
+add_loop_constraints (scop_p scop, __isl_take isl_set *domain, loop_p loop,
+ loop_p context)
+{
+ if (loop == context)
+ return domain;
+ const sese_l ®ion = scop->scop_info->region;
+ if (!loop_in_sese_p (loop, region))
+ return domain;
+
+ /* Recursion all the way up to the context loop. */
+ domain = add_loop_constraints (scop, domain, loop_outer (loop), context);
+
+ /* Then, build constraints over the loop in post-order: outer to inner. */
+
+ int loop_index = isl_set_dim (domain, isl_dim_set);
+ if (dump_file)
+ fprintf (dump_file, "[sese-to-poly] adding one extra dimension to the "
+ "domain for loop_%d.\n", loop->num);
+ domain = isl_set_add_dims (domain, isl_dim_set, 1);
+ isl_space *space = isl_set_get_space (domain);
+
+ /* 0 <= loop_i */
+ isl_local_space *ls = isl_local_space_from_space (isl_space_copy (space));
+ isl_constraint *c = isl_inequality_alloc (ls);
+ c = isl_constraint_set_coefficient_si (c, isl_dim_set, loop_index, 1);
+ if (dump_file)
+ {
+ fprintf (dump_file, "[sese-to-poly] adding constraint to the domain: ");
+ print_isl_constraint (dump_file, c);
+ }
+ domain = isl_set_add_constraint (domain, c);
+
+ tree nb_iters = number_of_latch_executions (loop);
+ if (TREE_CODE (nb_iters) == INTEGER_CST)
+ {
+ /* loop_i <= cst_nb_iters */
+ isl_local_space *ls = isl_local_space_from_space (space);
+ isl_constraint *c = isl_inequality_alloc (ls);
+ c = isl_constraint_set_coefficient_si (c, isl_dim_set, loop_index, -1);
+ mpz_t g;
+ mpz_init (g);
+ tree_int_to_gmp (nb_iters, g);
+ isl_val *v = isl_val_int_from_gmp (scop->isl_context, g);
+ mpz_clear (g);
+ c = isl_constraint_set_constant_val (c, v);
+ return isl_set_add_constraint (domain, c);
+ }
+ /* loop_i <= expr_nb_iters */
+ gcc_assert (!chrec_contains_undetermined (nb_iters));
+ nb_iters = scalar_evolution_in_region (region, loop, nb_iters);
+ gcc_assert (!chrec_contains_undetermined (nb_iters));
+
+ isl_pw_aff *aff_nb_iters = extract_affine (scop, nb_iters,
+ isl_space_copy (space));
+ isl_set *valid = isl_pw_aff_nonneg_set (isl_pw_aff_copy (aff_nb_iters));
+ valid = isl_set_project_out (valid, isl_dim_set, 0,
+ isl_set_dim (valid, isl_dim_set));
+
+ if (valid)
+ scop->param_context = isl_set_intersect (scop->param_context, valid);
+
+ ls = isl_local_space_from_space (isl_space_copy (space));
+ isl_aff *loop_i = isl_aff_set_coefficient_si (isl_aff_zero_on_domain (ls),
+ isl_dim_in, loop_index, 1);
+ isl_set *le = isl_pw_aff_le_set (isl_pw_aff_from_aff (loop_i),
+ isl_pw_aff_copy (aff_nb_iters));
+ if (dump_file)
+ {
+ fprintf (dump_file, "[sese-to-poly] adding constraint to the domain: ");
+ print_isl_set (dump_file, le);
+ }
+ domain = isl_set_intersect (domain, le);
+
+ widest_int nit;
+ if (!max_stmt_executions (loop, &nit))
+ {
+ isl_pw_aff_free (aff_nb_iters);
+ isl_space_free (space);
+ return domain;
+ }
+
+ /* NIT is an upper bound to NB_ITERS: "NIT >= NB_ITERS", although we
+ do not know whether the loop executes at least once. */
+ mpz_t g;
+ mpz_init (g);
+ wi::to_mpz (nit, g, SIGNED);
+ mpz_sub_ui (g, g, 1);
+
+ isl_pw_aff *approx = extract_affine_gmp (g, isl_space_copy (space));
+ isl_set *x = isl_pw_aff_ge_set (approx, aff_nb_iters);
+ x = isl_set_project_out (x, isl_dim_set, 0,
+ isl_set_dim (x, isl_dim_set));
+ scop->param_context = isl_set_intersect (scop->param_context, x);
+
+ ls = isl_local_space_from_space (space);
+ c = isl_inequality_alloc (ls);
+ c = isl_constraint_set_coefficient_si (c, isl_dim_set, loop_index, -1);
+ isl_val *v = isl_val_int_from_gmp (scop->isl_context, g);
+ mpz_clear (g);
+ c = isl_constraint_set_constant_val (c, v);
+
+ if (dump_file)
+ {
+ fprintf (dump_file, "[sese-to-poly] adding constraint to the domain: ");
+ print_isl_constraint (dump_file, c);
+ }
+
+ return isl_set_add_constraint (domain, c);
+}
+
+/* Builds the original iteration domains for each pbb in the SCOP. */
+
+static int
+build_iteration_domains (scop_p scop, __isl_keep isl_set *context, int index,
+ loop_p context_loop)
+{
+ loop_p current = pbb_loop (scop->pbbs[index]);
+ isl_set *domain = isl_set_copy (context);
+ domain = add_loop_constraints (scop, domain, current, context_loop);
+ const sese_l ®ion = scop->scop_info->region;
+
+ int i;
+ poly_bb_p pbb;
+ FOR_EACH_VEC_ELT_FROM (scop->pbbs, i, pbb, index)
+ {
+ loop_p loop = pbb_loop (pbb);
+ if (current == loop)
+ {
+ pbb->domain = isl_set_copy (domain);
+ pbb->domain = isl_set_set_tuple_id (pbb->domain,
+ isl_id_for_pbb (scop, pbb));
+ if (dump_file)
+ {
+ fprintf (dump_file, "[sese-to-poly] set pbb_%d->domain: ",
+ pbb_index (pbb));
+ print_isl_set (dump_file, domain);
+ }
+ continue;
+ }
+
+ while (loop_in_sese_p (loop, region)
+ && current != loop)
+ loop = loop_outer (loop);
+
+ if (current != loop)
+ {
+ /* A statement in a different loop nest than CURRENT loop. */
+ isl_set_free (domain);
+ return i;
+ }
+
+ /* A statement nested in the CURRENT loop. */
+ i = build_iteration_domains (scop, domain, i, current);
+ i--;
+ }
+
+ isl_set_free (domain);
+ return i;
+}
+
+
+/* Assign dimension for each parameter in SCOP and add constraints for the
+ parameters. */
+
+static void
+build_scop_context (scop_p scop)
+{
+ sese_info_p region = scop->scop_info;
+ unsigned nbp = sese_nb_params (region);
+ isl_space *space = isl_space_set_alloc (scop->isl_context, nbp, 0);
+
+ unsigned i;
+ tree e;
+ FOR_EACH_VEC_ELT (region->params, i, e)
+ space = isl_space_set_dim_id (space, isl_dim_param, i,
+ isl_id_for_ssa_name (scop, e));
+
+ scop->param_context = isl_set_universe (space);
+
+ graphite_dim_t p;
+ for (p = 0; p < nbp; p++)
+ add_param_constraints (scop, p);
+}
+
/* Builds the polyhedral representation for a SESE region. */
bool
build_poly_scop (scop_p scop)
{
- set_scop_parameter_dim (scop);
- if (!build_scop_iteration_domain (scop))
- return false;
-
build_scop_context (scop);
+ unsigned i = 0;
+ unsigned n = scop->pbbs.length ();
+ while (i < n)
+ i = build_iteration_domains (scop, scop->param_context, i, NULL);
+
if (!add_conditions_to_constraints (scop))
return false;
--
2.5.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 12/15] new scop schedule.
2016-01-15 17:14 [PATCH 01/15] add more coalescing to simplify constraints Sebastian Pop
` (10 preceding siblings ...)
2016-01-15 17:15 ` [PATCH 04/15] add missing ast node for isl 0.15 Sebastian Pop
@ 2016-01-15 17:16 ` Sebastian Pop
2016-01-21 14:22 ` [PATCH 01/15] add more coalescing to simplify constraints Matthew Wahab
12 siblings, 0 replies; 15+ messages in thread
From: Sebastian Pop @ 2016-01-15 17:16 UTC (permalink / raw)
To: gcc-patches; +Cc: hiraditya, sebpop, richard.guenther, Sebastian Pop
From: Sebastian Pop <s.pop@samsung.com>
* graphite-dependences.c (scop_get_reads): Do not call
isl_union_map_add_map that is undocumented isl functionality.
(scop_get_must_writes): Same.
(scop_get_may_writes): Same.
(scop_get_original_schedule): Remove.
(scop_get_dependences): Do not call isl_union_map_compute_flow that
is deprecated in isl 0.15. Instead, use isl_union_access_* interface.
(compute_deps): Remove.
* graphite-isl-ast-to-gimple.c (print_schedule_ast): New.
(debug_schedule_ast): New.
(translate_isl_ast_to_gimple::print_isl_ast_node): Removed.
(translate_isl_ast_to_gimple::get_max_schedule_dimensions): Remove.
(translate_isl_ast_to_gimple::extend_schedule): Remove.
(translate_isl_ast_to_gimple::generate_isl_schedule): Remove.
(translate_isl_ast_to_gimple::set_options): Remove.
(translate_isl_ast_to_gimple::scop_to_isl_ast): Generate code
from scop->transformed_schedule.
(graphite_regenerate_ast_isl): Add more dump.
* graphite-optimize-isl.c (optimize_isl): Set
scop->transformed_schedule. Check whether schedules are equal.
(apply_poly_transforms): Move here.
* graphite-poly.c (apply_poly_transforms): ... from here.
(free_poly_bb): Static.
(free_scop): Static.
(pbb_number_of_iterations_at_time): Remove.
(print_isl_ast): New.
(debug_isl_ast): New.
(debug_scop_pbb): New.
* graphite-scop-detection.c (print_edge): Move.
(print_sese): Move.
* graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons): Remove.
(build_scop_scattering): Remove.
(create_pw_aff_from_tree): Assert instead of bailing out.
(add_condition_to_pbb): Remove unused code, do not fail.
(add_conditions_to_domain): Same.
(add_conditions_to_constraints): Remove.
(build_scop_context): New.
(add_iter_domain_dimension): New.
(build_iteration_domains): Initialize pbb->iterators.
Call add_conditions_to_domain.
(nested_in): New.
(loop_at): New.
(index_outermost_in_loop): New.
(index_pbb_in_loop): New.
(outermost_pbb_in): New.
(add_in_sequence): New.
(add_outer_projection): New.
(outer_projection_mupa): New.
(add_loop_schedule): New.
(build_schedule_pbb): New.
(build_schedule_loop): New.
(embed_in_surrounding_loops): New.
(build_schedule_loop_nest): New.
(build_original_schedule): New.
(build_poly_scop): Call build_original_schedule.
* graphite.h (free_poly_dr): Remove.
(struct poly_bb): Add iterators. Remove schedule, transformed, saved.
(free_poly_bb): Remove.
(debug_loop_vec): Remove.
(print_isl_ast): Declare.
(debug_isl_ast): Declare.
(scop_do_interchange): Remove.
(scop_do_strip_mine): Remove.
(scop_do_block): Remove.
(flatten_all_loops): Remove.
(optimize_isl): Remove.
(pbb_number_of_iterations_at_time): Remove.
(debug_scop_pbb): Declare.
(print_schedule_ast): Declare.
(debug_schedule_ast): Declare.
(struct scop): Remove schedule. Add original_schedule,
transformed_schedule.
(free_gimple_poly_bb): Remove.
(print_generated_program): Remove.
(debug_generated_program): Remove.
(unify_scattering_dimensions): Remove.
* sese.c (print_edge): ... here.
(print_sese): ... here.
(debug_edge): ... here.
(debug_sese): ... here.
* sese.h (print_edge): Declare.
(print_sese): Declare.
(dump_edge): Declare.
(dump_sese): Declare.
gcc/testsuite
* gcc.dg/graphite/block-0.c: Adjust pattern.
* gcc.dg/graphite/block-1.c: Same.
* gcc.dg/graphite/block-5.c: Same.
* gcc.dg/graphite/block-6.c: Same.
* gcc.dg/graphite/block-pr47654.c: Same.
* gcc.dg/graphite/interchange-0.c: Same.
* gcc.dg/graphite/interchange-10.c: Same.
* gcc.dg/graphite/interchange-12.c: Same.
* gcc.dg/graphite/interchange-14.c: Same.
* gcc.dg/graphite/interchange-15.c: Same.
* gcc.dg/graphite/interchange-5.c: Same.
* gcc.dg/graphite/interchange-6.c: Same.
* gcc.dg/graphite/interchange-8.c: Same.
* gcc.dg/graphite/interchange-mvt.c: Same.
* gcc.dg/graphite/pr35356-1.c: Same.
* gcc.dg/graphite/scop-10.c (int toto): Same.
* gcc.dg/graphite/uns-block-1.c: Same.
* gcc.dg/graphite/uns-interchange-12.c: Same.
* gcc.dg/graphite/uns-interchange-14.c: Same.
* gcc.dg/graphite/uns-interchange-15.c: Same.
* gcc.dg/graphite/uns-interchange-mvt.c: Same.
* gfortran.dg/graphite/interchange-3.f90: Same.
* gfortran.dg/graphite/pr14741.f90: Same.
---
gcc/graphite-dependences.c | 169 +++----
gcc/graphite-isl-ast-to-gimple.c | 232 ++-------
gcc/graphite-optimize-isl.c | 83 +++-
gcc/graphite-poly.c | 115 ++---
gcc/graphite-scop-detection.c | 15 -
gcc/graphite-sese-to-poly.c | 531 +++++++++++++--------
gcc/graphite.h | 41 +-
gcc/sese.c | 34 ++
gcc/sese.h | 7 +-
gcc/testsuite/gcc.dg/graphite/block-0.c | 2 +-
gcc/testsuite/gcc.dg/graphite/block-1.c | 2 +-
gcc/testsuite/gcc.dg/graphite/block-5.c | 3 +-
gcc/testsuite/gcc.dg/graphite/block-6.c | 2 +-
gcc/testsuite/gcc.dg/graphite/block-pr47654.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-0.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-10.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-12.c | 3 +-
gcc/testsuite/gcc.dg/graphite/interchange-14.c | 3 +-
gcc/testsuite/gcc.dg/graphite/interchange-15.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-5.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-6.c | 2 +-
gcc/testsuite/gcc.dg/graphite/interchange-8.c | 3 +-
gcc/testsuite/gcc.dg/graphite/interchange-mvt.c | 2 +-
gcc/testsuite/gcc.dg/graphite/pr35356-1.c | 3 +-
gcc/testsuite/gcc.dg/graphite/scop-10.c | 2 +-
gcc/testsuite/gcc.dg/graphite/uns-block-1.c | 2 +-
gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c | 3 +-
gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c | 3 +-
gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c | 2 +-
.../gcc.dg/graphite/uns-interchange-mvt.c | 2 +-
.../gfortran.dg/graphite/interchange-3.f90 | 2 +-
gcc/testsuite/gfortran.dg/graphite/pr14741.f90 | 2 +-
32 files changed, 613 insertions(+), 667 deletions(-)
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index ae08059..161e019 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -66,7 +66,7 @@ add_pdr_constraints (poly_dr_p pdr, poly_bb_p pbb)
/* Returns all the memory reads in SCOP. */
static isl_union_map *
-scop_get_reads (scop_p scop, vec<poly_bb_p> pbbs)
+scop_get_reads (scop_p scop)
{
int i, j;
poly_bb_p pbb;
@@ -74,7 +74,7 @@ scop_get_reads (scop_p scop, vec<poly_bb_p> pbbs)
isl_space *space = isl_set_get_space (scop->param_context);
isl_union_map *res = isl_union_map_empty (space);
- FOR_EACH_VEC_ELT (pbbs, i, pbb)
+ FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
{
FOR_EACH_VEC_ELT (PBB_DRS (pbb), j, pdr)
if (pdr_read_p (pdr))
@@ -84,7 +84,9 @@ scop_get_reads (scop_p scop, vec<poly_bb_p> pbbs)
fprintf (dump_file, "Adding read to depedence graph: ");
print_pdr (dump_file, pdr);
}
- res = isl_union_map_add_map (res, add_pdr_constraints (pdr, pbb));
+ isl_union_map *um
+ = isl_union_map_from_map (add_pdr_constraints (pdr, pbb));
+ res = isl_union_map_union (res, um);
if (dump_file)
{
fprintf (dump_file, "Reads depedence graph: ");
@@ -99,7 +101,7 @@ scop_get_reads (scop_p scop, vec<poly_bb_p> pbbs)
/* Returns all the memory must writes in SCOP. */
static isl_union_map *
-scop_get_must_writes (scop_p scop, vec<poly_bb_p> pbbs)
+scop_get_must_writes (scop_p scop)
{
int i, j;
poly_bb_p pbb;
@@ -107,7 +109,7 @@ scop_get_must_writes (scop_p scop, vec<poly_bb_p> pbbs)
isl_space *space = isl_set_get_space (scop->param_context);
isl_union_map *res = isl_union_map_empty (space);
- FOR_EACH_VEC_ELT (pbbs, i, pbb)
+ FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
{
FOR_EACH_VEC_ELT (PBB_DRS (pbb), j, pdr)
if (pdr_write_p (pdr))
@@ -117,7 +119,9 @@ scop_get_must_writes (scop_p scop, vec<poly_bb_p> pbbs)
fprintf (dump_file, "Adding must write to depedence graph: ");
print_pdr (dump_file, pdr);
}
- res = isl_union_map_add_map (res, add_pdr_constraints (pdr, pbb));
+ isl_union_map *um
+ = isl_union_map_from_map (add_pdr_constraints (pdr, pbb));
+ res = isl_union_map_union (res, um);
if (dump_file)
{
fprintf (dump_file, "Must writes depedence graph: ");
@@ -132,7 +136,7 @@ scop_get_must_writes (scop_p scop, vec<poly_bb_p> pbbs)
/* Returns all the memory may writes in SCOP. */
static isl_union_map *
-scop_get_may_writes (scop_p scop, vec<poly_bb_p> pbbs)
+scop_get_may_writes (scop_p scop)
{
int i, j;
poly_bb_p pbb;
@@ -140,7 +144,7 @@ scop_get_may_writes (scop_p scop, vec<poly_bb_p> pbbs)
isl_space *space = isl_set_get_space (scop->param_context);
isl_union_map *res = isl_union_map_empty (space);
- FOR_EACH_VEC_ELT (pbbs, i, pbb)
+ FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
{
FOR_EACH_VEC_ELT (PBB_DRS (pbb), j, pdr)
if (pdr_may_write_p (pdr))
@@ -150,7 +154,9 @@ scop_get_may_writes (scop_p scop, vec<poly_bb_p> pbbs)
fprintf (dump_file, "Adding may write to depedence graph: ");
print_pdr (dump_file, pdr);
}
- res = isl_union_map_add_map (res, add_pdr_constraints (pdr, pbb));
+ isl_union_map *um
+ = isl_union_map_from_map (add_pdr_constraints (pdr, pbb));
+ res = isl_union_map_union (res, um);
if (dump_file)
{
fprintf (dump_file, "May writes depedence graph: ");
@@ -162,26 +168,6 @@ scop_get_may_writes (scop_p scop, vec<poly_bb_p> pbbs)
return isl_union_map_coalesce (res);
}
-/* Returns all the original schedules in SCOP. */
-
-static isl_union_map *
-scop_get_original_schedule (scop_p scop, vec<poly_bb_p> pbbs)
-{
- int i;
- poly_bb_p pbb;
- isl_space *space = isl_set_get_space (scop->param_context);
- isl_union_map *res = isl_union_map_empty (space);
-
- FOR_EACH_VEC_ELT (pbbs, i, pbb)
- {
- res = isl_union_map_add_map
- (res, constrain_domain (isl_map_copy (pbb->schedule),
- isl_set_copy (pbb->domain)));
- }
-
- return isl_union_map_coalesce (res);
-}
-
/* Helper function used on each MAP of a isl_union_map. Computes the
maximal output dimension. */
@@ -303,34 +289,20 @@ carries_deps (__isl_keep isl_union_map *schedule,
return res;
}
-/* Compute the original data dependences in SCOP for all the reads and
- writes in PBBS. */
-
-static void
-compute_deps (scop_p scop, vec<poly_bb_p> pbbs,
- isl_union_map **must_raw,
- isl_union_map **may_raw,
- isl_union_map **must_raw_no_source,
- isl_union_map **may_raw_no_source,
- isl_union_map **must_war,
- isl_union_map **may_war,
- isl_union_map **must_war_no_source,
- isl_union_map **may_war_no_source,
- isl_union_map **must_waw,
- isl_union_map **may_waw,
- isl_union_map **must_waw_no_source,
- isl_union_map **may_waw_no_source)
+/* Compute the dependence relations for the SCOP:
+ RAW are read after write dependences,
+ WAR are write after read dependences,
+ WAW are write after write dependences. */
+
+void
+scop_get_dependences (scop_p scop)
{
- isl_union_map *reads = scop_get_reads (scop, pbbs);
- isl_union_map *must_writes = scop_get_must_writes (scop, pbbs);
- isl_union_map *may_writes = scop_get_may_writes (scop, pbbs);
- isl_union_map *all_writes = isl_union_map_union
- (isl_union_map_copy (must_writes), isl_union_map_copy (may_writes));
- all_writes = isl_union_map_coalesce (all_writes);
+ if (scop->dependence)
+ return;
- isl_space *space = isl_union_map_get_space (all_writes);
- isl_union_map *empty = isl_union_map_empty (space);
- isl_union_map *original = scop_get_original_schedule (scop, pbbs);
+ isl_union_map *reads = scop_get_reads (scop);
+ isl_union_map *must_writes = scop_get_must_writes (scop);
+ isl_union_map *may_writes = scop_get_may_writes (scop);
if (dump_file)
{
@@ -357,57 +329,40 @@ compute_deps (scop_p scop, vec<poly_bb_p> pbbs,
print_isl_union_map (dump_file, must_writes);
fprintf (dump_file, " may_writes: ");
print_isl_union_map (dump_file, may_writes);
- fprintf (dump_file, " all_writes: ");
- print_isl_union_map (dump_file, all_writes);
fprintf (dump_file, ")\n");
}
- isl_union_map_compute_flow (isl_union_map_copy (reads),
- isl_union_map_copy (must_writes),
- isl_union_map_copy (may_writes),
- isl_union_map_copy (original),
- must_raw, may_raw, must_raw_no_source,
- may_raw_no_source);
- isl_union_map_compute_flow (isl_union_map_copy (all_writes),
- reads, empty,
- isl_union_map_copy (original),
- must_war, may_war, must_war_no_source,
- may_war_no_source);
- isl_union_map_compute_flow (all_writes, must_writes, may_writes,
- original,
- must_waw, may_waw, must_waw_no_source,
- may_waw_no_source);
-}
-
-isl_union_map *
-scop_get_dependences (scop_p scop)
-{
- if (scop->dependence)
- return scop->dependence;
-
- /* The original dependence relations:
- RAW are read after write dependences,
- WAR are write after read dependences,
- WAW are write after write dependences. */
- isl_union_map *must_raw = NULL, *may_raw = NULL, *must_raw_no_source = NULL,
- *may_raw_no_source = NULL, *must_war = NULL, *may_war = NULL,
- *must_war_no_source = NULL, *may_war_no_source = NULL, *must_waw = NULL,
- *may_waw = NULL, *must_waw_no_source = NULL, *may_waw_no_source = NULL;
-
- compute_deps (scop, scop->pbbs,
- &must_raw, &may_raw,
- &must_raw_no_source, &may_raw_no_source,
- &must_war, &may_war,
- &must_war_no_source, &may_war_no_source,
- &must_waw, &may_waw,
- &must_waw_no_source, &may_waw_no_source);
-
- isl_union_map *dependences = must_raw;
- dependences = isl_union_map_union (dependences, must_war);
- dependences = isl_union_map_union (dependences, must_waw);
- dependences = isl_union_map_union (dependences, may_raw);
- dependences = isl_union_map_union (dependences, may_war);
- dependences = isl_union_map_union (dependences, may_waw);
+ gcc_assert (scop->original_schedule);
+
+ isl_union_access_info *ai;
+ ai = isl_union_access_info_from_sink (isl_union_map_copy (reads));
+ ai = isl_union_access_info_set_must_source (ai, isl_union_map_copy (must_writes));
+ ai = isl_union_access_info_set_may_source (ai, may_writes);
+ ai = isl_union_access_info_set_schedule
+ (ai, isl_schedule_copy (scop->original_schedule));
+ isl_union_flow *flow = isl_union_access_info_compute_flow (ai);
+ isl_union_map *raw = isl_union_flow_get_must_dependence (flow);
+ isl_union_flow_free (flow);
+
+ ai = isl_union_access_info_from_sink (isl_union_map_copy (must_writes));
+ ai = isl_union_access_info_set_must_source (ai, must_writes);
+ ai = isl_union_access_info_set_may_source (ai, reads);
+ ai = isl_union_access_info_set_schedule
+ (ai, isl_schedule_copy (scop->original_schedule));
+ flow = isl_union_access_info_compute_flow (ai);
+
+ isl_union_map *waw = isl_union_flow_get_must_dependence (flow);
+ isl_union_map *war = isl_union_flow_get_may_dependence (flow);
+ war = isl_union_map_subtract (war, isl_union_map_copy (waw));
+ isl_union_flow_free (flow);
+
+ raw = isl_union_map_coalesce (raw);
+ waw = isl_union_map_coalesce (waw);
+ war = isl_union_map_coalesce (war);
+
+ isl_union_map *dependences = raw;
+ dependences = isl_union_map_union (dependences, war);
+ dependences = isl_union_map_union (dependences, waw);
dependences = isl_union_map_coalesce (dependences);
if (dump_file)
@@ -417,15 +372,7 @@ scop_get_dependences (scop_p scop)
fprintf (dump_file, ")\n");
}
- isl_union_map_free (must_raw_no_source);
- isl_union_map_free (may_raw_no_source);
- isl_union_map_free (must_war_no_source);
- isl_union_map_free (may_war_no_source);
- isl_union_map_free (must_waw_no_source);
- isl_union_map_free (may_waw_no_source);
-
scop->dependence = dependences;
- return dependences;
}
#endif /* HAVE_isl */
diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c
index a196419..2823d22 100644
--- a/gcc/graphite-isl-ast-to-gimple.c
+++ b/gcc/graphite-isl-ast-to-gimple.c
@@ -105,7 +105,7 @@ typedef std::map<isl_id *, tree> ivs_params;
/* Free all memory allocated for isl's identifiers. */
-void ivs_params_clear (ivs_params &ip)
+static void ivs_params_clear (ivs_params &ip)
{
std::map<isl_id *, tree>::iterator it;
for (it = ip.begin ();
@@ -117,7 +117,7 @@ void ivs_params_clear (ivs_params &ip)
/* Set the "separate" option for the schedule node. */
-static __isl_give isl_schedule_node *
+static isl_schedule_node *
set_separate_option (__isl_take isl_schedule_node *node, void *user)
{
if (user)
@@ -135,6 +135,26 @@ set_separate_option (__isl_take isl_schedule_node *node, void *user)
return node;
}
+/* Print SCHEDULE under an AST form on file F. */
+
+void
+print_schedule_ast (FILE *f, __isl_keep isl_schedule *schedule, scop_p scop)
+{
+ isl_set *set = isl_set_params (isl_set_copy (scop->param_context));
+ isl_ast_build *context = isl_ast_build_from_context (set);
+ isl_ast_node *ast
+ = isl_ast_build_node_from_schedule (context, isl_schedule_copy (schedule));
+ isl_ast_build_free (context);
+ print_isl_ast (f, ast);
+ isl_ast_node_free (ast);
+}
+
+DEBUG_FUNCTION void
+debug_schedule_ast (__isl_keep isl_schedule *s, scop_p scop)
+{
+ print_schedule_ast (stderr, s, scop);
+}
+
enum phi_node_kind
{
unknown_phi,
@@ -285,40 +305,13 @@ class translate_isl_ast_to_gimple
void add_parameters_to_ivs_params (scop_p scop, ivs_params &ip);
- /* Get the maximal number of schedule dimensions in the scop SCOP. */
-
- int get_max_schedule_dimensions (scop_p scop);
-
/* Generates a build, which specifies the constraints on the parameters. */
__isl_give isl_ast_build *generate_isl_context (scop_p scop);
- /* Extend the schedule to NB_SCHEDULE_DIMS schedule dimensions.
-
- For schedules with different dimensionality, the isl AST generator can not
- define an order and will just randomly choose an order. The solution to
- this problem is to extend all schedules to the maximal number of schedule
- dimensions (using '0's for the remaining values). */
-
- __isl_give isl_map *extend_schedule (__isl_take isl_map *schedule,
- int nb_schedule_dims);
-
- /* Generates a schedule, which specifies an order used to
- visit elements in a domain. */
-
- __isl_give isl_union_map *generate_isl_schedule (scop_p scop);
-
- /* Set the separate option for all dimensions.
- This helps to reduce control overhead. */
-
- __isl_give isl_ast_build * set_options (__isl_take isl_ast_build *control,
- __isl_keep isl_union_map *schedule);
-
- /* Generate isl AST from schedule of SCOP. Also, collects IVS_PARAMS in
- IP. */
-
- __isl_give isl_ast_node * scop_to_isl_ast (scop_p scop, ivs_params &ip);
+ /* Generate isl AST from schedule of SCOP. */
+ __isl_give isl_ast_node * scop_to_isl_ast (scop_p scop);
/* Return true if RENAME (defined in BB) is a valid use in NEW_BB. The
definition should flow into use, and the use should respect the loop-closed
@@ -474,11 +467,6 @@ class translate_isl_ast_to_gimple
bool codegen_error_p () const
{ return codegen_error; }
- /* Prints NODE to FILE. */
-
- void print_isl_ast_node (FILE *file, __isl_keep isl_ast_node *node,
- __isl_keep isl_ctx *ctx) const;
-
/* Return true when OP is a constant tree. */
bool is_constant (tree op) const
@@ -1365,7 +1353,7 @@ is_valid_rename (tree rename, basic_block def_bb, basic_block use_bb,
{
if (dump_file)
{
- fprintf (dump_file, "[codegen] rename not in loop closed ssa:");
+ fprintf (dump_file, "[codegen] rename not in loop closed ssa: ");
print_generic_expr (dump_file, rename, 0);
fprintf (dump_file, "\n");
}
@@ -3052,20 +3040,6 @@ translate_isl_ast_to_gimple::translate_pending_phi_nodes ()
}
}
-/* Prints NODE to FILE. */
-
-void
-translate_isl_ast_to_gimple::print_isl_ast_node (FILE *file,
- __isl_keep isl_ast_node *node,
- __isl_keep isl_ctx *ctx) const
-{
- isl_printer *prn = isl_printer_to_file (ctx, file);
- prn = isl_printer_set_output_format (prn, ISL_FORMAT_C);
- prn = isl_printer_print_ast_node (prn, node);
- prn = isl_printer_print_str (prn, "\n");
- isl_printer_free (prn);
-}
-
/* Add isl's parameter identifiers and corresponding trees to ivs_params. */
void
@@ -3094,83 +3068,6 @@ translate_isl_ast_to_gimple::generate_isl_context (scop_p scop)
return isl_ast_build_from_context (context_isl);
}
-/* Get the maximal number of schedule dimensions in the scop SCOP. */
-
-int
-translate_isl_ast_to_gimple::get_max_schedule_dimensions (scop_p scop)
-{
- int i;
- poly_bb_p pbb;
- int schedule_dims = 0;
-
- FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
- {
- int pbb_schedule_dims = isl_map_dim (pbb->transformed, isl_dim_out);
- if (pbb_schedule_dims > schedule_dims)
- schedule_dims = pbb_schedule_dims;
- }
-
- return schedule_dims;
-}
-
-/* Extend the schedule to NB_SCHEDULE_DIMS schedule dimensions.
-
- For schedules with different dimensionality, the isl AST generator can not
- define an order and will just randomly choose an order. The solution to this
- problem is to extend all schedules to the maximal number of schedule
- dimensions (using '0's for the remaining values). */
-
-__isl_give isl_map *
-translate_isl_ast_to_gimple::extend_schedule (__isl_take isl_map *schedule,
- int nb_schedule_dims)
-{
- int tmp_dims = isl_map_dim (schedule, isl_dim_out);
- schedule =
- isl_map_add_dims (schedule, isl_dim_out, nb_schedule_dims - tmp_dims);
- isl_val *zero =
- isl_val_int_from_si (isl_map_get_ctx (schedule), 0);
- int i;
- for (i = tmp_dims; i < nb_schedule_dims; i++)
- {
- schedule
- = isl_map_fix_val (schedule, isl_dim_out, i, isl_val_copy (zero));
- }
- isl_val_free (zero);
- return schedule;
-}
-
-/* Generates a schedule, which specifies an order used to
- visit elements in a domain. */
-
-__isl_give isl_union_map *
-translate_isl_ast_to_gimple::generate_isl_schedule (scop_p scop)
-{
- int nb_schedule_dims = get_max_schedule_dimensions (scop);
- int i;
- poly_bb_p pbb;
- isl_union_map *schedule_isl =
- isl_union_map_empty (isl_set_get_space (scop->param_context));
-
- FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
- {
- /* Dead code elimination: when the domain of a PBB is empty,
- don't generate code for the PBB. */
- if (isl_set_is_empty (pbb->domain))
- continue;
-
- isl_map *bb_schedule = isl_map_copy (pbb->transformed);
- bb_schedule = isl_map_intersect_domain (bb_schedule,
- isl_set_copy (pbb->domain));
- bb_schedule = extend_schedule (bb_schedule, nb_schedule_dims);
- bb_schedule = isl_map_coalesce (bb_schedule);
- schedule_isl
- = isl_union_map_union (schedule_isl,
- isl_union_map_from_map (bb_schedule));
- schedule_isl = isl_union_map_coalesce (schedule_isl);
- }
- return schedule_isl;
-}
-
/* This method is executed before the construction of a for node. */
__isl_give isl_id *
ast_build_before_for (__isl_keep isl_ast_build *build, void *user)
@@ -3188,63 +3085,28 @@ ast_build_before_for (__isl_keep isl_ast_build *build, void *user)
return id;
}
-/* Set the separate option for all dimensions.
- This helps to reduce control overhead. */
-
-__isl_give isl_ast_build *
-translate_isl_ast_to_gimple::set_options (__isl_take isl_ast_build *control,
- __isl_keep isl_union_map *schedule)
-{
- isl_ctx *ctx = isl_union_map_get_ctx (schedule);
- isl_space *range_space = isl_space_set_alloc (ctx, 0, 1);
- range_space =
- isl_space_set_tuple_name (range_space, isl_dim_set, "separate");
- isl_union_set *range =
- isl_union_set_from_set (isl_set_universe (range_space));
- isl_union_set *domain = isl_union_map_range (isl_union_map_copy (schedule));
- domain = isl_union_set_universe (domain);
- isl_union_map *options = isl_union_map_from_domain_and_range (domain, range);
- return isl_ast_build_set_options (control, options);
-}
-
-/* Generate isl AST from schedule of SCOP. Also, collects IVS_PARAMS in IP. */
+/* Generate isl AST from schedule of SCOP. */
__isl_give isl_ast_node *
-translate_isl_ast_to_gimple::scop_to_isl_ast (scop_p scop, ivs_params &ip)
+translate_isl_ast_to_gimple::scop_to_isl_ast (scop_p scop)
{
- /* Generate loop upper bounds that consist of the current loop iterator, an
- operator (< or <=) and an expression not involving the iterator. If this
- option is not set, then the current loop iterator may appear several times
- in the upper bound. See the isl manual for more details. */
- isl_options_set_ast_build_atomic_upper_bound (scop->isl_context, true);
-
- add_parameters_to_ivs_params (scop, ip);
+ gcc_assert (scop->transformed_schedule);
- if (scop->schedule)
- {
- /* Set the separate option to reduce control flow overhead. */
- isl_schedule *schedule = isl_schedule_map_schedule_node_bottom_up
- (scop->schedule, set_separate_option, NULL);
- isl_ast_build *context_isl = generate_isl_context (scop);
- isl_ast_node *ast_isl = isl_ast_build_node_from_schedule
- (context_isl, schedule);
- isl_ast_build_free (context_isl);
- return ast_isl;
- }
-
- /* graphite-identity, or parallelize. */
- isl_union_map *schedule_isl = generate_isl_schedule (scop);
+ /* Set the separate option to reduce control flow overhead. */
+ isl_schedule *schedule = isl_schedule_map_schedule_node_bottom_up
+ (isl_schedule_copy (scop->transformed_schedule), set_separate_option, NULL);
isl_ast_build *context_isl = generate_isl_context (scop);
- context_isl = set_options (context_isl, schedule_isl);
+
if (flag_loop_parallelize_all)
{
- isl_union_map *dependence = scop_get_dependences (scop);
+ scop_get_dependences (scop);
context_isl =
isl_ast_build_set_before_each_for (context_isl, ast_build_before_for,
- dependence);
+ scop->dependence);
}
- isl_ast_node *ast_isl = isl_ast_build_ast_from_schedule
- (context_isl, schedule_isl);
+
+ isl_ast_node *ast_isl = isl_ast_build_node_from_schedule
+ (context_isl, schedule);
isl_ast_build_free (context_isl);
return ast_isl;
}
@@ -3266,12 +3128,20 @@ graphite_regenerate_ast_isl (scop_p scop)
ivs_params ip;
timevar_push (TV_GRAPHITE_CODE_GEN);
- root_node = t.scop_to_isl_ast (scop, ip);
+ t.add_parameters_to_ivs_params (scop, ip);
+ root_node = t.scop_to_isl_ast (scop);
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (dump_file)
{
- fprintf (dump_file, "AST generated by isl: \n");
- t.print_isl_ast_node (dump_file, root_node, scop->isl_context);
+ fprintf (dump_file, "[scheduler] original schedule:\n");
+ print_isl_schedule (dump_file, scop->original_schedule);
+ fprintf (dump_file, "[scheduler] isl transformed schedule:\n");
+ print_isl_schedule (dump_file, scop->transformed_schedule);
+
+ fprintf (dump_file, "[scheduler] original ast:\n");
+ print_schedule_ast (dump_file, scop->original_schedule, scop);
+ fprintf (dump_file, "[scheduler] AST generated by isl:\n");
+ print_isl_ast (dump_file, root_node);
}
recompute_all_dominators ();
@@ -3293,8 +3163,8 @@ graphite_regenerate_ast_isl (scop_p scop)
if (t.codegen_error_p ())
{
if (dump_file)
- fprintf (dump_file, "[codegen] unsuccessful,"
- " reverting back to the original code.\n");
+ fprintf (dump_file, "codegen error: "
+ "reverting back to the original code.\n");
set_ifsese_condition (if_region, integer_zero_node);
}
else
diff --git a/gcc/graphite-optimize-isl.c b/gcc/graphite-optimize-isl.c
index 306f91c..f385c77 100644
--- a/gcc/graphite-optimize-isl.c
+++ b/gcc/graphite-optimize-isl.c
@@ -56,7 +56,7 @@ scop_get_domains (scop_p scop)
/* Compute the schedule for SCOP based on its parameters, domain and set of
constraints. Then apply the schedule to SCOP. */
-bool
+static bool
optimize_isl (scop_p scop)
{
int old_max_operations = isl_ctx_get_max_operations (scop->isl_context);
@@ -66,57 +66,88 @@ optimize_isl (scop_p scop)
isl_options_set_on_error (scop->isl_context, ISL_ON_ERROR_CONTINUE);
isl_union_set *domain = scop_get_domains (scop);
+
+ /* Simplify the dependences on the domain. */
scop_get_dependences (scop);
- scop->dependence
- = isl_union_map_gist_domain (scop->dependence, isl_union_set_copy (domain));
- scop->dependence
- = isl_union_map_gist_range (scop->dependence, isl_union_set_copy (domain));
- isl_union_map *validity = isl_union_map_copy (scop->dependence);
+ isl_union_map *dependences
+ = isl_union_map_gist_domain (isl_union_map_copy (scop->dependence),
+ isl_union_set_copy (domain));
+ isl_union_map *validity
+ = isl_union_map_gist_range (dependences, isl_union_set_copy (domain));
+
+ /* FIXME: proximity should not be validity. */
isl_union_map *proximity = isl_union_map_copy (validity);
- isl_schedule_constraints *schedule_constraints;
- schedule_constraints = isl_schedule_constraints_on_domain (domain);
- schedule_constraints
- = isl_schedule_constraints_set_proximity (schedule_constraints,
- proximity);
- schedule_constraints
- = isl_schedule_constraints_set_validity (schedule_constraints,
- isl_union_map_copy (validity));
- schedule_constraints
- = isl_schedule_constraints_set_coincidence (schedule_constraints,
- validity);
+ isl_schedule_constraints *sc = isl_schedule_constraints_on_domain (domain);
+ sc = isl_schedule_constraints_set_proximity (sc, proximity);
+ sc = isl_schedule_constraints_set_validity (sc, isl_union_map_copy (validity));
+ sc = isl_schedule_constraints_set_coincidence (sc, validity);
isl_options_set_schedule_serialize_sccs (scop->isl_context, 0);
isl_options_set_schedule_maximize_band_depth (scop->isl_context, 1);
isl_options_set_schedule_max_constant_term (scop->isl_context, 20);
isl_options_set_schedule_max_coefficient (scop->isl_context, 20);
isl_options_set_tile_scale_tile_loops (scop->isl_context, 0);
+ /* Generate loop upper bounds that consist of the current loop iterator, an
+ operator (< or <=) and an expression not involving the iterator. If this
+ option is not set, then the current loop iterator may appear several times
+ in the upper bound. See the isl manual for more details. */
isl_options_set_ast_build_atomic_upper_bound (scop->isl_context, 1);
- isl_schedule *schedule
- = isl_schedule_constraints_compute_schedule (schedule_constraints);
+ scop->transformed_schedule = isl_schedule_constraints_compute_schedule (sc);
isl_options_set_on_error (scop->isl_context, ISL_ON_ERROR_ABORT);
isl_ctx_reset_operations (scop->isl_context);
isl_ctx_set_max_operations (scop->isl_context, old_max_operations);
- if (!schedule || isl_ctx_last_error (scop->isl_context) == isl_error_quota)
+ if (!scop->transformed_schedule
+ || isl_ctx_last_error (scop->isl_context) == isl_error_quota)
{
if (dump_file && dump_flags)
fprintf (dump_file, "isl timed out --param max-isl-operations=%d\n",
max_operations);
- if (schedule)
- isl_schedule_free (schedule);
return false;
}
- scop->schedule = schedule;
+ gcc_assert (scop->original_schedule);
+ isl_union_map *original = isl_schedule_get_map (scop->original_schedule);
+ isl_union_map *transformed = isl_schedule_get_map (scop->transformed_schedule);
+ bool same_schedule = isl_union_map_is_equal (original, transformed);
+ isl_union_map_free (original);
+ isl_union_map_free (transformed);
- if (dump_file)
+ if (same_schedule)
{
- fprintf (dump_file, "isl end schedule:\n");
- print_isl_schedule (dump_file, scop->schedule);
+ if (dump_file)
+ {
+ fprintf (dump_file, "[scheduler] isl optimized schedule is "
+ "identical to the original schedule.\n");
+ print_schedule_ast (dump_file, scop->original_schedule, scop);
+ }
+ isl_schedule_free (scop->transformed_schedule);
+ scop->transformed_schedule = isl_schedule_copy (scop->original_schedule);
+ return false;
}
return true;
}
+
+/* Apply graphite transformations to all the basic blocks of SCOP. */
+
+bool
+apply_poly_transforms (scop_p scop)
+{
+ if (flag_loop_nest_optimize)
+ return optimize_isl (scop);
+
+ if (!flag_graphite_identity && !flag_loop_parallelize_all)
+ return false;
+
+ /* Generate code even if we did not apply any real transformation.
+ This also allows to check the performance for the identity
+ transformation: GIMPLE -> GRAPHITE -> GIMPLE. */
+ gcc_assert (scop->original_schedule);
+ scop->transformed_schedule = isl_schedule_copy (scop->original_schedule);
+ return true;
+}
+
#endif /* HAVE_isl */
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index de7515a..c1dd5ce 100644
--- a/gcc/graphite-poly.c
+++ b/gcc/graphite-poly.c
@@ -86,23 +86,6 @@ debug_iteration_domains (scop_p scop)
print_iteration_domains (stderr, scop);
}
-/* Apply graphite transformations to all the basic blocks of SCOP. */
-
-bool
-apply_poly_transforms (scop_p scop)
-{
- if (flag_loop_nest_optimize && optimize_isl (scop))
- return true;
-
- if (!flag_graphite_identity && !flag_loop_parallelize_all)
- return false;
-
- /* Generate code even if we did not apply any real transformation.
- This also allows to check the performance for the identity
- transformation: GIMPLE -> GRAPHITE -> GIMPLE. */
- return true;
-}
-
/* Create a new polyhedral data reference and add it to PBB. It is
defined by its ACCESSES, its TYPE, and the number of subscripts
NB_SUBSCRIPTS. */
@@ -137,7 +120,7 @@ new_poly_dr (poly_bb_p pbb, gimple *stmt, enum poly_dr_type type,
/* Free polyhedral data reference PDR. */
-void
+static void
free_poly_dr (poly_dr_p pdr)
{
isl_map_free (pdr->accesses);
@@ -153,9 +136,7 @@ new_poly_bb (scop_p scop, gimple_poly_bb_p black_box)
poly_bb_p pbb = XNEW (struct poly_bb);
pbb->domain = NULL;
- pbb->schedule = NULL;
- pbb->transformed = NULL;
- pbb->saved = NULL;
+ pbb->iterators = NULL;
PBB_SCOP (pbb) = scop;
pbb_set_black_box (pbb, black_box);
PBB_DRS (pbb).create (3);
@@ -166,16 +147,16 @@ new_poly_bb (scop_p scop, gimple_poly_bb_p black_box)
/* Free polyhedral black box. */
-void
+static void
free_poly_bb (poly_bb_p pbb)
{
int i;
poly_dr_p pdr;
isl_set_free (pbb->domain);
- isl_map_free (pbb->schedule);
- isl_map_free (pbb->transformed);
- isl_map_free (pbb->saved);
+ isl_set_free (pbb->iterators);
+ pbb->domain = NULL;
+ pbb->iterators = NULL;
if (PBB_DRS (pbb).exists ())
FOR_EACH_VEC_ELT (PBB_DRS (pbb), i, pdr)
@@ -246,7 +227,7 @@ new_gimple_poly_bb (basic_block bb, vec<data_reference_p> drs,
/* Frees GBB. */
-void
+static void
free_gimple_poly_bb (gimple_poly_bb_p gbb)
{
free_data_refs (GBB_DATA_REFS (gbb));
@@ -277,7 +258,8 @@ new_scop (edge entry, edge exit)
sese_info_p region = new_sese_info (entry, exit);
scop_p s = XNEW (struct scop);
- s->schedule = NULL;
+ s->original_schedule = NULL;
+ s->transformed_schedule = NULL;
s->param_context = NULL;
scop_set_region (s, region);
s->pbbs.create (3);
@@ -305,7 +287,13 @@ free_scop (scop_p scop)
isl_set_free (scop->param_context);
isl_union_map_free (scop->dependence);
+ isl_schedule_free (scop->original_schedule);
+ isl_schedule_free (scop->transformed_schedule);
+
+ scop->param_context = NULL;
scop->dependence = NULL;
+ scop->original_schedule = NULL;
+ scop->transformed_schedule = NULL;
XDELETE (scop);
}
@@ -530,7 +518,7 @@ debug_scop_params (scop_p scop)
extern isl_ctx *the_isl_ctx;
void
-print_isl_set (FILE *f, isl_set *set)
+print_isl_set (FILE *f, __isl_keep isl_set *set)
{
isl_printer *p = isl_printer_to_file (the_isl_ctx, f);
p = isl_printer_set_yaml_style (p, ISL_YAML_STYLE_BLOCK);
@@ -540,13 +528,13 @@ print_isl_set (FILE *f, isl_set *set)
}
DEBUG_FUNCTION void
-debug_isl_set (isl_set *set)
+debug_isl_set (__isl_keep isl_set *set)
{
print_isl_set (stderr, set);
}
void
-print_isl_map (FILE *f, isl_map *map)
+print_isl_map (FILE *f, __isl_keep isl_map *map)
{
isl_printer *p = isl_printer_to_file (the_isl_ctx, f);
p = isl_printer_set_yaml_style (p, ISL_YAML_STYLE_BLOCK);
@@ -556,13 +544,13 @@ print_isl_map (FILE *f, isl_map *map)
}
DEBUG_FUNCTION void
-debug_isl_map (isl_map *map)
+debug_isl_map (__isl_keep isl_map *map)
{
print_isl_map (stderr, map);
}
void
-print_isl_union_map (FILE *f, isl_union_map *map)
+print_isl_union_map (FILE *f, __isl_keep isl_union_map *map)
{
isl_printer *p = isl_printer_to_file (the_isl_ctx, f);
p = isl_printer_set_yaml_style (p, ISL_YAML_STYLE_BLOCK);
@@ -579,7 +567,7 @@ debug_isl_union_map (isl_union_map *map)
void
-print_isl_aff (FILE *f, isl_aff *aff)
+print_isl_aff (FILE *f, __isl_keep isl_aff *aff)
{
isl_printer *p = isl_printer_to_file (the_isl_ctx, f);
p = isl_printer_print_aff (p, aff);
@@ -588,13 +576,13 @@ print_isl_aff (FILE *f, isl_aff *aff)
}
DEBUG_FUNCTION void
-debug_isl_aff (isl_aff *aff)
+debug_isl_aff (__isl_keep isl_aff *aff)
{
print_isl_aff (stderr, aff);
}
void
-print_isl_constraint (FILE *f, isl_constraint *c)
+print_isl_constraint (FILE *f, __isl_keep isl_constraint *c)
{
isl_printer *p = isl_printer_to_file (the_isl_ctx, f);
p = isl_printer_print_constraint (p, c);
@@ -603,13 +591,13 @@ print_isl_constraint (FILE *f, isl_constraint *c)
}
DEBUG_FUNCTION void
-debug_isl_constraint (isl_constraint *c)
+debug_isl_constraint (__isl_keep isl_constraint *c)
{
print_isl_constraint (stderr, c);
}
void
-print_isl_schedule (FILE *f, isl_schedule *s)
+print_isl_schedule (FILE *f, __isl_keep isl_schedule *s)
{
isl_printer *p = isl_printer_to_file (the_isl_ctx, f);
p = isl_printer_set_yaml_style (p, ISL_YAML_STYLE_BLOCK);
@@ -624,41 +612,26 @@ debug_isl_schedule (isl_schedule *s)
print_isl_schedule (stderr, s);
}
-/* Returns the number of iterations RES of the loop around PBB at
- time(scattering) dimension TIME_DEPTH. */
-
void
-pbb_number_of_iterations_at_time (poly_bb_p pbb,
- graphite_dim_t time_depth,
- mpz_t res)
-{
- isl_set *transdomain;
- isl_space *dc;
- isl_aff *aff;
- isl_val *isllb, *islub;
-
- /* Map the iteration domain through the current scatter, and work
- on the resulting set. */
- transdomain = isl_set_apply (isl_set_copy (pbb->domain),
- isl_map_copy (pbb->transformed));
-
- /* Select the time_depth' dimension via an affine expression. */
- dc = isl_set_get_space (transdomain);
- aff = isl_aff_zero_on_domain (isl_local_space_from_space (dc));
- aff = isl_aff_set_coefficient_si (aff, isl_dim_in, time_depth, 1);
-
- /* And find the min/max for that function. */
- /* XXX isl check results? */
- isllb = isl_set_min_val (transdomain, aff);
- islub = isl_set_max_val (transdomain, aff);
-
- islub = isl_val_sub (islub, isllb);
- islub = isl_val_add_ui (islub, 1);
- isl_val_get_num_gmp (islub, res);
-
- isl_val_free (islub);
- isl_aff_free (aff);
- isl_set_free (transdomain);
+print_isl_ast (FILE *file, __isl_keep isl_ast_node *n)
+{
+ isl_printer *prn = isl_printer_to_file (the_isl_ctx, file);
+ prn = isl_printer_set_output_format (prn, ISL_FORMAT_C);
+ prn = isl_printer_print_ast_node (prn, n);
+ prn = isl_printer_print_str (prn, "\n");
+ isl_printer_free (prn);
+}
+
+DEBUG_FUNCTION void
+debug_isl_ast (isl_ast_node *n)
+{
+ print_isl_ast (stderr, n);
+}
+
+DEBUG_FUNCTION void
+debug_scop_pbb (scop_p scop, int i)
+{
+ debug_pbb (scop->pbbs[i]);
}
#endif /* HAVE_isl */
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index f035e0d..8dfb20a 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -522,21 +522,6 @@ public:
static edge get_nearest_pdom_with_single_exit (basic_block dom);
-
- /* Pretty printers. */
-
- static void print_edge (FILE *file, const_edge e)
- {
- fprintf (file, "edge (bb_%d, bb_%d)", e->src->index, e->dest->index);
- }
-
- static void print_sese (FILE *file, sese_l s)
- {
- fprintf (file, "(entry_"); print_edge (file, s.entry);
- fprintf (file, ", exit_"); print_edge (file, s.exit);
- fprintf (file, ")\n");
- }
-
/* Merge scops at same loop depth and returns the new sese.
Returns a new SESE when merge was successful, INVALID_SESE otherwise. */
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index abf18a7..885e0b7 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -77,151 +77,6 @@ isl_id_for_pbb (scop_p s, poly_bb_p pbb)
return isl_id_alloc (s->isl_context, name, pbb);
}
-/* Converts the STATIC_SCHEDULE of PBB into a scattering polyhedron.
- We generate SCATTERING_DIMENSIONS scattering dimensions.
-
- The scattering polyhedron consists of these dimensions: scattering,
- loop_iterators, parameters.
-
- Example:
-
- | scattering_dimensions = 5
- | nb_iterators = 1
- | scop_nb_params = 2
- |
- | Schedule:
- | i
- | 4 5
- |
- | Scattering polyhedron:
- |
- | scattering: {s1, s2, s3, s4, s5}
- | loop_iterators: {i}
- | parameters: {p1, p2}
- |
- | s1 s2 s3 s4 s5 i p1 p2 1
- | 1 0 0 0 0 0 0 0 -4 = 0
- | 0 1 0 0 0 -1 0 0 0 = 0
- | 0 0 1 0 0 0 0 0 -5 = 0 */
-
-static void
-build_pbb_scattering_polyhedrons (isl_aff *static_sched,
- poly_bb_p pbb)
-{
- isl_val *val;
-
- int scattering_dimensions = isl_set_dim (pbb->domain, isl_dim_set) * 2 + 1;
-
- isl_space *dc = isl_set_get_space (pbb->domain);
- isl_space *dm = isl_space_add_dims (isl_space_from_domain (dc),
- isl_dim_out, scattering_dimensions);
- pbb->schedule = isl_map_universe (dm);
-
- for (int i = 0; i < scattering_dimensions; i++)
- {
- /* Textual order inside this loop. */
- if ((i % 2) == 0)
- {
- isl_constraint *c = isl_equality_alloc
- (isl_local_space_from_space (isl_map_get_space (pbb->schedule)));
-
- val = isl_aff_get_coefficient_val (static_sched, isl_dim_in, i / 2);
- gcc_assert (val && isl_val_is_int (val));
-
- val = isl_val_neg (val);
- c = isl_constraint_set_constant_val (c, val);
- c = isl_constraint_set_coefficient_si (c, isl_dim_out, i, 1);
- pbb->schedule = isl_map_add_constraint (pbb->schedule, c);
- }
-
- /* Iterations of this loop. */
- else /* if ((i % 2) == 1) */
- {
- int loop = (i - 1) / 2;
- pbb->schedule = isl_map_equate (pbb->schedule, isl_dim_in, loop,
- isl_dim_out, i);
- }
- }
-
- /* Simplify the original schedule. */
- pbb->schedule = isl_map_coalesce (pbb->schedule);
-
- /* At the beginning, set the transformed schedule to the original. */
- pbb->transformed = isl_map_copy (pbb->schedule);
-}
-
-/* Build for BB the static schedule.
-
- The static schedule is a Dewey numbering of the abstract syntax
- tree: http://en.wikipedia.org/wiki/Dewey_Decimal_Classification
-
- The following example informally defines the static schedule:
-
- A
- for (i: ...)
- {
- for (j: ...)
- {
- B
- C
- }
-
- for (k: ...)
- {
- D
- E
- }
- }
- F
-
- Static schedules for A to F:
-
- DEPTH
- 0 1 2
- A 0
- B 1 0 0
- C 1 0 1
- D 1 1 0
- E 1 1 1
- F 2
-*/
-
-static void
-build_scop_scattering (scop_p scop)
-{
- gimple_poly_bb_p previous_gbb = NULL;
- isl_space *dc = isl_set_get_space (scop->param_context);
- isl_aff *static_sched;
-
- dc = isl_space_add_dims (dc, isl_dim_set, number_of_loops (cfun));
- static_sched = isl_aff_zero_on_domain (isl_local_space_from_space (dc));
-
- /* We have to start schedules at 0 on the first component and
- because we cannot compare_prefix_loops against a previous loop,
- prefix will be equal to zero, and that index will be
- incremented before copying. */
- static_sched = isl_aff_add_coefficient_si (static_sched, isl_dim_in, 0, -1);
-
- int i;
- poly_bb_p pbb;
- FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
- {
- gimple_poly_bb_p gbb = PBB_BLACK_BOX (pbb);
- int prefix = 0;
-
- if (previous_gbb)
- prefix = nb_common_loops (scop->scop_info->region, previous_gbb, gbb);
-
- previous_gbb = gbb;
-
- static_sched = isl_aff_add_coefficient_si (static_sched, isl_dim_in,
- prefix, 1);
- build_pbb_scattering_polyhedrons (static_sched, pbb);
- }
-
- isl_aff_free (static_sched);
-}
-
static isl_pw_aff *extract_affine (scop_p, tree, __isl_take isl_space *space);
/* Extract an affine expression from the chain of recurrence E. */
@@ -440,10 +295,7 @@ create_pw_aff_from_tree (poly_bb_p pbb, tree t)
t = scalar_evolution_in_region (scop->scop_info->region, pbb_loop (pbb), t);
- /* Bail out as we do not know the scev. */
- if (chrec_contains_undetermined (t))
- return NULL;
-
+ gcc_assert (!chrec_contains_undetermined (t));
gcc_assert (!automatically_generated_chrec_p (t));
return extract_affine (scop, t, isl_set_get_space (pbb->domain));
@@ -453,19 +305,11 @@ create_pw_aff_from_tree (poly_bb_p pbb, tree t)
operator. This allows us to invert the condition or to handle
inequalities. */
-static bool
+static void
add_condition_to_pbb (poly_bb_p pbb, gcond *stmt, enum tree_code code)
{
isl_pw_aff *lhs = create_pw_aff_from_tree (pbb, gimple_cond_lhs (stmt));
- if (!lhs)
- return false;
-
isl_pw_aff *rhs = create_pw_aff_from_tree (pbb, gimple_cond_rhs (stmt));
- if (!rhs)
- {
- isl_pw_aff_free (lhs);
- return false;
- }
isl_set *cond;
switch (code)
@@ -495,20 +339,17 @@ add_condition_to_pbb (poly_bb_p pbb, gcond *stmt, enum tree_code code)
break;
default:
- isl_pw_aff_free (lhs);
- isl_pw_aff_free (rhs);
- return true;
+ gcc_unreachable ();
}
cond = isl_set_coalesce (cond);
cond = isl_set_set_tuple_id (cond, isl_set_get_tuple_id (pbb->domain));
pbb->domain = isl_set_coalesce (isl_set_intersect (pbb->domain, cond));
- return true;
}
/* Add conditions to the domain of PBB. */
-static bool
+static void
add_conditions_to_domain (poly_bb_p pbb)
{
unsigned int i;
@@ -516,7 +357,7 @@ add_conditions_to_domain (poly_bb_p pbb)
gimple_poly_bb_p gbb = PBB_BLACK_BOX (pbb);
if (GBB_CONDITIONS (gbb).is_empty ())
- return true;
+ return;
FOR_EACH_VEC_ELT (GBB_CONDITIONS (gbb), i, stmt)
switch (gimple_code (stmt))
@@ -534,36 +375,14 @@ add_conditions_to_domain (poly_bb_p pbb)
if (!GBB_CONDITION_CASES (gbb)[i])
code = invert_tree_comparison (code, false);
- if (!add_condition_to_pbb (pbb, cond_stmt, code))
- return false;
+ add_condition_to_pbb (pbb, cond_stmt, code);
break;
}
- case GIMPLE_SWITCH:
- /* Switch statements are not supported right now - fall through. */
-
default:
gcc_unreachable ();
break;
}
-
- return true;
-}
-
-/* Traverses all the GBBs of the SCOP and add their constraints to the
- iteration domains. */
-
-static bool
-add_conditions_to_constraints (scop_p scop)
-{
- int i;
- poly_bb_p pbb;
-
- FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
- if (!add_conditions_to_domain (pbb))
- return false;
-
- return true;
}
/* Add constraints on the possible values of parameter P from the type
@@ -628,6 +447,29 @@ add_param_constraints (scop_p scop, graphite_dim_t p)
}
}
+/* Assign dimension for each parameter in SCOP and add constraints for the
+ parameters. */
+
+static void
+build_scop_context (scop_p scop)
+{
+ sese_info_p region = scop->scop_info;
+ unsigned nbp = sese_nb_params (region);
+ isl_space *space = isl_space_set_alloc (scop->isl_context, nbp, 0);
+
+ unsigned i;
+ tree e;
+ FOR_EACH_VEC_ELT (region->params, i, e)
+ space = isl_space_set_dim_id (space, isl_dim_param, i,
+ isl_id_for_ssa_name (scop, e));
+
+ scop->param_context = isl_set_universe (space);
+
+ graphite_dim_t p;
+ for (p = 0; p < nbp; p++)
+ add_param_constraints (scop, p);
+}
+
/* Add a constrain to the ACCESSES polyhedron for the alias set of
data reference DR. ACCESSP_NB_DIMS is the dimension of the
ACCESSES polyhedron, DOM_NB_DIMS is the dimension of the iteration
@@ -898,6 +740,19 @@ build_scop_drs (scop_p scop)
build_poly_sr (pbb);
}
+/* Add to the iteration DOMAIN one extra dimension for LOOP->num. */
+
+static isl_set *
+add_iter_domain_dimension (__isl_take isl_set *domain, loop_p loop, scop_p scop)
+{
+ int loop_index = isl_set_dim (domain, isl_dim_set);
+ domain = isl_set_add_dims (domain, isl_dim_set, 1);
+ char name[50];
+ snprintf (name, sizeof(name), "i%d", loop->num);
+ isl_id *label = isl_id_alloc (scop->isl_context, name, NULL);
+ return isl_set_set_dim_id (domain, isl_dim_set, loop_index, label);
+}
+
/* Add constraints to DOMAIN for each loop from LOOP up to CONTEXT. */
static isl_set *
@@ -919,7 +774,7 @@ add_loop_constraints (scop_p scop, __isl_take isl_set *domain, loop_p loop,
if (dump_file)
fprintf (dump_file, "[sese-to-poly] adding one extra dimension to the "
"domain for loop_%d.\n", loop->num);
- domain = isl_set_add_dims (domain, isl_dim_set, 1);
+ domain = add_iter_domain_dimension (domain, loop, scop);
isl_space *space = isl_set_get_space (domain);
/* 0 <= loop_i */
@@ -1014,8 +869,8 @@ add_loop_constraints (scop_p scop, __isl_take isl_set *domain, loop_p loop,
/* Builds the original iteration domains for each pbb in the SCOP. */
static int
-build_iteration_domains (scop_p scop, __isl_keep isl_set *context, int index,
- loop_p context_loop)
+build_iteration_domains (scop_p scop, __isl_keep isl_set *context,
+ int index, loop_p context_loop)
{
loop_p current = pbb_loop (scop->pbbs[index]);
isl_set *domain = isl_set_copy (context);
@@ -1029,9 +884,12 @@ build_iteration_domains (scop_p scop, __isl_keep isl_set *context, int index,
loop_p loop = pbb_loop (pbb);
if (current == loop)
{
+ pbb->iterators = isl_set_copy (domain);
pbb->domain = isl_set_copy (domain);
pbb->domain = isl_set_set_tuple_id (pbb->domain,
isl_id_for_pbb (scop, pbb));
+ add_conditions_to_domain (pbb);
+
if (dump_file)
{
fprintf (dump_file, "[sese-to-poly] set pbb_%d->domain: ",
@@ -1061,28 +919,283 @@ build_iteration_domains (scop_p scop, __isl_keep isl_set *context, int index,
return i;
}
+/* Return true when loop A is nested in loop B. */
-/* Assign dimension for each parameter in SCOP and add constraints for the
- parameters. */
+static bool
+nested_in (loop_p a, loop_p b)
+{
+ return b == find_common_loop (a, b);
+}
-static void
-build_scop_context (scop_p scop)
+/* Return the loop at a specific SCOP->pbbs[*INDEX]. */
+static loop_p
+loop_at (scop_p scop, int *index)
{
- sese_info_p region = scop->scop_info;
- unsigned nbp = sese_nb_params (region);
- isl_space *space = isl_space_set_alloc (scop->isl_context, nbp, 0);
+ return pbb_loop (scop->pbbs[*index]);
+}
- unsigned i;
- tree e;
- FOR_EACH_VEC_ELT (region->params, i, e)
- space = isl_space_set_dim_id (space, isl_dim_param, i,
- isl_id_for_ssa_name (scop, e));
+/* Return the index of any pbb belonging to loop or a subloop of A. */
- scop->param_context = isl_set_universe (space);
+static int
+index_outermost_in_loop (loop_p a, scop_p scop)
+{
+ int i, outermost = -1;
+ int last_depth = -1;
+ poly_bb_p pbb;
+ FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
+ if (nested_in (pbb_loop (pbb), a)
+ && (last_depth == -1
+ || last_depth > (int) loop_depth (pbb_loop (pbb))))
+ {
+ outermost = i;
+ last_depth = loop_depth (pbb_loop (pbb));
+ }
+ return outermost;
+}
- graphite_dim_t p;
- for (p = 0; p < nbp; p++)
- add_param_constraints (scop, p);
+/* Return the index of any pbb belonging to loop or a subloop of A. */
+
+static int
+index_pbb_in_loop (loop_p a, scop_p scop)
+{
+ int i;
+ poly_bb_p pbb;
+ FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
+ if (pbb_loop (pbb) == a)
+ return i;
+ return -1;
+}
+
+static poly_bb_p
+outermost_pbb_in (loop_p loop, scop_p scop)
+{
+ int x = index_pbb_in_loop (loop, scop);
+ if (x == -1)
+ x = index_outermost_in_loop (loop, scop);
+ return scop->pbbs[x];
+}
+
+static isl_schedule *
+add_in_sequence (__isl_take isl_schedule *a, __isl_take isl_schedule *b)
+{
+ gcc_assert (a || b);
+
+ if (!a)
+ return b;
+
+ if (!b)
+ return a;
+
+ return isl_schedule_sequence (a, b);
+}
+
+struct map_to_dimension_data {
+ int n;
+ isl_union_pw_multi_aff *res;
+};
+
+/* Create a function that maps the elements of SET to its N-th dimension and add
+ it to USER->res. */
+
+static isl_stat
+add_outer_projection (__isl_take isl_set *set, void *user)
+{
+ struct map_to_dimension_data *data = (struct map_to_dimension_data *) user;
+ int dim = isl_set_dim (set, isl_dim_set);
+ isl_space *space = isl_set_get_space (set);
+
+ gcc_assert (dim >= data->n);
+ isl_pw_multi_aff *pma
+ = isl_pw_multi_aff_project_out_map (space, isl_dim_set, data->n,
+ dim - data->n);
+ data->res = isl_union_pw_multi_aff_add_pw_multi_aff (data->res, pma);
+
+ isl_set_free (set);
+ return isl_stat_ok;
+}
+
+/* Return SET in which all inner dimensions above N are removed. */
+
+static isl_multi_union_pw_aff *
+outer_projection_mupa (__isl_take isl_union_set *set, int n)
+{
+ gcc_assert (n >= 0);
+ gcc_assert (set);
+ gcc_assert (!isl_union_set_is_empty (set));
+
+ isl_space *space = isl_union_set_get_space (set);
+ isl_union_pw_multi_aff *pwaff = isl_union_pw_multi_aff_empty (space);
+
+ struct map_to_dimension_data data = {n, pwaff};
+
+ if (isl_union_set_foreach_set (set, &add_outer_projection, &data) < 0)
+ data.res = isl_union_pw_multi_aff_free (data.res);
+
+ isl_union_set_free (set);
+ return isl_multi_union_pw_aff_from_union_pw_multi_aff (data.res);
+}
+
+/* Embed SCHEDULE in the constraints of the LOOP domain. */
+
+static isl_schedule *
+add_loop_schedule (__isl_take isl_schedule *schedule, loop_p loop,
+ scop_p scop)
+{
+ poly_bb_p pbb = outermost_pbb_in (loop, scop);
+ isl_set *iterators = pbb->iterators;
+
+ int empty = isl_set_is_empty (iterators);
+ if (empty < 0 || empty)
+ return empty < 0 ? isl_schedule_free (schedule) : schedule;
+
+ isl_space *space = isl_set_get_space (iterators);
+ int loop_index = isl_space_dim (space, isl_dim_set) - 1;
+
+ loop_p ploop = pbb_loop (pbb);
+ while (loop != ploop)
+ {
+ --loop_index;
+ ploop = loop_outer (ploop);
+ }
+
+ isl_local_space *ls = isl_local_space_from_space (space);
+ isl_aff *aff = isl_aff_var_on_domain (ls, isl_dim_set, loop_index);
+ isl_multi_aff *prefix = isl_multi_aff_from_aff (aff);
+ char name[50];
+ snprintf (name, sizeof(name), "L_%d", loop->num);
+ isl_id *label = isl_id_alloc (isl_schedule_get_ctx (schedule),
+ name, NULL);
+ prefix = isl_multi_aff_set_tuple_id (prefix, isl_dim_out, label);
+
+ int n = isl_multi_aff_dim (prefix, isl_dim_in);
+ isl_union_set *domain = isl_schedule_get_domain (schedule);
+ isl_multi_union_pw_aff *mupa = outer_projection_mupa (domain, n);
+ mupa = isl_multi_union_pw_aff_apply_multi_aff (mupa, prefix);
+ return isl_schedule_insert_partial_schedule (schedule, mupa);
+}
+
+/* Build schedule for the pbb at INDEX. */
+
+static isl_schedule *
+build_schedule_pbb (scop_p scop, int *index)
+{
+ poly_bb_p pbb = scop->pbbs[*index];
+ ++*index;
+ isl_set *domain = isl_set_copy (pbb->domain);
+ isl_union_set *ud = isl_union_set_from_set (domain);
+ return isl_schedule_from_domain (ud);
+}
+
+static isl_schedule *build_schedule_loop_nest (scop_p, int *, loop_p);
+
+/* Build the schedule of the loop containing the SCOP pbb at INDEX. */
+
+static isl_schedule *
+build_schedule_loop (scop_p scop, int *index)
+{
+ int max = scop->pbbs.length ();
+ gcc_assert (*index < max);
+ loop_p loop = loop_at (scop, index);
+
+ isl_schedule *s = NULL;
+ while (nested_in (loop_at (scop, index), loop))
+ {
+ if (loop == loop_at (scop, index))
+ s = add_in_sequence (s, build_schedule_pbb (scop, index));
+ else
+ s = add_in_sequence (s, build_schedule_loop_nest (scop, index, loop));
+
+ if (*index == max)
+ break;
+ }
+
+ return add_loop_schedule (s, loop, scop);
+}
+
+/* S is the schedule of the loop LOOP. Embed the schedule S in all outer loops.
+ When CONTEXT_LOOP is null, embed the schedule in all loops contained in the
+ SCOP surrounding LOOP. When CONTEXT_LOOP is non null, only embed S in the
+ maximal loop nest contained within CONTEXT_LOOP. */
+
+static isl_schedule *
+embed_in_surrounding_loops (__isl_take isl_schedule *s, scop_p scop,
+ loop_p loop, int *index, loop_p context_loop)
+{
+ loop_p outer = loop_outer (loop);
+ sese_l region = scop->scop_info->region;
+ if (context_loop == outer
+ || !loop_in_sese_p (outer, region))
+ return s;
+
+ int max = scop->pbbs.length ();
+ if (*index == max
+ || (context_loop && !nested_in (loop_at (scop, index), context_loop))
+ || (!context_loop
+ && !loop_in_sese_p (find_common_loop (outer, loop_at (scop, index)),
+ region)))
+ return embed_in_surrounding_loops (add_loop_schedule (s, outer, scop),
+ scop, outer, index, context_loop);
+
+ bool a_pbb;
+ while ((a_pbb = (outer == loop_at (scop, index)))
+ || nested_in (loop_at (scop, index), outer))
+ {
+ if (a_pbb)
+ s = add_in_sequence (s, build_schedule_pbb (scop, index));
+ else
+ s = add_in_sequence (s, build_schedule_loop (scop, index));
+
+ if (*index == max)
+ break;
+ }
+
+ /* We reached the end of the OUTER loop: embed S in OUTER. */
+ return embed_in_surrounding_loops (add_loop_schedule (s, outer, scop), scop,
+ outer, index, context_loop);
+}
+
+/* Build schedule for the full loop nest containing the pbb at INDEX. When
+ CONTEXT_LOOP is null, build the schedule of all loops contained in the SCOP
+ surrounding the pbb. When CONTEXT_LOOP is non null, only build the maximal loop
+ nest contained within CONTEXT_LOOP. */
+
+static isl_schedule *
+build_schedule_loop_nest (scop_p scop, int *index, loop_p context_loop)
+{
+ gcc_assert (*index != (int) scop->pbbs.length ());
+
+ loop_p loop = loop_at (scop, index);
+ isl_schedule *s = build_schedule_loop (scop, index);
+ return embed_in_surrounding_loops (s, scop, loop, index, context_loop);
+}
+
+/* Build the schedule of the SCOP. */
+
+static bool
+build_original_schedule (scop_p scop)
+{
+ int i = 0;
+ int n = scop->pbbs.length ();
+ while (i < n)
+ {
+ poly_bb_p pbb = scop->pbbs[i];
+ isl_schedule *s = NULL;
+ if (!loop_in_sese_p (pbb_loop (pbb), scop->scop_info->region))
+ s = build_schedule_pbb (scop, &i);
+ else
+ s = build_schedule_loop_nest (scop, &i, NULL);
+
+ scop->original_schedule = add_in_sequence (scop->original_schedule, s);
+ }
+
+ if (dump_file)
+ {
+ fprintf (dump_file, "[sese-to-poly] original schedule:\n");
+ print_isl_schedule (dump_file, scop->original_schedule);
+ }
+ if (!scop->original_schedule)
+ return false;
+ return true;
}
/* Builds the polyhedral representation for a SESE region. */
@@ -1097,11 +1210,7 @@ build_poly_scop (scop_p scop)
while (i < n)
i = build_iteration_domains (scop, scop->param_context, i, NULL);
- if (!add_conditions_to_constraints (scop))
- return false;
-
build_scop_drs (scop);
- build_scop_scattering (scop);
- return true;
+ return build_original_schedule (scop);
}
#endif /* HAVE_isl */
diff --git a/gcc/graphite.h b/gcc/graphite.h
index 7f8a273..7bafd09 100644
--- a/gcc/graphite.h
+++ b/gcc/graphite.h
@@ -200,7 +200,6 @@ struct poly_dr
void new_poly_dr (poly_bb_p, gimple *, enum poly_dr_type,
isl_map *, isl_set *);
-void free_poly_dr (poly_dr_p);
void debug_pdr (poly_dr_p);
void print_pdr (FILE *, poly_dr_p);
@@ -259,19 +258,11 @@ struct poly_bb
The number of variables in the DOMAIN may change and is not
related to the number of loops in the original code. */
isl_set *domain;
+ isl_set *iterators;
/* The data references we access. */
vec<poly_dr_p> drs;
- /* The original scattering. */
- isl_map *schedule;
-
- /* The transformed scattering. */
- isl_map *transformed;
-
- /* A copy of the transformed scattering. */
- isl_map *saved;
-
/* The last basic block generated for this pbb. */
basic_block new_bb;
};
@@ -281,8 +272,6 @@ struct poly_bb
#define PBB_DRS(PBB) (PBB->drs)
extern poly_bb_p new_poly_bb (scop_p, gimple_poly_bb_p);
-extern void free_poly_bb (poly_bb_p);
-extern void debug_loop_vec (poly_bb_p);
extern void print_pbb_domain (FILE *, poly_bb_p);
extern void print_pbb (FILE *, poly_bb_p);
extern void print_scop_context (FILE *, scop_p);
@@ -306,18 +295,17 @@ extern void print_isl_aff (FILE *, isl_aff *);
extern void print_isl_constraint (FILE *, isl_constraint *);
extern void print_isl_schedule (FILE *, isl_schedule *);
extern void debug_isl_schedule (isl_schedule *);
+extern void print_isl_ast (FILE *, isl_ast_node *);
+extern void debug_isl_ast (isl_ast_node *);
extern void debug_isl_set (isl_set *);
extern void debug_isl_map (isl_map *);
extern void debug_isl_union_map (isl_union_map *);
extern void debug_isl_aff (isl_aff *);
extern void debug_isl_constraint (isl_constraint *);
-extern int scop_do_interchange (scop_p);
-extern int scop_do_strip_mine (scop_p, int);
-extern bool scop_do_block (scop_p);
-extern bool flatten_all_loops (scop_p);
-extern bool optimize_isl (scop_p);
-extern void pbb_number_of_iterations_at_time (poly_bb_p, graphite_dim_t, mpz_t);
extern void debug_gmp_value (mpz_t);
+extern void debug_scop_pbb (scop_p scop, int i);
+extern void print_schedule_ast (FILE *, __isl_keep isl_schedule *, scop_p);
+extern void debug_schedule_ast (__isl_keep isl_schedule *, scop_p);
/* The basic block of the PBB. */
@@ -417,8 +405,11 @@ struct scop
/* The context used internally by isl. */
isl_ctx *isl_context;
- /* SCoP final schedule. */
- isl_schedule *schedule;
+ /* SCoP original schedule. */
+ isl_schedule *original_schedule;
+
+ /* SCoP transformed schedule. */
+ isl_schedule *transformed_schedule;
/* The data dependence relation among the data references in this scop. */
isl_union_map *dependence;
@@ -428,10 +419,6 @@ extern scop_p new_scop (edge, edge);
extern void free_scop (scop_p);
extern gimple_poly_bb_p new_gimple_poly_bb (basic_block, vec<data_reference_p>,
vec<scalar_use>, vec<tree>);
-extern void free_gimple_poly_bb (gimple_poly_bb_p);
-extern void print_generated_program (FILE *, scop_p);
-extern void debug_generated_program (scop_p);
-extern int unify_scattering_dimensions (scop_p);
extern bool apply_poly_transforms (scop_p);
/* Set the region of SCOP to REGION. */
@@ -458,9 +445,6 @@ scop_set_nb_params (scop_p scop, graphite_dim_t nb_params)
scop->nb_params = nb_params;
}
-isl_union_map *
-scop_get_dependences (scop_p scop);
-
bool
carries_deps (__isl_keep isl_union_map *schedule,
__isl_keep isl_union_map *deps,
@@ -468,9 +452,10 @@ carries_deps (__isl_keep isl_union_map *schedule,
extern bool build_poly_scop (scop_p);
extern bool graphite_regenerate_ast_isl (scop_p);
-
+extern void scop_get_dependences (scop_p scop);
extern void build_scops (vec<scop_p> *);
extern void dot_all_sese (FILE *, vec<sese_l> &);
extern void dot_sese (sese_l &);
extern void dot_cfg ();
+
#endif
diff --git a/gcc/sese.c b/gcc/sese.c
index 2ecff7d..9ea46c7f 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -581,3 +581,37 @@ scalar_evolution_in_region (const sese_l ®ion, loop_p loop, tree t)
return instantiate_scev (before, loop, t);
}
+
+/* Pretty print edge E to FILE. */
+
+void
+print_edge (FILE *file, const_edge e)
+{
+ fprintf (file, "edge (bb_%d, bb_%d)", e->src->index, e->dest->index);
+}
+
+/* Pretty print sese S to FILE. */
+
+void
+print_sese (FILE *file, const sese_l &s)
+{
+ fprintf (file, "(entry_"); print_edge (file, s.entry);
+ fprintf (file, ", exit_"); print_edge (file, s.exit);
+ fprintf (file, ")\n");
+}
+
+/* Pretty print edge E to STDERR. */
+
+DEBUG_FUNCTION void
+debug_edge (const_edge e)
+{
+ print_edge (stderr, e);
+}
+
+/* Pretty print sese S to STDERR. */
+
+DEBUG_FUNCTION void
+debug_sese (const sese_l &s)
+{
+ print_sese (stderr, s);
+}
diff --git a/gcc/sese.h b/gcc/sese.h
index f481524..e70ebd1 100644
--- a/gcc/sese.h
+++ b/gcc/sese.h
@@ -42,6 +42,11 @@ struct sese_l
edge exit;
};
+void print_edge (FILE *file, const_edge e);
+void print_sese (FILE *file, const sese_l &s);
+void dump_edge (const_edge e);
+void dump_sese (const sese_l &);
+
/* Get the entry of an sese S. */
static inline basic_block
@@ -203,7 +208,7 @@ loop_in_sese_p (struct loop *loop, const sese_l ®ion)
loop_2 is completely contained -> depth 1 */
static inline unsigned int
-sese_loop_depth (sese_l ®ion, loop_p loop)
+sese_loop_depth (const sese_l ®ion, loop_p loop)
{
unsigned int depth = 0;
diff --git a/gcc/testsuite/gcc.dg/graphite/block-0.c b/gcc/testsuite/gcc.dg/graphite/block-0.c
index 0a278f8..4baf79c 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-0.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-0.c
@@ -42,4 +42,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/block-1.c b/gcc/testsuite/gcc.dg/graphite/block-1.c
index 2758404..03a5f83 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-1.c
@@ -45,4 +45,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/block-5.c b/gcc/testsuite/gcc.dg/graphite/block-5.c
index 28a0192..95f08c7 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-5.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-5.c
@@ -54,4 +54,5 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/block-6.c b/gcc/testsuite/gcc.dg/graphite/block-6.c
index 8902a17..0418a34 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-6.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-6.c
@@ -49,4 +49,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/block-pr47654.c b/gcc/testsuite/gcc.dg/graphite/block-pr47654.c
index 2027a3f..c4ffca3 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-pr47654.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-pr47654.c
@@ -21,4 +21,4 @@ main ()
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-0.c b/gcc/testsuite/gcc.dg/graphite/interchange-0.c
index f655e84..3f398ca 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-0.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-0.c
@@ -46,4 +46,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-10.c b/gcc/testsuite/gcc.dg/graphite/interchange-10.c
index 825aafd..4f6be65 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-10.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-10.c
@@ -46,4 +46,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-12.c b/gcc/testsuite/gcc.dg/graphite/interchange-12.c
index 7cdbabe..0012d56 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-12.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-12.c
@@ -53,4 +53,5 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-14.c b/gcc/testsuite/gcc.dg/graphite/interchange-14.c
index 617659c..917e679 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-14.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-14.c
@@ -54,4 +54,5 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-15.c b/gcc/testsuite/gcc.dg/graphite/interchange-15.c
index 3696f41..8e147ad 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-15.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-15.c
@@ -48,4 +48,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-5.c b/gcc/testsuite/gcc.dg/graphite/interchange-5.c
index 4410a17..e578e17 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-5.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-5.c
@@ -46,4 +46,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-6.c b/gcc/testsuite/gcc.dg/graphite/interchange-6.c
index c4500cb..9760ed3 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-6.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-6.c
@@ -47,4 +47,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-8.c b/gcc/testsuite/gcc.dg/graphite/interchange-8.c
index 9df7258..c623a32 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-8.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-8.c
@@ -82,4 +82,5 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "codegen error: reverting back to the original code" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c b/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c
index b43131c..ec6a983 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c
@@ -58,4 +58,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/pr35356-1.c b/gcc/testsuite/gcc.dg/graphite/pr35356-1.c
index 89e6994..1c13a69 100644
--- a/gcc/testsuite/gcc.dg/graphite/pr35356-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/pr35356-1.c
@@ -34,4 +34,5 @@ if (n >= k + 1 && k >= 0) {
*/
-/* { dg-final { scan-tree-dump-times "if \\\(P_9 >= P_10 \\\+ 1 && P_10 >= 0\\\) \\\{" 1 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "if \\\(P_9 >= P_10 \\\+ 1 && P_10 >= 0\\\) \\\{" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-10.c b/gcc/testsuite/gcc.dg/graphite/scop-10.c
index 39ed5d7..ac2c7f9 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-10.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-10.c
@@ -17,7 +17,7 @@ int toto()
b[i+j] = b[i+j-1] + 2;
a[i][i] = 2;
}
-
+
for (k = 1; k < 100; k++)
b[i+k] = b[i+k-5] + 2;
}
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-block-1.c b/gcc/testsuite/gcc.dg/graphite/uns-block-1.c
index 5b61eea..19f358d 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-block-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-block-1.c
@@ -45,4 +45,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c
index a53c98e..2b957f5 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c
@@ -54,4 +54,5 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c
index 1e180c6..960e7ae 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c
@@ -55,4 +55,5 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c
index adac7d4..5c5597f 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c
@@ -49,4 +49,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c
index 04f5b7d..153fc8e 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c
@@ -59,4 +59,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "2" "graphite" } } */
+/* { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "2" "graphite" } } */
diff --git a/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90 b/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90
index a66ddfd..192c5b2 100644
--- a/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90
@@ -24,4 +24,4 @@ Program FOO
end Program FOO
-! { dg-final { scan-tree-dump-times "unsuccessful, reverting back to the original code." "1" "graphite" } }
+! { dg-final { scan-tree-dump-times "codegen error: reverting back to the original code" "1" "graphite" } }
diff --git a/gcc/testsuite/gfortran.dg/graphite/pr14741.f90 b/gcc/testsuite/gfortran.dg/graphite/pr14741.f90
index 50c2e79..057e57e 100644
--- a/gcc/testsuite/gfortran.dg/graphite/pr14741.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/pr14741.f90
@@ -24,4 +24,4 @@ SUBROUTINE mult(A,B,C,N)
ENDDO
END SUBROUTINE mult
-! { dg-final { scan-tree-dump-times "isl AST to Gimple succeeded" "1" "graphite" } }
+! { dg-final { scan-tree-dump-times "isl optimized schedule is identical to the original schedule" "1" "graphite" } }
--
2.5.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 01/15] add more coalescing to simplify constraints
2016-01-15 17:14 [PATCH 01/15] add more coalescing to simplify constraints Sebastian Pop
` (11 preceding siblings ...)
2016-01-15 17:16 ` [PATCH 12/15] new scop schedule Sebastian Pop
@ 2016-01-21 14:22 ` Matthew Wahab
2016-01-21 14:33 ` Matthew Wahab
12 siblings, 1 reply; 15+ messages in thread
From: Matthew Wahab @ 2016-01-21 14:22 UTC (permalink / raw)
To: Sebastian Pop, gcc-patches; +Cc: hiraditya
On 15/01/16 17:14, Sebastian Pop wrote:
> From: Sebastian Pop <s.pop@samsung.com>
>
> 2015-12-30 Aditya Kumar <aditya.k7@samsung.com>
> Sebastian Pop <s.pop@samsung.com>
>
> * graphite-dependences.c (constrain_domain): Add call to isl_*_coalesce.
> (add_pdr_constraints): Same.
> (scop_get_reads): Same.
> (scop_get_must_writes): Same.
> (scop_get_may_writes): Same.
> (scop_get_original_schedule): Same.
> (extend_schedule): Same.
> (apply_schedule_on_deps): Same.
> (carries_deps): Same.
> (compute_deps): Same.
> (scop_get_dependences): Same.
> * graphite-isl-ast-to-gimple.c
> (translate_isl_ast_to_gimple::generate_isl_schedule): Same.
> * graphite-optimize-isl.c (get_schedule_for_band): Same.
> (get_schedule_for_band_list): Same.
> (get_schedule_map): Same.
> (apply_schedule_map_to_scop): Same.
> * graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons): Same.
> (build_loop_iteration_domains): Same.
> (add_condition_to_pbb): Same.
> (add_param_constraints): Same.
> (pdr_add_memory_accesses): Same.
> (pdr_add_data_dimensions): Same.
> ---
> gcc/graphite-dependences.c | 63 ++++++++++++++++++----------------------
> gcc/graphite-isl-ast-to-gimple.c | 2 ++
> gcc/graphite-optimize-isl.c | 12 ++++----
> gcc/graphite-sese-to-poly.c | 28 ++++++++++++------
> 4 files changed, 56 insertions(+), 49 deletions(-)
> diff --git a/gcc/graphite-optimize-isl.c b/gcc/graphite-optimize-isl.c
> index 9626e96..15dd5b0 100644
> --- a/gcc/graphite-optimize-isl.c
> +++ b/gcc/graphite-optimize-isl.c
[..]
> static isl_union_map *
> get_schedule_map (isl_schedule *schedule)
> {
> - isl_band_list *bandList = isl_schedule_get_band_forest (schedule);
> - isl_union_map *schedule_map = get_schedule_for_band_list (bandList);
> + isl_band_list *band_list = isl_schedule_get_band_forest (schedule);
> + isl_union_map *schedule_map = get_schedule_for_band_list (band_list);
> isl_band_list_free (bandList);
> return schedule_map;
> }
Building arm-none-linux-gnueabihf fails at the isl_band_list_free. Shouldn't bandList
be band_list?
Matthew
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 01/15] add more coalescing to simplify constraints
2016-01-21 14:22 ` [PATCH 01/15] add more coalescing to simplify constraints Matthew Wahab
@ 2016-01-21 14:33 ` Matthew Wahab
0 siblings, 0 replies; 15+ messages in thread
From: Matthew Wahab @ 2016-01-21 14:33 UTC (permalink / raw)
To: Sebastian Pop, gcc-patches; +Cc: hiraditya
On 21/01/16 14:22, Matthew Wahab wrote:
> On 15/01/16 17:14, Sebastian Pop wrote:
>> From: Sebastian Pop <s.pop@samsung.com>
>>
>> 2015-12-30 Aditya Kumar <aditya.k7@samsung.com>
>> Sebastian Pop <s.pop@samsung.com>
>>
>> * graphite-dependences.c (constrain_domain): Add call to isl_*_coalesce.
>> (add_pdr_constraints): Same.
>> (scop_get_reads): Same.
>> (scop_get_must_writes): Same.
>> (scop_get_may_writes): Same.
>> (scop_get_original_schedule): Same.
>> (extend_schedule): Same.
>> (apply_schedule_on_deps): Same.
>> (carries_deps): Same.
>> (compute_deps): Same.
>> (scop_get_dependences): Same.
>> * graphite-isl-ast-to-gimple.c
>> (translate_isl_ast_to_gimple::generate_isl_schedule): Same.
>> * graphite-optimize-isl.c (get_schedule_for_band): Same.
>> (get_schedule_for_band_list): Same.
>> (get_schedule_map): Same.
>> (apply_schedule_map_to_scop): Same.
>> * graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons): Same.
>> (build_loop_iteration_domains): Same.
>> (add_condition_to_pbb): Same.
>> (add_param_constraints): Same.
>> (pdr_add_memory_accesses): Same.
>> (pdr_add_data_dimensions): Same.
>> ---
>> gcc/graphite-dependences.c | 63 ++++++++++++++++++----------------------
>> gcc/graphite-isl-ast-to-gimple.c | 2 ++
>> gcc/graphite-optimize-isl.c | 12 ++++----
>> gcc/graphite-sese-to-poly.c | 28 ++++++++++++------
>> 4 files changed, 56 insertions(+), 49 deletions(-)
>
>> diff --git a/gcc/graphite-optimize-isl.c b/gcc/graphite-optimize-isl.c
>> index 9626e96..15dd5b0 100644
>> --- a/gcc/graphite-optimize-isl.c
>> +++ b/gcc/graphite-optimize-isl.c
> [..]
>> static isl_union_map *
>> get_schedule_map (isl_schedule *schedule)
>> {
>> - isl_band_list *bandList = isl_schedule_get_band_forest (schedule);
>> - isl_union_map *schedule_map = get_schedule_for_band_list (bandList);
>> + isl_band_list *band_list = isl_schedule_get_band_forest (schedule);
>> + isl_union_map *schedule_map = get_schedule_for_band_list (band_list);
>> isl_band_list_free (bandList);
>> return schedule_map;
>> }
>
> Building arm-none-linux-gnueabihf fails at the isl_band_list_free. Shouldn't bandList
> be band_list?
Kyrill points out that it's already fixed:
https://gcc.gnu.org/ml/gcc-patches/2016-01/msg01613.html
Matthew
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2016-01-21 14:33 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-15 17:14 [PATCH 01/15] add more coalescing to simplify constraints Sebastian Pop
2016-01-15 17:15 ` [PATCH 02/15] remove unused variable Sebastian Pop
2016-01-15 17:15 ` [PATCH 05/15] remove tiling Sebastian Pop
2016-01-15 17:15 ` [PATCH 11/15] check for unstructured control flow Sebastian Pop
2016-01-15 17:15 ` [PATCH 07/15] check that all loops are valid in the combined region Sebastian Pop
2016-01-15 17:15 ` [PATCH 10/15] rewrite computation of iteration domains Sebastian Pop
2016-01-15 17:15 ` [PATCH 06/15] fix codegen error exposed by compute isl flow patch Sebastian Pop
2016-01-15 17:15 ` [PATCH 03/15] fix PR68343: disable graphite tests for isl 0.14 or earlier Sebastian Pop
2016-01-15 17:15 ` [PATCH 09/15] fix memory leak in scop-detection Sebastian Pop
2016-01-15 17:15 ` [PATCH 08/15] record loops in execution order Sebastian Pop
2016-01-15 17:15 ` [PATCH 13/15] reinstantiate loop blocking Sebastian Pop
2016-01-15 17:15 ` [PATCH 04/15] add missing ast node for isl 0.15 Sebastian Pop
2016-01-15 17:16 ` [PATCH 12/15] new scop schedule Sebastian Pop
2016-01-21 14:22 ` [PATCH 01/15] add more coalescing to simplify constraints Matthew Wahab
2016-01-21 14:33 ` Matthew Wahab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).