diff options
author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-01-26 00:19:20 +0000 |
---|---|---|
committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-01-26 00:19:20 +0000 |
commit | c1616982502fe0efa0bc5b29b5089959f78f55e6 (patch) | |
tree | 6ebff12ef5a02acdce4dfc118ac2c131d99e9cd0 /gcc/graphite-dependences.c | |
parent | 45fc5243185e98347e2b7a40cbebb9c1c1b9aa50 (diff) | |
download | gcc-c1616982502fe0efa0bc5b29b5089959f78f55e6.tar.gz |
new scop schedule for isl-0.15
Keep unchanged the implementation for isl-0.14.
* 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-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::scop_to_isl_ast): Call set_separate_option.
(graphite_regenerate_ast_isl): Add dump.
(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: Declare print_isl_schedule and debug_isl_schedule.
(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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232812 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/graphite-dependences.c')
-rw-r--r-- | gcc/graphite-dependences.c | 123 |
1 files changed, 111 insertions, 12 deletions
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c index 0544700930c..f9d5bc30910 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,6 +168,7 @@ scop_get_may_writes (scop_p scop, vec<poly_bb_p> pbbs) return isl_union_map_coalesce (res); } +#ifndef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS /* Returns all the original schedules in SCOP. */ static isl_union_map * @@ -181,6 +188,7 @@ scop_get_original_schedule (scop_p scop, vec<poly_bb_p> pbbs) return isl_union_map_coalesce (res); } +#endif /* Helper function used on each MAP of a isl_union_map. Computes the maximal output dimension. */ @@ -303,6 +311,95 @@ carries_deps (__isl_keep isl_union_map *schedule, return res; } +#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS +/* 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) +{ + if (scop->dependence) + return; + + 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) + { + fprintf (dump_file, "\n--- Documentation for datarefs dump: ---\n"); + fprintf (dump_file, "Statements on the iteration domain are mapped to" + " array references.\n"); + fprintf (dump_file, " To read the following data references:\n\n"); + fprintf (dump_file, " S_5[i0] -> [106] : i0 >= 0 and i0 <= 3\n"); + fprintf (dump_file, " S_8[i0] -> [1, i0] : i0 >= 0 and i0 <= 3\n\n"); + + fprintf (dump_file, " S_5[i0] is the dynamic instance of statement" + " bb_5 in a loop that accesses all iterations 0 <= i0 <= 3.\n"); + fprintf (dump_file, " [1, i0] is a 'memref' with alias set 1" + " and first subscript access i0.\n"); + fprintf (dump_file, " [106] is a 'scalar reference' which is the sum of" + " SSA_NAME_VERSION 6" + " and --param graphite-max-arrays-per-scop=100\n"); + fprintf (dump_file, "-----------------------\n\n"); + + fprintf (dump_file, "data references (\n"); + fprintf (dump_file, " reads: "); + print_isl_union_map (dump_file, reads); + fprintf (dump_file, " must_writes: "); + print_isl_union_map (dump_file, must_writes); + fprintf (dump_file, " may_writes: "); + print_isl_union_map (dump_file, may_writes); + fprintf (dump_file, ")\n"); + } + + 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) + { + fprintf (dump_file, "data dependences (\n"); + print_isl_union_map (dump_file, dependences); + fprintf (dump_file, ")\n"); + } + + scop->dependence = dependences; +} + +#else + /* Compute the original data dependences in SCOP for all the reads and writes in PBBS. */ @@ -321,9 +418,9 @@ compute_deps (scop_p scop, vec<poly_bb_p> pbbs, isl_union_map **must_waw_no_source, isl_union_map **may_waw_no_source) { - 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 *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); 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); @@ -428,4 +525,6 @@ scop_get_dependences (scop_p scop) return dependences; } +#endif /* HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS */ + #endif /* HAVE_isl */ |