add original schedule to scop

* graphite-optimize-isl.c (optimize_isl): Call isl_union_map_is_equal.
    * graphite-poly.c (new_scop): Initialize original_schedule.
    (free_scop): Free original_schedule.
    * graphite-poly.h (struct scop): Add field original_schedule.
    * graphite-sese-to-poly.c (build_scop_original_schedule): New.
    (build_poly_scop): Call build_scop_original_schedule.

From-SVN: r229910
This commit is contained in:
Abderrazek Zaafrani 2015-11-07 01:32:27 +00:00 committed by Sebastian Pop
parent 504fbc11f4
commit 0473915e63
5 changed files with 80 additions and 4 deletions

View File

@ -1,3 +1,12 @@
2015-11-06 Abderrazek Zaafrani <a.zaafrani@samsung.com>
* graphite-optimize-isl.c (optimize_isl): Call isl_union_map_is_equal.
* graphite-poly.c (new_scop): Initialize original_schedule.
(free_scop): Free original_schedule.
* graphite-poly.h (struct scop): Add field original_schedule.
* graphite-sese-to-poly.c (build_scop_original_schedule): New.
(build_poly_scop): Call build_scop_original_schedule.
2015-11-06 Abderrazek Zaafrani <a.zaafrani@samsung.com>
* graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons): Remove.

View File

@ -441,11 +441,23 @@ optimize_isl (scop_p scop)
#else
isl_union_map *schedule_map = get_schedule_map (schedule);
#endif
apply_schedule_map_to_scop (scop, schedule_map);
isl_schedule_free (schedule);
isl_union_map_free (schedule_map);
return true;
if (isl_union_map_is_equal (scop->original_schedule, schedule_map))
{
if (dump_file && dump_flags)
fprintf (dump_file, "\nISL schedule same as original schedule\n");
isl_schedule_free (schedule);
isl_union_map_free (schedule_map);
return false;
}
else
{
apply_schedule_map_to_scop (scop, schedule_map);
isl_schedule_free (schedule);
isl_union_map_free (schedule_map);
return true;
}
}
#endif /* HAVE_isl */

View File

@ -305,6 +305,7 @@ new_scop (edge entry, edge exit)
scop->must_waw_no_source = NULL;
scop->may_waw_no_source = NULL;
scop_set_region (scop, region);
scop->original_schedule = NULL;
scop->pbbs.create (3);
scop->poly_scop_p = false;
scop->drs.create (3);
@ -341,6 +342,7 @@ free_scop (scop_p scop)
isl_union_map_free (scop->may_waw);
isl_union_map_free (scop->must_waw_no_source);
isl_union_map_free (scop->may_waw_no_source);
isl_union_map_free (scop->original_schedule);
XDELETE (scop);
}

View File

@ -436,6 +436,9 @@ struct scop
*must_war, *may_war, *must_war_no_source, *may_war_no_source,
*must_waw, *may_waw, *must_waw_no_source, *may_waw_no_source;
/* Original schedule of the SCoP. */
isl_union_map *original_schedule;
/* True when the scop has been converted to its polyhedral
representation. */
bool poly_scop_p;

View File

@ -426,6 +426,55 @@ build_scop_minimal_scattering (scop_p scop)
isl_aff_free (static_sched);
}
/* Build the original schedule showing the orginal order of execution
of statement instances.
The following example shows the original schedule:
for (i: ...)
{
for (j: ...)
{
A
}
B
}
C
for (i: ...)
{
D
}
Static schedules for A to D expressed in a union map:
{ S_A[i0, i1] -> [i0, i1]; S_B[i0] -> [i0]; S_C[] -> []; S_9[i0] -> [i0] }
*/
static void
build_scop_original_schedule (scop_p scop)
{
isl_space *space = isl_set_get_space (scop->param_context);
isl_union_map *res = isl_union_map_empty (space);
int i;
poly_bb_p pbb;
FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
{
int nb_dimensions = isl_set_dim (pbb->domain, isl_dim_set);
isl_space *dc = isl_set_get_space (pbb->domain);
isl_space *dm = isl_space_add_dims (isl_space_from_domain (dc),
isl_dim_out, nb_dimensions);
isl_map *mp = isl_map_universe (dm);
for (int i = 0; i < nb_dimensions; i++)
mp = isl_map_equate (mp, isl_dim_in, i, isl_dim_out, i);
res = isl_union_map_add_map (res, mp);
}
scop->original_schedule = res;
}
static isl_pw_aff *extract_affine (scop_p, tree, __isl_take isl_space *space);
/* Extract an affine expression from the chain of recurrence E. */
@ -1799,6 +1848,7 @@ build_poly_scop (scop_p scop)
build_scop_drs (scop);
build_scop_minimal_scattering (scop);
build_scop_original_schedule (scop);
/* This SCoP has been translated to the polyhedral
representation. */