diff options
author | Aditya Kumar <aditya.k7@samsung.com> | 2016-01-26 00:19:20 +0000 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2016-01-26 00:19:20 +0000 |
commit | adba512db0e12d215961958b522b8b2f0ab94ab0 (patch) | |
tree | 6ebff12ef5a02acdce4dfc118ac2c131d99e9cd0 /gcc/graphite-poly.c | |
parent | 1e050c90812529ced914e94ef584d3774b66a360 (diff) | |
download | gcc-adba512db0e12d215961958b522b8b2f0ab94ab0.zip gcc-adba512db0e12d215961958b522b8b2f0ab94ab0.tar.gz gcc-adba512db0e12d215961958b522b8b2f0ab94ab0.tar.bz2 |
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.
Co-Authored-By: Sebastian Pop <s.pop@samsung.com>
From-SVN: r232812
Diffstat (limited to 'gcc/graphite-poly.c')
-rw-r--r-- | gcc/graphite-poly.c | 154 |
1 files changed, 85 insertions, 69 deletions
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c index efa39bf..4c3f550 100644 --- a/gcc/graphite-poly.c +++ b/gcc/graphite-poly.c @@ -86,28 +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) -{ - bool transform_done = 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; -} - /* 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. */ @@ -142,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); @@ -158,9 +136,13 @@ new_poly_bb (scop_p scop, gimple_poly_bb_p black_box) poly_bb_p pbb = XNEW (struct poly_bb); pbb->domain = NULL; +#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS + pbb->iterators = NULL; +#else pbb->schedule = NULL; pbb->transformed = NULL; pbb->saved = NULL; +#endif PBB_SCOP (pbb) = scop; pbb_set_black_box (pbb, black_box); PBB_DRS (pbb).create (3); @@ -171,16 +153,25 @@ 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); + pbb->domain = NULL; +#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS + isl_set_free (pbb->iterators); + pbb->iterators = NULL; +#else isl_map_free (pbb->schedule); + pbb->schedule = NULL; isl_map_free (pbb->transformed); + pbb->transformed = NULL; isl_map_free (pbb->saved); + pbb->saved = NULL; +#endif if (PBB_DRS (pbb).exists ()) FOR_EACH_VEC_ELT (PBB_DRS (pbb), i, pdr) @@ -251,7 +242,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)); @@ -282,7 +273,12 @@ new_scop (edge entry, edge exit) sese_info_p region = new_sese_info (entry, exit); scop_p s = XNEW (struct scop); +#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS + s->original_schedule = NULL; + s->transformed_schedule = NULL; +#else s->schedule = NULL; +#endif s->param_context = NULL; scop_set_region (s, region); s->pbbs.create (3); @@ -309,8 +305,17 @@ free_scop (scop_p scop) scop->drs.release (); isl_set_free (scop->param_context); + scop->param_context = NULL; isl_union_map_free (scop->dependence); scop->dependence = NULL; +#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS + isl_schedule_free (scop->original_schedule); + scop->original_schedule = NULL; + isl_schedule_free (scop->transformed_schedule); + scop->transformed_schedule = NULL; +#else + +#endif XDELETE (scop); } @@ -535,53 +540,61 @@ 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); +#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS + p = isl_printer_set_yaml_style (p, ISL_YAML_STYLE_BLOCK); +#endif p = isl_printer_print_set (p, set); p = isl_printer_print_str (p, "\n"); isl_printer_free (p); } 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); +#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS + p = isl_printer_set_yaml_style (p, ISL_YAML_STYLE_BLOCK); +#endif p = isl_printer_print_map (p, map); p = isl_printer_print_str (p, "\n"); isl_printer_free (p); } 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); +#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS + p = isl_printer_set_yaml_style (p, ISL_YAML_STYLE_BLOCK); +#endif p = isl_printer_print_union_map (p, map); p = isl_printer_print_str (p, "\n"); isl_printer_free (p); } DEBUG_FUNCTION void -debug_isl_union_map (isl_union_map *map) +debug_isl_union_map (__isl_keep isl_union_map *map) { print_isl_union_map (stderr, 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); @@ -590,13 +603,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); @@ -605,46 +618,49 @@ 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); } -/* Returns the number of iterations RES of the loop around PBB at - time(scattering) dimension TIME_DEPTH. */ +void +print_isl_schedule (FILE *f, __isl_keep isl_schedule *s) +{ + isl_printer *p = isl_printer_to_file (the_isl_ctx, f); +#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS + p = isl_printer_set_yaml_style (p, ISL_YAML_STYLE_BLOCK); +#endif + 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_keep isl_schedule *s) +{ + print_isl_schedule (stderr, s); +} 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 */ |